Search in sources :

Example 1 with ValueManagedReferenceFactory

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();
}
Also used : ExternalContextBinderService(org.jboss.as.naming.service.ExternalContextBinderService) BinderService(org.jboss.as.naming.service.BinderService) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ContextListAndJndiViewManagedReferenceFactory(org.jboss.as.naming.ContextListAndJndiViewManagedReferenceFactory) ContextListManagedReferenceFactory(org.jboss.as.naming.ContextListManagedReferenceFactory) ManagedReferenceFactory(org.jboss.as.naming.ManagedReferenceFactory) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ServiceTarget(org.jboss.msc.service.ServiceTarget) ContextNames(org.jboss.as.naming.deployment.ContextNames)

Example 2 with ValueManagedReferenceFactory

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());
}
Also used : BinderService(org.jboss.as.naming.service.BinderService) InjectionException(org.jboss.msc.inject.InjectionException) DefaultPartitionManager(org.picketlink.idm.internal.DefaultPartitionManager) PartitionManager(org.picketlink.idm.PartitionManager) ServiceName(org.jboss.msc.service.ServiceName) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ManagedReferenceFactory(org.jboss.as.naming.ManagedReferenceFactory) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) BindInfo(org.jboss.as.naming.deployment.ContextNames.BindInfo)

Example 3 with ValueManagedReferenceFactory

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();
}
Also used : BinderService(org.jboss.as.naming.service.BinderService) ServiceBasedNamingStore(org.jboss.as.naming.ServiceBasedNamingStore) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) BindInfo(org.jboss.as.naming.deployment.ContextNames.BindInfo)

Example 4 with ValueManagedReferenceFactory

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);
}
Also used : BinderService(org.jboss.as.naming.service.BinderService) ServiceName(org.jboss.msc.service.ServiceName) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ServiceBasedNamingStore(org.jboss.as.naming.ServiceBasedNamingStore)

Example 5 with ValueManagedReferenceFactory

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();
}
Also used : BinderService(org.jboss.as.naming.service.BinderService) HandleDelegateImpl(org.jboss.as.ejb3.iiop.handle.HandleDelegateImpl) ServiceName(org.jboss.msc.service.ServiceName) ServiceBasedNamingStore(org.jboss.as.naming.ServiceBasedNamingStore) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ORB(org.omg.CORBA.ORB) ImmediateValue(org.jboss.msc.value.ImmediateValue)

Aggregations

ValueManagedReferenceFactory (org.jboss.as.naming.ValueManagedReferenceFactory)15 BinderService (org.jboss.as.naming.service.BinderService)13 ServiceName (org.jboss.msc.service.ServiceName)7 ServiceBasedNamingStore (org.jboss.as.naming.ServiceBasedNamingStore)6 ImmediateValue (org.jboss.msc.value.ImmediateValue)5 ManagedReferenceFactory (org.jboss.as.naming.ManagedReferenceFactory)4 ContextNames (org.jboss.as.naming.deployment.ContextNames)3 BindInfo (org.jboss.as.naming.deployment.ContextNames.BindInfo)3 ServiceTarget (org.jboss.msc.service.ServiceTarget)3 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)2 PersistenceUnitServiceImpl (org.jboss.as.jpa.service.PersistenceUnitServiceImpl)2 PhaseOnePersistenceUnitServiceImpl (org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl)2 ContextListAndJndiViewManagedReferenceFactory (org.jboss.as.naming.ContextListAndJndiViewManagedReferenceFactory)2 ContextListManagedReferenceFactory (org.jboss.as.naming.ContextListManagedReferenceFactory)2 NamingStoreService (org.jboss.as.naming.service.NamingStoreService)2 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)2 CastingInjector (org.jboss.msc.inject.CastingInjector)2 InjectionException (org.jboss.msc.inject.InjectionException)2 Injector (org.jboss.msc.inject.Injector)2 HashSet (java.util.HashSet)1