Set<Bean<?>> beans = wbc.getBeanManagerImpl().getBeans(beanClass); if (beans != null) { boolean recreateIt = false;
/** * Creates a new loader instance. * @param webBeansContext */ public ExtensionLoader(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; manager = this.webBeansContext.getBeanManagerImpl(); }
/** * Gets conversation instance from conversation bean. * @return conversation instance */ public Conversation getConversationBeanReference() { BeanManager beanManager = webBeansContext.getBeanManagerImpl(); Bean<Conversation> bean = (Bean<Conversation>)beanManager.getBeans(Conversation.class, DefaultLiteral.INSTANCE).iterator().next(); Conversation conversation =(Conversation) beanManager.getReference(bean, Conversation.class, beanManager.createCreationalContext(bean)); return conversation; }
@Override protected BeanManager produce(Map<Interceptor<?>, ?> interceptors, CreationalContextImpl<BeanManager> creationalContext) { if (manager == null) { manager = new InjectableBeanManager(context.getBeanManagerImpl()); } return manager; }
public void addDecorator(Decorator decorator) { webBeansDecorators.add(decorator); if (decorator instanceof OwbBean) { OwbBean<?> owbBean = (OwbBean<?>)decorator; if(owbBean.isPassivationCapable()) { webBeansContext.getBeanManagerImpl().addPassivationInfo(decorator); } } }
private void startSingletonContext() { createSingletonContext(); webBeansContext.getBeanManagerImpl().fireContextLifecyleEvent( new Object(), InitializedLiteral.INSTANCE_SINGLETON_SCOPED); }
private static int cdiSize(final AppContext ctx) { final WebBeansContext wbc = ctx.getWebBeansContext(); if (wbc == null) { return 0; } return wbc.getBeanManagerImpl().getBeans().size(); }
private boolean isOwbApplication() { if (owbApplication == null) { owbApplication = WebBeansContext.getInstance().getBeanManagerImpl().isInUse(); } return owbApplication; }
private Object readResolve() throws ObjectStreamException { WebBeansContext webBeansContext = WebBeansContext.getInstance(); return webBeansContext.getBeanManagerImpl().getPassivationCapableBean(passivationId); } }
public AnnotationManager(WebBeansContext context) { webBeansContext = context; beanManagerImpl = context.getBeanManagerImpl(); strictValidation = context.getOpenWebBeansConfiguration().strictDynamicValidation(); }
@Override public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable<?, ?> environment) { return new InjectableBeanManager(WebBeansContext.getInstance().getBeanManagerImpl()); }
@Override protected InterceptionFactory<?> produce(Map<Interceptor<?>, ?> interceptorInstances, CreationalContextImpl<InterceptionFactory<?>> creationalContext) { InjectionPoint ip = creationalContext.getInjectionPoint(); AnnotatedType<?> at = context.getBeanManagerImpl().createAnnotatedType( // already validated at startup so let's be brutal at runtime Class.class.cast(ParameterizedType.class.cast(ip.getType()).getActualTypeArguments()[0])); return new InterceptionFactoryImpl(context, at, ip.getQualifiers(), creationalContext); } }
@Override public Set<Bean<?>> implResolveByType(final boolean delegate, final Type injectionPointType, final Class<?> injectinPointClass, final Annotation... qualifiers) { final Set<Bean<?>> set = super.implResolveByType(delegate, injectionPointType, injectinPointClass, qualifiers); if (set.isEmpty()) { return context.getParent().getBeanManagerImpl().getInjectionResolver().implResolveByType(delegate, injectionPointType, injectinPointClass, qualifiers); } return set; } }
@Override public Set<Bean<?>> implResolveByType(final boolean delegate, final Type injectionPointType, final Class<?> injectinPointClass, final Annotation... qualifiers) { final Set<Bean<?>> set = super.implResolveByType(delegate, injectionPointType, injectinPointClass, qualifiers); if (set.isEmpty() && context.getParent() != null) { return context.getParent().getBeanManagerImpl().getInjectionResolver().implResolveByType(delegate, injectionPointType, injectinPointClass, qualifiers); } return set; } }
/** * {@inheritDoc} */ @Override public void addDefinitionError(Throwable t) { checkState(); WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t); }
/** * {@inheritDoc} */ @Override public void addDefinitionError(Throwable t) { checkState(); WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t); }
/** * {@inheritDoc} */ @Override public void addDefinitionError(Throwable t) { checkState(); WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t); }
/** * {@inheritDoc} */ @Override public void addDefinitionError(Throwable t) { checkState(); WebBeansContext.getInstance().getBeanManagerImpl().getErrorStack().pushError(t); }
private void startCdiContexts(final String name) { final WebBeansContext wbc = this.container.getAppContexts(name).getWebBeansContext(); if (wbc.getBeanManagerImpl().isInUse()) { final MockHttpSession session = new MockHttpSession(); wbc.getContextsService().startContext(RequestScoped.class, null); wbc.getContextsService().startContext(SessionScoped.class, session); wbc.getContextsService().startContext(ConversationScoped.class, null); SESSIONS.put(name, session); } }
@BeforeClass public static void startContainer() { final WebBeansContext webBeansContext = WebBeansContext.currentInstance(); lifecycle = webBeansContext.getService(ContainerLifecycle.class); lifecycle.startApplication(null); bm = webBeansContext.getBeanManagerImpl(); }