use of org.platformlayer.jobs.model.JobData in project platformlayer by platformlayer.
the class DeleteItem method formatRaw.
@Override
public void formatRaw(Object o, PrintWriter writer) {
JobData jobData = (JobData) o;
writer.println(jobData.getJobId());
}
use of org.platformlayer.jobs.model.JobData in project platformlayer by platformlayer.
the class DoAction method runCommand.
@Override
public Object runCommand() throws PlatformLayerClientException {
String json;
try {
JSONObject data;
if (this.json != null) {
data = new JSONObject(this.json);
} else {
data = new JSONObject();
}
data.put("type", action.getKey());
json = data.toString();
} catch (JSONException e) {
throw new IllegalStateException("Error building JSON", e);
}
PlatformLayerClient client = getPlatformLayerClient();
PlatformLayerKey key = path.resolve(getContext());
JobData ret = client.doAction(key, json, Format.JSON);
return ret;
}
use of org.platformlayer.jobs.model.JobData in project platformlayer by platformlayer.
the class DoAction method formatRaw.
@Override
public void formatRaw(Object o, PrintWriter writer) {
JobData jobData = (JobData) o;
writer.println(jobData.getJobId());
}
use of org.platformlayer.jobs.model.JobData in project platformlayer by platformlayer.
the class FederatedPlatformLayerClient method doAction.
@Override
public JobData doAction(PlatformLayerKey key, Action action) throws PlatformLayerClientException {
MappedPlatformLayerKey mapped = mapToChild(key);
JobData result = mapped.child.client.doAction(mapped.key, action);
return mapped.child.setHost(result);
}
use of org.platformlayer.jobs.model.JobData in project platformlayer by platformlayer.
the class ListJobs method formatRaw.
@Override
public void formatRaw(Object o, PrintWriter writer) {
JobDataList jobs = (JobDataList) o;
switch(getFormat()) {
case JSON:
JsonHelper<JobDataList> jsonHelper = JsonHelper.build(JobDataList.class);
boolean formatted = true;
try {
String json = jsonHelper.marshal(jobs, formatted);
writer.println(json);
return;
} catch (IOException e) {
throw new CliException("Error formatting for output", e);
}
}
Ansi ansi = new Ansi(writer);
for (JobData job : jobs.getJobs()) {
// JobState state = job.state;
// if (state != null) {
// ansi.setColorBlue();
// switch (job.state) {
// case FAILED:
// ansi.setColorRed();
// break;
//
// case SUCCESS:
// ansi.setColorGreen();
// break;
//
// case RUNNING:
// ansi.setColorBlue();
// break;
//
// default:
// ansi.setColorBlue();
// break;
// }
// }
writer.println(job.key);
}
ansi.reset();
}
Aggregations