Java Code Examples for javax.enterprise.inject.spi.AfterBeanDiscovery#addContext()
The following examples show how to use
javax.enterprise.inject.spi.AfterBeanDiscovery#addContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JtaExtension.java From openwebbeans-meecrowave with Apache License 2.0 | 6 votes |
void addContextAndBeans(@Observes final AfterBeanDiscovery afterBeanDiscovery, final BeanManager bm) { context = new TransactionContext(); afterBeanDiscovery.addContext(context); if (!hasManager && !hasRegistry) { try { final GeronimoTransactionManager mgr = new GeronimoTransactionManager(); afterBeanDiscovery.addBean(new JtaBean(mgr)); } catch (final XAException e) { throw new IllegalStateException(e); } hasManager = true; hasRegistry = true; } afterBeanDiscovery.addBean(new JtaConfigBean(config)); }
Example 2
Source File: WeldCDIExtension.java From weld-junit with Apache License 2.0 | 5 votes |
void afterBeandiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager) { if (scopesToActivate != null) { for (Class<? extends Annotation> scope : scopesToActivate) { ContextImpl ctx = new ContextImpl(scope, beanManager); contexts.add(ctx); event.addContext(ctx); } } if (beans != null) { for (Bean<?> bean : beans) { event.addBean(bean); } } }
Example 3
Source File: DeltaSpikeContextExtension.java From deltaspike with Apache License 2.0 | 5 votes |
public void registerDeltaSpikeContexts(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { if (!isActivated) { return; } windowContext = new WindowContextImpl(beanManager); conversationContext = new GroupedConversationContext(beanManager, windowContext); viewAccessScopedContext = new ViewAccessContext(beanManager, windowContext); afterBeanDiscovery.addContext(windowContext); afterBeanDiscovery.addContext(conversationContext); afterBeanDiscovery.addContext(viewAccessScopedContext); }
Example 4
Source File: ViewScopedExtension.java From deltaspike with Apache License 2.0 | 5 votes |
/** * Register and start the ViewScopedContext. */ public void registerViewContext(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { if (!isActivated) { return; } //X TODO check whether we still need this in EE6: CodiStartupBroadcaster.broadcastStartup(); afterBeanDiscovery.addContext(new ViewScopedContext(beanManager)); }
Example 5
Source File: TransactionContextExtension.java From deltaspike with Apache License 2.0 | 5 votes |
/** * Register the TransactionContext as a CDI Context * * @param afterBeanDiscovery after-bean-discovery event */ protected void registerTransactionContext(@Observes AfterBeanDiscovery afterBeanDiscovery) { if (!isActivated) { return; } TransactionContext transactionContext = new TransactionContext(); afterBeanDiscovery.addContext(transactionContext); }
Example 6
Source File: BatchEEScopeExtension.java From incubator-batchee with Apache License 2.0 | 5 votes |
void addBatchScopes(final @Observes AfterBeanDiscovery afterBeanDiscovery, final BeanManager bm) { jobContext = new JobContextImpl(bm); stepContext = new StepContextImpl(bm); afterBeanDiscovery.addContext(jobContext); afterBeanDiscovery.addContext(stepContext); }
Example 7
Source File: PortletCDIExtension.java From portals-pluto with Apache License 2.0 | 5 votes |
/** * Add the context for the custom scope implementations. * * @param abd */ void addPortletCustomScopeContexts(@Observes AfterBeanDiscovery abd) { RedirectScopedContext rsc = new RedirectScopedContext(); abd.addContext(rsc); PortletSessionScopedContext pssc = new PortletSessionScopedContext(); abd.addContext(pssc); PortletStateScopedContext pstsc = new PortletStateScopedContext(); abd.addContext(pstsc); PortletRequestScopedContext prsc = new PortletRequestScopedContext(); abd.addContext(prsc); }
Example 8
Source File: ProcessEngineExtension.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { event.addContext(new BusinessProcessContext(manager)); }
Example 9
Source File: RefreshableScopeExtension.java From datawave with Apache License 2.0 | 4 votes |
@SuppressWarnings("unused") void afterBeanDiscovery(@Observes AfterBeanDiscovery abd, BeanManager bm) { refreshableScopeContext = new RefreshableScopeContext(); abd.addContext(refreshableScopeContext); }
Example 10
Source File: DummyScopeExtension.java From deltaspike with Apache License 2.0 | 4 votes |
public void registerDummyContext(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) { context = new DummyContext(beanManager, true); afterBeanDiscovery.addContext(context); }
Example 11
Source File: RegisterJoynrJeeMessageContextExtension.java From joynr with Apache License 2.0 | 4 votes |
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager) { JoynrJeeMessageContext context = JoynrJeeMessageContext.getInstance(); logger.info("Created new JoynrJeeMessageContext {} and adding to event {}", context, event); event.addContext(context); }
Example 12
Source File: TrimouExtension.java From trimou with Apache License 2.0 | 4 votes |
/** * * @param event * @param beanManager */ public void observeAfterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager) { LOGGER.info("Registering context for @RenderingScoped"); renderingContext = new RenderingContext(); event.addContext(renderingContext); }
Example 13
Source File: ClientScopeExtension.java From dolphin-platform with Apache License 2.0 | 4 votes |
public void registerContext(@Observes final AfterBeanDiscovery event, final BeanManager beanManager) { Assert.requireNonNull(event, "event"); event.addContext(new ClientScopeContext(beanManager)); }
Example 14
Source File: BusinessScopeExtension.java From drools-workshop with Apache License 2.0 | 4 votes |
public void registerACustomScopeContext(@Observes final AfterBeanDiscovery event) { event.addContext(new BusinessScopeContext()); }
Example 15
Source File: JpaExtension.java From openwebbeans-meecrowave with Apache License 2.0 | 4 votes |
void addBeans(@Observes final AfterBeanDiscovery afb, final BeanManager bm) { afb.addContext(entityManagerContext); entityManagerBeans.forEach((n, b) -> afb.addBean(b)); }
Example 16
Source File: FlowableExtension.java From flowable-engine with Apache License 2.0 | 4 votes |
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { BeanManagerLookup.localInstance = manager; event.addContext(new BusinessProcessContext(manager)); }
Example 17
Source File: ActivitiExtension.java From activiti6-boot2 with Apache License 2.0 | 4 votes |
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) { BeanManagerLookup.localInstance = manager; event.addContext(new BusinessProcessContext(manager)); }
Example 18
Source File: AngularBeansCDIExtension.java From AngularBeans with GNU Lesser General Public License v3.0 | 2 votes |
/** * <p> * Invoked by the container once all the annotated types has bean discovered, then registers * the NGSessionScopeContext (and the NGSessionScoped custom CDI scope) * </p> * * @see javax.enterprise.inject.spi.AfterBeanDiscovery * @see javax.enterprise.inject.spi.BeanManager * @see angularBeans.context.NGSessionScoped * @see angularBeans.context.NGSessionScopeContext */ public void registerContext(@Observes final AfterBeanDiscovery event, BeanManager manager) { Context context = NGSessionScopeContext.getINSTANCE(); event.addContext(context); }