org.voovan.docker.message.container.ContainerInfo Maven / Gradle / Ivy
Show all versions of JDocker Show documentation
package org.voovan.docker.message.container;
import org.voovan.docker.message.container.atom.HostConfig;
import org.voovan.docker.message.container.atom.Mount;
import org.voovan.docker.message.container.atom.NetworkSettings;
import org.voovan.docker.message.container.atom.Port;
import org.voovan.tools.json.JSONPath;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* @author helyho
*
* DockerFly Framework.
* WebSite: https://git.oschina.net/helyho/JDocker
* Licence: Apache v2 License
*/
public class ContainerInfo {
private String id;
private List names;
private String image;
private Long sizeRootFs;
private String imageId;
private String command;
private Long created;
private List ports;
private String state;
private String status;
private HostConfig hostConfig;
private NetworkSettings networkSettings;
private List mounts;
private Map labels;
public ContainerInfo() {
labels = new HashMap();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public List getNames() {
return names;
}
public void setNames(List names) {
this.names = names;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public Long getSizeRootFs() {
return sizeRootFs;
}
public void setSizeRootFs(Long sizeRootFs) {
this.sizeRootFs = sizeRootFs;
}
public String getImageId() {
return imageId;
}
public void setImageId(String imageId) {
this.imageId = imageId;
}
public String getCommand() {
return command;
}
public void setCommand(String command) {
this.command = command;
}
public Long getCreated() {
return created;
}
public void setCreated(Long created) {
this.created = created;
}
public List getPorts() {
return ports;
}
public void setPorts(List ports) {
this.ports = ports;
}
public Map getLabels() {
return labels;
}
public void setLabels(Map labels) {
this.labels = labels;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public HostConfig getHostConfig() {
return hostConfig;
}
public void setHostConfig(HostConfig hostConfig) {
this.hostConfig = hostConfig;
}
public NetworkSettings getNetworkSettings() {
return networkSettings;
}
public void setNetworkSettings(NetworkSettings networkSettings) {
this.networkSettings = networkSettings;
}
public List getMounts() {
return mounts;
}
public void setMounts(List mounts) {
this.mounts = mounts;
}
public static List load(String jsonStr) throws ParseException, ReflectiveOperationException {
if(!jsonStr.trim().startsWith("[")){
jsonStr = "["+jsonStr+"]";
}
JSONPath jsonPath = JSONPath.newInstance(jsonStr);
List containerInfos = jsonPath.listObject("/",ContainerInfo.class,new ArrayList());
return containerInfos;
}
}