Exemplo n.º 1
0
  /**
   * 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();
  }
Exemplo n.º 2
0
  /**
   * Creates a list of CliCommandActions for adding a Connector
   *
   * @param connAS7 Connector
   * @return created list containing CliCommandActions for adding the Connector
   * @throws CliScriptException if required attributes for a creation of the CLI command of the
   *     Connector are missing or are empty (socket-binding, connector-name, protocol)
   */
  private static List<CliCommandAction> createConnectorCliAction(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");

    List<CliCommandAction> actions = new LinkedList();

    actions.add(
        new CliCommandAction(
            ServerMigrator.class,
            createConnectorScript(connAS7),
            createConnectorModelNode(connAS7)));

    if (connAS7.getScheme().equals("https")) {
      actions.add(
          new CliCommandAction(
              ServerMigrator.class, createSSLConfScript(connAS7), createSSLConfModelNode(connAS7)));
    }

    return actions;
  }
Exemplo n.º 3
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();
  }