Пример #1
0
  /**
   * Creates CliCommandAction for adding a Virtual-Server
   *
   * @param server Virtual-Server
   * @return created CliCommandAction for adding the Virtual-Server
   * @throws CliScriptException if required attributes for a creation of the CLI command of the
   *     Virtual-Server are missing or are empty (server-name)
   */
  public static CliCommandAction createVirtualServerCliAction(VirtualServerBean server)
      throws CliScriptException {
    String errMsg = "in virtual-server (engine in AS5) must be set";
    Utils.throwIfBlank(server.getVirtualServerName(), errMsg, "Server name");

    ModelNode serverCmd = new ModelNode();
    serverCmd.get(ClientConstants.OP).set(ClientConstants.ADD);
    serverCmd.get(ClientConstants.OP_ADDR).add("subsystem", "web");
    serverCmd.get(ClientConstants.OP_ADDR).add("virtual-server", server.getVirtualServerName());

    if (server.getAliasName() != null) {
      ModelNode aliasesNode = new ModelNode();
      for (String alias : server.getAliasName()) {
        ModelNode aliasNode = new ModelNode();

        aliasNode.set(alias);
        aliasesNode.add(aliasNode);
      }
      serverCmd.get("alias").set(aliasesNode);
    }

    CliApiCommandBuilder builder = new CliApiCommandBuilder(serverCmd);

    builder.addProperty("enable-welcome-root", server.getEnableWelcomeRoot());
    builder.addProperty("default-web-module", server.getDefaultWebModule());

    return new CliCommandAction(
        ServerMigrator.class, createVirtualServerScript(server), builder.getCommand());
  }
Пример #2
0
  /**
   * Creates CliCommandAction for adding a Socket-Binding
   *
   * @param socket Socket-Binding
   * @return created CliCommandAction for adding the Socket-Binding
   * @throws CliScriptException if required attributes for a creation of the CLI command of the
   *     Security-Domain are missing or are empty (security-domain-name)
   */
  public static CliCommandAction createSocketBindingCliAction(SocketBindingBean socket)
      throws CliScriptException {
    String errMsg = " in socket-binding must be set.";
    Utils.throwIfBlank(socket.getSocketPort(), errMsg, "Port");
    Utils.throwIfBlank(socket.getSocketName(), errMsg, "Name");

    ModelNode serverCmd = new ModelNode();
    serverCmd.get(ClientConstants.OP).set(ClientConstants.ADD);
    serverCmd.get(ClientConstants.OP_ADDR).add("socket-binding-group", "standard-sockets");
    serverCmd.get(ClientConstants.OP_ADDR).add("socket-binding", socket.getSocketName());

    serverCmd.get("port").set(socket.getSocketPort());

    CliApiCommandBuilder builder = new CliApiCommandBuilder(serverCmd);
    builder.addProperty("interface", socket.getSocketInterface());

    return new CliCommandAction(
        ServerMigrator.class, createSocketBindingScript(socket), builder.getCommand());
  }
Пример #3
0
  private static ModelNode createSSLConfModelNode(ConnectorAS7Bean connAS7) {
    ModelNode sslConf = new ModelNode();
    sslConf.get(ClientConstants.OP).set(ClientConstants.ADD);
    sslConf.get(ClientConstants.OP_ADDR).add("subsystem", "web");
    sslConf.get(ClientConstants.OP_ADDR).add("connector", connAS7.getConnectorName());
    sslConf.get(ClientConstants.OP_ADDR).add("ssl", "configuration");

    CliApiCommandBuilder sslBuilder = new CliApiCommandBuilder(sslConf);

    sslBuilder.addProperty("name", connAS7.getSslName());
    sslBuilder.addProperty("verify-client", connAS7.getVerifyClient());
    sslBuilder.addProperty("verify-depth", connAS7.getVerifyDepth());
    sslBuilder.addProperty("certificate-key-file", connAS7.getCertifKeyFile());
    sslBuilder.addProperty("password", connAS7.getPassword());
    sslBuilder.addProperty("protocol", connAS7.getProtocol());
    sslBuilder.addProperty("ciphers", connAS7.getCiphers());
    sslBuilder.addProperty("key-alias", connAS7.getKeyAlias());
    sslBuilder.addProperty("ca-certificate-file", connAS7.getCaCertifFile());
    sslBuilder.addProperty("session-cache-size", connAS7.getSessionCacheSize());
    sslBuilder.addProperty("session-timeout", connAS7.getSessionTimeout());
    return sslBuilder.getCommand();
  }
Пример #4
0
  private static ModelNode createConnectorModelNode(ConnectorAS7Bean connAS7) {
    ModelNode connCmd = new ModelNode();
    connCmd.get(ClientConstants.OP).set(ClientConstants.ADD);
    connCmd.get(ClientConstants.OP_ADDR).add("subsystem", "web");
    connCmd.get(ClientConstants.OP_ADDR).add("connector", connAS7.getConnectorName());

    CliApiCommandBuilder builder = new CliApiCommandBuilder(connCmd);

    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());
    return builder.getCommand();
  }