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);
}
}
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();
}
}
}
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);
}
}
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());
}
}
Aggregations