Search in sources :

Example 1 with ResourceDefinition

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

the class EJB3Extension method initialize.

/**
 * {@inheritDoc}
 */
@Override
public void initialize(ExtensionContext context) {
    final boolean registerRuntimeOnly = context.isRuntimeOnlyRegistrationValid();
    final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, CURRENT_MODEL_VERSION);
    subsystem.registerXMLElementWriter(EJB3SubsystemXMLPersister.INSTANCE);
    PathManager pathManager = context.getProcessType().isServer() ? context.getPathManager() : null;
    subsystem.registerSubsystemModel(new EJB3SubsystemRootResourceDefinition(registerRuntimeOnly, pathManager));
    if (registerRuntimeOnly) {
        ResourceDefinition deploymentsDef = new SimpleResourceDefinition(new Parameters(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, SUBSYSTEM_NAME), getResourceDescriptionResolver("deployed")).setFeature(false));
        final ManagementResourceRegistration deploymentsRegistration = subsystem.registerDeploymentModel(deploymentsDef);
        deploymentsRegistration.registerSubModel(MessageDrivenBeanResourceDefinition.INSTANCE);
        deploymentsRegistration.registerSubModel(SingletonBeanDeploymentResourceDefinition.INSTANCE);
        deploymentsRegistration.registerSubModel(StatelessSessionBeanDeploymentResourceDefinition.INSTANCE);
        deploymentsRegistration.registerSubModel(StatefulSessionBeanDeploymentResourceDefinition.INSTANCE);
    }
}
Also used : PathManager(org.jboss.as.controller.services.path.PathManager) Parameters(org.jboss.as.controller.SimpleResourceDefinition.Parameters) StatelessSessionBeanDeploymentResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.StatelessSessionBeanDeploymentResourceDefinition) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) SingletonBeanDeploymentResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.SingletonBeanDeploymentResourceDefinition) ResourceDefinition(org.jboss.as.controller.ResourceDefinition) MessageDrivenBeanResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.MessageDrivenBeanResourceDefinition) StatefulSessionBeanDeploymentResourceDefinition(org.jboss.as.ejb3.subsystem.deployment.StatefulSessionBeanDeploymentResourceDefinition) SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) ManagementResourceRegistration(org.jboss.as.controller.registry.ManagementResourceRegistration) SubsystemRegistration(org.jboss.as.controller.SubsystemRegistration)

Example 2 with ResourceDefinition

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

the class ModelXMLElementWriter method write.

public void write(XMLExtendedStreamWriter writer, ModelNode modelNode) throws XMLStreamException {
    String nodeName = modelNode.asProperty().getName();
    if (nodeName.equals(this.modelElement.getName())) {
        List<ModelNode> modelNodes = modelNode.asProperty().getValue().asList();
        boolean writeParrent = this.parentElement != null && !modelNodes.isEmpty();
        if (writeParrent) {
            writer.writeStartElement(this.parentElement.getName());
        }
        for (ModelNode valueNode : modelNodes) {
            writer.writeStartElement(this.modelElement.getName());
            if (this.nameAttribute != null) {
                writer.writeAttribute(this.nameAttribute, valueNode.keys().iterator().next());
            }
            ModelNode value = valueNode.asProperty().getValue();
            if (value.isDefined()) {
                writeAttributes(writer, value);
                for (ModelNode propertyIdentity : value.asList()) {
                    List<ResourceDefinition> children = getChildResourceDefinitions().get(this.modelElement);
                    if (children != null) {
                        for (ResourceDefinition child : children) {
                            get(child.getPathElement().getKey()).write(writer, propertyIdentity);
                        }
                    }
                }
            }
            writer.writeEndElement();
        }
        if (writeParrent) {
            writer.writeEndElement();
        }
    }
}
Also used : ResourceDefinition(org.jboss.as.controller.ResourceDefinition) ModelNode(org.jboss.dmr.ModelNode)

Example 3 with ResourceDefinition

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

the class AbstractResourceDefinition method addChildResourceDefinition.

private void addChildResourceDefinition(ModelElement resourceDefinitionKey, ResourceDefinition resourceDefinition) {
    List<ResourceDefinition> childResources = childResourceDefinitions.get(resourceDefinitionKey);
    if (childResources == null) {
        childResources = new ArrayList<>();
        childResourceDefinitions.put(resourceDefinitionKey, childResources);
    }
    if (!childResources.contains(resourceDefinition)) {
        for (ResourceDefinition childResource : childResources) {
            if (childResource.getPathElement().getKey().equals(resourceDefinition.getPathElement().getKey())) {
                return;
            }
        }
        childResources.add(resourceDefinition);
    }
}
Also used : SimpleResourceDefinition(org.jboss.as.controller.SimpleResourceDefinition) ResourceDefinition(org.jboss.as.controller.ResourceDefinition)

Example 4 with ResourceDefinition

use of org.jboss.as.controller.ResourceDefinition 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(new WSSubsystemWriter());
    // 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")).noFeature().pushChild(ENDPOINT_PATH).addMetrics(WSEndpointMetrics.INSTANCE, WSEndpointMetrics.ATTRIBUTES).addReadOnlyAttribute(ENDPOINT_CLASS).addReadOnlyAttribute(ENDPOINT_CONTEXT).addReadOnlyAttribute(ENDPOINT_NAME).addReadOnlyAttribute(ENDPOINT_TYPE).addReadOnlyAttribute(ENDPOINT_WSDL).build());
    }
}
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)

Aggregations

ResourceDefinition (org.jboss.as.controller.ResourceDefinition)4 SimpleResourceDefinition (org.jboss.as.controller.SimpleResourceDefinition)2 SubsystemRegistration (org.jboss.as.controller.SubsystemRegistration)2 ManagementResourceRegistration (org.jboss.as.controller.registry.ManagementResourceRegistration)2 ReloadRequiredWriteAttributeHandler (org.jboss.as.controller.ReloadRequiredWriteAttributeHandler)1 ResourceBuilder (org.jboss.as.controller.ResourceBuilder)1 Parameters (org.jboss.as.controller.SimpleResourceDefinition.Parameters)1 PathManager (org.jboss.as.controller.services.path.PathManager)1 MessageDrivenBeanResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.MessageDrivenBeanResourceDefinition)1 SingletonBeanDeploymentResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.SingletonBeanDeploymentResourceDefinition)1 StatefulSessionBeanDeploymentResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.StatefulSessionBeanDeploymentResourceDefinition)1 StatelessSessionBeanDeploymentResourceDefinition (org.jboss.as.ejb3.subsystem.deployment.StatelessSessionBeanDeploymentResourceDefinition)1 ModelNode (org.jboss.dmr.ModelNode)1