diff options
Diffstat (limited to 'libjava/java/rmi/server')
25 files changed, 1471 insertions, 0 deletions
diff --git a/libjava/java/rmi/server/ExportException.java b/libjava/java/rmi/server/ExportException.java new file mode 100644 index 0000000..a3a2793 --- /dev/null +++ b/libjava/java/rmi/server/ExportException.java @@ -0,0 +1,43 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.RemoteException; + +public class ExportException + extends RemoteException { + +public ExportException(String s) { + super(s); +} + +public ExportException(String s, Exception e) { + super(s, e); +} + +} diff --git a/libjava/java/rmi/server/LoaderHandler.java b/libjava/java/rmi/server/LoaderHandler.java new file mode 100644 index 0000000..e96cf2c --- /dev/null +++ b/libjava/java/rmi/server/LoaderHandler.java @@ -0,0 +1,44 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.net.MalformedURLException; +import java.net.URL; + + +public interface LoaderHandler { + +public static final String packagePrefix = ""; + +public Class loadClass(String name) throws MalformedURLException, ClassNotFoundException; + +public Class loadClass(URL codebase, String name) throws MalformedURLException, ClassNotFoundException; + +public Object getSecurityContext(ClassLoader loader); + +} diff --git a/libjava/java/rmi/server/LogStream.java b/libjava/java/rmi/server/LogStream.java new file mode 100644 index 0000000..e5e1183 --- /dev/null +++ b/libjava/java/rmi/server/LogStream.java @@ -0,0 +1,92 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.io.PrintStream; +import java.io.OutputStream; +import java.io.IOException; + +public class LogStream + extends PrintStream { + +public static final int SILENT = 0; +public static final int BRIEF = 1; +public static final int VERBOSE = 2; + +private static PrintStream defStream; + +private LogStream(OutputStream s) { + super(s); +} + +public static LogStream log(String name) { + throw new Error("Not implemented"); +} + +public static PrintStream getDefaultStream() { + return (defStream); +} + +public static void setDefaultStream(PrintStream s) { + defStream = s; +} + +public OutputStream getOutputStream() { + return (out); +} + +public void setOutputStream(OutputStream s) { + out = s; +} + +public void write(int b) { + super.write(b); +} + +public void write(byte[] b, int off, int len) { + super.write(b, off, len); +} + +public String toString() { + throw new Error("Not implemented"); +} + +public static int parseLevel(String s) { + if (s.equalsIgnoreCase("silent")) { + return (SILENT); + } + if (s.equalsIgnoreCase("brief")) { + return (BRIEF); + } + if (s.equalsIgnoreCase("verbose")) { + return (VERBOSE); + } + return (SILENT); +} + +} diff --git a/libjava/java/rmi/server/ObjID.java b/libjava/java/rmi/server/ObjID.java new file mode 100644 index 0000000..038e3f9 --- /dev/null +++ b/libjava/java/rmi/server/ObjID.java @@ -0,0 +1,95 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.io.Serializable; +import java.io.ObjectOutput; +import java.io.ObjectInput; +import java.io.IOException; +import java.lang.Math; +import java.io.DataInput; +import java.io.DataOutput; +import java.util.Random; + +public final class ObjID + implements Serializable { + +static final long serialVersionUID = -6386392263968365220L; + +private static long next = 0x8000000000000000L; +private static final Object lock = ObjID.class; + +public static final int REGISTRY_ID = 0; +public static final int ACTIVATOR_ID = 1; +public static final int DGC_ID = 2; + +private long objNum; +private UID space; + +public ObjID() { + synchronized (lock) { + objNum = next++; + } + space = new UID(); +} + +public ObjID(int num) { + objNum = (long)num; + space = new UID((short)0); +} + +public void write(ObjectOutput out) throws IOException { + DataOutput dout = (DataOutput)out; + dout.writeLong(objNum); + space.write(dout); +} + +public static ObjID read(ObjectInput in) throws IOException { + DataInput din = (DataInput)in; + ObjID id = new ObjID(); + id.objNum = din.readLong(); + id.space = UID.read(din); + return (id); +} + +public int hashCode() { + return ((int)objNum); +} + +public boolean equals(Object obj) { + if (obj instanceof ObjID && this.objNum == ((ObjID)obj).objNum) { + return (true); + } + return (false); +} + +public String toString() { + return ("[objNum: " + objNum + ", " + space + "]"); +} + +} diff --git a/libjava/java/rmi/server/Operation.java b/libjava/java/rmi/server/Operation.java new file mode 100644 index 0000000..c75fec4 --- /dev/null +++ b/libjava/java/rmi/server/Operation.java @@ -0,0 +1,46 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +public class Operation { + +private String operation; + +public Operation(String op) { + operation = op; +} + +public String getOperation() { + return (operation); +} + +public String toString() { + return (operation); +} + +} diff --git a/libjava/java/rmi/server/RMIClassLoader.java b/libjava/java/rmi/server/RMIClassLoader.java new file mode 100644 index 0000000..76b48b7 --- /dev/null +++ b/libjava/java/rmi/server/RMIClassLoader.java @@ -0,0 +1,92 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.net.URL; +import java.net.URLConnection; +import java.io.IOException; +import java.io.DataInputStream; +import java.net.MalformedURLException; +import java.util.StringTokenizer; + +public class RMIClassLoader { + +static private class MyClassLoader extends ClassLoader { + +Class defineClass(String name, byte[] data) { + return (defineClass(name, data, 0, data.length)); +} +} +static private MyClassLoader loader = new MyClassLoader(); + +/** + * @deprecated + */ +public static Class loadClass(String name) throws MalformedURLException, ClassNotFoundException { + return (loadClass(System.getProperty("java.rmi.server.codebase"), name)); +} + +public static Class loadClass(URL codebase, String name) throws MalformedURLException, ClassNotFoundException { + URL u = new URL(codebase, name + ".class"); + try { + URLConnection conn = u.openConnection(); + DataInputStream strm = new DataInputStream(conn.getInputStream()); + byte data[] = new byte[conn.getContentLength()]; + strm.readFully(data); + return (loader.defineClass(name, data)); + } + catch (IOException _) { + throw new ClassNotFoundException(name); + } +} + +public static Class loadClass(String codebase, String name) throws MalformedURLException, ClassNotFoundException { + StringTokenizer tok = new StringTokenizer(codebase, ":"); + while (tok.hasMoreTokens()) { + try { + return (loadClass(new URL(tok.nextToken()), name)); + } + catch (ClassNotFoundException _) { + // Ignore - try the next one. + } + } + throw new ClassNotFoundException(name); +} + +public static String getClassAnnotation(Class cl) { + return (null); // We don't yet do this. +} + +/** + * @deprecated + */ +public static Object getSecurityContext(ClassLoader loader) { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/java/rmi/server/RMIClientSocketFactory.java b/libjava/java/rmi/server/RMIClientSocketFactory.java new file mode 100644 index 0000000..1eda8da --- /dev/null +++ b/libjava/java/rmi/server/RMIClientSocketFactory.java @@ -0,0 +1,37 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.net.Socket; +import java.io.IOException; + +public interface RMIClientSocketFactory { + +public Socket createSocket(String host, int port) throws IOException; + +} diff --git a/libjava/java/rmi/server/RMIFailureHandler.java b/libjava/java/rmi/server/RMIFailureHandler.java new file mode 100644 index 0000000..e729593 --- /dev/null +++ b/libjava/java/rmi/server/RMIFailureHandler.java @@ -0,0 +1,34 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +public interface RMIFailureHandler { + +public boolean failure(Exception ex); + +} diff --git a/libjava/java/rmi/server/RMIServerSocketFactory.java b/libjava/java/rmi/server/RMIServerSocketFactory.java new file mode 100644 index 0000000..46245bd --- /dev/null +++ b/libjava/java/rmi/server/RMIServerSocketFactory.java @@ -0,0 +1,37 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.net.ServerSocket; +import java.io.IOException; + +public interface RMIServerSocketFactory { + +public ServerSocket createServerSocket(int port) throws IOException; + +} diff --git a/libjava/java/rmi/server/RMISocketFactory.java b/libjava/java/rmi/server/RMISocketFactory.java new file mode 100644 index 0000000..bc7f8c3 --- /dev/null +++ b/libjava/java/rmi/server/RMISocketFactory.java @@ -0,0 +1,74 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.net.Socket; +import java.net.ServerSocket; +import java.io.IOException; +import gnu.java.rmi.server.RMIDefaultSocketFactory; + +public abstract class RMISocketFactory + implements RMIClientSocketFactory, RMIServerSocketFactory { + +static private RMISocketFactory defaultFactory; +static private RMISocketFactory currentFactory; +static private RMIFailureHandler currentHandler; + +static { + defaultFactory = new RMIDefaultSocketFactory(); + currentFactory = defaultFactory; +} + +public RMISocketFactory() { +} + +public abstract Socket createSocket(String host, int port) throws IOException; + +public abstract ServerSocket createServerSocket(int port) throws IOException; + +public static void setSocketFactory(RMISocketFactory fac) throws IOException { + currentFactory = fac; +} + +public static RMISocketFactory getSocketFactory() { + return (currentFactory); +} + +public static RMISocketFactory getDefaultSocketFactory() { + return (defaultFactory); +} + +public static void setFailureHandler(RMIFailureHandler fh) { + currentHandler = fh; +} + +public static RMIFailureHandler getFailureHandler() { + return (currentHandler); +} + +} diff --git a/libjava/java/rmi/server/RemoteCall.java b/libjava/java/rmi/server/RemoteCall.java new file mode 100644 index 0000000..ceb8abe --- /dev/null +++ b/libjava/java/rmi/server/RemoteCall.java @@ -0,0 +1,46 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.lang.Exception; +import java.io.IOException; +import java.io.ObjectOutput; +import java.io.ObjectInput; +import java.io.StreamCorruptedException; + +public interface RemoteCall { + +public ObjectOutput getOutputStream() throws IOException; +public void releaseOutputStream() throws IOException; +public ObjectInput getInputStream() throws IOException; +public void releaseInputStream() throws IOException; +public ObjectOutput getResultStream(boolean success) throws IOException, StreamCorruptedException; +public void executeCall() throws Exception; +public void done() throws IOException; + +} diff --git a/libjava/java/rmi/server/RemoteObject.java b/libjava/java/rmi/server/RemoteObject.java new file mode 100644 index 0000000..6f12866 --- /dev/null +++ b/libjava/java/rmi/server/RemoteObject.java @@ -0,0 +1,119 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.io.Serializable; +import java.rmi.Remote; +import java.rmi.NoSuchObjectException; +import java.rmi.UnmarshalException; +import java.rmi.server.RemoteRef; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.IOException; +import java.lang.ClassNotFoundException; +import java.lang.InstantiationException; +import java.lang.IllegalAccessException; + +public abstract class RemoteObject + implements Remote, Serializable { + +public static final long serialVersionUID = -3215090123894869218l; + +protected transient RemoteRef ref; + +protected RemoteObject() { + this(null); +} + +protected RemoteObject(RemoteRef newref) { + ref = newref; +} + +public RemoteRef getRef() { + return (ref); +} + +public static Remote toStub(Remote obj) throws NoSuchObjectException { + throw new Error("Not implemented"); +} + +public int hashCode() { + if (ref == null) { + return (0); + } + else { + return (ref.hashCode()); + } +} + +public boolean equals(Object obj) { + // We only compare references. + return (this == obj); +} + +public String toString() { + return (ref.toString()); +} + +private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { + String cname = in.readUTF(); + if (!cname.equals("")) { + cname = RemoteRef.packagePrefix + '.' + cname; + try { + Class cls = Class.forName(cname); + ref = (RemoteRef)cls.newInstance(); + } + catch (InstantiationException e1) { + throw new UnmarshalException("failed to create ref"); + } + catch (IllegalAccessException e2) { + throw new UnmarshalException("failed to create ref"); + } + ref.readExternal(in); + } + else { + ref = (RemoteRef)in.readObject(); + } +} + +private void writeObject(ObjectOutputStream out) throws IOException, ClassNotFoundException { + if (ref == null) { + throw new UnmarshalException("no ref to serialize"); + } + String cname = ref.getRefClass(out); + if (cname != null && cname.length() > 0) { + out.writeUTF(cname); + ref.writeExternal(out); + } + else { + out.writeUTF(""); + out.writeObject(ref); + } +} + +} diff --git a/libjava/java/rmi/server/RemoteRef.java b/libjava/java/rmi/server/RemoteRef.java new file mode 100644 index 0000000..f9e57ce --- /dev/null +++ b/libjava/java/rmi/server/RemoteRef.java @@ -0,0 +1,51 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.lang.reflect.Method; +import java.io.Externalizable; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.io.ObjectOutput; + +public interface RemoteRef + extends Externalizable { + +public static final long serialVersionUID = 0; +public static final String packagePrefix = "gnu.java.rmi.server"; + +public void invoke(RemoteCall call) throws Exception; +public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception; +public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException; +public void done(RemoteCall call) throws RemoteException; +public boolean remoteEquals(RemoteRef ref); +public int remoteHashCode(); +public String getRefClass(ObjectOutput out); +public String remoteToString(); + +} diff --git a/libjava/java/rmi/server/RemoteServer.java b/libjava/java/rmi/server/RemoteServer.java new file mode 100644 index 0000000..24a564a --- /dev/null +++ b/libjava/java/rmi/server/RemoteServer.java @@ -0,0 +1,56 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.io.OutputStream; +import java.io.PrintStream; + +public abstract class RemoteServer + extends RemoteObject { + +protected RemoteServer() { + super(); +} + +protected RemoteServer(RemoteRef ref) { + super(ref); +} + +public static String getClientHost() throws ServerNotActiveException { + throw new Error("Not implemented"); +} + +public static void setLog(OutputStream out) { + throw new Error("Not implemented"); +} + +public static PrintStream getLog() { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/java/rmi/server/RemoteStub.java b/libjava/java/rmi/server/RemoteStub.java new file mode 100644 index 0000000..c364cd8 --- /dev/null +++ b/libjava/java/rmi/server/RemoteStub.java @@ -0,0 +1,47 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +public abstract class RemoteStub + extends RemoteObject { + +public static final long serialVersionUID = -1585587260594494182l; + +protected RemoteStub() { + super(); +} + +protected RemoteStub(RemoteRef ref) { + super(ref); +} + +protected static void setRef(RemoteStub stub, RemoteRef ref) { + stub.ref = ref; +} + +} diff --git a/libjava/java/rmi/server/ServerCloneException.java b/libjava/java/rmi/server/ServerCloneException.java new file mode 100644 index 0000000..3912168 --- /dev/null +++ b/libjava/java/rmi/server/ServerCloneException.java @@ -0,0 +1,76 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.lang.CloneNotSupportedException; +import java.io.PrintStream; +import java.io.PrintWriter; + +public class ServerCloneException + extends CloneNotSupportedException { + +public Exception detail; + +public ServerCloneException(String s) { + super(s); + detail = null; +} + +public ServerCloneException(String s, Exception e) { + super(s); + detail = e; +} + +public String getMessage() { + if (detail != null) { + return (super.getMessage() + ":" + detail.getMessage()); + } + else { + return (super.getMessage()); + } +} + +public void printStackTrace(PrintStream s) { + if (detail != null) { + detail.printStackTrace(s); + } + super.printStackTrace(s); +} + +public void printStackTrace() { + printStackTrace(System.err); +} + +public void printStackTrace(PrintWriter s) { + if (detail != null) { + detail.printStackTrace(s); + } + super.printStackTrace(s); +} + +} diff --git a/libjava/java/rmi/server/ServerNotActiveException.java b/libjava/java/rmi/server/ServerNotActiveException.java new file mode 100644 index 0000000..90747f7 --- /dev/null +++ b/libjava/java/rmi/server/ServerNotActiveException.java @@ -0,0 +1,43 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.lang.Exception; + +public class ServerNotActiveException + extends Exception { + +public ServerNotActiveException() { + super(); +} + +public ServerNotActiveException(String s) { + super(s); +} + +} diff --git a/libjava/java/rmi/server/ServerRef.java b/libjava/java/rmi/server/ServerRef.java new file mode 100644 index 0000000..fc75669d --- /dev/null +++ b/libjava/java/rmi/server/ServerRef.java @@ -0,0 +1,43 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.server.RemoteStub; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.server.ServerNotActiveException; + +public interface ServerRef + extends RemoteRef { + +public static final long serialVersionUID = 0; + +public RemoteStub exportObject(Remote obj, Object data) throws RemoteException; +public String getClientHost() throws ServerNotActiveException; + +} diff --git a/libjava/java/rmi/server/Skeleton.java b/libjava/java/rmi/server/Skeleton.java new file mode 100644 index 0000000..99339d5 --- /dev/null +++ b/libjava/java/rmi/server/Skeleton.java @@ -0,0 +1,39 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.Remote; +import java.lang.Exception; +import java.rmi.server.RemoteCall; + +public interface Skeleton { + +public void dispatch(Remote obj, RemoteCall theCall, int opnum, long hash) throws Exception; +public Operation[] getOperations(); + +} diff --git a/libjava/java/rmi/server/SkeletonMismatchException.java b/libjava/java/rmi/server/SkeletonMismatchException.java new file mode 100644 index 0000000..e74ae51 --- /dev/null +++ b/libjava/java/rmi/server/SkeletonMismatchException.java @@ -0,0 +1,41 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.RemoteException; + +public class SkeletonMismatchException + extends RemoteException { + +public static final long serialVersionUID = -7780460454818859281l; + +public SkeletonMismatchException(String s) { + super(s); +} + +} diff --git a/libjava/java/rmi/server/SkeletonNotFoundException.java b/libjava/java/rmi/server/SkeletonNotFoundException.java new file mode 100644 index 0000000..26dfe88 --- /dev/null +++ b/libjava/java/rmi/server/SkeletonNotFoundException.java @@ -0,0 +1,43 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.RemoteException; + +public class SkeletonNotFoundException + extends RemoteException { + +public SkeletonNotFoundException(String s) { + super(s); +} + +public SkeletonNotFoundException(String s, Exception e) { + super(s, e); +} + +} diff --git a/libjava/java/rmi/server/SocketSecurityException.java b/libjava/java/rmi/server/SocketSecurityException.java new file mode 100644 index 0000000..10b0b80 --- /dev/null +++ b/libjava/java/rmi/server/SocketSecurityException.java @@ -0,0 +1,43 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.server.ExportException; + +public class SocketSecurityException + extends ExportException { + +public SocketSecurityException(String s) { + super(s); +} + +public SocketSecurityException(String s, Exception e) { + super(s, e); +} + +} diff --git a/libjava/java/rmi/server/UID.java b/libjava/java/rmi/server/UID.java new file mode 100644 index 0000000..49d256e --- /dev/null +++ b/libjava/java/rmi/server/UID.java @@ -0,0 +1,120 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.io.Serializable; +import java.io.DataOutput; +import java.io.DataInput; +import java.io.IOException; +import java.util.Random; +import java.lang.Thread; +import java.lang.InterruptedException; + +public final class UID + implements Serializable { + +public static final long serialVersionUID = 1086053664494604050L; + +private static final Object lock = UID.class; +private static long baseTime = System.currentTimeMillis(); +private static short nextCount = Short.MIN_VALUE; +// This is sun's algorithm - don't ask me why ... +private static final int uniqueNr = (new Object()).hashCode(); + +private int unique; +private long time; +private short count; + +/** + * This is sun's algorithm - don't ask me why ... + */ +public UID() { + synchronized (lock) { + if (count == Short.MAX_VALUE) { + long newtime; + for (;;) { + newtime = System.currentTimeMillis(); + if (newtime - baseTime > 1000) { + break; + } + try { + Thread.sleep(1000); + } + catch (InterruptedException _) { + } + } + baseTime = newtime; + nextCount = Short.MIN_VALUE; + } + count = nextCount++; + unique = uniqueNr; + time = baseTime; + } +} + +public UID(short num) { + unique = (int)num; + time = 0; + count = 0; +} + +public int hashCode() { + return (unique); +} + +public boolean equals(Object obj) { + if (obj instanceof UID) { + UID uid = (UID)obj; + if (this.unique == uid.unique && + this.time == uid.time && + this.count == uid.count) { + return (true); + } + } + return (false); +} + +public String toString() { + return ("[UID: " + unique + "," + time + "," + count + "]"); +} + +public void write(DataOutput out) throws IOException { + out.writeInt(unique); + out.writeLong(time); + out.writeShort(count); +} + +public static UID read(DataInput in) throws IOException { + UID id = new UID(); + id.unique = in.readInt(); + id.time = in.readLong(); + id.count = in.readShort(); + return (id); +} + +} diff --git a/libjava/java/rmi/server/UnicastRemoteObject.java b/libjava/java/rmi/server/UnicastRemoteObject.java new file mode 100644 index 0000000..3f78893 --- /dev/null +++ b/libjava/java/rmi/server/UnicastRemoteObject.java @@ -0,0 +1,76 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +import java.rmi.RemoteException; +import java.rmi.Remote; +import java.rmi.server.RemoteRef; +import java.rmi.NoSuchObjectException; +import gnu.java.rmi.server.UnicastServerRef; + +public class UnicastRemoteObject + extends RemoteServer { + +protected UnicastRemoteObject() throws RemoteException { + this(0); +} + +protected UnicastRemoteObject(int port) throws RemoteException { + this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()); +} + +protected UnicastRemoteObject(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { + super(new UnicastServerRef(new ObjID(), port, ssf)); +} + +protected UnicastRemoteObject(RemoteRef ref) throws RemoteException { + super((UnicastServerRef)ref); +} + +public Object clone() throws CloneNotSupportedException { + throw new Error("Not implemented"); +} + +public static RemoteStub exportObject(Remote obj) throws RemoteException { + UnicastServerRef sref = (UnicastServerRef)((RemoteObject)obj).getRef(); + return (sref.exportObject(obj)); +} + +public static Remote exportObject(Remote obj, int port) throws RemoteException { + return (exportObject(obj)); +} + +public static Remote exportObject(Remote obj, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException { + return (exportObject(obj)); +} + +public static boolean unexportObject(Remote obj, boolean force) throws NoSuchObjectException { + throw new Error("Not implemented"); +} + +} diff --git a/libjava/java/rmi/server/Unreferenced.java b/libjava/java/rmi/server/Unreferenced.java new file mode 100644 index 0000000..20678d1 --- /dev/null +++ b/libjava/java/rmi/server/Unreferenced.java @@ -0,0 +1,34 @@ +/* + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. + */ + +package java.rmi.server; + +public interface Unreferenced { + +public void unreferenced(); + +} |