You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by rm...@apache.org on 2014/12/22 18:55:09 UTC

[2/3] tomee git commit: if we have the beans.xml url keep it and use it since that's a key in OWB processing - EJBContainer case

if we have the beans.xml url keep it and use it since that's a key in OWB processing - EJBContainer case


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/50c94847
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/50c94847
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/50c94847

Branch: refs/heads/develop
Commit: 50c948470149d3f30eb4fa87bcd6d813fd29ae83
Parents: 12274a4
Author: Romain Manni-Bucau <rm...@apache.org>
Authored: Mon Dec 22 18:51:26 2014 +0100
Committer: Romain Manni-Bucau <rm...@apache.org>
Committed: Mon Dec 22 18:51:26 2014 +0100

----------------------------------------------------------------------
 .../org/apache/openejb/config/AnnotationDeployer.java    | 10 +++++++---
 .../java/org/apache/openejb/config/ReadDescriptors.java  |  3 +++
 .../src/main/java/org/apache/openejb/jee/Beans.java      | 11 +++++++++++
 3 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/50c94847/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java b/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
index 458f513..cb03bb9 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
@@ -1287,7 +1287,7 @@ public class AnnotationDeployer implements DynamicDeployer {
 
                 if (beans != null) {
                     managedClasses = beans.getManagedClasses();
-                    getBeanClasses(finder, managedClasses, beans.getNotManagedClasses());
+                    getBeanClasses(beans.getUri(), finder, managedClasses, beans.getNotManagedClasses());
 
                     // passing jar location to be able to manage maven classes/test-classes which have the same moduleId
                     String id = ejbModule.getModuleId();
@@ -1618,7 +1618,7 @@ public class AnnotationDeployer implements DynamicDeployer {
             return name != null && name.length() != 0;
         }
 
-        private void getBeanClasses(final IAnnotationFinder finder, final Map<URL, List<String>> classes, final Map<URL, List<String>> notManaged) {
+        private void getBeanClasses(final String uri, final IAnnotationFinder finder, final Map<URL, List<String>> classes, final Map<URL, List<String>> notManaged) {
 
             //  What we're hoping in this method is to get lucky and find
             //  that our 'finder' instances is an AnnotationFinder that is
@@ -1637,7 +1637,11 @@ public class AnnotationDeployer implements DynamicDeployer {
             final Archive archive = annotationFinder.getArchive();
 
             if (!WebappAggregatedArchive.class.isInstance(archive)) {
-                classes.put(null, annotationFinder.getAnnotatedClassNames());
+                try {
+                    classes.put(uri == null ? null : new URL(uri), annotationFinder.getAnnotatedClassNames());
+                } catch (final MalformedURLException e) {
+                    throw new IllegalStateException(e);
+                }
                 return;
             }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/50c94847/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
index 456a2f9..c004e6c 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
@@ -467,6 +467,9 @@ public class ReadDescriptors implements DynamicDeployer {
             try {
                 final Beans beans = readBeans(data.get());
                 checkDuplicatedByBeansXml(beans, beans);
+                if (UrlSource.class.isInstance(data)) {
+                    beans.setUri(UrlSource.class.cast(data).getUrl().toExternalForm());
+                }
                 ejbModule.setBeans(beans);
             } catch (final IOException e) {
                 throw new OpenEJBException(e);

http://git-wip-us.apache.org/repos/asf/tomee/blob/50c94847/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java
----------------------------------------------------------------------
diff --git a/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java b/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java
index 2142ab5..843fdde 100644
--- a/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java
+++ b/container/openejb-jee/src/main/java/org/apache/openejb/jee/Beans.java
@@ -100,6 +100,17 @@ public class Beans {
     @XmlElement
     protected Scan scan;
 
+    @XmlTransient
+    private String uri;
+
+    public String getUri() {
+        return uri;
+    }
+
+    public void setUri(final String uri) {
+        this.uri = uri;
+    }
+
     public Scan getScan() {
         if (scan == null) {
             scan = new Scan();