public Ejb3Handler createHandler(ClassFile cf) throws Exception { return new Ejb3DescriptorHandler(di, cf, dd); } }
private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, MethodMetaData method) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { addAnnotations(annotationClass, annotation, container, method.getMethodName(), method.getMethodParams()); }
private void addDescriptorAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean, String ejbName, boolean isStateful) throws Exception { // EJBTHREE-936: TODO: another wicked patch: jndi-name might mean local-jndi-name // TODO: Make sure this is done after addInterfaces! if(enterpriseBean instanceof JBossGenericBeanMetaData) { Class<?>[] remoteAndBusinessRemoteInterfaces = ProxyFactoryHelper.getRemoteAndBusinessRemoteInterfaces(container); if(remoteAndBusinessRemoteInterfaces.length == 0) { enterpriseBean.setLocalJndiName(enterpriseBean.getMappedName()); enterpriseBean.setMappedName(null); } } addTransactionAnnotations(container, enterpriseBean, ejbName); addAssemblyAnnotations(container, enterpriseBean, ejbName); addSecurityAnnotations(container, enterpriseBean, ejbName); addEjbAnnotations(container, enterpriseBean); addEjb21Annotations(container, isStateful); addWebServiceAnnotations(container, enterpriseBean); }
private void addEjbAnnotations(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws Exception { if (enterpriseBean != null) { if (enterpriseBean instanceof JBossSessionBeanMetaData) { addHomeAnnotations(container, (JBossSessionBeanMetaData) enterpriseBean); addJndiAnnotations(container, (JBossSessionBeanMetaData) enterpriseBean); } addInterceptorMethodAnnotations(container, enterpriseBean); handleResourceRefs(container, enterpriseBean.getResourceReferences()); addMessageDestinationAnnotations(container, enterpriseBean.getMessageDestinationReferences()); addSecurityIdentityAnnotation(container, enterpriseBean.getSecurityIdentity()); addDependencies(container, enterpriseBean); addPoolAnnotations(container, enterpriseBean); addXmlAnnotations(container, enterpriseBean); if (enterpriseBean instanceof JBossSessionBeanMetaData) { addConcurrentAnnotations(container, (JBossSessionBeanMetaData)enterpriseBean); addClusterAnnotations(container, (JBossSessionBeanMetaData)enterpriseBean); addCacheAnnotations(container, (JBossSessionBeanMetaData)enterpriseBean); } } }
@Override protected EJBContainer getStatelessContainer(int ejbIndex, JBossSessionBeanMetaData enterpriseBean) throws Exception { String ejbName = ejbNames.get(ejbIndex); EJBContainer container = super.getStatelessContainer(ejbIndex, enterpriseBean); container.setAssemblyDescriptor(dd.getAssemblyDescriptor()); StatelessImpl annotation = new StatelessImpl(ejbName); if (enterpriseBean != null && !isAnnotatedBean()) { addClassAnnotation(container, Stateless.class, annotation); } if(enterpriseBean instanceof JBossSessionBeanMetaData) addInterfaces(container, (JBossSessionBeanMetaData) enterpriseBean); else log.debug("Not analyzing interfaces on " + enterpriseBean); addDescriptorAnnotations(container, enterpriseBean, ejbName); return container; }
if (consumer != null && !isAnnotatedBean()) addClassAnnotation(container, Consumer.class, annotation); addDescriptorAnnotations(container, consumer, ejbName); addConsumerAnnotations(container, consumer);
private void addDependencies(EJBContainer container, JBossEnterpriseBeanMetaData enterpriseBean) throws Exception { Set<String> depends = enterpriseBean.getDepends(); if (depends != null && depends.size() > 0) { DependsImpl annotation = new DependsImpl(); Iterator<String> dependencies = enterpriseBean.getDepends() .iterator(); while (dependencies.hasNext()) { annotation.addDependency(dependencies.next()); } addClassAnnotation(container, Depends.class, annotation); } if (enterpriseBean.getIgnoreDependency() != null) { for(ResourceInjectionTargetMetaData ignore : enterpriseBean.getIgnoreDependency().getInjectionTargets()) { IgnoreDependencyImpl annotation = new IgnoreDependencyImpl(); MethodMetaData method = new MethodMetaData(); method.setMethodName(ignore.getInjectionTargetName()); addAnnotations(IgnoreDependency.class, annotation, container, method); } } }
private void addClassAnnotation(EJBContainer container, Annotation annotation) { addClassAnnotation(container, annotation.annotationType(), annotation); }
if (dd != null) Ejb3DescriptorHandler handler = new Ejb3DescriptorHandler(this, dd); handler.setCtxProperties(unit.getJndiProperties()); List<Container> containers = handler.getContainers(this, localContainers); for (Container con : containers)
setAnnotationPropertyField(field, annotation, property.getPropertyValue()); addClassAnnotation(container, annotationClass, annotation); addAnnotations(annotationClass, annotation, container, method);
addClassAnnotation(container, ResourceAdapter.class, adapter); if (isAnnotatedBean()) addClassAnnotation(container, MessageDriven.class, annotation); addDefaultActivationConfig(container, mdb);
/** * Interceptors are additive. What's in the annotations and in the XML is * merged */ private void addClassLevelInterceptorBindingAnnotations( EJBContainer container, InterceptorBindingMetaData binding) throws ClassNotFoundException { Interceptors interceptors = (Interceptors) container .resolveAnnotation(Interceptors.class); if (binding != null) { Interceptors impl = createInterceptorsFromInterceptorBinding(interceptors, binding); addClassAnnotation(container, impl.annotationType(), impl); } boolean exclude = false; if (binding != null) exclude = binding.isExcludeDefaultInterceptors(); if (exclude && container.resolveAnnotation(ExcludeDefaultInterceptors.class) == null) { addClassAnnotation(container, ExcludeDefaultInterceptors.class, new ExcludeDefaultInterceptorsImpl()); } }
overrideAnnotations(container, declaredMethod, annotationClass .getName(), annotation); annotations.addAnnotation(methods[methodIndex], annotationClass, annotation); overrideAnnotations(container, methods[methodIndex], annotationClass.getName(), annotation); foundMethod = true; annotations.addAnnotation(methods[methodIndex], annotationClass, annotation); overrideAnnotations(container, methods[methodIndex], annotationClass.getName(), annotation); foundMethod = true; annotations .addAnnotation(member, annotationClass, annotation); overrideAnnotations(container, member, annotationClass .getName(), annotation); + " method annotation to " + member); annotations.addAnnotation(member, annotationClass, annotation); overrideAnnotations(container, member, annotationClass.getName(), annotation);
addClassLevelInterceptorBindingAnnotations(container, binding); definesInterceptors = true; definesInterceptors = addMethodLevelInterceptorBindingAnnotations( container, binding);
if(hasPublicMethod(ejbClass, "ejbCreate")) addAnnotations(annotationClass, annotation, container, method); annotationClass = javax.ejb.PostActivate.class; method.setMethodName("ejbActivate"); addAnnotations(annotationClass, annotation, container, method); addAnnotations(annotationClass, annotation, container, method); addAnnotations(annotationClass, annotation, container, method); method.setMethodName("setSessionContext"); addAnnotations(annotationClass, annotation, container, method);
addClassAnnotation(container, RemoteHomeBinding.class, homeBinding); addClassAnnotation(container, RemoteBinding.class, remoteBindingAnnotation); log.debug("Adding " + RemoteBinding.class.getName() + " to " + container.toString() + ": " + remoteBindingAnnotation.toString()); if (bindingsList == null || bindingsList.size() == 0) addSimpleJndiAnnotations(container, enterpriseBean); return; addClassAnnotation(container, RemoteBindings.class, bindingsAnnotation);
@Override protected StatefulContainer getStatefulContainer(int ejbIndex, JBossSessionBeanMetaData enterpriseBean) throws Exception { String ejbName = ejbNames.get(ejbIndex); StatefulContainer container = super.getStatefulContainer(ejbIndex, enterpriseBean); container.setAssemblyDescriptor(dd.getAssemblyDescriptor()); StatefulImpl annotation = new StatefulImpl(ejbName); if (enterpriseBean != null && !isAnnotatedBean()) { addClassAnnotation(container, annotation); } if(enterpriseBean instanceof JBossSessionBeanMetaData) addInterfaces(container, (JBossSessionBeanMetaData) enterpriseBean); else log.trace("Not analyzing interfaces on " + enterpriseBean); addDescriptorAnnotations(container, enterpriseBean, ejbName, true); return container; }
addClassAnnotation(container, TransactionManagement.class, annotation); addAnnotations(TransactionTimeout.class, timeoutAnnotation, container, method.getMethodName(), null); addAnnotations(TransactionAttribute.class, annotation, container, method);
private void addServiceAnnotations(EJBContainer container, JBossServiceBeanMetaData service) throws ClassNotFoundException { if (service == null) return; String management = service.getManagement(); if (management != null) { ManagementImpl annotation = new ManagementImpl(di.getClassLoader().loadClass(management)); addClassAnnotation(container, Management.class, annotation); } }
@Override protected ServiceContainer getServiceContainer(int ejbIndex, JBossServiceBeanMetaData service) throws Exception { String ejbName = ejbNames.get(ejbIndex); ServiceContainer container = super.getServiceContainer(ejbIndex, service); ServiceImpl annotation = new ServiceImpl((Service) container .resolveAnnotation(Service.class)); container.setAssemblyDescriptor(dd.getAssemblyDescriptor()); if (service != null && !isAnnotatedBean()) { if (service.getObjectName() != null) annotation.setObjectName(service.getObjectName()); if (service.getEjbName() != null) annotation.setName(service.getEjbName()); if (service.getXmbean() != null) annotation.setXMBean(service.getXmbean()); addClassAnnotation(container, Service.class, annotation); } addInterfaces(container, service); addDescriptorAnnotations(container, service, ejbName); addServiceAnnotations(container, service); return container; }