/** * Returns the ssh service address in format - host:port (example - localhost:32899) * * @param machine machine to retrieve address * @return ssh service address in format host:port */ private String getSshServerAddress(MachineImpl machine) { Optional<ServerImpl> server = machine.getServerByName(SERVER_SSH_REFERENCE); if (server.isPresent()) { return server.get().getUrl(); } return null; }
/** * Returns a top-level URL of the GWT Code Server which is declared in the machine that contains * the "wsagent" server. * * @return {@code Optional} with a top-level URL of the GWT Code Server or an empty {@code * Optional} if none */ private Optional<String> getInternalCodeServerURL() { Optional<MachineImpl> wsAgentServerMachineOpt = wsAgentServerUtil.getWsAgentServerMachine(); if (wsAgentServerMachineOpt.isPresent()) { MachineImpl wsAgentServerMachine = wsAgentServerMachineOpt.get(); Optional<ServerImpl> codeServerOpt = wsAgentServerMachine.getServerByName(INT_CODE_SERVER_REF); if (codeServerOpt.isPresent()) { ServerImpl codeServer = codeServerOpt.get(); String codeServerUrl = codeServer.getUrl(); if (!isNullOrEmpty(codeServerUrl)) { return codeServerUrl.endsWith("/") ? Optional.of(codeServerUrl) : Optional.of(codeServerUrl + '/'); } } } return Optional.empty(); }
private void internalInitialize(String machineName) { final WorkspaceImpl workspace = appContext.getWorkspace(); final RuntimeImpl runtime = workspace.getRuntime(); if (runtime == null) { return; // workspace is stopped } runtime .getMachineByName(machineName) .ifPresent( machine -> { Optional<ServerImpl> execAgentServer = machine.getServerByName(SERVER_EXEC_AGENT_WEBSOCKET_REFERENCE); execAgentServer.ifPresent( server -> initializer.initialize( machine.getName(), singletonMap("url", agentURLModifier.modify(server.getUrl())))); }); } }
@Override protected ActionGroup updateActions() { final DefaultActionGroup actionGroup = new DefaultActionGroup(actionManager); Map<String, MachineImpl> machines = appContext.getWorkspace().getRuntime().getMachines(); for (MachineImpl machine : machines.values()) { Separator separ = new Separator(machine.getName() + ":"); actionGroup.add(separ); if (machine.getServerByName(SERVER_TERMINAL_REFERENCE).isPresent()) { NewTerminalMenuAction newTerminalMenuAction = new NewTerminalMenuAction( coreLocalizationConstant, machineResources, machine.getName()); actionGroup.add(newTerminalMenuAction); } if (machine.getServerByName(SERVER_SSH_REFERENCE).isPresent()) { AddSSHMenuAction addSSHMenuAction = new AddSSHMenuAction(machine.getName()); actionGroup.add(addSSHMenuAction); } ShowServersAction showServersAction = new ShowServersAction(machine.getName()); actionGroup.add(showServersAction); ShowMachineOutputAction showMachineOutputAction = new ShowMachineOutputAction(machine.getName()); actionGroup.add(showMachineOutputAction); } return actionGroup; }
if (machinePrev.isPresent()) { Optional<ServerImpl> serverPrev = machinePrev.get().getServerByName(server.getName()); if (serverPrev.isPresent()) { if (server.getStatus() != serverPrev.get().getStatus()) {
ServerImpl terminalServer = machine .getServerByName(SERVER_TERMINAL_REFERENCE) .orElseThrow( () ->