Author: arne
Date: Fri Jan 4 13:14:03 2013
New Revision: 1428833
URL: http://svn.apache.org/viewvc?rev=1428833&view=rev
Log:
OWB-745: Removed unnecessary code
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java?rev=1428833&r1=1428832&r2=1428833&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/WebBeansInterceptorConfig.java
Fri Jan 4 13:14:03 2013
@@ -266,174 +266,31 @@ public final class WebBeansInterceptorCo
postActivateClass = ejbPlugin.getPostActivateClass();
}
- if(annotatedType != null)
- {
- // interceptor binding
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
annotatedType,
-
AroundInvoke.class, true,
-
false, stack, null, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
annotatedType,
-
PostConstruct.class, true,
-
false, stack, null, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
annotatedType,
-
PreDestroy.class, true,
-
false, stack, null, true);
-
- if (null != ejbPlugin)
- {
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
annotatedType,
-
prePassivateClass,
-
true, false, stack,
-
null, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
annotatedType,
-
postActivateClass,
-
true, false, stack,
-
null, true);
+ // interceptor binding
+
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
annotatedType,
+
AroundInvoke.class, true,
+
false, stack, null, true);
+
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
annotatedType,
+
PostConstruct.class, true,
+
false, stack, null, true);
+
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
annotatedType,
+
PreDestroy.class, true,
+
false, stack, null, true);
- }
- }
- else
+ if (null != ejbPlugin)
{
- // interceptor binding
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
AroundInvoke.class, true,
-
false, stack, null, true);
+
annotatedType,
+
prePassivateClass,
+
true, false, stack,
+
null, true);
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
PostConstruct.class, true,
-
false, stack, null, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
PreDestroy.class, true,
-
false, stack, null, true);
-
- if (null != ejbPlugin)
- {
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
prePassivateClass,
-
true, false, stack,
-
null, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
+
annotatedType,
postActivateClass,
true, false, stack,
null, true);
-
- }
-
}
}
-
- }
-
- /**
- * Add configured interceptors, combining the bindings at the
component-level with annotations on methods
- * @param component
- * @param clazz the bean class
- * @param stack the current interceptor stack for the bean
- * @param componentInterceptors the configured interceptors from the
component level
- * @param resolvedComponentInterceptorBindings complete (including
transitive) set of component-level interceptor bindings
- */
- private void addMethodInterceptors(AbstractInjectionTargetBean<?>
component, Class<?> clazz, List<InterceptorData> stack, Set<Interceptor<?>>
componentInterceptors,
- Set<Annotation>
resolvedComponentInterceptorBindings)
- {
- AnnotationManager annotationManager =
webBeansContext.getAnnotationManager();
-
- // All methods, not just those declared
- Method[] methods = clazz.getMethods();
- Set<Method> set = new HashSet<Method>();
- for(Method m : methods)
- {
- set.add(m);
- }
-
- //GE : I added for private, protected etc. methods.
- //Not just for public methods.
- methods =
webBeansContext.getSecurityService().doPrivilegedGetDeclaredMethods(clazz);
- for(Method m : methods)
- {
- set.add(m);
- }
-
- methods = set.toArray(new Method[set.size()]);
-
- for (Method method : methods)
- {
- Set<Annotation> interceptorAnns = new HashSet<Annotation>();
- if (annotationManager.hasInterceptorBindingMetaAnnotation(
- method.getDeclaredAnnotations()))
- {
- Annotation[] anns =
- annotationManager.getInterceptorBindingMetaAnnotations(
- method.getAnnotations());
- for (Annotation ann : anns)
- {
- interceptorAnns.add(ann);
- }
- }
-
- // To find the right interceptors, we need to consider method and
- // class-level combined
- interceptorAnns.addAll(resolvedComponentInterceptorBindings);
-
- if (!interceptorAnns.isEmpty())
- {
- Annotation[] result = new Annotation[interceptorAnns.size()];
- result = interceptorAnns.toArray(result);
-
- Set<Interceptor<?>> setInterceptors =
findDeployedWebBeansInterceptor(result);
-
- if (componentInterceptors != null)
- {
- setInterceptors.removeAll(componentInterceptors);
- }
-
- Iterator<Interceptor<?>> it = setInterceptors.iterator();
-
- while (it.hasNext())
- {
- WebBeansInterceptorBean<?> interceptor =
(WebBeansInterceptorBean<?>) it.next();
-
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
AroundInvoke.class,
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
PostConstruct.class,
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
PreDestroy.class, true,
-
true, stack, method,
-
true);
-
- OpenWebBeansEjbLCAPlugin ejbPlugin =
webBeansContext.getPluginLoader().getEjbLCAPlugin();
- if (null != ejbPlugin)
- {
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
ejbPlugin.getPrePassivateClass(),
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
ejbPlugin.getPostActivateClass(),
-
true, true, stack,
-
method, true);
- }
-
-
- }
- }
- }
-
}
@SuppressWarnings("unchecked")
@@ -509,47 +366,24 @@ public final class WebBeansInterceptorCo
WebBeansInterceptorBean<?> interceptor =
(WebBeansInterceptorBean<?>) it.next();
AnnotatedType<?> interAnnoType =
interceptor.getAnnotatedType();
-
- if(interAnnoType == null)
- {
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
AroundInvoke.class,
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
PostConstruct.class,
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interceptor.getClazz(),
-
PreDestroy.class,
-
true, true, stack,
-
method, true);
- }
- else
- {
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interAnnoType,
-
AroundInvoke.class,
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interAnnoType,
-
PostConstruct.class,
-
true, true, stack,
-
method, true);
-
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
-
interAnnoType,
-
PreDestroy.class,
-
true, true, stack,
-
method, true);
- }
+
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
+
interAnnoType,
+
AroundInvoke.class,
+
true, true, stack,
+
method, true);
+
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
+
interAnnoType,
+
PostConstruct.class,
+
true, true, stack,
+
method, true);
+
webBeansContext.getWebBeansUtil().configureInterceptorMethods(interceptor,
+
interAnnoType,
+
PreDestroy.class,
+
true, true, stack,
+
method, true);
}
}
}
-
}
/*
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
URL:
http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java?rev=1428833&r1=1428832&r2=1428833&view=diff
==============================================================================
---
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
(original)
+++
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Fri Jan 4 13:14:03 2013
@@ -1055,75 +1055,6 @@ public final class WebBeansUtil
* @param defineWithInterceptorBinding if interceptor is defined with
WebBeans
* spec, not EJB spec
*/
- public void configureInterceptorMethods(Interceptor<?> webBeansInterceptor,
- Class<?> interceptorClass,
- Class<? extends Annotation>
annotation,
- boolean definedInInterceptorClass,
- boolean definedInMethod,
- List<InterceptorData> stack,
- Method
annotatedInterceptorClassMethod,
- boolean
defineWithInterceptorBinding)
- {
- InterceptorData intData;
- Set<Method> methods = null;
- OpenWebBeansEjbLCAPlugin ejbPlugin;
- Class<? extends Annotation> prePassivateClass = null;
- Class<? extends Annotation> postActivateClass = null;
-
- ejbPlugin = webBeansContext.getPluginLoader().getEjbLCAPlugin();
- if(ejbPlugin != null)
- {
- prePassivateClass = ejbPlugin.getPrePassivateClass();
- postActivateClass = ejbPlugin.getPostActivateClass();
- }
-
- //Check for default constructor of EJB based interceptor
- if(webBeansInterceptor == null)
- {
- if(definedInInterceptorClass)
- {
- Constructor<?> ct = getNoArgConstructor(interceptorClass);
- if (ct == null)
- {
- throw new WebBeansConfigurationException("class : " +
interceptorClass.getName()
- + " must have no-arg constructor");
- }
- }
- }
-
- if (annotation.equals(AroundInvoke.class) ||
annotation.equals(AroundTimeout.class))
- {
- methods = checkAroundInvokeAnnotationCriterias(interceptorClass,
annotation);
- }
- else if (annotation.equals(PostConstruct.class) || ((postActivateClass
!= null) && (annotation.equals(postActivateClass)))
- || annotation.equals(PreDestroy.class) || ((prePassivateClass
!= null) && (annotation.equals(prePassivateClass))))
- {
- methods = checkCommonAnnotationCriterias(interceptorClass,
annotation, definedInInterceptorClass);
- }
-
- if (methods != null && !methods.isEmpty())
- {
- for (Method method : methods)
- {
- intData = new
InterceptorDataImpl(defineWithInterceptorBinding, webBeansContext);
-
intData.setDefinedInInterceptorClass(definedInInterceptorClass);
- intData.setDefinedInMethod(definedInMethod);
-
intData.setInterceptorBindingMethod(annotatedInterceptorClassMethod);
- intData.setWebBeansInterceptor(webBeansInterceptor);
-
- if (definedInInterceptorClass)
- {
- intData.setInterceptorClass(interceptorClass);
- }
-
- intData.setInterceptorMethod(method, annotation);
-
- stack.add(intData);
- }
- }
- }
-
-
public <T> void configureInterceptorMethods(Interceptor<?>
webBeansInterceptor,
AnnotatedType<T>
annotatedType,
Class<? extends Annotation>
annotation,