[jboss-cvs] JBossAS SVN: r68870 - in projects/ejb3/trunk: metadata and 26 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Jan 11 04:47:57 EST 2008
Author: wolfc
Date: 2008-01-11 04:47:56 -0500 (Fri, 11 Jan 2008)
New Revision: 68870
Added:
projects/ejb3/trunk/metadata/
projects/ejb3/trunk/metadata/.classpath
projects/ejb3/trunk/metadata/.project
projects/ejb3/trunk/metadata/.settings/
projects/ejb3/trunk/metadata/.settings/org.eclipse.jdt.core.prefs
projects/ejb3/trunk/metadata/pom.xml
projects/ejb3/trunk/metadata/src/
projects/ejb3/trunk/metadata/src/main/
projects/ejb3/trunk/metadata/src/main/java/
projects/ejb3/trunk/metadata/src/main/java/org/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/EJBMetaDataLoader.java
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/AnnotationRepositoryToMetaData.java
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/retrieval/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/retrieval/ClassMetaDataRetrieval.java
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/
projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java
projects/ejb3/trunk/metadata/src/test/
projects/ejb3/trunk/metadata/src/test/java/
projects/ejb3/trunk/metadata/src/test/java/org/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/
projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java
projects/ejb3/trunk/metadata/src/test/resources/
projects/ejb3/trunk/metadata/src/test/resources/interceptor/
projects/ejb3/trunk/metadata/src/test/resources/interceptor/ejb-jar.xml
projects/ejb3/trunk/metadata/src/test/resources/securitydomain/
projects/ejb3/trunk/metadata/src/test/resources/securitydomain/jboss.xml
Log:
Moved meta data loader here (security domain is working)
Property changes on: projects/ejb3/trunk/metadata
___________________________________________________________________
Name: svn:ignore
+ eclipse-target
target
Added: projects/ejb3/trunk/metadata/.classpath
===================================================================
--- projects/ejb3/trunk/metadata/.classpath (rev 0)
+++ projects/ejb3/trunk/metadata/.classpath 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,39 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="src" path="src/test/java" output="eclipse-target/tests-classes"/>
+ <classpathentry kind="src" path="src/test/resources" output="eclipse-target/tests-classes" excluding="**/*.java"/>
+ <classpathentry kind="output" path="eclipse-target/classes"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta4/jboss-vfs-2.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-vfs/2.0.0.Beta4/jboss-vfs-2.0.0.Beta4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/qdox/qdox/1.6/qdox-1.6.jar" sourcepath="M2_REPO/qdox/qdox/1.6/qdox-1.6-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR1/jboss-aop-2.0.0.CR1.jar" sourcepath="M2_REPO/org/jboss/aop/jboss-aop/2.0.0.CR1/jboss-aop-2.0.0.CR1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/trove/trove/1.0.2/trove-1.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-log4j/log4j/1.2.8/log4j-1.2.8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossws-spi/1.0.0.GA/jbossws-spi-1.0.0.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/ant/ant/1.6.5/ant-1.6.5.jar" sourcepath="M2_REPO/ant/ant/1.6.5/ant-1.6.5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-common-core/2.2.1.GA/jboss-common-core-2.2.1.GA.jar" sourcepath="M2_REPO/org/jboss/jboss-common-core/2.2.1.GA/jboss-common-core-2.2.1.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xml-apis/2.7.1/xml-apis-2.7.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.0.2/activation-1.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.Beta3Update1/jboss-transaction-api-1.0.1.Beta3Update1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-transaction-api/1.0.1.Beta3Update1/jboss-transaction-api-1.0.1.Beta3Update1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/wutka-dtdparser/dtdparser121/1.2.1/dtdparser121-1.2.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-slide/webdavlib/2.0/webdavlib-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-metadata/1.0.0.Beta4/jboss-metadata-1.0.0.Beta4.jar" sourcepath="M2_REPO/org/jboss/jboss-metadata/1.0.0.Beta4/jboss-metadata-1.0.0.Beta4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-log4j/2.0.2.GA/jboss-logging-log4j-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jboss-jaxws/2.0.1.GA/jboss-jaxws-2.0.1.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9.jar" sourcepath="M2_REPO/org/jboss/microcontainer/jboss-container/2.0.0.Beta9/jboss-container-2.0.0.Beta9-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jbossws/jboss-jaxrpc/1.0.4.GA/jboss-jaxrpc-1.0.4.GA.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-javaee/5.0.0.Beta3/jboss-javaee-5.0.0.Beta3-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/jbossxb/2.0.0.CR5/jbossxb-2.0.0.CR5.jar" sourcepath="M2_REPO/org/jboss/jbossxb/2.0.0.CR5/jbossxb-2.0.0.CR5-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-core/2.0.2.GA/jboss-common-core-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-core/2.0.2.GA/jboss-common-core-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-impl/0.1.3-SNAPSHOT/jboss-ejb3-impl-0.1.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-impl/0.1.3-SNAPSHOT/jboss-ejb3-impl-0.1.3-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/junit/junit/4.4/junit-4.4.jar" sourcepath="M2_REPO/junit/junit/4.4/junit-4.4-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/apache-xerces/xercesImpl/2.7.1/xercesImpl-2.7.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.Beta3Update1/jboss-ejb-api-3.0.0.Beta3Update1.jar" sourcepath="M2_REPO/org/jboss/javaee/jboss-ejb-api/3.0.0.Beta3Update1/jboss-ejb-api-3.0.0.Beta3Update1-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA.jar" sourcepath="M2_REPO/jboss/jboss-common-logging-spi/2.0.4.GA/jboss-common-logging-spi-2.0.4.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA.jar" sourcepath="M2_REPO/org/jboss/javassist/3.6.0.GA/javassist-3.6.0.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.1.3-SNAPSHOT/jboss-ejb3-ext-api-0.1.3-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/ejb3/jboss-ejb3-ext-api/0.1.3-SNAPSHOT/jboss-ejb3-ext-api-0.1.3-SNAPSHOT-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/jboss/jboss-logging-spi/2.0.2.GA/jboss-logging-spi-2.0.2.GA.jar" sourcepath="M2_REPO/jboss/jboss-logging-spi/2.0.2.GA/jboss-logging-spi-2.0.2.GA-sources.jar"/>
+ <classpathentry kind="var" path="M2_REPO/sun-jaxb/jaxb-api/2.0.5/jaxb-api-2.0.5.jar"/>
+</classpath>
\ No newline at end of file
Added: projects/ejb3/trunk/metadata/.project
===================================================================
--- projects/ejb3/trunk/metadata/.project (rev 0)
+++ projects/ejb3/trunk/metadata/.project 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,14 @@
+<projectDescription>
+ <name>jboss-ejb3-metadata</name>
+ <comment>The JBoss EJB 3 MetaData component implements the meta data retrieval
+ bridge between jboss-metadata and annotations.</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Added: projects/ejb3/trunk/metadata/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/ejb3/trunk/metadata/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/ejb3/trunk/metadata/.settings/org.eclipse.jdt.core.prefs 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,5 @@
+#Fri Jan 11 09:16:39 CET 2008
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
Added: projects/ejb3/trunk/metadata/pom.xml
===================================================================
--- projects/ejb3/trunk/metadata/pom.xml (rev 0)
+++ projects/ejb3/trunk/metadata/pom.xml 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,69 @@
+<!--
+ vi:ts=2:sw=2:expandtab
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3</artifactId>
+ <version>0.12.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>jboss-ejb3-metadata</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss EJB 3 Interceptors</name>
+ <url>http://www.jboss.org</url>
+ <description>
+ The JBoss EJB 3 MetaData component implements the meta data retrieval
+ bridge between jboss-metadata and annotations.
+ </description>
+
+ <dependencies>
+ <!-- internal -->
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-ext-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.ejb3</groupId>
+ <artifactId>jboss-ejb3-impl</artifactId>
+ </dependency>
+
+ <!-- external -->
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-metadata</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.javaee</groupId>
+ <artifactId>jboss-ejb-api</artifactId>
+ </dependency>
+
+ <!-- broken transitive dependencies of AOP -->
+ <!--
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-container</artifactId>
+ </dependency>
+ -->
+ </dependencies>
+</project>
Property changes on: projects/ejb3/trunk/metadata/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Copied: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/EJBMetaDataLoader.java (from rev 68808, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/EJBMetaDataLoader.java)
===================================================================
--- projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/EJBMetaDataLoader.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/EJBMetaDataLoader.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,181 @@
+/*
+* 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.metadata;
+
+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.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.annotation.impl.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.scope.ScopeKey;
+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 JBossEnterpriseBeanMetaData beanMetaData;
+
+ /** Component cache */
+ private Map<Signature, MetaDataRetrieval> cache = new ConcurrentHashMap<Signature, MetaDataRetrieval>();
+
+ /**
+ * Create a new EJBMetaDataLoader.
+ *
+ * @param key the scope
+ * @param container the container
+ */
+ public EJBMetaDataLoader(ScopeKey key, JBossEnterpriseBeanMetaData beanMetaData)
+ {
+ super(key);
+ assert beanMetaData != null : "beanMetaData is null";
+ this.beanMetaData = beanMetaData;
+ }
+
+ /**
+ * Get the bean metadata
+ *
+ * @return the bean metadata
+ */
+ protected JBossEnterpriseBeanMetaData getBeanMetaData()
+ {
+ return beanMetaData;
+ }
+
+ 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<T>(annotationType.cast(new SecurityDomainImpl(securityDomain)));
+ }
+ return null;
+ }
+
+ public AnnotationsItem retrieveAnnotations()
+ {
+ List<AnnotationItem<?>> annotations = new ArrayList<AnnotationItem<?>>();
+ AnnotationItem<SecurityDomain> 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;
+ }
+ }
+}
Copied: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/AnnotationRepositoryToMetaData.java (from rev 68808, projects/ejb3/trunk/core/src/main/java/org/jboss/ejb3/AnnotationRepositoryToMetaData.java)
===================================================================
--- projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/AnnotationRepositoryToMetaData.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/AnnotationRepositoryToMetaData.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,385 @@
+/*
+* 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.metadata.annotation;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.util.Arrays;
+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.ejb3.metadata.EJBMetaDataLoader;
+import org.jboss.ejb3.metadata.spi.signature.ClassSignature;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+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 implements ExtendedAnnotationRepository
+{
+ /** 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(Class<?> beanClass, JBossEnterpriseBeanMetaData beanMetaData, String canonicalObjectName, ClassLoader classLoader)
+ {
+ assert beanClass != null : "beanClass is null";
+ assert beanMetaData != null : "beanMetaData is null";
+ assert canonicalObjectName != null : "canonicalObjectName is null";
+ assert classLoader != null : "classLoader is null";
+
+ this.classLoader = classLoader;
+
+ MetaDataRetrieval classMetaData = ClassMetaDataRetrievalFactory.INSTANCE.getMetaDataRetrieval(new Scope(CommonLevels.CLASS, beanClass));
+ ScopeKey instanceScope = new ScopeKey(CommonLevels.INSTANCE, canonicalObjectName);
+ mutableMetaData = new MemoryMetaDataLoader(instanceScope);
+ MetaDataRetrieval dynamicXml = new EJBMetaDataLoader(instanceScope, beanMetaData);
+
+ MetaDataContext classContext = new AbstractMetaDataContext(classMetaData);
+ MetaDataRetrieval[] instance = { dynamicXml, mutableMetaData };
+ MetaDataContext instanceContext = new AbstractMetaDataContext(classContext, Arrays.asList(instance));
+ metaData = new MetaDataRetrievalToMetaDataBridge(instanceContext);
+ }
+
+ protected static Signature getSignature(Class<?> cls)
+ {
+ return new ClassSignature(cls);
+ }
+
+ /**
+ * 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 + " using class loader " + classLoader);
+ }
+ }
+
+ 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)
+ {
+ throw new RuntimeException("Not implemented: disableAnnotation(" + m + ", " + annotation + ")");
+ }
+
+ public void disableAnnotation(String annotation)
+ {
+ throw new RuntimeException("Not implemented: disableAnnotation(" + annotation + ")");
+ }
+
+ public void enableAnnotation(String annotation)
+ {
+ throw new RuntimeException("Not implemented: enableAnnotation(" + annotation + ")");
+ }
+
+ /**
+ * Get the component meta data of another class which is
+ * under advisement.
+ *
+ * @param cls
+ * @return
+ */
+ protected MetaData getComponentMetaData(Class<?> cls)
+ {
+ return metaData.getComponentMetaData(getSignature(cls));
+ }
+
+ public Map getAnnotations()
+ {
+ throw new RuntimeException("Not implemented: getAnnotations()");
+ }
+
+ public Map getClassAnnotations()
+ {
+ throw new RuntimeException("Not implemented: getClassAnnotations()");
+ }
+
+ public boolean hasAnnotation(Class<?> cls, Class<? extends Annotation> annotationType)
+ {
+ if(annotationType == null)
+ throw new IllegalArgumentException("annotationType is null");
+ MetaData component = getComponentMetaData(cls);
+ if(component == null)
+ return false;
+ return component.isMetaDataPresent(annotationType);
+ }
+
+ public boolean hasAnnotation(Class<?> cls, Member member, Class<? extends Annotation> annotationType)
+ {
+ if(annotationType == null)
+ throw new IllegalArgumentException("annotationType is null");
+ MetaData classComponent = getComponentMetaData(cls);
+ MetaData component = classComponent.getComponentMetaData(Signature.getSignature(member));
+ if(component == null)
+ return false;
+ return component.isMetaDataPresent(annotationType);
+ }
+
+ 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.getAnnotation(annotation);
+ }
+
+ public <A extends Annotation> A resolveAnnotation(Class<?> cls, Class<A> annotationType)
+ {
+ if(annotationType == null)
+ throw new IllegalArgumentException("annotationType is null");
+ MetaData component = getComponentMetaData(cls);
+ if (component == null)
+ return null;
+ return component.getAnnotation(annotationType);
+ }
+
+ public <A extends Annotation> A resolveAnnotation(Class<?> cls, Member member, Class<A> annotationType)
+ {
+ if(annotationType == null)
+ throw new IllegalArgumentException("annotationType is null");
+ MetaData classComponent = getComponentMetaData(cls);
+ MetaData component = classComponent.getComponentMetaData(Signature.getSignature(member));
+ if (component == null)
+ return null;
+ return component.getAnnotation(annotationType);
+ }
+
+ public Object resolveAnnotation(Member m, Class annotation)
+ {
+ if (annotation == null)
+ throw new IllegalArgumentException("Null annotation");
+ MetaData component = metaData.getComponentMetaData(Signature.getSignature(m));
+ if (component == null)
+ return null;
+ return component.getAnnotation(annotation);
+ }
+
+ protected Object resolveAnnotation(Member m, String annotation)
+ {
+ return resolveAnnotation(m, loadClass(annotation));
+ }
+}
Added: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java
===================================================================
--- projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,55 @@
+/*
+ * 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.metadata.annotation;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+
+
+/**
+ * Allows querying an annotation repository on classes which
+ * are also under advisement by this advisor, but not the advised class
+ * itself.
+ *
+ * (For interceptor classes associated with a class.)
+ *
+ * Note: this is not a full repository, but only an interrogator.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ExtendedAnnotationRepository
+{
+ boolean hasAnnotation(Class<?> cls, Class<? extends Annotation> annotationType);
+
+ boolean hasAnnotation(Class<?> cls, Member member, Class<? extends Annotation> annotationType);
+
+ /*
+ boolean isDisabled(Class<?> cls, Class<? extends Annotation> annotationType);
+
+ boolean isDisabled(Class<?> cls, Member member, Class<? extends Annotation> annotationType);
+ */
+
+ <A extends Annotation> A resolveAnnotation(Class<?> cls, Class<A> annotationType);
+
+ <A extends Annotation> A resolveAnnotation(Class<?> cls, Member member, Class<A> annotationType);
+}
Property changes on: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/annotation/ExtendedAnnotationRepository.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/retrieval/ClassMetaDataRetrieval.java
===================================================================
--- projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/retrieval/ClassMetaDataRetrieval.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/retrieval/ClassMetaDataRetrieval.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,45 @@
+/*
+ * 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.metadata.spi.retrieval;
+
+import org.jboss.metadata.spi.retrieval.MetaDataRetrieval;
+
+/**
+ * Allows a component be made of multiple classes.
+ *
+ * (In EJB 3 you have the bean class and its interceptor classes.)
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public interface ClassMetaDataRetrieval extends MetaDataRetrieval
+{
+ /**
+ * Get the component metadata retrieval of another class.
+ *
+ * The class is expected to be a part of this component.
+ *
+ * @param cls the class
+ * @return the component metadata retrieval
+ */
+ MetaDataRetrieval getComponentMetaDataRetrieval(Class<?> cls);
+}
Property changes on: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/retrieval/ClassMetaDataRetrieval.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java
===================================================================
--- projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -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.metadata.spi.signature;
+
+import org.jboss.metadata.spi.signature.Signature;
+
+/**
+ * Allows a component be made of multiple classes.
+ *
+ * (In EJB 3 you have the bean class and its interceptor classes.)
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class ClassSignature extends Signature
+{
+ public ClassSignature(Class<?> cls)
+ {
+ super(cls.getName());
+ }
+}
Property changes on: projects/ejb3/trunk/metadata/src/main/java/org/jboss/ejb3/metadata/spi/signature/ClassSignature.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java
===================================================================
--- projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,62 @@
+/*
+ * 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.metadata.interceptor;
+
+import javax.interceptor.InvocationContext;
+
+import org.jboss.logging.Logger;
+
+/**
+ * An interceptor which defines all possible callback methods.
+ *
+ * Note that in ejb3-metadata interceptors can't actually run.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class DummyInterceptor
+{
+ private static final Logger log = Logger.getLogger(DummyInterceptor.class);
+
+ public static int preDestroys = 0, postConstructs = 0, aroundInvokes = 0;
+
+ public void preDestroy(InvocationContext ctx) throws Exception
+ {
+ log.debug("preDestroy " + ctx);
+ preDestroys++;
+ ctx.proceed();
+ }
+
+ public void postConstruct(InvocationContext ctx) throws Exception
+ {
+ log.debug("postConstruct " + ctx);
+ postConstructs++;
+ ctx.proceed();
+ }
+
+ public Object aroundInvoke(InvocationContext ctx) throws Exception
+ {
+ log.debug("aroundInvoke " + ctx);
+ aroundInvokes++;
+ return ctx.proceed();
+ }
+}
Property changes on: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/DummyInterceptor.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java
===================================================================
--- projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,32 @@
+/*
+ * 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.metadata.interceptor;
+
+/**
+ * Nothing to see, move along.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class InterceptedBean
+{
+}
Property changes on: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/InterceptedBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java
===================================================================
--- projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,98 @@
+/*
+ * 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.metadata.interceptor.unit;
+
+import java.net.URL;
+
+import javax.interceptor.Interceptors;
+
+import junit.framework.TestCase;
+
+import org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData;
+import org.jboss.ejb3.test.metadata.securitydomain.SecurityDomainBean;
+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.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;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class InterceptorTestCase extends TestCase
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(InterceptorTestCase.class);
+
+ 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 test1() throws Exception
+ {
+ // Bootstrap metadata
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+ URL url = Thread.currentThread().getContextClassLoader().getResource("interceptor/ejb-jar.xml");
+ EjbJar30MetaData ejbJarMetaData = (EjbJar30MetaData) unmarshaller.unmarshal(url.toString(), schemaResolverForClass(EjbJar30MetaData.class));
+ JBoss50MetaData metaData = new JBoss50MetaData();
+ metaData.merge(null, ejbJarMetaData);
+
+ JBossEnterpriseBeanMetaData beanMetaData = metaData.getEnterpriseBean("InterceptedBean");
+ String canonicalObjectName = "Not important";
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ AnnotationRepositoryToMetaData repository = new AnnotationRepositoryToMetaData(SecurityDomainBean.class, beanMetaData, canonicalObjectName, classLoader);
+ Interceptors interceptors = (Interceptors) repository.resolveClassAnnotation(Interceptors.class);
+ assertNotNull(interceptors);
+
+ fail("NYI");
+ }
+}
Property changes on: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/interceptor/unit/InterceptorTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java
===================================================================
--- projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,33 @@
+/*
+ * 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.metadata.securitydomain;
+
+
+/**
+ * Nothing to see, move along.
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SecurityDomainBean
+{
+}
Property changes on: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/SecurityDomainBean.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java
===================================================================
--- projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,93 @@
+/*
+ * 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.metadata.securitydomain.unit;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.jboss.ejb3.annotation.SecurityDomain;
+import org.jboss.ejb3.metadata.annotation.AnnotationRepositoryToMetaData;
+import org.jboss.ejb3.test.metadata.securitydomain.SecurityDomainBean;
+import org.jboss.logging.Logger;
+import org.jboss.metadata.ejb.jboss.JBoss50MetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+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;
+
+/**
+ * Comment
+ *
+ * @author <a href="mailto:carlo.dewolf at jboss.com">Carlo de Wolf</a>
+ * @version $Revision: $
+ */
+public class SecurityDomainTestCase extends TestCase
+{
+ @SuppressWarnings("unused")
+ private static final Logger log = Logger.getLogger(SecurityDomainTestCase.class);
+
+ 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 test1() throws Exception
+ {
+ // Bootstrap metadata
+ UnmarshallerFactory unmarshallerFactory = UnmarshallerFactory.newInstance();
+ Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+ URL url = Thread.currentThread().getContextClassLoader().getResource("securitydomain/jboss.xml");
+ JBoss50MetaData metaData = (JBoss50MetaData) unmarshaller.unmarshal(url.toString(), schemaResolverForClass(JBoss50MetaData.class));
+
+ JBossEnterpriseBeanMetaData beanMetaData = metaData.getEnterpriseBean("SecurityDomainBean");
+ String canonicalObjectName = "Not important";
+ ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+ AnnotationRepositoryToMetaData repository = new AnnotationRepositoryToMetaData(SecurityDomainBean.class, beanMetaData, canonicalObjectName, classLoader);
+ SecurityDomain securityDomain = (SecurityDomain) repository.resolveClassAnnotation(SecurityDomain.class);
+ assertNotNull(securityDomain);
+ assertEquals("test", securityDomain.value());
+ }
+}
Property changes on: projects/ejb3/trunk/metadata/src/test/java/org/jboss/ejb3/test/metadata/securitydomain/unit/SecurityDomainTestCase.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/resources/interceptor/ejb-jar.xml
===================================================================
--- projects/ejb3/trunk/metadata/src/test/resources/interceptor/ejb-jar.xml (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/resources/interceptor/ejb-jar.xml 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,29 @@
+<?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>InterceptorsTest</display-name>
+ <interceptors>
+ <interceptor>
+ <interceptor-class>org.jboss.ejb3.test.metadata.interceptor.DummyInterceptor</interceptor-class>
+ <around-invoke>
+ <method-name>aroundInvoke</method-name>
+ </around-invoke>
+ <post-construct>
+ <lifecycle-callback-method>postConstruct</lifecycle-callback-method>
+ </post-construct>
+ <pre-destroy>
+ <lifecycle-callback-method>preDestroy</lifecycle-callback-method>
+ </pre-destroy>
+ </interceptor>
+ </interceptors>
+ <assembly-descriptor>
+ <interceptor-binding>
+ <ejb-name>InterceptedBean</ejb-name>
+ <interceptor-class>org.jboss.ejb3.test.metadata.interceptor.DummyInterceptor</interceptor-class>
+ </interceptor-binding>
+ </assembly-descriptor>
+</ejb-jar>
\ No newline at end of file
Property changes on: projects/ejb3/trunk/metadata/src/test/resources/interceptor/ejb-jar.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: projects/ejb3/trunk/metadata/src/test/resources/securitydomain/jboss.xml
===================================================================
--- projects/ejb3/trunk/metadata/src/test/resources/securitydomain/jboss.xml (rev 0)
+++ projects/ejb3/trunk/metadata/src/test/resources/securitydomain/jboss.xml 2008-01-11 09:47:56 UTC (rev 68870)
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- $Id$ -->
+<jboss xmlns="http://www.jboss.com/xml/ns/javaee"
+ xmlns:jee="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss_5_0.xsd"
+ version="5.0">
+ <enterprise-beans>
+ <session>
+ <ejb-name>SecurityDomainBean</ejb-name>
+ <security-domain>test</security-domain>
+ </session>
+ </enterprise-beans>
+</jboss>
\ No newline at end of file
Property changes on: projects/ejb3/trunk/metadata/src/test/resources/securitydomain/jboss.xml
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
More information about the jboss-cvs-commits
mailing list