geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r433404 - in /geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context: AbstractContext.java AbstractUnmodifiableContext.java ImmutableContext.java
Date Mon, 21 Aug 2006 22:41:08 GMT
Author: dain
Date: Mon Aug 21 15:41:05 2006
New Revision: 433404

URL: http://svn.apache.org/viewvc?rev=433404&view=rev
Log:
Pulled up support for indexing from AbstractUnmodifiableContext to AbstractContext

Modified:
    geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
    geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractUnmodifiableContext.java
    geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/ImmutableContext.java

Modified: geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java?rev=433404&r1=433403&r2=433404&view=diff
==============================================================================
--- geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
(original)
+++ geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractContext.java
Mon Aug 21 15:41:05 2006
@@ -51,6 +51,15 @@
     //
 
     /**
+     * Gets the object bound to the name.  The name may contain slashes.
+     * @param name the name
+     * @return the object bound to the name, or null if not found
+     */
+    protected Object getDeepBinding(String name) {
+        return null;
+    }
+
+    /**
      * Gets the object bound to the name.  The name will not contain slashes.
      * @param name the name
      * @return the object bound to the name, or null if not found
@@ -62,7 +71,7 @@
 
     /**
      * Finds the specified entry.  Normally there is no need to override this method; instead
you should
-     * simply the getBindings(String) method.
+     * simply implement the getDeepBindings(String) and getBindings(String) method.
      *
      * This method will follow links except for the final element which is always just returned
without
      * inspection.  This means this method can be used to implement lookupLink.
@@ -78,6 +87,12 @@
         }
         if (stringName == null) stringName = parsedName.toString();
 
+        // try to look up the name directly (this is the fastest path)
+        Object directLookup = getDeepBinding(stringName);
+        if (directLookup != null) {
+            return ContextUtil.resolve(stringName, directLookup);
+        }
+
         // if the parsed name has no parts, they are asking for the current context
         if (parsedName == null) parsedName = getNameParser().parse(stringName);
         if (parsedName.isEmpty()) {
@@ -293,6 +308,12 @@
     //  Remove Binding
     //
 
+    /**
+     * Removes the binding from the context.  The name will not contain a path and the value
will not
+     * be a nested context although it may be a foreign context.
+     * @param name name under which the value should be bound
+     * @throws NamingException if a problem occurs during the bind such as a value already
being bound
+     */
     protected abstract void removeBinding(String name) throws NamingException;
 
     protected void removeDeepBinding(Name name, boolean pruneEmptyContexts) throws NamingException
{

Modified: geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractUnmodifiableContext.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractUnmodifiableContext.java?rev=433404&r1=433403&r2=433404&view=diff
==============================================================================
--- geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractUnmodifiableContext.java
(original)
+++ geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/AbstractUnmodifiableContext.java
Mon Aug 21 15:41:05 2006
@@ -21,97 +21,14 @@
 import javax.naming.Name;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
-import java.io.Serializable;
-import java.util.Map;
 
 /**
  * @version $Rev: 355877 $ $Date: 2005-12-10 18:48:27 -0800 (Sat, 10 Dec 2005) $
  */
-public abstract class AbstractUnmodifiableContext extends AbstractContext implements Context,
NestedContextFactory, Serializable {
-    private static final long serialVersionUID = 3808693663629444493L;
-
+public abstract class AbstractUnmodifiableContext extends AbstractContext {
     protected AbstractUnmodifiableContext(String nameInNamespace) {
         super(nameInNamespace);
     }
-
-    protected final void addBinding(Name name, Object obj, boolean rebind) throws NamingException
{
-        throw new OperationNotSupportedException("Context is read only");
-    }
-
-    //
-    //  Lookup Binding
-    //
-
-    /**
-     * Gets the object bound to the name.  The name may contain slashes.
-     * @param name the name
-     * @return the object bound to the name, or null if not found
-     */
-    protected Object getDeepBinding(String name) {
-        return null;
-    }
-
-    /**
-     * Finds the specified entry.  Normally there is no need to override this method; instead
you should
-     * simply implement the getDeepBindings(String) and getBindings(String) method.
-     *
-     * This method will follow links except for the final element which is always just returned
without
-     * inspection.  This means this method can be used to implement lookupLink.
-     *
-     * @param stringName the string version of the name; maybe null
-     * @param parsedName the parsed name; may be null
-     * @return the value bound to the name
-     * @throws NamingException if no value is bound to that name or if a problem occurs during
the lookup
-     */
-    protected Object lookup(String stringName, Name parsedName) throws NamingException {
-        if (stringName == null && parsedName == null) {
-            throw new IllegalArgumentException("Both stringName and parsedName are null");
-        }
-        if (stringName == null) stringName = parsedName.toString();
-
-        // try to look up the name directly (this is the fastest path)
-        Object directLookup = getDeepBinding(stringName);
-        if (directLookup != null) {
-            return ContextUtil.resolve(stringName, directLookup);
-        }
-
-        Object value = super.lookup(stringName, parsedName);
-        return value;
-    }
-
-    //
-    //  List Bindings
-    //
-
-    /**
-     * Gets a map of the bindings for the current node (i.e., no names with slashes).
-     * This method must not return null.
-     */
-    protected Map getBindings() throws NamingException {
-        throw new OperationNotSupportedException("This context is not listable");
-    }
-
-    //
-    //  Remove Binding
-    //
-
-    /**
-     * Removes the binding from the context.  The name will not contain a path and the value
will not
-     * be a nested context although it may be a foreign context.
-     * @param name name under which the value should be bound
-     * @throws NamingException if a problem occurs during the bind such as a value already
being bound
-     */
-    protected void removeBinding(String name) throws NamingException {
-        throw new OperationNotSupportedException("Context is read only");
-    }
-
-    // ==================================================================================
-    // =================== Final Methods (see methods above) ============================
-    // ==================================================================================
-
-    //
-    //  Unsupported Operations
-    //
 
     public final void bind(Name name, Object obj) throws NamingException {
         throw new OperationNotSupportedException("Context is read only");

Modified: geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/ImmutableContext.java
URL: http://svn.apache.org/viewvc/geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/ImmutableContext.java?rev=433404&r1=433403&r2=433404&view=diff
==============================================================================
--- geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/ImmutableContext.java
(original)
+++ geronimo/xbean/branches/colossus/xbean-naming/src/main/java/org/apache/xbean/naming/context/ImmutableContext.java
Mon Aug 21 15:41:05 2006
@@ -21,6 +21,7 @@
 import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.OperationNotSupportedException;
+import javax.naming.Name;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -92,7 +93,11 @@
         throw new OperationNotSupportedException("Context is immutable");
     }
 
-    protected void removeDeepBinding(String name, Object value) throws NamingException {
+    protected void removeDeepBinding(Name name, boolean pruneEmptyContexts) throws NamingException
{
+        throw new OperationNotSupportedException("Context is immutable");
+    }
+
+    protected void removeBinding(String name) throws NamingException {
         throw new OperationNotSupportedException("Context is immutable");
     }
 
@@ -141,7 +146,11 @@
             throw new OperationNotSupportedException("Context is immutable");
         }
 
-        protected void removeDeepBinding(String name, Object value) throws NamingException
{
+        protected void removeDeepBinding(Name name, boolean pruneEmptyContexts) throws NamingException
{
+            throw new OperationNotSupportedException("Context is immutable");
+        }
+
+        protected void removeBinding(String name) throws NamingException {
             throw new OperationNotSupportedException("Context is immutable");
         }
 



Mime
View raw message