boolean enabled = !operation.hasDefined(ENABLED) || operation.get(ENABLED).asBoolean();
AbstractDataSourceService dataSourceService = createDataSourceService(jndiName);
final ServiceName dataSourceServiceName = AbstractDataSourceService.SERVICE_NAME_BASE.append(jndiName);
final ServiceBuilder<?> dataSourceServiceBuilder = serviceTarget
.addService(dataSourceServiceName, dataSourceService)
.addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class,
dataSourceService.getTransactionIntegrationInjector())
.addDependency(ConnectorServices.MANAGEMENT_REPOSISTORY_SERVICE, ManagementRepository.class,
dataSourceService.getmanagementRepositoryInjector())
.addDependency(SubjectFactoryService.SERVICE_NAME, SubjectFactory.class,
dataSourceService.getSubjectFactoryInjector())
.addDependency(ConnectorServices.JDBC_DRIVER_REGISTRY_SERVICE, DriverRegistry.class,
dataSourceService.getDriverRegistryInjector()).addDependency(NamingService.SERVICE_NAME);
controllers.add(startConfigAndAddDependency(dataSourceServiceBuilder, dataSourceService, jndiName, serviceTarget, operation));
ModelNode node = operation.require(DATASOURCE_DRIVER);
final String driverName = node.asString();
final ServiceName driverServiceName = ServiceName.JBOSS.append("jdbc-driver", driverName.replaceAll("\\.", "_"));
if (driverServiceName != null) {
dataSourceServiceBuilder.addDependency(driverServiceName, Driver.class,
dataSourceService.getDriverInjector());
}
final DataSourceReferenceFactoryService referenceFactoryService = new DataSourceReferenceFactoryService();
final ServiceName referenceFactoryServiceName = DataSourceReferenceFactoryService.SERVICE_NAME_BASE
.append(jndiName);
final ServiceBuilder<?> referenceBuilder = serviceTarget.addService(referenceFactoryServiceName,
referenceFactoryService).addDependency(dataSourceServiceName, DataSource.class,
referenceFactoryService.getDataSourceInjector());
final ServiceName binderServiceName = Util.getBinderServiceName(jndiName);
final BinderService binderService = new BinderService(binderServiceName.getSimpleName());
final ServiceBuilder<?> binderBuilder = serviceTarget
.addService(binderServiceName, binderService)
.addDependency(referenceFactoryServiceName, ManagedReferenceFactory.class, binderService.getManagedObjectInjector())
.addDependency(binderServiceName.getParent(), NamingStore.class, binderService.getNamingStoreInjector()).addListener(new AbstractServiceListener<Object>() {
public void transition(final ServiceController<? extends Object> controller, final ServiceController.Transition transition) {
switch (transition) {
case STARTING_to_UP: {
log.infof("Bound data source [%s]", jndiName);
break;