use of org.jboss.as.naming.deployment.ContextNames.BindInfo in project wildfly by wildfly.
the class PartitionManagerService method publishPartitionManager.
private void publishPartitionManager(StartContext context) {
BindInfo bindInfo = createPartitionManagerBindInfo();
ServiceName serviceName = bindInfo.getBinderServiceName();
final BinderService binderService = new BinderService(serviceName.getCanonicalName());
final ServiceBuilder<ManagedReferenceFactory> builder = context.getController().getServiceContainer().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());
}
use of org.jboss.as.naming.deployment.ContextNames.BindInfo in project wildfly by wildfly.
the class BinderServiceUtil method installBinderService.
/**
* Install a binder service to bind the {@code obj} using the binding {@code name}.
* @param serviceTarget
* @param name the binding name
* @param obj the object that must be bound
*/
public static void installBinderService(final ServiceTarget serviceTarget, final String name, final Object obj) {
final BindInfo bindInfo = ContextNames.bindInfoFor(name);
final BinderService binderService = new BinderService(bindInfo.getBindName());
serviceTarget.addService(bindInfo.getBinderServiceName(), binderService).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addInjection(binderService.getManagedObjectInjector(), new ValueManagedReferenceFactory(Values.immediateValue(obj))).setInitialMode(ServiceController.Mode.ACTIVE).install();
}
use of org.jboss.as.naming.deployment.ContextNames.BindInfo in project wildfly by wildfly.
the class BinderServiceUtil method installAliasBinderService.
public static void installAliasBinderService(final ServiceTarget serviceTarget, final BindInfo bindInfo, final String alias) {
final BindInfo aliasBindInfo = ContextNames.bindInfoFor(alias);
final BinderService aliasBinderService = new BinderService(alias);
aliasBinderService.getManagedObjectInjector().inject(new AliasManagedReferenceFactory(bindInfo.getAbsoluteJndiName()));
serviceTarget.addService(aliasBindInfo.getBinderServiceName(), aliasBinderService).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, aliasBinderService.getNamingStoreInjector()).addDependency(bindInfo.getBinderServiceName()).addListener(new AbstractServiceListener<ManagedReferenceFactory>() {
@Override
public void transition(ServiceController<? extends ManagedReferenceFactory> controller, ServiceController.Transition transition) {
switch(transition) {
case STARTING_to_UP:
{
ROOT_LOGGER.boundJndiName(alias);
break;
}
case STOPPING_to_DOWN:
{
ROOT_LOGGER.unboundJndiName(alias);
break;
}
case REMOVING_to_REMOVED:
{
ROOT_LOGGER.debugf("Removed messaging object [%s]", alias);
break;
}
}
}
}).install();
}
use of org.jboss.as.naming.deployment.ContextNames.BindInfo in project wildfly by wildfly.
the class BinderServiceUtil method installBinderService.
/**
* Install a binder service to bind the value of the {@code service} using the binding {@code name}.
* @param serviceTarget
* @param name the binding name
* @param service the service whose value must be bound
*/
public static void installBinderService(final ServiceTarget serviceTarget, final String name, final Service<?> service, final ServiceName... dependencies) {
final BindInfo bindInfo = ContextNames.bindInfoFor(name);
final BinderService binderService = new BinderService(bindInfo.getBindName());
final ServiceBuilder serviceBuilder = serviceTarget.addService(bindInfo.getBinderServiceName(), binderService).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addInjection(binderService.getManagedObjectInjector(), new ValueManagedReferenceFactory(service)).setInitialMode(ServiceController.Mode.PASSIVE);
if (dependencies != null && dependencies.length > 0) {
serviceBuilder.addDependencies(dependencies);
}
serviceBuilder.install();
}
Aggregations