Search in sources :

Example 11 with BinderService

use of org.jboss.as.naming.service.BinderService in project wildfly by wildfly.

the class EEConcurrentAbstractService method bindValueToJndi.

private void bindValueToJndi(final StartContext context) {
    final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(jndiName);
    final BinderService binderService = new BinderService(bindInfo.getBindName());
    final ImmediateManagedReferenceFactory managedReferenceFactory = new ImmediateManagedReferenceFactory(getValue());
    context.getChildTarget().addService(bindInfo.getBinderServiceName(), binderService).addInjectionValue(binderService.getManagedObjectInjector(), new ImmediateValue<ManagedReferenceFactory>(managedReferenceFactory)).addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).install();
}
Also used : BinderService(org.jboss.as.naming.service.BinderService) ServiceBasedNamingStore(org.jboss.as.naming.ServiceBasedNamingStore) ImmediateManagedReferenceFactory(org.jboss.as.naming.ImmediateManagedReferenceFactory) ManagedReferenceFactory(org.jboss.as.naming.ManagedReferenceFactory) ContextNames(org.jboss.as.naming.deployment.ContextNames) ImmediateManagedReferenceFactory(org.jboss.as.naming.ImmediateManagedReferenceFactory)

Example 12 with BinderService

use of org.jboss.as.naming.service.BinderService 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 13 with BinderService

use of org.jboss.as.naming.service.BinderService 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)

Example 14 with BinderService

use of org.jboss.as.naming.service.BinderService in project wildfly by wildfly.

the class BeanValidationFactoryDeployer method bindServices.

/**
     *
     * @param factory The ValidatorFactory to bind
     * @param serviceTarget The service target
     * @param contextServiceName The service name of the context to bind to
     */
private void bindServices(LazyValidatorFactory factory, ServiceTarget serviceTarget, EEModuleDescription description, String componentName, ServiceName contextServiceName) {
    BinderService validatorFactoryBindingService = new BinderService("ValidatorFactory");
    validatorFactoryBindingService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(factory)));
    serviceTarget.addService(contextServiceName.append("ValidatorFactory"), validatorFactoryBindingService).addDependency(contextServiceName, ServiceBasedNamingStore.class, validatorFactoryBindingService.getNamingStoreInjector()).install();
    BinderService validatorBindingService = new BinderService("Validator");
    validatorBindingService.getManagedObjectInjector().inject(new ValidatorJndiInjectable(factory));
    serviceTarget.addService(contextServiceName.append("Validator"), validatorBindingService).addDependency(contextServiceName, ServiceBasedNamingStore.class, validatorBindingService.getNamingStoreInjector()).install();
}
Also used : BinderService(org.jboss.as.naming.service.BinderService) ValueManagedReferenceFactory(org.jboss.as.naming.ValueManagedReferenceFactory) ServiceBasedNamingStore(org.jboss.as.naming.ServiceBasedNamingStore) ImmediateValue(org.jboss.msc.value.ImmediateValue)

Example 15 with BinderService

use of org.jboss.as.naming.service.BinderService in project wildfly by wildfly.

the class CorbaServiceUtil method bindObject.

/**
     * <p>
     * Adds a {@code BinderService} to the specified target. The service binds the specified value to JNDI under the
     * {@code java:/jboss/contextName} context.
     * </p>
     *
     * @param target      the {@code ServiceTarget} where the service will be added.
     * @param contextName the JNDI context name where the value will be bound.
     * @param value       the value to be bound.
     */
public static void bindObject(final ServiceTarget target, final String contextName, final Object value) {
    final BinderService binderService = new BinderService(contextName);
    target.addService(ContextNames.buildServiceName(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, contextName), binderService).addDependency(ContextNames.JBOSS_CONTEXT_SERVICE_NAME, ServiceBasedNamingStore.class, binderService.getNamingStoreInjector()).addInjection(binderService.getManagedObjectInjector(), new ValueManagedReferenceFactory(Values.immediateValue(value))).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)

Aggregations

BinderService (org.jboss.as.naming.service.BinderService)33 ServiceName (org.jboss.msc.service.ServiceName)18 ServiceBasedNamingStore (org.jboss.as.naming.ServiceBasedNamingStore)17 ValueManagedReferenceFactory (org.jboss.as.naming.ValueManagedReferenceFactory)14 ContextNames (org.jboss.as.naming.deployment.ContextNames)14 ManagedReferenceFactory (org.jboss.as.naming.ManagedReferenceFactory)12 ServiceTarget (org.jboss.msc.service.ServiceTarget)10 ServiceController (org.jboss.msc.service.ServiceController)9 ImmediateValue (org.jboss.msc.value.ImmediateValue)6 OperationFailedException (org.jboss.as.controller.OperationFailedException)3 BindInfo (org.jboss.as.naming.deployment.ContextNames.BindInfo)3 NamingStoreService (org.jboss.as.naming.service.NamingStoreService)3 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)3 ModelNode (org.jboss.dmr.ModelNode)3 Injector (org.jboss.msc.inject.Injector)3 HashSet (java.util.HashSet)2 TransactionSynchronizationRegistry (javax.transaction.TransactionSynchronizationRegistry)2 UserTransaction (javax.transaction.UserTransaction)2 DriverRegistry (org.jboss.as.connector.services.driver.registry.DriverRegistry)2 DataSourceReferenceFactoryService (org.jboss.as.connector.subsystems.datasources.DataSourceReferenceFactoryService)2