use of org.jboss.as.clustering.controller.ResourceDescriptor in project wildfly by wildfly.
the class CacheResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver());
this.descriptorConfigurator.accept(descriptor);
new SimpleResourceRegistration(descriptor, this.handler).register(registration);
this.registrationConfigurator.accept(registration);
}
use of org.jboss.as.clustering.controller.ResourceDescriptor 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.clustering.controller.ResourceDescriptor 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.clustering.controller.ResourceDescriptor 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.clustering.controller.ResourceDescriptor in project wildfly by wildfly.
the class StringTableResourceDefinition method register.
@Override
public void register(ManagementResourceRegistration parentRegistration) {
ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(TableResourceDefinition.Attribute.class).addAttributes(TableResourceDefinition.ColumnAttribute.class);
ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new StringTableBuilder(address.getParent().getParent()));
new SimpleResourceRegistration(descriptor, handler).register(registration);
}
Aggregations