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

项目:cdi    文件:MybatisExtension.java   
/**
 * Collect all SqlSessionFactory producers annotated with SessionFactoryProvider.
 *
 * @param <T> the generic type
 * @param <X> the generic type
 * @param pp the pp
 */
@SuppressWarnings("UnusedDeclaration")
protected <T, X> void processProducer(@Observes final ProcessProducer<T, X> pp) {
  final AnnotatedMember<T> am = pp.getAnnotatedMember();
  final boolean isAnnotated = am.isAnnotationPresent(SessionFactoryProvider.class);
  final boolean isSqlSessionFactory = am.getBaseType().equals(SqlSessionFactory.class);
  final Object[] logData = { am.getJavaMember().getDeclaringClass().getSimpleName(), am.getJavaMember().getName() };
  if (isAnnotated && isSqlSessionFactory) {
    LOGGER.log(Level.INFO, "MyBatis CDI Module - SqlSessionFactory producer {0}.{1}", logData);
    this.sessionProducers.add(new BeanKey((Class<Type>) (Type) SqlSession.class, am.getAnnotations()));
  } else if (isAnnotated && !isSqlSessionFactory) {
    LOGGER.log(Level.SEVERE, "MyBatis CDI Module - Invalid return type (Must be SqlSessionFactory): {0}.{1}",
        logData);
    pp.addDefinitionError(new MybatisCdiConfigurationException(String
        .format("SessionFactoryProvider producers must return SqlSessionFactory (%s.%s)", logData[0], logData[1])));
  } else if (!isAnnotated && isSqlSessionFactory) {
    LOGGER.log(Level.WARNING,
        "MyBatis CDI Module - Ignored SqlSessionFactory producer because it is not annotated with @SessionFactoryProvider: {0}.{1}",
        logData);
  }
}
项目:axon-cdi    文件:AxonCdiExtension.java   
<T, X extends CommandBus> void processCommandBusProducer(
        @Observes final ProcessProducer<T, X> processProducer,
        final BeanManager beanManager) {

    AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();

    if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
        Producer<X> originalProducer = processProducer.getProducer();
        Producer<X> producer = new AutoConfiguringCommandBusProducer<>(originalProducer,
                annotatedMember, getAggregateRoots(), getCommandHandlers(), beanManager);
        processProducer.setProducer(producer);
    }
}
项目:axon-cdi    文件:AxonCdiExtension.java   
<T, X extends EventStore> void processEventStoreProducer(
        @Observes final ProcessProducer<T, X> processProducer,
        final BeanManager beanManager) {
    AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
    if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
        Producer<X> originalProducer = processProducer.getProducer();
        Producer<X> producer = new AutoConfiguringEventStoreProducer<>(originalProducer,
                annotatedMember,
                getEventHandlers(),
                getSagas(), beanManager);
        processProducer.setProducer(producer);
    }
}
项目:axon-cdi    文件:AxonCdiExtension.java   
<T, X extends Snapshotter> void processSnapshotterProducer(
        @Observes final ProcessProducer<T, X> processProducer,
        final BeanManager beanManager) {
    Producer<X> originalProducer = processProducer.getProducer();
    AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
    if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
        Producer<X> producer = new AutoConfiguringAggregateSnapshotterProducer<>(originalProducer,
                annotatedMember, getAggregateRoots(), beanManager);
        processProducer.setProducer(producer);
    }
}
项目:axon-cdi    文件:AxonCdiExtension.java   
<T, X extends SagaRepository<?>> void processSagaRepositoryProducer(
        @Observes final ProcessProducer<T, X> processProducer,
        final BeanManager beanManager) {
    Producer<X> originalProducer = processProducer.getProducer();
    AnnotatedMember<T> annotatedMember = processProducer.getAnnotatedMember();
    if (annotatedMember.isAnnotationPresent(AutoConfigure.class)) {
        Producer<X> producer = new AutoConfiguringSagaRepositoryProducer<>(originalProducer,
                annotatedMember, beanManager);
        processProducer.setProducer(producer);
    }
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:ObserverExtension.java   
<K, V> void processProducer(@Observes ProcessProducer<K, V> pp) {
    logger.info("finished the scanning process");
    processProducer++;
}
项目:jpa-unit    文件:JpaUnitCdiExtension.java   
public <T> void registerProducer(@Observes final ProcessProducer<T, EntityManager> pb) {
    pb.setProducer(new EntityManagerProducerProxy(pb.getProducer()));
}
项目:wildfly-swarm    文件:MPJWTExtension.java   
void doProcessProducers(@Observes ProcessProducer pp) {
}
项目:wildfly-swarm    文件:ImplicitArchiveExtension.java   
@SuppressWarnings("unused")
<X, T> void processProducer(@Observes ProcessProducer<X, T> pp, BeanManager beanManager) throws Exception {
}
项目:wildfly-swarm    文件:AbstractNetworkExtension.java   
@SuppressWarnings("unused")
void process(@Observes ProcessProducer<?, T> p, BeanManager beanManager) throws Exception {
    p.setProducer(producer(p.getProducer()));
}
项目:Camel    文件:CdiCamelExtension.java   
private <T extends CamelContext> void camelContextProducers(@Observes ProcessProducer<?, T> pp, BeanManager manager) {
    pp.setProducer(environment.camelContextProducer(pp.getProducer(), pp.getAnnotatedMember(), manager, this));
}
项目:appformer    文件:SystemConfigProducer.java   
public void processSystemFSProducer(@Observes ProcessProducer<?, FileSystem> pp) {
    if (pp.getAnnotatedMember().getJavaMember().getName().equals("systemFS")) {
        ioStrategyBeanNotFound = false;
    }
}
项目:appformer    文件:SystemConfigProducer.java   
public void processIOServiceProducer(@Observes ProcessProducer<?, IOService> pp) {
    if (pp.getAnnotatedMember().getJavaMember().getName().equals("ioStrategy")) {
        ioStrategyBeanNotFound = false;
    }
}
项目:spearal-jpa2    文件:SpearalExtension.java   
public void wrapEntityManager(@Observes ProcessProducer<?, EntityManager> event) {
    if (event.getAnnotatedMember().isAnnotationPresent(SpearalEnabled.class))
        event.setProducer(new EntityManagerProducerWrapper(event.getProducer()));
}
项目:spearal-jpa2    文件:SpearalExtension.java   
public void wrapEntityManagerFactory(@Observes ProcessProducer<?, EntityManagerFactory> event, BeanManager beanManager) {
    if (event.getAnnotatedMember().isAnnotationPresent(SpearalEnabled.class))
        event.setProducer(new EntityManagerFactoryProducerWrapper(event.getProducer(), beanManager));
}
项目:Java-EE    文件:LifeCycleLogger.java   
<T, X> void logLifecycleEvent(@Observes ProcessProducer<T, X> event) {
    LOGGER.info("ProcessProducer: annotatedMember=" + event.getAnnotatedMember());
}
项目:camel-cdi    文件:CdiCamelExtension.java   
private <T extends CamelContext> void camelContextProducers(@Observes ProcessProducer<?, T> pp, BeanManager manager) {
    pp.setProducer(environment.camelContextProducer(pp.getProducer(), pp.getAnnotatedMember(), manager));
}
项目:deltaspike    文件:MockExtension.java   
public <X, T> void onProcessProducer(@Observes ProcessProducer<X, T> processProducer, BeanManager beanManager)
{
    if (!isActivated)
    {
        return;
    }

    for (MockFilter mockFilter : mockFilters)
    {
        if (!mockFilter.isMockedImplementationSupported(beanManager, processProducer.getAnnotatedMember()))
        {
            return;
        }
    }

    final Producer<T> originalProducer = processProducer.getProducer();
    AnnotatedMember<X> annotatedMember = processProducer.getAnnotatedMember();
    List<Annotation> qualifiers = new ArrayList<Annotation>();
    for (Annotation annotation : annotatedMember.getAnnotations())
    {
        if (beanManager.isQualifier(annotation.annotationType()))
        {
            qualifiers.add(annotation);
        }
    }

    Typed typed = annotatedMember.getAnnotation(Typed.class);

    List<Type> foundTypes = new ArrayList<Type>();
    if (typed != null)
    {
        Collections.addAll(foundTypes, typed.value());
    }
    else if (annotatedMember.getBaseType() instanceof Class)
    {
        foundTypes.addAll(extractTypes((Class)annotatedMember.getBaseType()));
    }

    if (foundTypes.isEmpty())
    {
        return;
    }

    processProducer.setProducer(new MockAwareProducerWrapper<T>(
        beanManager, originalProducer, foundTypes, qualifiers));
}