}
}
public <T> void processBean(@Observes ProcessBeanImpl<T> event)
{
Annotated annotated = event.getAnnotated();
Bean<T> bean = event.getBean();
if (annotated == null || bean instanceof EjbGeneratedBean
|| !(bean instanceof AbstractBean<?>)) {
return;
}
AbstractBean<T> absBean = (AbstractBean<T>) bean;
if (annotated.isAnnotationPresent(Stateful.class)
|| annotated.isAnnotationPresent(Stateless.class)
|| annotated.isAnnotationPresent(Singleton.class)
|| annotated.isAnnotationPresent(MessageDriven.class)
|| annotated.isAnnotationPresent(JmsMessageListener.class)) {
EjbContainer ejbContainer = EjbContainer.create();
AnnotatedType<T> annType = absBean.getAnnotatedType();
if (annType != null) {
ejbContainer.createBean(annType, absBean.getInjectionTarget());
if (event instanceof ProcessBeanImpl)
((ProcessBeanImpl) event).veto();
}
}
if (annotated.isAnnotationPresent(Jndi.class)) {
Jndi jndi = annotated.getAnnotation(Jndi.class);
String jndiName = jndi.value();
if ("".equals(jndiName)) {
jndiName = bean.getBeanClass().getSimpleName();
}
JndiBeanProxy<T> proxy = new JndiBeanProxy<T>(_injectManager, bean);
if (log.isLoggable(Level.FINE))
log.fine("bind to JNDI '" + jndiName + "' for " + bean);
try {
com.caucho.naming.Jndi.bindDeepShort(jndiName, proxy);
} catch (Exception e) {
log.log(Level.FINE, e.toString(), e);
}
}
if (annotated.isAnnotationPresent(MBean.class)) {
MBean manage = annotated.getAnnotation(MBean.class);
String mbeanName = manage.value();
if ("".equals(mbeanName))
mbeanName = "type=" + bean.getBeanClass().getSimpleName();
AnnotatedType<?> annType = (AnnotatedType<?>) annotated;
try {
Jmx.register(new BeanMBean(_injectManager, bean, annType), mbeanName);
} catch (Exception e) {
log.log(Level.FINE, e.toString(), e);
}
}
if (annotated.isAnnotationPresent(BamService.class)) {
BamService service = annotated.getAnnotation(BamService.class);
HempBroker broker = HempBroker.getCurrent();
broker.addStartupActor(event.getBean(), service.name(), service
.threadMax());
}
if (annotated.isAnnotationPresent(AdminService.class)) {
AdminService service = annotated.getAnnotation(AdminService.class);
Server server = Server.getCurrent();
if (server == null) {
throw new ConfigException(L