builder.addAttribute(new TraceSettingAttribute(setting, counter.incrementAndGet()));
builder.addAttribute(Connectivity.OPTIONAL);
if (setting.getMode() == Mode.STRICT) {
builder.addAttribute(ObservationCount.EXACTLY_ONCE);
port.disconnectAll();
FlowElementResolver resolver = builder.toResolver();
FlowElementInput input = resolver.getInput(INPUT_PORT_NAME);
for (FlowElementOutput upstream : upstreams) {
PortConnection.connect(upstream, input);
}
FlowElementOutput output = resolver.getOutput(OUTPUT_PORT_NAME);
for (FlowElementInput downstream : downstreams) {
PortConnection.connect(output, downstream);
}
} else if (setting.getMode() == Mode.IN_ORDER) {
builder.addAttribute(ObservationCount.AT_LEAST_ONCE);
port.disconnectAll();
FlowElementResolver resolver = builder.toResolver();
FlowElementInput input = resolver.getInput(INPUT_PORT_NAME);
for (FlowElementOutput upstream : upstreams) {
PortConnection.connect(upstream, input);
}
FlowElementOutput output = resolver.getOutput(OUTPUT_PORT_NAME);
for (FlowElementInput downstream : downstreams) {
PortConnection.connect(output, downstream);
}
} else if (setting.getMode() == Mode.OUT_OF_ORDER) {
builder.addAttribute(ObservationCount.AT_LEAST_ONCE);
FlowElementResolver resolver = builder.toResolver();
FlowElementInput input = resolver.getInput(INPUT_PORT_NAME);
for (FlowElementOutput upstream : upstreams) {
PortConnection.connect(upstream, input);
}
}
}