User: oberg
Date: 00/10/25 01:59:13
Modified: src/main/org/jnp/server NamingServer.java
Log:
Updated NamingContext to always store objects in marshalled state due to classloader
problems
Revision Changes Path
1.2 +81 -8 jnp/src/main/org/jnp/server/NamingServer.java
Index: NamingServer.java
===================================================================
RCS file: /products/cvs/ejboss/jnp/src/main/org/jnp/server/NamingServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NamingServer.java 2000/10/10 12:42:35 1.1
+++ NamingServer.java 2000/10/25 08:59:12 1.2
@@ -26,6 +26,7 @@
import javax.naming.NameNotFoundException;
import javax.naming.NotContextException;
import javax.naming.NameAlreadyBoundException;
+import javax.naming.CannotProceedException;
import javax.naming.spi.ResolveResult;
import org.jnp.interfaces.*;
@@ -35,7 +36,7 @@
*
* @see <related>
* @author $Author: oberg $
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*/
public class NamingServer
implements Naming, java.io.Serializable
@@ -89,6 +90,19 @@
if (ctx instanceof NamingServer)
{
((NamingServer)ctx).bind(name.getSuffix(1),obj, className);
+ } else if (ctx instanceof Reference)
+ {
+ // Federation
+ if (((Reference)ctx).get("nns") != null)
+ {
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(ctx);
+ cpe.setRemainingName(name.getSuffix(1));
+ throw cpe;
+ } else
+ {
+ throw new NotContextException();
+ }
} else
{
throw new NotContextException();
@@ -135,6 +149,19 @@
if (ctx instanceof NamingServer)
{
((NamingServer)ctx).rebind(name.getSuffix(1),obj, className);
+ } else if (ctx instanceof Reference)
+ {
+ // Federation
+ if (((Reference)ctx).get("nns") != null)
+ {
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(ctx);
+ cpe.setRemainingName(name.getSuffix(1));
+ throw cpe;
+ } else
+ {
+ throw new NotContextException();
+ }
} else
{
throw new NotContextException();
@@ -147,7 +174,7 @@
throw new InvalidNameException();
} else
{
-// System.out.println("rebind "+name+"="+obj);
+// System.out.println("rebind "+name+"="+obj+"("+this+")");
setBinding(name,obj,className);
}
}
@@ -169,13 +196,26 @@
if (ctx instanceof NamingServer)
{
((NamingServer)ctx).unbind(name.getSuffix(1));
+ } else if (ctx instanceof Reference)
+ {
+ // Federation
+ if (((Reference)ctx).get("nns") != null)
+ {
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(ctx);
+ cpe.setRemainingName(name.getSuffix(1));
+ throw cpe;
+ } else
+ {
+ throw new NotContextException();
+ }
} else
{
throw new NotContextException();
}
} else
{
- // Bind object
+ // Unbind object
if (name.get(0).equals(""))
{
throw new InvalidNameException();
@@ -197,8 +237,6 @@
public Object lookup(Name name)
throws NamingException
{
- long start = System.currentTimeMillis();
- System.out.println("Lookup");
Object result;
if (name.isEmpty())
{
@@ -217,6 +255,15 @@
result = ((NamingServer)ctx).lookup(name.getSuffix(1));
} else if (ctx instanceof Reference)
{
+ // Federation
+ if (((Reference)ctx).get("nns") != null)
+ {
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(ctx);
+ cpe.setRemainingName(name.getSuffix(1));
+ throw cpe;
+ }
+
result = new ResolveResult(ctx, name.getSuffix(1));
} else
{
@@ -244,8 +291,6 @@
}
}
- long end = System.currentTimeMillis();
- System.out.println("Lookup time:"+(end-start));
return result;
}
@@ -275,6 +320,19 @@
if (ctx instanceof NamingServer)
{
return ((NamingServer)ctx).list(name.getSuffix(1));
+ } else if (ctx instanceof Reference)
+ {
+ // Federation
+ if (((Reference)ctx).get("nns") != null)
+ {
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(ctx);
+ cpe.setRemainingName(name.getSuffix(1));
+ throw cpe;
+ } else
+ {
+ throw new NotContextException();
+ }
} else
{
throw new NotContextException();
@@ -295,6 +353,19 @@
if (ctx instanceof NamingServer)
{
return ((NamingServer)ctx).createSubcontext(name.getSuffix(1));
+ } else if (ctx instanceof Reference)
+ {
+ // Federation
+ if (((Reference)ctx).get("nns") != null)
+ {
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(ctx);
+ cpe.setRemainingName(name.getSuffix(1));
+ throw cpe;
+ } else
+ {
+ throw new NotContextException();
+ }
} else
{
throw new NotContextException();
@@ -345,7 +416,9 @@
{
Binding b = (Binding)table.get(key);
if (b == null)
+ {
throw new NameNotFoundException(key + " not bound");
+ }
return b;
}