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 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);
  }
Exemplo n.º 3
0
  private ChannelTree getChannelTree(String pattern) {

    ChannelTree tr = null;

    try {
      sMap = new ChannelMap();
      if ((pattern != null) && (pattern.length() > 0)) sMap.Add(pattern);
      sink.RequestRegistration(sMap);
      sMap = sink.Fetch(-1, sMap);
      tr = ChannelTree.createFromChannelMap(sMap);

    } catch (SAPIException se) {
      se.printStackTrace();
    }

    return tr;
  }