Пример #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();
  }
Пример #2
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();
  }