Exemplo n.º 1
0
  public void removeStream(StreamDataSource stream) {
    Iterator it = streams.iterator();
    while (it.hasNext()) {
      StreamDataSource sds = (StreamDataSource) it.next();
      sds.removeStream(stream);
    }

    streams.remove(stream);
    fireRemovedEvent(stream);
  }
Exemplo n.º 2
0
 public void addRequestForStream(StreamDataSource sds, int serial) {
   if (afterLoadMap.containsKey(sds)) {
     List sList = (List) afterLoadMap.get(sds);
     sList.add(new Integer(serial));
   } else {
     List sList = new LinkedList();
     sList.add(new Integer(serial));
     afterLoadMap.put(sds, sList);
   }
 }
Exemplo n.º 3
0
  public void saveStreams() throws IOException {
    Config config = Config.getConfiguration("manager.streams");

    config.setArray("streams", streams.toArray());

    Iterator it = streams.iterator();
    while (it.hasNext()) {
      DataSource ds = (DataSource) it.next();
      ds.save();
    }

    config.save();
  }
Exemplo n.º 4
0
  private void fireAddedEvent(StreamDataSource sds) {
    Iterator it = listeners.iterator();

    while (it.hasNext()) {
      ((StreamManagerListener) it.next()).streamAdded(sds);
    }
  }
Exemplo n.º 5
0
 private void addDefault(StreamDataSource sds) {
   Iterator it = defaultProcs.iterator();
   while (it.hasNext()) {
     FlowProcessor proc = (FlowProcessor) it.next();
     sds.registerRaw(proc);
   }
 }
Exemplo n.º 6
0
  public void loadStreams() throws Exception {
    Config config = Config.getConfiguration("manager.streams");
    afterLoadMap = new HashMap();
    Object[] names = config.getArray("streams", null);

    if (names == null) {
      return;
    }

    for (int i = 0; i < names.length; i++) {
      StreamDataSource sds = new StreamDataSource(names[i].toString());
      sds.load();
      sds.initiate();
      addStreamNoFire(sds);
      addDefault(sds);
    }

    Iterator it = afterLoadMap.keySet().iterator();
    while (it.hasNext()) {
      StreamDataSource sds = (StreamDataSource) it.next();
      List sList = (List) afterLoadMap.get(sds);

      Iterator addIt = sList.iterator();
      while (addIt.hasNext()) {
        Integer serial = (Integer) addIt.next();
        StreamDataSource addStream = getStream(serial.intValue());
        if (addStream != null) {
          sds.addStream(addStream);
        } else {
          logger.warn("Unable to find source (" + serial + ") for " + sds);
        }
      }
    }

    afterLoadMap = null;
  }
Exemplo n.º 7
0
 private void addStreamNoFire(StreamDataSource stream) {
   streams.add(stream);
   serialToStream.put(new Integer(stream.getSerial()), stream);
 }
Exemplo n.º 8
0
 public void removeStreamManagerListener(StreamManagerListener l) {
   listeners.remove(l);
 }
Exemplo n.º 9
0
 public void addStreamManagerListener(StreamManagerListener l) {
   listeners.add(l);
 }
Exemplo n.º 10
0
 public void removeDefaultProcs(FlowProcessor proc) {
   defaultProcs.remove(proc);
 }
Exemplo n.º 11
0
 public void addDefaultProcs(FlowProcessor proc) {
   if (proc != null) {
     defaultProcs.add(proc);
   }
 }