use of com.ibm.streams.flow.declare.InputPortDeclaration in project streamsx.topology by IBMStreams.
the class BOperatorInvocation method inputFrom.
public BInputPort inputFrom(BOutput output, BInputPort input) {
if (input != null) {
assert input.operator() == this.op;
assert inputs != null;
output.connectTo(input);
return input;
}
if (inputs == null) {
inputs = new ArrayList<>();
}
InputPortDeclaration inputPort = op.addInput(this.op.getName() + "_IN" + inputs.size(), output.schema());
input = new BInputPort(this, inputPort);
inputs.add(input);
output.connectTo(input);
return input;
}
use of com.ibm.streams.flow.declare.InputPortDeclaration in project streamsx.topology by IBMStreams.
the class EmbeddedGraph method declareInputs.
private void declareInputs(OperatorInvocation<? extends Operator> opDecl, JsonArray inputs) {
if (jisEmpty(inputs))
return;
// Ensure we deal with them in port order.
JsonObject[] ports = new JsonObject[inputs.size()];
for (JsonElement e : inputs) {
JsonObject input = e.getAsJsonObject();
ports[input.get("index").getAsInt()] = input;
}
for (JsonObject input : ports) {
String name = jstring(input, "name");
StreamSchema schema = Type.Factory.getTupleType(jstring(input, "type")).getTupleSchema();
InputPortDeclaration port = opDecl.addInput(name, schema);
assert !inputPorts.containsKey(name);
inputPorts.put(name, port);
if (input.has("window"))
windowInput(input, port);
}
}
use of com.ibm.streams.flow.declare.InputPortDeclaration in project streamsx.topology by IBMStreams.
the class EmbeddedGraph method declareOpConnections.
private void declareOpConnections(JsonObject json) {
JsonArray outputs = json.getAsJsonArray("outputs");
if (jisEmpty(outputs))
return;
for (JsonElement e : outputs) {
JsonObject output = e.getAsJsonObject();
String name = jstring(output, "name");
JsonArray conns = output.getAsJsonArray("connections");
if (jisEmpty(conns))
continue;
OutputPortDeclaration port = requireNonNull(outputPorts.get(name));
for (JsonElement c : conns) {
String iname = c.getAsString();
InputPortDeclaration iport = requireNonNull(inputPorts.get(iname));
port.connect(iport);
}
}
}
Aggregations