use of org.jboss.as.controller.registry.ManagementResourceRegistration 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);
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class BackupForResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
parentRegistration.registerAlias(LEGACY_PATH, new SimpleAliasEntry(registration));
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class);
ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new BackupForBuilder(address.getParent()));
new SimpleResourceRegistration(descriptor, handler).register(registration);
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class BackupResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(TakeOfflineAttribute.class);
new RestartParentResourceRegistration<>(this.parentBuilderFactory, descriptor).register(registration);
if (this.runtimeRegistration) {
new OperationHandler<>(new BackupOperationExecutor(), BackupOperation.class).register(registration);
}
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class JdrReportExtension method initialize.
public void initialize(ExtensionContext context) {
SubsystemRegistration subsystemRegistration = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
ManagementResourceRegistration root = subsystemRegistration.registerSubsystemModel(JdrReportSubsystemDefinition.INSTANCE);
root.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
if (context.isRuntimeOnlyRegistrationValid()) {
root.registerOperationHandler(JdrReportRequestHandler.DEFINITION, JdrReportRequestHandler.INSTANCE);
}
subsystemRegistration.registerXMLElementWriter(JdrReportSubsystemParser.INSTANCE);
}
use of org.jboss.as.controller.registry.ManagementResourceRegistration in project wildfly by wildfly.
the class JaxrsExtension method initialize.
/**
* {@inheritDoc}
*/
@Override
public void initialize(final ExtensionContext context) {
JAXRS_LOGGER.debug("Activating JAX-RS Extension");
final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(JaxrsSubsystemDefinition.INSTANCE);
registration.registerOperationHandler(GenericSubsystemDescribeHandler.DEFINITION, GenericSubsystemDescribeHandler.INSTANCE);
ManagementResourceRegistration jaxrsResReg = subsystem.registerDeploymentModel(JaxrsDeploymentDefinition.INSTANCE);
jaxrsResReg.registerSubModel(DeploymentRestResourcesDefintion.INSTANCE);
subsystem.registerXMLElementWriter(parser);
}
Aggregations