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; }
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; }
public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) { int serverId = illegalServerId; String orbId = ""; try { // parse command String arg; int i = 0; while (i < cmdArgs.length) { arg = cmdArgs[i++]; if (arg.equals("-serverid")) { if (i < cmdArgs.length) serverId = (Integer.valueOf(cmdArgs[i++])).intValue(); else return parseError; } else if (arg.equals("-applicationName")) { if (i < cmdArgs.length) serverId = ServerTool.getServerIdForAlias(orb, cmdArgs[i++]); else return parseError; } else if (arg.equals("-orbid")) { if (i < cmdArgs.length) orbId = cmdArgs[i++]; } } // the server id has to be specified if (serverId == illegalServerId) return parseError; // locate the server // deactivate the server Locator locator = LocatorHelper.narrow(orb.resolve_initial_references(ORBConstants.SERVER_LOCATOR_NAME)); ServerLocationPerORB location = locator.locateServerForORB(serverId, orbId); // print success message out.println(CorbaResourceUtil.getText("servertool.locateorb2", location.hostname)); int numEntries = location.ports.length; for (i = 0; i < numEntries; i++) { EndPointInfo Port = location.ports[i]; out.println("\t\t" + Port.port + "\t\t" + Port.endpointType + "\t\t" + orbId); } } catch (InvalidORBid ex) { out.println(CorbaResourceUtil.getText("servertool.nosuchorb")); } catch (ServerHeldDown ex) { out.println(CorbaResourceUtil.getText("servertool.helddown")); } catch (ServerNotRegistered ex) { out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); } catch (Exception ex) { ex.printStackTrace(); } return commandDone; }
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; }
public static void main(String[] args) { ServerTool tool = new ServerTool(); tool.run(args); }