org.voovan.docker.message.task.TaskInfo Maven / Gradle / Ivy
Show all versions of JDocker Show documentation
package org.voovan.docker.message.task;
import org.voovan.docker.message.task.atom.Status;
import org.voovan.tools.json.JSONPath;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
/**
*
* @author helyho
*
* DockerFly Framework.
* WebSite: https://git.oschina.net/helyho/JDocker
* Licence: Apache v2 License
*/
public class TaskInfo {
private String id;
private String createdAt;
private String updatedAt;
private String serviceId;
private String slot;
private String nodeId;
private Status status;
private String desiredState;
public TaskInfo() {
status = new Status();
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getCreatedAt() {
return createdAt;
}
public void setCreatedAt(String createdAt) {
this.createdAt = createdAt;
}
public String getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(String updatedAt) {
this.updatedAt = updatedAt;
}
public String getServiceId() {
return serviceId;
}
public void setServiceId(String serviceId) {
this.serviceId = serviceId;
}
public String getSlot() {
return slot;
}
public void setSlot(String slot) {
this.slot = slot;
}
public String getNodeId() {
return nodeId;
}
public void setNodeId(String nodeId) {
this.nodeId = nodeId;
}
public Status getStatus() {
return status;
}
public void setStatus(Status status) {
this.status = status;
}
public String getDesiredState() {
return desiredState;
}
public void setDesiredState(String desiredState) {
this.desiredState = desiredState;
}
public static List load(String jsonStr) throws ParseException, ReflectiveOperationException {
if(!jsonStr.trim().startsWith("[")){
jsonStr = "["+jsonStr+"]";
}
JSONPath jsonPath = JSONPath.newInstance(jsonStr);
List taskInfos = jsonPath.listObject("/", TaskInfo.class, new ArrayList());
return taskInfos;
}
}