use of org.jboss.as.clustering.controller.SimpleResourceRegistration in project wildfly by wildfly.
the class SimpleElectionPolicyResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(ElectionPolicyResourceDefinition.Attribute.class).addCapabilities(ElectionPolicyResourceDefinition.Capability.class);
ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new SimpleElectionPolicyBuilder(address.getParent()));
new SimpleResourceRegistration(descriptor, handler).register(registration);
}
use of org.jboss.as.clustering.controller.SimpleResourceRegistration 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.SimpleResourceRegistration 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.SimpleResourceRegistration in project wildfly by wildfly.
the class JGroupsSubsystemResourceDefinition method register.
@Override
public void register(SubsystemRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubsystemModel(this);
new DefaultSubsystemDescribeHandler().register(registration);
// registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(model -> model.hasDefined(Attribute.DEFAULT_CHANNEL.getName()), CAPABILITIES.values()).addCapabilities(model -> model.hasDefined(Attribute.DEFAULT_CHANNEL.getName()), CLUSTERING_CAPABILITIES.values());
ResourceServiceHandler handler = new JGroupsSubsystemServiceHandler();
new SimpleResourceRegistration(descriptor, handler).register(registration);
new ChannelResourceDefinition(this.allowRuntimeOnlyRegistration).register(registration);
new StackResourceDefinition(this.allowRuntimeOnlyRegistration).register(registration);
}
use of org.jboss.as.clustering.controller.SimpleResourceRegistration in project wildfly by wildfly.
the class HostSingleSignOnDefinition method registerOperations.
@Override
public void registerOperations(ManagementResourceRegistration registration) {
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(SingleSignOnDefinition.Attribute.class);
new SimpleResourceRegistration(descriptor, new HostSingleSignOnServiceHandler()).register(registration);
}
Aggregations