Skip to content

Commit

Permalink
Use non deprecated versions of API to simplify service building
Browse files Browse the repository at this point in the history
  • Loading branch information
ctomc committed Jan 16, 2015
1 parent 1a6cdb6 commit 947c94c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 36 deletions.
Expand Up @@ -22,18 +22,13 @@


package org.jboss.as.connector.deployers.ds; package org.jboss.as.connector.deployers.ds;


import java.util.ArrayList;
import java.util.Collection;

import org.jboss.as.connector.deployers.datasource.DataSourceDefinitionAnnotationProcessor; import org.jboss.as.connector.deployers.datasource.DataSourceDefinitionAnnotationProcessor;
import org.jboss.as.connector.deployers.datasource.DataSourceDefinitionDescriptorProcessor; import org.jboss.as.connector.deployers.datasource.DataSourceDefinitionDescriptorProcessor;
import org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor; import org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentInstallProcessor;
import org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentParsingProcessor; import org.jboss.as.connector.deployers.ds.processors.DsXmlDeploymentParsingProcessor;
import org.jboss.as.connector.subsystems.datasources.DataSourcesExtension; import org.jboss.as.connector.subsystems.datasources.DataSourcesExtension;
import org.jboss.as.server.DeploymentProcessorTarget; import org.jboss.as.server.DeploymentProcessorTarget;
import org.jboss.as.server.deployment.Phase; import org.jboss.as.server.deployment.Phase;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceTarget;


/** /**
* Service activator which installs the various service required for datasource * Service activator which installs the various service required for datasource
Expand All @@ -43,13 +38,6 @@
*/ */
public class DsDeploymentActivator { public class DsDeploymentActivator {


public Collection<ServiceController<?>> activateServices(final ServiceTarget serviceTarget) {

final Collection<ServiceController<?>> controllers = new ArrayList<ServiceController<?>>(1);

return controllers;
}

public void activateProcessors(final DeploymentProcessorTarget updateContext) { public void activateProcessors(final DeploymentProcessorTarget updateContext) {
updateContext.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_DSXML_DEPLOYMENT, new DsXmlDeploymentParsingProcessor()); updateContext.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_DSXML_DEPLOYMENT, new DsXmlDeploymentParsingProcessor());
updateContext.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_RESOURCE_DEF_ANNOTATION_DATA_SOURCE, new DataSourceDefinitionAnnotationProcessor()); updateContext.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.PARSE, Phase.PARSE_RESOURCE_DEF_ANNOTATION_DATA_SOURCE, new DataSourceDefinitionAnnotationProcessor());
Expand Down
Expand Up @@ -22,10 +22,6 @@


package org.jboss.as.connector.deployers.ra; package org.jboss.as.connector.deployers.ra;


import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.jboss.as.connector.deployers.ds.processors.DriverProcessor; import org.jboss.as.connector.deployers.ds.processors.DriverProcessor;
import org.jboss.as.connector.deployers.ds.processors.StructureDriverProcessor; import org.jboss.as.connector.deployers.ds.processors.StructureDriverProcessor;
import org.jboss.as.connector.deployers.ra.processors.IronJacamarDeploymentParsingProcessor; import org.jboss.as.connector.deployers.ra.processors.IronJacamarDeploymentParsingProcessor;
Expand All @@ -46,7 +42,6 @@
import org.jboss.as.server.deployment.Phase; import org.jboss.as.server.deployment.Phase;
import org.jboss.jca.core.spi.mdr.MetadataRepository; import org.jboss.jca.core.spi.mdr.MetadataRepository;
import org.jboss.jca.core.spi.transaction.TransactionIntegration; import org.jboss.jca.core.spi.transaction.TransactionIntegration;
import org.jboss.msc.service.ServiceController;
import org.jboss.msc.service.ServiceTarget; import org.jboss.msc.service.ServiceTarget;


/** /**
Expand All @@ -63,30 +58,27 @@ public RaDeploymentActivator(final boolean appclient) {
this.appclient = appclient; this.appclient = appclient;
} }


public Collection<ServiceController<?>> activateServices(final ServiceTarget serviceTarget) { public void activateServices(final ServiceTarget serviceTarget) {
final List<ServiceController<?>> controllers = new ArrayList<ServiceController<?>>();
// add resources here // add resources here


controllers.add(serviceTarget.addService(ConnectorServices.IRONJACAMAR_MDR, mdrService) serviceTarget.addService(ConnectorServices.IRONJACAMAR_MDR, mdrService)
.install()); .install();


RaRepositoryService raRepositoryService = new RaRepositoryService(); RaRepositoryService raRepositoryService = new RaRepositoryService();
controllers.add(serviceTarget.addService(ConnectorServices.RA_REPOSITORY_SERVICE, raRepositoryService) serviceTarget.addService(ConnectorServices.RA_REPOSITORY_SERVICE, raRepositoryService)
.addDependency(ConnectorServices.IRONJACAMAR_MDR, MetadataRepository.class, raRepositoryService.getMdrInjector()) .addDependency(ConnectorServices.IRONJACAMAR_MDR, MetadataRepository.class, raRepositoryService.getMdrInjector())
.addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class, .addDependency(ConnectorServices.TRANSACTION_INTEGRATION_SERVICE, TransactionIntegration.class,
raRepositoryService.getTransactionIntegrationInjector()) raRepositoryService.getTransactionIntegrationInjector())
.install()); .install();


ManagementRepositoryService managementRepositoryService = new ManagementRepositoryService(); ManagementRepositoryService managementRepositoryService = new ManagementRepositoryService();
controllers.add(serviceTarget.addService(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, managementRepositoryService) serviceTarget.addService(ConnectorServices.MANAGEMENT_REPOSITORY_SERVICE, managementRepositoryService)
.install()); .install();


ResourceAdapterDeploymentRegistryService registryService = new ResourceAdapterDeploymentRegistryService(); ResourceAdapterDeploymentRegistryService registryService = new ResourceAdapterDeploymentRegistryService();
controllers.add(serviceTarget.addService(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, registryService) serviceTarget.addService(ConnectorServices.RESOURCE_ADAPTER_REGISTRY_SERVICE, registryService)
.addDependency(ConnectorServices.IRONJACAMAR_MDR) .addDependency(ConnectorServices.IRONJACAMAR_MDR)
.install()); .install();

return controllers;
} }




Expand Down
Expand Up @@ -213,8 +213,7 @@ public static ServiceBuilder process(final ConnectorXmlDescriptor connectorXmlDe




// Create the service // Create the service
ServiceBuilder builder = return Services.addServerExecutorDependency(
Services.addServerExecutorDependency(
serviceTarget.addService(deployerServiceName, raDeploymentService), serviceTarget.addService(deployerServiceName, raDeploymentService),
raDeploymentService.getExecutorServiceInjector(), false) raDeploymentService.getExecutorServiceInjector(), false)
.addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, raDeploymentService.getMdrInjector()) .addDependency(ConnectorServices.IRONJACAMAR_MDR, AS7MetadataRepository.class, raDeploymentService.getMdrInjector())
Expand All @@ -228,8 +227,6 @@ public static ServiceBuilder process(final ConnectorXmlDescriptor connectorXmlDe
.addDependency(ConnectorServices.IDLE_REMOVER_SERVICE) .addDependency(ConnectorServices.IDLE_REMOVER_SERVICE)
.addDependency(ConnectorServices.CONNECTION_VALIDATOR_SERVICE) .addDependency(ConnectorServices.CONNECTION_VALIDATOR_SERVICE)
.addDependency(NamingService.SERVICE_NAME); .addDependency(NamingService.SERVICE_NAME);

return builder;
} catch (Throwable t) { } catch (Throwable t) {
throw new DeploymentUnitProcessingException(t); throw new DeploymentUnitProcessingException(t);
} }
Expand Down
Expand Up @@ -58,8 +58,5 @@ protected void execute(DeploymentProcessorTarget processorTarget) {
processorTarget.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEFAULT_BINDINGS_DATASOURCE, new DefaultDataSourceBindingProcessor()); processorTarget.addDeploymentProcessor(DataSourcesExtension.SUBSYSTEM_NAME, Phase.INSTALL, Phase.INSTALL_DEFAULT_BINDINGS_DATASOURCE, new DefaultDataSourceBindingProcessor());
} }
}, OperationContext.Stage.RUNTIME); }, OperationContext.Stage.RUNTIME);


dsDeploymentActivator.activateServices(context.getServiceTarget());
} }
} }

0 comments on commit 947c94c

Please sign in to comment.