Search in sources :

Example 21 with SubsystemRegistration

use of org.jboss.as.controller.SubsystemRegistration 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 22 with SubsystemRegistration

use of org.jboss.as.controller.SubsystemRegistration 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 23 with SubsystemRegistration

use of org.jboss.as.controller.SubsystemRegistration 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)

Example 24 with SubsystemRegistration

use of org.jboss.as.controller.SubsystemRegistration in project wildfly by wildfly.

the class ModClusterExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    ROOT_LOGGER.debugf("Activating mod_cluster extension");
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, ModClusterModel.CURRENT.getVersion());
    final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(new ModClusterSubsystemResourceDefinition(context.isRuntimeOnlyRegistrationValid()));
    final ManagementResourceRegistration configuration = registration.registerSubModel(new ModClusterConfigResourceDefinition());
    configuration.registerSubModel(new ModClusterSSLResourceDefinition());
    final ManagementResourceRegistration dynamicLoadProvider = configuration.registerSubModel(DynamicLoadProviderDefinition.INSTANCE);
    dynamicLoadProvider.registerSubModel(LoadMetricDefinition.INSTANCE);
    dynamicLoadProvider.registerSubModel(CustomLoadMetricDefinition.INSTANCE);
    subsystem.registerXMLElementWriter(new ModClusterSubsystemXMLWriter());
}
Also used : ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 25 with SubsystemRegistration

use of org.jboss.as.controller.SubsystemRegistration in project wildfly by wildfly.

the class JGroupsExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    SubsystemRegistration registration = context.registerSubsystem(SUBSYSTEM_NAME, JGroupsModel.CURRENT.getVersion());
    new JGroupsSubsystemResourceDefinition(context.isRuntimeOnlyRegistrationValid()).register(registration);
    registration.registerXMLElementWriter(new JGroupsSubsystemXMLWriter());
}
Also used : SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Aggregations

SubsystemRegistration (org.jboss.as.controller.SubsystemRegistration)42 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)32 RequirementCapability (org.jboss.as.clustering.controller.RequirementCapability)3 ResourceDescriptor (org.jboss.as.clustering.controller.ResourceDescriptor)3 ResourceServiceHandler (org.jboss.as.clustering.controller.ResourceServiceHandler)3 SubsystemResourceDefinition (org.jboss.as.clustering.controller.SubsystemResourceDefinition)3 ModelVersion (org.jboss.as.controller.ModelVersion)3 PathElement (org.jboss.as.controller.PathElement)3 SimpleResourceDefinition (org.jboss.as.controller.SimpleResourceDefinition)3 ModelDescriptionConstants (org.jboss.as.controller.descriptions.ModelDescriptionConstants)3 ResourceTransformationDescriptionBuilder (org.jboss.as.controller.transform.description.ResourceTransformationDescriptionBuilder)3 TransformationDescription (org.jboss.as.controller.transform.description.TransformationDescription)3 TransformationDescriptionBuilder (org.jboss.as.controller.transform.description.TransformationDescriptionBuilder)3 EnumMap (java.util.EnumMap)2 EnumSet (java.util.EnumSet)2 Map (java.util.Map)2 CapabilityReference (org.jboss.as.clustering.controller.CapabilityReference)2 DeploymentChainContributingResourceRegistration (org.jboss.as.clustering.controller.DeploymentChainContributingResourceRegistration)2 CapabilityReferenceRecorder (org.jboss.as.controller.CapabilityReferenceRecorder)2 ResourceDefinition (org.jboss.as.controller.ResourceDefinition)2