Search in sources :

Example 91 with ResourceTransformationDescriptionBuilder

use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.

the class EeExtension method registerTransformers.

private void registerTransformers(SubsystemRegistration subsystem) {
    final ModelVersion v1_0_0 = ModelVersion.create(1, 0, 0);
    final ModelVersion v1_1_0 = ModelVersion.create(1, 1, 0);
    final ModelVersion v3_0_0 = ModelVersion.create(3, 0, 0);
    ChainedTransformationDescriptionBuilder chainedBuilder = TransformationDescriptionBuilder.Factory.createChainedSubystemInstance(subsystem.getSubsystemVersion());
    ResourceTransformationDescriptionBuilder builder_3_0 = chainedBuilder.createBuilder(subsystem.getSubsystemVersion(), v3_0_0);
    ManagedExecutorServiceResourceDefinition.INSTANCE.registerTransformers_4_0(builder_3_0);
    ManagedScheduledExecutorServiceResourceDefinition.INSTANCE.registerTransformers_4_0(builder_3_0);
    // 3.0.0 --> 1.1.0
    ResourceTransformationDescriptionBuilder builder11 = chainedBuilder.createBuilder(v3_0_0, v1_1_0);
    builder11.rejectChildResource(PathElement.pathElement(EESubsystemModel.CONTEXT_SERVICE));
    builder11.rejectChildResource(PathElement.pathElement(EESubsystemModel.MANAGED_THREAD_FACTORY));
    builder11.rejectChildResource(PathElement.pathElement(EESubsystemModel.MANAGED_EXECUTOR_SERVICE));
    builder11.rejectChildResource(PathElement.pathElement(EESubsystemModel.MANAGED_SCHEDULED_EXECUTOR_SERVICE));
    builder11.discardChildResource(EESubsystemModel.DEFAULT_BINDINGS_PATH);
    // 1.1.0 --> 1.0.0
    ResourceTransformationDescriptionBuilder builder = chainedBuilder.createBuilder(v1_1_0, v1_0_0);
    GlobalModulesRejecterConverter globalModulesRejecterConverter = new GlobalModulesRejecterConverter();
    builder.getAttributeBuilder().addRejectCheck(new JBossDescriptorPropertyReplacementRejectChecker(), EeSubsystemRootResource.JBOSS_DESCRIPTOR_PROPERTY_REPLACEMENT).addRejectCheck(globalModulesRejecterConverter, GlobalModulesDefinition.INSTANCE).setValueConverter(globalModulesRejecterConverter, GlobalModulesDefinition.INSTANCE).setDiscard(new DiscardAttributeChecker.DiscardAttributeValueChecker(new ModelNode(false)), EeSubsystemRootResource.ANNOTATION_PROPERTY_REPLACEMENT).addRejectCheck(RejectAttributeChecker.DEFINED, EeSubsystemRootResource.ANNOTATION_PROPERTY_REPLACEMENT);
    chainedBuilder.buildAndRegister(subsystem, new ModelVersion[] { v1_0_0, v1_1_0, v3_0_0 });
}
Also used : ChainedTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ModelVersion(org.jboss.as.controller.ModelVersion) ModelNode(org.jboss.dmr.ModelNode)

Example 92 with ResourceTransformationDescriptionBuilder

use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.

the class ManagedExecutorServiceResourceDefinition method registerTransformers_4_0.

void registerTransformers_4_0(final ResourceTransformationDescriptionBuilder builder) {
    final PathElement pathElement = getPathElement();
    final ResourceTransformationDescriptionBuilder resourceBuilder = builder.addChildResource(pathElement);
    resourceBuilder.getAttributeBuilder().addRejectCheck(RejectAttributeChecker.UNDEFINED, CORE_THREADS_AD).end();
}
Also used : PathElement(org.jboss.as.controller.PathElement) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)

Example 93 with ResourceTransformationDescriptionBuilder

use of org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder in project wildfly by wildfly.

the class MessagingSubsystemRootResourceDefinition method registerTransformers_EAP_7_0_0.

private static void registerTransformers_EAP_7_0_0(SubsystemRegistration subsystemRegistration) {
    final ResourceTransformationDescriptionBuilder subsystem = TransformationDescriptionBuilder.Factory.createSubsystemInstance();
    rejectDefinedAttributeWithDefaultValue(subsystem, MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_THREAD_POOL_MAX_SIZE, MessagingSubsystemRootResourceDefinition.GLOBAL_CLIENT_SCHEDULED_THREAD_POOL_MAX_SIZE);
    ResourceTransformationDescriptionBuilder server = subsystem.addChildResource(MessagingExtension.SERVER_PATH);
    // reject journal-datasource, journal-bindings-table introduced in management version 2.0.0 if it is defined and different from the default value.
    rejectDefinedAttributeWithDefaultValue(server, ServerDefinition.ELYTRON_DOMAIN, ServerDefinition.JOURNAL_DATASOURCE, ServerDefinition.JOURNAL_MESSAGES_TABLE, ServerDefinition.JOURNAL_BINDINGS_TABLE, ServerDefinition.JOURNAL_LARGE_MESSAGES_TABLE, ServerDefinition.JOURNAL_PAGE_STORE_TABLE, ServerDefinition.JOURNAL_DATABASE);
    server.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, ServerDefinition.CREDENTIAL_REFERENCE).addRejectCheck(DEFINED, ServerDefinition.CREDENTIAL_REFERENCE);
    ResourceTransformationDescriptionBuilder replicationMaster = server.addChildResource(MessagingExtension.REPLICATION_MASTER_PATH);
    replicationMaster.getAttributeBuilder().addRejectCheck(UNDEFINED, HAAttributes.CHECK_FOR_LIVE_SERVER);
    ResourceTransformationDescriptionBuilder replicationColocated = server.addChildResource(MessagingExtension.REPLICATION_COLOCATED_PATH);
    ResourceTransformationDescriptionBuilder masterForReplicationColocated = replicationColocated.addChildResource(MessagingExtension.CONFIGURATION_MASTER_PATH);
    masterForReplicationColocated.getAttributeBuilder().addRejectCheck(UNDEFINED, HAAttributes.CHECK_FOR_LIVE_SERVER);
    ResourceTransformationDescriptionBuilder bridge = server.addChildResource(MessagingExtension.BRIDGE_PATH);
    bridge.getAttributeBuilder().setDiscard(DiscardAttributeChecker.ALWAYS, BridgeDefinition.CREDENTIAL_REFERENCE).addRejectCheck(DEFINED, BridgeDefinition.CREDENTIAL_REFERENCE);
    ResourceTransformationDescriptionBuilder httpConnector = server.addChildResource(HTTPConnectorDefinition.INSTANCE);
    // reject server-name introduced in management version 2.0.0 if it is defined
    rejectDefinedAttributeWithDefaultValue(httpConnector, HTTPConnectorDefinition.SERVER_NAME);
    // reject producer-window-size introduced in management version 2.0.0 if it is defined and different from the default value.
    rejectDefinedAttributeWithDefaultValue(bridge, BridgeDefinition.PRODUCER_WINDOW_SIZE);
    ResourceTransformationDescriptionBuilder jmsBridge = server.addChildResource(MessagingExtension.JMS_BRIDGE_PATH);
    rejectDefinedAttributeWithDefaultValue(jmsBridge, JMSBridgeDefinition.SOURCE_CREDENTIAL_REFERENCE);
    rejectDefinedAttributeWithDefaultValue(jmsBridge, JMSBridgeDefinition.TARGET_CREDENTIAL_REFERENCE);
    ResourceTransformationDescriptionBuilder clusterConnection = server.addChildResource(MessagingExtension.CLUSTER_CONNECTION_PATH);
    // reject producer-window-size introduced in management version 2.0.0 if it is defined and different from the default value.
    rejectDefinedAttributeWithDefaultValue(clusterConnection, ClusterConnectionDefinition.PRODUCER_WINDOW_SIZE);
    ResourceTransformationDescriptionBuilder pooledConnectionFactory = server.addChildResource(MessagingExtension.POOLED_CONNECTION_FACTORY_PATH);
    // reject rebalance-connections introduced in management version 2.0.0 if it is defined and different from the default value.
    rejectDefinedAttributeWithDefaultValue(pooledConnectionFactory, ConnectionFactoryAttributes.Pooled.REBALANCE_CONNECTIONS);
    // reject statistics-enabled introduced in management version 2.0.0 if it is defined and different from the default value.
    rejectDefinedAttributeWithDefaultValue(pooledConnectionFactory, ConnectionFactoryAttributes.Pooled.STATISTICS_ENABLED);
    // reject max-pool-size whose default value has been changed in  management version 2.0.0
    defaultValueAttributeConverter(pooledConnectionFactory, ConnectionFactoryAttributes.Pooled.MAX_POOL_SIZE);
    // reject min-pool-size whose default value has been changed in  management version 2.0.0
    defaultValueAttributeConverter(pooledConnectionFactory, ConnectionFactoryAttributes.Pooled.MIN_POOL_SIZE);
    TransformationDescription.Tools.register(subsystem.build(), subsystemRegistration, MessagingExtension.VERSION_1_0_0);
}
Also used : ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)

Aggregations

ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)93 ModelNode (org.jboss.dmr.ModelNode)46 PathAddress (org.jboss.as.controller.PathAddress)25 DiscardAttributeChecker (org.jboss.as.controller.transform.description.DiscardAttributeChecker)24 TransformationContext (org.jboss.as.controller.transform.TransformationContext)15 SimpleOperationTransformer (org.jboss.as.clustering.controller.transform.SimpleOperationTransformer)9 LegacyPropertyResourceTransformer (org.jboss.as.clustering.controller.transform.LegacyPropertyResourceTransformer)7 ModelVersion (org.jboss.as.controller.ModelVersion)7 Resource (org.jboss.as.controller.registry.Resource)7 ChainedTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ChainedTransformationDescriptionBuilder)7 ResourceTransformationContext (org.jboss.as.controller.transform.ResourceTransformationContext)6 ResourceTransformer (org.jboss.as.controller.transform.ResourceTransformer)6 AttributeConverter (org.jboss.as.controller.transform.description.AttributeConverter)6 Map (java.util.Map)4 LegacyPropertyAddOperationTransformer (org.jboss.as.clustering.controller.transform.LegacyPropertyAddOperationTransformer)4 OperationTransformer (org.jboss.as.clustering.controller.transform.OperationTransformer)4 OperationFailedException (org.jboss.as.controller.OperationFailedException)4 PathElement (org.jboss.as.controller.PathElement)4 RejectAttributeChecker (org.jboss.as.controller.transform.description.RejectAttributeChecker)4 LinkedList (java.util.LinkedList)2