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