Activatable.java, [...]: RMI implementation from Kaffe.

* java/rmi/activation/Activatable.java,
	java/rmi/activation/ActivateFailedException.java,
	java/rmi/activation/ActivationDesc.java,
	java/rmi/activation/ActivationException.java,
	java/rmi/activation/ActivationGroup.java,
	java/rmi/activation/ActivationGroupDesc.java,
	java/rmi/activation/ActivationGroupID.java,
	java/rmi/activation/ActivationID.java,
	java/rmi/activation/ActivationInstantiator.java,
	java/rmi/activation/ActivationMonitor.java,
	java/rmi/activation/ActivationSystem.java,
	java/rmi/activation/Activator.java,
	java/rmi/activation/UnknownGroupException.java,
	java/rmi/activation/UnknownObjectException.java,
	java/rmi/AccessException.java,
	java/rmi/AlreadyBoundException.java,
	java/rmi/ConnectException.java, java/rmi/ConnectIOException.java,
	java/rmi/MarshalException.java, java/rmi/MarshalledObject.java,
	java/rmi/Naming.java, java/rmi/NoSuchObjectException.java,
	java/rmi/NotBoundException.java,
	java/rmi/RMISecurityException.java,
	java/rmi/RMISecurityManager.java, java/rmi/Remote.java,
	java/rmi/RemoteException.java, java/rmi/ServerError.java,
	java/rmi/ServerException.java,
	java/rmi/ServerRuntimeException.java,
	java/rmi/StubNotFoundException.java,
	java/rmi/UnexpectedException.java,
	java/rmi/UnknownHostException.java,
	java/rmi/UnmarshalException.java, java/rmi/dgc/DGC.java,
	java/rmi/dgc/Lease.java, java/rmi/dgc/VMID.java,
	java/rmi/registry/LocateRegistry.java,
	java/rmi/registry/Registry.java,
	java/rmi/registry/RegistryHandler.java,
	java/rmi/server/ExportException.java,
	java/rmi/server/LoaderHandler.java,
	java/rmi/server/LogStream.java, java/rmi/server/ObjID.java,
	java/rmi/server/Operation.java,
	java/rmi/server/RMIClassLoader.java,
	java/rmi/server/RMIClientSocketFactory.java,
	java/rmi/server/RMIFailureHandler.java,
	java/rmi/server/RMIServerSocketFactory.java,
	java/rmi/server/RMISocketFactory.java,
	java/rmi/server/RemoteCall.java,
	java/rmi/server/RemoteObject.java, java/rmi/server/RemoteRef.java,
	java/rmi/server/RemoteServer.java,
	java/rmi/server/RemoteStub.java,
	java/rmi/server/ServerCloneException.java,
	java/rmi/server/ServerNotActiveException.java,
	java/rmi/server/ServerRef.java, java/rmi/server/Skeleton.java,
	java/rmi/server/SkeletonMismatchException.java,
	java/rmi/server/SkeletonNotFoundException.java,
	java/rmi/server/SocketSecurityException.java,
	java/rmi/server/UID.java,
	java/rmi/server/UnicastRemoteObject.java,
	java/rmi/server/Unreferenced.java, gnu/java/rmi/dgc/DGCImpl.java,
	gnu/java/rmi/dgc/DGCImpl_Skel.java,
	gnu/java/rmi/dgc/DGCImpl_Stub.java,
	gnu/java/rmi/registry/RegistryImpl.java,
	gnu/java/rmi/registry/RegistryImpl_Skel.java,
	gnu/java/rmi/registry/RegistryImpl_Stub.java,
	gnu/java/rmi/rmic/RMIC.java, gnu/java/rmi/rmic/TabbedWriter.java,
	gnu/java/rmi/server/ProtocolConstants.java,
	gnu/java/rmi/server/RMIDefaultSocketFactory.java,
	gnu/java/rmi/server/RMIHashes.java,
	gnu/java/rmi/server/RMIObjectInputStream.java,
	gnu/java/rmi/server/RMIObjectOutputStream.java,
	gnu/java/rmi/server/UnicastConnection.java,
	gnu/java/rmi/server/UnicastConnectionManager.java,
	gnu/java/rmi/server/UnicastRef.java,
	gnu/java/rmi/server/UnicastRemoteCall.java,
	gnu/java/rmi/server/UnicastRemoteStub.java,
	gnu/java/rmi/server/UnicastServer.java,
	gnu/java/rmi/server/UnicastServerRef.java: RMI implementation from
	Kaffe.  Relabelled classes to fit into Classpath tree.
	* Makefile.in: Rebuilt.
	* Makefile.am (rmi_java_source_files): New macro.
	(ordinary_java_source_files): Reference it.
	(bin_PROGRAMS): Added rmic and rmiregistry.
	(rmic_SOURCES): New macro.
	(EXTRA_rmic_SOURCES): Likewise.
	(rmic_LDFLAGS): Likewise.
	(rmic_LINK): Likewise.
	(rmic_LDADD): Likewise.
	(rmic_DEPENDENCIES): Likewise.
	(rmiregistry_SOURCES): New macro.
	(EXTRA_rmiregistry_SOURCES): Likewise.
	(rmiregistry_LDFLAGS): Likewise.
	(rmiregistry_LINK): Likewise.
	(rmiregistry_LDADD): Likewise.
	(rmiregistry_DEPENDENCIES): Likewise.

From-SVN: r45218
This commit is contained in:
Tom Tromey 2001-08-28 00:03:35 +00:00 committed by Tom Tromey
parent c5bb59c118
commit 83e7315b5f
88 changed files with 8583 additions and 49 deletions

View file

@ -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);
}
}

View file

@ -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);
}

View file

@ -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);
}
}

View file

@ -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 + "]");
}
}

View file

@ -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);
}
}

View file

@ -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");
}
}

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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);
}
}
}

View file

@ -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();
}

View file

@ -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");
}
}

View file

@ -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;
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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;
}

View file

@ -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();
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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");
}
}

View file

@ -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();
}