tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1291850 - /openejb/trunk/maven-plugins/xbean-xml/src/main/java/org/apache/openejb/xbean/xml/XMLAnnotationFinderHelper.java
Date Tue, 21 Feb 2012 15:15:14 GMT
Author: rmannibucau
Date: Tue Feb 21 15:15:14 2012
New Revision: 1291850

URL: http://svn.apache.org/viewvc?rev=1291850&view=rev
Log:
adding a missing helper method to create a finder from a scan.xml file without providing an
archive class

Modified:
    openejb/trunk/maven-plugins/xbean-xml/src/main/java/org/apache/openejb/xbean/xml/XMLAnnotationFinderHelper.java

Modified: openejb/trunk/maven-plugins/xbean-xml/src/main/java/org/apache/openejb/xbean/xml/XMLAnnotationFinderHelper.java
URL: http://svn.apache.org/viewvc/openejb/trunk/maven-plugins/xbean-xml/src/main/java/org/apache/openejb/xbean/xml/XMLAnnotationFinderHelper.java?rev=1291850&r1=1291849&r2=1291850&view=diff
==============================================================================
--- openejb/trunk/maven-plugins/xbean-xml/src/main/java/org/apache/openejb/xbean/xml/XMLAnnotationFinderHelper.java
(original)
+++ openejb/trunk/maven-plugins/xbean-xml/src/main/java/org/apache/openejb/xbean/xml/XMLAnnotationFinderHelper.java
Tue Feb 21 15:15:14 2012
@@ -52,6 +52,23 @@ public final class XMLAnnotationFinderHe
         return new AnnotationFinder(archive); // don't link here
     }
 
+    public static IAnnotationFinder finderFromXml(final InputStream is, final ClassLoader
loader, final Iterable<URL> urls) throws JAXBException {
+        final Scan scan = (Scan) JAXB_CONTEXT.createUnmarshaller().unmarshal(new BufferedInputStream(is));
+
+        final Archive packageArchive = packageArchive(scan.getPackagename(), loader, urls,
null);
+        final Archive classesArchive = classesArchive(scan, loader);
+
+        final Archive archive;
+        if (packageArchive != null && classesArchive != null) {
+            archive = new CompositeArchive(classesArchive, packageArchive);
+        } else if (packageArchive != null) {
+            archive = packageArchive;
+        } else {
+            archive = classesArchive;
+        }
+        return new AnnotationFinder(archive); // don't link here
+    }
+
     public static Archive classesArchive(final Scan scan, final ClassLoader loader) {
         Class<?>[] classes = new Class<?>[scan.getClassname().size()];
         int i = 0;



Mime
View raw message