openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r454055 - in /incubator/openejb/trunk/openejb3/container/openejb-core/src/main: java/org/apache/openejb/alt/containers/castor_cmp11/ java/org/apache/openejb/assembler/spring/ resources/META-INF/org.apache.openejb/
Date Sun, 08 Oct 2006 00:58:02 GMT
Author: dblevins
Date: Sat Oct  7 17:58:01 2006
New Revision: 454055

URL: http://svn.apache.org/viewvc?view=rev&rev=454055
Log:
Removed the need for the jarPath attribute in the spring file

Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/AbstractDeploymentFactory.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java?view=diff&rev=454055&r1=454054&r2=454055
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/alt/containers/castor_cmp11/CastorCMP11_EntityContainer.java
Sat Oct  7 17:58:01 2006
@@ -52,6 +52,7 @@
 import javax.transaction.Transaction;
 import javax.transaction.TransactionManager;
 import java.io.File;
+import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -62,6 +63,7 @@
 import java.util.Map;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.Enumeration;
 import java.net.URL;
 import java.net.MalformedURLException;
 
@@ -190,22 +192,36 @@
             org.apache.openejb.core.CoreDeploymentInfo di = (org.apache.openejb.core.CoreDeploymentInfo)
deploys[x];
             di.setContainer(this);
 
-            URL url = null;
-            try {
-                String jarPath = di.getJarPath();
-                File file = new File(jarPath);
+            if (di.getJarPath() == null){
+                // DMB: This may pull in more than we like
+                try {
+                    ClassLoader classLoader = di.getBeanClass().getClassLoader();
+                    Enumeration<URL> resources = classLoader.getResources("META-INF/cmp.mapping.xml");
+                    while (resources.hasMoreElements()) {
+                        URL url = resources.nextElement();
+                        mappings.put(url.toExternalForm(), url);
+                    }
+                } catch (IOException e) {
+                    throw new OpenEJBException("Error locating mapping file via classloader
for deployment "+di.getDeploymentID(), e);
+                }
+            } else {
+                URL url = null;
+                try {
+                    String jarPath = di.getJarPath();
+                    File file = new File(jarPath);
 
-                if (file.isDirectory()){
-                    file = new File(file, "META-INF");
-                    file = new File(file, "cmp.mapping.xml");
-                    url = file.toURL();
-                } else {
-                    url = file.toURL();
-                    url = new URL("jar:"+ url.toExternalForm() + "!/META-INF/cmp.mapping.xml");
+                    if (file.isDirectory()){
+                        file = new File(file, "META-INF");
+                        file = new File(file, "cmp.mapping.xml");
+                        url = file.toURL();
+                    } else {
+                        url = file.toURL();
+                        url = new URL("jar:"+ url.toExternalForm() + "!/META-INF/cmp.mapping.xml");
+                    }
+                    mappings.put(url.toExternalForm(), url);
+                } catch (MalformedURLException e) {
+                    throw new OpenEJBException("Error locating mapping file "+url+" for deployment
"+di.getDeploymentID(), e);
                 }
-                mappings.put(url.toExternalForm(), url);
-            } catch (MalformedURLException e) {
-                throw new OpenEJBException("Error locating mapping file "+url+" for deployment
"+di.getDeploymentID(), e);
             }
             methodReadyPoolMap.put(di.getDeploymentID(), new LinkedListStack(poolsize / 2));
 
@@ -1236,4 +1252,4 @@
             throw new org.apache.openejb.SystemException("Could not generate a query statement
for the findByPrimaryKey method of the deployment = " + di.getDeploymentID(), e);
         }
     }
-}
\ No newline at end of file
+}

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/AbstractDeploymentFactory.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/AbstractDeploymentFactory.java?view=diff&rev=454055&r1=454054&r2=454055
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/AbstractDeploymentFactory.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/spring/AbstractDeploymentFactory.java
Sat Oct  7 17:58:01 2006
@@ -130,12 +130,12 @@
     }
 
     public String getJarPath() {
-        try {
-            File file = SystemInstance.get().getHome().getFile(jarPath, false).getCanonicalFile();
-            return file.getAbsolutePath();
-        } catch (IOException e) {
+//        try {
+//            File file = SystemInstance.get().getHome().getFile(jarPath, false).getCanonicalFile();
+//            return file.getAbsolutePath();
+//        } catch (IOException e) {
             return jarPath;
-        }
+//        }
     }
 
     public void setJarPath(String jarPath) {
@@ -203,7 +203,7 @@
                 loadClass(getPkClass(), classLoader),
                 getComponentType(),
                 null);
-        deploymentInfo.setJarPath(getJarPath());
+        //deploymentInfo.setJarPath(getJarPath());
         if (assembly != null) {
             applySecurityRoleReference(deploymentInfo);
             // todo we should be able to apply tx attributes and security permissions here

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml?view=diff&rev=454055&r1=454054&r2=454055
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/resources/META-INF/org.apache.openejb/spring.xml
Sat Oct  7 17:58:01 2006
@@ -214,7 +214,7 @@
               homeInterface="org.apache.openejb.test.entity.cmp.RmiIiopCmpHome"
               remoteInterface="org.apache.openejb.test.entity.cmp.RmiIiopCmpObject"
               beanClass="org.apache.openejb.test.entity.cmp.RmiIiopCmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer" primKeyField="primaryKey">
             <o:jndiContext>
@@ -228,7 +228,7 @@
           <o:cmpDeployment id="client/tests/entity/cmp/EncBean" homeInterface="org.apache.openejb.test.entity.cmp.EncCmpHome"
               remoteInterface="org.apache.openejb.test.entity.cmp.EncCmpObject"
               beanClass="org.apache.openejb.test.entity.cmp.EncCmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer" primKeyField="primaryKey">
             <o:jndiContext>
@@ -258,7 +258,7 @@
               homeInterface="org.apache.openejb.test.entity.cmp.BasicCmpHome"
               remoteInterface="org.apache.openejb.test.entity.cmp.BasicCmpObject"
               beanClass="org.apache.openejb.test.entity.cmp.AllowedOperationsCmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer" primKeyField="primaryKey">
             <o:jndiContext>
@@ -273,7 +273,7 @@
               homeInterface="org.apache.openejb.test.entity.cmp.BasicCmpHome"
               remoteInterface="org.apache.openejb.test.entity.cmp.BasicCmpObject"
               beanClass="org.apache.openejb.test.entity.cmp.BasicCmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer" primKeyField="primaryKey">
             <o:queries>
@@ -298,7 +298,7 @@
               homeInterface="org.apache.openejb.test.entity.bmp.RmiIiopBmpHome"
               remoteInterface="org.apache.openejb.test.entity.bmp.RmiIiopBmpObject"
               beanClass="org.apache.openejb.test.entity.bmp.RmiIiopBmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer">
             <o:jndiContext>
@@ -312,7 +312,7 @@
           <o:bmpDeployment id="client/tests/entity/bmp/EncBean" homeInterface="org.apache.openejb.test.entity.bmp.EncBmpHome"
               remoteInterface="org.apache.openejb.test.entity.bmp.EncBmpObject"
               beanClass="org.apache.openejb.test.entity.bmp.EncBmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer">
             <o:jndiContext>
@@ -342,7 +342,7 @@
               homeInterface="org.apache.openejb.test.entity.bmp.BasicBmpHome"
               remoteInterface="org.apache.openejb.test.entity.bmp.BasicBmpObject"
               beanClass="org.apache.openejb.test.entity.bmp.AllowedOperationsBmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer">
             <o:jndiContext>
@@ -362,7 +362,7 @@
               homeInterface="org.apache.openejb.test.entity.bmp.BasicBmpHome"
               remoteInterface="org.apache.openejb.test.entity.bmp.BasicBmpObject"
               beanClass="org.apache.openejb.test.entity.bmp.BasicBmpBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" reentrant="false"
               pkClass="java.lang.Integer">
             <o:jndiContext>
@@ -383,7 +383,7 @@
               homeInterface="org.apache.openejb.test.stateful.RmiIiopStatefulHome"
               remoteInterface="org.apache.openejb.test.stateful.RmiIiopStatefulObject"
               beanClass="org.apache.openejb.test.stateful.RmiIiopStatefulBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -397,7 +397,7 @@
               homeInterface="org.apache.openejb.test.stateful.EncStatefulHome"
               remoteInterface="org.apache.openejb.test.stateful.EncStatefulObject"
               beanClass="org.apache.openejb.test.stateful.EncStatefulBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -425,7 +425,7 @@
               homeInterface="org.apache.openejb.test.stateful.BeanTxStatefulHome"
               remoteInterface="org.apache.openejb.test.stateful.BeanTxStatefulObject"
               beanClass="org.apache.openejb.test.stateful.BeanTxStatefulBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -439,7 +439,7 @@
               homeInterface="org.apache.openejb.test.stateful.BasicStatefulHome"
               remoteInterface="org.apache.openejb.test.stateful.BasicStatefulObject"
               beanClass="org.apache.openejb.test.stateful.BMTStatefulBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc/>
@@ -451,7 +451,7 @@
               homeInterface="org.apache.openejb.test.stateful.BasicStatefulHome"
               remoteInterface="org.apache.openejb.test.stateful.BasicStatefulObject"
               beanClass="org.apache.openejb.test.stateful.BasicStatefulBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly">
             <o:jndiContext>
               <o:enc/>
@@ -466,7 +466,7 @@
               localInterface="org.apache.openejb.test.stateful.BasicStatefulLocalObject"
               businessLocalInterface="org.apache.openejb.test.stateful.BasicStatefulBusinessLocal"
               beanClass="org.apache.openejb.test.stateful.BasicStatefulPojoBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly">
             <o:jndiContext>
               <o:enc/>
@@ -484,7 +484,7 @@
               homeInterface="org.apache.openejb.test.stateless.RmiIiopStatelessHome"
               remoteInterface="org.apache.openejb.test.stateless.RmiIiopStatelessObject"
               beanClass="org.apache.openejb.test.stateless.RmiIiopStatelessBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -498,7 +498,7 @@
               homeInterface="org.apache.openejb.test.stateless.EncStatelessHome"
               remoteInterface="org.apache.openejb.test.stateless.EncStatelessObject"
               beanClass="org.apache.openejb.test.stateless.EncStatelessBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -530,7 +530,7 @@
               homeInterface="org.apache.openejb.test.stateless.BeanTxStatelessHome"
               remoteInterface="org.apache.openejb.test.stateless.BeanTxStatelessObject"
               beanClass="org.apache.openejb.test.stateless.BeanTxStatelessBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -542,7 +542,7 @@
         <entry key="client/tools/DatabaseHome">
           <o:statelessDeployment id="client/tools/DatabaseHome" homeInterface="org.apache.openejb.test.beans.DatabaseHome"
               remoteInterface="org.apache.openejb.test.beans.Database" beanClass="org.apache.openejb.test.beans.DatabaseBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -556,7 +556,7 @@
               homeInterface="org.apache.openejb.test.stateless.BasicStatelessHome"
               remoteInterface="org.apache.openejb.test.stateless.BasicStatelessObject"
               beanClass="org.apache.openejb.test.stateless.BasicStatelessBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly" beanManagedTransaction="true">
             <o:jndiContext>
               <o:enc>
@@ -574,7 +574,7 @@
               homeInterface="org.apache.openejb.test.stateless.BasicStatelessHome"
               remoteInterface="org.apache.openejb.test.stateless.BasicStatelessObject"
               beanClass="org.apache.openejb.test.stateless.BasicStatelessBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly">
             <o:jndiContext>
               <o:enc>
@@ -595,7 +595,7 @@
               localInterface="org.apache.openejb.test.stateless.BasicStatelessLocalObject"
               businessLocalInterface="org.apache.openejb.test.stateless.BasicStatelessBusinessLocal"
               beanClass="org.apache.openejb.test.stateless.BasicStatelessPojoBean"
-              jarPath="../../../../openejb-itests/target/classes/" classLoader="#classLoader"
+              classLoader="#classLoader"
               transactionManager="#transactionManager" assembly="#assembly">
             <o:jndiContext>
               <o:enc>



Mime
View raw message