private void installJNDIAliases(final ContextNames.BindInfo bindInfo, final ServiceTarget serviceTarget) { for (String alias : getJndiAliases()) { final ContextNames.BindInfo aliasBindInfo = ContextNames.bindInfoFor(alias); final BinderService aliasBinderService = new BinderService(alias); aliasBinderService.getManagedObjectInjector().inject(new AliasManagedReferenceFactory(bindInfo.getAbsoluteJndiName())); final ServiceBuilder sb = serviceTarget.addService(aliasBindInfo.getBinderServiceName(), aliasBinderService); sb.addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, aliasBinderService.getNamingStoreInjector()); sb.requires(bindInfo.getBinderServiceName()); sb.addListener(new LifecycleListener() { @Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { switch (event) { case UP: { DEPLOYMENT_CONNECTOR_LOGGER.bindingAlias(bindInfo.getAbsoluteJndiName(), alias); break; } case DOWN: { DEPLOYMENT_CONNECTOR_LOGGER.unbindingAlias(bindInfo.getAbsoluteJndiName(), alias); break; } case REMOVED: { DEPLOYMENT_CONNECTOR_LOGGER.debugf("Removed messaging object [%s]", alias); break; } } } }); sb.install(); } }
public synchronized void start(StartContext startContext) throws StartException { try { final ServiceContainer container = startContext.getController().getServiceContainer(); deploymentMD = getDeployer().deploy(container); if (deploymentMD.getCfs().length != 1) { throw ConnectorLogger.ROOT_LOGGER.cannotStartDs(); } sqlDataSource = new WildFlyDataSource((javax.sql.DataSource) deploymentMD.getCfs()[0], jndiName.getAbsoluteJndiName()); DS_DEPLOYER_LOGGER.debugf("Adding datasource: %s", deploymentMD.getCfJndiNames()[0]); CommonDeploymentService cdService = new CommonDeploymentService(deploymentMD); final ServiceName cdServiceName = CommonDeploymentService.getServiceName(jndiName); final ServiceBuilder cdServiceSB = startContext.getChildTarget().addService(cdServiceName, cdService); // The dependency added must be the JNDI name which for subsystem resources is an alias. This service // is also used in deployments where the capability service name is not registered for the service. cdServiceSB.requires(getServiceName(jndiName)); cdServiceSB.setInitialMode(ServiceController.Mode.ACTIVE).install(); } catch (Throwable t) { throw ConnectorLogger.ROOT_LOGGER.deploymentError(t, dsName); } }
@Override public synchronized void stop(StopContext context) { LOGGER.debug("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
private void publishPartitionManager(StartContext context) { BindInfo bindInfo = createPartitionManagerBindInfo(); ServiceName serviceName = bindInfo.getBinderServiceName(); final BinderService binderService = new BinderService(serviceName.getCanonicalName()); final ServiceBuilder<ManagedReferenceFactory> builder = context.getChildTarget() .addService(serviceName, binderService) .addAliases(ContextNames.JAVA_CONTEXT_SERVICE_NAME.append(this.jndiName)); builder.addDependency(ContextNames.JAVA_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()); builder.addDependency(createServiceName(this.alias), PartitionManager.class, new Injector<PartitionManager>() { @Override public void inject(final PartitionManager value) throws InjectionException { binderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value))); } @Override public void uninject() { binderService.getManagedObjectInjector().uninject(); } }); builder.setInitialMode(Mode.PASSIVE).install(); ROOT_LOGGER.boundToJndi("PartitionManager " + this.alias, bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void stop(StopContext context) { LOGGER.debug("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public synchronized void stop(StopContext context) { LOGGER.info("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public synchronized void stop(StopContext context) { LOGGER.info("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public synchronized void stop(StopContext context) { LOGGER.debug("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void stop(StopContext context) { LOGGER.debug("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void stop(StopContext context) { LOGGER.debug("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public synchronized void start(StartContext context) throws StartException { super.start(context); LOGGER.info("Bound camel naming object: {}", bindInfo.getAbsoluteJndiName()); }
@Override public synchronized void stop(StopContext context) { LOGGER.debug("Unbind camel naming object: {}", bindInfo.getAbsoluteJndiName()); super.stop(context); } };
@Override public void handleEvent(ServiceController<?> controller, LifecycleEvent event) { switch (event) { case UP: { DEPLOYMENT_CONNECTOR_LOGGER.bindingAlias(bindInfo.getAbsoluteJndiName(), alias); break; } case DOWN: { DEPLOYMENT_CONNECTOR_LOGGER.unbindingAlias(bindInfo.getAbsoluteJndiName(), alias); break; } case REMOVED: { DEPLOYMENT_CONNECTOR_LOGGER.debugf("Removed messaging object [%s]", alias); break; } } } });