Search in sources :

Example 16 with ManagementResourceRegistration

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

the class MixedKeyedJDBCStoreResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = super.register(parent);
    registration.registerReadWriteAttribute(DeprecatedAttribute.BINARY_TABLE.getDefinition(), BinaryKeyedJDBCStoreResourceDefinition.LEGACY_READ_TABLE_HANDLER, BinaryKeyedJDBCStoreResourceDefinition.LEGACY_WRITE_TABLE_HANDLER);
    registration.registerReadWriteAttribute(DeprecatedAttribute.STRING_TABLE.getDefinition(), StringKeyedJDBCStoreResourceDefinition.LEGACY_READ_TABLE_HANDLER, StringKeyedJDBCStoreResourceDefinition.LEGACY_WRITE_TABLE_HANDLER);
    new BinaryTableResourceDefinition().register(registration);
    new StringTableResourceDefinition().register(registration);
    return registration;
}
Also used : ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration)

Example 17 with ManagementResourceRegistration

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

the class NoStoreResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver());
    ResourceServiceHandler handler = new SimpleResourceServiceHandler(NoStoreServiceConfigurator::new);
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    return registration;
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 18 with ManagementResourceRegistration

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

the class PartitionHandlingResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class);
    ResourceServiceHandler handler = new SimpleResourceServiceHandler(PartitionHandlingServiceConfigurator::new);
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    if (registration.isRuntimeOnlyRegistrationValid()) {
        for (DeprecatedOperation operation : EnumSet.allOf(DeprecatedOperation.class)) {
            operation.register(registration);
        }
        for (DeprecatedMetric metric : EnumSet.allOf(DeprecatedMetric.class)) {
            metric.register(registration);
        }
    }
    return registration;
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) ImmutableManagementResourceRegistration(org.jboss.as.controller.registry.ImmutableManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 19 with ManagementResourceRegistration

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

the class LockingResourceDefinition method register.

@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    parent.registerAlias(LEGACY_PATH, new SimpleAliasEntry(registration));
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class);
    ResourceServiceHandler handler = new SimpleResourceServiceHandler(LockingServiceConfigurator::new);
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    if (registration.isRuntimeOnlyRegistrationValid()) {
        for (DeprecatedMetric metric : EnumSet.allOf(DeprecatedMetric.class)) {
            metric.register(registration);
        }
    }
    return registration;
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) SimpleAliasEntry(org.jboss.as.clustering.controller.SimpleAliasEntry) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 20 with ManagementResourceRegistration

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

the class ProxyConfigurationResourceDefinition method register.

@SuppressWarnings("deprecation")
@Override
public ManagementResourceRegistration register(ManagementResourceRegistration parent) {
    ManagementResourceRegistration registration = parent.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(EnumSet.complementOf(EnumSet.of(Attribute.SSL_CONTEXT))).addExtraParameters(Attribute.SSL_CONTEXT).addAttributeTranslation(DeprecatedAttribute.SIMPLE_LOAD_PROVIDER, SIMPLE_LOAD_PROVIDER_TRANSLATION).addAlias(DeprecatedAttribute.CONNECTOR, Attribute.LISTENER).addRequiredSingletonChildren(SimpleLoadProviderResourceDefinition.PATH).addCapabilities(Capability.class);
    registration.registerReadWriteAttribute(Attribute.SSL_CONTEXT.getDefinition(), null, new ReloadRequiredWriteAttributeHandler() {

        @Override
        protected void validateUpdatedModel(OperationContext context, Resource model) {
            context.addStep(new OperationStepHandler() {

                @Override
                public void execute(OperationContext ctx, ModelNode op) throws OperationFailedException {
                    if (model.hasChild(SSLResourceDefinition.PATH)) {
                        throw new OperationFailedException(ROOT_LOGGER.bothElytronAndLegacySslContextDefined());
                    }
                }
            }, OperationContext.Stage.MODEL);
        }
    });
    parent.registerAlias(LEGACY_PATH, new AliasEntry(registration) {

        @Override
        public PathAddress convertToTargetAddress(PathAddress aliasAddress, AliasContext aliasContext) {
            PathAddress rebuiltAddress = PathAddress.EMPTY_ADDRESS;
            for (PathElement pathElement : aliasAddress) {
                if (pathElement.equals(LEGACY_PATH)) {
                    try {
                        if (aliasContext.readResourceFromRoot(rebuiltAddress, false).hasChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey())) {
                            Set<Resource.ResourceEntry> children = aliasContext.readResourceFromRoot(rebuiltAddress, false).getChildren(ProxyConfigurationResourceDefinition.WILDCARD_PATH.getKey());
                            if (children.size() > 1 && !Operations.getOperationName(aliasContext.getOperation()).equals(AliasContext.RECURSIVE_GLOBAL_OP)) {
                                throw new IllegalStateException(ModClusterLogger.ROOT_LOGGER.legacyOperationsWithMultipleProxies());
                            }
                            PathAddress proxyPath = PathAddress.pathAddress(ProxyConfigurationResourceDefinition.pathElement(children.iterator().next().getName()));
                            rebuiltAddress = rebuiltAddress.append(proxyPath);
                        } else {
                            // handle :add
                            rebuiltAddress = rebuiltAddress.append(ProxyConfigurationResourceDefinition.pathElement("default"));
                        }
                    } catch (Resource.NoSuchResourceException ignore) {
                        // handle recursive-global-op
                        rebuiltAddress = rebuiltAddress.append(ProxyConfigurationResourceDefinition.WILDCARD_PATH);
                    }
                } else {
                    rebuiltAddress = rebuiltAddress.append(pathElement);
                }
            }
            return rebuiltAddress;
        }
    });
    if (registration.isRuntimeOnlyRegistrationValid()) {
        new OperationHandler<>(new ProxyOperationExecutor(this.executors), ProxyOperation.class).register(registration);
    }
    new ReloadRequiredResourceRegistration(descriptor).register(registration);
    new LegacyMetricOperationsRegistration().register(registration);
    new SimpleLoadProviderResourceDefinition().register(registration);
    new DynamicLoadProviderResourceDefinition().register(registration);
    new SSLResourceDefinition().register(registration);
    return registration;
}
Also used : OperationContext(org.jboss.as.controller.OperationContext) EnumSet(java.util.EnumSet) Set(java.util.Set) OperationStepHandler(org.jboss.as.controller.OperationStepHandler) Resource(org.jboss.as.controller.registry.Resource) OperationFailedException(org.jboss.as.controller.OperationFailedException) ManagementResourceRegistration(org.jboss.as.clustering.controller.ManagementResourceRegistration) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler) PathElement(org.jboss.as.controller.PathElement) PathAddress(org.jboss.as.controller.PathAddress) ReloadRequiredResourceRegistration(org.jboss.as.clustering.controller.ReloadRequiredResourceRegistration) AliasEntry(org.jboss.as.controller.registry.AliasEntry) ModelNode(org.jboss.dmr.ModelNode) 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