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

项目:tomee    文件:HessianExtension.java   
protected <X> void findHessianWebServices(final @Observes ProcessBean<X> processBean) {
    if (ProcessSessionBean.class.isInstance(processBean)) {
        return;
    }

    final Bean<X> bean = processBean.getBean();
    final Class<?> beanClass = bean.getBeanClass();
    for (final Class<?> itf : beanClass.getInterfaces()) {
        final Hessian hessian = itf.getAnnotation(Hessian.class);
        final String key = "openejb.hessian." + beanClass.getName() + "_" + itf.getName() + ".path";
        final String path = appInfo.properties.getProperty(key, SystemInstance.get().getProperty(key));
        if (hessian != null || path != null) {
            toDeploy.add(new Deployment(itf, path, bean));
        }
    }
}
项目:transaction-cdi    文件:TransactionExtension.java   
/**
 * Observes {@link ProcessManagedBean} event.
 *
 * @param event {@link ProcessManagedBean} event.
 */
<X> void processBean(
    @Observes ProcessManagedBean<X> event)
{
    boolean sessionBean = event instanceof ProcessSessionBean<?>;
    AnnotatedType<X> annotatedType = event.getAnnotatedBeanClass();
    boolean hasClassInterceptor = annotatedType
        .isAnnotationPresent(Transactional.class);
    if (hasClassInterceptor && sessionBean)
    {
        event.addDefinitionError(new RuntimeException(
            "@Transactional is forbidden for session bean "
                + event.getBean()));
    }
    else
    {
        TransactionAttribute classAttr = annotatedType
            .getAnnotation(TransactionAttribute.class);
        for (AnnotatedMethod<? super X> am : annotatedType.getMethods())
        {
            boolean hasMethodInterceptor = am
                .isAnnotationPresent(Transactional.class);
            if (hasMethodInterceptor && sessionBean)
            {
                event.addDefinitionError(new RuntimeException(
                    "@Transactional is forbidden for session bean method "
                    + am));
            }
            else if (hasClassInterceptor || hasMethodInterceptor)
            {
                TransactionAttribute attr = am
                    .getAnnotation(TransactionAttribute.class);
                Method method = am.getJavaMember();
                TransactionAttributeType attrType =
                    mergeTransactionAttributes(classAttr, attr);
                transactionAttributes.put(method, attrType);
            }
        }
    }
}
项目:Mastering-Java-EE-Development-with-WildFly    文件:ObserverExtension.java   
<T> void processSessionBean(@Observes ProcessSessionBean<T> psb) {
    logger.info("finished the scanning process");
    processSessionBean++;
}