Search in sources :

Example 36 with ManagementResourceRegistration

use of org.jboss.as.clustering.controller.ManagementResourceRegistration 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, this).register(registration);
    new SingletonPolicyResourceDefinition().register(registration);
}
Also used : ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) DeploymentChainContributingResourceRegistration(org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 37 with ManagementResourceRegistration

use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.

the class StringKeyedJDBCStoreResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = super.register(parent);
    parent.registerAlias(STRING_JDBC_PATH, new SimpleAliasEntry(registration));
    registration.registerReadWriteAttribute(DeprecatedAttribute.TABLE.getDefinition(), LEGACY_READ_TABLE_HANDLER, LEGACY_WRITE_TABLE_HANDLER);
    new StringTableResourceDefinition().register(registration);
    return registration;
}
Also used : SimpleAliasEntry(org.jboss.as.clustering.controller.SimpleAliasEntry) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration)

Example 38 with ManagementResourceRegistration

use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.

the class OffHeapMemoryResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = super.register(parent);
    parent.registerAlias(BINARY_PATH, new SimpleAliasEntry(registration));
    return registration;
}
Also used : SimpleAliasEntry(org.jboss.as.clustering.controller.SimpleAliasEntry) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration)

Example 39 with ManagementResourceRegistration

use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.

the class StorePropertyResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    AbstractAddStepHandler addHandler = new AbstractAddStepHandler() {

        @Override
        public void execute(OperationContext context, ModelNode operation) {
            operationDeprecated(context, operation);
            context.createResource(PathAddress.EMPTY_ADDRESS);
            String name = context.getCurrentAddressValue();
            String value = operation.get(VALUE.getName()).asString();
            PathAddress storeAddress = context.getCurrentAddress().getParent();
            ModelNode putOperation = Operations.createMapPutOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, name, value);
            context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
        }
    };
    this.registerAddOperation(registration, addHandler);
    AbstractRemoveStepHandler removeHandler = new AbstractRemoveStepHandler() {

        @Override
        public void execute(OperationContext context, ModelNode operation) {
            operationDeprecated(context, operation);
            context.removeResource(PathAddress.EMPTY_ADDRESS);
            String name = context.getCurrentAddressValue();
            PathAddress storeAddress = context.getCurrentAddress().getParent();
            ModelNode putOperation = Operations.createMapRemoveOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, name);
            context.addStep(putOperation, MapOperations.MAP_REMOVE_HANDLER, context.getCurrentStage());
        }
    };
    this.registerRemoveOperation(registration, removeHandler);
    OperationStepHandler readHandler = new OperationStepHandler() {

        @Override
        public void execute(OperationContext context, ModelNode operation) {
            operationDeprecated(context, operation);
            PathAddress storeAddress = context.getCurrentAddress().getParent();
            String key = context.getCurrentAddressValue();
            ModelNode getOperation = Operations.createMapGetOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, key);
            context.addStep(getOperation, MapOperations.MAP_GET_HANDLER, context.getCurrentStage());
        }
    };
    OperationStepHandler writeHandler = new OperationStepHandler() {

        @Override
        public void execute(OperationContext context, ModelNode operation) {
            operationDeprecated(context, operation);
            PathAddress storeAddress = context.getCurrentAddress().getParent();
            String key = context.getCurrentAddressValue();
            String value = Operations.getAttributeValue(operation).asString();
            ModelNode putOperation = Operations.createMapPutOperation(storeAddress, StoreResourceDefinition.Attribute.PROPERTIES, key, value);
            context.addStep(putOperation, MapOperations.MAP_PUT_HANDLER, context.getCurrentStage());
        }
    };
    registration.registerReadWriteAttribute(VALUE, readHandler, writeHandler);
    return registration;
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) AbstractAddStepHandler(org.jboss.as.controller.AbstractAddStepHandler) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) PathAddress(org.jboss.as.controller.PathAddress) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) ModelNode(org.jboss.dmr.ModelNode) AbstractRemoveStepHandler(org.jboss.as.controller.AbstractRemoveStepHandler)

Example 40 with ManagementResourceRegistration

use of org.jboss.as.clustering.controller.ManagementResourceRegistration in project wildfly by wildfly.

the class ChannelResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    ServiceValueExecutorRegistry<JChannel> executors = new ServiceValueExecutorRegistry<>();
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addCapabilities(Capability.class).addCapabilities(CLUSTERING_CAPABILITIES.values()).addAlias(DeprecatedAttribute.STATS_ENABLED, Attribute.STATISTICS_ENABLED).setAddOperationTransformation(new AddOperationTransformation()).addRuntimeResourceRegistration(new ChannelRuntimeResourceRegistration(executors));
    ResourceServiceHandler handler = new ChannelServiceHandler(executors);
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    if (registration.isRuntimeOnlyRegistrationValid()) {
        new MetricHandler<>(new ChannelMetricExecutor(executors), ChannelMetric.class).register(registration);
    }
    new ForkResourceDefinition(executors).register(registration);
    return registration;
}
Also used : JChannel(org.jgroups.JChannel) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) ServiceValueExecutorRegistry(org.jboss.as.clustering.controller.ServiceValueExecutorRegistry) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Aggregations

ManagementResourceRegistration (org.jboss.as.clustering.controller.ManagementResourceRegistration)41 ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)31 SimpleResourceRegistration (org.jboss.as.clustering.controller.SimpleResourceRegistration)25 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)23 SimpleResourceServiceHandler (org.jboss.as.clustering.controller.SimpleResourceServiceHandler)13 SimpleAliasEntry (org.jboss.as.clustering.controller.SimpleAliasEntry)10 ServiceValueExecutorRegistry (org.jboss.as.clustering.controller.ServiceValueExecutorRegistry)5 OperationContext (org.jboss.as.controller.OperationContext)5 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)5 PathAddress (org.jboss.as.controller.PathAddress)5 ModelNode (org.jboss.dmr.ModelNode)5 UnaryRequirementCapability (org.jboss.as.clustering.controller.UnaryRequirementCapability)4 PathElement (org.jboss.as.controller.PathElement)4 EnumSet (java.util.EnumSet)3 Capability (org.jboss.as.clustering.controller.Capability)3 DeploymentChainContributingResourceRegistration (org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration)3 ListAttributeTranslation (org.jboss.as.clustering.controller.ListAttributeTranslation)3 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)3 OperationFailedException (org.jboss.as.controller.OperationFailedException)3 EnumMap (java.util.EnumMap)2