Ejemplo n.º 1
0
  void run(String[] args) {
    String[] cmd = null;

    // if command specified in the args, get it
    for (int i = 0; i < args.length; i++) {

      if (args[i].equals(commandArg)) {
        // get the command
        int cmdLen = args.length - i - 1;
        cmd = new String[cmdLen];
        for (int j = 0; j < cmdLen; j++) cmd[j] = args[++i];

        break;
      }
    }

    try {
      // create the POA ORB
      Properties props = System.getProperties();
      props.put("org.omg.CORBA.ORBClass", "com.sun.corba.se.impl.orb.ORBImpl");
      orb = (ORB) ORB.init(args, props);

      // if command specified in the args, process it
      if (cmd != null) executeCommand(cmd);
      else { // process commands interactively

        // create a buffered reader to read commands from standard in
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

        // print tool banner
        System.out.println(CorbaResourceUtil.getText("servertool.banner"));

        // process commands until user quits
        while (true) {
          cmd = readCommand(in);
          if (cmd != null) executeCommand(cmd);
          else printAvailableCommands();
        }
      }
    } catch (Exception ex) {
      System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
      System.out.println();
      ex.printStackTrace();
    }
  }
Ejemplo n.º 2
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    System.exit(0);

    return commandDone;
  }