[jboss-cvs] JBossAS SVN: r94648 - in projects/weld-int/trunk/ejb: src/main/java/org/jboss/weld/integration/ejb/interceptor and 1 other directory.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Oct 11 12:34:44 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-10-11 12:34:44 -0400 (Sun, 11 Oct 2009)
New Revision: 94648

Removed:
   projects/weld-int/trunk/ejb/.classpath
   projects/weld-int/trunk/ejb/.project
   projects/weld-int/trunk/ejb/.settings/
Modified:
   projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java
Log:
remove eclipse files

Deleted: projects/weld-int/trunk/ejb/.classpath
===================================================================
--- projects/weld-int/trunk/ejb/.classpath	2009-10-11 16:34:12 UTC (rev 94647)
+++ projects/weld-int/trunk/ejb/.classpath	2009-10-11 16:34:44 UTC (rev 94648)
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
-	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
-	<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
-	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
-	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
-	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
-	<classpathentry kind="output" path="target/classes"/>
-</classpath>

Deleted: projects/weld-int/trunk/ejb/.project
===================================================================
--- projects/weld-int/trunk/ejb/.project	2009-10-11 16:34:12 UTC (rev 94647)
+++ projects/weld-int/trunk/ejb/.project	2009-10-11 16:34:44 UTC (rev 94648)
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
-	<name>weld-jboss-int-jboss-ejb</name>
-	<comment></comment>
-	<projects>
-	</projects>
-	<buildSpec>
-		<buildCommand>
-			<name>org.eclipse.jdt.core.javabuilder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-		<buildCommand>
-			<name>org.maven.ide.eclipse.maven2Builder</name>
-			<arguments>
-			</arguments>
-		</buildCommand>
-	</buildSpec>
-	<natures>
-		<nature>org.eclipse.jdt.core.javanature</nature>
-		<nature>org.maven.ide.eclipse.maven2Nature</nature>
-	</natures>
-</projectDescription>

Modified: projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java
===================================================================
--- projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java	2009-10-11 16:34:12 UTC (rev 94647)
+++ projects/weld-int/trunk/ejb/src/main/java/org/jboss/weld/integration/ejb/interceptor/Jsr299BindingsInterceptor.java	2009-10-11 16:34:44 UTC (rev 94648)
@@ -49,6 +49,8 @@
 public class Jsr299BindingsInterceptor implements Serializable
 {
 
+   private static final long serialVersionUID = -1999613731498564948L;
+
    @Resource(mappedName="java:app/BeanManager")
    private WeldManager beanManager;
 
@@ -62,6 +64,12 @@
    @PostConstruct
    public void doPostConstruct(InvocationContext invocationContext) throws Exception
    {
+      init(invocationContext);
+      doLifecycleInterception(invocationContext, InterceptionType.POST_CONSTRUCT);
+   }
+   
+   private <T> void init(InvocationContext invocationContext)
+   {
       // create contextual instances for interceptors
       interceptorInstances = new ConcurrentHashMap<String, Object>();
       EjbDescriptor<?> ejbDescriptor = (EjbDescriptor<?>) invocationContext.getContextData().get(SessionBeanInterceptor.EJB_DESCRIPTOR);
@@ -70,15 +78,20 @@
 
       if (interceptorBindings != null)
       {
-         for (Interceptor interceptor : interceptorBindings.getAllInterceptors())
+         for (Interceptor<?> interceptor : interceptorBindings.getAllInterceptors())
          {
-            CreationalContext creationalContext = (CreationalContext) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT);
-            interceptorInstances.put(interceptor.getName(), beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext));
+            addInterceptorInstance(interceptor, invocationContext);
          }
 
-         doLifecycleInterception(invocationContext, InterceptionType.POST_CONSTRUCT);
       }
    }
+   
+   @SuppressWarnings("unchecked")
+   private <T> void addInterceptorInstance(Interceptor<T> interceptor, InvocationContext invocationContext)
+   {
+      CreationalContext<T> creationalContext = (CreationalContext<T>) invocationContext.getContextData().get(SessionBeanInterceptor.CREATIONAL_CONTEXT);
+      interceptorInstances.put(interceptor.getName(), beanManager.getContext(interceptor.getScope()).get(interceptor, creationalContext));
+   }
 
    @PreDestroy
    public void doPreDestroy(InvocationContext invocationContext) throws Exception
@@ -98,8 +111,12 @@
       if (interceptorBindings != null)
       {
          List<Interceptor<?>> currentInterceptors = interceptorBindings.getLifecycleInterceptors(interceptionType);
-         doInterception(invocationContext, interceptionType, currentInterceptors);
+         delegateInterception(invocationContext, interceptionType, currentInterceptors);
       }
+      else
+      {
+         invocationContext.proceed();
+      }
    }
 
    private void doMethodInterception(InvocationContext invocationContext, InterceptionType interceptionType)
@@ -108,11 +125,15 @@
       if (interceptorBindings != null)
       {
          List<Interceptor<?>> currentInterceptors = interceptorBindings.getMethodInterceptors(interceptionType, invocationContext.getMethod());
-         doInterception(invocationContext, interceptionType, currentInterceptors);
+         delegateInterception(invocationContext, interceptionType, currentInterceptors);
       }
+      else
+      {
+         invocationContext.proceed();
+      }
    }
 
-   private void doInterception(InvocationContext invocationContext, InterceptionType interceptionType, List<Interceptor<?>> currentInterceptors)
+   private void delegateInterception(InvocationContext invocationContext, InterceptionType interceptionType, List<Interceptor<?>> currentInterceptors)
          throws Exception
    {
       List<Object> currentInterceptorInstances = new ArrayList<Object>();




More information about the jboss-cvs-commits mailing list