You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by da...@apache.org on 2006/10/17 20:42:28 UTC

svn commit: r464996 - /geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/SimpleReference.java

Author: dain
Date: Tue Oct 17 11:42:27 2006
New Revision: 464996

URL: http://svn.apache.org/viewvc?view=rev&rev=464996
Log:
Changed to be an empty extension of org.apache.xbean.naming.reference.SimpleReference

Modified:
    geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/SimpleReference.java

Modified: geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/SimpleReference.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/SimpleReference.java?view=diff&rev=464996&r1=464995&r2=464996
==============================================================================
--- geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/SimpleReference.java (original)
+++ geronimo/server/trunk/modules/geronimo-naming/src/main/java/org/apache/geronimo/naming/reference/SimpleReference.java Tue Oct 17 11:42:27 2006
@@ -16,126 +16,8 @@
  */
 package org.apache.geronimo.naming.reference;
 
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.NoSuchElementException;
-import javax.naming.Context;
-import javax.naming.Name;
-import javax.naming.RefAddr;
-import javax.naming.Reference;
-import javax.naming.NamingException;
-import javax.naming.spi.ObjectFactory;
-
 /**
  * @version $Rev$ $Date$
  */
-public abstract class SimpleReference extends Reference {
-    private static final Enumeration EMPTY_ENUMERATION = new Enumeration() {
-        public boolean hasMoreElements() {
-            return false;
-        }
-
-        public Object nextElement() {
-            return new NoSuchElementException();
-        }
-    };
-
-    public SimpleReference() {
-        super(null);
-    }
-
-    /**
-     * Gets the actual referenced Object.
-     * @return the referenced object
-     */
-    public abstract Object getContent() throws NamingException;
-
-    /**
-     * We will atleast return an Object.  Subclasses may want to provide a more specific class.
-     * @return "java.lang.Object"
-     */
-    public String getClassName() {
-        return "java.lang.Object";
-    }
-
-    /**
-     * If the JNDI context does not understand simple references, this method will be called
-     * to obtain the class name of a factory.  This factory in turn understands the simple
-     * reference.  This style is much slower because JNDI will use reflection to load and
-     * create this class.
-     * @return
-     */
-    public final String getFactoryClassName() {
-        return SimpleObjectFactory.class.getName();
-    }
-
-    //
-    // Disabled methods that we no longer need
-    //
-    public final String getFactoryClassLocation() {
-        return null;
-    }
-
-    public final RefAddr get(String addrType) {
-        return null;
-    }
-
-    public final RefAddr get(int posn) {
-        throw new ArrayIndexOutOfBoundsException(posn);
-    }
-
-    public final Enumeration getAll() {
-        return EMPTY_ENUMERATION;
-    }
-
-    public final int size() {
-        return 0;
-    }
-
-    public final void add(RefAddr addr) {
-        throw new UnsupportedOperationException("SimpleReference has no addresses so none can be added");
-    }
-
-    public final void add(int posn, RefAddr addr) {
-        throw new UnsupportedOperationException("SimpleReference has no addresses so none can be added");
-    }
-
-    public final Object remove(int posn) {
-        throw new ArrayIndexOutOfBoundsException(posn);
-    }
-
-    public final void clear() {
-    }
-
-    //
-    // Reset the java.lang.Object methods back to default implementations
-    //
-    public boolean equals(Object obj) {
-        return this == obj;
-    }
-
-    public int hashCode() {
-        return System.identityHashCode(this);
-    }
-
-    public String toString() {
-        return getClass().getName() + "@" + Integer.toHexString(hashCode());
-    }
-
-    public Object clone() {
-        throw new UnsupportedOperationException("SimpleReference can not be cloned");
-    }
-
-    /**
-     * Simply calls getContent() on the SimpleReference
-     */
-    public static final class SimpleObjectFactory implements ObjectFactory {
-        public Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
-            if (obj instanceof SimpleReference) {
-                SimpleReference reference = (SimpleReference) obj;
-                return reference.getContent();
-            }
-            return null;
-        }
-    }
+public abstract class SimpleReference extends org.apache.xbean.naming.reference.SimpleReference {
 }