Search in sources :

Example 21 with ResourceDescriptor

use of org.jboss.as.clustering.controller.ResourceDescriptor in project wildfly by wildfly.

the class SingletonPolicyResourceDefinition method register.

@Override
public void register(ManagementResourceRegistration parentRegistration) {
    ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(Capability.class).addRequiredSingletonChildren(SimpleElectionPolicyResourceDefinition.PATH);
    ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new SingletonPolicyBuilder(address));
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    new RandomElectionPolicyResourceDefinition().register(registration);
    new SimpleElectionPolicyResourceDefinition().register(registration);
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) RuntimeCapability(org.jboss.as.controller.capability.RuntimeCapability) UnaryRequirementCapability(org.jboss.as.clustering.controller.UnaryRequirementCapability) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 22 with ResourceDescriptor

use of org.jboss.as.clustering.controller.ResourceDescriptor in project wildfly by wildfly.

the class SingletonResourceDefinition method register.

@Override
public void register(SubsystemRegistration parentRegistration) {
    ManagementResourceRegistration registration = parentRegistration.registerSubsystemModel(this);
    registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(Capability.class);
    ResourceServiceHandler handler = new SingletonServiceHandler();
    new DeploymentChainContributingResourceRegistration(descriptor, handler, target -> {
        for (SingletonDeploymentSchema schema : SingletonDeploymentSchema.values()) {
            target.addDeploymentProcessor(SingletonExtension.SUBSYSTEM_NAME, Phase.STRUCTURE, Phase.STRUCTURE_REGISTER_JBOSS_ALL_SINGLETON_DEPLOYMENT, new JBossAllXmlParserRegisteringProcessor<>(schema.getRoot(), SingletonDeploymentDependencyProcessor.CONFIGURATION_KEY, new SingletonDeploymentXMLReader(schema)));
        }
        target.addDeploymentProcessor(SingletonExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_SINGLETON_DEPLOYMENT, new SingletonDeploymentParsingProcessor());
        target.addDeploymentProcessor(SingletonExtension.SUBSYSTEM_NAME, Phase.DEPENDENCIES, Phase.DEPENDENCIES_SINGLETON_DEPLOYMENT, new SingletonDeploymentDependencyProcessor());
        target.addDeploymentProcessor(SingletonExtension.SUBSYSTEM_NAME, Phase.CONFIGURE_MODULE, Phase.CONFIGURE_SINGLETON_DEPLOYMENT, new SingletonDeploymentProcessor());
    }).register(registration);
    new SingletonPolicyResourceDefinition().register(registration);
}
Also used : SingletonDeploymentParsingProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentParsingProcessor) SubsystemResourceDefinition(org.jboss.as.clustering.controller.SubsystemResourceDefinition) SimpleAttributeDefinitionBuilder(org.jboss.as.controller.SimpleAttributeDefinitionBuilder) SingletonDefaultRequirement(org.wildfly.clustering.singleton.SingletonDefaultRequirement) CapabilityReference(org.jboss.as.clustering.controller.CapabilityReference) SingletonDeploymentXMLReader(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentXMLReader) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration) SingletonDeploymentProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentProcessor) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ModelVersion(org.jboss.as.controller.ModelVersion) SingletonRequirement(org.wildfly.clustering.singleton.SingletonRequirement) Requirement(org.wildfly.clustering.service.Requirement) ModelDescriptionConstants(org.jboss.as.controller.descriptions.ModelDescriptionConstants) CapabilityReferenceRecorder(org.jboss.as.controller.CapabilityReferenceRecorder) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) SingletonDeploymentDependencyProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentDependencyProcessor) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor) PathElement(org.jboss.as.controller.PathElement) DeploymentChainContributingResourceRegistration(org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration) Flag(org.jboss.as.controller.registry.AttributeAccess.Flag) TransformationDescription(org.jboss.as.controller.transform.description.TransformationDescription) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) TransformationDescriptionBuilder(org.jboss.as.controller.transform.description.TransformationDescriptionBuilder) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) SingletonDeploymentSchema(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentSchema) CapabilityProvider(org.jboss.as.clustering.controller.CapabilityProvider) RequirementCapability(org.jboss.as.clustering.controller.RequirementCapability) GenericSubsystemDescribeHandler(org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler) Phase(org.jboss.as.server.deployment.Phase) ModelType(org.jboss.dmr.ModelType) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) SingletonDeploymentProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentProcessor) SingletonDeploymentParsingProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentParsingProcessor) SingletonDeploymentSchema(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentSchema) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) DeploymentChainContributingResourceRegistration(org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration) SingletonDeploymentDependencyProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentDependencyProcessor) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) SingletonDeploymentXMLReader(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentXMLReader) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 23 with ResourceDescriptor

use of org.jboss.as.clustering.controller.ResourceDescriptor in project wildfly by wildfly.

the class AbstractProtocolResourceDefinition method register.

@Override
public void register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver());
    this.descriptorConfigurator.accept(descriptor);
    new RestartParentResourceRegistration<>(this.parentBuilderFactory, descriptor, this.handler).register(registration);
    this.registrationConfigurator.accept(parent, registration);
}
Also used : ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 24 with ResourceDescriptor

use of org.jboss.as.clustering.controller.ResourceDescriptor in project wildfly by wildfly.

the class ChannelResourceDefinition method register.

@Override
public void register(ManagementResourceRegistration parentRegistration) {
    ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(Capability.class).addCapabilities(CLUSTERING_CAPABILITIES.values()).addAlias(DeprecatedAttribute.STATS_ENABLED, Attribute.STATISTICS_ENABLED).addOperationTranslator(new OperationStepHandler() {

        @SuppressWarnings("deprecation")
        @Override
        public void execute(OperationContext context, ModelNode operation) throws OperationFailedException {
            // Handle recipe for version < 4.0 where stack was not required and the stack attribute would use default-stack for a default value
            if (!operation.hasDefined(Attribute.STACK.getName())) {
                ModelNode parentModel = context.readResourceFromRoot(context.getCurrentAddress().getParent()).getModel();
                // If default-stack is not defined either, then recipe must be for version >= 4.0 and so this really is an invalid operation
                if (parentModel.hasDefined(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName())) {
                    operation.get(Attribute.STACK.getName()).set(parentModel.get(JGroupsSubsystemResourceDefinition.Attribute.DEFAULT_STACK.getName()));
                }
            }
        }
    }).addRuntimeResourceRegistration(new ProtocolResourceRegistrationHandler());
    ResourceServiceHandler handler = new ChannelServiceHandler();
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    if (this.allowRuntimeOnlyRegistration) {
        new MetricHandler<>(new ChannelMetricExecutor(), ChannelMetric.class).register(registration);
    }
    new ForkResourceDefinition().register(registration);
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) ModelNode(org.jboss.dmr.ModelNode) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 25 with ResourceDescriptor

use of org.jboss.as.clustering.controller.ResourceDescriptor in project wildfly by wildfly.

the class RemoteSiteResourceDefinition method register.

@Override
public void register(ManagementResourceRegistration parentRegistration) {
    ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(DeprecatedAttribute.class).addCapabilities(Capability.class);
    ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new RemoteSiteConfigurationBuilder(address));
    new RestartParentResourceRegistration<>(this.parentBuilderFactory, descriptor, handler).register(registration);
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Aggregations

ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)32 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)30 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)26 SimpleResourceRegistration (org.jboss.as.clustering.controller.SimpleResourceRegistration)26 SimpleResourceServiceHandler (org.jboss.as.clustering.controller.SimpleResourceServiceHandler)16 SimpleAliasEntry (org.jboss.as.clustering.controller.SimpleAliasEntry)9 PathElement (org.jboss.as.controller.PathElement)6 UnaryRequirementCapability (org.jboss.as.clustering.controller.UnaryRequirementCapability)5 EnumMap (java.util.EnumMap)4 EnumSet (java.util.EnumSet)4 Map (java.util.Map)4 ModelVersion (org.jboss.as.controller.ModelVersion)4 ModelDescriptionConstants (org.jboss.as.controller.descriptions.ModelDescriptionConstants)4 ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)4 CapabilityProvider (org.jboss.as.clustering.controller.CapabilityProvider)3 CapabilityReference (org.jboss.as.clustering.controller.CapabilityReference)3 RequirementCapability (org.jboss.as.clustering.controller.RequirementCapability)3 SubsystemResourceDefinition (org.jboss.as.clustering.controller.SubsystemResourceDefinition)3 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)3 CapabilityReferenceRecorder (org.jboss.as.controller.CapabilityReferenceRecorder)3