public SimpleBuilder(ServiceName name, T value) { this(name, new ImmediateValue<>(value)); }
@Override public ManagedReference getReference() { try { final Object value = new InitialContext().lookup(name); return new ValueManagedReference(new ImmediateValue<Object>(value)); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public ManagedReference getReference() { return new ValueManagedReference(new ImmediateValue<Object>(service.getValue())); } }
@Override public ManagedReference getReference() { BeanManager bm = beanManager.getOptionalValue(); if (bm == null) { return null; } return new ValueManagedReference(new ImmediateValue<Object>(bm)); }
@Override public void inject(T value) throws InjectionException { injectable.inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value))); }
public synchronized void start(StartContext startContext) throws StartException { reference = new ValueManagedReference(new ImmediateValue<Object>(connectionFactoryValue.getValue())); }
public synchronized void start(StartContext startContext) throws StartException { reference = new ValueManagedReference(new ImmediateValue<Object>(dataSourceValue.getValue())); }
public synchronized void start(StartContext startContext) throws StartException { reference = new ValueManagedReference(new ImmediateValue<Object>(adminObjectValue.getValue())); }
@Override public void inject(final javax.transaction.TransactionManager value) throws InjectionException { tmBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value))); }
@Override public void inject(final TransactionSynchronizationRegistry value) throws InjectionException { tsrBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value))); }
@Override public void inject(final javax.transaction.TransactionManager value) throws InjectionException { tmLegacyBinderService.getManagedObjectInjector().inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(value))); }
/** * {@inheritDoc} * * This method returns a Context proxy that is only able to handle a lookup operation for an atomic name of a security * domain. */ public ManagedReference getReference() { final ClassLoader loader; try { loader = SecurityActions.getModuleClassLoader(); } catch (ModuleLoadException e) { throw SecurityLogger.ROOT_LOGGER.unableToGetModuleClassLoader(e); } Class<?>[] interfaces = { Context.class }; return new ValueManagedReference(new ImmediateValue<Object>(Proxy.newProxyInstance(loader, interfaces, this))); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) { Object value = EJBClient.createProxy(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL)); return new ValueManagedReference(new ImmediateValue<>(value)); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) { Object value = EJBClient.createProxy(new EJBHomeLocator(componentView.getViewClass(), applicationName, moduleName, beanName, distinctName, Affinity.LOCAL)); return new ValueManagedReference(new ImmediateValue(value)); }
void updateOrCreateDefaultExceptionLoggingEnabledService(final OperationContext context, final ModelNode model) throws OperationFailedException { final boolean enabled = EJB3SubsystemRootResourceDefinition.LOG_EJB_EXCEPTIONS.resolveModelAttribute(context, model).asBoolean(); final ServiceName serviceName = LoggingInterceptor.LOGGING_ENABLED_SERVICE_NAME; final ServiceRegistry registry = context.getServiceRegistry(true); final ServiceController sc = registry.getService(serviceName); if (sc != null) { final AtomicBoolean value = (AtomicBoolean) sc.getValue(); value.set(enabled); } else { // create and install the service final ValueService<AtomicBoolean> service = new ValueService<>(new ImmediateValue<>(new AtomicBoolean(enabled))); context.getServiceTarget().addService(serviceName, service) .install(); } } }
/** * * @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(); } @Override
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(); }
void updateOptimisticLocking(final OperationContext context, final ModelNode model) throws OperationFailedException { final ModelNode enabled = EJB3SubsystemRootResourceDefinition.DEFAULT_ENTITY_BEAN_OPTIMISTIC_LOCKING.resolveModelAttribute(context, model); final ServiceRegistry serviceRegistry = context.getServiceRegistry(true); ServiceController<?> existingService = serviceRegistry.getService(SERVICE_NAME); // if a default optimistic locking config is installed, remove it if (existingService != null) { context.removeService(existingService); } if (enabled.isDefined()) { final Service<Boolean> newDefaultPoolConfigService = new ValueService<Boolean>(new ImmediateValue<Boolean>(enabled.asBoolean())); ServiceController<?> newController = context.getServiceTarget().addService(SERVICE_NAME, newDefaultPoolConfigService) .install(); } } }
/** * 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(); }
@Override public void getResourceValue(final ResolutionContext resolutionContext, final ServiceBuilder<?> serviceBuilder, final DeploymentPhaseContext phaseContext, final Injector<ManagedReferenceFactory> injector) throws DeploymentUnitProcessingException { final ClassLoader classLoader = phaseContext.getDeploymentUnit().getAttachment(Attachments.MODULE).getClassLoader(); injector.inject(new ValueManagedReferenceFactory(new ImmediateValue<Object>(new LazyValidatorFactory(classLoader)))); } }