private List<ServiceName> getJNDISubsytemDependencies(boolean tx) { List<ServiceName> dependencies = new ArrayList<>(); if (tx) { dependencies.add(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append(ServiceName.of("UserTransaction"))); dependencies.add(ContextNames.JBOSS_CONTEXT_SERVICE_NAME.append(ServiceName.of("TransactionSynchronizationRegistry"))); } dependencies.add(NamingService.SERVICE_NAME); dependencies.add(DefaultNamespaceContextSelectorService.SERVICE_NAME); return dependencies; }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode recoveryEnvModel) throws OperationFailedException { final String configPropertyValue = CONFIG_PROPERTY_VALUE.resolveModelAttribute(context, recoveryEnvModel).asString(); final ModelNode address = operation.require(OP_ADDR); PathAddress path = PathAddress.pathAddress(address); final String archiveName = path.getElement(path.size() -2).getValue(); final String configPropertyName = PathAddress.pathAddress(address).getLastElement().getValue(); ServiceName serviceName = ServiceName.of(ConnectorServices.RA_SERVICE, archiveName, configPropertyName); ServiceName raServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, archiveName); final ServiceTarget serviceTarget = context.getServiceTarget(); final ConfigPropertiesService service = new ConfigPropertiesService(configPropertyName, configPropertyValue); serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE) .addDependency(raServiceName, ModifiableResourceAdapter.class, service.getRaInjector() ) .install(); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode recoveryEnvModel) throws OperationFailedException { final String configPropertyValue = CONFIG_PROPERTY_VALUE.resolveModelAttribute(context, recoveryEnvModel).asString(); final ModelNode address = operation.require(OP_ADDR); PathAddress path = PathAddress.pathAddress(address); final String archiveName = path.getElement(path.size() -3).getValue(); final String aoName = path.getElement(path.size() -2).getValue(); final String configPropertyName = PathAddress.pathAddress(address).getLastElement().getValue(); ServiceName serviceName = ServiceName.of(ConnectorServices.RA_SERVICE, archiveName, aoName, configPropertyName); ServiceName aoServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, archiveName, aoName); final ServiceTarget serviceTarget = context.getServiceTarget(); final AOConfigPropertiesService service = new AOConfigPropertiesService(configPropertyName, configPropertyValue); serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE) .addDependency(aoServiceName, ModifiableAdminObject.class, service.getAOInjector() ) .install(); } }
@Override protected void performRuntime(OperationContext context, ModelNode operation, ModelNode recoveryEnvModel) throws OperationFailedException { final String configPropertyValue = CONFIG_PROPERTY_VALUE.resolveModelAttribute(context, recoveryEnvModel).asString(); final ModelNode address = operation.require(OP_ADDR); PathAddress path = PathAddress.pathAddress(address); final String archiveName = path.getElement(path.size() -3).getValue(); final String cfName = path.getElement(path.size() -2).getValue(); final String configPropertyName = PathAddress.pathAddress(address).getLastElement().getValue(); ServiceName serviceName = ServiceName.of(ConnectorServices.RA_SERVICE, archiveName, cfName, configPropertyName); ServiceName cfServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, archiveName, cfName); final ServiceTarget serviceTarget = context.getServiceTarget(); final CDConfigPropertiesService service = new CDConfigPropertiesService(configPropertyName, configPropertyValue); serviceTarget.addService(serviceName, service).setInitialMode(ServiceController.Mode.ACTIVE) .addDependency(cfServiceName, ModifiableConnDef.class, service.getRaInjector() ) .install(); } }
@Override public void stop(StopContext context) { resourceAdapters.getValue().removeActivation(value); resourceAdaptersMap.getValue().remove(value.getArchive(), ServiceName.of(ConnectorServices.RA_SERVICE, name)); SUBSYSTEM_RA_LOGGER.debugf("Stopping ResourceAdapter Service"); }
@Override public void start(StartContext context) throws StartException { resourceAdapters.getValue().addActivation(value); resourceAdaptersMap.getValue().putIfAbsent(value.getArchive(), ServiceName.of(ConnectorServices.RA_SERVICE, name)); SUBSYSTEM_RA_LOGGER.debugf("Starting ResourceAdapter Service"); }
@Override public void handleEvent(ServiceController controller, LifecycleEvent event) { latch.awaitUninterruptibly(); if (event == LifecycleEvent.DOWN) { try { final ServiceController<?> RaxmlController = registry.getService(ServiceName.of(ConnectorServices.RA_SERVICE, id)); Activation raxml = (Activation) RaxmlController.getValue(); ((ResourceAdapterXmlDeploymentService) controller.getService()).setRaxml(raxml); controller.compareAndSetMode(ServiceController.Mode.NEVER, originalMode); } finally { controller.removeListener(this); } } } });
public static void activate(OperationContext context, String raName, String archiveName) throws OperationFailedException { ServiceRegistry registry = context.getServiceRegistry(true); ServiceController<?> inactiveRaController = registry.getService(ConnectorServices.INACTIVE_RESOURCE_ADAPTER_SERVICE.append(archiveName)); if (inactiveRaController == null) { inactiveRaController = registry.getService(ConnectorServices.INACTIVE_RESOURCE_ADAPTER_SERVICE.append(raName)); if (inactiveRaController == null) { throw ConnectorLogger.ROOT_LOGGER.RARNotYetDeployed(raName); } } InactiveResourceAdapterDeploymentService.InactiveResourceAdapterDeployment inactive = (InactiveResourceAdapterDeploymentService.InactiveResourceAdapterDeployment) inactiveRaController.getValue(); final ServiceController<?> RaxmlController = registry.getService(ServiceName.of(ConnectorServices.RA_SERVICE, raName)); Activation raxml = (Activation) RaxmlController.getValue(); RaServicesFactory.createDeploymentService(inactive.getRegistration(), inactive.getConnectorXmlDescriptor(), inactive.getModule(), inactive.getServiceTarget(), archiveName, inactive.getDeploymentUnitServiceName(), inactive.getDeployment(), raxml, inactive.getResource(), registry); }
ServiceName serviceName = ServiceName.of(ConnectorServices.RA_SERVICE, raName, poolName); ServiceName raServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, raName); final ServiceController<?> RaxmlController = registry.getService(ServiceName.of(ConnectorServices.RA_SERVICE, raName)); Activation raxml = (Activation) RaxmlController.getValue(); ServiceName deploymentServiceName = ConnectorServices.getDeploymentServiceName(archiveOrModuleName, raName);
raName = raxml.getId(); ServiceName parentName = ServiceName.of(ConnectorServices.RA_SERVICE, raName); for(ServiceName subServiceName: serviceRegistry.getServiceNames()) { if (parentName.isParentOf(subServiceName)
ServiceName raServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, idName); ServiceController<?> serviceController = context.getServiceRegistry(false).getService(raServiceName); final ModifiableResourceAdapter resourceAdapter;
ServiceName raServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, name); final ServiceController<?> service = context.getServiceRegistry(true).getService(raServiceName); if (service == null) {
ServiceName serviceName = ServiceName.of(ConnectorServices.RA_SERVICE, raName, poolName); ServiceName raServiceName = ServiceName.of(ConnectorServices.RA_SERVICE, raName); final ServiceController<?> RaxmlController = registry.getService(ServiceName.of(ConnectorServices.RA_SERVICE, raName)); Activation raxml = (Activation) RaxmlController.getValue(); ServiceName deploymentServiceName = ConnectorServices.getDeploymentServiceName(archiveOrModuleName, raName);
final ServiceController<?> RaxmlController = registry.getService(ServiceName.of(ConnectorServices.RA_SERVICE, name)); Activation raxml = (Activation) RaxmlController.getValue(); ServiceName serviceName = ConnectorServices.getDeploymentServiceName(archiveOrModuleName, name); ServiceBuilder statsServiceBuilder = context.getServiceTarget().addService(ServiceName.of(ConnectorServices.RA_SERVICE, name).append(ConnectorServices.STATISTICS_SUFFIX), raStatsService); statsServiceBuilder.addDependency(ConnectorServices.BOOTSTRAP_CONTEXT_SERVICE.append(bootStrapCtxName), Object.class, raStatsService.getBootstrapContextInjector()) .addDependency(serviceName, Object.class, raStatsService.getResourceAdapterDeploymentInjector())
/** * Create a service name by appending name parts using this as a parent to the new ServiceName. * * @param parts The parts to append * @return A new ServiceName */ public ServiceName append(final String... parts) { return of(this, parts); }
/** * Create a ServiceName from a series of String parts. * * @param parts The string representations of the service name segments * @return A ServiceName instance */ public static ServiceName of(final String... parts) { return of(null, parts); }
private void addCacheDependency(DeploymentPhaseContext context, DeploymentUnit deploymentUnit, String cacheContainer, String cacheName) { ServiceName jbossAsCacheContainerService = ServiceName.of("jboss", "infinispan", cacheContainer); ServiceTarget st = context.getServiceTarget(); st.addDependency(jbossAsCacheContainerService.append(cacheName)); }
@Override public void activate(ServiceActivatorContext serviceActivatorContext) throws ServiceRegistryException { DaemonService runner = new DaemonService(); serviceActivatorContext.getServiceTarget() .addService(ServiceName.of("wildfly", "swarm", "arquillian", "daemon", "runner"), runner) .addDependency(ServiceName.JBOSS.append("as", "service-module-loader"), ModuleLoader.class, runner.getServiceLoader()) .setInitialMode(ServiceController.Mode.ACTIVE) .install(); }
@Override public void activate(ServiceActivatorContext context) throws ServiceRegistryException { SwarmMessages.MESSAGES.argsInstalled(Arrays.asList(this.args)); context.getServiceTarget().addService(ServiceName.of("wildfly", "swarm", "main-args"), new ValueService<>(new ImmediateValue<>(this.args))) .install(); } }
@Override public void activate(ServiceActivatorContext context) throws ServiceRegistryException { context.getServiceTarget().addService(ServiceName.of("wildfly", "swarm", "temp-provider"), new ValueService<>(new ImmediateValue<Object>(tempFileProvider))) .install(); // Provide the main command line args as a value service context.getServiceTarget().addService(ServiceName.of("wildfly", "swarm", "main-args"), new ValueService<>(new ImmediateValue<Object>(config.getArgs()))) .install(); } });