use of com.ibm.json.java.JSONArray in project streamsx.topology by IBMStreams.
the class PlaceableTest method getResourceTags.
private static Set<String> getResourceTags(BOperator bop) {
JSONObject placement = JOperatorConfig.getJSONItem(bop.json(), PLACEMENT);
if (placement == null)
return null;
JSONArray jat = (JSONArray) placement.get(com.ibm.streamsx.topology.generator.operator.OpProperties.PLACEMENT_RESOURCE_TAGS);
if (jat == null)
return null;
Set<String> tags = new HashSet<>();
for (Object rt : jat) tags.add(rt.toString());
return tags;
}
use of com.ibm.json.java.JSONArray in project streamsx.topology by IBMStreams.
the class BInputPort method complete.
/**
* Add this port information and its connections to output ports, by name.
*/
@Override
public JSONObject complete() {
final JSONObject json = json();
BUtils.addPortInfo(json, port);
JSONArray conns = new JSONArray();
for (StreamConnection c : port().getConnections()) {
conns.add(c.getOutput().getName());
}
json.put("connections", conns);
return json;
}
use of com.ibm.json.java.JSONArray in project streamsx.topology by IBMStreams.
the class BOperator method complete.
@Override
public JSONObject complete() {
JSONObject json = super.complete();
if (regions != null) {
JSONArray ra = new JSONArray();
ra.addAll(regions);
json.put("regions", ra);
}
return json;
}
use of com.ibm.json.java.JSONArray in project streamsx.topology by IBMStreams.
the class BOutputPort method complete.
@Override
public JSONObject complete() {
final JSONObject json = json();
BUtils.addPortInfo(json, port);
JSONArray conns = new JSONArray();
for (StreamConnection c : port().getConnections()) {
conns.add(c.getInput().getName());
}
json.put("connections", conns);
return json;
}
use of com.ibm.json.java.JSONArray in project streamsx.topology by IBMStreams.
the class BOperatorInvocation method complete.
@Override
public JSONObject complete() {
final JSONObject json = super.complete();
if (outputs != null) {
JSONArray oa = new JSONArray(outputs.size());
for (BOutputPort output : outputs) {
oa.add(output.complete());
}
json.put("outputs", oa);
}
if (inputs != null) {
JSONArray ia = new JSONArray(inputs.size());
for (BInputPort input : inputs) {
ia.add(input.complete());
}
json.put("inputs", ia);
}
return json;
}
Aggregations