tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlaskow...@apache.org
Subject svn commit: r503397 - in /incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/JndiEncBuilder.java config/AutoConfigAndDeploy.java config/ReadDescriptors.java
Date Sun, 04 Feb 2007 12:25:00 GMT
Author: jlaskowski
Date: Sun Feb  4 04:24:59 2007
New Revision: 503397

URL: http://svn.apache.org/viewvc?view=rev&rev=503397
Log:
OPENEJB-467 Lookup of EntityManagerFactories failing in Windows

Submitted by: Manu T George

Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfigAndDeploy.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java?view=diff&rev=503397&r1=503396&r2=503397
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncBuilder.java
Sun Feb  4 04:24:59 2007
@@ -43,6 +43,7 @@
 import javax.transaction.UserTransaction;
 import javax.transaction.TransactionSynchronizationRegistry;
 import java.io.File;
+import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Iterator;
@@ -84,7 +85,11 @@
         }
 
         beanManagedTransactions = transactionType != null && transactionType.equalsIgnoreCase("Bean");
-
+        try {
+            path = new File(path).toURL().getPath();
+        } catch (MalformedURLException e) {
+            throw new org.apache.openejb.OpenEJBException("The module path is invalid " +
path , e);
+        }
         this.jarPath = path;
         this.jndiEnc = jndiEnc;
 
@@ -447,18 +452,17 @@
         String relativePath = puName.substring(0,index);
         String unitName = puName.substring(index+1,puName.length());
         if(new File(path).isFile()){
-            path=path.substring(0,path.lastIndexOf(File.separator));
+            path=path.substring(0,path.lastIndexOf('/'));
         }
         while(relativePath.startsWith("../")){
             relativePath = relativePath.substring(3,relativePath.length());
-            path = path.substring(0,path.lastIndexOf(File.separator));
+            path = path.substring(0,path.lastIndexOf('/'));
         }
 
         while(relativePath.startsWith("./")){
             relativePath = relativePath.substring(2,relativePath.length());
         }
-        path = path + File.separator + relativePath;
-        path = new File(path).getPath();
+        path = path + "/" + relativePath;
         Map factories = allFactories.get(path);
         if (factories != null){
             EntityManagerFactory factory = (EntityManagerFactory)factories.get(unitName);

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfigAndDeploy.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfigAndDeploy.java?view=diff&rev=503397&r1=503396&r2=503397
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfigAndDeploy.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AutoConfigAndDeploy.java
Sun Feb  4 04:24:59 2007
@@ -270,6 +270,9 @@
     }
 
     private String getDataSourceId(String dataSource, PersistenceUnit persistenceUnit) throws
OpenEJBException {
+        if(dataSource == null){
+            return null;
+        }
         if (dataSource.startsWith("java:comp/env")) {
             dataSource = dataSource.substring("java:comp/env".length());
         }
@@ -294,7 +297,11 @@
                     logger.warning("Auto-creating a datasource with res-id " + id + " for
persistence-unit '" + persistenceUnit.getName() + "'.  THERE IS LITTLE CHANCE THIS WILL WORK!");
                     configFactory.install(connectorInfo);
                 }
+            } else {
+                return name;
             }
+        } else {
+            return dataSource;
         }
         return id;
     }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java?view=diff&rev=503397&r1=503396&r2=503397
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
(original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ReadDescriptors.java
Sun Feb  4 04:24:59 2007
@@ -68,10 +68,11 @@
 
         List<URL> persistenceUrls = (List<URL>) appModule.getAltDDs().get("persistence.xml");
         for (URL url1 : persistenceUrls) {
-            String moduleName1 = url1.toExternalForm().replaceFirst("!?/?META-INF/persistence.xml$",
"");
+            String moduleName1 = url1.toExternalForm().replaceFirst("!/?META-INF/persistence.xml$",
"");
+            moduleName1 = moduleName1.replaceFirst("/?META-INF/persistence.xml$", "/");
             if (moduleName1.startsWith("jar:")) moduleName1 = moduleName1.substring("jar:".length());
             if (moduleName1.startsWith("file:")) moduleName1 = moduleName1.substring("file:".length());
-            if (moduleName1.endsWith("/")) moduleName1 = moduleName1.substring(0, moduleName1.length()
-1);
+        //    if (moduleName1.endsWith("/")) moduleName1 = moduleName1.substring(0, moduleName1.length()
-1);
             try {
                 Persistence persistence = JaxbPersistenceFactory.getPersistence(url1);
                 PersistenceModule persistenceModule = new PersistenceModule(moduleName1,
persistence);



Mime
View raw message