Java 类javax.enterprise.inject.spi.BeforeBeanDiscovery 实例源码

项目:wildfly-swarm    文件:MetricCdiInjectionExtension.java   
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));
}
项目:deltaspike    文件:ViewScopedExtension.java   
/**
 * 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);
}
项目:deltaspike    文件:SchedulerExtension.java   
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;
        }
    }
}
项目:deltaspike    文件:InterDynExtension.java   
@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();
    }
}
项目:cito    文件:ExtensionTest.java   
@Test
public void addScope() {
    final BeforeBeanDiscovery beforeBeanDiscovery = mock(BeforeBeanDiscovery.class);

    this.extension.addScope(beforeBeanDiscovery);

    verify(beforeBeanDiscovery).addScope(WebSocketScope.class, true, false);
    verifyNoMoreInteractions(beforeBeanDiscovery);
}
项目:property-inject    文件:PropertyInjectionExtension.java   
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);
}
项目:property-inject    文件:PropertyInjectionExtension.java   
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());
    }
}
项目:opendata-common    文件:SchedulerExtension.java   
void beforeBeanDiscovery( @Observes BeforeBeanDiscovery type )
        throws SchedulerException
{
    StdSchedulerFactory fact = new StdSchedulerFactory();
    fact.initialize( getClass().getResourceAsStream( "quartz.properties" ) );
    scheduler = fact.getScheduler();
}
项目:wildfly-swarm    文件:MPJWTExtension.java   
/**
 * 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));
}
项目:wildfly-swarm    文件:MetricCdiInjectionExtension.java   
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));
}
项目:wildfly-swarm    文件:HystrixExtension.java   
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());
}
项目:appformer    文件:WorkspaceScopedExtension.java   
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
    if (logger.isDebugEnabled()) {
        logger.debug("Before bean discovery, adding WosrkspaceScoped");
    }

    bbd.addScope(WorkspaceScoped.class,
                 true,
                 false);
}
项目:switchyard    文件:SwitchYardCDIServiceDiscovery.java   
/**
 * {@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());
}
项目:kie-wb-distributions    文件:DeploymentValidator.java   
public void validateNiogit(@Observes BeforeBeanDiscovery bbd) {
    final File niogit = getNiogitDir();

    if (niogit.exists()) {
        failIfNotMigrated(niogit);
    }
}
项目:metrics-cdi    文件:MetricsExtension.java   
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));
}
项目:deltaspike    文件:PersistenceUnitDescriptorInitExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery before)
{
    isActivated = ClassDeactivationUtils.isActivated(getClass());

    if (!isActivated)
    {
        return;
    }

    PersistenceUnitDescriptorProvider.getInstance().init();
}
项目:deltaspike    文件:GlobalInterceptorExtension.java   
@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);
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:ObserverExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
    logger.info("beginning the scanning process");
    beforeBeanDiscovery++;
}
项目:aries-jpa    文件:TransactionExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event, BeanManager manager) {
    event.addAnnotatedType(manager.createAnnotatedType(TransactionSupport.class));
    event.addAnnotatedType(manager.createAnnotatedType(TransactionalInterceptor.class));
    event.addInterceptorBinding(Transactional.class);
}
项目:wildfly-microprofile-config    文件:ConfigExtension.java   
private void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd, BeanManager bm) {
    AnnotatedType<ConfigProducer> configBean = bm.createAnnotatedType(ConfigProducer.class);
    bbd.addAnnotatedType(configBean);
}
项目:snoopee    文件:SnoopEEScannerExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
    LOGGER.config("Scanning for SnoopEE clients");
}
项目:snoopee    文件:SnoopEEScannerExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
    LOGGER.config("Scanning for SnoopEE clients");
}
项目:ozark    文件:CdiUtils.java   
/**
 * @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());
    }
}
项目:property-inject    文件:PropertyInjectionExtensionTest.java   
@Before
public void setup() {
    ext = new PropertyInjectionExtension();
    event = mock(BeforeBeanDiscovery.class);
    beanManager = mock(BeanManager.class);
}
项目:weld-vertx    文件:ServiceProxyExtension.java   
void init(@Observes BeforeBeanDiscovery event) {
    serviceInterfaces = new HashSet<>();
}
项目:wildfly-swarm    文件:InjectConfigViewExtension.java   
public void addConfigView(@Observes BeforeBeanDiscovery bbd, BeanManager beanManager) {
    bbd.addAnnotatedType(beanManager.createAnnotatedType(ConfigurationValueProducer.class));
}
项目:wildfly-swarm    文件:DeploymentScopedExtension.java   
public void addScope(@Observes final BeforeBeanDiscovery event) {
    event.addScope(DeploymentScoped.class, true, false);
}
项目:flowable-engine    文件:FlowableExtension.java   
public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event) {
    event.addScope(BusinessProcessScoped.class, true, true);
}
项目:drools-workshop    文件:BusinessScopeExtension.java   
public void addACustomScope(@Observes final BeforeBeanDiscovery event) {
    event.addScope(BusinessScoped.class, true, false);
}
项目:PedidoVenda    文件:ViewContextExtension.java   
public void addScope(@Observes final BeforeBeanDiscovery event) {
    event.addScope(ViewScoped.class, true, true);
}
项目:snoop    文件:SnoopScannerExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
    LOGGER.config("Scanning for Snoop clients");
}
项目:snoop    文件:SnoopEurekaScannerExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
   LOGGER.config("Scanning for Eureka clients");
}
项目:SecureBPMN    文件:ActivitiExtension.java   
public void beforeBeanDiscovery(@Observes final BeforeBeanDiscovery event) {
  event.addScope(BusinessProcessScoped.class, true, true);
  event.addScope(ThreadScoped.class, true, false);
}
项目:dolphin-platform    文件:ClientScopeExtension.java   
public void addScope(@Observes final BeforeBeanDiscovery event) {
    Assert.requireNonNull(event, "event");
    event.addScope(ClientScoped.class, true, false);
}
项目:nlighten    文件:CDILoggingExtension.java   
/**
 * 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...");
  }
}
项目:dropwizard-weld    文件:DropwizardCdiExtension.java   
void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {
    logger.error("============================> beginning the scanning process");
}
项目:osgi.ee    文件:ScopeExtension.java   
/**
 * 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);
}
项目:johnzon    文件:JohnzonCdiExtension.java   
void started(@Observes final BeforeBeanDiscovery beforeBeanDiscovery) {
    canWrite = true;
}
项目:Java-EE    文件:LifeCycleLogger.java   
void logLifecycleEvent(@Observes BeforeBeanDiscovery event) {
    LOGGER.info("BeforeBeanDiscovery");
}
项目:goFitOne    文件:ViewContextExtension.java   
public void addScope(@Observes final BeforeBeanDiscovery event)
{
    event.addScope(ViewScoped.class, true, true);
}