コード例 #1
0
  static int getServerIdForAlias(ORB orb, String applicationName) throws ServerNotRegistered {
    try {
      Repository rep =
          RepositoryHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_REPOSITORY_NAME));
      int serverid = rep.getServerID(applicationName);

      return rep.getServerID(applicationName);
    } catch (Exception ex) {
      throw (new ServerNotRegistered());
    }
  }
コード例 #2
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    if ((cmdArgs.length == 2) && cmdArgs[0].equals("-applicationName")) {
      String str = (String) cmdArgs[1];

      try {
        Repository repository =
            RepositoryHelper.narrow(
                orb.resolve_initial_references(ORBConstants.SERVER_REPOSITORY_NAME));

        try {
          int result = repository.getServerID(str);
          out.println();
          out.println(
              CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
          out.println();
        } catch (ServerNotRegistered e) {
          out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
        }
      } catch (Exception ex) {
        ex.printStackTrace();
      }

      return commandDone;
    } else return parseError;
  }