Esempio n. 1
0
  public void connectGraph() {
    // make sure I have some elements - not sure what to do otherwise
    assert !streamElements.isEmpty();

    // go through the list and connect it together:
    ListIterator<Stream> childIter;
    childIter = (ListIterator<Stream>) streamElements.iterator();
    Stream source = null;

    while (childIter.hasNext()) {
      // advance the iterator:
      Stream sink = childIter.next();
      assert sink != null;

      // setup the sink itself
      sink.setupOperator();

      if (source != null && source.getOutputChannel() != null) {
        // create and connect a pass filter
        ChannelConnectFilter connect = new ChannelConnectFilter();
        Channel in = source.getOutputChannel();
        Channel out = sink.getInputChannel();
        connect.useChannels(in, out);
        connect.setupOperator();
      }
      source = sink;
    }

    // set myself up with proper input and output
    {
      inputChannel = streamElements.getFirst().getInputChannel();
      outputChannel = streamElements.getLast().getOutputChannel();
    }
  }