use of org.jboss.as.naming.ValueManagedReferenceFactory in project wildfly by wildfly.
the class NamingBindingAdd method installSimpleBinding.
void installSimpleBinding(final OperationContext context, final String name, final ModelNode model) throws OperationFailedException {
Object bindValue = createSimpleBinding(context, model);
ValueManagedReferenceFactory referenceFactory = new ValueManagedReferenceFactory(new ImmediateValue<Object>(bindValue));
final BinderService binderService = new BinderService(name, bindValue);
binderService.getManagedObjectInjector().inject(new MutableManagedReferenceFactory(referenceFactory));
final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(name);
final ServiceTarget serviceTarget = context.getServiceTarget();
ServiceBuilder<ManagedReferenceFactory> builder = serviceTarget.addService(bindInfo.getBinderServiceName(), binderService).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector());
builder.install();
}
use of org.jboss.as.naming.ValueManagedReferenceFactory 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.ValueManagedReferenceFactory 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.ValueManagedReferenceFactory in project wildfly by wildfly.
the class InApplicationClientBindingProcessor method bindServices.
private void bindServices(DeploymentUnit deploymentUnit, ServiceTarget serviceTarget, ServiceName contextServiceName) {
final ServiceName inAppClientServiceName = contextServiceName.append("InAppClientContainer");
BinderService inAppClientContainerService = new BinderService("InAppClientContainer");
serviceTarget.addService(inAppClientServiceName, inAppClientContainerService).addInjection(inAppClientContainerService.getManagedObjectInjector(), new ValueManagedReferenceFactory(Values.immediateValue(appclient))).addDependency(contextServiceName, ServiceBasedNamingStore.class, inAppClientContainerService.getNamingStoreInjector()).install();
deploymentUnit.addToAttachmentList(org.jboss.as.server.deployment.Attachments.JNDI_DEPENDENCIES, inAppClientServiceName);
}
use of org.jboss.as.naming.ValueManagedReferenceFactory in project wildfly by wildfly.
the class IIOPJndiBindingProcessor method bindService.
/**
* Binds java:comp/ORB
*
* @param serviceTarget The service target
* @param contextServiceName The service name of the context to bind to
*/
private void bindService(final ServiceTarget serviceTarget, final ServiceName contextServiceName, final Module module) {
final ServiceName orbServiceName = contextServiceName.append("ORB");
final BinderService orbService = new BinderService("ORB");
serviceTarget.addService(orbServiceName, orbService).addDependency(CorbaORBService.SERVICE_NAME, ORB.class, new ManagedReferenceInjector<ORB>(orbService.getManagedObjectInjector())).addDependency(contextServiceName, ServiceBasedNamingStore.class, orbService.getNamingStoreInjector()).install();
final ServiceName handleDelegateServiceName = contextServiceName.append("HandleDelegate");
final BinderService handleDelegateBindingService = new BinderService("HandleDelegate");
handleDelegateBindingService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue(new HandleDelegateImpl(module.getClassLoader()))));
serviceTarget.addService(handleDelegateServiceName, handleDelegateBindingService).addDependency(contextServiceName, ServiceBasedNamingStore.class, handleDelegateBindingService.getNamingStoreInjector()).install();
}
Aggregations