Search in sources :

Example 76 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class XaDataSourcePropertyAdd method performRuntime.

@Override
protected void performRuntime(OperationContext context, ModelNode operation, ModelNode recoveryEnvModel) throws OperationFailedException {
    final String configPropertyValue = XADATASOURCE_PROPERTY_VALUE.resolveModelAttribute(context, recoveryEnvModel).asString();
    final ModelNode address = operation.require(OP_ADDR);
    PathAddress path = PathAddress.pathAddress(address);
    final String dsName = path.getElement(path.size() - 2).getValue();
    final String configPropertyName = PathAddress.pathAddress(address).getLastElement().getValue();
    ServiceName serviceName = XADataSourceConfigService.SERVICE_NAME_BASE.append(dsName).append("xa-datasource-properties").append(configPropertyName);
    final ServiceRegistry registry = context.getServiceRegistry(true);
    final ServiceName dataSourceConfigServiceName = XADataSourceConfigService.SERVICE_NAME_BASE.append(dsName);
    final ServiceController<?> dataSourceConfigController = registry.getService(dataSourceConfigServiceName);
    if (dataSourceConfigController == null || !((XaDataSource) dataSourceConfigController.getValue()).isEnabled()) {
        final ServiceTarget serviceTarget = context.getServiceTarget();
        final XaDataSourcePropertiesService service = new XaDataSourcePropertiesService(configPropertyName, configPropertyValue);
        ServiceController<?> controller = serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.NEVER).install();
    } else {
        context.reloadRequired();
    }
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) PathAddress(org.jboss.as.controller.PathAddress) ServiceTarget(org.jboss.msc.service.ServiceTarget) ServiceRegistry(org.jboss.msc.service.ServiceRegistry) ModelNode(org.jboss.dmr.ModelNode) XaDataSource(org.jboss.jca.common.api.metadata.ds.XaDataSource)

Example 77 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class JdbcDriverRemove method performRuntime.

protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException {
    final String driverName = model.get(DRIVER_NAME.getName()).asString();
    final ServiceRegistry registry = context.getServiceRegistry(true);
    ServiceName jdbcServiceName = ServiceName.JBOSS.append("jdbc-driver", driverName.replaceAll("\\.", "_"));
    ServiceController<?> jdbcServiceController = registry.getService(jdbcServiceName);
    context.removeService(jdbcServiceController);
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry)

Example 78 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class XaDataSourceAdd method startConfigAndAddDependency.

@Override
protected void startConfigAndAddDependency(ServiceBuilder<?> dataSourceServiceBuilder, AbstractDataSourceService dataSourceService, String jndiName, ServiceTarget serviceTarget, final ModelNode operation) throws OperationFailedException {
    final ServiceName dataSourceCongServiceName = XADataSourceConfigService.SERVICE_NAME_BASE.append(jndiName);
    dataSourceServiceBuilder.addDependency(dataSourceCongServiceName, ModifiableXaDataSource.class, ((XaDataSourceService) dataSourceService).getDataSourceConfigInjector());
}
Also used : ServiceName(org.jboss.msc.service.ServiceName)

Example 79 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class JaccEjbDeploymentProcessor method getJaccServiceName.

private ServiceName getJaccServiceName(DeploymentUnit deploymentUnit) {
    final DeploymentUnit parentDU = deploymentUnit.getParent();
    // EJBs maybe included directly in war deployment
    ServiceName jaccServiceName = deploymentUnit.getServiceName().append(JaccService.SERVICE_NAME).append("ejb");
    //Qualify the service name properly with parent DU
    if (parentDU != null) {
        jaccServiceName = jaccServiceName.append(parentDU.getName());
    }
    return jaccServiceName;
}
Also used : ServiceName(org.jboss.msc.service.ServiceName) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 80 with ServiceName

use of org.jboss.msc.service.ServiceName in project wildfly by wildfly.

the class JaccEjbDeploymentProcessor method undeploy.

@Override
public void undeploy(DeploymentUnit deploymentUnit) {
    AbstractSecurityDeployer<?> deployer = null;
    deployer = new EjbSecurityDeployer();
    deployer.undeploy(deploymentUnit);
    // EJBs maybe included directly in war deployment
    ServiceName jaccServiceName = getJaccServiceName(deploymentUnit);
    ServiceRegistry registry = deploymentUnit.getServiceRegistry();
    if (registry != null) {
        ServiceController<?> serviceController = registry.getService(jaccServiceName);
        if (serviceController != null) {
            serviceController.setMode(ServiceController.Mode.REMOVE);
        }
    }
}
Also used : EjbSecurityDeployer(org.jboss.as.ejb3.deployment.EjbSecurityDeployer) ServiceName(org.jboss.msc.service.ServiceName) ServiceRegistry(org.jboss.msc.service.ServiceRegistry)

Aggregations

ServiceName (org.jboss.msc.service.ServiceName)323 ServiceTarget (org.jboss.msc.service.ServiceTarget)62 PathAddress (org.jboss.as.controller.PathAddress)57 ModelNode (org.jboss.dmr.ModelNode)53 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)47 ServiceRegistry (org.jboss.msc.service.ServiceRegistry)45 OperationFailedException (org.jboss.as.controller.OperationFailedException)35 ServiceController (org.jboss.msc.service.ServiceController)26 Module (org.jboss.modules.Module)24 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)22 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)22 ContextNames (org.jboss.as.naming.deployment.ContextNames)21 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)20 BinderService (org.jboss.as.naming.service.BinderService)20 ArrayList (java.util.ArrayList)17 HashSet (java.util.HashSet)17 ServiceBuilder (org.jboss.msc.service.ServiceBuilder)16 HashMap (java.util.HashMap)14 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)14 OperationContext (org.jboss.as.controller.OperationContext)12