Ejemplo n.º 1
0
/** @author @author <a href="mailto:[email protected]">Stefano Maestri</a> */
class Constants {

  static final String DATASOURCES = "datasources";

  static final String DATA_SOURCE = "data-source";

  static final String XA_DATASOURCE = "xa-data-source";

  private static final String CONNECTION_URL_NAME = "connection-url";

  static final String JDBC_DRIVER_NAME = "jdbc-driver";

  private static final String DATASOURCE_DRIVER_CLASS_NAME = "driver-class";

  private static final String DATASOURCE_CLASS_NAME = "datasource-class";

  private static final String DATASOURCE_DRIVER_NAME = "driver-name";

  private static final String DRIVER_NAME_NAME = "driver-name";

  private static final String DRIVER_MODULE_NAME_NAME = "driver-module-name";

  private static final String DRIVER_MAJOR_VERSION_NAME = "driver-major-version";

  private static final String DRIVER_MINOR_VERSION_NAME = "driver-minor-version";

  private static final String DRIVER_CLASS_NAME_NAME = "driver-class-name";

  private static final String DRIVER_DATASOURCE_CLASS_NAME_NAME = "driver-datasource-class-name";

  private static final String DRIVER_XA_DATASOURCE_CLASS_NAME_NAME =
      "driver-xa-datasource-class-name";

  private static final String CONNECTION_PROPERTIES_NAME = "connection-properties";

  private static final String CONNECTION_PROPERTY_VALUE_NAME = "value";

  private static final String NEW_CONNECTION_SQL_NAME = "new-connection-sql";

  private static final String TRANSACTION_ISOLATION_NAME = "transaction-isolation";

  private static final String URL_DELIMITER_NAME = "url-delimiter";

  private static final String URL_SELECTOR_STRATEGY_CLASS_NAME_NAME =
      "url-selector-strategy-class-name";

  private static final String USE_JAVA_CONTEXT_NAME = "use-java-context";

  static final String POOLNAME_NAME = "pool-name";

  private static final String ENABLED_NAME = "enabled";

  private static final String JTA_NAME = "jta";

  private static final String JNDINAME_NAME = "jndi-name";

  private static final String ALLOCATION_RETRY_NAME = "allocation-retry";

  private static final String ALLOCATION_RETRY_WAIT_MILLIS_NAME = "allocation-retry-wait-millis";

  private static final String ALLOW_MULTIPLE_USERS_NAME = "allow-multiple-users";

  private static final String SETTXQUERYTIMEOUT_NAME = "set-tx-query-timeout";

  private static final String XA_RESOURCE_TIMEOUT_NAME = "xa-resource-timeout";

  private static final String QUERYTIMEOUT_NAME = "query-timeout";

  private static final String USETRYLOCK_NAME = "use-try-lock";

  private static final String USERNAME_NAME = "user-name";

  private static final String PASSWORD_NAME = "password";

  private static final String SECURITY_DOMAIN_NAME = "security-domain";

  private static final String SHAREPREPAREDSTATEMENTS_NAME = "share-prepared-statements";

  private static final String PREPAREDSTATEMENTSCACHESIZE_NAME = "prepared-statements-cache-size";

  private static final String TRACKSTATEMENTS_NAME = "track-statements";

  private static final String VALIDCONNECTIONCHECKERCLASSNAME_NAME =
      "valid-connection-checker-class-name";

  private static final String CHECKVALIDCONNECTIONSQL_NAME = "check-valid-connection-sql";

  private static final String VALIDATEONMATCH_NAME = "validate-on-match";

  private static final String SPY_NAME = "spy";

  private static final String USE_CCM_NAME = "use-ccm";

  private static final String STALECONNECTIONCHECKERCLASSNAME_NAME =
      "stale-connection-checker-class-name";

  private static final String EXCEPTIONSORTERCLASSNAME_NAME = "exception-sorter-class-name";

  private static final String XADATASOURCEPROPERTIES_NAME = "xa-datasource-properties";

  private static final String XADATASOURCEPROPERTIES_VALUE_NAME = "value";

  private static final String XADATASOURCECLASS_NAME = "xa-datasource-class";

  private static final String INTERLEAVING_NAME = "interleaving";

  private static final String NOTXSEPARATEPOOL_NAME = "no-tx-separate-pool";

  private static final String PAD_XID_NAME = "pad-xid";

  private static final String SAME_RM_OVERRIDE_NAME = "same-rm-override";

  private static final String WRAP_XA_RESOURCE_NAME = "wrap-xa-resource";

  private static final String EXCEPTIONSORTER_PROPERTIES_NAME = "exception-sorter-properties";

  private static final String STALECONNECTIONCHECKER_PROPERTIES_NAME =
      "stale-connection-checker-properties";

  private static final String VALIDCONNECTIONCHECKER_PROPERTIES_NAME =
      "valid-connection-checker-properties";

  private static final String REAUTHPLUGIN_CLASSNAME_NAME = "reauth-plugin-class-name";

  private static final String REAUTHPLUGIN_PROPERTIES_NAME = "reauth-plugin-properties";

  private static final String RECOVERY_USERNAME_NAME = "recovery-username";

  private static final String RECOVERY_PASSWORD_NAME = "recovery-password";

  private static final String RECOVERY_SECURITY_DOMAIN_NAME = "recovery-security-domain";

  private static final String RECOVER_PLUGIN_CLASSNAME_NAME = "recovery-plugin-class-name";

  private static final String RECOVER_PLUGIN_PROPERTIES_NAME = "recovery-plugin-properties";

  private static final String NO_RECOVERY_NAME = "no-recovery";

  static final String INSTALLED_DRIVERS = "installed-drivers";

  static final String DEPLOYMENT_NAME = "deployment-name";

  static final String MODULE_SLOT = "module-slot";

  static final String JDBC_COMPLIANT = "jdbc-compliant";

  static final String STATISTICS = "statistics";

  static SimpleAttributeDefinition CONNECTION_URL =
      new SimpleAttributeDefinition(
          CONNECTION_URL_NAME,
          DataSource.Tag.CONNECTION_URL.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition DRIVER_CLASS =
      new SimpleAttributeDefinition(
          DATASOURCE_DRIVER_CLASS_NAME,
          DataSource.Tag.DRIVER_CLASS.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition DATASOURCE_CLASS =
      new SimpleAttributeDefinition(
          DATASOURCE_CLASS_NAME,
          DataSource.Tag.DATASOURCE_CLASS.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition JNDINAME =
      new SimpleAttributeDefinition(
          JNDINAME_NAME,
          DataSource.Attribute.JNDI_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE,
          new ParameterValidator() {
            @Override
            public void validateParameter(String parameterName, ModelNode value)
                throws OperationFailedException {
              if (value.isDefined()) {
                if (value.getType() != ModelType.EXPRESSION) {
                  String str = value.asString();
                  if (!str.startsWith("java:/") && !str.startsWith("java:jboss/")) {
                    throw MESSAGES.jndiNameInvalidFormat();
                  }
                }
              } else {
                throw MESSAGES.jndiNameRequired();
              }
            }

            @Override
            public void validateResolvedParameter(String parameterName, ModelNode value)
                throws OperationFailedException {
              validateParameter(parameterName, value.resolve());
            }
          });

  static SimpleAttributeDefinition DATASOURCE_DRIVER =
      new SimpleAttributeDefinition(
          DATASOURCE_DRIVER_NAME,
          DataSource.Tag.DRIVER.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition NEW_CONNECTION_SQL =
      new SimpleAttributeDefinition(
          NEW_CONNECTION_SQL_NAME,
          DataSource.Tag.NEW_CONNECTION_SQL.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition URL_DELIMITER =
      new SimpleAttributeDefinition(
          URL_DELIMITER_NAME,
          DataSource.Tag.URL_DELIMITER.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition URL_SELECTOR_STRATEGY_CLASS_NAME =
      new SimpleAttributeDefinition(
          URL_SELECTOR_STRATEGY_CLASS_NAME_NAME,
          DataSource.Tag.URL_SELECTOR_STRATEGY_CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USE_JAVA_CONTEXT =
      new SimpleAttributeDefinition(
          USE_JAVA_CONTEXT_NAME,
          DataSource.Attribute.USE_JAVA_CONTEXT.getLocalName(),
          new ModelNode().set(Defaults.USE_JAVA_CONTEXT),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition ENABLED =
      new SimpleAttributeDefinition(
          ENABLED_NAME,
          DataSource.Attribute.ENABLED.getLocalName(),
          new ModelNode().set(Defaults.ENABLED),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition JTA =
      new SimpleAttributeDefinition(
          JTA_NAME,
          DataSource.Attribute.JTA.getLocalName(),
          new ModelNode().set(Defaults.JTA),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition CONNECTION_PROPERTIES =
      new SimpleAttributeDefinition(
          CONNECTION_PROPERTIES_NAME,
          DataSource.Tag.CONNECTION_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition CONNECTION_PROPERTY_VALUE =
      new SimpleAttributeDefinition(
          CONNECTION_PROPERTY_VALUE_NAME,
          DataSource.Tag.CONNECTION_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USERNAME =
      new SimpleAttributeDefinition(
          USERNAME_NAME,
          Credential.Tag.USER_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition PASSWORD =
      new SimpleAttributeDefinition(
          PASSWORD_NAME,
          Credential.Tag.PASSWORD.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SECURITY_DOMAIN =
      new SimpleAttributeDefinition(
          SECURITY_DOMAIN_NAME,
          CommonSecurity.Tag.SECURITY_DOMAIN.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition PREPAREDSTATEMENTSCACHESIZE =
      new SimpleAttributeDefinition(
          PREPAREDSTATEMENTSCACHESIZE_NAME,
          Statement.Tag.PREPARED_STATEMENT_CACHE_SIZE.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SHAREPREPAREDSTATEMENTS =
      new SimpleAttributeDefinition(
          SHAREPREPAREDSTATEMENTS_NAME,
          Statement.Tag.SHARE_PREPARED_STATEMENTS.getLocalName(),
          new ModelNode().set(Defaults.SHARE_PREPARED_STATEMENTS),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition TRACKSTATEMENTS =
      new SimpleAttributeDefinition(
          TRACKSTATEMENTS_NAME,
          Statement.Tag.TRACK_STATEMENTS.getLocalName(),
          new ModelNode().set(Defaults.TRACK_STATEMENTS.name()),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition ALLOCATION_RETRY =
      new SimpleAttributeDefinition(
          ALLOCATION_RETRY_NAME,
          TimeOut.Tag.ALLOCATION_RETRY.getLocalName(),
          new ModelNode(),
          ModelType.INT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition ALLOCATION_RETRY_WAIT_MILLIS =
      new SimpleAttributeDefinition(
          ALLOCATION_RETRY_WAIT_MILLIS_NAME,
          TimeOut.Tag.ALLOCATION_RETRY_WAIT_MILLIS.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition ALLOW_MULTIPLE_USERS =
      new SimpleAttributeDefinition(
          ALLOW_MULTIPLE_USERS_NAME,
          DsPool.Tag.ALLOW_MULTIPLE_USERS.getLocalName(),
          new ModelNode(),
          ModelType.BOOLEAN,
          true,
          false,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition QUERYTIMEOUT =
      new SimpleAttributeDefinition(
          QUERYTIMEOUT_NAME,
          TimeOut.Tag.QUERY_TIMEOUT.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USETRYLOCK =
      new SimpleAttributeDefinition(
          USETRYLOCK_NAME,
          TimeOut.Tag.USE_TRY_LOCK.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SETTXQUERYTIMEOUT =
      new SimpleAttributeDefinition(
          SETTXQUERYTIMEOUT_NAME,
          TimeOut.Tag.SET_TX_QUERY_TIMEOUT.getLocalName(),
          new ModelNode().set(Defaults.SET_TX_QUERY_TIMEOUT),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition TRANSACTION_ISOLATION =
      new SimpleAttributeDefinition(
          TRANSACTION_ISOLATION_NAME,
          DataSource.Tag.TRANSACTION_ISOLATION.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition CHECKVALIDCONNECTIONSQL =
      new SimpleAttributeDefinition(
          CHECKVALIDCONNECTIONSQL_NAME,
          Validation.Tag.CHECK_VALID_CONNECTION_SQL.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition EXCEPTIONSORTERCLASSNAME =
      new SimpleAttributeDefinition(
          EXCEPTIONSORTERCLASSNAME_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition EXCEPTIONSORTER_PROPERTIES =
      new SimpleAttributeDefinition(
          EXCEPTIONSORTER_PROPERTIES_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.OBJECT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition STALECONNECTIONCHECKERCLASSNAME =
      new SimpleAttributeDefinition(
          STALECONNECTIONCHECKERCLASSNAME_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition STALECONNECTIONCHECKER_PROPERTIES =
      new SimpleAttributeDefinition(
          STALECONNECTIONCHECKER_PROPERTIES_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.OBJECT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition VALIDCONNECTIONCHECKERCLASSNAME =
      new SimpleAttributeDefinition(
          VALIDCONNECTIONCHECKERCLASSNAME_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition VALIDCONNECTIONCHECKER_PROPERTIES =
      new SimpleAttributeDefinition(
          VALIDCONNECTIONCHECKER_PROPERTIES_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.OBJECT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition VALIDATEONMATCH =
      new SimpleAttributeDefinition(
          VALIDATEONMATCH_NAME,
          Validation.Tag.VALIDATE_ON_MATCH.getLocalName(),
          new ModelNode().set(Defaults.VALIDATE_ON_MATCH),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SPY =
      new SimpleAttributeDefinition(
          SPY_NAME,
          DataSource.Attribute.SPY.getLocalName(),
          new ModelNode().set(Defaults.SPY),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USE_CCM =
      new SimpleAttributeDefinition(
          USE_CCM_NAME,
          DataSource.Attribute.USE_CCM.getLocalName(),
          new ModelNode().set(Defaults.USE_CCM),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition XADATASOURCECLASS =
      new SimpleAttributeDefinition(
          XADATASOURCECLASS_NAME,
          XaDataSource.Tag.XA_DATASOURCE_CLASS.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition INTERLEAVING =
      new SimpleAttributeDefinition(
          INTERLEAVING_NAME,
          CommonXaPool.Tag.INTERLEAVING.getLocalName(),
          new ModelNode().set(Defaults.INTERLEAVING),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition NOTXSEPARATEPOOL =
      new SimpleAttributeDefinition(
          NOTXSEPARATEPOOL_NAME,
          CommonXaPool.Tag.NO_TX_SEPARATE_POOLS.getLocalName(),
          new ModelNode().set(Defaults.NO_TX_SEPARATE_POOL),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition PAD_XID =
      new SimpleAttributeDefinition(
          PAD_XID_NAME,
          CommonXaPool.Tag.PAD_XID.getLocalName(),
          new ModelNode().set(Defaults.PAD_XID),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SAME_RM_OVERRIDE =
      new SimpleAttributeDefinition(
          SAME_RM_OVERRIDE_NAME,
          CommonXaPool.Tag.IS_SAME_RM_OVERRIDE.getLocalName(),
          new ModelNode(),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition WRAP_XA_RESOURCE =
      new SimpleAttributeDefinition(
          WRAP_XA_RESOURCE_NAME,
          CommonXaPool.Tag.WRAP_XA_RESOURCE.getLocalName(),
          new ModelNode().set(Defaults.WRAP_XA_RESOURCE),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition XA_RESOURCE_TIMEOUT =
      new SimpleAttributeDefinition(
          XA_RESOURCE_TIMEOUT_NAME,
          TimeOut.Tag.XA_RESOURCE_TIMEOUT.getLocalName(),
          new ModelNode(),
          ModelType.INT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition REAUTHPLUGIN_CLASSNAME =
      new SimpleAttributeDefinition(
          REAUTHPLUGIN_CLASSNAME_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition REAUTHPLUGIN_PROPERTIES =
      new SimpleAttributeDefinition(
          REAUTHPLUGIN_PROPERTIES_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.OBJECT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERY_USERNAME =
      new SimpleAttributeDefinition(
          RECOVERY_USERNAME_NAME,
          Credential.Tag.USER_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERY_PASSWORD =
      new SimpleAttributeDefinition(
          RECOVERY_PASSWORD_NAME,
          Credential.Tag.PASSWORD.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERY_SECURITY_DOMAIN =
      new SimpleAttributeDefinition(
          RECOVERY_SECURITY_DOMAIN_NAME,
          Credential.Tag.SECURITY_DOMAIN.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERLUGIN_CLASSNAME =
      new SimpleAttributeDefinition(
          RECOVER_PLUGIN_CLASSNAME_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERLUGIN_PROPERTIES =
      new SimpleAttributeDefinition(
          RECOVER_PLUGIN_PROPERTIES_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.OBJECT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition NO_RECOVERY =
      new SimpleAttributeDefinition(
          NO_RECOVERY_NAME,
          Recovery.Attribute.NO_RECOVERY.getLocalName(),
          new ModelNode(),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition XADATASOURCE_PROPERTIES =
      new SimpleAttributeDefinition(
          XADATASOURCEPROPERTIES_NAME,
          XaDataSource.Tag.XA_DATASOURCE_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition XADATASOURCE_PROPERTY_VALUE =
      new SimpleAttributeDefinition(
          XADATASOURCEPROPERTIES_VALUE_NAME,
          XaDataSource.Tag.XA_DATASOURCE_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_NAME =
      new SimpleAttributeDefinition(
          DRIVER_NAME_NAME,
          Driver.Attribute.NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_MODULE_NAME =
      new SimpleAttributeDefinition(
          DRIVER_MODULE_NAME_NAME,
          Driver.Attribute.MODULE.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_MAJOR_VERSION =
      new SimpleAttributeDefinition(
          DRIVER_MAJOR_VERSION_NAME,
          Driver.Attribute.MAJOR_VERSION.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_MINOR_VERSION =
      new SimpleAttributeDefinition(
          DRIVER_MINOR_VERSION_NAME,
          Driver.Attribute.MINOR_VERSION.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_CLASS_NAME =
      new SimpleAttributeDefinition(
          DRIVER_CLASS_NAME_NAME,
          Driver.Tag.DRIVER_CLASS.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_DATASOURCE_CLASS_NAME =
      new SimpleAttributeDefinition(
          DRIVER_DATASOURCE_CLASS_NAME_NAME,
          Driver.Tag.DATASOURCE_CLASS.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition DRIVER_XA_DATASOURCE_CLASS_NAME =
      new SimpleAttributeDefinition(
          DRIVER_XA_DATASOURCE_CLASS_NAME_NAME,
          Driver.Tag.XA_DATASOURCE_CLASS.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);
}
Ejemplo n.º 2
0
/** @author @author <a href="mailto:[email protected]">Stefano Maestri</a> */
public class Constants {

  public static final String RESOURCEADAPTER_NAME = "resource-adapter";

  static final String RESOURCEADAPTERS_NAME = "resource-adapters";

  public static final String IRONJACAMAR_NAME = "ironjacamar";

  public static final String STATISTICS_NAME = "statistics";

  public static final String CONNECTIONDEFINITIONS_NAME = "connection-definitions";

  private static final String CLASS_NAME_NAME = "class-name";

  static final String POOL_NAME_NAME = "pool-name";

  private static final String USE_JAVA_CONTEXT_NAME = "use-java-context";

  private static final String ENABLED_NAME = "enabled";

  private static final String JNDINAME_NAME = "jndi-name";

  private static final String ALLOCATION_RETRY_NAME = "allocation-retry";

  private static final String ALLOCATION_RETRY_WAIT_MILLIS_NAME = "allocation-retry-wait-millis";

  private static final String XA_RESOURCE_TIMEOUT_NAME = "xa-resource-timeout";

  private static final String USETRYLOCK_NAME = "use-try-lock";

  private static final String SECURITY_DOMAIN_AND_APPLICATION_NAME =
      "security-domain-and-application";

  private static final String SECURITY_DOMAIN_NAME = "security-domain";

  private static final String APPLICATION_NAME = "security-application";

  private static final String USE_CCM_NAME = "use-ccm";

  private static final String CONFIG_PROPERTIES_NAME = "config-properties";

  private static final String CONFIG_PROPERTY_VALUE_NAME = "value";

  private static final String ARCHIVE_NAME = "archive";

  private static final String BOOTSTRAPCONTEXT_NAME = "bootstrap-context";

  private static final String TRANSACTIONSUPPORT_NAME = "transaction-support";

  private static final String BEANVALIDATIONGROUPS_NAME = "beanvalidationgroups";

  static final String ADMIN_OBJECTS_NAME = "admin-objects";

  private static final String INTERLEAVING_NAME = "interleaving";

  private static final String NOTXSEPARATEPOOL_NAME = "no-tx-separate-pool";

  private static final String PAD_XID_NAME = "pad-xid";

  private static final String SAME_RM_OVERRIDE_NAME = "same-rm-override";

  private static final String WRAP_XA_RESOURCE_NAME = "wrap-xa-resource";

  private static final String RECOVERY_USERNAME_NAME = "recovery-username";

  private static final String RECOVERY_PASSWORD_NAME = "recovery-password";

  private static final String RECOVERY_SECURITY_DOMAIN_NAME = "recovery-security-domain";

  private static final String RECOVERLUGIN_CLASSNAME_NAME = "recovery-plugin-class-name";

  private static final String RECOVERLUGIN_PROPERTIES_NAME = "recovery-plugin-properties";

  private static final String NO_RECOVERY_NAME = "no-recovery";

  public static final String ACTIVATE = "activate";

  public static final String FLUSH_ALL_CONNECTION_IN_POOL = "flush-all-connection-in-pool";

  public static final String FLUSH_IDLE_CONNECTION_IN_POOL = "flush-idle-connection-in-pool";

  public static final String TEST_CONNECTION_IN_POOL = "test-connection-in-pool";

  public static final String CLEAR_STATISTICS = "clear-statistics";

  static final SimpleAttributeDefinition CLASS_NAME =
      new SimpleAttributeDefinition(
          CLASS_NAME_NAME,
          CommonConnDef.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition JNDINAME =
      new SimpleAttributeDefinition(
          JNDINAME_NAME,
          CommonConnDef.Attribute.JNDI_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition CONFIG_PROPERTIES =
      new SimpleAttributeDefinition(
          CONFIG_PROPERTIES_NAME,
          CommonConnDef.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition CONFIG_PROPERTY_VALUE =
      new SimpleAttributeDefinition(
          CONFIG_PROPERTY_VALUE_NAME,
          CommonConnDef.Tag.CONFIG_PROPERTY.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition ARCHIVE =
      new SimpleAttributeDefinition(
          ARCHIVE_NAME,
          ResourceAdapter.Tag.ARCHIVE.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          false,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition BOOTSTRAP_CONTEXT =
      new SimpleAttributeDefinition(
          BOOTSTRAPCONTEXT_NAME,
          ResourceAdapter.Tag.BOOTSTRAP_CONTEXT.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static final SimpleAttributeDefinition TRANSACTION_SUPPORT =
      new SimpleAttributeDefinition(
          TRANSACTIONSUPPORT_NAME,
          ResourceAdapter.Tag.TRANSACTION_SUPPORT.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE,
          new EnumValidator<TransactionSupportEnum>(TransactionSupportEnum.class, true, true));

  static final PrimitiveListAttributeDefinition BEANVALIDATION_GROUPS =
      PrimitiveListAttributeDefinition.Builder.of(BEANVALIDATIONGROUPS_NAME, ModelType.STRING)
          .setXmlName(ResourceAdapter.Tag.BEAN_VALIDATION_GROUP.getLocalName())
          .setAllowNull(true)
          .setAllowExpression(true)
          .build();

  static final SimpleAttributeDefinition BEANVALIDATIONGROUP =
      new SimpleAttributeDefinition(
          BEANVALIDATIONGROUPS_NAME,
          ResourceAdapter.Tag.BEAN_VALIDATION_GROUP.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USE_JAVA_CONTEXT =
      new SimpleAttributeDefinition(
          USE_JAVA_CONTEXT_NAME,
          DataSource.Attribute.USE_JAVA_CONTEXT.getLocalName(),
          new ModelNode().set(Defaults.USE_JAVA_CONTEXT),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition ENABLED =
      new SimpleAttributeDefinition(
          ENABLED_NAME,
          DataSource.Attribute.ENABLED.getLocalName(),
          new ModelNode().set(Defaults.ENABLED),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SECURITY_DOMAIN =
      new SimpleAttributeDefinitionBuilder(SECURITY_DOMAIN_NAME, ModelType.STRING)
          .setXmlName(CommonSecurity.Tag.SECURITY_DOMAIN.getLocalName())
          .setAllowExpression(true)
          .setAllowNull(true)
          .setAlternatives(SECURITY_DOMAIN_AND_APPLICATION_NAME, APPLICATION_NAME)
          .build();

  static final SimpleAttributeDefinition SECURITY_DOMAIN_AND_APPLICATION =
      new SimpleAttributeDefinitionBuilder(SECURITY_DOMAIN_AND_APPLICATION_NAME, ModelType.STRING)
          .setXmlName(CommonSecurity.Tag.SECURITY_DOMAIN_AND_APPLICATION.getLocalName())
          .setAllowExpression(true)
          .setAllowNull(true)
          .setAlternatives(SECURITY_DOMAIN_NAME, APPLICATION_NAME)
          .build();

  static final SimpleAttributeDefinition APPLICATION =
      new SimpleAttributeDefinitionBuilder(APPLICATION_NAME, ModelType.BOOLEAN)
          .setXmlName(CommonSecurity.Tag.APPLICATION.getLocalName())
          .setDefaultValue(new ModelNode(Defaults.APPLICATION_MANAGED_SECURITY))
          .setAllowExpression(true)
          .setAllowNull(true)
          .setMeasurementUnit(MeasurementUnit.NONE)
          .setAlternatives(SECURITY_DOMAIN_NAME, SECURITY_DOMAIN_AND_APPLICATION_NAME)
          .build();

  static SimpleAttributeDefinition ALLOCATION_RETRY =
      new SimpleAttributeDefinition(
          ALLOCATION_RETRY_NAME,
          TimeOut.Tag.ALLOCATION_RETRY.getLocalName(),
          new ModelNode(),
          ModelType.INT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition ALLOCATION_RETRY_WAIT_MILLIS =
      new SimpleAttributeDefinition(
          ALLOCATION_RETRY_WAIT_MILLIS_NAME,
          TimeOut.Tag.ALLOCATION_RETRY_WAIT_MILLIS.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USETRYLOCK =
      new SimpleAttributeDefinition(
          USETRYLOCK_NAME,
          TimeOut.Tag.USE_TRY_LOCK.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition USE_CCM =
      new SimpleAttributeDefinition(
          USE_CCM_NAME,
          DataSource.Attribute.USE_CCM.getLocalName(),
          new ModelNode().set(Defaults.USE_CCM),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition INTERLEAVING =
      new SimpleAttributeDefinition(
          INTERLEAVING_NAME,
          CommonXaPool.Tag.INTERLEAVING.getLocalName(),
          new ModelNode().set(Defaults.INTERLEAVING),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition NOTXSEPARATEPOOL =
      new SimpleAttributeDefinition(
          NOTXSEPARATEPOOL_NAME,
          CommonXaPool.Tag.NO_TX_SEPARATE_POOLS.getLocalName(),
          new ModelNode().set(Defaults.NO_TX_SEPARATE_POOL),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition PAD_XID =
      new SimpleAttributeDefinition(
          PAD_XID_NAME,
          CommonXaPool.Tag.PAD_XID.getLocalName(),
          new ModelNode().set(Defaults.PAD_XID),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition SAME_RM_OVERRIDE =
      new SimpleAttributeDefinitionBuilder(SAME_RM_OVERRIDE_NAME, ModelType.BOOLEAN)
          .setAllowNull(true)
          .setAllowExpression(true)
          .setXmlName(CommonXaPool.Tag.IS_SAME_RM_OVERRIDE.getLocalName())
          // .setDefaultValue(new ModelNode(Defaults.IS_SAME_RM_OVERRIDE)) //this is wrong, it
          // should not be null
          .setDefaultValue(new ModelNode(false))
          .build();

  static SimpleAttributeDefinition WRAP_XA_RESOURCE =
      new SimpleAttributeDefinition(
          WRAP_XA_RESOURCE_NAME,
          CommonXaPool.Tag.WRAP_XA_RESOURCE.getLocalName(),
          new ModelNode().set(Defaults.WRAP_XA_RESOURCE),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition XA_RESOURCE_TIMEOUT =
      new SimpleAttributeDefinition(
          XA_RESOURCE_TIMEOUT_NAME,
          TimeOut.Tag.XA_RESOURCE_TIMEOUT.getLocalName(),
          new ModelNode(),
          ModelType.INT,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERY_USERNAME =
      new SimpleAttributeDefinition(
          RECOVERY_USERNAME_NAME,
          Credential.Tag.USER_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERY_PASSWORD =
      new SimpleAttributeDefinition(
          RECOVERY_PASSWORD_NAME,
          Credential.Tag.PASSWORD.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERY_SECURITY_DOMAIN =
      new SimpleAttributeDefinition(
          RECOVERY_SECURITY_DOMAIN_NAME,
          Credential.Tag.SECURITY_DOMAIN.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition NO_RECOVERY =
      new SimpleAttributeDefinition(
          NO_RECOVERY_NAME,
          Recovery.Attribute.NO_RECOVERY.getLocalName(),
          new ModelNode(false),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleAttributeDefinition RECOVERLUGIN_CLASSNAME =
      new SimpleAttributeDefinition(
          RECOVERLUGIN_CLASSNAME_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  static SimpleMapAttributeDefinition RECOVERLUGIN_PROPERTIES =
      new SimpleMapAttributeDefinition.Builder(RECOVERLUGIN_PROPERTIES_NAME, true)
          .setAllowExpression(true)
          .setXmlName(
              org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName())
          .build();
}
Ejemplo n.º 3
0
/** @author @author <a href="mailto:[email protected]">Stefano Maestri</a> */
public class Constants {

  private static final String MIN_POOL_SIZE_NAME = "min-pool-size";

  private static final String INITIAL_POOL_SIZE_NAME = "initial-pool-size";

  private static final String MAX_POOL_SIZE_NAME = "max-pool-size";

  private static final String POOL_PREFILL_NAME = "pool-prefill";

  private static final String POOL_USE_STRICT_MIN_NAME = "pool-use-strict-min";

  private static final String BACKGROUNDVALIDATIONMILLIS_NAME = "background-validation-millis";

  private static final String BACKGROUNDVALIDATION_NAME = "background-validation";

  private static final String USE_FAST_FAIL_NAME = "use-fast-fail";

  private static final String BLOCKING_TIMEOUT_WAIT_MILLIS_NAME = "blocking-timeout-wait-millis";

  private static final String IDLETIMEOUTMINUTES_NAME = "idle-timeout-minutes";

  private static final String FLUSH_STRATEGY_NAME = "flush-strategy";

  private static final String CAPACITY_INCREMENTER_CLASS_NAME = "capacity-incrementer-class";

  private static final String CAPACITY_INCREMENTER_PROPERTIES_NAME =
      "capacity-incrementer-properties";

  private static final String CAPACITY_DECREMENTER_CLASS_NAME = "capacity-decrementer-class";

  private static final String CAPACITY_DECREMENTER_PROPERTIES_NAME =
      "capacity-decrementer-properties";

  public static final SimpleAttributeDefinition BLOCKING_TIMEOUT_WAIT_MILLIS =
      new SimpleAttributeDefinition(
          BLOCKING_TIMEOUT_WAIT_MILLIS_NAME,
          TimeOut.Tag.BLOCKING_TIMEOUT_MILLIS.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.MILLISECONDS);

  public static final SimpleAttributeDefinition IDLETIMEOUTMINUTES =
      new SimpleAttributeDefinition(
          IDLETIMEOUTMINUTES_NAME,
          TimeOut.Tag.IDLE_TIMEOUT_MINUTES.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.MINUTES);

  public static final SimpleAttributeDefinition BACKGROUNDVALIDATIONMILLIS =
      new SimpleAttributeDefinition(
          BACKGROUNDVALIDATIONMILLIS_NAME,
          Validation.Tag.BACKGROUND_VALIDATION_MILLIS.getLocalName(),
          new ModelNode(),
          ModelType.LONG,
          true,
          true,
          MeasurementUnit.MILLISECONDS,
          new IntRangeValidator(1, true, true));

  public static final SimpleAttributeDefinition BACKGROUNDVALIDATION =
      new SimpleAttributeDefinition(
          BACKGROUNDVALIDATION_NAME,
          Validation.Tag.BACKGROUND_VALIDATION.getLocalName(),
          new ModelNode(Defaults.BACKGROUND_VALIDATION),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition USE_FAST_FAIL =
      new SimpleAttributeDefinition(
          USE_FAST_FAIL_NAME,
          Validation.Tag.USE_FAST_FAIL.getLocalName(),
          new ModelNode(Defaults.USE_FAST_FAIL),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition MAX_POOL_SIZE =
      new SimpleAttributeDefinition(
          MAX_POOL_SIZE_NAME,
          CommonPool.Tag.MAX_POOL_SIZE.getLocalName(),
          new ModelNode(Defaults.MAX_POOL_SIZE),
          ModelType.INT,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition MIN_POOL_SIZE =
      new SimpleAttributeDefinition(
          MIN_POOL_SIZE_NAME,
          CommonPool.Tag.MIN_POOL_SIZE.getLocalName(),
          new ModelNode(Defaults.MIN_POOL_SIZE),
          ModelType.INT,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition INITIAL_POOL_SIZE =
      new SimpleAttributeDefinitionBuilder(INITIAL_POOL_SIZE_NAME, ModelType.INT)
          .setXmlName(ConnDefPool.Tag.INITIAL_POOL_SIZE.getLocalName())
          .setAllowExpression(true)
          .setAllowNull(true)
          .build();

  public static SimpleAttributeDefinition CAPACITY_INCREMENTER_CLASS =
      new SimpleAttributeDefinition(
          CAPACITY_INCREMENTER_CLASS_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  public static PropertiesAttributeDefinition CAPACITY_INCREMENTER_PROPERTIES =
      new PropertiesAttributeDefinition.Builder(CAPACITY_INCREMENTER_PROPERTIES_NAME, true)
          .setXmlName(
              org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName())
          .setAllowNull(true)
          .setAllowExpression(true)
          .setAttributeMarshaller(
              new AttributeMarshaller() {
                @Override
                public void marshallAsElement(
                    final AttributeDefinition attribute,
                    final ModelNode resourceModel,
                    final boolean marshallDefault,
                    final XMLStreamWriter writer)
                    throws XMLStreamException {
                  for (ModelNode property : resourceModel.get(attribute.getName()).asList()) {
                    writer.writeStartElement(attribute.getXmlName());
                    writer.writeAttribute(
                        org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(),
                        property.asProperty().getName());
                    writer.writeCharacters(property.asProperty().getValue().asString());
                    writer.writeEndElement();
                  }
                }
              })
          .build();

  public static SimpleAttributeDefinition CAPACITY_DECREMENTER_CLASS =
      new SimpleAttributeDefinition(
          CAPACITY_DECREMENTER_CLASS_NAME,
          org.jboss.jca.common.api.metadata.common.Extension.Attribute.CLASS_NAME.getLocalName(),
          new ModelNode(),
          ModelType.STRING,
          true,
          true,
          MeasurementUnit.NONE);

  public static PropertiesAttributeDefinition CAPACITY_DECREMENTER_PROPERTIES =
      new PropertiesAttributeDefinition.Builder(CAPACITY_DECREMENTER_PROPERTIES_NAME, true)
          .setXmlName(
              org.jboss.jca.common.api.metadata.common.Extension.Tag.CONFIG_PROPERTY.getLocalName())
          .setAllowNull(true)
          .setAllowExpression(true)
          .setAttributeMarshaller(
              new AttributeMarshaller() {
                @Override
                public void marshallAsElement(
                    final AttributeDefinition attribute,
                    final ModelNode resourceModel,
                    final boolean marshallDefault,
                    final XMLStreamWriter writer)
                    throws XMLStreamException {
                  for (ModelNode property : resourceModel.get(attribute.getName()).asList()) {
                    writer.writeStartElement(attribute.getXmlName());
                    writer.writeAttribute(
                        org.jboss.as.controller.parsing.Attribute.NAME.getLocalName(),
                        property.asProperty().getName());
                    writer.writeCharacters(property.asProperty().getValue().asString());
                    writer.writeEndElement();
                  }
                }
              })
          .build();

  public static final SimpleAttributeDefinition POOL_PREFILL =
      new SimpleAttributeDefinition(
          POOL_PREFILL_NAME,
          CommonPool.Tag.PREFILL.getLocalName(),
          new ModelNode(Defaults.PREFILL),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition POOL_USE_STRICT_MIN =
      new SimpleAttributeDefinition(
          POOL_USE_STRICT_MIN_NAME,
          CommonPool.Tag.USE_STRICT_MIN.getLocalName(),
          new ModelNode(Defaults.USE_STRICT_MIN),
          ModelType.BOOLEAN,
          true,
          true,
          MeasurementUnit.NONE);

  public static final SimpleAttributeDefinition POOL_FLUSH_STRATEGY =
      new SimpleAttributeDefinitionBuilder(FLUSH_STRATEGY_NAME, ModelType.STRING)
          .setDefaultValue(new ModelNode(Defaults.FLUSH_STRATEGY.getName()))
          .setXmlName(CommonPool.Tag.FLUSH_STRATEGY.getLocalName())
          .setAllowNull(true)
          .setAllowExpression(true)
          .setValidator(new EnumValidator<FlushStrategy>(FlushStrategy.class, true, true))
          .build();

  public static final SimpleAttributeDefinition[] POOL_ATTRIBUTES_1 = {
    BLOCKING_TIMEOUT_WAIT_MILLIS,
    IDLETIMEOUTMINUTES,
    BACKGROUNDVALIDATIONMILLIS,
    BACKGROUNDVALIDATION,
    USE_FAST_FAIL,
    MAX_POOL_SIZE,
    MIN_POOL_SIZE,
    POOL_PREFILL,
    POOL_USE_STRICT_MIN,
    POOL_FLUSH_STRATEGY
  };

  public static final AttributeDefinition[] POOL_ATTRIBUTES_2 = {
    INITIAL_POOL_SIZE,
    CAPACITY_INCREMENTER_CLASS,
    CAPACITY_DECREMENTER_CLASS,
    CAPACITY_INCREMENTER_PROPERTIES,
    CAPACITY_DECREMENTER_PROPERTIES
  };

  public static final AttributeDefinition[] POOL_ATTRIBUTES = {
    BLOCKING_TIMEOUT_WAIT_MILLIS,
    IDLETIMEOUTMINUTES,
    BACKGROUNDVALIDATIONMILLIS,
    BACKGROUNDVALIDATION,
    USE_FAST_FAIL,
    MAX_POOL_SIZE,
    MIN_POOL_SIZE,
    INITIAL_POOL_SIZE,
    POOL_PREFILL,
    POOL_USE_STRICT_MIN,
    POOL_FLUSH_STRATEGY,
    CAPACITY_INCREMENTER_CLASS,
    CAPACITY_DECREMENTER_CLASS,
    CAPACITY_INCREMENTER_PROPERTIES,
    CAPACITY_DECREMENTER_PROPERTIES
  };

  public static SimpleAttributeDefinition POOL_STATISTICS_ENABLED =
      new SimpleAttributeDefinitionBuilder(
              ModelDescriptionConstants.STATISTICS_ENABLED, ModelType.BOOLEAN)
          .setStorageRuntime()
          .build();
}