[jboss-cvs] JBossAS SVN: r67430 - in trunk/ejb3: src/main/org/jboss/annotation/ejb and 10 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 24 12:22:01 EST 2007


Author: adrian at jboss.org
Date: 2007-11-24 12:22:00 -0500 (Sat, 24 Nov 2007)
New Revision: 67430

Added:
   trunk/ejb3/src/main/org/jboss/ejb3/AnnotationRepositoryToMetaData.java
   trunk/ejb3/src/main/org/jboss/ejb3/EJBMetaDataLoader.java
   trunk/ejb3/src/resources/test/changexml/
   trunk/ejb3/src/resources/test/changexml/META-INF/
   trunk/ejb3/src/resources/test/changexml/META-INF/ejb-jar.xml
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionLocal.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterBean.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterRemote.java
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/unit/
   trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/unit/ChangeXMLUnitTestCase.java
Modified:
   trunk/ejb3/build-test.xml
   trunk/ejb3/src/main/org/jboss/annotation/ejb/ConsumerImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/CurrentMessageImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalBindingImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/ManagementImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingsImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/security/RunAsPrincipalImpl.java
   trunk/ejb3/src/main/org/jboss/annotation/security/SecurityDomainImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/ActivationConfigPropertyImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/ApplicationExceptionImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/AroundInvokeImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/DeclareRolesImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/DenyAllImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/InitImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/InterceptorsImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/LocalImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/MessageDrivenImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/PermitAllImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/PostActivateImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/PostConstructImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/PreDestroyImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/PrePassivateImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/RemoveImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/ResourceImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/RolesAllowedImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/RunAsImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/StatefulImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/StatelessImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/TransactionAttributeImpl.java
   trunk/ejb3/src/main/org/jboss/ejb/TransactionManagementImpl.java
   trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
   trunk/ejb3/src/main/org/jboss/persistence/EntityImpl.java
Log:
Use hierarchical metadata instead of aop flat annotation repository - plus fixes for annotation implementations not using correct annotationType

Modified: trunk/ejb3/build-test.xml
===================================================================
--- trunk/ejb3/build-test.xml	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/build-test.xml	2007-11-24 17:22:00 UTC (rev 67430)
@@ -3326,6 +3326,22 @@
       </jar>
    </target>
 
+   <target name="changexml"
+      description="Builds all jar files."
+      depends="compile-classes">
+
+      <mkdir dir="${build.lib}"/>
+
+      <jar jarfile="${build.lib}/changexml.jar">
+         <fileset dir="${build.classes}">
+            <include name="org/jboss/ejb3/test/changexml/*.class"/>
+         </fileset>
+         <fileset dir="${resources}/test/changexml">
+            <include name="META-INF/*.xml"/>
+         </fileset>
+      </jar>
+   </target>
+
    <target name="servicedependency"
       description="Builds all jar files."
       depends="compile-classes">
@@ -3728,7 +3744,7 @@
       timer, benchmark, entity, joininheritance, singletable, tableperclass, dependent, mdb, manytomany, regression,
       composite, composite2, entitycallback, relationships, ssl, ssladvanced, clusteredsession, strictpool, jacc,
       localcall, interceptors, interceptors2, interceptors3, iiop, clientinterceptor,
-      statelesscreation"/>
+      statelesscreation, changexml"/>
 
    <target name="test" depends="init" if="test"
       description="Execute all tests in the given test directory.">
@@ -4697,6 +4713,9 @@
       <antcall target="test" inheritRefs="true">
          <param name="test" value="jbas4489"/>
       </antcall>
+      <antcall target="test" inheritRefs="true">
+         <param name="test" value="changexml"/>
+      </antcall>
    </target>
 
    <target name="entity-tests" depends="init" description="Execute all tests">

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/ConsumerImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/ConsumerImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/ConsumerImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -82,6 +82,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return Consumer.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/CurrentMessageImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/CurrentMessageImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/CurrentMessageImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -40,6 +40,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return CurrentMessage.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalBindingImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalBindingImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalBindingImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -46,6 +46,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return LocalBinding.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/LocalHomeBindingImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -44,6 +44,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return LocalHomeBinding.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/ManagementImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/ManagementImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/ManagementImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -51,6 +51,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return Management.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -124,7 +124,7 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return RemoteBinding.class;
    }
    
    public String toString()

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingsImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingsImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteBindingsImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -53,6 +53,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return RemoteBindings.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/RemoteHomeBindingImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -60,7 +60,7 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return RemoteHomeBinding.class;
    }
    
    public String toString()

Modified: trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/ejb/ServiceImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -80,6 +80,6 @@
    
    public Class<? extends Annotation> annotationType()
    {
-      return null;
+      return Service.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/annotation/security/RunAsPrincipalImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/security/RunAsPrincipalImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/security/RunAsPrincipalImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -42,7 +42,7 @@
 
    public Class<RunAsPrincipal> annotationType()
    {
-      return org.jboss.annotation.security.RunAsPrincipal.class;
+      return RunAsPrincipal.class;
    }
    
    public String toString()

Modified: trunk/ejb3/src/main/org/jboss/annotation/security/SecurityDomainImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/annotation/security/SecurityDomainImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/annotation/security/SecurityDomainImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -63,7 +63,7 @@
 
    public Class<SecurityDomain> annotationType()
    {
-      return org.jboss.annotation.security.SecurityDomain.class;
+      return SecurityDomain.class;
    }
    
    public String toString()

Modified: trunk/ejb3/src/main/org/jboss/ejb/ActivationConfigPropertyImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/ActivationConfigPropertyImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/ActivationConfigPropertyImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.ActivationConfigProperty;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class ActivationConfigPropertyImpl implements javax.ejb.ActivationConfigProperty
+public class ActivationConfigPropertyImpl implements ActivationConfigProperty
 {
    private String name;
    private String value;
@@ -51,12 +53,12 @@
 
    public String name()
    {
-      return javax.ejb.ActivationConfigProperty.class.getName();
+      return ActivationConfigProperty.class.getName();
    }
 
    public Class annotationType()
    {
-      return javax.ejb.ActivationConfigProperty.class;
+      return ActivationConfigProperty.class;
    }
    
    public String toString()

Modified: trunk/ejb3/src/main/org/jboss/ejb/ApplicationExceptionImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/ApplicationExceptionImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/ApplicationExceptionImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.ApplicationException;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class ApplicationExceptionImpl implements javax.ejb.ApplicationException
+public class ApplicationExceptionImpl implements ApplicationException
 {
    private boolean rollback ;
    
@@ -44,6 +46,6 @@
 
    public Class annotationType()
    {
-      return javax.ejb.ApplicationException.class;
+      return ApplicationException.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/AroundInvokeImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/AroundInvokeImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/AroundInvokeImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.interceptor.AroundInvoke;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class AroundInvokeImpl implements javax.interceptor.AroundInvoke
+public class AroundInvokeImpl implements AroundInvoke
 {
    public AroundInvokeImpl()
    {
@@ -35,11 +37,11 @@
 
    public Class annotationType()
    {
-      return javax.annotation.security.PermitAll.class;
+      return AroundInvoke.class;
    }
 
    public String name()
    {
-      return javax.annotation.security.PermitAll.class.getName();
+      return AroundInvoke.class.getName();
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/DeclareRolesImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/DeclareRolesImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/DeclareRolesImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.annotation.security.DeclareRoles;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class DeclareRolesImpl implements javax.annotation.security.DeclareRoles
+public class DeclareRolesImpl implements DeclareRoles
 {
    private String[] v;
 
@@ -44,7 +46,7 @@
 
    public Class annotationType()
    {
-      return javax.annotation.security.DeclareRoles.class;
+      return DeclareRoles.class;
    }
 
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/DenyAllImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/DenyAllImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/DenyAllImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.annotation.security.DenyAll;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class DenyAllImpl implements javax.annotation.security.DenyAll
+public class DenyAllImpl implements DenyAll
 {
    public DenyAllImpl()
    {
@@ -35,6 +37,6 @@
 
    public Class annotationType()
    {
-      return javax.annotation.security.DenyAll.class;
+      return DenyAll.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/InitImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/InitImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/InitImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -23,13 +23,15 @@
 
 import java.lang.annotation.Annotation;
 
+import javax.ejb.Init;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class InitImpl implements javax.ejb.Init
+public class InitImpl implements Init
 {
    private String value = "";
 
@@ -45,7 +47,7 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return javax.ejb.Init.class;
+      return Init.class;
    }
    
    public void setValue(String s)

Modified: trunk/ejb3/src/main/org/jboss/ejb/InterceptorsImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/InterceptorsImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/InterceptorsImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -24,13 +24,15 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.interceptor.Interceptors;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class InterceptorsImpl implements javax.interceptor.Interceptors
+public class InterceptorsImpl implements Interceptors
 {
    private List values = new ArrayList();
 
@@ -50,7 +52,7 @@
       values.add(value);
    }
 
-   public static InterceptorsImpl getImpl(javax.interceptor.Interceptors interceptors)
+   public static InterceptorsImpl getImpl(Interceptors interceptors)
    {
       if (interceptors == null)
       {
@@ -73,6 +75,6 @@
    
    public Class annotationType()
    {
-      return javax.interceptor.Interceptors.class;
+      return Interceptors.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/LocalImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/LocalImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/LocalImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -47,6 +47,6 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return javax.ejb.Local.class;
+      return Local.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/MessageDrivenImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/MessageDrivenImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/MessageDrivenImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -66,7 +66,7 @@
 
    public Class<? extends Annotation> annotationType()
    {
-      return javax.ejb.MessageDriven.class;
+      return MessageDriven.class;
    }
    
    public String mappedName() { return mn;}

Modified: trunk/ejb3/src/main/org/jboss/ejb/PermitAllImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/PermitAllImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/PermitAllImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.annotation.security.PermitAll;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class PermitAllImpl implements javax.annotation.security.PermitAll
+public class PermitAllImpl implements PermitAll
 {
    public PermitAllImpl()
    {
@@ -35,11 +37,11 @@
 
    public Class annotationType()
    {
-      return javax.annotation.security.PermitAll.class;
+      return PermitAll.class;
    }
 
    public String name()
    {
-      return javax.annotation.security.PermitAll.class.getName();
+      return PermitAll.class.getName();
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/PostActivateImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/PostActivateImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/PostActivateImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.PostActivate;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class PostActivateImpl implements javax.ejb.PostActivate
+public class PostActivateImpl implements PostActivate
 {
    public PostActivateImpl()
    {
@@ -35,6 +37,6 @@
 
    public Class annotationType()
    {
-      return javax.ejb.PostActivate.class;
+      return PostActivate.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/PostConstructImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/PostConstructImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/PostConstructImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.annotation.PostConstruct;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class PostConstructImpl implements javax.annotation.PostConstruct
+public class PostConstructImpl implements PostConstruct
 {
    public PostConstructImpl()
    {
@@ -35,6 +37,6 @@
 
    public Class annotationType()
    {
-      return javax.annotation.PostConstruct.class;
+      return PostConstruct.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/PreDestroyImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/PreDestroyImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/PreDestroyImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.annotation.PreDestroy;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class PreDestroyImpl implements javax.annotation.PreDestroy
+public class PreDestroyImpl implements PreDestroy
 {
    public PreDestroyImpl()
    {
@@ -35,6 +37,6 @@
 
    public Class annotationType()
    {
-      return javax.annotation.PreDestroy.class;
+      return PreDestroy.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/PrePassivateImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/PrePassivateImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/PrePassivateImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,13 +21,15 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.PrePassivate;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class PrePassivateImpl implements javax.ejb.PrePassivate
+public class PrePassivateImpl implements PrePassivate
 {
    public PrePassivateImpl()
    {
@@ -35,6 +37,6 @@
 
    public Class annotationType()
    {
-      return javax.ejb.PrePassivate.class;
+      return PrePassivate.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/RemoveImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/RemoveImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/RemoveImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.Remove;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class RemoveImpl implements javax.ejb.Remove
+public class RemoveImpl implements Remove
 {
    private boolean retain = false;
 
@@ -49,6 +51,6 @@
 
    public Class annotationType()
    {
-      return javax.ejb.Remove.class;
+      return Remove.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/ResourceImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/ResourceImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/ResourceImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.annotation.Resource;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class ResourceImpl implements javax.annotation.Resource
+public class ResourceImpl implements Resource
 {
    private boolean shareable;
    private AuthenticationType authenticationType;
@@ -97,6 +99,6 @@
 
    public Class annotationType()
    {
-      return javax.annotation.Resource.class;
+      return Resource.class;
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/RolesAllowedImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/RolesAllowedImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/RolesAllowedImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -23,13 +23,15 @@
 
 import java.util.ArrayList;
 
+import javax.annotation.security.RolesAllowed;
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class RolesAllowedImpl implements javax.annotation.security.RolesAllowed
+public class RolesAllowedImpl implements RolesAllowed
 {
    private ArrayList values = new ArrayList();
 
@@ -51,11 +53,11 @@
 
    public Class annotationType()
    {
-      return javax.annotation.security.RolesAllowed.class;
+      return RolesAllowed.class;
    }
 
    public String name()
    {
-      return javax.annotation.security.RolesAllowed.class.getName();
+      return RolesAllowed.class.getName();
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/RunAsImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/RunAsImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/RunAsImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -29,7 +29,7 @@
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class RunAsImpl implements javax.annotation.security.RunAs
+public class RunAsImpl implements RunAs
 {
    private String value;
 
@@ -45,11 +45,11 @@
 
    public Class<RunAs> annotationType()
    {
-      return javax.annotation.security.RunAs.class;
+      return RunAs.class;
    }
 
    public String name()
    {
-      return javax.annotation.security.RunAs.class.getName();
+      return RunAs.class.getName();
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/StatefulImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/StatefulImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/StatefulImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.Stateful;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class StatefulImpl implements javax.ejb.Stateful
+public class StatefulImpl implements Stateful
 {
    private String name ;
 
@@ -44,7 +46,7 @@
 
    public Class annotationType()
    {
-      return javax.ejb.Stateful.class;
+      return Stateful.class;
    }
    public String mappedName() { return "";}
    public String description() { return "";}

Modified: trunk/ejb3/src/main/org/jboss/ejb/StatelessImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/StatelessImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/StatelessImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,14 +21,16 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.Stateless;
 
+
 /**
  * // *
  *
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class StatelessImpl implements javax.ejb.Stateless
+public class StatelessImpl implements Stateless
 {
    private String name;
 
@@ -44,7 +46,7 @@
 
    public Class annotationType()
    {
-      return javax.ejb.Stateless.class;
+      return Stateless.class;
    }
 
    public String mappedName() { return "";}

Modified: trunk/ejb3/src/main/org/jboss/ejb/TransactionAttributeImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/TransactionAttributeImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/TransactionAttributeImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,6 +21,7 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.TransactionAttribute;
 import javax.ejb.TransactionAttributeType;
 
 /**
@@ -29,7 +30,7 @@
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class TransactionAttributeImpl implements javax.ejb.TransactionAttribute
+public class TransactionAttributeImpl implements TransactionAttribute
 {
    private TransactionAttributeType type;
 
@@ -54,11 +55,11 @@
 
    public Class annotationType()
    {
-      return javax.ejb.TransactionAttribute.class;
+      return TransactionAttribute.class;
    }
 
    public String name()
    {
-      return javax.ejb.TransactionAttribute.class.getName();
+      return TransactionAttribute.class.getName();
    }
 }

Modified: trunk/ejb3/src/main/org/jboss/ejb/TransactionManagementImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb/TransactionManagementImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb/TransactionManagementImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -21,6 +21,7 @@
  */
 package org.jboss.ejb;
 
+import javax.ejb.TransactionManagement;
 import javax.ejb.TransactionManagementType;
 
 /**
@@ -29,7 +30,7 @@
  * @author <a href="mailto:bill at jboss.org">William DeCoste</a>
  * @version $Revision$
  */
-public class TransactionManagementImpl implements javax.ejb.TransactionManagement
+public class TransactionManagementImpl implements TransactionManagement
 {
    private TransactionManagementType value = TransactionManagementType.CONTAINER;
 
@@ -47,8 +48,8 @@
       this.value = value;
    }
 
-   public Class annotationType()
+   public Class<TransactionManagement> annotationType()
    {
-      return javax.ejb.TransactionManagement.class;
+      return TransactionManagement.class;
    }
 }

Added: trunk/ejb3/src/main/org/jboss/ejb3/AnnotationRepositoryToMetaData.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/AnnotationRepositoryToMetaData.java	                        (rev 0)
+++ trunk/ejb3/src/main/org/jboss/ejb3/AnnotationRepositoryToMetaData.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,316 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Map;
+
+import javassist.CtClass;
+import javassist.CtConstructor;
+import javassist.CtField;
+import javassist.CtMember;
+import javassist.CtMethod;
+import javassist.NotFoundException;
+
+import org.jboss.annotation.factory.AnnotationCreator;
+import org.jboss.aop.annotation.AnnotationRepository;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.plugins.context.AbstractMetaDataContext;
+import org.jboss.metadata.plugins.loader.memory.MemoryMetaDataLoader;
+import org.jboss.metadata.plugins.loader.reflection.ClassMetaDataRetrievalFactory;
+import org.jboss.metadata.spi.MetaData;
+import org.jboss.metadata.spi.context.MetaDataContext;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge;
+import org.jboss.metadata.spi.scope.CommonLevels;
+import org.jboss.metadata.spi.scope.Scope;
+import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.metadata.spi.signature.ConstructorSignature;
+import org.jboss.metadata.spi.signature.FieldSignature;
+import org.jboss.metadata.spi.signature.MethodSignature;
+import org.jboss.metadata.spi.signature.Signature;
+
+/**
+ * AnnotationRepositoryToMetaData.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class AnnotationRepositoryToMetaData extends AnnotationRepository
+{
+   /** The log */
+   private static final Logger log = Logger.getLogger(AnnotationRepositoryToMetaData.class);
+   
+   /** The metadata */
+   private MetaData metaData;
+   
+   /** The mutable metadata */
+   private MemoryMetaDataLoader mutableMetaData;
+   
+   /** The classloader */
+   private ClassLoader classLoader;
+
+   public AnnotationRepositoryToMetaData(EJBContainer container)
+   {
+      if (container == null)
+         throw new IllegalArgumentException("Null container");
+
+      Class<?> beanClass = container.getClazz();
+      if (beanClass == null)
+         throw new IllegalArgumentException("Null bean class");
+      String name = container.getObjectName().getCanonicalName();
+      if (name == null)
+         throw new IllegalArgumentException("Null name");
+      this.classLoader = container.getClassloader();
+      if (classLoader == null)
+         throw new IllegalArgumentException("Null class");
+      
+      MetaDataRetrieval classMetaData = ClassMetaDataRetrievalFactory.INSTANCE.getMetaDataRetrieval(new Scope(CommonLevels.CLASS, beanClass));
+      mutableMetaData = new MemoryMetaDataLoader(new ScopeKey(CommonLevels.INSTANCE, name));
+      MetaDataRetrieval dynamicXml = new EJBMetaDataLoader(container);
+      
+      MetaDataContext classContext = new AbstractMetaDataContext(classMetaData);
+      MetaDataRetrieval[] instance = { dynamicXml, mutableMetaData }; 
+      MetaDataContext instanceContext = new AbstractMetaDataContext(classContext, Arrays.asList(instance));
+      metaData = new MetaDataRetrievalToMetaDataBridge(instanceContext);
+   }
+   
+   /**
+    * Create a signature from javassist member
+    * 
+    * @param member the member
+    * @return the signature
+    */
+   protected static Signature getSignature(CtMember member)
+   {
+      if (member == null)
+         throw new IllegalArgumentException("Null member");
+
+      try
+      {
+         if (member instanceof CtMethod)
+         {
+            CtMethod method = (CtMethod) member;
+            CtClass[] parameterTypes = method.getParameterTypes();
+            String[] params = Signature.NO_PARAMETERS;
+            if (parameterTypes.length > 0)
+            {
+               params = new String[parameterTypes.length];
+               for (int i = 0; i < params.length; ++i)
+                  params[i] = parameterTypes[i].getName();
+            }
+            return new MethodSignature(method.getName(), params);
+         }
+         if (member instanceof CtConstructor)
+         {
+            CtConstructor constructor = (CtConstructor) member;
+            CtClass[] parameterTypes = constructor.getParameterTypes();
+            String[] params = Signature.NO_PARAMETERS;
+            if (parameterTypes.length > 0)
+            {
+               params = new String[parameterTypes.length];
+               for (int i = 0; i < params.length; ++i)
+                  params[i] = parameterTypes[i].getName();
+            }
+            return new ConstructorSignature(params);
+         }
+         if (member instanceof CtField)
+         {
+            return new FieldSignature(member.getName());
+         }
+         throw new IllegalArgumentException("Unknown member type: " + member);
+      }
+      catch (NotFoundException e)
+      {
+         throw new RuntimeException("Error determing signature: " + member, e);
+      }
+   }
+
+   /**
+    * Initialise an annotation
+    * 
+    * @param annotation the annotation or a string
+    * @return the annotation
+    */
+   protected Annotation initAnnotation(Object annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+
+      if (annotation instanceof Annotation)
+         return (Annotation) annotation;
+      
+      if (annotation instanceof String == false)
+         throw new IllegalArgumentException("Not an annotation: " + annotation);
+      
+      try
+      {
+         return (Annotation) AnnotationCreator.createAnnotation((String) annotation, classLoader);
+      }
+      catch (RuntimeException e)
+      {
+         throw e;
+      }
+      catch (Exception e)
+      {
+         throw new RuntimeException("Error creating annotation: " + annotation, e);
+      }
+   }
+   
+   protected Class loadClass(String className)
+   {
+      try
+      {
+         return classLoader.loadClass(className);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new RuntimeException("Unable to load class for annotation: " + className);
+      }
+   }
+   
+   public void addAnnotation(CtMember m, String annotation)
+   {
+      mutableMetaData.addAnnotation(getSignature(m), initAnnotation(annotation));
+   }
+
+   public void addAnnotation(Member m, Class annotation, Object value)
+   {
+      mutableMetaData.addAnnotation(m, initAnnotation(value));
+   }
+
+   public void addAnnotation(Member m, String annotation, Object value)
+   {
+      mutableMetaData.addAnnotation(m, initAnnotation(value));
+   }
+
+   public void addClassAnnotation(Class annotation, Object value)
+   {
+      mutableMetaData.addAnnotation(initAnnotation(value));
+   }
+
+   public void addClassAnnotation(String annotation, String value)
+   {
+      mutableMetaData.addAnnotation(initAnnotation(value));
+   }
+
+   public void disableAnnotation(Member m, String annotation)
+   {
+      log.warn("Not implemented: disableAnnotation(" + m + ", " + annotation + ")");
+   }
+
+   public void disableAnnotation(String annotation)
+   {
+      log.warn("Not implemented: disableAnnotation(" + annotation + ")");
+   }
+
+   public void enableAnnotation(String annotation)
+   {
+      log.warn("Not implemented: enableAnnotation(" + annotation + ")");
+   }
+
+   public Map getAnnotations()
+   {
+      log.warn("Not implemented: getAnnotations()");
+      return Collections.emptyMap();
+   }
+
+   public Map getClassAnnotations()
+   {
+      log.warn("Not implemented: getClassAnnotations()");
+      return Collections.emptyMap();
+   }
+
+   public boolean hasAnnotation(CtMember m, String annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+      MetaData component = metaData.getComponentMetaData(getSignature(m));
+      if (component == null)
+         return false;
+      return component.isMetaDataPresent(annotation);
+   }
+
+   public boolean hasAnnotation(Member m, Class annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+      MetaData component = metaData.getComponentMetaData(Signature.getSignature(m));
+      if (component == null)
+         return false;
+      return component.isAnnotationPresent(annotation);
+   }
+
+   public boolean hasAnnotation(Member m, String annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+      MetaData component = metaData.getComponentMetaData(Signature.getSignature(m));
+      if (component == null)
+         return false;
+      return component.isAnnotationPresent(loadClass(annotation));
+   }
+
+   public boolean hasClassAnnotation(Class annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+      return metaData.isAnnotationPresent(annotation);
+   }
+
+   public boolean hasClassAnnotation(String annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+      return metaData.isAnnotationPresent(loadClass(annotation));
+   }
+
+   public boolean isDisabled(Class annotation)
+   {
+      return false;
+   }
+
+   public boolean isDisabled(Member m, Class annotation)
+   {
+      return false;
+   }
+
+   public boolean isDisabled(Member m, String annotation)
+   {
+      return false;
+   }
+
+   public boolean isDisabled(String annotation)
+   {
+      return false;
+   }
+
+   public Object resolveClassAnnotation(Class annotation)
+   {
+      if (annotation == null)
+         throw new IllegalArgumentException("Null annotation");
+      return metaData.getMetaData(annotation);
+   }
+}

Modified: trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBContainer.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -213,6 +213,9 @@
       {
          throw new RuntimeException("failed to create object name for: " + on, e);
       }
+      
+      annotations = new AnnotationRepositoryToMetaData(this);
+      
       initialContextProperties = ctxProperties;
       try
       {

Added: trunk/ejb3/src/main/org/jboss/ejb3/EJBMetaDataLoader.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/ejb3/EJBMetaDataLoader.java	                        (rev 0)
+++ trunk/ejb3/src/main/org/jboss/ejb3/EJBMetaDataLoader.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,179 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, JBoss Inc., and individual contributors as indicated
+* by the @authors tag. See the copyright.txt 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;
+
+import java.lang.annotation.Annotation;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.jboss.annotation.security.SecurityDomain;
+import org.jboss.annotation.security.SecurityDomainImpl;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.plugins.loader.BasicMetaDataLoader;
+import org.jboss.metadata.spi.retrieval.AnnotationItem;
+import org.jboss.metadata.spi.retrieval.AnnotationsItem;
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationItem;
+import org.jboss.metadata.spi.retrieval.simple.SimpleAnnotationsItem;
+import org.jboss.metadata.spi.signature.MethodSignature;
+import org.jboss.metadata.spi.signature.Signature;
+
+/**
+ * EJBMetaDataLoader.
+ * 
+ * @author <a href="adrian at jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class EJBMetaDataLoader extends BasicMetaDataLoader
+{
+   /** The container */
+   private EJBContainer container;
+   
+   /** Component cache */
+   private Map<Signature, MetaDataRetrieval> cache = new ConcurrentHashMap<Signature, MetaDataRetrieval>();
+   
+   /**
+    * Create a new EJBMetaDataLoader.
+    * 
+    * @param container
+    */
+   public EJBMetaDataLoader(EJBContainer container)
+   {
+      if (container == null)
+         throw new IllegalArgumentException("Null container");
+      this.container = container;
+   }
+   
+   /**
+    * Get the bean metadata
+    * 
+    * @return the bean metadata
+    */
+   protected JBossEnterpriseBeanMetaData getBeanMetaData()
+   {
+      return container.getXml();
+   }
+   
+   public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+   {
+      JBossEnterpriseBeanMetaData beanMetaData = getBeanMetaData();
+      if (beanMetaData == null)
+         return null;
+
+      if (signature instanceof MethodSignature == false)
+         return null;
+      
+      MetaDataRetrieval retrieval = cache.get(signature);
+      if (retrieval != null)
+         return retrieval;
+
+      retrieval = new MethodMetaDataRetrieval((MethodSignature) signature);
+      cache.put(signature, retrieval);
+      return retrieval;
+   }
+
+   public boolean isEmpty()
+   {
+      return getBeanMetaData() != null;
+   }
+
+   public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+   {
+      JBossEnterpriseBeanMetaData beanMetaData = getBeanMetaData();
+      if (beanMetaData == null)
+         return null;
+      
+      if (annotationType == SecurityDomain.class)
+      {
+         String securityDomain = beanMetaData.getSecurityDomain();
+         if (securityDomain != null)
+            return new SimpleAnnotationItem(new SecurityDomainImpl(securityDomain));
+      }
+      return null;
+   }
+   
+   public AnnotationsItem retrieveAnnotations()
+   {
+      List<AnnotationItem> annotations = new ArrayList<AnnotationItem>();
+      AnnotationItem annotation = retrieveAnnotation(SecurityDomain.class);
+      if (annotation != null)
+         annotations.add(annotation);
+      if (annotations.isEmpty())
+         return SimpleAnnotationsItem.NO_ANNOTATIONS;
+      else
+         return new SimpleAnnotationsItem(annotations.toArray(new AnnotationItem[annotations.size()]));
+   }
+
+   /**
+    * MethodMetaDataRetrieval.
+    */
+   private class MethodMetaDataRetrieval extends BasicMetaDataLoader
+   {
+      /** The signature */
+      private MethodSignature signature;
+      
+      /**
+       * Create a new MethodMetaDataRetrieval.
+       * 
+       * @param methodSignature the signature
+       */
+      public MethodMetaDataRetrieval(MethodSignature methodSignature)
+      {
+         this.signature = methodSignature;
+      }
+
+      public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
+      {
+         return null;
+      }
+
+      public boolean isEmpty()
+      {
+         return false;
+      }
+
+      public <T extends Annotation> AnnotationItem<T> retrieveAnnotation(Class<T> annotationType)
+      {
+         /* Example 
+         JBossEnterpriseBeanMetaData beanMetaData = getBeanMetaData();
+         if (beanMetaData == null)
+            return null;
+         
+         if (annotationType == TransactionTimeout.class)
+         {
+            MethodAttributesMetaData methodAttributes = beanMetaData.getMethodAttributes();
+            int timeout = methodAttributes.getMethodTransactionTimeout(signature.getName());
+            return new SimpleAnnotationItem(new TransactionTimeoutImpl(timeout));
+         }
+         */
+         return null;
+      }
+
+      public AnnotationsItem retrieveAnnotations()
+      {
+         // TODO
+         return SimpleAnnotationsItem.NO_ANNOTATIONS;
+      }
+   }
+}

Modified: trunk/ejb3/src/main/org/jboss/persistence/EntityImpl.java
===================================================================
--- trunk/ejb3/src/main/org/jboss/persistence/EntityImpl.java	2007-11-24 17:20:29 UTC (rev 67429)
+++ trunk/ejb3/src/main/org/jboss/persistence/EntityImpl.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -41,12 +41,12 @@
 
    public String name()
    {
-      return javax.persistence.Entity.class.getName();
+      return Entity.class.getName();
    }
 
-   public Class annotationType()
+   public Class<Entity> annotationType()
    {
-      return javax.persistence.Entity.class;
+      return Entity.class;
    }
 
    public String[] values()

Added: trunk/ejb3/src/resources/test/changexml/META-INF/ejb-jar.xml
===================================================================
--- trunk/ejb3/src/resources/test/changexml/META-INF/ejb-jar.xml	                        (rev 0)
+++ trunk/ejb3/src/resources/test/changexml/META-INF/ejb-jar.xml	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,24 @@
+<?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"> 
+   <enterprise-beans>
+      <session>
+         <ejb-name>SessionBean</ejb-name>
+         <local>org.jboss.ejb3.test.changexml.SessionLocal</local>
+         <ejb-class>org.jboss.ejb3.test.changexml.SessionBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+      <session>
+         <ejb-name>TesterBean</ejb-name>
+         <remote>org.jboss.ejb3.test.changexml.TesterRemote</remote>
+         <ejb-class>org.jboss.ejb3.test.changexml.TesterBean</ejb-class>
+         <session-type>Stateless</session-type>
+         <transaction-type>Container</transaction-type>
+      </session>
+   </enterprise-beans>
+</ejb-jar>

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionBean.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,36 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.changexml;
+
+import javax.ejb.EJB;
+
+/**
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 61136 $
+ */
+public class SessionBean implements SessionLocal
+{
+   public String doSomething(String string) 
+   {
+       return string;
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionLocal.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionLocal.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/SessionLocal.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,31 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.changexml;
+
+/**
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 61136 $
+ */
+public interface SessionLocal
+{
+   String doSomething(String string);
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterBean.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterBean.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterBean.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.changexml;
+
+import java.net.URL;
+
+import javax.ejb.EJB;
+import javax.ejb.EJBAccessException;
+import javax.management.MBeanServer;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployment.MainDeployerMBean;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.mx.util.MBeanServerLocator;
+
+/**
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 61136 $
+ */
+public class TesterBean implements TesterRemote
+{
+   @EJB private SessionLocal local;
+
+   public void runTest(URL url) throws Exception
+   {
+      if (local == null)
+         throw new RuntimeException("local not injected");
+   
+      // No security domain should work
+      if ("Ok".equals(local.doSomething("Ok")) == false)
+         throw new RuntimeException("doSomething didn't work");
+      
+      // Add a security domain 
+      MBeanServer server = MBeanServerLocator.locateJBoss();
+      DeploymentUnit unit = (DeploymentUnit) server.invoke(MainDeployerMBean.OBJECT_NAME, "getDeploymentUnit", new Object[] { url }, new String[] { URL.class.getName() });
+      if (unit == null)
+         throw new RuntimeException("Not deployed: " + url);
+      JBossMetaData jbossMetaData = unit.getAttachment(JBossMetaData.class);
+      if (jbossMetaData == null)
+         throw new RuntimeException("No JBossMetaData");
+      JBossEnterpriseBeanMetaData bean = jbossMetaData.getEnterpriseBean(SessionBean.class.getSimpleName());
+      if (bean == null)
+         throw new RuntimeException("No bean");
+      bean.setSecurityDomain("other");
+      
+      // Now this shouldn't work
+      try
+      {
+         local.doSomething("bad");
+      }
+      catch (EJBAccessException expected)
+      {
+         return;
+      }
+      throw new RuntimeException("Should not be here!"); 
+   }
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterRemote.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterRemote.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/TesterRemote.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.changexml;
+
+import java.net.URL;
+
+
+/**
+ * @author <a href="mailto:adrian at jboss.org">Adrian Brock</a>
+ * @version $Revision: 61136 $
+ */
+public interface TesterRemote
+{
+   void runTest(URL url) throws Exception;
+}

Added: trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/unit/ChangeXMLUnitTestCase.java
===================================================================
--- trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/unit/ChangeXMLUnitTestCase.java	                        (rev 0)
+++ trunk/ejb3/src/test/org/jboss/ejb3/test/changexml/unit/ChangeXMLUnitTestCase.java	2007-11-24 17:22:00 UTC (rev 67430)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.changexml.unit;
+
+import java.io.File;
+
+import org.jboss.ejb3.test.changexml.TesterRemote;
+import org.jboss.test.JBossTestCase;
+import junit.framework.Test;
+
+/**
+ * @author <a href="mailto:adrian at jboss.com">Adrian Brock</a>
+ */
+public class ChangeXMLUnitTestCase extends JBossTestCase
+{
+   public ChangeXMLUnitTestCase(String name)
+   {
+      super(name);
+   }
+   
+   public void testChangeXML() throws Exception
+   {
+      TesterRemote tester = (TesterRemote)getInitialContext().lookup("TesterBean/remote");
+      String deployDir = System.getProperty("jbosstest.deploy.dir");
+      File file = new File(deployDir + "/" + "changexml.jar"); 
+      tester.runTest(file.toURL());
+   }
+
+   public static Test suite() throws Exception
+   {
+      return getDeploySetup(ChangeXMLUnitTestCase.class, "changexml.jar");
+   }
+
+}




More information about the jboss-cvs-commits mailing list