Search in sources :

Example 41 with ManagementResourceRegistration

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

the class WebExtension method initializeLegacyModel.

@Override
protected Set<ManagementResourceRegistration> initializeLegacyModel(ExtensionContext context) {
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(WebDefinition.INSTANCE);
    subsystem.registerXMLElementWriter(WebSubsystemParser.getInstance());
    // connectors
    final ManagementResourceRegistration connectors = registration.registerSubModel(WebConnectorDefinition.INSTANCE);
    final ManagementResourceRegistration ssl = connectors.registerSubModel(WebSSLDefinition.INSTANCE);
    connectors.registerAlias(SSL_ALIAS, new StandardWebExtensionAliasEntry(ssl));
    //hosts
    final ManagementResourceRegistration hosts = registration.registerSubModel(WebVirtualHostDefinition.INSTANCE);
    // access-log.
    final ManagementResourceRegistration accesslog = hosts.registerSubModel(WebAccessLogDefinition.INSTANCE);
    hosts.registerAlias(ACCESS_LOG_ALIAS, new StandardWebExtensionAliasEntry(accesslog));
    // access-log.
    // the directory needs one level more
    final ManagementResourceRegistration accessLogDir = accesslog.registerSubModel(WebAccessLogDirectoryDefinition.INSTANCE);
    accesslog.registerAlias(DIRECTORY_ALIAS, new StandardWebExtensionAliasEntry(accessLogDir));
    // sso valve.
    final ManagementResourceRegistration sso = hosts.registerSubModel(WebSSODefinition.INSTANCE);
    hosts.registerAlias(SSO_ALIAS, new StandardWebExtensionAliasEntry(sso));
    // rewrite valve.
    final ManagementResourceRegistration rewrite = hosts.registerSubModel(WebReWriteDefinition.INSTANCE);
    // the condition needs one level more
    rewrite.registerSubModel(WebReWriteConditionDefinition.INSTANCE);
    // configuration=jsp
    registration.registerSubModel(WebJSPDefinition.INSTANCE);
    // configuration=resources
    registration.registerSubModel(WebStaticResources.INSTANCE);
    // configuration=container
    registration.registerSubModel(WebContainerDefinition.INSTANCE);
    // Global valve.
    registration.registerSubModel(WebValveDefinition.INSTANCE);
    //noinspection deprecation
    if (context.isRegisterTransformers()) {
        registerTransformers_1_3_0(subsystem);
        registerTransformers_1_4_0(subsystem);
        registerTransformers_2_x_0(subsystem, 0);
        registerTransformers_2_x_0(subsystem, 1);
    }
    return Collections.singleton(registration);
}
Also used : ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 42 with ManagementResourceRegistration

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

the class WSExtension method initialize.

@Override
public void initialize(final ExtensionContext context) {
    final boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    subsystem.registerXMLElementWriter(WSSubsystemWriter.getInstance());
    // ws subsystem
    ResourceBuilder propertyResource = ResourceBuilder.Factory.create(PROPERTY_PATH, getResourceDescriptionResolver(Constants.PROPERTY)).setAddOperation(PropertyAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.VALUE, null, new ReloadRequiredWriteAttributeHandler(Attributes.VALUE));
    ResourceBuilder handlerBuilder = ResourceBuilder.Factory.create(HANDLER_PATH, getResourceDescriptionResolver(HANDLER)).setAddOperation(HandlerAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.CLASS, null, new ReloadRequiredWriteAttributeHandler(Attributes.CLASS));
    ResourceBuilder preHandler = ResourceBuilder.Factory.create(PRE_HANDLER_CHAIN_PATH, getResourceDescriptionResolver(Constants.PRE_HANDLER_CHAIN)).setAddOperation(HandlerChainAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.PROTOCOL_BINDINGS, null, new ReloadRequiredWriteAttributeHandler(Attributes.PROTOCOL_BINDINGS)).pushChild(handlerBuilder).pop();
    ResourceBuilder postHandler = ResourceBuilder.Factory.create(POST_HANDLER_CHAIN_PATH, getResourceDescriptionResolver(Constants.POST_HANDLER_CHAIN)).setAddOperation(HandlerChainAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).addReadWriteAttribute(Attributes.PROTOCOL_BINDINGS, null, new ReloadRequiredWriteAttributeHandler(Attributes.PROTOCOL_BINDINGS)).pushChild(handlerBuilder).pop();
    ResourceDefinition epConfigsDef = ResourceBuilder.Factory.create(ENDPOINT_CONFIG_PATH, getResourceDescriptionResolver(ENDPOINT_CONFIG)).setAddOperation(EndpointConfigAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).pushChild(propertyResource).pop().pushChild(preHandler).pop().pushChild(postHandler).pop().build();
    ResourceDefinition clConfigsDef = ResourceBuilder.Factory.create(CLIENT_CONFIG_PATH, getResourceDescriptionResolver(CLIENT_CONFIG)).setAddOperation(ClientConfigAdd.INSTANCE).setRemoveOperation(ReloadRequiredRemoveStepHandler.INSTANCE).pushChild(propertyResource).pop().pushChild(preHandler).pop().pushChild(postHandler).pop().build();
    ResourceDefinition subsystemResource = ResourceBuilder.Factory.createSubsystemRoot(SUBSYSTEM_PATH, getResourceDescriptionResolver(), WSSubsystemAdd.INSTANCE, WSSubsystemRemove.INSTANCE).addReadWriteAttribute(Attributes.WSDL_HOST, null, new WSServerConfigAttributeHandler(Attributes.WSDL_HOST)).addReadWriteAttribute(Attributes.WSDL_PORT, null, new WSServerConfigAttributeHandler(Attributes.WSDL_PORT)).addReadWriteAttribute(Attributes.WSDL_SECURE_PORT, null, new WSServerConfigAttributeHandler(Attributes.WSDL_SECURE_PORT)).addReadWriteAttribute(Attributes.WSDL_URI_SCHEME, null, new WSServerConfigAttributeHandler(Attributes.WSDL_URI_SCHEME)).addReadWriteAttribute(Attributes.WSDL_PATH_REWRITE_RULE, null, new WSServerConfigAttributeHandler(Attributes.WSDL_PATH_REWRITE_RULE)).addReadWriteAttribute(Attributes.MODIFY_WSDL_ADDRESS, null, new WSServerConfigAttributeHandler(Attributes.MODIFY_WSDL_ADDRESS)).addReadWriteAttribute(Attributes.STATISTICS_ENABLED, null, new WSServerConfigAttributeHandler(Attributes.STATISTICS_ENABLED)).build();
    ManagementResourceRegistration subsystemRegistration = subsystem.registerSubsystemModel(subsystemResource);
    subsystemRegistration.registerSubModel(epConfigsDef);
    subsystemRegistration.registerSubModel(clConfigsDef);
    if (registerRuntimeOnly) {
        subsystem.registerDeploymentModel(ResourceBuilder.Factory.create(SUBSYSTEM_PATH, getResourceDescriptionResolver("deployment")).pushChild(ENDPOINT_PATH).addMetrics(WSEndpointMetrics.INSTANCE, WSEndpointMetrics.ATTRIBUTES).addReadOnlyAttribute(ENDPOINT_CLASS).addReadOnlyAttribute(ENDPOINT_CONTEXT).addReadOnlyAttribute(ENDPOINT_NAME).addReadOnlyAttribute(ENDPOINT_TYPE).addReadOnlyAttribute(ENDPOINT_WSDL).build());
    }
    if (context.isRegisterTransformers()) {
        registerTransformers1_2_0(subsystem);
        registerTransformers2_0_0(subsystem);
    }
}
Also used : ResourceBuilder(org.jboss.as.controller.ResourceBuilder) ResourceDefinition(org.jboss.as.controller.ResourceDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) ReloadRequiredWriteAttributeHandler(org.jboss.as.controller.ReloadRequiredWriteAttributeHandler) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 43 with ManagementResourceRegistration

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

the class SimpleElectionPolicyResourceDefinition method register.

@Override
public void register(ManagementResourceRegistration parentRegistration) {
    ManagementResourceRegistration registration = parentRegistration.registerSubModel(this);
    ResourceDescriptor descriptor = new ResourceDescriptor(this.getResourceDescriptionResolver()).addAttributes(Attribute.class).addAttributes(ElectionPolicyResourceDefinition.Attribute.class).addCapabilities(ElectionPolicyResourceDefinition.Capability.class);
    ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new SimpleElectionPolicyBuilder(address.getParent()));
    new SimpleResourceRegistration(descriptor, handler).register(registration);
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 44 with ManagementResourceRegistration

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

the class SingletonPolicyResourceDefinition 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).addRequiredSingletonChildren(SimpleElectionPolicyResourceDefinition.PATH);
    ResourceServiceHandler handler = new SimpleResourceServiceHandler<>(address -> new SingletonPolicyBuilder(address));
    new SimpleResourceRegistration(descriptor, handler).register(registration);
    new RandomElectionPolicyResourceDefinition().register(registration);
    new SimpleElectionPolicyResourceDefinition().register(registration);
}
Also used : SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) SimpleResourceRegistration(org.jboss.as.clustering.controller.SimpleResourceRegistration) RuntimeCapability(org.jboss.as.controller.capability.RuntimeCapability) UnaryRequirementCapability(org.jboss.as.clustering.controller.UnaryRequirementCapability) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SimpleResourceServiceHandler(org.jboss.as.clustering.controller.SimpleResourceServiceHandler) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Example 45 with ManagementResourceRegistration

use of org.jboss.as.controller.registry.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, 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);
}
Also used : SingletonDeploymentParsingProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentParsingProcessor) SubsystemResourceDefinition(org.jboss.as.clustering.controller.SubsystemResourceDefinition) SimpleAttributeDefinitionBuilder(org.jboss.as.controller.SimpleAttributeDefinitionBuilder) SingletonDefaultRequirement(org.wildfly.clustering.singleton.SingletonDefaultRequirement) CapabilityReference(org.jboss.as.clustering.controller.CapabilityReference) SingletonDeploymentXMLReader(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentXMLReader) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration) SingletonDeploymentProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentProcessor) ResourceTransformationDescriptionBuilder(org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder) ModelVersion(org.jboss.as.controller.ModelVersion) SingletonRequirement(org.wildfly.clustering.singleton.SingletonRequirement) Requirement(org.wildfly.clustering.service.Requirement) ModelDescriptionConstants(org.jboss.as.controller.descriptions.ModelDescriptionConstants) CapabilityReferenceRecorder(org.jboss.as.controller.CapabilityReferenceRecorder) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) SimpleAttributeDefinition(org.jboss.as.controller.SimpleAttributeDefinition) SingletonDeploymentDependencyProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentDependencyProcessor) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor) PathElement(org.jboss.as.controller.PathElement) DeploymentChainContributingResourceRegistration(org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration) Flag(org.jboss.as.controller.registry.AttributeAccess.Flag) TransformationDescription(org.jboss.as.controller.transform.description.TransformationDescription) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) TransformationDescriptionBuilder(org.jboss.as.controller.transform.description.TransformationDescriptionBuilder) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) SingletonDeploymentSchema(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentSchema) CapabilityProvider(org.jboss.as.clustering.controller.CapabilityProvider) RequirementCapability(org.jboss.as.clustering.controller.RequirementCapability) GenericSubsystemDescribeHandler(org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler) Phase(org.jboss.as.server.deployment.Phase) ModelType(org.jboss.dmr.ModelType) JBossAllXmlParserRegisteringProcessor(org.jboss.as.server.deployment.jbossallxml.JBossAllXmlParserRegisteringProcessor) SingletonDeploymentProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentProcessor) SingletonDeploymentParsingProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentParsingProcessor) SingletonDeploymentSchema(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentSchema) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) DeploymentChainContributingResourceRegistration(org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration) SingletonDeploymentDependencyProcessor(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentDependencyProcessor) ResourceServiceHandler(org.jboss.as.clustering.controller.ResourceServiceHandler) SingletonDeploymentXMLReader(org.wildfly.extension.clustering.singleton.deployment.SingletonDeploymentXMLReader) ResourceDescriptor(org.jboss.as.clustering.controller.ResourceDescriptor)

Aggregations

ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)79 SubsystemRegistration (org.jboss.as.controller.SubsystemRegistration)32 ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)30 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)26 SimpleResourceRegistration (org.jboss.as.clustering.controller.SimpleResourceRegistration)25 SimpleResourceServiceHandler (org.jboss.as.clustering.controller.SimpleResourceServiceHandler)16 PathElement (org.jboss.as.controller.PathElement)12 SimpleAliasEntry (org.jboss.as.clustering.controller.SimpleAliasEntry)9 PathAddress (org.jboss.as.controller.PathAddress)9 ModelNode (org.jboss.dmr.ModelNode)8 OperationStepHandler (org.jboss.as.controller.OperationStepHandler)7 Resource (org.jboss.as.controller.registry.Resource)7 Map (java.util.Map)6 Locale (java.util.Locale)5 UnaryRequirementCapability (org.jboss.as.clustering.controller.UnaryRequirementCapability)5 OperationContext (org.jboss.as.controller.OperationContext)5 EnumMap (java.util.EnumMap)4 EnumSet (java.util.EnumSet)4 AttributeDefinition (org.jboss.as.controller.AttributeDefinition)4 SimpleAttributeDefinitionBuilder (org.jboss.as.controller.SimpleAttributeDefinitionBuilder)4