protected void destroy() { BeanContext info = deploymentInfo.getAndSet(null); if (info != null) { info.set(EjbDeployment.class, null); } } }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { final Object deploymentId = beanContext.getDeploymentID(); cmpEngine.deploy(beanContext); beanContext.setContainerData(cmpEngine); beanContext.set(EJBContext.class, new EntityContext(securityService)); // try to set deploymentInfo static field on bean implementation class try { final Field field = beanContext.getCmpImplClass().getField("deploymentInfo"); field.set(null, beanContext); } catch (final Exception e) { // ignore } // add to indexes deploymentsById.put(deploymentId, beanContext); beansByClass.put(beanContext.getCmpImplClass(), beanContext); beanContext.setContainer(this); } }
beanContext.setContainerData(data); beanContext.set(EJBContext.class, this.sessionContext);
public void deploy(final BeanContext beanContext) { poolMap.put(beanContext.getDeploymentID(), new LinkedListStack(poolsize / 2)); beanContext.set(EJBContext.class, createEntityContext()); }
@Override public void deploy(final BeanContext beanContext) throws OpenEJBException { synchronized (this) { final Object deploymentId = beanContext.getDeploymentID(); cmpEngine.deploy(beanContext); beanContext.setContainerData(cmpEngine); beanContext.set(EJBContext.class, new EntityContext(securityService)); // try to set deploymentInfo static field on bean implementation class try { final Field field = beanContext.getCmpImplClass().getField("deploymentInfo"); field.set(null, beanContext); } catch (final Exception e) { // ignore } // add to indexes deploymentsById.put(deploymentId, beanContext); beansByClass.put(beanContext.getCmpImplClass(), beanContext); beanContext.setContainer(this); } }
beanContext.setContainerData(data); beanContext.set(EJBContext.class, this.sessionContext);
public void deploy(final BeanContext beanContext) { poolMap.put(beanContext.getDeploymentID(), new LinkedListStack(poolsize / 2)); beanContext.set(EJBContext.class, createEntityContext()); }
beanContext.set(EJBContext.class, this.sessionContext);
public ConcurrentMap getLiveHandleRegistry() { final BeanContext beanContext = getBeanContext(); ProxyRegistry proxyRegistry = beanContext.get(ProxyRegistry.class); if (proxyRegistry == null) { proxyRegistry = new ProxyRegistry(); beanContext.set(ProxyRegistry.class, proxyRegistry); } return proxyRegistry.liveHandleRegistry; }
private static void doInject(final Object testInstance, final BeanContext context, final BeanManagerImpl bm) throws Exception { final Set<Bean<?>> beans = bm.getBeans(testInstance.getClass()); final Bean<?> bean = bm.resolve(beans); final CreationalContext<?> cc = bm.createCreationalContext(bean); if (context != null) { context.set(CreationalContext.class, cc); } OWBInjector.inject(bm, testInstance, cc); }
/** * Creates a MdbInstanceFactory for a single specific deployment. * * @param beanContext the deployment for which instances will be created * @param securityService the transaction manager for this container system * @param instanceLimit the maximal number of instances or <= 0 if unlimited */ public MdbInstanceFactory(final BeanContext beanContext, final SecurityService securityService, final int instanceLimit) throws OpenEJBException { this.beanContext = beanContext; this.instanceLimit = instanceLimit; mdbContext = new MdbContext(securityService); try { final Context context = beanContext.getJndiEnc(); context.bind("comp/EJBContext", mdbContext); context.bind("comp/TimerService", new TimerServiceWrapper()); } catch (final NamingException e) { throw new OpenEJBException("Failed to bind EJBContext/TimerService", e); } beanContext.set(EJBContext.class, this.mdbContext); }
/** * Creates a MdbInstanceFactory for a single specific deployment. * * @param beanContext the deployment for which instances will be created * @param securityService the transaction manager for this container system * @param instanceLimit the maximal number of instances or <= 0 if unlimited */ public MdbInstanceFactory(final BeanContext beanContext, final SecurityService securityService, final int instanceLimit) throws OpenEJBException { this.beanContext = beanContext; this.instanceLimit = instanceLimit; mdbContext = new MdbContext(securityService); try { final Context context = beanContext.getJndiEnc(); context.bind("comp/EJBContext", mdbContext); context.bind("comp/TimerService", new TimerServiceWrapper()); } catch (final NamingException e) { throw new OpenEJBException("Failed to bind EJBContext/TimerService", e); } beanContext.set(EJBContext.class, this.mdbContext); }
protected EjbDeployment initialize(BeanContext deploymentInfo) { try { ImmutableFederatedContext federatedContext = (ImmutableFederatedContext) ((DeepBindableContext.ContextWrapper)deploymentInfo.getJndiEnc()).getRootContext(); federatedContext.federateContext(componentContext); federatedContext.federateContext(moduleContext); federatedContext.federateContext(applicationContext); federatedContext.federateContext(globalContext); deploymentInfo.set(EjbDeployment.class, this); this.deploymentInfo.set(deploymentInfo); return this; } catch (NamingException e) { throw new IllegalStateException("Unable to complete EjbDeployment initialization", e); } }
private Method getMostSpecificMethod(final BeanContext beanContext, final Method method, final Class callInterface) { MostSpecificMethodCache cache = beanContext.get(MostSpecificMethodCache.class); if (cache == null) { synchronized (beanContext) { // no need to use a lock IMO here cache = beanContext.get(MostSpecificMethodCache.class); if (cache == null) { cache = new MostSpecificMethodCache(); beanContext.set(MostSpecificMethodCache.class, cache); } } } final MostSpecificMethodKey key = new MostSpecificMethodKey(callInterface, method); Method m = cache.methods.get(key); if (m == null) { // no need of more synchro since Method will be resolved to the same instance m = getMostSpecificMethod(method, callInterface); cache.methods.putIfAbsent(key, m); } return m; }
private Method getMostSpecificMethod(final BeanContext beanContext, final Method method, final Class callInterface) { MostSpecificMethodCache cache = beanContext.get(MostSpecificMethodCache.class); if (cache == null) { synchronized (beanContext) { // no need to use a lock IMO here cache = beanContext.get(MostSpecificMethodCache.class); if (cache == null) { cache = new MostSpecificMethodCache(); beanContext.set(MostSpecificMethodCache.class, cache); } } } final MostSpecificMethodKey key = new MostSpecificMethodKey(callInterface, method); Method m = cache.methods.get(key); if (m == null) { // no need of more synchro since Method will be resolved to the same instance m = getMostSpecificMethod(method, callInterface); cache.methods.putIfAbsent(key, m); } return m; }
public CdiEjbBean(final BeanContext beanContext, final WebBeansContext webBeansContext, final Class beanClass, final AnnotatedType<T> at, final InjectionTargetFactoryImpl<T> factory) { super(webBeansContext, toSessionType(beanContext.getComponentType()), at, new EJBBeanAttributesImpl<T>(beanContext, BeanAttributesBuilder.forContext(webBeansContext).newBeanAttibutes(at).build()), beanClass, factory); this.beanContext = beanContext; beanContext.set(Bean.class, this); passivatingId = beanContext.getDeploymentID() + getReturnType().getName(); isDependentAndStateful = getScope().equals(Dependent.class) && BeanType.STATEFUL.equals(beanContext.getComponentType()); }
beanContext.set(HasSchedule.class, new HasSchedule(hasSchedules));
public EndpointFactory(final ActivationSpec activationSpec, final MdbContainer container, final BeanContext beanContext, final MdbInstanceFactory instanceFactory, final XAResourceWrapper xaResourceWrapper) { this.activationSpec = activationSpec; this.container = container; this.beanContext = beanContext; this.instanceFactory = instanceFactory; classLoader = container.getMessageListenerInterface().getClassLoader(); interfaces = new Class[]{container.getMessageListenerInterface(), MessageEndpoint.class}; this.xaResourceWrapper = xaResourceWrapper; final BeanContext.ProxyClass proxyClass = beanContext.get(BeanContext.ProxyClass.class); if (proxyClass == null) { proxy = LocalBeanProxyFactory.createProxy(beanContext.getBeanClass(), beanContext.getClassLoader(), interfaces); beanContext.set(BeanContext.ProxyClass.class, new BeanContext.ProxyClass(beanContext, interfaces)); } else { proxy = proxyClass.getProxy(); } }
public EndpointFactory(final ActivationSpec activationSpec, final BaseMdbContainer container, final BeanContext beanContext, final MdbInstanceFactory instanceFactory, final MdbInstanceManager instanceManager, final XAResourceWrapper xaResourceWrapper, boolean usePool) { this.activationSpec = activationSpec; this.container = container; this.beanContext = beanContext; this.instanceFactory = instanceFactory; this.instanceManager = instanceManager; classLoader = container.getMessageListenerInterface().getClassLoader(); interfaces = new Class[]{container.getMessageListenerInterface(), MessageEndpoint.class}; this.xaResourceWrapper = xaResourceWrapper; this.usePool = usePool; final BeanContext.ProxyClass proxyClass = beanContext.get(BeanContext.ProxyClass.class); if (proxyClass == null) { proxy = LocalBeanProxyFactory.createProxy(beanContext.getBeanClass(), beanContext.getClassLoader(), interfaces); beanContext.set(BeanContext.ProxyClass.class, new BeanContext.ProxyClass(beanContext, interfaces)); } else { proxy = proxyClass.getProxy(); } }
beanClass, factory); this.beanContext = bc; bc.set(Bean.class, this); passivatingId = bc.getDeploymentID() + getReturnType().getName();