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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations