tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1183705 - /openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/ContextUtil.java
Date Sat, 15 Oct 2011 21:00:44 GMT
Author: rmannibucau
Date: Sat Oct 15 21:00:44 2011
New Revision: 1183705

URL: http://svn.apache.org/viewvc?rev=1183705&view=rev
Log:
missing file :s

Added:
    openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/ContextUtil.java

Added: openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/ContextUtil.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/ContextUtil.java?rev=1183705&view=auto
==============================================================================
--- openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/ContextUtil.java
(added)
+++ openejb/trunk/openejb/container/openejb-core/src/main/java/org/apache/openejb/util/ContextUtil.java
Sat Oct 15 21:00:44 2011
@@ -0,0 +1,32 @@
+package org.apache.openejb.util;
+
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+/**
+ * @author rmannibucau
+ */
+public class ContextUtil {
+    private ContextUtil() {
+        // no-op
+    }
+
+    public 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;
+                }
+            }
+        }
+    }
+}



Mime
View raw message