use of org.jboss.as.clustering.controller.ResourceServiceHandler 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.ResourceServiceHandler 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.ResourceServiceHandler 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);
}
use of org.jboss.as.clustering.controller.ResourceServiceHandler 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.ResourceServiceHandler in project wildfly by wildfly.
the class CacheContainerResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(ExecutorAttribute.class).addAttributes(DeprecatedAttribute.class).addCapabilities(Capability.class).addCapabilities(model -> model.hasDefined(Attribute.DEFAULT_CACHE.getName()), DEFAULT_CAPABILITIES.values()).addCapabilities(model -> model.hasDefined(Attribute.DEFAULT_CACHE.getName()), DEFAULT_CLUSTERING_CAPABILITIES.values()).addRequiredChildren(ThreadPoolResourceDefinition.class).addRequiredChildren(ScheduledThreadPoolResourceDefinition.class).addRequiredSingletonChildren(NoTransportResourceDefinition.PATH);
ResourceServiceHandler handler = new CacheContainerServiceHandler();
new SimpleResourceRegistration(descriptor, handler).register(registration);
// Translate legacy add-alias operation to list-add operation
OperationStepHandler addAliasHandler = new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode legacyOperation) {
String value = legacyOperation.get(ALIAS.getName()).asString();
ModelNode operation = Operations.createListAddOperation(context.getCurrentAddress(), Attribute.ALIASES, value);
context.addStep(operation, ListOperations.LIST_ADD_HANDLER, context.getCurrentStage());
}
};
registration.registerOperationHandler(ALIAS_ADD, addAliasHandler);
// Translate legacy remove-alias operation to list-remove operation
OperationStepHandler removeAliasHandler = new OperationStepHandler() {
@Override
public void execute(OperationContext context, ModelNode legacyOperation) throws OperationFailedException {
String value = legacyOperation.get(ALIAS.getName()).asString();
ModelNode operation = Operations.createListRemoveOperation(context.getCurrentAddress(), Attribute.ALIASES, value);
context.addStep(operation, ListOperations.LIST_REMOVE_HANDLER, context.getCurrentStage());
}
};
registration.registerOperationHandler(ALIAS_REMOVE, removeAliasHandler);
if (this.allowRuntimeOnlyRegistration) {
new MetricHandler<>(new CacheContainerMetricExecutor(), CacheContainerMetric.class).register(registration);
}
new JGroupsTransportResourceDefinition().register(registration);
new NoTransportResourceDefinition().register(registration);
EnumSet.allOf(ThreadPoolResourceDefinition.class).forEach(p -> p.register(registration));
EnumSet.allOf(ScheduledThreadPoolResourceDefinition.class).forEach(p -> p.register(registration));
new LocalCacheResourceDefinition(this.pathManager, this.allowRuntimeOnlyRegistration).register(registration);
new InvalidationCacheResourceDefinition(this.pathManager, this.allowRuntimeOnlyRegistration).register(registration);
new ReplicatedCacheResourceDefinition(this.pathManager, this.allowRuntimeOnlyRegistration).register(registration);
new DistributedCacheResourceDefinition(this.pathManager, this.allowRuntimeOnlyRegistration).register(registration);
}
Aggregations