/** * Creates a CLI script for adding a Connector * * @param connAS7 object of migrated connector * @return string containing created CLI script * @throws CliScriptException if required attributes are missing * @deprecated Generate this from the ModelNode. */ private static String createConnectorScript(ConnectorAS7Bean connAS7) throws CliScriptException { String errMsg = " in connector must be set."; Utils.throwIfBlank(connAS7.getScheme(), errMsg, "Scheme"); Utils.throwIfBlank(connAS7.getSocketBinding(), errMsg, "Socket-binding"); Utils.throwIfBlank(connAS7.getConnectorName(), errMsg, "Connector name"); Utils.throwIfBlank(connAS7.getProtocol(), errMsg, "Protocol"); CliAddScriptBuilder builder = new CliAddScriptBuilder(); StringBuilder resultScript = new StringBuilder("/subsystem=web/connector="); resultScript.append(connAS7.getConnectorName()).append(":add("); builder.addProperty("socket-binding", connAS7.getSocketBinding()); builder.addProperty("enable-lookups", connAS7.getEnableLookups()); builder.addProperty("max-post-size", connAS7.getMaxPostSize()); builder.addProperty("max-save-post-size", connAS7.getMaxSavePostSize()); builder.addProperty("max-connections", connAS7.getMaxConnections()); builder.addProperty("protocol", connAS7.getProtocol()); builder.addProperty("proxy-name", connAS7.getProxyName()); builder.addProperty("proxy-port", connAS7.getProxyPort()); builder.addProperty("redirect-port", connAS7.getRedirectPort()); builder.addProperty("scheme", connAS7.getScheme()); builder.addProperty("secure", connAS7.getSecure()); builder.addProperty("enabled", connAS7.getEnabled()); resultScript.append(builder.asString()).append(")"); return resultScript.toString(); }
/** * Creates a CLI script for adding virtual-server to AS7 * * @param virtualServer object representing migrated virtual-server * @return string containing created CLI script * @deprecated Generate this from the ModelNode. */ private static String createVirtualServerScript(VirtualServerBean virtualServer) throws CliScriptException { String errMsg = "in virtual-server (engine in AS5) must be set"; Utils.throwIfBlank(virtualServer.getVirtualServerName(), errMsg, "Server name"); CliAddScriptBuilder builder = new CliAddScriptBuilder(); StringBuilder resultScript = new StringBuilder("/subsystem=web/virtual-server="); resultScript.append(virtualServer.getVirtualServerName()).append(":add("); builder.addProperty("enable-welcome-root", virtualServer.getEnableWelcomeRoot()); builder.addProperty("default-web-module", virtualServer.getDefaultWebModule()); String aliases = ""; if (virtualServer.getAliasName() != null) { StringBuilder aliasBuilder = new StringBuilder(); for (String alias : virtualServer.getAliasName()) { aliasBuilder.append(", \"").append(alias).append("\""); } aliases = aliasBuilder.toString(); aliases = aliases.replaceFirst(", ", ""); if (!aliases.isEmpty()) { aliases = ", alias=[" + aliases + "]"; } } resultScript.append(builder.asString()).append(aliases).append(")"); return resultScript.toString(); }
/** * Creates a CLI script for adding socket-binding to AS7 * * @param socketBinding object representing socket-binding * @return string containing created CLI script * @throws CliScriptException if required attributes are missing * @deprecated Generate this from the ModelNode. */ private static String createSocketBindingScript(SocketBindingBean socketBinding) throws CliScriptException { String errMsg = " in socket-binding must be set."; Utils.throwIfBlank(socketBinding.getSocketPort(), errMsg, "Port"); Utils.throwIfBlank(socketBinding.getSocketName(), errMsg, "Name"); CliAddScriptBuilder builder = new CliAddScriptBuilder(); StringBuilder resultScript = new StringBuilder("/socket-binding-group=standard-sockets/socket-binding="); resultScript.append(socketBinding.getSocketName()).append(":add("); resultScript.append("port=").append(socketBinding.getSocketPort()); builder.addProperty("interface", socketBinding.getSocketInterface()); resultScript.append(builder.asString()).append(")"); return resultScript.toString(); }
/** * Creates a CLI script for adding a SSL configuration of the Connector * * @param connAS7 Connector containing SSL configuration * @return created string containing the CLI script for adding the SSL configuration * @deprecated Generate this from the ModelNode. */ private static String createSSLConfScript(ConnectorAS7Bean connAS7) { CliAddScriptBuilder builder = new CliAddScriptBuilder(); StringBuilder resultScript = new StringBuilder("/subsystem=web/connector=" + connAS7.getConnectorName()); resultScript.append("/ssl=configuration:add("); builder.addProperty("name", connAS7.getSslName()); builder.addProperty("verify-client", connAS7.getVerifyClient()); builder.addProperty("verify-depth", connAS7.getVerifyDepth()); builder.addProperty("certificate-key-file", connAS7.getCertifKeyFile()); builder.addProperty("password", connAS7.getPassword()); builder.addProperty("protocol", connAS7.getProtocol()); builder.addProperty("ciphers", connAS7.getCiphers()); builder.addProperty("key-alias", connAS7.getKeyAlias()); builder.addProperty("ca-certificate-file", connAS7.getCaCertifFile()); builder.addProperty("session-cache-size", connAS7.getSessionCacheSize()); builder.addProperty("session-timeout", connAS7.getSessionTimeout()); resultScript.append(builder.asString()).append(")"); return resultScript.toString(); }