/** * 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; }
@Override public String getWsAgentServerApiEndpoint() { Optional<ServerImpl> server = wsAgentServerUtilProvider.get().getWsAgentHttpServer(); if (server.isPresent()) { return server.get().getUrl(); } throw new RuntimeException("wsagent server doesn't exist"); }
/** * 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() { final WorkspaceImpl workspace = appContext.getWorkspace(); final RuntimeImpl runtime = workspace.getRuntime(); if (runtime == null) { return; // workspace is stopped } wsAgentServerUtil .getWsAgentWebSocketServer() .ifPresent( server -> { String wsAgentWebSocketUrl = agentURLModifier.modify(server.getUrl()); String separator = wsAgentWebSocketUrl.contains("?") ? "&" : "?"; Optional<String> applicationWebSocketId = appContext.getApplicationId(); String queryParams = applicationWebSocketId.map(id -> separator + "clientId=" + id).orElse(""); initializer.initialize( WS_AGENT_JSON_RPC_ENDPOINT_ID, singletonMap("url", wsAgentWebSocketUrl + queryParams), emptySet()); }); } }
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())))); }); } }
+ machine.getName() + " doesn't provide terminal server.")); connectToTerminal(agentURLModifier.modify(terminalServer.getUrl()), options); }) .catchError(