geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r433705 - in /geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi: GlobalContextGBean.java KernelContextGBean.java
Date Tue, 22 Aug 2006 17:32:32 GMT
Author: dain
Date: Tue Aug 22 10:32:32 2006
New Revision: 433705

URL: http://svn.apache.org/viewvc?rev=433705&view=rev
Log:
Updated for newest xbean-naming code

Modified:
    geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/GlobalContextGBean.java
    geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/KernelContextGBean.java

Modified: geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/GlobalContextGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/GlobalContextGBean.java?rev=433705&r1=433704&r2=433705&view=diff
==============================================================================
--- geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/GlobalContextGBean.java
(original)
+++ geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/GlobalContextGBean.java
Tue Aug 22 10:32:32 2006
@@ -26,6 +26,7 @@
 
 import javax.naming.Context;
 import javax.naming.NamingException;
+import javax.naming.Name;
 import java.util.Collections;
 
 /**
@@ -51,13 +52,14 @@
         super.doFail();
     }
 
-    protected String createBindingName(AbstractName abstractName, Object value) throws NamingException
{
+    protected Name createBindingName(AbstractName abstractName, Object value) throws NamingException
{
         if (value instanceof Context) {
             // don't bind yourself
             if (value == this) return null;
 
             Context context = (Context) value;
-            return context.getNameInNamespace();
+            String nameInNamespace = context.getNameInNamespace();
+            return getNameParser().parse(nameInNamespace);
         }
         throw new NamingException("value is not a context: abstractName=" + abstractName
+ " valueType=" + value.getClass().getName());
     }

Modified: geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/KernelContextGBean.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/KernelContextGBean.java?rev=433705&r1=433704&r2=433705&view=diff
==============================================================================
--- geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/KernelContextGBean.java
(original)
+++ geronimo/sandbox/plugins/global-jndi/src/java/org/apache/geronimo/gjndi/KernelContextGBean.java
Tue Aug 22 10:32:32 2006
@@ -30,6 +30,7 @@
 import org.apache.xbean.naming.context.UnmodifiableContext;
 
 import javax.naming.NamingException;
+import javax.naming.Name;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
@@ -81,8 +82,8 @@
         kernel.getLifecycleMonitor().removeLifecycleListener(listener);
         for (Iterator iterator = bindingsByAbstractName.values().iterator(); iterator.hasNext();)
{
             try {
-                String name = (String) iterator.next();
-                removeDeepBinding(name);
+                Name name = (Name) iterator.next();
+                removeDeepBinding(name, true);
             } catch (NamingException ignored) {
             }
         }
@@ -130,7 +131,7 @@
         }
 
         // generate a name for this binding
-        String name = createBindingName(abstractName, value);
+        Name name = createBindingName(abstractName, value);
         if (name == null) return;
 
         // give sub classes a chance to preprocess the value
@@ -139,7 +140,7 @@
 
         // bind the value
 
-        addDeepBinding(name, value);
+        addDeepBinding(name, value, true, true);
 
         // remember where we bound this value
         bindingsByAbstractName.put(abstractName, name);
@@ -150,10 +151,10 @@
      * @param abstractName the abstract name of the gbean to unbind
      */
     protected synchronized void removeBinding(AbstractName abstractName) {
-        String name = (String) bindingsByAbstractName.remove(abstractName);
+        Name name = (Name) bindingsByAbstractName.remove(abstractName);
         if (name != null) {
             try {
-                removeDeepBinding(name);
+                removeDeepBinding(name, true);
             } catch (NamingException ignored) {
             }
         }
@@ -166,8 +167,9 @@
      * @param value the gbean instance
      * @return the name under which the gbean should be bound
      */
-    protected String createBindingName(AbstractName abstractName, Object value) throws NamingException
{
-        return (String) abstractName.getName().get("name");
+    protected Name createBindingName(AbstractName abstractName, Object value) throws NamingException
{
+        String shortName = (String) abstractName.getName().get("name");
+        return getNameParser().parse(shortName);
     }
 
     /**
@@ -178,7 +180,7 @@
      * @param value the gbean instance
      * @return the value to bind
      */
-    protected Object preprocessVaue(AbstractName abstractName, String name, Object value)
throws NamingException {
+    protected Object preprocessVaue(AbstractName abstractName, Name name, Object value) throws
NamingException {
         return value;
     }
 



Mime
View raw message