Example #1
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);
   }
 }
Example #2
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;
  }
Example #3
0
 private void addStreamNoFire(StreamDataSource stream) {
   streams.add(stream);
   serialToStream.put(new Integer(stream.getSerial()), stream);
 }
Example #4
0
 public StreamDataSource getStream(int serial) {
   return (StreamDataSource) serialToStream.get(new Integer(serial));
 }