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 addInitAnnotations(EJBContainer container, InitMethodsMetaData list, String ejbName) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { if (list != null) { for (InitMethodMetaData initMethod : list) { NamedMethodMetaData method = initMethod.getBeanMethod(); InitImpl annotation = new InitImpl(); addAnnotations(Init.class, annotation, container, method); } } }
private void addRemoveAnnotations(EJBContainer container, RemoveMethodsMetaData list, String ejbName) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { if (list != null) { for (RemoveMethodMetaData removeMethod : list) { NamedMethodMetaData method = removeMethod.getBeanMethod(); RemoveImpl annotation = new RemoveImpl(removeMethod.isRetainIfException()); addAnnotations(Remove.class, annotation, container, method); } } }
private void addExcludeAnnotations(EJBContainer container, ExcludeListMetaData list, String ejbName) throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException { if (list != null && list.getMethods() != null) { for(MethodMetaData method : list.getMethods()) { if (method.getEjbName().equals(ejbName)) { DenyAllImpl annotation = new DenyAllImpl(); addAnnotations(DenyAll.class, annotation, container, method); } } } }
private void addAnnotations(Class<? extends Annotation> annotationClass, Annotation annotation, EJBContainer container, String methodName, MethodParametersMetaData params) { try { AnnotationRepository annotations = container.getAnnotations(); if (methodName.equals("*")) { log.debug("adding " + annotationClass.getName() + " annotation to " + ejbClass.getName() + "." + methodName); for (java.lang.reflect.Method declaredMethod : ejbClass .getDeclaredMethods()) { annotations.addAnnotation(declaredMethod, annotationClass, annotation); overrideAnnotations(container, declaredMethod, annotationClass .getName(), annotation); } } else { if (params == null) { java.lang.reflect.Method[] methods = ejbClass.getMethods(); boolean foundMethod = false; for (int methodIndex = 0; methodIndex < methods.length; ++methodIndex) { if (methods[methodIndex].getName().equals(methodName)) { log.debug("adding " + annotationClass.getName() + " method annotation to " + methods[methodIndex]);
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);
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); } } }
addAnnotations(annotationClass, annotation, container, method);
addAnnotations(TransactionTimeout.class, timeoutAnnotation, container, method.getMethodName(), null); addAnnotations(TransactionAttribute.class, annotation, container, method);
for(MethodAttributeMetaData method : currentMessage) addAnnotations(CurrentMessage.class, annotation, container, method); addAnnotations(MessageProperties.class, annotation, container, method);
addAnnotations(PermitAll.class, annotation, container, method); } else + method.getMethodParams() + ") of EJB " + method.getEjbName() + ": " + Arrays.asList(annotation.value())); addAnnotations(RolesAllowed.class, annotation, container, method);