[jboss-cvs] JBossAS SVN: r68988 - in projects/ejb3/trunk/interceptors/src: main/java/org/jboss/ejb3/interceptors/annotation/impl and 9 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Jan 15 13:28:37 EST 2008


Author: wolfc
Date: 2008-01-15 13:28:36 -0500 (Tue, 15 Jan 2008)
New Revision: 68988

Added:
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java
   projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/
   projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java
   projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java
   projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java
   projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/unit/
   projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/unit/AdditiveTestCase.java
   projects/ejb3/trunk/interceptors/src/test/resources/additive/
   projects/ejb3/trunk/interceptors/src/test/resources/additive/META-INF/
   projects/ejb3/trunk/interceptors/src/test/resources/additive/META-INF/ejb-jar.xml
Modified:
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsFactory.java
   projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
Log:
Additive class interceptors

Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.interceptors.annotation.impl;
+
+import java.lang.annotation.Annotation;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+import javax.interceptor.Interceptors;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class InterceptorsImpl implements Interceptors
+{
+   private static final Logger log = Logger.getLogger(InterceptorsImpl.class);
+
+   private Set<Class<?>> values = new LinkedHashSet<Class<?>>();
+   
+   public boolean add(Interceptors annotation)
+   {
+      if(annotation == null)
+         return false;
+      for(Class<?> cls : annotation.value())
+      {
+         boolean result = values.add(cls);
+         assert result;
+      }
+      return true;
+   }
+   
+   public Class<? extends Annotation> annotationType()
+   {
+      return Interceptors.class;
+   }
+
+   public boolean isEmpty()
+   {
+      return values.isEmpty();
+   }
+
+   public Class<?>[] value()
+   {
+      return values.toArray(new Class<?>[0]);
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/annotation/impl/InterceptorsImpl.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java	2008-01-15 16:48:12 UTC (rev 68987)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InjectInterceptorsFactory.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -27,6 +27,7 @@
 import java.util.List;
 
 import javax.interceptor.ExcludeClassInterceptors;
+import javax.interceptor.ExcludeDefaultInterceptors;
 
 import org.jboss.aop.Advisor;
 import org.jboss.aop.InstanceAdvisor;
@@ -85,9 +86,8 @@
                return super.addAll(c);
             }
          };
-         // TODO: implement default interceptors
-//         if(!isIgnoreDefaultInterceptors(advisor, jp))
-//            interceptors.addAll(defaultInterceptors);
+         if(!isExcludeDefaultInterceptors(advisor, method))
+            interceptors.addAll(InterceptorsFactory.getDefaultInterceptors(instanceAdvisor));
          if(!isExcludeClassInterceptors(advisor, method))
             interceptors.addAll(InterceptorsFactory.getClassInterceptors(instanceAdvisor));
          interceptors.addAll(InterceptorsFactory.getBusinessMethodInterceptors(instanceAdvisor, method));
@@ -118,9 +118,14 @@
    
    private static final boolean isExcludeClassInterceptors(Advisor advisor, Method method)
    {
-      return advisor.hasAnnotation(method, ExcludeClassInterceptors.class);
+      return advisor.hasAnnotation(method, ExcludeClassInterceptors.class) || advisor.resolveAnnotation(ExcludeClassInterceptors.class) != null;
    }
    
+   private static final boolean isExcludeDefaultInterceptors(Advisor advisor, Method method)
+   {
+      return advisor.hasAnnotation(method, ExcludeDefaultInterceptors.class) || advisor.resolveAnnotation(ExcludeDefaultInterceptors.class) != null;
+   }
+   
    public String getName()
    {
       return "InjectInterceptorsFactory";

Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsFactory.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsFactory.java	2008-01-15 16:48:12 UTC (rev 68987)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/InterceptorsFactory.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -38,6 +38,7 @@
 import org.jboss.aop.joinpoint.MethodInvocation;
 import org.jboss.ejb3.interceptors.InterceptorFactory;
 import org.jboss.ejb3.interceptors.InterceptorFactoryRef;
+import org.jboss.ejb3.interceptors.aop.annotation.DefaultInterceptors;
 import org.jboss.ejb3.interceptors.lang.ClassHelper;
 import org.jboss.logging.Logger;
 
@@ -51,6 +52,43 @@
 {
    private static final Logger log = Logger.getLogger(InterceptorsFactory.class);
    
+   private List<? extends Interceptor> createInterceptors(Advisor advisor, InterceptorFactory interceptorFactory, Class<?>[] interceptorClasses, List<BusinessMethodInterceptorMethodInterceptor> interceptors, Map<Class<?>, Object> existingInterceptors, List<LifecycleCallbackInterceptorMethodInterceptor> postConstructs) throws InstantiationException, IllegalAccessException
+   {
+      if(interceptorClasses != null)
+      {
+         for(Class<?> interceptorClass : interceptorClasses)
+         {
+            // TODO: what if I've specified the same interceptor twice? (throw an Exception?)
+            Object interceptor = existingInterceptors.get(interceptorClass);
+            if(interceptor == null)
+            {
+               interceptor = interceptorFactory.create(advisor, interceptorClass);
+               existingInterceptors.put(interceptorClass, interceptor);
+            }
+            //Advisor interceptorAdvisor = ((Advised) interceptor)._getAdvisor();
+            //Advisor interceptorAdvisor = advisor.getManager().getAdvisor(interceptorClass);
+            //AnnotationAdvisor interceptorAdvisor = AnnotationAdvisorHelper.getAnnotationAdvisor(advisor, interceptor);
+            ExtendedAdvisor interceptorAdvisor = ExtendedAdvisorHelper.getExtendedAdvisor(advisor, interceptor);
+            log.debug("  interceptorAdvisor = " + interceptorAdvisor);
+            // TODO: should be only non-overriden methods (EJB 3 12.4.1 last bullet)
+            for(Method method : ClassHelper.getAllMethods(interceptorClass))
+            {
+               if(interceptorAdvisor.isAnnotationPresent(interceptorClass, method, PostConstruct.class))
+               {
+                  postConstructs.add(new LifecycleCallbackInterceptorMethodInterceptor(interceptor, method));
+               }
+               if(interceptorAdvisor.isAnnotationPresent(interceptorClass, method, AroundInvoke.class))
+               {
+                  interceptors.add(new BusinessMethodInterceptorMethodInterceptor(interceptor, method));
+               }
+            }
+            //instanceAdvisor.appendInterceptorStack(stackName);
+            //instanceAdvisor.appendInterceptor(new InvokeSpecInterceptorInterceptor());
+         }
+      }
+      return interceptors;
+   }
+   
    public Object createPerInstance(Advisor advisor, InstanceAdvisor instanceAdvisor)
    {
       try
@@ -67,43 +105,27 @@
          log.info("interceptor factory class = " + interceptorFactoryRef.value());
          InterceptorFactory interceptorFactory = interceptorFactoryRef.value().newInstance();
          
+         Map<Class<?>, Object> interceptors = new HashMap<Class<?>, Object>();
+         List<LifecycleCallbackInterceptorMethodInterceptor> postConstructs = new ArrayList<LifecycleCallbackInterceptorMethodInterceptor>();
+         
+         DefaultInterceptors defaultInterceptorsAnnotation = (DefaultInterceptors) advisor.resolveAnnotation(DefaultInterceptors.class);
+         List<BusinessMethodInterceptorMethodInterceptor> defaultInterceptors = new ArrayList<BusinessMethodInterceptorMethodInterceptor>();
+         if(defaultInterceptorsAnnotation != null)
+            createInterceptors(advisor, interceptorFactory, defaultInterceptorsAnnotation.value(), defaultInterceptors, interceptors, postConstructs);
+         
+         log.debug("Found class interceptors " + defaultInterceptors);
+         // Default Interceptors
+         instanceAdvisor.getMetaData().addMetaData(InterceptorsFactory.class, "defaultInterceptors", defaultInterceptors);
+         
          Interceptors interceptorsAnnotation = (Interceptors) advisor.resolveAnnotation(Interceptors.class);
-         Map<Class<?>, Object> interceptors = new HashMap<Class<?>, Object>();
-         List<Interceptor> postConstructs = new ArrayList<Interceptor>();
-         List<Interceptor> classInterceptors = new ArrayList<Interceptor>();
+         List<BusinessMethodInterceptorMethodInterceptor> classInterceptors = new ArrayList<BusinessMethodInterceptorMethodInterceptor>();
          if(interceptorsAnnotation != null)
-         {
-            for(Class<?> interceptorClass : interceptorsAnnotation.value())
-            {
-               // TODO: what if I've specified the same interceptor twice? (throw an Exception?)
-               Object interceptor = interceptors.get(interceptorClass);
-               if(interceptor == null)
-               {
-                  interceptor = interceptorFactory.create(advisor, interceptorClass);
-                  interceptors.put(interceptorClass, interceptor);
-               }
-               //Advisor interceptorAdvisor = ((Advised) interceptor)._getAdvisor();
-               //Advisor interceptorAdvisor = advisor.getManager().getAdvisor(interceptorClass);
-               //AnnotationAdvisor interceptorAdvisor = AnnotationAdvisorHelper.getAnnotationAdvisor(advisor, interceptor);
-               ExtendedAdvisor interceptorAdvisor = ExtendedAdvisorHelper.getExtendedAdvisor(advisor, interceptor);
-               log.debug("  interceptorAdvisor = " + interceptorAdvisor);
-               // TODO: should be only non-overriden methods (EJB 3 12.4.1 last bullet)
-               for(Method method : ClassHelper.getAllMethods(interceptorClass))
-               {
-                  if(interceptorAdvisor.isAnnotationPresent(interceptorClass, method, PostConstruct.class))
-                  {
-                     postConstructs.add(new LifecycleCallbackInterceptorMethodInterceptor(interceptor, method));
-                  }
-                  if(interceptorAdvisor.isAnnotationPresent(interceptorClass, method, AroundInvoke.class))
-                  {
-                     classInterceptors.add(new BusinessMethodInterceptorMethodInterceptor(interceptor, method));
-                  }
-               }
-               //instanceAdvisor.appendInterceptorStack(stackName);
-               //instanceAdvisor.appendInterceptor(new InvokeSpecInterceptorInterceptor());
-            }
-         }
+            createInterceptors(advisor, interceptorFactory, interceptorsAnnotation.value(), classInterceptors, interceptors, postConstructs);
          
+         log.debug("Found class interceptors " + classInterceptors);
+         // Class Interceptors
+         instanceAdvisor.getMetaData().addMetaData(InterceptorsFactory.class, "classInterceptors", classInterceptors);
+         
          Class<?> beanClass = advisor.getClazz();
          List<Interceptor> beanInterceptors = new ArrayList<Interceptor>();
          for(Method beanMethod : ClassHelper.getAllMethods(beanClass))
@@ -149,10 +171,6 @@
          log.debug("Found bean interceptors " + beanInterceptors);
          instanceAdvisor.getMetaData().addMetaData(InterceptorsFactory.class, "beanInterceptors", beanInterceptors);
          
-         log.debug("Found class interceptors " + classInterceptors);
-         // Class Interceptors
-         instanceAdvisor.getMetaData().addMetaData(InterceptorsFactory.class, "classInterceptors", classInterceptors);
-         
          // Put the postConstructs interceptors here in the chain
          // TODO: why? We may need more control
          return new InterceptorSequencer(postConstructs.toArray(new Interceptor[0]));
@@ -207,6 +225,12 @@
       return (List<Interceptor>) instanceAdvisor.getMetaData().getMetaData(InterceptorsFactory.class, "classInterceptors");
    }
    
+   @SuppressWarnings("unchecked")
+   public static List<Interceptor> getDefaultInterceptors(InstanceAdvisor instanceAdvisor)
+   {
+      return (List<Interceptor>) instanceAdvisor.getMetaData().getMetaData(InterceptorsFactory.class, "defaultInterceptors");
+   }
+   
    private String toString(Object obj)
    {
       return obj.getClass().getName() + "@" + System.identityHashCode(obj);

Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.interceptors.aop.annotation;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used internally to specify default interceptors on a managed object.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Target(TYPE)
+ at Retention(RUNTIME)
+public @interface DefaultInterceptors {
+   Class<?>[] value();
+}


Property changes on: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptors.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.interceptors.aop.annotation;
+
+import java.lang.annotation.Annotation;
+import java.util.Collection;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DefaultInterceptorsImpl implements DefaultInterceptors
+{
+   private Class<?> values[];
+   
+   public DefaultInterceptorsImpl(Collection<Class<?>> values)
+   {
+      this.values = values.toArray(new Class<?>[0]);
+   }
+   
+   public Class<?>[] value()
+   {
+      return values;
+   }
+
+   public Class<? extends Annotation> annotationType()
+   {
+      return DefaultInterceptors.class;
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/DefaultInterceptorsImpl.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.interceptors.aop.annotation;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Used internally to specify the order of interceptors.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at Target({ TYPE, METHOD })
+ at Retention(RUNTIME)
+public @interface InterceptorOrder {
+   Class<?>[] value();
+}


Property changes on: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/aop/annotation/InterceptorOrder.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,81 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.interceptors.metadata;
+
+import java.lang.annotation.Annotation;
+
+import javax.interceptor.Interceptors;
+
+import org.jboss.ejb3.interceptors.annotation.impl.InterceptorsImpl;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+
+/**
+ * Extend bean interceptor meta data bridge for
+ * additive operation.
+ * 
+ * TODO: this is ugly, because metadata complete should be a cross component function
+ * TODO: additivity is probably also a cross component function
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class AdditiveBeanInterceptorMetaDataBridge extends BeanInterceptorMetaDataBridge
+{
+   private static final Logger log = Logger.getLogger(AdditiveBeanInterceptorMetaDataBridge.class);
+   
+   private Class<?> beanClass;
+   
+   public AdditiveBeanInterceptorMetaDataBridge(Class<?> beanClass)
+   {
+      assert beanClass != null : "beanClass is null";
+      this.beanClass = beanClass;
+   }
+   
+   private static boolean isMetadataComplete(JBossEnterpriseBeanMetaData beanMetaData)
+   {
+      return beanMetaData.getEjbJarMetaData().isMetadataComplete();
+   }
+   
+   @Override
+   public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, JBossEnterpriseBeanMetaData beanMetaData, ClassLoader classLoader)
+   {
+      if(annotationClass == Interceptors.class)
+      {
+         InterceptorsImpl interceptors = new InterceptorsImpl();
+         if(!isMetadataComplete(beanMetaData))
+            interceptors.add(beanClass.getAnnotation(Interceptors.class));
+         
+         interceptors.add(super.retrieveAnnotation(Interceptors.class, beanMetaData, classLoader));
+         
+         if(!interceptors.isEmpty())
+            return annotationClass.cast(interceptors);
+      }
+      return super.retrieveAnnotation(annotationClass, beanMetaData, classLoader);
+   }
+   
+   @Override
+   public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, JBossEnterpriseBeanMetaData beanMetaData, ClassLoader classLoader, String methodName, String... parameterNames)
+   {
+      return super.retrieveAnnotation(annotationClass, beanMetaData, classLoader, methodName, parameterNames);
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/AdditiveBeanInterceptorMetaDataBridge.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Modified: projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java	2008-01-15 16:48:12 UTC (rev 68987)
+++ projects/ejb3/trunk/interceptors/src/main/java/org/jboss/ejb3/interceptors/metadata/BeanInterceptorMetaDataBridge.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -22,12 +22,16 @@
 package org.jboss.ejb3.interceptors.metadata;
 
 import java.lang.annotation.Annotation;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 
 import javax.interceptor.AroundInvoke;
 import javax.interceptor.Interceptors;
 
 import org.jboss.ejb3.annotation.impl.InterceptorsImpl;
+import org.jboss.ejb3.interceptors.aop.annotation.DefaultInterceptors;
+import org.jboss.ejb3.interceptors.aop.annotation.DefaultInterceptorsImpl;
 import org.jboss.ejb3.metadata.MetaDataBridge;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
@@ -68,6 +72,24 @@
       return true;
    }
    
+   protected static boolean add(List<Class<?>> interceptors, ClassLoader classLoader, InterceptorBindingMetaData binding)
+   {
+      InterceptorClassesMetaData interceptorClassesMetaData;
+      if(binding.isTotalOrdering())
+      {
+         interceptorClassesMetaData = binding.getInterceptorOrder();
+      }
+      else
+      {
+         interceptorClassesMetaData = binding.getInterceptorClasses();
+      }
+      for(String interceptorClassName : interceptorClassesMetaData)
+      {
+         interceptors.add(loadClass(classLoader, interceptorClassName));
+      }
+      return true;
+   }
+   
    private static Class<?> loadClass(ClassLoader classLoader, String name)
    {
       try
@@ -83,27 +105,44 @@
    @Override
    public <A extends Annotation> A retrieveAnnotation(Class<A> annotationClass, JBossEnterpriseBeanMetaData beanMetaData, ClassLoader classLoader)
    {
-      if(annotationClass == Interceptors.class)
+      if(annotationClass == DefaultInterceptors.class)
       {
          InterceptorBindingsMetaData bindings = beanMetaData.getEjbJarMetaData().getAssemblyDescriptor().getInterceptorBindings();
          if(bindings != null)
          {
+            List<Class<?>> interceptors = new ArrayList<Class<?>>();
             for(InterceptorBindingMetaData binding : bindings)
             {
+               String bindingEjbName = binding.getEjbName();
+               if(bindingEjbName.equals("*"))
+               {
+                  assert binding.getMethod() == null : "method binding not allowed on default interceptor";
+                  
+                  add(interceptors, classLoader, binding);
+               }
+            }
+            if(!interceptors.isEmpty())
+               return annotationClass.cast(new DefaultInterceptorsImpl(interceptors));
+         }
+      }
+      else if(annotationClass == Interceptors.class)
+      {
+         InterceptorBindingsMetaData bindings = beanMetaData.getEjbJarMetaData().getAssemblyDescriptor().getInterceptorBindings();
+         if(bindings != null)
+         {
+            InterceptorsImpl interceptors = new InterceptorsImpl();
+            for(InterceptorBindingMetaData binding : bindings)
+            {
                // For the method component
                if(binding.getMethod() != null)
                   continue;
                
                String ejbName = beanMetaData.getEjbName();
                String bindingEjbName = binding.getEjbName();
-               if(bindingEjbName.equals("*") || bindingEjbName.equals(ejbName))
-               {
-                  //List<Class<?>> interceptorClasses = new ArrayList<Class<?>>();
-                  InterceptorsImpl interceptors = new InterceptorsImpl();
+               if(bindingEjbName.equals(ejbName))
                   add(interceptors, classLoader, binding);
-                  return annotationClass.cast(interceptors);
-               }
             }
+            return annotationClass.cast(interceptors);
          }
       }
       return super.retrieveAnnotation(annotationClass, beanMetaData, classLoader);

Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,48 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.interceptors.additive;
+
+import java.util.List;
+
+import javax.interceptor.AroundInvoke;
+import javax.interceptor.InvocationContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class MyInterceptor
+{
+   private static final Logger log = Logger.getLogger(MyInterceptor.class);
+   
+   @AroundInvoke
+   public Object aroundInvoke(InvocationContext ctx) throws Exception
+   {
+      List<Class<?>> visits = (List<Class<?>>) ctx.getParameters()[0];
+      visits.add(this.getClass());
+      return ctx.proceed();
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MyInterceptor.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.interceptors.additive;
+
+import java.util.List;
+
+import javax.interceptor.Interceptors;
+
+import org.jboss.ejb3.interceptors.ManagedObject;
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+ at ManagedObject
+ at Interceptors(MyInterceptor.class)
+public class MySessionBean
+{
+   private static final Logger log = Logger.getLogger(MySessionBean.class);
+   
+   public void doIt(List<Class<?>> visits)
+   {
+      visits.add(this.getClass());
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/MySessionBean.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.interceptors.additive;
+
+import java.util.List;
+
+import javax.interceptor.InvocationContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class XMLInterceptor
+{
+   private static final Logger log = Logger.getLogger(XMLInterceptor.class);
+   
+   public Object aroundInvoke(InvocationContext ctx) throws Exception
+   {
+      List<Class<?>> visits = (List<Class<?>>) ctx.getParameters()[0];
+      visits.add(this.getClass());
+      return ctx.proceed();
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/XMLInterceptor.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/unit/AdditiveTestCase.java
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/unit/AdditiveTestCase.java	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/unit/AdditiveTestCase.java	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,154 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2007, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.test.interceptors.additive.unit;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.jboss.aop.AspectManager;
+import org.jboss.aop.AspectXmlLoader;
+import org.jboss.ejb3.interceptors.direct.AbstractDirectContainer;
+import org.jboss.ejb3.interceptors.metadata.AdditiveBeanInterceptorMetaDataBridge;
+import org.jboss.ejb3.interceptors.metadata.InterceptorComponentMetaDataLoaderFactory;
+import org.jboss.ejb3.interceptors.metadata.InterceptorMetaDataBridge;
+import org.jboss.ejb3.metadata.MetaDataBridge;
+import org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData;
+import org.jboss.ejb3.test.interceptors.additive.MyInterceptor;
+import org.jboss.ejb3.test.interceptors.additive.MySessionBean;
+import org.jboss.ejb3.test.interceptors.additive.XMLInterceptor;
+import org.jboss.ejb3.test.interceptors.metadata.MetadataBean;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.EjbJar30MetaData;
+import org.jboss.metadata.ejb.spec.InterceptorMetaData;
+import org.jboss.xb.binding.Unmarshaller;
+import org.jboss.xb.binding.UnmarshallerFactory;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
+import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.builder.JBossXBBuilder;
+import org.w3c.dom.ls.LSInput;
+
+/**
+ * Test direct container advisement in combination with metadata.
+ *
+ * The binding of interceptors to classes is additive. If interceptors are bound at the class-level and/or
+ * default-level as well as at the method-level, both class-level and/or default-level as well as method-level
+ * interceptors will apply. The deployment descriptor may be used to augment the interceptors and inter-
+ * ceptor methods defined by means of annotations. When the deployment descriptor is used to augment
+ * the interceptors specified in annotations, the interceptor methods specified in the deployment descriptor
+ * will be invoked after those specified in annotations, according to the ordering specified in sections
+ * 12.3.1 and 12.4.1. The interceptor-order deployment descriptor element may be used to over-
+ * ride this ordering.
+ * 
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class AdditiveTestCase extends TestCase
+{
+   private static final Logger log = Logger.getLogger(AdditiveTestCase.class);
+   
+   private class MyContainer<T> extends AbstractDirectContainer<T, MyContainer<T>>
+   {
+      public MyContainer(String name, String domainName, Class<? extends T> beanClass, JBossEnterpriseBeanMetaData beanMetaData)
+      {
+         super();
+         
+         ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+         AnnotationRepositoryToMetaData annotations = new AnnotationRepositoryToMetaData(beanClass, beanMetaData, name, classLoader);
+         List<MetaDataBridge<InterceptorMetaData>> interceptorBridges = new ArrayList<MetaDataBridge<InterceptorMetaData>>();
+         interceptorBridges.add(new InterceptorMetaDataBridge());
+         annotations.addComponentMetaDataLoaderFactory(new InterceptorComponentMetaDataLoaderFactory(interceptorBridges));
+         annotations.addMetaDataBridge(new AdditiveBeanInterceptorMetaDataBridge(beanClass));
+         
+         initializeAdvisor(name, getDomain(domainName), beanClass, annotations);
+      }
+   }
+   
+   protected static SchemaBindingResolver schemaResolverForClass(final Class<?> root)
+   {
+      return new SchemaBindingResolver()
+      {
+         public String getBaseURI()
+         {
+            return null;
+         }
+
+         public SchemaBinding resolve(String nsUri, String baseURI, String schemaLocation)
+         {
+            return JBossXBBuilder.build(root);
+         }
+
+         public LSInput resolveAsLSInput(String nsUri, String baseUri, String schemaLocation)
+         {
+            return null;
+         }
+
+         public void setBaseURI(String baseURI)
+         {
+         }
+      };
+   }
+
+   public void test() throws Throwable
+   {
+      AspectManager.verbose = true;
+      
+      // To make surefire happy
+      Thread.currentThread().setContextClassLoader(MetadataBean.class.getClassLoader());
+      
+      // Bootstrap AOP
+      // FIXME: use the right jboss-aop.xml
+      URL url = Thread.currentThread().getContextClassLoader().getResource("proxy/jboss-aop.xml");
+      log.info("deploying AOP from " + url);
+      AspectXmlLoader.deployXML(url);
+      
+      // Bootstrap metadata
+      UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+      url = Thread.currentThread().getContextClassLoader().getResource("additive/META-INF/ejb-jar.xml");
+      assertNotNull("no ejb-jar.xml", url);
+      EjbJar30MetaData metaData = (EjbJar30MetaData) unmarshaller.unmarshal(url.toString(), schemaResolverForClass(EjbJar30MetaData.class));
+      JBoss50MetaData jbossMetaData = new JBoss50MetaData();
+      jbossMetaData.merge(null, metaData);
+      
+      JBossEnterpriseBeanMetaData beanMetaData = jbossMetaData.getEnterpriseBean("MySessionBean");
+      assertNotNull(beanMetaData);
+      
+      MyContainer<MySessionBean> container = new MyContainer<MySessionBean>("MySessionBean", "Test", MySessionBean.class, beanMetaData);
+      
+      MySessionBean bean = container.construct();
+      
+      List<Class<?>> visits = new ArrayList<Class<?>>();
+      container.invoke(bean, "doIt", visits);
+      
+      List<Class<?>> expected = new ArrayList<Class<?>>();
+      expected.add(MyInterceptor.class);
+      expected.add(XMLInterceptor.class);
+      expected.add(MySessionBean.class);
+      
+      assertEquals(expected, visits);
+   }
+}


Property changes on: projects/ejb3/trunk/interceptors/src/test/java/org/jboss/ejb3/test/interceptors/additive/unit/AdditiveTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native

Added: projects/ejb3/trunk/interceptors/src/test/resources/additive/META-INF/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/interceptors/src/test/resources/additive/META-INF/ejb-jar.xml	                        (rev 0)
+++ projects/ejb3/trunk/interceptors/src/test/resources/additive/META-INF/ejb-jar.xml	2008-01-15 18:28:36 UTC (rev 68988)
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar
+        xmlns="http://java.sun.com/xml/ns/javaee"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+                            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
+        version="3.0">
+	<display-name>AdditiveTest</display-name>
+    <!-- Must define a bean here, because we have no annotation on it -->
+    <!-- (Can't use @Stateless within ejb3-interceptors) -->
+    <enterprise-beans>
+    	<session>
+    		<ejb-name>MySessionBean</ejb-name>
+    	</session>
+    	<session>
+    		<ejb-name>MySessionBean2</ejb-name>
+    	</session>
+    </enterprise-beans>
+    <interceptors>
+    	<interceptor>
+    		<interceptor-class>org.jboss.ejb3.test.interceptors.additive.XMLInterceptor</interceptor-class>
+    		<around-invoke>
+    			<method-name>aroundInvoke</method-name>
+    		</around-invoke>
+    	</interceptor>
+    </interceptors>
+    <assembly-descriptor>
+    	<interceptor-binding>
+    		<ejb-name>MySessionBean</ejb-name>
+    		<interceptor-class>org.jboss.ejb3.test.interceptors.additive.XMLInterceptor</interceptor-class>
+    	</interceptor-binding>
+    	<interceptor-binding>
+    		<ejb-name>MySessionBean2</ejb-name>
+    		<!-- reverse the order against the default order (EJB3 12.8.2) -->
+    		<interceptor-order>
+    			<interceptor-class>org.jboss.ejb3.test.interceptors.additive.XMLInterceptor</interceptor-class>
+    			<interceptor-class>org.jboss.ejb3.test.interceptors.additive.MyInterceptor</interceptor-class>
+    		</interceptor-order>
+    	</interceptor-binding>
+    </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file


Property changes on: projects/ejb3/trunk/interceptors/src/test/resources/additive/META-INF/ejb-jar.xml
___________________________________________________________________
Name: svn:keywords
   + Author Date Id Revision
Name: svn:eol-style
   + native




More information about the jboss-cvs-commits mailing list