/** {@inheritDoc} */ @Override public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException { context.startSubsystemElement(Namespace.CURRENT.getUriString(), false); ModelNode scanners = context.getModelNode(); for (final Property list : scanners.asPropertyList()) { final ModelNode node = list.getValue(); for (final Property scanner : node.asPropertyList()) { writer.writeEmptyElement(Element.DEPLOYMENT_SCANNER.getLocalName()); writer.writeAttribute(Attribute.NAME.getLocalName(), scanner.getName()); ModelNode configuration = scanner.getValue(); if (configuration.hasDefined(CommonAttributes.PATH)) { writer.writeAttribute( Attribute.PATH.getLocalName(), configuration.get(CommonAttributes.PATH).asString()); } if (configuration.hasDefined(CommonAttributes.SCAN_ENABLED)) { writer.writeAttribute( Attribute.SCAN_ENABLED.getLocalName(), configuration.get(CommonAttributes.SCAN_ENABLED).asString()); } if (configuration.hasDefined(CommonAttributes.SCAN_INTERVAL)) { writer.writeAttribute( Attribute.SCAN_INTERVAL.getLocalName(), configuration.get(CommonAttributes.SCAN_INTERVAL).asString()); } if (configuration.hasDefined(CommonAttributes.RELATIVE_TO)) { writer.writeAttribute( Attribute.RELATIVE_TO.getLocalName(), configuration.get(CommonAttributes.RELATIVE_TO).asString()); } if (configuration.hasDefined(CommonAttributes.AUTO_DEPLOY_ZIPPED)) { if (!configuration.get(CommonAttributes.AUTO_DEPLOY_ZIPPED).asBoolean()) { writer.writeAttribute( Attribute.AUTO_DEPLOY_ZIPPED.getLocalName(), Boolean.FALSE.toString()); } } if (configuration.hasDefined(CommonAttributes.AUTO_DEPLOY_EXPLODED)) { if (configuration.get(CommonAttributes.AUTO_DEPLOY_EXPLODED).asBoolean()) { writer.writeAttribute( Attribute.AUTO_DEPLOY_EXPLODED.getLocalName(), Boolean.TRUE.toString()); } } if (configuration.hasDefined(CommonAttributes.DEPLOYMENT_TIMEOUT)) { writer.writeAttribute( Attribute.DEPLOYMENT_TIMEOUT.getLocalName(), configuration.get(CommonAttributes.DEPLOYMENT_TIMEOUT).asString()); } } writer.writeEndElement(); } }
/** * @author Tomaz Cerar * @created 25.1.12 17:24 */ public class DeploymentScannerDefinition extends SimpleResourceDefinition { DeploymentScannerDefinition(final PathManager pathManager) { super( DeploymentScannerExtension.SCANNERS_PATH, DeploymentScannerExtension.getResourceDescriptionResolver("deployment.scanner"), new DeploymentScannerAdd(pathManager), DeploymentScannerRemove.INSTANCE); } protected static final SimpleAttributeDefinition NAME = new SimpleAttributeDefinitionBuilder(CommonAttributes.NAME, ModelType.STRING, false) .setXmlName(Attribute.NAME.getLocalName()) .setAllowExpression(false) .setValidator(new StringLengthValidator(1)) .setDefaultValue(new ModelNode().set(DeploymentScannerExtension.DEFAULT_SCANNER_NAME)) .build(); protected static final SimpleAttributeDefinition PATH = new SimpleAttributeDefinitionBuilder(CommonAttributes.PATH, ModelType.STRING, false) .setXmlName(Attribute.PATH.getLocalName()) .setAllowExpression(true) .setValidator(new StringLengthValidator(1, Integer.MAX_VALUE, false, true)) .build(); protected static final SimpleAttributeDefinition RELATIVE_TO = new SimpleAttributeDefinitionBuilder(CommonAttributes.RELATIVE_TO, ModelType.STRING, true) .setXmlName(Attribute.RELATIVE_TO.getLocalName()) .setValidator(new StringLengthValidator(1, Integer.MAX_VALUE, true, false)) .build(); protected static final SimpleAttributeDefinition SCAN_ENABLED = new SimpleAttributeDefinitionBuilder(CommonAttributes.SCAN_ENABLED, ModelType.BOOLEAN, true) .setXmlName(Attribute.SCAN_ENABLED.getLocalName()) .setAllowExpression(true) .setDefaultValue(new ModelNode(true)) .build(); protected static final SimpleAttributeDefinition SCAN_INTERVAL = new SimpleAttributeDefinitionBuilder(CommonAttributes.SCAN_INTERVAL, ModelType.INT, true) .setXmlName(Attribute.SCAN_INTERVAL.getLocalName()) .setAllowExpression(true) .setDefaultValue(new ModelNode().set(0)) .build(); protected static final SimpleAttributeDefinition AUTO_DEPLOY_ZIPPED = new SimpleAttributeDefinitionBuilder( CommonAttributes.AUTO_DEPLOY_ZIPPED, ModelType.BOOLEAN, true) .setXmlName(Attribute.AUTO_DEPLOY_ZIPPED.getLocalName()) .setDefaultValue(new ModelNode().set(true)) .setAllowExpression(true) .build(); protected static final SimpleAttributeDefinition AUTO_DEPLOY_EXPLODED = new SimpleAttributeDefinitionBuilder( CommonAttributes.AUTO_DEPLOY_EXPLODED, ModelType.BOOLEAN, true) .setXmlName(Attribute.AUTO_DEPLOY_EXPLODED.getLocalName()) .setAllowExpression(true) .setDefaultValue(new ModelNode().set(false)) .build(); protected static final SimpleAttributeDefinition AUTO_DEPLOY_XML = new SimpleAttributeDefinitionBuilder( CommonAttributes.AUTO_DEPLOY_XML, ModelType.BOOLEAN, true) .setXmlName(Attribute.AUTO_DEPLOY_XML.getLocalName()) .setAllowExpression(true) .setDefaultValue(new ModelNode().set(true)) .build(); protected static final SimpleAttributeDefinition DEPLOYMENT_TIMEOUT = new SimpleAttributeDefinitionBuilder( CommonAttributes.DEPLOYMENT_TIMEOUT, ModelType.LONG, true) .setXmlName(Attribute.DEPLOYMENT_TIMEOUT.getLocalName()) .setAllowExpression(true) .setDefaultValue(new ModelNode().set(600)) .build(); protected static final SimpleAttributeDefinition RUNTIME_FAILURE_CAUSES_ROLLBACK = new SimpleAttributeDefinitionBuilder( CommonAttributes.RUNTIME_FAILURE_CAUSES_ROLLBACK, ModelType.BOOLEAN, true) .setXmlName(Attribute.RUNTIME_FAILURE_CAUSES_ROLLBACK.getLocalName()) .setAllowExpression(true) .setDefaultValue(new ModelNode().set(false)) .build(); protected static final SimpleAttributeDefinition[] ALL_ATTRIBUTES = { PATH, RELATIVE_TO, SCAN_ENABLED, SCAN_INTERVAL, AUTO_DEPLOY_EXPLODED, AUTO_DEPLOY_XML, AUTO_DEPLOY_ZIPPED, DEPLOYMENT_TIMEOUT, RUNTIME_FAILURE_CAUSES_ROLLBACK }; @Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { // resourceRegistration.registerReadOnlyAttribute(NAME, null); resourceRegistration.registerReadWriteAttribute( PATH, null, new ReloadRequiredWriteAttributeHandler(PATH)); resourceRegistration.registerReadWriteAttribute( RELATIVE_TO, null, new ReloadRequiredWriteAttributeHandler(RELATIVE_TO)); resourceRegistration.registerReadWriteAttribute( SCAN_ENABLED, null, WriteEnabledAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( SCAN_INTERVAL, null, WriteScanIntervalAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( AUTO_DEPLOY_ZIPPED, null, WriteAutoDeployZipAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( AUTO_DEPLOY_EXPLODED, null, WriteAutoDeployExplodedAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( AUTO_DEPLOY_XML, null, WriteAutoDeployXMLAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( DEPLOYMENT_TIMEOUT, null, WriteDeploymentTimeoutAttributeHandler.INSTANCE); resourceRegistration.registerReadWriteAttribute( RUNTIME_FAILURE_CAUSES_ROLLBACK, null, WriteRuntimeFailureCausesRollbackAttributeHandler.INSTANCE); } }
/** {@inheritDoc} */ @Override public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException { context.startSubsystemElement(Namespace.CURRENT.getUriString(), false); ModelNode node = context.getModelNode(); writeAttribute(writer, Attribute.NATIVE.getLocalName(), node); writeAttribute(writer, Attribute.DEFAULT_VIRTUAL_SERVER.getLocalName(), node); writeAttribute(writer, Attribute.INSTANCE_ID.getLocalName(), node); if (node.hasDefined(CONTAINER_CONFIG)) { writeContainerConfig(writer, node.get(CONTAINER_CONFIG)); } if (node.hasDefined(CONNECTOR)) { for (final Property connector : node.get(CONNECTOR).asPropertyList()) { final ModelNode config = connector.getValue(); writer.writeStartElement(Element.CONNECTOR.getLocalName()); writer.writeAttribute(NAME, connector.getName()); writeAttribute(writer, Attribute.PROTOCOL.getLocalName(), config); writeAttribute(writer, Attribute.SOCKET_BINDING.getLocalName(), config); writeAttribute(writer, Attribute.SCHEME.getLocalName(), config); writeAttribute(writer, Attribute.ENABLED.getLocalName(), config); writeAttribute(writer, Attribute.ENABLE_LOOKUPS.getLocalName(), config); writeAttribute(writer, Attribute.PROXY_NAME.getLocalName(), config); writeAttribute(writer, Attribute.PROXY_PORT.getLocalName(), config); writeAttribute(writer, Attribute.SECURE.getLocalName(), config); writeAttribute(writer, Attribute.EXECUTOR.getLocalName(), config); writeAttribute(writer, Attribute.MAX_POST_SIZE.getLocalName(), config); writeAttribute(writer, Attribute.MAX_SAVE_POST_SIZE.getLocalName(), config); writeAttribute(writer, Attribute.MAX_CONNECTIONS.getLocalName(), config); writeAttribute(writer, Attribute.REDIRECT_PORT.getLocalName(), config); if (config.get(SSL).isDefined() && config.get(SSL).has("configuration")) { ModelNode sslConfig = config.get(SSL).get("configuration"); writer.writeStartElement(Element.SSL.getLocalName()); writeAttribute(writer, Attribute.NAME.getLocalName(), sslConfig); writeAttribute(writer, Attribute.KEY_ALIAS.getLocalName(), sslConfig); writeAttribute(writer, Attribute.PASSWORD.getLocalName(), sslConfig); writeAttribute(writer, Attribute.CERTIFICATE_KEY_FILE.getLocalName(), sslConfig); writeAttribute(writer, Attribute.CIPHER_SUITE.getLocalName(), sslConfig); writeAttribute(writer, Attribute.PROTOCOL.getLocalName(), sslConfig); writeAttribute(writer, Attribute.VERIFY_CLIENT.getLocalName(), sslConfig); writeAttribute(writer, Attribute.VERIFY_DEPTH.getLocalName(), sslConfig); writeAttribute(writer, Attribute.CERTIFICATE_FILE.getLocalName(), sslConfig); writeAttribute(writer, Attribute.CA_CERTIFICATE_FILE.getLocalName(), sslConfig); writeAttribute(writer, Attribute.CA_REVOCATION_URL.getLocalName(), sslConfig); writeAttribute(writer, Attribute.SESSION_CACHE_SIZE.getLocalName(), sslConfig); writeAttribute(writer, Attribute.SESSION_TIMEOUT.getLocalName(), sslConfig); writer.writeEndElement(); } if (config.hasDefined(VIRTUAL_SERVER)) { for (final ModelNode virtualServer : config.get(VIRTUAL_SERVER).asList()) { writer.writeEmptyElement(VIRTUAL_SERVER); writer.writeAttribute(NAME, virtualServer.asString()); } } writer.writeEndElement(); } } if (node.hasDefined(VIRTUAL_SERVER)) { for (final Property host : node.get(VIRTUAL_SERVER).asPropertyList()) { final ModelNode config = host.getValue(); writer.writeStartElement(Element.VIRTUAL_SERVER.getLocalName()); writer.writeAttribute(NAME, host.getName()); writeAttribute(writer, Attribute.DEFAULT_WEB_MODULE.getLocalName(), config); if (config.hasDefined(ENABLE_WELCOME_ROOT) && config.get(ENABLE_WELCOME_ROOT).asBoolean()) writer.writeAttribute(ENABLE_WELCOME_ROOT, "true"); if (config.hasDefined(ALIAS)) { for (final ModelNode alias : config.get(ALIAS).asList()) { writer.writeEmptyElement(ALIAS); writer.writeAttribute(NAME, alias.asString()); } } if (config.get(ACCESS_LOG).isDefined() && config.get(ACCESS_LOG).has("configuration")) { ModelNode accessLog = config.get(ACCESS_LOG).get("configuration"); writer.writeStartElement(Element.ACCESS_LOG.getLocalName()); writeAttribute(writer, Attribute.PATTERN.getLocalName(), accessLog); writeAttribute(writer, Attribute.RESOLVE_HOSTS.getLocalName(), accessLog); writeAttribute(writer, Attribute.EXTENDED.getLocalName(), accessLog); writeAttribute(writer, Attribute.PREFIX.getLocalName(), accessLog); writeAttribute(writer, Attribute.ROTATE.getLocalName(), accessLog); if (accessLog.has(DIRECTORY) && accessLog.get(DIRECTORY).has("configuration")) { ModelNode directory = accessLog.get(DIRECTORY).get("configuration"); String name = Element.DIRECTORY.getLocalName(); boolean startwritten = false; startwritten = writeAttribute( writer, Attribute.PATH.getLocalName(), directory, startwritten, name); startwritten = writeAttribute( writer, Attribute.RELATIVE_TO.getLocalName(), directory, startwritten, name); if (startwritten) writer.writeEndElement(); } writer.writeEndElement(); } if (config.hasDefined(REWRITE)) { for (final ModelNode rewritenode : config.get(REWRITE).asList()) { String name = getAddedRule(rewritenode); ModelNode rewrite; if (rewritenode.hasDefined(name)) rewrite = rewritenode.get(name); else rewrite = rewritenode; writer.writeStartElement(REWRITE); writeAttribute(writer, Attribute.PATTERN.getLocalName(), rewrite); writeAttribute(writer, Attribute.SUBSTITUTION.getLocalName(), rewrite); writeAttribute(writer, Attribute.FLAGS.getLocalName(), rewrite); if (rewrite.hasDefined(CONDITION)) { for (final ModelNode conditionnode : rewrite.get(CONDITION).asList()) { String condname = getAddedConditionName(conditionnode); ModelNode condition; if (conditionnode.hasDefined(condname)) condition = conditionnode.get(condname); else condition = conditionnode; writer.writeStartElement(CONDITION); writeAttribute(writer, Attribute.TEST.getLocalName(), condition); writeAttribute(writer, Attribute.PATTERN.getLocalName(), condition); writeAttribute(writer, Attribute.FLAGS.getLocalName(), condition); writer.writeEndElement(); } } writer.writeEndElement(); } } if (config.hasDefined(SSO) && config.get(SSO).has("configuration")) { final ModelNode sso; sso = config.get(SSO).get("configuration"); writer.writeStartElement(SSO); writeAttribute(writer, Attribute.CACHE_CONTAINER.getLocalName(), sso); writeAttribute(writer, Attribute.CACHE_NAME.getLocalName(), sso); writeAttribute(writer, Attribute.DOMAIN.getLocalName(), sso); writeAttribute(writer, Attribute.REAUTHENTICATE.getLocalName(), sso); writer.writeEndElement(); } // End of the VIRTUAL_SERVER writer.writeEndElement(); } } writer.writeEndElement(); }
/** * Attributes used in setting up ModeShape configurations. To mark an attribute as required, mark it * as not allowing null. */ public class ModelAttributes { private static final ParameterValidator ROLE_NAME_VALIDATOR = new StringSetValidator( false, false, "", ModeShapeRoles.ADMIN, ModeShapeRoles.READONLY, ModeShapeRoles.READWRITE); private static final ParameterValidator WORKSPACE_NAME_VALIDATOR = new ModelTypeValidator(ModelType.STRING, false, false, true); private static final ParameterValidator NODE_TYPE_VALIDATOR = new ModelTypeValidator(ModelType.STRING, false, false, true); private static final ParameterValidator INITIAL_CONTENT_VALIDATOR = new ModelTypeValidator(ModelType.PROPERTY, false, false, true); private static final ParameterValidator DEFAULT_INITIAL_CONTENT_VALIDATOR = new ModelTypeValidator(ModelType.STRING, true, false, true); private static final ParameterValidator PATH_EXPRESSION_VALIDATOR = new PathExpressionValidator(false); private static final ParameterValidator PROJECTION_VALIDATOR = new ProjectionValidator(false); private static final ParameterValidator COLUMNS_VALIDATOR = new IndexColumnsValidator(false); private static final ParameterValidator INDEX_KIND_VALIDATOR = new StringSetValidator( true, true, RepositoryConfiguration.FieldValue.KIND_ENUMERATED, RepositoryConfiguration.FieldValue.KIND_NODE_TYPE, RepositoryConfiguration.FieldValue.KIND_TEXT, RepositoryConfiguration.FieldValue.KIND_UNIQUE, RepositoryConfiguration.FieldValue.KIND_VALUE); private static final ParameterValidator REINDEXING_MODE_VALIDATOR = new StringSetValidator( true, true, RepositoryConfiguration.ReindexingMode.IF_MISSING.name(), RepositoryConfiguration.ReindexingMode.INCREMENTAL.name()); private static final ParameterValidator MIME_TYPE_DETECTION_VALIDATOR = new StringSetValidator( true, true, RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_CONTENT, RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NAME, RepositoryConfiguration.FieldValue.MIMETYPE_DETECTION_NONE); public static final SimpleAttributeDefinition ALLOW_WORKSPACE_CREATION = new MappedAttributeDefinitionBuilder(ModelKeys.ALLOW_WORKSPACE_CREATION, ModelType.BOOLEAN) .setXmlName(Attribute.ALLOW_WORKSPACE_CREATION.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(true)) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration(FieldName.WORKSPACES, FieldName.ALLOW_CREATION) .build(); public static final SimpleAttributeDefinition WORKSPACES_CACHE_SIZE = new MappedAttributeDefinitionBuilder(ModelKeys.WORKSPACES_CACHE_SIZE, ModelType.INT) .setXmlName(Attribute.CACHE_SIZE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setValidator(new IntRangeValidator(1)) .build(); public static final ListAttributeDefinition ANONYMOUS_ROLES = MappedListAttributeDefinition.Builder.of( ModelKeys.ANONYMOUS_ROLES, new MappedAttributeDefinitionBuilder(ModelKeys.ANONYMOUS_ROLE, ModelType.STRING) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue( new ModelNode().add(new ModelNode().set(ModeShapeRoles.READONLY))) .setValidator(ROLE_NAME_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setAccessConstraints( SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN_REF) .build()) .setAllowNull(true) .setMinSize(0) .setMaxSize(100) .setFieldPathInRepositoryConfiguration( FieldName.SECURITY, FieldName.ANONYMOUS, FieldName.ANONYMOUS_ROLES) .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN_REF) .build(); public static final SimpleAttributeDefinition ANONYMOUS_USERNAME = new MappedAttributeDefinitionBuilder(ModelKeys.ANONYMOUS_USERNAME, ModelType.STRING) .setXmlName(Attribute.ANONYMOUS_USERNAME.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("<anonymous>")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN_REF) .setFieldPathInRepositoryConfiguration( FieldName.SECURITY, FieldName.ANONYMOUS, FieldName.ANONYMOUS_USERNAME) .build(); public static final SimpleAttributeDefinition AUTHENTICATOR_CLASSNAME = new MappedAttributeDefinitionBuilder(ModelKeys.AUTHENTICATOR_CLASSNAME, ModelType.STRING) .setXmlName(Attribute.CLASSNAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.SECURITY, FieldName.PROVIDERS, FieldName.CLASSNAME) .build(); public static final SimpleAttributeDefinition CACHE_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.CACHE_NAME, ModelType.STRING) .setXmlName(Attribute.CACHE_NAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition CACHE_CONFIG = new MappedAttributeDefinitionBuilder(ModelKeys.CACHE_CONFIG, ModelType.STRING) .setXmlName(Attribute.CACHE_CONFIG.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition CONFIG_RELATIVE_TO = new MappedAttributeDefinitionBuilder(ModelKeys.CONFIG_RELATIVE_TO, ModelType.STRING) .setXmlName(Attribute.CONFIG_RELATIVE_TO.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setDefaultValue(new ModelNode().set(ModeShapeExtension.JBOSS_CONFIG_DIR_VARIABLE)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition CLASSNAME = new MappedAttributeDefinitionBuilder(ModelKeys.CLASSNAME, ModelType.STRING) .setXmlName(Attribute.CLASSNAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition DATA_SOURCE_JNDI_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.DATA_SOURCE_JNDI_NAME, ModelType.STRING) .setXmlName(Attribute.DATA_SOURCE_JNDI_NAME.getLocalName()) .setAllowExpression(true) .setAllowNull(false) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition DEFAULT_WORKSPACE = new MappedAttributeDefinitionBuilder(ModelKeys.DEFAULT_WORKSPACE, ModelType.STRING) .setXmlName(Attribute.DEFAULT_WORKSPACE.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("default")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration(FieldName.WORKSPACES, FieldName.DEFAULT) .build(); public static final SimpleAttributeDefinition ENABLE_MONITORING = new MappedAttributeDefinitionBuilder(ModelKeys.ENABLE_MONITORING, ModelType.BOOLEAN) .setXmlName(Attribute.ENABLE_MONITORING.getLocalName()) .setAllowNull(true) .setAllowExpression(true) .setDefaultValue(new ModelNode().set(true)) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration(FieldName.MONITORING, FieldName.MONITORING_ENABLED) .build(); public static final SimpleAttributeDefinition GARBAGE_COLLECTION_THREAD_POOL = new MappedAttributeDefinitionBuilder( ModelKeys.GARBAGE_COLLECTION_THREAD_POOL, ModelType.STRING) .setXmlName(Attribute.GARBAGE_COLLECTION_THREAD_POOL.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("modeshape-gc")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.GARBAGE_COLLECTION, FieldName.THREAD_POOL) .build(); public static final SimpleAttributeDefinition GARBAGE_COLLECTION_INITIAL_TIME = new MappedAttributeDefinitionBuilder( ModelKeys.GARBAGE_COLLECTION_INITIAL_TIME, ModelType.STRING) .setXmlName(Attribute.GARBAGE_COLLECTION_INITIAL_TIME.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("00:00")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.GARBAGE_COLLECTION, FieldName.INITIAL_TIME) .build(); public static final SimpleAttributeDefinition GARBAGE_COLLECTION_INTERVAL = new MappedAttributeDefinitionBuilder(ModelKeys.GARBAGE_COLLECTION_INTERVAL, ModelType.INT) .setXmlName(Attribute.GARBAGE_COLLECTION_INTERVAL.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(24)) .setMeasurementUnit(MeasurementUnit.HOURS) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.GARBAGE_COLLECTION, FieldName.INTERVAL_IN_HOURS) .build(); public static final SimpleAttributeDefinition DOCUMENT_OPTIMIZATION_THREAD_POOL = new MappedAttributeDefinitionBuilder( ModelKeys.DOCUMENT_OPTIMIZATION_THREAD_POOL, ModelType.STRING) .setXmlName(Attribute.DOCUMENT_OPTIMIZATION_THREAD_POOL.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("modeshape-opt")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.DOCUMENT_OPTIMIZATION, FieldName.THREAD_POOL) .build(); public static final SimpleAttributeDefinition DOCUMENT_OPTIMIZATION_INITIAL_TIME = new MappedAttributeDefinitionBuilder( ModelKeys.DOCUMENT_OPTIMIZATION_INITIAL_TIME, ModelType.STRING) .setXmlName(Attribute.DOCUMENT_OPTIMIZATION_INITIAL_TIME.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("00:00")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.DOCUMENT_OPTIMIZATION, FieldName.INITIAL_TIME) .build(); public static final SimpleAttributeDefinition DOCUMENT_OPTIMIZATION_INTERVAL = new MappedAttributeDefinitionBuilder(ModelKeys.DOCUMENT_OPTIMIZATION_INTERVAL, ModelType.INT) .setXmlName(Attribute.DOCUMENT_OPTIMIZATION_INTERVAL.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(24)) .setMeasurementUnit(MeasurementUnit.HOURS) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.DOCUMENT_OPTIMIZATION, FieldName.INTERVAL_IN_HOURS) .build(); public static final SimpleAttributeDefinition DOCUMENT_OPTIMIZATION_CHILD_COUNT_TARGET = new MappedAttributeDefinitionBuilder( ModelKeys.DOCUMENT_OPTIMIZATION_CHILD_COUNT_TARGET, ModelType.INT) .setXmlName(Attribute.DOCUMENT_OPTIMIZATION_CHILD_COUNT_TARGET.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.DOCUMENT_OPTIMIZATION, FieldName.OPTIMIZATION_CHILD_COUNT_TARGET) .build(); public static final SimpleAttributeDefinition DOCUMENT_OPTIMIZATION_CHILD_COUNT_TOLERANCE = new MappedAttributeDefinitionBuilder( ModelKeys.DOCUMENT_OPTIMIZATION_CHILD_COUNT_TOLERANCE, ModelType.INT) .setXmlName(Attribute.DOCUMENT_OPTIMIZATION_CHILD_COUNT_TOLERANCE.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.DOCUMENT_OPTIMIZATION, FieldName.OPTIMIZATION_CHILD_COUNT_TOLERANCE) .build(); public static final SimpleAttributeDefinition EVENT_BUS_SIZE = new MappedAttributeDefinitionBuilder(ModelKeys.EVENT_BUS_SIZE, ModelType.INT) .setXmlName(Attribute.EVENT_BUS_SIZE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration(FieldName.EVENT_BUS_SIZE) .build(); public static final SimpleAttributeDefinition REINDEXING_ASYNC = new MappedAttributeDefinitionBuilder(ModelKeys.REINDEXING_ASYNC, ModelType.BOOLEAN) .setXmlName(Attribute.REINDEXING_ASNC.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFieldPathInRepositoryConfiguration(FieldName.REINDEXING, FieldName.REINDEXING_ASYNC) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition REINDEXING_MODE = new MappedAttributeDefinitionBuilder(ModelKeys.REINDEXING_MODE, ModelType.STRING) .setXmlName(Attribute.REINDEXING_MODE.getLocalName()) .setAllowExpression(false) .setValidator(REINDEXING_MODE_VALIDATOR) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFieldPathInRepositoryConfiguration(FieldName.REINDEXING, FieldName.REINDEXING_MODE) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition INDEX_KIND = new MappedAttributeDefinitionBuilder(ModelKeys.INDEX_KIND, ModelType.STRING) .setXmlName(Attribute.INDEX_KIND.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(IndexKind.VALUE.toString())) .setValidator(INDEX_KIND_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition SYNCHRONOUS = new MappedAttributeDefinitionBuilder(ModelKeys.SYNCHRONOUS, ModelType.BOOLEAN) .setXmlName(Attribute.SYNCHRONOUS.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(Boolean.TRUE)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition JNDI_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.JNDI_NAME, ModelType.STRING) .setXmlName(Attribute.JNDI_NAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition MINIMUM_BINARY_SIZE = new MappedAttributeDefinitionBuilder(ModelKeys.MINIMUM_BINARY_SIZE, ModelType.INT) .setXmlName(Attribute.MIN_VALUE_SIZE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.BYTES) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.BINARY_STORAGE, FieldName.MINIMUM_BINARY_SIZE_IN_BYTES) .build(); public static final SimpleAttributeDefinition MINIMUM_STRING_SIZE = new MappedAttributeDefinitionBuilder(ModelKeys.MINIMUM_STRING_SIZE, ModelType.INT) .setXmlName(Attribute.MIN_STRING_SIZE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.BINARY_STORAGE, FieldName.MINIMUM_STRING_SIZE) .build(); public static final SimpleAttributeDefinition MIME_TYPE_DETECTION = new MappedAttributeDefinitionBuilder(ModelKeys.MIME_TYPE_DETECTION, ModelType.STRING) .setXmlName(Attribute.MIME_TYPE_DETECTION.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setMeasurementUnit(MeasurementUnit.NONE) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setValidator(MIME_TYPE_DETECTION_VALIDATOR) .setFieldPathInRepositoryConfiguration( FieldName.STORAGE, FieldName.BINARY_STORAGE, FieldName.MIMETYPE_DETECTION) .build(); public static final SimpleAttributeDefinition MODULE = new MappedAttributeDefinitionBuilder(ModelKeys.MODULE, ModelType.STRING) .setXmlName(Attribute.MODULE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition NAME = new MappedAttributeDefinitionBuilder(ModelKeys.NAME, ModelType.STRING) .setXmlName(Attribute.NAME.getLocalName()) .setAllowExpression(false) .setAllowNull(false) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition NODE_TYPE_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.NODE_TYPE_NAME, ModelType.STRING) .setXmlName(Attribute.NODE_TYPE.getLocalName()) .setAllowExpression(true) .setAllowNull(false) .setValidator(NODE_TYPE_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition INDEX_COLUMNS = new MappedAttributeDefinitionBuilder(ModelKeys.INDEX_COLUMNS, ModelType.STRING) .setXmlName(Attribute.COLUMNS.getLocalName()) .setAllowExpression(true) .setAllowNull(false) .setValidator(COLUMNS_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition PROVIDER_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.PROVIDER_NAME, ModelType.STRING) .setXmlName(Attribute.PROVIDER_NAME.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition PATH = new MappedAttributeDefinitionBuilder(ModelKeys.PATH, ModelType.STRING) .setXmlName(Attribute.PATH.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition TRASH = new MappedAttributeDefinitionBuilder(ModelKeys.TRASH, ModelType.STRING) .setXmlName(Attribute.TRASH.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final ListAttributeDefinition PATH_EXPRESSIONS = MappedListAttributeDefinition.Builder.of( ModelKeys.PATH_EXPRESSIONS, new MappedAttributeDefinitionBuilder(ModelKeys.PATH_EXPRESSION, ModelType.STRING) .setAllowExpression(true) .setAllowNull(false) .setValidator(PATH_EXPRESSION_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build()) .setAllowNull(true) .setMinSize(0) .setFieldPathInRepositoryConfiguration( FieldName.SEQUENCING, FieldName.SEQUENCERS, FieldName.PATH_EXPRESSIONS) .build(); public static final ListAttributeDefinition PROJECTIONS = MappedListAttributeDefinition.Builder.of( ModelKeys.PROJECTIONS, new MappedAttributeDefinitionBuilder(ModelKeys.PROJECTION, ModelType.STRING) .setAllowExpression(true) .setAllowNull(false) .setValidator(PROJECTION_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build()) .setAllowNull(true) .setMinSize(1) .build(); public static final SimpleAttributeDefinition CONNECTOR_CLASSNAME = new MappedAttributeDefinitionBuilder(ModelKeys.CONNECTOR_CLASSNAME, ModelType.STRING) .setXmlName(Attribute.CLASSNAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition CACHEABLE = new MappedAttributeDefinitionBuilder(ModelKeys.CACHEABLE, ModelType.BOOLEAN) .setXmlName(Attribute.CACHEABLE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition QUERYABLE = new MappedAttributeDefinitionBuilder(ModelKeys.QUERYABLE, ModelType.BOOLEAN) .setXmlName(Attribute.QUERYABLE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition READONLY = new MappedAttributeDefinitionBuilder(ModelKeys.READONLY, ModelType.BOOLEAN) .setXmlName(Attribute.READONLY.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setDefaultValue(new ModelNode(false)) .build(); public static final SimpleAttributeDefinition EXPOSE_AS_WORKSPACE = new MappedAttributeDefinitionBuilder(ModelKeys.EXPOSE_AS_WORKSPACE, ModelType.STRING) .setXmlName(Attribute.EXPOSE_AS_WORKSPACE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setDefaultValue(new ModelNode(false)) .build(); public static final ListAttributeDefinition PREDEFINED_WORKSPACE_NAMES = MappedListAttributeDefinition.Builder.of( ModelKeys.PREDEFINED_WORKSPACE_NAMES, new MappedAttributeDefinitionBuilder( ModelKeys.PREDEFINED_WORKSPACE_NAME, ModelType.STRING) .setAllowExpression(true) .setAllowNull(false) .setValidator(WORKSPACE_NAME_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build()) .setAllowNull(true) .setMinSize(0) .setFieldPathInRepositoryConfiguration(FieldName.WORKSPACES, FieldName.PREDEFINED) .build(); public static final SimpleAttributeDefinition DEFAULT_INITIAL_CONTENT = new MappedAttributeDefinitionBuilder(ModelKeys.DEFAULT_INITIAL_CONTENT, ModelType.STRING) .setAllowExpression(false) .setAllowNull(true) .setValidator(DEFAULT_INITIAL_CONTENT_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final ListAttributeDefinition WORKSPACES_INITIAL_CONTENT = MappedListAttributeDefinition.Builder.of( ModelKeys.WORKSPACES_INITIAL_CONTENT, new MappedAttributeDefinitionBuilder(ModelKeys.INITIAL_CONTENT, ModelType.PROPERTY) .setAllowNull(false) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setValidator(INITIAL_CONTENT_VALIDATOR) .build()) .setAllowNull(true) .setMinSize(0) .build(); public static final ListAttributeDefinition NODE_TYPES = MappedListAttributeDefinition.Builder.of( ModelKeys.NODE_TYPES, new MappedAttributeDefinitionBuilder(ModelKeys.NODE_TYPE, ModelType.STRING) .setAllowExpression(true) .setAllowNull(false) .setValidator(NODE_TYPE_VALIDATOR) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build()) .setAllowNull(true) .setMinSize(0) .build(); public static final SimpleAttributeDefinition PROPERTY = new SimpleAttributeDefinition(ModelKeys.PROPERTY, ModelType.PROPERTY, true); public static final SimpleListAttributeDefinition PROPERTIES = SimpleListAttributeDefinition.Builder.of(ModelKeys.PROPERTIES, PROPERTY) .setAllowNull(true) .build(); public static final SimpleAttributeDefinition RELATIVE_TO = new MappedAttributeDefinitionBuilder(ModelKeys.RELATIVE_TO, ModelType.STRING) .setXmlName(Attribute.RELATIVE_TO.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(JBOSS_DATA_DIR_VARIABLE)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition SEQUENCER_CLASSNAME = new MappedAttributeDefinitionBuilder(ModelKeys.SEQUENCER_CLASSNAME, ModelType.STRING) .setXmlName(Attribute.CLASSNAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.SEQUENCING, FieldName.SEQUENCERS, FieldName.CLASSNAME) .build(); public static final SimpleAttributeDefinition SEQUENCER_THREAD_POOL_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.SEQUENCERS_THREAD_POOL_NAME, ModelType.STRING) .setXmlName(Attribute.THREAD_POOL_NAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setDefaultValue(new ModelNode().set(RepositoryConfiguration.Default.SEQUENCING_POOL)) .setFieldPathInRepositoryConfiguration( FieldName.SEQUENCING, FieldName.SEQUENCERS, FieldName.THREAD_POOL) .build(); public static final SimpleAttributeDefinition SEQUENCER_MAX_POOL_SIZE = new MappedAttributeDefinitionBuilder(ModelKeys.SEQUENCERS_MAX_POOL_SIZE, ModelType.STRING) .setXmlName(Attribute.MAX_POOL_SIZE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setDefaultValue( new ModelNode().set(RepositoryConfiguration.Default.SEQUENCING_MAX_POOL_SIZE)) .setFieldPathInRepositoryConfiguration( FieldName.SEQUENCING, FieldName.SEQUENCERS, FieldName.MAX_POOL_SIZE) .build(); public static final SimpleAttributeDefinition STORE_NAME = new MappedAttributeDefinitionBuilder(ModelKeys.STORE_NAME, ModelType.STRING) .setXmlName(Attribute.STORE_NAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final ListAttributeDefinition NESTED_STORES = MappedListAttributeDefinition.Builder.of( ModelKeys.NESTED_STORES, new MappedAttributeDefinitionBuilder(ModelKeys.STORE_NAME, ModelType.STRING) .setAllowExpression(false) .setAllowNull(false) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build()) .setAllowNull(false) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition TEXT_EXTRACTOR_CLASSNAME = new MappedAttributeDefinitionBuilder(ModelKeys.TEXT_EXTRACTOR_CLASSNAME, ModelType.STRING) .setXmlName(Attribute.CLASSNAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setFieldPathInRepositoryConfiguration( FieldName.TEXT_EXTRACTION, FieldName.EXTRACTORS, FieldName.CLASSNAME) .build(); public static final SimpleAttributeDefinition TEXT_EXTRACTOR_THREAD_POOL_NAME = new MappedAttributeDefinitionBuilder( ModelKeys.TEXT_EXTRACTORS_THREAD_POOL_NAME, ModelType.STRING) .setXmlName(Attribute.THREAD_POOL_NAME.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setDefaultValue( new ModelNode().set(RepositoryConfiguration.Default.TEXT_EXTRACTION_POOL)) .setFieldPathInRepositoryConfiguration( FieldName.TEXT_EXTRACTION, FieldName.EXTRACTORS, FieldName.THREAD_POOL) .build(); public static final SimpleAttributeDefinition TEXT_EXTRACTOR_MAX_POOL_SIZE = new MappedAttributeDefinitionBuilder( ModelKeys.TEXT_EXTRACTORS_MAX_POOL_SIZE, ModelType.STRING) .setXmlName(Attribute.MAX_POOL_SIZE.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setDefaultValue( new ModelNode().set(RepositoryConfiguration.Default.TEXT_EXTRACTION_MAX_POOL_SIZE)) .setFieldPathInRepositoryConfiguration( FieldName.TEXT_EXTRACTION, FieldName.EXTRACTORS, FieldName.MAX_POOL_SIZE) .build(); public static final SimpleAttributeDefinition SECURITY_DOMAIN = new MappedAttributeDefinitionBuilder(ModelKeys.SECURITY_DOMAIN, ModelType.STRING) .setXmlName(Attribute.SECURITY_DOMAIN.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("modeshape-security")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN_REF) .setFieldPathInRepositoryConfiguration( FieldName.SECURITY, FieldName.JAAS, FieldName.JAAS_POLICY_NAME) .build(); public static final SimpleAttributeDefinition USE_ANONYMOUS_IF_AUTH_FAILED = new MappedAttributeDefinitionBuilder( ModelKeys.USE_ANONYMOUS_IF_AUTH_FAILED, ModelType.BOOLEAN) .setXmlName(Attribute.USE_ANONYMOUS_IF_AUTH_FAILED.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_NONE) .setAccessConstraints(SensitiveTargetAccessConstraintDefinition.SECURITY_DOMAIN_REF) .setFieldPathInRepositoryConfiguration( FieldName.SECURITY, FieldName.ANONYMOUS, FieldName.USE_ANONYMOUS_ON_FAILED_LOGINS) .build(); public static final SimpleAttributeDefinition EXPLODED = new MappedAttributeDefinitionBuilder(ModelKeys.EXPLODED, ModelType.BOOLEAN) .setXmlName(Attribute.EXPLODED.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setDefaultValue(new ModelNode().set(false)) .build(); public static final SimpleAttributeDefinition JOURNALING = new MappedAttributeDefinitionBuilder(ModelKeys.JOURNALING, ModelType.BOOLEAN) .setXmlName(Attribute.JOURNALING.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setDefaultValue(new ModelNode(false)) .build(); public static final SimpleAttributeDefinition JOURNAL_PATH = new MappedAttributeDefinitionBuilder(ModelKeys.JOURNAL_PATH, ModelType.STRING) .setXmlName(Attribute.JOURNAL_PATH.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition JOURNAL_RELATIVE_TO = new MappedAttributeDefinitionBuilder(ModelKeys.JOURNAL_RELATIVE_TO, ModelType.STRING) .setXmlName(Attribute.JOURNAL_RELATIVE_TO.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition MAX_DAYS_TO_KEEP_RECORDS = new MappedAttributeDefinitionBuilder(ModelKeys.MAX_DAYS_TO_KEEP_RECORDS, ModelType.INT) .setXmlName(Attribute.MAX_DAYS_TO_KEEP_RECORDS.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setDefaultValue(new ModelNode(-1)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition ASYNC_WRITES = new MappedAttributeDefinitionBuilder(ModelKeys.ASYNC_WRITES, ModelType.BOOLEAN) .setXmlName(Attribute.ASYNC_WRITES.getLocalName()) .setAllowExpression(false) .setAllowNull(true) .setDefaultValue(new ModelNode(false)) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); public static final SimpleAttributeDefinition JOURNAL_GC_THREAD_POOL = new MappedAttributeDefinitionBuilder(ModelKeys.JOURNAL_GC_THREAD_POOL, ModelType.STRING) .setXmlName(Attribute.JOURNAL_GC_THREAD_POOL.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("modeshape-journaling-gc")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final SimpleAttributeDefinition JOURNAL_GC_INITIAL_TIME = new MappedAttributeDefinitionBuilder(ModelKeys.JOURNAL_GC_INITIAL_TIME, ModelType.STRING) .setXmlName(Attribute.JOURNAL_GC_INITIAL_TIME.getLocalName()) .setAllowExpression(true) .setAllowNull(true) .setDefaultValue(new ModelNode().set("00:00")) .setFlags(AttributeAccess.Flag.RESTART_NONE) .build(); public static final AttributeDefinition[] SUBSYSTEM_ATTRIBUTES = {}; public static final AttributeDefinition[] WEBAPP_ATTRIBUTES = {EXPLODED}; public static final AttributeDefinition[] REPOSITORY_ATTRIBUTES = { CACHE_NAME, CACHE_CONFIG, CONFIG_RELATIVE_TO, JNDI_NAME, ENABLE_MONITORING, SECURITY_DOMAIN, ANONYMOUS_ROLES, ANONYMOUS_USERNAME, USE_ANONYMOUS_IF_AUTH_FAILED, NODE_TYPES, DEFAULT_WORKSPACE, PREDEFINED_WORKSPACE_NAMES, ALLOW_WORKSPACE_CREATION, WORKSPACES_CACHE_SIZE, DEFAULT_INITIAL_CONTENT, WORKSPACES_INITIAL_CONTENT, GARBAGE_COLLECTION_THREAD_POOL, GARBAGE_COLLECTION_INITIAL_TIME, GARBAGE_COLLECTION_INTERVAL, DOCUMENT_OPTIMIZATION_THREAD_POOL, DOCUMENT_OPTIMIZATION_INITIAL_TIME, DOCUMENT_OPTIMIZATION_INTERVAL, DOCUMENT_OPTIMIZATION_CHILD_COUNT_TARGET, DOCUMENT_OPTIMIZATION_CHILD_COUNT_TOLERANCE, JOURNAL_PATH, JOURNAL_RELATIVE_TO, MAX_DAYS_TO_KEEP_RECORDS, JOURNAL_GC_INITIAL_TIME, JOURNAL_GC_THREAD_POOL, ASYNC_WRITES, JOURNALING, SEQUENCER_THREAD_POOL_NAME, SEQUENCER_MAX_POOL_SIZE, TEXT_EXTRACTOR_THREAD_POOL_NAME, TEXT_EXTRACTOR_MAX_POOL_SIZE, EVENT_BUS_SIZE, REINDEXING_ASYNC, REINDEXING_MODE }; public static final AttributeDefinition[] TRANSIENT_BINARY_STORAGE_ATTRIBUTES = { MINIMUM_BINARY_SIZE, MINIMUM_STRING_SIZE, MIME_TYPE_DETECTION }; public static final AttributeDefinition[] FILE_BINARY_STORAGE_ATTRIBUTES = { MINIMUM_BINARY_SIZE, MINIMUM_STRING_SIZE, PATH, TRASH, RELATIVE_TO, STORE_NAME, MIME_TYPE_DETECTION }; public static final AttributeDefinition[] DATABASE_BINARY_STORAGE_ATTRIBUTES = { MINIMUM_BINARY_SIZE, MINIMUM_STRING_SIZE, DATA_SOURCE_JNDI_NAME, STORE_NAME, MIME_TYPE_DETECTION }; public static final AttributeDefinition[] COMPOSITE_BINARY_STORAGE_ATTRIBUTES = { MINIMUM_BINARY_SIZE, MINIMUM_STRING_SIZE, NESTED_STORES, MIME_TYPE_DETECTION }; public static final AttributeDefinition[] CUSTOM_BINARY_STORAGE_ATTRIBUTES = { MINIMUM_BINARY_SIZE, MINIMUM_STRING_SIZE, CLASSNAME, MODULE, STORE_NAME, MIME_TYPE_DETECTION }; public static final AttributeDefinition[] INDEX_DEFINITION_ATTRIBUTES = { INDEX_KIND, PROVIDER_NAME, NODE_TYPE_NAME, SYNCHRONOUS, INDEX_COLUMNS, PROPERTIES }; public static final AttributeDefinition[] INDEX_PROVIDER_ATTRIBUTES = { CLASSNAME, MODULE, RELATIVE_TO, PATH, PROPERTIES }; public static final AttributeDefinition[] SEQUENCER_ATTRIBUTES = { PATH_EXPRESSIONS, SEQUENCER_CLASSNAME, MODULE, PROPERTIES }; public static final AttributeDefinition[] SOURCE_ATTRIBUTES = { PROJECTIONS, CONNECTOR_CLASSNAME, READONLY, CACHEABLE, QUERYABLE, MODULE, PROPERTIES, EXPOSE_AS_WORKSPACE }; public static final AttributeDefinition[] TEXT_EXTRACTOR_ATTRIBUTES = { TEXT_EXTRACTOR_CLASSNAME, MODULE, PROPERTIES }; public static final AttributeDefinition[] AUTHENTICATOR_ATTRIBUTES = { AUTHENTICATOR_CLASSNAME, MODULE, PROPERTIES }; }
/** * Resource description for the addressable resource * /subsystem=infinispan/cache-container=X/cache=Y/store=STORE * * @author Richard Achmatowicz (c) 2011 Red Hat Inc. */ public class FileStoreResource extends BaseStoreResource { public static final PathElement FILE_STORE_PATH = PathElement.pathElement(ModelKeys.FILE_STORE); // attributes static final SimpleAttributeDefinition MAX_ENTRIES = new SimpleAttributeDefinitionBuilder(ModelKeys.MAX_ENTRIES, ModelType.INT, true) .setXmlName(Attribute.MAX_ENTRIES.getLocalName()) .setAllowExpression(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); static final SimpleAttributeDefinition PATH = new SimpleAttributeDefinitionBuilder(ModelKeys.PATH, ModelType.STRING, true) .setXmlName(Attribute.PATH.getLocalName()) .setAllowExpression(true) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .build(); static final SimpleAttributeDefinition RELATIVE_TO = new SimpleAttributeDefinitionBuilder(ModelKeys.RELATIVE_TO, ModelType.STRING, true) .setXmlName(Attribute.RELATIVE_TO.getLocalName()) .setAllowExpression(false) .setFlags(AttributeAccess.Flag.RESTART_RESOURCE_SERVICES) .setDefaultValue(new ModelNode().set(ServerEnvironment.SERVER_DATA_DIR)) .build(); static final AttributeDefinition[] FILE_STORE_ATTRIBUTES = {MAX_ENTRIES, RELATIVE_TO, PATH}; static final SimpleAttributeDefinition NAME = new SimpleAttributeDefinitionBuilder(BaseStoreResource.NAME) .setDefaultValue(new ModelNode().set(ModelKeys.FILE_STORE_NAME)) .build(); // operations private static final OperationDefinition FILE_STORE_ADD_DEFINITION = new SimpleOperationDefinitionBuilder( ADD, InfinispanExtension.getResourceDescriptionResolver(ModelKeys.FILE_STORE)) .setParameters(COMMON_STORE_PARAMETERS) .addParameter(MAX_ENTRIES) .addParameter(RELATIVE_TO) .addParameter(PATH) .setAttributeResolver( InfinispanExtension.getResourceDescriptionResolver(ModelKeys.FILE_STORE)) .build(); private final ResolvePathHandler resolvePathHandler; public FileStoreResource(CacheResource cacheResource, ResolvePathHandler resolvePathHandler) { super(FILE_STORE_PATH, ModelKeys.FILE_STORE, cacheResource, FILE_STORE_ATTRIBUTES); this.resolvePathHandler = resolvePathHandler; } @Override public void registerOperations(ManagementResourceRegistration resourceRegistration) { super.registerOperations(resourceRegistration); } // override the add operation to provide a custom definition (for the optional PROPERTIES // parameter to add()) @Override protected void registerAddOperation( final ManagementResourceRegistration registration, final OperationStepHandler handler, OperationEntry.Flag... flags) { registration.registerOperationHandler(FILE_STORE_ADD_DEFINITION, handler); if (resolvePathHandler != null) { registration.registerOperationHandler( resolvePathHandler.getOperationDefinition(), resolvePathHandler); } } }
/** * {@link org.jboss.as.controller.ResourceDefinition} for the root resource of the transaction * subsystem. * * @author Brian Stansberry (c) 2011 Red Hat Inc. */ public class TransactionSubsystemRootResourceDefinition extends SimpleResourceDefinition { public static final RuntimeCapability<Void> TRANSACTION_CAPABILITY = RuntimeCapability.Builder.of("org.wildfly.transactions").build(); // recovery environment public static final SimpleAttributeDefinition BINDING = new SimpleAttributeDefinitionBuilder(CommonAttributes.BINDING, ModelType.STRING, false) .setValidator(new StringLengthValidator(1)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.BINDING.getLocalName()) .setAllowExpression(true) .addAccessConstraint(SensitiveTargetAccessConstraintDefinition.SOCKET_BINDING_REF) .build(); public static final SimpleAttributeDefinition STATUS_BINDING = new SimpleAttributeDefinitionBuilder(CommonAttributes.STATUS_BINDING, ModelType.STRING, false) .setValidator(new StringLengthValidator(1)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.STATUS_BINDING.getLocalName()) .setAllowExpression(true) .addAccessConstraint(SensitiveTargetAccessConstraintDefinition.SOCKET_BINDING_REF) .build(); public static final SimpleAttributeDefinition RECOVERY_LISTENER = new SimpleAttributeDefinitionBuilder( CommonAttributes.RECOVERY_LISTENER, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.RECOVERY_LISTENER.getLocalName()) .setAllowExpression(true) .build(); // core environment public static final SimpleAttributeDefinition NODE_IDENTIFIER = new SimpleAttributeDefinitionBuilder(CommonAttributes.NODE_IDENTIFIER, ModelType.STRING, true) .setDefaultValue(new ModelNode().set("1")) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setAllowExpression(true) .setValidator(new StringBytesLengthValidator(0, 23, true, true)) .build(); public static final SimpleAttributeDefinition PROCESS_ID_UUID = new SimpleAttributeDefinitionBuilder("process-id-uuid", ModelType.BOOLEAN, false) .setDefaultValue(new ModelNode().set(false)) .setAlternatives("process-id-socket-binding") .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .build(); public static final SimpleAttributeDefinition PROCESS_ID_SOCKET_BINDING = new SimpleAttributeDefinitionBuilder("process-id-socket-binding", ModelType.STRING, false) .setValidator(new StringLengthValidator(1, true)) .setAlternatives("process-id-uuid") .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.BINDING.getLocalName()) .setAllowExpression(true) .addAccessConstraint(SensitiveTargetAccessConstraintDefinition.SOCKET_BINDING_REF) .build(); public static final SimpleAttributeDefinition PROCESS_ID_SOCKET_MAX_PORTS = new SimpleAttributeDefinitionBuilder("process-id-socket-max-ports", ModelType.INT, true) .setValidator(new IntRangeValidator(1, true)) .setDefaultValue(new ModelNode().set(10)) .setRequires("process-id-socket-binding") .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.SOCKET_PROCESS_ID_MAX_PORTS.getLocalName()) .setAllowExpression(true) .addAccessConstraint(SensitiveTargetAccessConstraintDefinition.SOCKET_CONFIG) .build(); // coordinator environment public static final SimpleAttributeDefinition STATISTICS_ENABLED = new SimpleAttributeDefinitionBuilder( CommonAttributes.STATISTICS_ENABLED, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) // TODO should be runtime-changeable .setAllowExpression(true) .build(); public static final SimpleAttributeDefinition ENABLE_STATISTICS = new SimpleAttributeDefinitionBuilder( CommonAttributes.ENABLE_STATISTICS, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) // TODO should be runtime-changeable .setXmlName(Attribute.ENABLE_STATISTICS.getLocalName()) .setDeprecated(ModelVersion.create(2)) .setAllowExpression(true) .build(); public static final SimpleAttributeDefinition ENABLE_TSM_STATUS = new SimpleAttributeDefinitionBuilder( CommonAttributes.ENABLE_TSM_STATUS, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) // TODO is this runtime-changeable? .setXmlName(Attribute.ENABLE_TSM_STATUS.getLocalName()) .setAllowExpression(true) .build(); public static final SimpleAttributeDefinition DEFAULT_TIMEOUT = new SimpleAttributeDefinitionBuilder(CommonAttributes.DEFAULT_TIMEOUT, ModelType.INT, true) .setMeasurementUnit(MeasurementUnit.SECONDS) .setDefaultValue(new ModelNode().set(300)) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) // TODO is this runtime-changeable? .setXmlName(Attribute.DEFAULT_TIMEOUT.getLocalName()) .setAllowExpression(true) .build(); // object store public static final SimpleAttributeDefinition OBJECT_STORE_RELATIVE_TO = new SimpleAttributeDefinitionBuilder( CommonAttributes.OBJECT_STORE_RELATIVE_TO, ModelType.STRING, true) .setDefaultValue(new ModelNode().set("jboss.server.data.dir")) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.RELATIVE_TO.getLocalName()) .setAllowExpression(true) .build(); public static final SimpleAttributeDefinition OBJECT_STORE_PATH = new SimpleAttributeDefinitionBuilder( CommonAttributes.OBJECT_STORE_PATH, ModelType.STRING, true) .setDefaultValue(new ModelNode().set("tx-object-store")) .setFlags(AttributeAccess.Flag.RESTART_ALL_SERVICES) .setXmlName(Attribute.PATH.getLocalName()) .setAllowExpression(true) .build(); public static final SimpleAttributeDefinition JTS = new SimpleAttributeDefinitionBuilder(CommonAttributes.JTS, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags( AttributeAccess.Flag .RESTART_JVM) // I think the use of statics in arjunta will require a JVM restart .setAllowExpression(false) .build(); public static final SimpleAttributeDefinition USEHORNETQSTORE = new SimpleAttributeDefinitionBuilder( CommonAttributes.USEHORNETQSTORE, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setAlternatives(CommonAttributes.USE_JDBC_STORE) .setAllowExpression(false) .build(); public static final SimpleAttributeDefinition HORNETQ_STORE_ENABLE_ASYNC_IO = new SimpleAttributeDefinitionBuilder( CommonAttributes.HORNETQ_STORE_ENABLE_ASYNC_IO, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode().set(false)) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.ENABLE_ASYNC_IO.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USEHORNETQSTORE) .build(); public static final SimpleAttributeDefinition USE_JDBC_STORE = new SimpleAttributeDefinitionBuilder(CommonAttributes.USE_JDBC_STORE, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode(false)) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setAlternatives(CommonAttributes.USEHORNETQSTORE) .setAllowExpression(false) .build(); public static final SimpleAttributeDefinition JDBC_STORE_DATASOURCE = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_STORE_DATASOURCE, ModelType.STRING, true) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.DATASOURCE_JNDI_NAME.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); public static final SimpleAttributeDefinition JDBC_ACTION_STORE_TABLE_PREFIX = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_ACTION_STORE_TABLE_PREFIX, ModelType.STRING, true) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.TABLE_PREFIX.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); public static final SimpleAttributeDefinition JDBC_ACTION_STORE_DROP_TABLE = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_ACTION_STORE_DROP_TABLE, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode(false)) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.DROP_TABLE.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); public static final SimpleAttributeDefinition JDBC_COMMUNICATION_STORE_TABLE_PREFIX = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_COMMUNICATION_STORE_TABLE_PREFIX, ModelType.STRING, true) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.TABLE_PREFIX.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); public static final SimpleAttributeDefinition JDBC_COMMUNICATION_STORE_DROP_TABLE = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_COMMUNICATION_STORE_DROP_TABLE, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode(false)) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.DROP_TABLE.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); public static final SimpleAttributeDefinition JDBC_STATE_STORE_TABLE_PREFIX = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_STATE_STORE_TABLE_PREFIX, ModelType.STRING, true) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.TABLE_PREFIX.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); public static final SimpleAttributeDefinition JDBC_STATE_STORE_DROP_TABLE = new SimpleAttributeDefinitionBuilder( CommonAttributes.JDBC_STATE_STORE_DROP_TABLE, ModelType.BOOLEAN, true) .setDefaultValue(new ModelNode(false)) .setFlags(AttributeAccess.Flag.RESTART_JVM) .setXmlName(Attribute.DROP_TABLE.getLocalName()) .setAllowExpression(true) .setRequires(CommonAttributes.USE_JDBC_STORE) .build(); private final boolean registerRuntimeOnly; TransactionSubsystemRootResourceDefinition(boolean registerRuntimeOnly) { super( TransactionExtension.SUBSYSTEM_PATH, TransactionExtension.getResourceDescriptionResolver(), TransactionSubsystemAdd.INSTANCE, TransactionSubsystemRemove.INSTANCE, OperationEntry.Flag.RESTART_ALL_SERVICES, OperationEntry.Flag.RESTART_ALL_SERVICES); this.registerRuntimeOnly = registerRuntimeOnly; } // all attributes static final AttributeDefinition[] attributes = new AttributeDefinition[] { BINDING, STATUS_BINDING, RECOVERY_LISTENER, NODE_IDENTIFIER, PROCESS_ID_UUID, PROCESS_ID_SOCKET_BINDING, PROCESS_ID_SOCKET_MAX_PORTS, STATISTICS_ENABLED, ENABLE_TSM_STATUS, DEFAULT_TIMEOUT, OBJECT_STORE_RELATIVE_TO, OBJECT_STORE_PATH, JTS, USEHORNETQSTORE, USE_JDBC_STORE, JDBC_STORE_DATASOURCE, JDBC_ACTION_STORE_DROP_TABLE, JDBC_ACTION_STORE_TABLE_PREFIX, JDBC_COMMUNICATION_STORE_DROP_TABLE, JDBC_COMMUNICATION_STORE_TABLE_PREFIX, JDBC_STATE_STORE_DROP_TABLE, JDBC_STATE_STORE_TABLE_PREFIX, HORNETQ_STORE_ENABLE_ASYNC_IO }; static final AttributeDefinition[] ATTRIBUTES_WITH_EXPRESSIONS_AFTER_1_1_0 = new AttributeDefinition[] { DEFAULT_TIMEOUT, STATISTICS_ENABLED, ENABLE_STATISTICS, ENABLE_TSM_STATUS, NODE_IDENTIFIER, OBJECT_STORE_PATH, OBJECT_STORE_RELATIVE_TO, PROCESS_ID_SOCKET_BINDING, PROCESS_ID_SOCKET_MAX_PORTS, RECOVERY_LISTENER, BINDING, STATUS_BINDING }; static final AttributeDefinition[] ATTRIBUTES_WITH_EXPRESSIONS_AFTER_1_1_1 = new AttributeDefinition[] {JTS, USEHORNETQSTORE}; static final AttributeDefinition[] attributes_1_2 = new AttributeDefinition[] { USE_JDBC_STORE, JDBC_STORE_DATASOURCE, JDBC_ACTION_STORE_DROP_TABLE, JDBC_ACTION_STORE_TABLE_PREFIX, JDBC_COMMUNICATION_STORE_DROP_TABLE, JDBC_COMMUNICATION_STORE_TABLE_PREFIX, JDBC_STATE_STORE_DROP_TABLE, JDBC_STATE_STORE_TABLE_PREFIX }; @Override public void registerAttributes(ManagementResourceRegistration resourceRegistration) { // Register all attributes except of the mutual ones Set<AttributeDefinition> attributesWithoutMutuals = new HashSet<>(Arrays.asList(attributes)); attributesWithoutMutuals.remove(USEHORNETQSTORE); attributesWithoutMutuals.remove(USE_JDBC_STORE); attributesWithoutMutuals.remove(PROCESS_ID_UUID); attributesWithoutMutuals.remove(PROCESS_ID_SOCKET_BINDING); attributesWithoutMutuals.remove(PROCESS_ID_SOCKET_MAX_PORTS); OperationStepHandler writeHandler = new ReloadRequiredWriteAttributeHandler(attributesWithoutMutuals); for (final AttributeDefinition def : attributesWithoutMutuals) { resourceRegistration.registerReadWriteAttribute(def, null, writeHandler); } // Register mutual object store attributes OperationStepHandler mutualWriteHandler = new ObjectStoreMutualWriteHandler(USEHORNETQSTORE, USE_JDBC_STORE); resourceRegistration.registerReadWriteAttribute(USEHORNETQSTORE, null, mutualWriteHandler); resourceRegistration.registerReadWriteAttribute(USE_JDBC_STORE, null, mutualWriteHandler); // Register mutual object store attributes OperationStepHandler mutualProcessIdWriteHandler = new ProcessIdWriteHandler( PROCESS_ID_UUID, PROCESS_ID_SOCKET_BINDING, PROCESS_ID_SOCKET_MAX_PORTS); resourceRegistration.registerReadWriteAttribute( PROCESS_ID_UUID, null, mutualProcessIdWriteHandler); resourceRegistration.registerReadWriteAttribute( PROCESS_ID_SOCKET_BINDING, null, mutualProcessIdWriteHandler); resourceRegistration.registerReadWriteAttribute( PROCESS_ID_SOCKET_MAX_PORTS, null, mutualProcessIdWriteHandler); EnableStatisticsHandler esh = new EnableStatisticsHandler(); resourceRegistration.registerReadWriteAttribute(ENABLE_STATISTICS, esh, esh); if (registerRuntimeOnly) { TxStatsHandler.INSTANCE.registerMetrics(resourceRegistration); } } @Override public void registerCapabilities(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerCapability(TRANSACTION_CAPABILITY); } private static class EnableStatisticsHandler implements OperationStepHandler { @Override public void execute(OperationContext context, ModelNode operation) throws OperationFailedException { ModelNode aliased = getAliasedOperation(operation); context.addStep( aliased, getHandlerForOperation(context, operation), OperationContext.Stage.MODEL, true); context.stepCompleted(); } private static ModelNode getAliasedOperation(ModelNode operation) { ModelNode aliased = operation.clone(); aliased.get(ModelDescriptionConstants.NAME).set(STATISTICS_ENABLED.getName()); return aliased; } private static OperationStepHandler getHandlerForOperation( OperationContext context, ModelNode operation) { ImmutableManagementResourceRegistration imrr = context.getResourceRegistration(); return imrr.getOperationHandler(PathAddress.EMPTY_ADDRESS, operation.get(OP).asString()); } } private static class ObjectStoreMutualWriteHandler extends ReloadRequiredWriteAttributeHandler { public ObjectStoreMutualWriteHandler(final AttributeDefinition... definitions) { super(definitions); } @Override protected void finishModelStage( final OperationContext context, final ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, final Resource model) throws OperationFailedException { super.finishModelStage(context, operation, attributeName, newValue, oldValue, model); assert !USEHORNETQSTORE.isAllowExpression() && !USE_JDBC_STORE.isAllowExpression() : "rework this before enabling expression"; if (attributeName.equals(USEHORNETQSTORE.getName()) || attributeName.equals(USE_JDBC_STORE.getName())) { if (newValue.asBoolean() == true) { // check the value of the mutual attribute and disable it if it is set to true final String mutualAttributeName = attributeName.equals(USE_JDBC_STORE.getName()) ? USEHORNETQSTORE.getName() : USE_JDBC_STORE.getName(); ModelNode resourceModel = model.getModel(); if (resourceModel.hasDefined(mutualAttributeName) && resourceModel.get(mutualAttributeName).asBoolean()) { resourceModel.get(mutualAttributeName).set(new ModelNode(false)); } } } } } private static class ProcessIdWriteHandler extends ReloadRequiredWriteAttributeHandler { public ProcessIdWriteHandler(final AttributeDefinition... definitions) { super(definitions); } @Override protected void validateUpdatedModel(final OperationContext context, final Resource model) throws OperationFailedException { context.addStep( model.getModel(), new OperationStepHandler() { @Override public void execute(OperationContext operationContext, ModelNode node) throws OperationFailedException { if (node.hasDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.getName()) && node.get(TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.getName()) .asBoolean()) { if (node.hasDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING .getName())) { throw TransactionLogger.ROOT_LOGGER.mustBeUndefinedIfTrue( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING .getName(), TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.getName()); } else if (node.hasDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS .getName())) { throw TransactionLogger.ROOT_LOGGER.mustBeUndefinedIfTrue( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS .getName(), TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.getName()); } } else if (node.hasDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.getName())) { // it's fine do nothing } else if (node.hasDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS .getName())) { throw TransactionLogger.ROOT_LOGGER.mustBedefinedIfDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.getName(), TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_MAX_PORTS .getName()); } else { // not uuid and also not sockets! throw TransactionLogger.ROOT_LOGGER.eitherTrueOrDefined( TransactionSubsystemRootResourceDefinition.PROCESS_ID_UUID.getName(), TransactionSubsystemRootResourceDefinition.PROCESS_ID_SOCKET_BINDING.getName()); } context.stepCompleted(); } }, OperationContext.Stage.MODEL); } @Override protected void finishModelStage( final OperationContext context, final ModelNode operation, String attributeName, ModelNode newValue, ModelNode oldValue, final Resource model) throws OperationFailedException { if (attributeName.equals(PROCESS_ID_SOCKET_BINDING.getName())) { if (newValue.isDefined()) { ModelNode resourceModel = model.getModel(); if (resourceModel.hasDefined(PROCESS_ID_UUID.getName()) && resourceModel.get(PROCESS_ID_UUID.getName()).asBoolean()) { resourceModel.get(PROCESS_ID_UUID.getName()).set(new ModelNode(false)); } } } if (attributeName.equals(PROCESS_ID_UUID.getName())) { if (newValue.asBoolean(false)) { ModelNode resourceModel = model.getModel(); resourceModel.get(PROCESS_ID_SOCKET_BINDING.getName()).clear(); resourceModel.get(PROCESS_ID_SOCKET_MAX_PORTS.getName()).clear(); } } validateUpdatedModel(context, model); } } @Override public void registerChildren(ManagementResourceRegistration resourceRegistration) { resourceRegistration.registerSubModel(new CMResourceResourceDefinition()); } }
/** {@inheritDoc} */ @Override public void initialize(ExtensionContext context) { ROOT_LOGGER.debug("Initializing Deployment Scanner Extension"); final SubsystemRegistration subsystem = context.registerSubsystem(CommonAttributes.DEPLOYMENT_SCANNER); subsystem.registerXMLElementWriter(parser); final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(SUBSYSTEM); registration.registerOperationHandler( DeploymentScannerSubsystemAdd.OPERATION_NAME, DeploymentScannerSubsystemAdd.INSTANCE, DeploymentScannerSubsystemAdd.INSTANCE, false); registration.registerOperationHandler( DeploymentScannerSubsystemRemove.OPERATION_NAME, DeploymentScannerSubsystemRemove.INSTANCE, DeploymentScannerSubsystemRemove.INSTANCE, false); // Register operation handlers final ManagementResourceRegistration scanners = registration.registerSubModel(scannersPath, SCANNER); scanners.registerOperationHandler( DeploymentScannerAdd.OPERATION_NAME, DeploymentScannerAdd.INSTANCE, DeploymentScannerAdd.INSTANCE, false); scanners.registerOperationHandler( DeploymentScannerRemove.OPERATION_NAME, DeploymentScannerRemove.INSTANCE, DeploymentScannerRemove.INSTANCE, false); scanners.registerReadWriteAttribute( Attribute.PATH.getLocalName(), null, WritePathAttributeHandler.INSTANCE, Storage.CONFIGURATION); scanners.registerReadWriteAttribute( Attribute.RELATIVE_TO.getLocalName(), null, WriteRelativeToAttributeHandler.INSTANCE, Storage.CONFIGURATION); scanners.registerReadWriteAttribute( Attribute.SCAN_ENABLED.getLocalName(), null, WriteEnabledAttributeHandler.INSTANCE, Storage.CONFIGURATION); scanners.registerReadWriteAttribute( Attribute.SCAN_INTERVAL.getLocalName(), null, WriteScanIntervalAttributeHandler.INSTANCE, Storage.CONFIGURATION); scanners.registerReadWriteAttribute( Attribute.AUTO_DEPLOY_ZIPPED.getLocalName(), null, WriteAutoDeployZipAttributeHandler.INSTANCE, Storage.CONFIGURATION); scanners.registerReadWriteAttribute( Attribute.AUTO_DEPLOY_EXPLODED.getLocalName(), null, WriteAutoDeployExplodedAttributeHandler.INSTANCE, Storage.CONFIGURATION); scanners.registerReadWriteAttribute( Attribute.DEPLOYMENT_TIMEOUT.getLocalName(), null, WriteDeploymentTimeoutAttributeHandler.INSTANCE, Storage.CONFIGURATION); }