You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by co...@apache.org on 2010/07/26 17:12:34 UTC
svn commit: r979322 - in /openwebbeans/trunk: webbeans-ejb/
webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/
webbeans-impl/ webbeans-impl/src/main/java/org/apache/webbeans/intercept/
webbeans-impl/src/main/java/org/apache/webbeans...
Author: covener
Date: Mon Jul 26 15:12:34 2010
New Revision: 979322
URL: http://svn.apache.org/viewvc?rev=979322&view=rev
Log:
revert r979071 due to bleeding of EJB dependency into -impl
(and two TCK issues needing investigation)
Modified:
openwebbeans/trunk/webbeans-ejb/pom.xml
openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
openwebbeans/trunk/webbeans-impl/pom.xml
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/util/WebBeansUtil.java
Modified: openwebbeans/trunk/webbeans-ejb/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/pom.xml?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/pom.xml (original)
+++ openwebbeans/trunk/webbeans-ejb/pom.xml Mon Jul 26 15:12:34 2010
@@ -33,12 +33,6 @@
<groupId>org.apache.openwebbeans</groupId>
<artifactId>openwebbeans-impl</artifactId>
</dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_3.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
Modified: openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/interceptor/OpenWebBeansEjbInterceptor.java Mon Jul 26 15:12:34 2010
@@ -35,15 +35,12 @@ import javassist.util.proxy.ProxyObject;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.RequestScoped;
import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.interceptor.AroundInvoke;
-import javax.interceptor.AroundTimeout;
import javax.interceptor.InvocationContext;
import org.apache.webbeans.component.InjectionTargetBean;
@@ -216,48 +213,7 @@ public class OpenWebBeansEjbInterceptor
return rv.RETURN_VALUE;
}
-
- /**
- * Around Timeout.
- * @param context invocation ctx
- */
- @AroundTimeout
- public Object callAroundTimeouts(InvocationContext context) throws Exception
- {
- Object retVal = null;
- InjectionTargetBean<?> injectionTarget = (InjectionTargetBean<?>) threadLocal.get();
-
- logger.debug("OpenWebBeansEjbInterceptor: @AroundTimeout called. Trying to run Interceptors.");
-
- if(injectionTarget != null)
- {
- if (WebBeansUtil.isContainsInterceptorMethod(injectionTarget.getInterceptorStack(), InterceptorType.AROUND_TIMEOUT))
- {
- InvocationContextImpl impl = new InvocationContextImpl(null, context.getTarget(), null, null,
- InterceptorUtil.getInterceptorMethods(injectionTarget.getInterceptorStack(), InterceptorType.AROUND_TIMEOUT), InterceptorType.AROUND_TIMEOUT);
- impl.setCreationalContext(threadLocalCreationalContext.get());
- try
- {
- //run OWB interceptors
- impl.proceed();
-
- //run EJB interceptors
- retVal = context.proceed();
- }
- catch (Exception e)
- {
- logger.error(OWBLogConst.ERROR_0008, e, "@AroundTimeout.");
- throw new RuntimeException(e);
- }
- }
- }
- else
- {
- runPrePostForNonContextual(context, InterceptorType.AROUND_TIMEOUT); // TODO: Is this required for activate? It was in POST_CONSTUCT code.
- }
- return retVal;
- }
-
+
/**
* Post construct.
* @param context invocation ctx
@@ -309,88 +265,7 @@ public class OpenWebBeansEjbInterceptor
}
}
}
-
- /**
- * Post activate.
- */
- @PostActivate
- public void afterActivate(InvocationContext context)
- {
- InjectionTargetBean<?> injectionTarget = (InjectionTargetBean<?>) threadLocal.get();
-
- logger.debug("OpenWebBeansEjbInterceptor: @PostActivate called. Trying to run Interceptors.");
-
- if(injectionTarget != null)
- {
- if (WebBeansUtil.isContainsInterceptorMethod(injectionTarget.getInterceptorStack(), InterceptorType.POST_ACTIVATE))
- {
- InvocationContextImpl impl = new InvocationContextImpl(null, context.getTarget(), null, null,
- InterceptorUtil.getInterceptorMethods(
- injectionTarget.getInterceptorStack(),
- InterceptorType.POST_ACTIVATE),
- InterceptorType.POST_ACTIVATE);
- impl.setCreationalContext(threadLocalCreationalContext.get());
- try
- {
- //run OWB interceptors
- impl.proceed();
-
- //run EJB interceptors
- context.proceed();
- }
- catch (Exception e)
- {
- logger.error(OWBLogConst.ERROR_0008, e, "@PostActivate.");
- throw new RuntimeException(e);
- }
- }
- }
- else
- {
- runPrePostForNonContextual(context, InterceptorType.POST_ACTIVATE); // TODO: Is this required for activate? It was in POST_CONSTUCT code.
- }
- }
-
- /**
- * Pre Passivate.
- */
- @PrePassivate
- public void beforePassivate(InvocationContext context)
- {
- InjectionTargetBean<?> injectionTarget = (InjectionTargetBean<?>) threadLocal.get();
-
- logger.debug("OpenWebBeansEjbInterceptor: @PrePassivate called. Trying to run Interceptors.");
-
- if(injectionTarget != null)
- {
- if (WebBeansUtil.isContainsInterceptorMethod(injectionTarget.getInterceptorStack(), InterceptorType.PRE_PASSIVATE))
- {
- InvocationContextImpl impl = new InvocationContextImpl(null, context.getTarget(), null, null,
- InterceptorUtil.getInterceptorMethods(
- injectionTarget.getInterceptorStack(),
- InterceptorType.PRE_PASSIVATE),
- InterceptorType.PRE_PASSIVATE);
- impl.setCreationalContext(threadLocalCreationalContext.get());
- try
- {
- //Call OWB interceptord
- impl.proceed();
-
- //Call EJB interceptors
- context.proceed();
- }
- catch (Exception e)
- {
- logger.error(OWBLogConst.ERROR_0008, e, "@PrePassivate.");
- throw new RuntimeException(e);
- }
- }
- }
- else
- {
- runPrePostForNonContextual(context, InterceptorType.PRE_PASSIVATE); // TODO: Is this required for passivate? It was in the PRE_DESTROY code.
- }
- }
+
/**
* Pre destroy.
* @param context invocation context
@@ -626,10 +501,7 @@ public class OpenWebBeansEjbInterceptor
List<Object> decorators = null;
DelegateHandler delegateHandler = null;
- if (logger.wblWillLogDebug())
- {
- logger.debug("Decorator stack for target {0}", injectionTarget.getDecoratorStack());
- }
+ logger.debug("Decorator stack for target {0}", injectionTarget.getDecoratorStack());
if (injectionTarget.getDecoratorStack().size() > 0)
{
Modified: openwebbeans/trunk/webbeans-impl/pom.xml
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/pom.xml?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/pom.xml (original)
+++ openwebbeans/trunk/webbeans-impl/pom.xml Mon Jul 26 15:12:34 2010
@@ -78,12 +78,6 @@
<artifactId>geronimo-atinject_1.0_spec</artifactId>
<optional>true</optional>
</dependency>
-
- <dependency>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-ejb_3.0_spec</artifactId>
- <optional>true</optional>
- </dependency>
<dependency>
<groupId>org.apache.openwebbeans</groupId>
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorData.java Mon Jul 26 15:12:34 2010
@@ -55,13 +55,6 @@ public interface InterceptorData
public Method getPostConstruct();
/**
- * Gets {@link javax.ejb.PostActivate} annotated method if exist
- * return null otherwise.
- * @return post-activate method
- */
- public Method getPostActivate();
-
- /**
* Gets the {@link javax.annotation.PreDestroy} annotated method
* if exist, returns null otherwise.
* @return pre-destroy method
@@ -69,13 +62,6 @@ public interface InterceptorData
public Method getPreDestroy();
/**
- * Gets {@link javax.ejb.PrePassivate} annotated method if exist
- * return null otherwise.
- * @return pre-passivate method
- */
- public Method getPrePassivate();
-
- /**
* Gets {@link javax.interceptor.AroundInvoke} annotated method
* if exist, returns null otherwise.
* @return around invoke method
@@ -83,13 +69,6 @@ public interface InterceptorData
public Method getAroundInvoke();
/**
- * Gets {@link javax.interceptor.AroundTimeout} annotated method
- * if exist, returns null otherwise.
- * @return around timeout method
- */
- public Method getAroundTimeout();
-
- /**
* Gets interceptor method that this
* interceptor data contains. It is one of
* the post construct, pre-destroy or around-invoke.
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorDataImpl.java Mon Jul 26 15:12:34 2010
@@ -48,22 +48,13 @@ public class InterceptorDataImpl impleme
/** Around invokes method */
private Method aroundInvoke = null;
-
- /** Around timeout method */
- private Method aroundTimeout = null;
/** Post construct methods */
private Method postConstruct = null;
- /** Post activate method */
- private Method postActivate = null;
-
/** Predestroy Method */
private Method preDestroy = null;
- /** Prepassivate Method */
- private Method prePassivate = null;
-
private Interceptor<?> webBeansInterceptor;
/** Defined in the interceptor or bean */
@@ -143,17 +134,6 @@ public class InterceptorDataImpl impleme
/*
* (non-Javadoc)
* @see
- * org.apache.webbeans.intercept.InterceptorData#addAroundTimeout(java.lang
- * .reflect.Method)
- */
- public void setAroundTimeout(Method m)
- {
- this.aroundTimeout = m;
- }
-
- /*
- * (non-Javadoc)
- * @see
* org.apache.webbeans.intercept.InterceptorData#addPostConstruct(java.lang
* .reflect.Method)
*/
@@ -165,17 +145,6 @@ public class InterceptorDataImpl impleme
/*
* (non-Javadoc)
* @see
- * org.apache.webbeans.intercept.InterceptorData#addPostActivate(java.lang
- * .reflect.Method)
- */
- protected void setPostActivate(Method m)
- {
- this.postActivate = m;
- }
-
- /*
- * (non-Javadoc)
- * @see
* org.apache.webbeans.intercept.InterceptorData#addPreDestroy(java.lang
* .reflect.Method)
*/
@@ -186,17 +155,6 @@ public class InterceptorDataImpl impleme
/*
* (non-Javadoc)
- * @see
- * org.apache.webbeans.intercept.InterceptorData#addPrePassivate(java.lang
- * .reflect.Method)
- */
- protected void setPrePassivate(Method m)
- {
- this.prePassivate = m;
- }
-
- /*
- * (non-Javadoc)
* @see org.apache.webbeans.intercept.InterceptorData#getPostConstruct()
*/
public Method getPostConstruct()
@@ -206,15 +164,6 @@ public class InterceptorDataImpl impleme
/*
* (non-Javadoc)
- * @see org.apache.webbeans.intercept.InterceptorData#getPostActivate()
- */
- public Method getPostActivate()
- {
- return this.postActivate;
- }
-
- /*
- * (non-Javadoc)
* @see org.apache.webbeans.intercept.InterceptorData#getPreDestroy()
*/
public Method getPreDestroy()
@@ -224,15 +173,6 @@ public class InterceptorDataImpl impleme
/*
* (non-Javadoc)
- * @see org.apache.webbeans.intercept.InterceptorData#getPrePassivate()
- */
- public Method getPrePassivate()
- {
- return this.prePassivate;
- }
-
- /*
- * (non-Javadoc)
* @see org.apache.webbeans.intercept.InterceptorData#getAroundInvoke()
*/
public Method getAroundInvoke()
@@ -242,15 +182,6 @@ public class InterceptorDataImpl impleme
/*
* (non-Javadoc)
- * @see org.apache.webbeans.intercept.InterceptorData#getAroundTimeout()
- */
- public Method getAroundTimeout()
- {
- return this.aroundTimeout;
- }
-
- /*
- * (non-Javadoc)
* @see
* org.apache.webbeans.intercept.InterceptorData#isDefinedInInterceptorClass
* ()
@@ -342,26 +273,14 @@ public class InterceptorDataImpl impleme
{
return aroundInvoke;
}
- else if (aroundTimeout != null)
- {
- return aroundTimeout;
- }
else if (postConstruct != null)
{
return postConstruct;
}
- else if (postActivate != null)
- {
- return postActivate;
- }
else if (preDestroy != null)
{
return preDestroy;
}
- else if (prePassivate != null)
- {
- return prePassivate;
- }
return null;
}
@@ -369,7 +288,7 @@ public class InterceptorDataImpl impleme
@Override
public boolean isLifecycleInterceptor()
{
- if(this.preDestroy != null || this.postConstruct != null || this.prePassivate != null || this.postActivate != null)
+ if(this.preDestroy != null || this.postConstruct != null)
{
return true;
}
@@ -450,11 +369,8 @@ public class InterceptorDataImpl impleme
StringBuilder sb = new StringBuilder();
sb.append("Class: [").append(webBeansInterceptor.getBeanClass()).append("]");
sb.append(" aroundInvoke [").append(aroundInvoke).append("]");
- sb.append(" aroundTimeout [").append(aroundTimeout).append("]");
sb.append(" postConstruct [").append(postConstruct).append("]");
- sb.append(" postActivate [").append(postActivate).append("]");
sb.append(" preDestroy [").append(preDestroy).append("]");
- sb.append(" prePassivate [").append(prePassivate).append("]");
return sb.toString();
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorType.java Mon Jul 26 15:12:34 2010
@@ -31,7 +31,7 @@ import org.apache.webbeans.exception.Web
*/
public enum InterceptorType
{
- AROUND_INVOKE, AROUND_TIMEOUT, POST_CONSTRUCT, PRE_DESTROY, PRE_PASSIVATE, POST_ACTIVATE;
+ AROUND_INVOKE, POST_CONSTRUCT, PRE_DESTROY, PRE_PASSIVATE, POST_ACTIVATE;
public static InterceptorType getType(InterceptionType type)
{
@@ -39,10 +39,6 @@ public enum InterceptorType
{
return AROUND_INVOKE;
}
- else if (type.equals(InterceptionType.AROUND_TIMEOUT))
- {
- return AROUND_TIMEOUT;
- }
else if (type.equals(InterceptionType.POST_CONSTRUCT))
{
return POST_CONSTRUCT;
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InterceptorUtil.java Mon Jul 26 15:12:34 2010
@@ -30,8 +30,6 @@ import java.util.Set;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
-import javax.ejb.PrePassivate;
-import javax.ejb.PostActivate;
import javax.enterprise.inject.Produces;
import javax.enterprise.inject.spi.AnnotatedMethod;
import javax.enterprise.inject.spi.AnnotatedParameter;
@@ -47,7 +45,6 @@ import org.apache.webbeans.component.Inj
import org.apache.webbeans.context.creational.CreationalContextImpl;
import org.apache.webbeans.exception.WebBeansConfigurationException;
import org.apache.webbeans.exception.WebBeansException;
-import org.apache.webbeans.logger.WebBeansLogger;
import org.apache.webbeans.util.AnnotationUtil;
import org.apache.webbeans.util.Asserts;
import org.apache.webbeans.util.ClassUtil;
@@ -55,9 +52,6 @@ import org.apache.webbeans.util.Security
public final class InterceptorUtil
{
- /**Logger instance*/
- private static final WebBeansLogger logger = WebBeansLogger.getLogger(InterceptorUtil.class);
-
private InterceptorUtil()
{
@@ -89,10 +83,7 @@ public final class InterceptorUtil
if (annCls.equals(Inject.class) ||
annCls.equals(PreDestroy.class) ||
annCls.equals(PostConstruct.class) ||
- annCls.equals(AroundInvoke.class) ||
- annCls.equals(PrePassivate.class) || // JSR-299 7.2
- annCls.equals(PostActivate.class) || // JSR-299 7.2
- annCls.equals(AroundTimeout.class)) // JSR-299 7.2
+ annCls.equals(AroundInvoke.class) )
{
return false;
}
@@ -107,10 +98,10 @@ public final class InterceptorUtil
{
return AroundInvoke.class;
}
- else if (type.equals(InterceptionType.POST_ACTIVATE))
- {
- return PostActivate.class;
- }
+// else if (type.equals(InterceptionType.POST_ACTIVATE))
+// {
+// return O;
+// }
else if (type.equals(InterceptionType.POST_CONSTRUCT))
{
return PostConstruct.class;
@@ -119,10 +110,10 @@ public final class InterceptorUtil
{
return PreDestroy.class;
}
- else if (type.equals(InterceptionType.PRE_PASSIVATE))
- {
- return PrePassivate.class;
- }
+// else if (type.equals(InterceptionType.PRE_PASSIVATE))
+// {
+// return PrePassivate.class;
+// }
else if (type.equals(InterceptionType.AROUND_TIMEOUT))
{
return AroundTimeout.class;
@@ -212,8 +203,8 @@ public final class InterceptorUtil
for (Method method : methods)
{
if (AnnotationUtil.hasMethodAnnotation(method, PostConstruct.class) || AnnotationUtil.hasMethodAnnotation(method, PreDestroy.class)
- || AnnotationUtil.hasMethodAnnotation(method, PostActivate.class)
- || AnnotationUtil.hasMethodAnnotation(method, PrePassivate.class)
+// AnnotationUtil.isMethodHasAnnotation(method, PostActivate.class) ||
+// AnnotationUtil.isMethodHasAnnotation(method, PrePassivate.class)
)
{
if (ClassUtil.isMethodHasParameter(method))
@@ -229,29 +220,10 @@ public final class InterceptorUtil
{
return true;
}
- else
- {
- logger.debug("Static LifeCycle callback method found.");
- }
- }
- else
- {
- logger.debug("LifeCycle callback method with checked exception.");
}
}
- else
- {
- logger.debug("LifeCycle callback method with non-void return type.");
- }
}
- else
- {
- logger.debug("LifeCycle callback method with wrong number or type of parameter(s).");
- }
- }
- else
- {
- logger.debug("LifeCycle callback method without any context parameter.");
+
}
}
}
@@ -267,9 +239,7 @@ public final class InterceptorUtil
{
AnnotatedMethod<T> method = (AnnotatedMethod<T>)methodA;
if(method.isAnnotationPresent(PostConstruct.class)
- || method.isAnnotationPresent(PreDestroy.class)
- || method.isAnnotationPresent(PostActivate.class)
- || method.isAnnotationPresent(PrePassivate.class))
+ || method.isAnnotationPresent(PreDestroy.class))
{
if (!methodA.getParameters().isEmpty())
{
@@ -463,11 +433,8 @@ public final class InterceptorUtil
public static List<InterceptorData> getInterceptorMethods(List<InterceptorData> stack, InterceptorType type)
{
List<InterceptorData> ai = new ArrayList<InterceptorData>();
- List<InterceptorData> at = new ArrayList<InterceptorData>();
- List<InterceptorData> pa = new ArrayList<InterceptorData>();
List<InterceptorData> pc = new ArrayList<InterceptorData>();
List<InterceptorData> pd = new ArrayList<InterceptorData>();
- List<InterceptorData> pp = new ArrayList<InterceptorData>();
Iterator<InterceptorData> it = stack.iterator();
while (it.hasNext())
@@ -484,24 +451,6 @@ public final class InterceptorUtil
}
}
- else if (type.equals(InterceptorType.AROUND_TIMEOUT))
- {
- m = data.getAroundTimeout();
- if (m != null)
- {
- at.add(data);
- }
-
- }
- else if (type.equals(InterceptorType.POST_ACTIVATE))
- {
- m = data.getPostActivate();
- if (m != null)
- {
- pa.add(data);
- }
-
- }
else if (type.equals(InterceptorType.POST_CONSTRUCT))
{
m = data.getPostConstruct();
@@ -520,42 +469,22 @@ public final class InterceptorUtil
}
}
- else if (type.equals(InterceptorType.PRE_PASSIVATE))
- {
- m = data.getPrePassivate();
- if (m != null)
- {
- pp.add(data);
- }
- }
}
if (type.equals(InterceptorType.AROUND_INVOKE))
{
return ai;
}
- else if (type.equals(InterceptorType.AROUND_TIMEOUT))
- {
- return at;
- }
- else if (type.equals(InterceptorType.POST_ACTIVATE))
- {
- return pa;
- }
else if (type.equals(InterceptorType.POST_CONSTRUCT))
{
return pc;
+
}
else if (type.equals(InterceptorType.PRE_DESTROY))
{
return pd;
}
- else if (type.equals(InterceptorType.PRE_PASSIVATE))
- {
- return pp;
-
- }
return Collections.EMPTY_LIST;
}
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/InvocationContextImpl.java Mon Jul 26 15:12:34 2010
@@ -33,7 +33,6 @@ import org.apache.webbeans.component.Ent
import org.apache.webbeans.component.OwbBean;
import org.apache.webbeans.container.BeanManagerImpl;
import org.apache.webbeans.context.creational.CreationalContextImpl;
-import org.apache.webbeans.logger.WebBeansLogger;
import org.apache.webbeans.util.ClassUtil;
import org.apache.webbeans.util.SecurityUtil;
@@ -68,9 +67,6 @@ public class InvocationContextImpl imple
private OwbBean<?> owbBean;
private InvocationContext ejbInvocationContext;
-
- //Logger instance
- private static final WebBeansLogger logger = WebBeansLogger.getLogger(InvocationContextImpl.class);
/**
* Initializes the context.
@@ -172,15 +168,8 @@ public class InvocationContextImpl imple
{
if (type.equals(InterceptorType.AROUND_INVOKE))
{
- logger.debug("InvocationContextImpl: Proceeding to AroundInvokes.");
return proceedAroundInvokes(this.interceptorDatas);
}
- else if (type.equals(InterceptorType.AROUND_TIMEOUT))
- {
- logger.debug("InvocationContextImpl: Proceeding to AroundTimeouts.");
- return proceedAroundTimeouts(this.interceptorDatas);
- }
- logger.debug("InvocationContextImpl: Proceeding to CommonAnnotations.");
return proceedCommonAnnots(this.interceptorDatas, this.type);
}
@@ -272,75 +261,7 @@ public class InvocationContextImpl imple
return result;
}
-
- /**
- * AroundTimeout operations on stack.
- * @param datas interceptor stack
- * @return final result
- * @throws Exception for exceptions
- */
- private Object proceedAroundTimeouts(List<InterceptorData> datas) throws Exception
- {
- Object result = null;
-
- if (currentMethod <= datas.size())
- {
- InterceptorData intc = datas.get(currentMethod - 1);
-
- Method method = intc.getAroundTimeout();
- boolean accessible = method.isAccessible();
-
- if (!accessible)
- {
- SecurityUtil.doPrivilegedSetAccessible(method, true);
- }
-
- Object t = intc.createNewInstance(this.target,(CreationalContextImpl<?>)this.creationalContext);
-
- if (t == null)
- {
- t = target;
- }
-
- currentMethod++;
-
- result = method.invoke(t, new Object[] { this });
-
- if(!accessible)
- {
- SecurityUtil.doPrivilegedSetAccessible(method, false);
- }
-
- }
- else
- {
- if(!(this.owbBean instanceof EnterpriseBeanMarker))
- {
- boolean accessible = this.method.isAccessible();
- if(!accessible)
- {
- SecurityUtil.doPrivilegedSetAccessible(method, true);
- }
-
- result = this.method.invoke(target, parameters);
-
- if(!accessible)
- {
- SecurityUtil.doPrivilegedSetAccessible(method, false);
- }
- }
- else
- {
- if (this.ejbInvocationContext != null)
- {
- result = ejbInvocationContext.proceed();
- }
- }
- }
-
- return result;
- }
-
+
/**
* Post construct and predestroy
* callback operations.
@@ -362,14 +283,6 @@ public class InvocationContextImpl imple
{
method = intc.getPostConstruct();
}
- else if (type.equals(InterceptorType.POST_ACTIVATE))
- {
- method = intc.getPostActivate();
- }
- else if (type.equals(InterceptorType.PRE_PASSIVATE))
- {
- method = intc.getPrePassivate();
- }
else if (type.equals(InterceptorType.PRE_DESTROY))
{
method = intc.getPreDestroy();
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java?rev=979322&r1=979321&r2=979322&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/intercept/webbeans/WebBeansInterceptor.java Mon Jul 26 15:12:34 2010
@@ -276,6 +276,10 @@ public class WebBeansInterceptor<T> exte
method = WebBeansUtil.checkAroundInvokeAnnotationCriterias(getClazz(),AroundTimeout.class);
}
+ else if(type.equals(InterceptionType.POST_ACTIVATE) || type.equals(InterceptionType.PRE_PASSIVATE))
+ {
+ return null;
+ }
else
{
Class<? extends Annotation> interceptorTypeAnnotationClazz = InterceptorUtil.getInterceptorAnnotationClazz(type);
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=979322&r1=979321&r2=979322&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 Mon Jul 26 15:12:34 2010
@@ -45,8 +45,6 @@ import java.util.concurrent.ConcurrentHa
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.decorator.Decorator;
-import javax.ejb.PostActivate;
-import javax.ejb.PrePassivate;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Conversation;
import javax.enterprise.context.ConversationScoped;
@@ -1207,10 +1205,27 @@ public final class WebBeansUtil
{
method = WebBeansUtil.checkAroundInvokeAnnotationCriterias(interceptorClass, interceptorType);
}
- else if (interceptorType.equals(PostConstruct.class) || interceptorType.equals(PostActivate.class)
- || interceptorType.equals(PreDestroy.class) || interceptorType.equals(PrePassivate.class))
+ else if (interceptorType.equals(PostConstruct.class))
{
- method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, interceptorType, definedInInterceptorClass);
+ if (definedInInterceptorClass)
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PostConstruct.class, true);
+ }
+ else
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PostConstruct.class, false);
+ }
+ }
+ else if (interceptorType.equals(PreDestroy.class))
+ {
+ if (definedInInterceptorClass)
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PreDestroy.class, true);
+ }
+ else
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(interceptorClass, PreDestroy.class, false);
+ }
}
if (method != null)
@@ -1249,10 +1264,27 @@ public final class WebBeansUtil
{
method = WebBeansUtil.checkAroundInvokeAnnotationCriterias(annotatedType, annotation);
}
- else if (annotation.equals(PostConstruct.class) || annotation.equals(PostActivate.class)
- || annotation.equals(PreDestroy.class) || annotation.equals(PrePassivate.class))
+ else if (annotation.equals(PostConstruct.class))
{
- method = WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, annotation, definedInInterceptorClass);
+ if (definedInInterceptorClass)
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, PostConstruct.class, true);
+ }
+ else
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, PostConstruct.class, false);
+ }
+ }
+ else if (annotation.equals(PreDestroy.class))
+ {
+ if (definedInInterceptorClass)
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, PreDestroy.class, true);
+ }
+ else
+ {
+ method = WebBeansUtil.checkCommonAnnotationCriterias(annotatedType, PreDestroy.class, false);
+ }
}
if (method != null)
@@ -1336,26 +1368,15 @@ public final class WebBeansUtil
{
m = data.getAroundInvoke();
}
- else if (type.equals(InterceptorType.AROUND_TIMEOUT))
- {
- m = data.getAroundTimeout();
- }
else if (type.equals(InterceptorType.POST_CONSTRUCT))
{
m = data.getPostConstruct();
- }
- else if (type.equals(InterceptorType.POST_ACTIVATE))
- {
- m = data.getPostActivate();
+
}
else if (type.equals(InterceptorType.PRE_DESTROY))
{
m = data.getPreDestroy();
}
- else if (type.equals(InterceptorType.PRE_PASSIVATE))
- {
- m = data.getPrePassivate();
- }
if (m != null)
{