Esempio n. 1
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    int serverId = illegalServerId;

    try {
      // determine the server id
      if (cmdArgs.length == 2)
        if (cmdArgs[0].equals("-serverid")) serverId = (Integer.valueOf(cmdArgs[1])).intValue();
        else if (cmdArgs[0].equals("-applicationName"))
          serverId = ServerTool.getServerIdForAlias(orb, cmdArgs[1]);

      if (serverId == illegalServerId) return parseError;

      // startup the server
      Activator activator =
          ActivatorHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));
      activator.activate(serverId);

      out.println(CorbaResourceUtil.getText("servertool.startserver2"));
    } catch (ServerNotRegistered ex) {
      out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
    } catch (ServerAlreadyActive ex) {
      out.println(CorbaResourceUtil.getText("servertool.serverup"));
    } catch (ServerHeldDown ex) {
      out.println(CorbaResourceUtil.getText("servertool.helddown"));
    } catch (Exception ex) {
      ex.printStackTrace();
    }
    return commandDone;
  }
Esempio n. 2
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {

    int serverId = illegalServerId;

    try {
      if (cmdArgs.length == 2) {
        if (cmdArgs[0].equals("-serverid")) serverId = (Integer.valueOf(cmdArgs[1])).intValue();
        else if (cmdArgs[0].equals("-applicationName"))
          serverId = ServerTool.getServerIdForAlias(orb, cmdArgs[1]);
      }

      // the server id has to be specified
      if (serverId == illegalServerId) return parseError;
      // activate the server
      Activator activator =
          ActivatorHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));

      String[] orbList = activator.getORBNames(serverId);

      out.println(CorbaResourceUtil.getText("servertool.orbidmap2"));

      for (int i = 0; i < orbList.length; i++) {
        out.println("\t " + orbList[i]);
      }
    } catch (ServerNotRegistered ex) {
      out.println("\tno such server found.");
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return commandDone;
  }
Esempio n. 3
0
 public static synchronized org.omg.CORBA.TypeCode type() {
   if (__typeCode == null) {
     __typeCode =
         org.omg
             .CORBA
             .ORB
             .init()
             .create_interface_tc(
                 com.sun.corba.se.spi.activation.ActivatorHelper.id(), "Activator");
   }
   return __typeCode;
 }
Esempio n. 4
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    int serverId = illegalServerId;

    try {
      if (cmdArgs.length == 2) {
        if (cmdArgs[0].equals("-serverid")) serverId = (Integer.valueOf(cmdArgs[1])).intValue();
        else if (cmdArgs[0].equals("-applicationName"))
          serverId = ServerTool.getServerIdForAlias(orb, cmdArgs[1]);
      }

      // the server id has to be specified
      if (serverId == illegalServerId) return parseError;

      // deactivate server, hold it down and and unregister it
      // deactivate the server
      try {
        Activator activator =
            ActivatorHelper.narrow(
                orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));
        activator.uninstall(serverId);
      } catch (ServerHeldDown ex) {
      }

      // unregister the server from the repository
      Repository repository =
          RepositoryHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_REPOSITORY_NAME));
      repository.unregisterServer(serverId);

      // print success message
      out.println(CorbaResourceUtil.getText("servertool.unregister2"));
    } catch (ServerNotRegistered ex) {
      out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return commandDone;
  }
Esempio n. 5
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    ServerDef serverDef;

    // process the list active servers command
    try {
      Repository repository =
          RepositoryHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_REPOSITORY_NAME));

      Activator activator =
          ActivatorHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));

      int[] servers = activator.getActiveServers();

      out.println(CorbaResourceUtil.getText("servertool.list2"));

      ListServers.sortServers(servers);
      for (int i = 0; i < servers.length; i++) {
        try {
          serverDef = repository.getServer(servers[i]);
          out.println(
              "\t   "
                  + servers[i]
                  + "\t\t"
                  + serverDef.serverName
                  + "\t\t"
                  + serverDef.applicationName);
        } catch (ServerNotRegistered e) {
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return commandDone;
  }
Esempio n. 6
0
  public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) {
    int i = 0;
    String applicationName = "";
    String name = "";
    String classpath = "";
    String args = "";
    String vmargs = "";
    int serverId = 0;

    // parse register server command
    String arg;
    while (i < cmdArgs.length) {

      arg = cmdArgs[i++];

      if (arg.equals("-server")) {
        if (i < cmdArgs.length) name = cmdArgs[i++];
        else return parseError;
      } else if (arg.equals("-applicationName")) {
        if (i < cmdArgs.length) applicationName = cmdArgs[i++];
        else return parseError;
      } else if (arg.equals("-classpath")) {
        if (i < cmdArgs.length) classpath = cmdArgs[i++];
        else return parseError;
      } else if (arg.equals("-args")) {
        while ((i < cmdArgs.length) && !cmdArgs[i].equals("-vmargs")) {
          args = args.equals("") ? cmdArgs[i] : args + " " + cmdArgs[i];
          i++;
        }
        if (args.equals("")) return parseError;
      } else if (arg.equals("-vmargs")) {
        while ((i < cmdArgs.length) && !cmdArgs[i].equals("-args")) {
          vmargs = vmargs.equals("") ? cmdArgs[i] : vmargs + " " + cmdArgs[i];
          i++;
        }
        if (vmargs.equals("")) return parseError;
      } else return parseError;
    }

    // minimally the server class name has to be specified
    if (name.equals("")) return parseError;

    // register server and activate it
    try {
      // register the server with the repository
      Repository repository =
          RepositoryHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_REPOSITORY_NAME));

      ServerDef server = new ServerDef(applicationName, name, classpath, args, vmargs);
      serverId = repository.registerServer(server);

      // activate the server
      Activator activator =
          ActivatorHelper.narrow(
              orb.resolve_initial_references(ORBConstants.SERVER_ACTIVATOR_NAME));
      activator.activate(serverId);
      activator.install(serverId);

      // print success message
      out.println(CorbaResourceUtil.getText("servertool.register2", serverId));
    } catch (ServerNotRegistered ex) {
    } catch (ServerAlreadyActive ex) {
    } catch (ServerHeldDown ex) {
      out.println(CorbaResourceUtil.getText("servertool.register3", serverId));
    } catch (ServerAlreadyRegistered ex) {
      out.println(CorbaResourceUtil.getText("servertool.register4", serverId));
    } catch (BadServerDefinition ex) {
      out.println(CorbaResourceUtil.getText("servertool.baddef", ex.reason));
    } catch (Exception ex) {
      ex.printStackTrace();
    }

    return commandDone;
  }
Esempio n. 7
0
 public org.omg.CORBA.TypeCode _type() {
   return com.sun.corba.se.spi.activation.ActivatorHelper.type();
 }
Esempio n. 8
0
 public void _write(org.omg.CORBA.portable.OutputStream o) {
   com.sun.corba.se.spi.activation.ActivatorHelper.write(o, value);
 }
Esempio n. 9
0
 public void _read(org.omg.CORBA.portable.InputStream i) {
   value = com.sun.corba.se.spi.activation.ActivatorHelper.read(i);
 }