Exemplo n.º 1
0
  private void printServerNode(int level, String serverName) {
    printlnAtLevel(level, "[Printing list for Server = " + serverName + "]");
    String pattern = serverName + "/...";
    if (level == 0) pattern = "/" + pattern;
    printlnAtLevel(level, "[Pattern = " + pattern + "]");
    ChannelTree tr = getChannelTree(pattern);

    if (tr == null) {
      printlnAtLevel(level, "[no tree]");
      return;
    }
    Iterator i = tr.rootIterator();
    if (!i.hasNext()) {
      printlnAtLevel(level, "[empty root list]");
      return;
    }

    // the first node should be for the requested serverName
    ChannelTree.Node node = (ChannelTree.Node) i.next();
    if (!node.getType().toString().equals("Server")) {
      printlnAtLevel(level, "[unexpected non-Server node type = " + node.getType() + "]");
      return;
    }

    if (!node.getName().equals(serverName)) {
      printlnAtLevel(level, "[unexpected node name = " + node.getName() + "]");
      return;
    }

    printlnAtLevel(
        level, node.getName() + " -- " + node.getFullName() + " (" + node.getType() + ")");

    printChildren(level + 1, node);
  }
Exemplo n.º 2
0
  private void printChildren(int level, ChannelTree.Node node) {
    // iterate through children of hirarchy
    List l = node.getChildren();
    Iterator i = l.iterator();

    while (i.hasNext()) {
      node = (ChannelTree.Node) i.next();

      printlnAtLevel(
          level, node.getName() + " -- " + node.getFullName() + " (" + node.getType() + ")");

      if (node.getType().toString().equals("Server")) printServerNode(level + 1, node.getName());
      else {
        printChildren(level + 1, node);
      }
    }
  }
Exemplo n.º 3
0
  private void exec() {
    connect();
    ChannelTree t = getChannelTree("/...");
    Iterator i = t.rootIterator();
    int level = 0;
    if (!i.hasNext()) {
      printlnAtLevel(level, "[empty root list]");
    }

    // the first node should be for the requested serverName
    ChannelTree.Node node = (ChannelTree.Node) i.next();
    if (!node.getType().toString().equals("Server")) {
      printlnAtLevel(level, "[unexpected non-Server node type = " + node.getType() + "]");
      return;
    }

    String serverName = node.getName();

    printServerNode(level, serverName);
  }
  private void setupChannelList() {
    channelPathList = new Vector();

    if ((channelPathPattern != null) && !channelPathPattern.equals(""))
      appendChannelListFromPattern();
    if ((channelPathListString != null) && !channelPathListString.equals(""))
      appendChannelListFromString();

    Iterator channels = channelPathList.iterator();
    if (!channels.hasNext()) {
      System.out.println("DataVideoGather: No data channels to monitor.");
      this.printUsage();
      System.exit(0);
    }

    channelPathArray = new String[channelPathList.size()];
    shortNameArray = new String[channelPathList.size()];
    for (int i = 0; i < channelPathArray.length; i++) {
      ChannelTree.Node candidate = (ChannelTree.Node) channels.next();
      channelPathArray[i] = candidate.getFullName();
      shortNameArray[i] = candidate.getName();
    }
  }