public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }
protected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services) { List<ContextHolder<? extends Context>> contexts = new ArrayList<ContextHolder<? extends Context>>(); BeanIdentifierIndex beanIdentifierIndex = services.get(BeanIdentifierIndex.class); /* * Register a full set of bound and unbound contexts. Although we may not use all of * these (e.g. if we are running in a servlet environment) they may be * useful for an application. */ Set<Annotation> boundQualifires = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build(); Set<Annotation> unboundQualifiers = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(UnboundLiteral.INSTANCE).build(); contexts.add(new ContextHolder<ApplicationContext>(new ApplicationContextImpl(contextId), ApplicationContext.class, unboundQualifiers)); contexts.add(new ContextHolder<SingletonContext>(new SingletonContextImpl(contextId), SingletonContext.class, unboundQualifiers)); contexts.add(new ContextHolder<BoundSessionContext>(new BoundSessionContextImpl(contextId, beanIdentifierIndex), BoundSessionContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundConversationContext>(new BoundConversationContextImpl(contextId, services), BoundConversationContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundRequestContext>(new BoundRequestContextImpl(contextId), BoundRequestContext.class, boundQualifires)); contexts.add(new ContextHolder<RequestContext>(new RequestContextImpl(contextId), RequestContext.class, unboundQualifiers)); contexts.add(new ContextHolder<DependentContext>(new DependentContextImpl(services.get(ContextualStore.class)), DependentContext.class, unboundQualifiers)); services.get(WeldModules.class).postContextRegistration(contextId, services, contexts); /* * Register the contexts with the bean manager and add the beans to the * deployment manager so that they are easily accessible (contexts are app * scoped) */ for (ContextHolder<? extends Context> context : contexts) { deploymentManager.addContext(context.getContext()); deploymentManager.addBean(ContextBean.of(context, deploymentManager)); } return contexts; }
@Override public void postContextRegistration(PostContextRegistrationContext ctx) { final BeanIdentifierIndex index = ctx.getServices().get(BeanIdentifierIndex.class); final String contextId = ctx.getContextId(); if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { // Register the Http contexts if not in Set<Annotation> httpQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(HttpLiteral.INSTANCE).build(); ctx.addContext(new ContextHolder<HttpSessionContext>(new HttpSessionContextImpl(contextId, index), HttpSessionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpSessionDestructionContext>(new HttpSessionDestructionContext(contextId, index), HttpSessionDestructionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpConversationContext>(new LazyHttpConversationContextImpl(contextId, ctx.getServices()), HttpConversationContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpRequestContext>(new HttpRequestContextImpl(contextId), HttpRequestContext.class, httpQualifiers)); } }
protected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services) { List<ContextHolder<? extends Context>> contexts = new ArrayList<ContextHolder<? extends Context>>(); BeanIdentifierIndex beanIdentifierIndex = services.get(BeanIdentifierIndex.class); /* * Register a full set of bound and unbound contexts. Although we may not use all of * these (e.g. if we are running in a servlet environment) they may be * useful for an application. */ Set<Annotation> boundQualifires = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build(); Set<Annotation> unboundQualifiers = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(UnboundLiteral.INSTANCE).build(); contexts.add(new ContextHolder<ApplicationContext>(new ApplicationContextImpl(contextId), ApplicationContext.class, unboundQualifiers)); contexts.add(new ContextHolder<SingletonContext>(new SingletonContextImpl(contextId), SingletonContext.class, unboundQualifiers)); contexts.add(new ContextHolder<BoundSessionContext>(new BoundSessionContextImpl(contextId, beanIdentifierIndex), BoundSessionContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundConversationContext>(new BoundConversationContextImpl(contextId, services), BoundConversationContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundRequestContext>(new BoundRequestContextImpl(contextId), BoundRequestContext.class, boundQualifires)); contexts.add(new ContextHolder<RequestContext>(new RequestContextImpl(contextId), RequestContext.class, unboundQualifiers)); contexts.add(new ContextHolder<DependentContext>(new DependentContextImpl(services.get(ContextualStore.class)), DependentContext.class, unboundQualifiers)); services.get(WeldModules.class).postContextRegistration(contextId, services, contexts); /* * Register the contexts with the bean manager and add the beans to the * deployment manager so that they are easily accessible (contexts are app * scoped) */ for (ContextHolder<? extends Context> context : contexts) { deploymentManager.addContext(context.getContext()); deploymentManager.addBean(ContextBean.of(context, deploymentManager)); } return contexts; }
@Override public void postContextRegistration(PostContextRegistrationContext ctx) { final BeanIdentifierIndex index = ctx.getServices().get(BeanIdentifierIndex.class); final String contextId = ctx.getContextId(); if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { // Register the Http contexts if not in Set<Annotation> httpQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(HttpLiteral.INSTANCE).build(); ctx.addContext(new ContextHolder<HttpSessionContext>(new HttpSessionContextImpl(contextId, index), HttpSessionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpSessionDestructionContext>(new HttpSessionDestructionContext(contextId, index), HttpSessionDestructionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpConversationContext>(new LazyHttpConversationContextImpl(contextId, ctx.getServices()), HttpConversationContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpRequestContext>(new HttpRequestContextImpl(contextId), HttpRequestContext.class, httpQualifiers)); } }
public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }
protected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services) { List<ContextHolder<? extends Context>> contexts = new ArrayList<ContextHolder<? extends Context>>(); BeanIdentifierIndex beanIdentifierIndex = services.get(BeanIdentifierIndex.class); /* * Register a full set of bound and unbound contexts. Although we may not use all of * these (e.g. if we are running in a servlet environment) they may be * useful for an application. */ Set<Annotation> boundQualifires = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build(); Set<Annotation> unboundQualifiers = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(UnboundLiteral.INSTANCE).build(); contexts.add(new ContextHolder<ApplicationContext>(new ApplicationContextImpl(contextId), ApplicationContext.class, unboundQualifiers)); contexts.add(new ContextHolder<SingletonContext>(new SingletonContextImpl(contextId), SingletonContext.class, unboundQualifiers)); contexts.add(new ContextHolder<BoundSessionContext>(new BoundSessionContextImpl(contextId, beanIdentifierIndex), BoundSessionContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundConversationContext>(new BoundConversationContextImpl(contextId, services), BoundConversationContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundRequestContext>(new BoundRequestContextImpl(contextId), BoundRequestContext.class, boundQualifires)); contexts.add(new ContextHolder<RequestContext>(new RequestContextImpl(contextId), RequestContext.class, unboundQualifiers)); contexts.add(new ContextHolder<DependentContext>(new DependentContextImpl(services.get(ContextualStore.class)), DependentContext.class, unboundQualifiers)); services.get(WeldModules.class).postContextRegistration(contextId, services, contexts); /* * Register the contexts with the bean manager and add the beans to the * deployment manager so that they are easily accessible (contexts are app * scoped) */ for (ContextHolder<? extends Context> context : contexts) { deploymentManager.addContext(context.getContext()); deploymentManager.addBean(ContextBean.of(context, deploymentManager)); } return contexts; }
@Override public void postContextRegistration(PostContextRegistrationContext ctx) { final BeanIdentifierIndex index = ctx.getServices().get(BeanIdentifierIndex.class); final String contextId = ctx.getContextId(); if (Reflections.isClassLoadable(ServletApiAbstraction.SERVLET_CONTEXT_CLASS_NAME, WeldClassLoaderResourceLoader.INSTANCE)) { // Register the Http contexts if not in Set<Annotation> httpQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(HttpLiteral.INSTANCE).build(); ctx.addContext(new ContextHolder<HttpSessionContext>(new HttpSessionContextImpl(contextId, index), HttpSessionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpSessionDestructionContext>(new HttpSessionDestructionContext(contextId, index), HttpSessionDestructionContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpConversationContext>(new LazyHttpConversationContextImpl(contextId, ctx.getServices()), HttpConversationContext.class, httpQualifiers)); ctx.addContext(new ContextHolder<HttpRequestContext>(new HttpRequestContextImpl(contextId), HttpRequestContext.class, httpQualifiers)); } }
public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }
protected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services) { List<ContextHolder<? extends Context>> contexts = new ArrayList<ContextHolder<? extends Context>>(); BeanIdentifierIndex beanIdentifierIndex = services.get(BeanIdentifierIndex.class); /* * Register a full set of bound and unbound contexts. Although we may not use all of * these (e.g. if we are running in a servlet environment) they may be * useful for an application. */ Set<Annotation> boundQualifires = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build(); Set<Annotation> unboundQualifiers = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(UnboundLiteral.INSTANCE).build(); contexts.add(new ContextHolder<ApplicationContext>(new ApplicationContextImpl(contextId), ApplicationContext.class, unboundQualifiers)); contexts.add(new ContextHolder<SingletonContext>(new SingletonContextImpl(contextId), SingletonContext.class, unboundQualifiers)); contexts.add(new ContextHolder<BoundSessionContext>(new BoundSessionContextImpl(contextId, beanIdentifierIndex), BoundSessionContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundConversationContext>(new BoundConversationContextImpl(contextId, services), BoundConversationContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundRequestContext>(new BoundRequestContextImpl(contextId), BoundRequestContext.class, boundQualifires)); contexts.add(new ContextHolder<RequestContext>(new RequestContextImpl(contextId), RequestContext.class, unboundQualifiers)); contexts.add(new ContextHolder<DependentContext>(new DependentContextImpl(services.get(ContextualStore.class)), DependentContext.class, unboundQualifiers)); services.get(WeldModules.class).postContextRegistration(contextId, services, contexts); /* * Register the contexts with the bean manager and add the beans to the * deployment manager so that they are easily accessible (contexts are app * scoped) */ for (ContextHolder<? extends Context> context : contexts) { deploymentManager.addContext(context.getContext()); deploymentManager.addBean(ContextBean.of(context, deploymentManager)); } return contexts; }
@Override public void postContextRegistration(PostContextRegistrationContext ctx) { // Register the EJB Request context ctx.addContext(new ContextHolder<EjbRequestContext>(new EjbRequestContextImpl(ctx.getContextId()), EjbRequestContext.class, ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(EjbLiteral.INSTANCE).build())); }
public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }
protected Collection<ContextHolder<? extends Context>> createContexts(ServiceRegistry services) { List<ContextHolder<? extends Context>> contexts = new ArrayList<ContextHolder<? extends Context>>(); BeanIdentifierIndex beanIdentifierIndex = services.get(BeanIdentifierIndex.class); /* * Register a full set of bound and unbound contexts. Although we may not use all of * these (e.g. if we are running in a servlet environment) they may be * useful for an application. */ Set<Annotation> boundQualifires = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build(); Set<Annotation> unboundQualifiers = ImmutableSet.<Annotation>builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(UnboundLiteral.INSTANCE).build(); contexts.add(new ContextHolder<ApplicationContext>(new ApplicationContextImpl(contextId), ApplicationContext.class, unboundQualifiers)); contexts.add(new ContextHolder<SingletonContext>(new SingletonContextImpl(contextId), SingletonContext.class, unboundQualifiers)); contexts.add(new ContextHolder<BoundSessionContext>(new BoundSessionContextImpl(contextId, beanIdentifierIndex), BoundSessionContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundConversationContext>(new BoundConversationContextImpl(contextId, services), BoundConversationContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundRequestContext>(new BoundRequestContextImpl(contextId), BoundRequestContext.class, boundQualifires)); contexts.add(new ContextHolder<RequestContext>(new RequestContextImpl(contextId), RequestContext.class, unboundQualifiers)); contexts.add(new ContextHolder<DependentContext>(new DependentContextImpl(services.get(ContextualStore.class)), DependentContext.class, unboundQualifiers)); services.get(WeldModules.class).postContextRegistration(contextId, services, contexts); /* * Register the contexts with the bean manager and add the beans to the * deployment manager so that they are easily accessible (contexts are app * scoped) */ for (ContextHolder<? extends Context> context : contexts) { deploymentManager.addContext(context.getContext()); deploymentManager.addBean(ContextBean.of(context, deploymentManager)); } return contexts; }
public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }
contexts.add(new ContextHolder<ApplicationContext>(new ApplicationContextImpl(contextId), ApplicationContext.class, unboundQualifiers)); contexts.add(new ContextHolder<SingletonContext>(new SingletonContextImpl(contextId), SingletonContext.class, unboundQualifiers)); contexts.add(new ContextHolder<BoundSessionContext>(new BoundSessionContextImpl(contextId, beanIdentifierIndex), BoundSessionContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundConversationContext>(new BoundConversationContextImpl(contextId, services), BoundConversationContext.class, boundQualifires)); contexts.add(new ContextHolder<BoundRequestContext>(new BoundRequestContextImpl(contextId), BoundRequestContext.class, boundQualifires)); contexts.add(new ContextHolder<RequestContext>(new RequestContextImpl(contextId), RequestContext.class, unboundQualifiers)); contexts.add(new ContextHolder<DependentContext>(new DependentContextImpl(services.get(ContextualStore.class)), DependentContext.class, unboundQualifiers)); contexts.add(new ContextHolder<HttpSessionContext>(new HttpSessionContextImpl(contextId, beanIdentifierIndex), HttpSessionContext.class, httpQualifiers)); contexts.add(new ContextHolder<HttpSessionDestructionContext>(new HttpSessionDestructionContext(contextId, beanIdentifierIndex), HttpSessionDestructionContext.class, httpQualifiers)); contexts.add(new ContextHolder<HttpConversationContext>(new LazyHttpConversationContextImpl(contextId, services), HttpConversationContext.class, httpQualifiers)); contexts.add(new ContextHolder<HttpRequestContext>(new HttpRequestContextImpl(contextId), HttpRequestContext.class, httpQualifiers)); contexts.add(new ContextHolder<EjbRequestContext>(new EjbRequestContextImpl(contextId), EjbRequestContext.class, ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(EjbLiteral.INSTANCE).build())); deploymentManager.addContext(context.getContext()); deploymentManager.addBean(ContextBean.of(context, deploymentManager));
public ContextBean(ContextHolder<T> contextHolder, BeanManagerImpl beanManager) { super(new StringBeanIdentifier(BeanIdentifiers.forBuiltInBean(beanManager, contextHolder.getType(), null)), beanManager, contextHolder.getType()); this.context = contextHolder.getContext(); this.types = HierarchyDiscovery.forNormalizedType(contextHolder.getType()).getTypeClosure(); this.qualifiers = contextHolder.getQualifiers(); }