/** * Inicializa la comunicación con el servidor. * * @throws RequestException es lanzada cuando no se puede establecer la comunicación el servidor */ protected void activeCommunication() throws RequestException { try { OutputMonitor.printLine("Initialize communication", OutputMonitor.INFORMATION_MESSAGE); // iniciar el entorno de ejecución de ICE if (communication.isInitialize()) { communication.reset(); } else { communication.initialize(this.args); } SettingProperties.loadSettingProperies(); ApplicationContext.initContext(); String host = cnxServer.getServerHost(); int serverPort = cnxServer.getServerPort(); int clientPort = clientSetting.getPortNumber(); OutputMonitor.printLine("Server host: " + host, OutputMonitor.INFORMATION_MESSAGE); OutputMonitor.printLine("Server port: " + serverPort, OutputMonitor.INFORMATION_MESSAGE); OutputMonitor.printLine( "Server name: " + cnxServer.getServerName(), OutputMonitor.INFORMATION_MESSAGE); OutputMonitor.printLine( "Container name: " + cnxServer.getContainerName(), OutputMonitor.INFORMATION_MESSAGE); OutputMonitor.printLine( "Session name: " + cnxServer.getSessionName(), OutputMonitor.INFORMATION_MESSAGE); OutputMonitor.printLine( "File store name: " + cnxServer.getFileStoreName(), OutputMonitor.INFORMATION_MESSAGE); if (clientPort <= 0) { clientPort = (clientPort <= 0) ? Utilities.getAvailablePort() : clientPort; clientSetting.setPortNumber(clientPort); } this.appManager = new ApplicationManager(communication, netController, clientPort); this.appManager.activate(); this.server = new DelegateServerManager(communication, cnxServer.getServerName(), host, serverPort); this.server.create(); // se establece la comunicación con el proxy del servidor this.container = server.getDlgSessionContainer(cnxServer.getContainerName()); this.session = container.getNoPersistentSessionByName( cnxServer.getSessionName(), Invocation.SYNCHRONOUS_METHOD_INVOCATION); this.session.setCommunication(container.getCommunication()); this.fileStore = new DelegateFileStore(communication, cnxServer.getFileStoreName(), host, serverPort); this.fileStore.create(); this.startedCommunication = true; OutputMonitor.printLine("Initialized communication", OutputMonitor.INFORMATION_MESSAGE); } catch (Exception ex) { throw new RequestException(ex.getMessage()); } }
/** * Captura los valores pasados por parámetros, para la configuración de la aplicacion * * @param args argumentos para la incialización de la aplicación */ protected void initValues(String[] args) { // - sh -sp -cp Map m = new HashMap(); for (int i = 0; i < args.length - 1; i++) { m.put(args[i], args[i + 1]); } this.cnxServer.setServerHost( m.containsKey("-sh") ? m.get("-sh").toString() : this.cnxServer.getServerHost()); this.cnxServer.setServerPort( m.containsKey("-sp") ? Integer.parseInt(m.get("-sp").toString()) : this.cnxServer.getServerPort()); clientSetting.setPortNumber( m.containsKey("-cp") ? Integer.parseInt(m.get("-cp").toString()) : clientSetting.getPortNumber()); }