Search in sources :

Example 1 with DeploymentResourceSupport

use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.

the class DsXmlDeploymentInstallProcessor method installManagementModel.

private void installManagementModel(final DataSource ds, final DeploymentUnit deploymentUnit, final PathAddress addr) {
    XMLDataSourceRuntimeHandler.INSTANCE.registerDataSource(addr, ds);
    final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    deploymentResourceSupport.getDeploymentSubModel(DataSourcesExtension.SUBSYSTEM_NAME, addr.getLastElement());
    if (ds.getConnectionProperties() != null) {
        for (final Map.Entry<String, String> prop : ds.getConnectionProperties().entrySet()) {
            PathAddress registration = PathAddress.pathAddress(addr.getLastElement(), PathElement.pathElement(CONNECTION_PROPERTIES, prop.getKey()));
            deploymentResourceSupport.getDeploymentSubModel(DataSourcesExtension.SUBSYSTEM_NAME, registration);
        }
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) PathAddress(org.jboss.as.controller.PathAddress) Map(java.util.Map)

Example 2 with DeploymentResourceSupport

use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.

the class EjbManagementDeploymentUnitProcessor method installManagementResource.

private void installManagementResource(ComponentConfiguration configuration, DeploymentUnit deploymentUnit) {
    final EJBComponentType type = EJBComponentType.getComponentType(configuration);
    PathAddress addr = getComponentAddress(type, configuration, deploymentUnit);
    final AbstractEJBComponentRuntimeHandler<?> handler = type.getRuntimeHandler();
    handler.registerComponent(addr, configuration.getComponentDescription().getStartServiceName());
    deploymentUnit.addToAttachmentList(EjbDeploymentAttachmentKeys.MANAGED_COMPONENTS, new InstalledComponent(type, addr));
    final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    deploymentResourceSupport.getDeploymentSubModel(EJB3Extension.SUBSYSTEM_NAME, addr.getLastElement());
    final EJBComponentDescription description = (EJBComponentDescription) configuration.getComponentDescription();
    if (description.isTimerServiceRequired()) {
        final PathAddress timerServiceAddress = PathAddress.pathAddress(addr.getLastElement(), EJB3SubsystemModel.TIMER_SERVICE_PATH);
        final TimerServiceResource timerServiceResource = ((TimerServiceImpl) description.getTimerService()).getResource();
        deploymentResourceSupport.registerDeploymentSubResource(EJB3Extension.SUBSYSTEM_NAME, timerServiceAddress, timerServiceResource);
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) TimerServiceResource(org.jboss.as.ejb3.subsystem.deployment.TimerServiceResource) InstalledComponent(org.jboss.as.ejb3.subsystem.deployment.InstalledComponent) PathAddress(org.jboss.as.controller.PathAddress) EJBComponentType(org.jboss.as.ejb3.subsystem.deployment.EJBComponentType) TimerServiceImpl(org.jboss.as.ejb3.timerservice.TimerServiceImpl) EJBComponentDescription(org.jboss.as.ejb3.component.EJBComponentDescription)

Example 3 with DeploymentResourceSupport

use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.

the class UndertowJSRWebSocketDeploymentProcessor method addManagementWebsocket.

void addManagementWebsocket(final DeploymentUnit unit, Class endpoint, String path) {
    try {
        final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
        //websockets don't have the concept of a name, however the path much be unique
        final ModelNode node = deploymentResourceSupport.getDeploymentSubModel(UndertowExtension.SUBSYSTEM_NAME, PathElement.pathElement("websocket", path));
        node.get("endpoint-class").set(endpoint.getName());
        node.get("path").set(path);
    } catch (Exception e) {
        UndertowLogger.ROOT_LOGGER.failedToRegisterWebsocket(endpoint, path, e);
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) ModelNode(org.jboss.dmr.ModelNode) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException)

Example 4 with DeploymentResourceSupport

use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.

the class ModelDeploymentAspect method start.

@Override
public void start(final Deployment dep) {
    final DeploymentUnit unit = dep.getAttachment(DeploymentUnit.class);
    if (unit instanceof WSEndpointDeploymentUnit)
        return;
    final DeploymentResourceSupport deploymentResourceSupport = unit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    for (final Endpoint endpoint : dep.getService().getEndpoints()) {
        final ModelNode endpointModel;
        try {
            endpointModel = deploymentResourceSupport.getDeploymentSubModel(WSExtension.SUBSYSTEM_NAME, PathElement.pathElement(ENDPOINT, URLEncoder.encode(getId(endpoint), "UTF-8")));
        } catch (final UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        endpointModel.get(ENDPOINT_NAME).set(getName(endpoint));
        endpointModel.get(ENDPOINT_CONTEXT).set(getContext(endpoint));
        endpointModel.get(ENDPOINT_CLASS).set(endpoint.getTargetBeanName());
        endpointModel.get(ENDPOINT_TYPE).set(endpoint.getType().toString());
        endpointModel.get(ENDPOINT_WSDL).set(endpoint.getAddress() + "?wsdl");
    }
}
Also used : DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) WSEndpointDeploymentUnit(org.jboss.as.webservices.publish.WSEndpointDeploymentUnit) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ModelNode(org.jboss.dmr.ModelNode) WSEndpointDeploymentUnit(org.jboss.as.webservices.publish.WSEndpointDeploymentUnit) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 5 with DeploymentResourceSupport

use of org.jboss.as.server.deployment.DeploymentResourceSupport in project wildfly by wildfly.

the class JMSConnectionFactoryDefinitionInjectionSource method startedPooledConnectionFactory.

private void startedPooledConnectionFactory(ResolutionContext context, String name, ServiceBuilder<?> serviceBuilder, ServiceTarget serviceTarget, DeploymentUnit deploymentUnit, Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException, OperationFailedException {
    Map<String, String> props = new HashMap<>(properties);
    List<String> connectors = getConnectors(props);
    clearUnknownProperties(properties);
    ModelNode model = new ModelNode();
    for (String connector : connectors) {
        model.get(CONNECTORS).add(connector);
    }
    for (Map.Entry<String, String> entry : properties.entrySet()) {
        model.get(entry.getKey()).set(entry.getValue());
    }
    model.get(MIN_POOL_SIZE.getName()).set(minPoolSize);
    model.get(MAX_POOL_SIZE.getName()).set(maxPoolSize);
    if (user != null && !user.isEmpty()) {
        model.get(ConnectionFactoryAttributes.Pooled.USER.getName()).set(user);
    }
    if (password != null && !password.isEmpty()) {
        model.get(ConnectionFactoryAttributes.Pooled.PASSWORD.getName()).set(password);
    }
    if (clientId != null && !clientId.isEmpty()) {
        model.get(CommonAttributes.CLIENT_ID.getName()).set(clientId);
    }
    final String discoveryGroupName = properties.containsKey(DISCOVERY_GROUP.getName()) ? properties.get(DISCOVERY_GROUP.getName()) : null;
    if (discoveryGroupName != null) {
        model.get(DISCOVERY_GROUP.getName()).set(discoveryGroupName);
    }
    final String jgroupsChannelName = properties.containsKey(JGROUPS_CHANNEL.getName()) ? properties.get(JGROUPS_CHANNEL.getName()) : null;
    if (jgroupsChannelName != null) {
        model.get(JGROUPS_CHANNEL.getName()).set(jgroupsChannelName);
    }
    final String managedConnectionPoolClassName = properties.containsKey(MANAGED_CONNECTION_POOL.getName()) ? properties.get(MANAGED_CONNECTION_POOL.getName()) : null;
    if (managedConnectionPoolClassName != null) {
        model.get(MANAGED_CONNECTION_POOL.getName()).set(managedConnectionPoolClassName);
    }
    final Boolean enlistmentTrace = properties.containsKey(ENLISTMENT_TRACE.getName()) ? Boolean.valueOf(properties.get(ENLISTMENT_TRACE.getName())) : null;
    List<PooledConnectionFactoryConfigProperties> adapterParams = getAdapterParams(model);
    String txSupport = transactional ? XA_TX : NO_TX;
    final String serverName = getActiveMQServerName(properties);
    final String pcfName = uniqueName(context, name);
    final ContextNames.BindInfo bindInfo = ContextNames.bindInfoForEnvEntry(context.getApplicationName(), context.getModuleName(), context.getComponentName(), !context.isCompUsesModule(), name);
    PooledConnectionFactoryService.installService(serviceTarget, pcfName, serverName, connectors, discoveryGroupName, jgroupsChannelName, adapterParams, bindInfo, txSupport, minPoolSize, maxPoolSize, managedConnectionPoolClassName, enlistmentTrace, true);
    final ServiceName referenceFactoryServiceName = ConnectionFactoryReferenceFactoryService.SERVICE_NAME_BASE.append(bindInfo.getBinderServiceName());
    serviceBuilder.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, injector);
    //create the management registration
    String managementName = managementName(context, name);
    final PathElement serverElement = PathElement.pathElement(SERVER, serverName);
    final DeploymentResourceSupport deploymentResourceSupport = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_RESOURCE_SUPPORT);
    deploymentResourceSupport.getDeploymentSubModel(MessagingExtension.SUBSYSTEM_NAME, serverElement);
    final PathElement pcfPath = PathElement.pathElement(POOLED_CONNECTION_FACTORY, managementName);
    PathAddress registration = PathAddress.pathAddress(serverElement, pcfPath);
    MessagingXmlInstallDeploymentUnitProcessor.createDeploymentSubModel(registration, deploymentUnit);
    PooledConnectionFactoryConfigurationRuntimeHandler.INSTANCE.registerResource(serverName, managementName, model);
}
Also used : HashMap(java.util.HashMap) PooledConnectionFactoryConfigProperties(org.wildfly.extension.messaging.activemq.jms.PooledConnectionFactoryConfigProperties) DeploymentResourceSupport(org.jboss.as.server.deployment.DeploymentResourceSupport) PathElement(org.jboss.as.controller.PathElement) ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) ModelNode(org.jboss.dmr.ModelNode) Map(java.util.Map) HashMap(java.util.HashMap) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Aggregations

DeploymentResourceSupport (org.jboss.as.server.deployment.DeploymentResourceSupport)13 PathAddress (org.jboss.as.controller.PathAddress)8 ModelNode (org.jboss.dmr.ModelNode)8 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)5 PathElement (org.jboss.as.controller.PathElement)4 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)4 Map (java.util.Map)3 ServiceName (org.jboss.msc.service.ServiceName)3 MalformedURLException (java.net.MalformedURLException)2 JBossServletMetaData (org.jboss.metadata.web.jboss.JBossServletMetaData)2 DeploymentInfo (io.undertow.servlet.api.DeploymentInfo)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Executor (java.util.concurrent.Executor)1 Queue (javax.jms.Queue)1 Topic (javax.jms.Topic)1 CapabilityServiceSupport (org.jboss.as.controller.capability.CapabilityServiceSupport)1 ComponentRegistry (org.jboss.as.ee.component.ComponentRegistry)1 EJBComponentDescription (org.jboss.as.ejb3.component.EJBComponentDescription)1