use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class OfflineConverter method toJSON.
@Override
public JSONObject toJSON(Offline o) {
JSONObject c = new JSONObject();
c.put("id", getJSONId());
c.put("node", JSONs.elementToJSON(o.getInvolvedNodes().iterator().next()));
return c;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class QuarantineConverter method toJSON.
@Override
public JSONObject toJSON(Quarantine o) {
JSONObject c = new JSONObject();
c.put("id", getJSONId());
c.put("node", JSONs.elementToJSON(o.getInvolvedNodes().iterator().next()));
return c;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ResourceCapacityConverter method toJSON.
@Override
public JSONObject toJSON(ResourceCapacity o) {
JSONObject c = new JSONObject();
c.put("id", getJSONId());
c.put("nodes", nodesToJSON(o.getInvolvedNodes()));
c.put("rc", o.getResource());
c.put("amount", o.getAmount());
c.put("continuous", o.isContinuous());
return c;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class RunningCapacityConverter method toJSON.
@Override
public JSONObject toJSON(RunningCapacity o) {
JSONObject c = new JSONObject();
c.put("id", getJSONId());
c.put("nodes", nodesToJSON(o.getInvolvedNodes()));
c.put("amount", o.getAmount());
return c;
}
use of net.minidev.json.JSONObject in project scheduler by btrplace.
the class ConstraintsConverter method fromJSON.
/**
* Convert a json-encoded constraint.
*
* @param mo the model to rely on
* @param in the constraint to decode
* @return the resulting constraint
* @throws JSONConverterException if the conversion failed
*/
public Constraint fromJSON(Model mo, JSONObject in) throws JSONConverterException {
checkKeys(in, "id");
Object id = in.get("id");
ConstraintConverter<? extends Constraint> c = json2java.get(id.toString());
if (c == null) {
throw new JSONConverterException("No converter available for a constraint having id '" + id + "'");
}
return c.fromJSON(mo, in);
}
Aggregations