private void addInterceptorBindings(@Observes BeforeBeanDiscovery bbd, BeanManager manager) { LOGGER.info("MicroProfile: Metrics activated"); declareAsInterceptorBinding(Counted.class, manager, bbd); declareAsInterceptorBinding(Gauge.class, manager, bbd); declareAsInterceptorBinding(Timed.class, manager, bbd); declareAsInterceptorBinding(Metered.class, manager, bbd); // It seems that fraction deployment module cannot be picked up as a CDI bean archive - see also SWARM-1725 bbd.addAnnotatedType(manager.createAnnotatedType(AMetricRegistryFactory.class)); bbd.addAnnotatedType(manager.createAnnotatedType(MetricNameFactory.class)); bbd.addAnnotatedType(manager.createAnnotatedType(MeteredInterceptor.class)); bbd.addAnnotatedType(manager.createAnnotatedType(CountedInterceptor.class)); bbd.addAnnotatedType(manager.createAnnotatedType(TimedInterceptor.class)); bbd.addAnnotatedType(manager.createAnnotatedType(MetricsInterceptor.class)); }
/** * javax.faces.bean.ViewScoped is no CDI Scope. * We need to add it programmatically to CDI. */ public void addViewScoped(@Observes BeforeBeanDiscovery beforeBeanDiscovery) { isActivated = ClassDeactivationUtils.isActivated(getClass()); if (isActivated) { //this extension is only needed if the cdi-based view-scope handling isn't delegated to jsf 2.2+ isActivated = !JsfUtils.isViewScopeDelegationEnabled(); } if (!isActivated) { return; } beforeBeanDiscovery.addScope(ViewScoped.class, true, true); }
protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery) { this.isActivated = ClassDeactivationUtils.isActivated(getClass()); if (this.isActivated) { String jobClassName = SchedulerBaseConfig.JobCustomization.JOB_CLASS_NAME; this.jobClass = ClassUtils.tryToLoadClassForName(jobClassName); if (this.jobClass == null) { this.isActivated = false; } } }
@SuppressWarnings("UnusedDeclaration") protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) { if (!ClassDeactivationUtils.isActivated(getClass())) { return; } enabled = CoreBaseConfig.InterDynCustomization.INTERDYN_ENABLED.getValue(); if (enabled) { logger.info("Starting with deltaspike.interdyn instrumentation"); init(); } }
@Test public void addScope() { final BeforeBeanDiscovery beforeBeanDiscovery = mock(BeforeBeanDiscovery.class); this.extension.addScope(beforeBeanDiscovery); verify(beforeBeanDiscovery).addScope(WebSocketScope.class, true, false); verifyNoMoreInteractions(beforeBeanDiscovery); }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager beanManager) { final String method = "PropertyInjectionExtension.beforeBeanDiscovery()"; if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, method + " beanManager = " + beanManager); } addAnnotatedType(event, beanManager, PropertyProducerBean.class); addAnnotatedType(event, beanManager, PropertyResourceProducerBean.class); }
void addAnnotatedType(BeforeBeanDiscovery event, BeanManager beanManager, Class<?> type) { final String method = "PropertyInjectionExtension.addAnnotatedType()"; event.addAnnotatedType(beanManager.createAnnotatedType(type)); if (logger.isLoggable(Level.FINER)) { logger.log(Level.FINER, method + " added type: " + type.getName()); } }
void beforeBeanDiscovery( @Observes BeforeBeanDiscovery type ) throws SchedulerException { StdSchedulerFactory fact = new StdSchedulerFactory(); fact.initialize( getClass().getResourceAsStream( "quartz.properties" ) ); scheduler = fact.getScheduler(); }
/** * Register the MPJWTProducer JsonWebToken producer bean * * @param bbd before discovery event * @param beanManager cdi bean manager */ public void observeBeforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager beanManager) { log.debugf("MPJWTExtension(), added JWTPrincipalProducer"); bbd.addAnnotatedType(beanManager.createAnnotatedType(JWTAuthContextInfoProvider.class)); bbd.addAnnotatedType(beanManager.createAnnotatedType(MPJWTProducer.class)); bbd.addAnnotatedType(beanManager.createAnnotatedType(RawClaimTypeProducer.class)); bbd.addAnnotatedType(beanManager.createAnnotatedType(ClaimValueProducer.class)); bbd.addAnnotatedType(beanManager.createAnnotatedType(JsonValueProducer.class)); }
private static <T extends Annotation> void declareAsInterceptorBinding(Class<T> annotation, BeanManager manager, BeforeBeanDiscovery bbd) { AnnotatedType<T> annotated = manager.createAnnotatedType(annotation); Set<AnnotatedMethod<? super T>> methods = new HashSet<>(); for (AnnotatedMethod<? super T> method : annotated.getMethods()) { methods.add(new AnnotatedMethodDecorator<>(method, NON_BINDING)); } bbd.addInterceptorBinding(new AnnotatedTypeDecorator<>(annotated, INTERCEPTOR_BINDING, methods)); }
void registerInterceptorBindings(@Observes BeforeBeanDiscovery bbd, BeanManager bm) { LOGGER.info("MicroProfile: Fault Tolerance activated"); bbd.addInterceptorBinding(new HystrixInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(CircuitBreaker.class))); bbd.addInterceptorBinding(new HystrixInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Retry.class))); bbd.addInterceptorBinding(new HystrixInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Timeout.class))); bbd.addInterceptorBinding(new HystrixInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Asynchronous.class))); bbd.addInterceptorBinding(new HystrixInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Fallback.class))); bbd.addInterceptorBinding(new HystrixInterceptorBindingAnnotatedType<>(bm.createAnnotatedType(Bulkhead.class))); // Add AnnotatedType for HystrixCommandInterceptor // It seems that fraction deployment module cannot be picked up as a CDI bean archive - see also SWARM-1725 bbd.addAnnotatedType(bm.createAnnotatedType(HystrixCommandInterceptor.class), HystrixCommandInterceptor.class.getName()); }
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { if (logger.isDebugEnabled()) { logger.debug("Before bean discovery, adding WosrkspaceScoped"); } bbd.addScope(WorkspaceScoped.class, true, false); }
/** * {@link javax.enterprise.inject.spi.BeforeBeanDiscovery} CDI event observer. * * @param beforeEvent CDI Event instance. * @param beanManager CDI Bean Manager instance. */ public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeEvent, BeanManager beanManager) { _logger.debug("CDI Bean discovery process started."); _beanDeploymentMetaData = new BeanDeploymentMetaData(); _beanDeploymentMetaData.setBeanManager(beanManager); _beanDeploymentMetaData.setDeploymentClassLoader(Classes.getTCCL()); }
public void validateNiogit(@Observes BeforeBeanDiscovery bbd) { final File niogit = getNiogitDir(); if (niogit.exists()) { failIfNotMigrated(niogit); } }
private static <T extends Annotation> void declareAsInterceptorBinding(Class<T> annotation, BeanManager manager, BeforeBeanDiscovery bbd) { AnnotatedType<T> annotated = manager.createAnnotatedType(annotation); Set<AnnotatedMethod<? super T>> methods = new HashSet<>(); for (AnnotatedMethod<? super T> method : annotated.getMethods()) methods.add(new AnnotatedMethodDecorator<>(method, NON_BINDING)); bbd.addInterceptorBinding(new AnnotatedTypeDecorator<>(annotated, INTERCEPTOR_BINDING, methods)); }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery before) { isActivated = ClassDeactivationUtils.isActivated(getClass()); if (!isActivated) { return; } PersistenceUnitDescriptorProvider.getInstance().init(); }
@SuppressWarnings("UnusedDeclaration") protected void init(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) { if (!ClassDeactivationUtils.isActivated(getClass())) { return; } this.beanManager = beanManager; int priorityValue = CoreBaseConfig.InterceptorCustomization.PRIORITY; priorityAnnotationInstance = AnnotationInstanceUtils.getPriorityAnnotationInstance(priorityValue); }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { logger.info("beginning the scanning process"); beforeBeanDiscovery++; }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager manager) { event.addAnnotatedType(manager.createAnnotatedType(TransactionSupport.class)); event.addAnnotatedType(manager.createAnnotatedType(TransactionalInterceptor.class)); event.addInterceptorBinding(Transactional.class); }
private void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager bm) { AnnotatedType<ConfigProducer> configBean = bm.createAnnotatedType(ConfigProducer.class); bbd.addAnnotatedType(configBean); }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { LOGGER.config("Scanning for SnoopEE clients"); }
/** * @param beforeBean The BeforeBeanDiscovery. * @param bm The BeanManager. * @param types annotated types to register */ public static void addAnnotatedTypes(BeforeBeanDiscovery beforeBean, BeanManager bm, Class<?>... types) { for (Class<?> type : types) { beforeBean.addAnnotatedType(bm.createAnnotatedType(type), type.getName()); } }
@Before public void setup() { ext = new PropertyInjectionExtension(); event = mock(BeforeBeanDiscovery.class); beanManager = mock(BeanManager.class); }
void init(@Observes BeforeBeanDiscovery event) { serviceInterfaces = new HashSet<>(); }
public void addConfigView(@Observes BeforeBeanDiscovery bbd, BeanManager beanManager) { bbd.addAnnotatedType(beanManager.createAnnotatedType(ConfigurationValueProducer.class)); }
public void addScope(@Observes final BeforeBeanDiscovery event) { event.addScope(DeploymentScoped.class, true, false); }
public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event) { event.addScope(BusinessProcessScoped.class, true, true); }
public void addACustomScope(@Observes final BeforeBeanDiscovery event) { event.addScope(BusinessScoped.class, true, false); }
public void addScope(@Observes final BeforeBeanDiscovery event) { event.addScope(ViewScoped.class, true, true); }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { LOGGER.config("Scanning for Snoop clients"); }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { LOGGER.config("Scanning for Eureka clients"); }
public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event) { event.addScope(BusinessProcessScoped.class, true, true); event.addScope(ThreadScoped.class, true, false); }
public void addScope(@Observes final BeforeBeanDiscovery event) { Assert.requireNonNull(event, "event"); event.addScope(ClientScoped.class, true, false); }
/** * beforeBeanDiscovery is triggered before scanning process. Its purpose is to notify user that * scanning process has started. */ void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { if (NLIGHTEN_CDI_DEBUG) { logger.info("Beginning the scanning process for available beans..."); } }
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) { logger.error("============================> beginning the scanning process"); }
/** * Before bean discovery. Adds the bundle and view scopes, nothing more. * * @param event The event */ @SuppressWarnings("static-method") public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event) { event.addScope(ComponentScoped.class, false, false); event.addScope(ViewScoped.class, true, true); }
void started(@Observes final BeforeBeanDiscovery beforeBeanDiscovery) { canWrite = true; }
void logLifecycleEvent(@Observes BeforeBeanDiscovery event) { LOGGER.info("BeforeBeanDiscovery"); }