tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1183694 - in /openejb/trunk/openejb/assembly/tomee: tomee-catalina/src/main/java/org/apache/tomee/catalina/ tomee-embedded/src/main/java/org/apache/tomee/embedded/ tomee-embedded/src/test/java/org/apache/tomee/embedded/
Date Sat, 15 Oct 2011 20:52:21 GMT
Author: rmannibucau
Date: Sat Oct 15 20:52:21 2011
New Revision: 1183694

URL: http://svn.apache.org/viewvc?rev=1183694&view=rev
Log:
allowing to use File[] and String[] in embedded tomee container (EJBContainer implementation)

Modified:
    openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatJndiBuilder.java
    openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
    openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/EmbeddedTomEEContainer.java
    openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java

Modified: openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatJndiBuilder.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatJndiBuilder.java?rev=1183694&r1=1183693&r2=1183694&view=diff
==============================================================================
--- openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatJndiBuilder.java
(original)
+++ openejb/trunk/openejb/assembly/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomcatJndiBuilder.java
Sat Oct 15 20:52:21 2011
@@ -65,6 +65,7 @@ import org.apache.openejb.loader.SystemI
 import org.apache.openejb.persistence.JtaEntityManager;
 import org.apache.openejb.persistence.JtaEntityManagerRegistry;
 import org.apache.openejb.spi.ContainerSystem;
+import org.apache.openejb.util.ContextUtil;
 import org.apache.tomee.common.EjbFactory;
 import org.apache.tomee.common.EnumFactory;
 import org.apache.tomee.common.LookupFactory;
@@ -184,7 +185,7 @@ public class TomcatJndiBuilder {
                 try {
                     final String key = entry.getKey();
                     Object value = normalize(entry.getValue());
-                    mkdirs(root, key);
+                    ContextUtil.mkdirs(root, key);
                     root.rebind(key, value);
                 } catch (NamingException e) {
                     e.printStackTrace();
@@ -226,25 +227,6 @@ public class TomcatJndiBuilder {
         return value;
     }
 
-    private static void mkdirs(Context context, String key) {
-        final String[] parts = key.split("/");
-
-        int i = 0;
-        for (String part : parts) {
-            if (++i == parts.length) return;
-
-            try {
-                context = context.createSubcontext(part);
-            } catch (NamingException e) {
-                try {
-                    context = (Context) context.lookup(part);
-                } catch (NamingException e1) {
-                    return;
-                }
-            }
-        }
-    }
-
     public void mergeRef(NamingResources naming, EnvEntryInfo ref) {
 //        if (!ref.referenceName.startsWith("comp/")) return;
         if ("java.lang.Class".equals(ref.type)) {

Modified: openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java?rev=1183694&r1=1183693&r2=1183694&view=diff
==============================================================================
--- openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
(original)
+++ openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/Container.java
Sat Oct 15 20:52:21 2011
@@ -220,6 +220,10 @@ public class Container {
         appContexts.remove(name);
     }
 
+    public Context getJndiContext() {
+        return assembler.getContainerSystem().getJNDIContext();
+    }
+
     public AppContext getAppContexts(String moduleId) {
         return appContexts.get(moduleId);
     }

Modified: openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/EmbeddedTomEEContainer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/EmbeddedTomEEContainer.java?rev=1183694&r1=1183693&r2=1183694&view=diff
==============================================================================
--- openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/EmbeddedTomEEContainer.java
(original)
+++ openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/main/java/org/apache/tomee/embedded/EmbeddedTomEEContainer.java
Sat Oct 15 20:52:21 2011
@@ -40,7 +40,7 @@ public class EmbeddedTomEEContainer exte
     }
 
     @Override public Context getContext() {
-        return tomEEContainer.container.getAppContexts(appId).getGlobalJndiContext();
+        return tomEEContainer.container.getJndiContext();
     }
 
     public static class EmbeddedTomEEContainerProvider implements EJBContainerProvider {
@@ -83,6 +83,14 @@ public class EmbeddedTomEEContainer exte
                     tomEEContainer.container.deploy(appId, ((File) modules));
                 } else if (modules instanceof String) {
                     tomEEContainer.container.deploy(appId, new File((String) modules));
+                } else if (modules instanceof String[]) {
+                    for (String path : (String[]) modules) {
+                        tomEEContainer.container.deploy(appId, new File(path));
+                    }
+                } else if (modules instanceof File[]) {
+                    for (File file : (File[]) modules) {
+                        tomEEContainer.container.deploy(appId, file);
+                    }
                 } else {
                     try {
                         tomEEContainer.close();

Modified: openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java?rev=1183694&r1=1183693&r2=1183694&view=diff
==============================================================================
--- openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java
(original)
+++ openejb/trunk/openejb/assembly/tomee/tomee-embedded/src/test/java/org/apache/tomee/embedded/EmbeddedTomEEContainerTest.java
Sat Oct 15 20:52:21 2011
@@ -30,7 +30,7 @@ public class EmbeddedTomEEContainerTest 
         Properties p = new Properties();
         p.setProperty(EJBContainer.APP_NAME, "test");
         p.setProperty(EJBContainer.PROVIDER, EmbeddedTomEEContainer.class.getName());
-        p.setProperty(EJBContainer.MODULES, war.getAbsolutePath());
+        p.put(EJBContainer.MODULES, war.getAbsolutePath());
         p.setProperty(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT, "-1");
         try {
             EJBContainer container = EJBContainer.createEJBContainer(p);



Mime
View raw message