@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); } }
private InterceptorFactory createInterceptorFactoryForContainerInterceptor(final Method method, final Constructor interceptorConstructor) { // The managed reference is going to be ConstructedValue, using the container-interceptor's constructor final ConstructedValue interceptorInstanceValue = new ConstructedValue(interceptorConstructor, Collections.<Value<?>>emptyList()); // we *don't* create multiple instances of the container-interceptor class, but we just reuse a single instance and it's *not* // tied to the EJB component instance lifecycle. final CachedValue cachedInterceptorInstanceValue = new CachedValue(interceptorInstanceValue); // ultimately create the managed reference which is backed by the CachedValue final ManagedReference interceptorInstanceRef = new ValueManagedReference(cachedInterceptorInstanceValue); // return the ContainerInterceptorMethodInterceptorFactory which is responsible for creating an Interceptor // which can invoke the container-interceptor's around-invoke/around-timeout methods return new ContainerInterceptorMethodInterceptorFactory(interceptorInstanceRef, method); } }
@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)); }
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())); }
/** * {@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)); }
@Override public ManagedReference createViewInstance(final ComponentView componentView, final Map<Object, Object> contextData) throws Exception { SessionID sessionID = (SessionID) contextData.get(SessionID.class); final StatefulEJBLocator<?> statefulEJBLocator; final StatefulSessionComponent statefulSessionComponent = (StatefulSessionComponent) componentView.getComponent(); if (sessionID == null) { statefulEJBLocator = EJBClient.createSession(StatelessEJBLocator.create(componentView.getViewClass(), identifier, Affinity.LOCAL)); } else { statefulEJBLocator = StatefulEJBLocator.create(componentView.getViewClass(), identifier, sessionID, statefulSessionComponent.getCache().getStrictAffinity()); } final Object ejbProxy = EJBClient.createProxy(statefulEJBLocator); return new ValueManagedReference(new ImmediateValue<Object>(ejbProxy)); }
return new ValueManagedReference(new ImmediateValue<>(proxy));
@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() { try { final Object value = new InitialContext().lookup(lookup); return new ValueManagedReference(new ImmediateValue<Object>(value)); } catch (Exception e) { throw new RuntimeException(e); } }
@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() { try { Object value = new InitialContext().lookup(lookupName); return new ValueManagedReference(new ImmediateValue<Object>(value)); } catch (NamingException e) { return null; } }
@Override public ManagedReference getReference() { try { return new ValueManagedReference(new ImmediateValue(new URL(resourceRef.getResUrl()))); } catch (MalformedURLException e) { throw new RuntimeException(e); } } }, new URL(resourceRef.getResUrl())));
@Override public ManagedReference getReference() { try { return new ValueManagedReference(new ImmediateValue(new URI(resourceRef.getResUrl()))); } catch (URISyntaxException e) { throw new RuntimeException(e); } } }, new URI(resourceRef.getResUrl())));
@Override public ManagedReference getReference() { return new ValueManagedReference(new ImmediateValue<Object>(factory.getValidator())); }
private InterceptorFactory createInterceptorFactoryForContainerInterceptor(final Method method, final Constructor interceptorConstructor) { // The managed reference is going to be ConstructedValue, using the container-interceptor's constructor final ConstructedValue interceptorInstanceValue = new ConstructedValue(interceptorConstructor, Collections.<Value<?>>emptyList()); // we *don't* create multiple instances of the container-interceptor class, but we just reuse a single instance and it's *not* // tied to the EJB component instance lifecycle. final CachedValue cachedInterceptorInstanceValue = new CachedValue(interceptorInstanceValue); // ultimately create the managed reference which is backed by the CachedValue final ManagedReference interceptorInstanceRef = new ValueManagedReference(cachedInterceptorInstanceValue); // return the ContainerInterceptorMethodInterceptorFactory which is responsible for creating a Interceptor // which can invoke the container-interceptor's around-invoke/around-timeout methods return new ContainerInterceptorMethodInterceptorFactory(interceptorInstanceRef, method); } }