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

@ -1,3 +1,96 @@
2001-08-27 Tom Tromey <tromey@redhat.com>
* 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.
2001-08-26 Bryce McKinlay <bryce@waitaki.otago.ac.nz>
* name-finder.cc (lookup): Ignore a null dli_fname from dladdr.

View file

@ -35,7 +35,7 @@ data_DATA = libgcj.jar
## For now, only on native systems. FIXME.
if NATIVE
bin_PROGRAMS = jv-convert gij
bin_PROGRAMS = jv-convert gij rmic rmiregistry
endif
bin_SCRIPTS = addr2name.awk
@ -435,6 +435,38 @@ gij_LDADD = libgcj.la $(GCLIBS) $(THREADLIBS) $(ZLIBS) -L$(here)/.libs
## linking this program.
gij_DEPENDENCIES = $(GCDEPS) $(THREADDEPS) $(ZDEPS) libgcj.la libgcj.spec
rmic_SOURCES =
## This is a dummy definition.
EXTRA_rmic_SOURCES = $(rmi_java_source_files)
rmic_LDFLAGS = --main=gnu.java.rmi.rmic.RMIC \
-rpath $(toolexeclibdir) -shared-libgcc
rmic_LINK = $(GCJLINK)
## We explicitly link in the libraries we need. This way we don't
## need -nodefaultlibs, so we can still rely on gcj picking up the
## system libraries we need (via the specs file).
## We need the -L so that gcj can find libgcj with `-lgcj'.
## FIXME: should be _libs on some systems.
rmic_LDADD = libgcj.la $(GCLIBS) $(THREADLIBS) $(ZLIBS) -L$(here)/.libs
## Depend on the spec file to make sure it is up to date before
## linking this program.
rmic_DEPENDENCIES = $(GCDEPS) $(THREADDEPS) $(ZDEPS) libgcj.la libgcj.spec
rmiregistry_SOURCES =
## This is a dummy definition.
EXTRA_rmiregistry_SOURCES = $(rmi_java_source_files)
rmiregistry_LDFLAGS = --main=gnu.java.rmi.registry.RegistryImpl \
-rpath $(toolexeclibdir) -shared-libgcc
rmiregistry_LINK = $(GCJLINK)
## We explicitly link in the libraries we need. This way we don't
## need -nodefaultlibs, so we can still rely on gcj picking up the
## system libraries we need (via the specs file).
## We need the -L so that gcj can find libgcj with `-lgcj'.
## FIXME: should be _libs on some systems.
rmiregistry_LDADD = libgcj.la $(GCLIBS) $(THREADLIBS) $(ZLIBS) -L$(here)/.libs
## Depend on the spec file to make sure it is up to date before
## linking this program.
rmiregistry_DEPENDENCIES = $(GCDEPS) $(THREADDEPS) $(ZDEPS) libgcj.la libgcj.spec
# The Unicode consortium does not permit re-distributing the file JIS0201.TXT.
# You can get it from ftp://ftp.unicode.org/Public/MAPPINGS/EASTASIA/JIS/.
@ -769,6 +801,93 @@ java/beans/VetoableChangeListener.java \
java/beans/VetoableChangeSupport.java \
java/beans/Visibility.java
rmi_java_source_files = \
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
## Java files which are created by configure and thus are in the build
## directory.
built_java_source_files = java/lang/ConcreteProcess.java \
@ -1309,6 +1428,7 @@ org/xml/sax/SAXNotSupportedException.java \
org/xml/sax/SAXParseException.java \
org/xml/sax/XMLFilter.java \
org/xml/sax/XMLReader.java \
$(rmi_java_source_files) \
$(awt_java_source_files) \
$(convert_source_files)

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,55 @@
/*
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 gnu.java.rmi.dgc;
import java.rmi.dgc.DGC;
import java.rmi.dgc.Lease;
import java.rmi.dgc.VMID;
import java.rmi.server.ObjID;
import java.rmi.RemoteException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.RMISocketFactory;
import gnu.java.rmi.server.UnicastServerRef;
public class DGCImpl
extends UnicastRemoteObject implements DGC {
public DGCImpl() throws RemoteException {
super(new UnicastServerRef(new ObjID(ObjID.DGC_ID), 0, RMISocketFactory.getSocketFactory()));
}
public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException {
System.out.println("DGCImpl.dirty - not implemented");
return (lease);
}
public void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) throws RemoteException {
System.out.println("DGCImpl.clean - not implemented");
}
}

View file

@ -0,0 +1,106 @@
// Skel class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.dgc;
public final class DGCImpl_Skel
implements java.rmi.server.Skeleton
{
private static final long interfaceHash = -669196253586618813L;
private static final java.rmi.server.Operation[] operations = {
new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean"),
new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease")
};
public java.rmi.server.Operation[] getOperations() {
return ((java.rmi.server.Operation[]) operations.clone());
}
public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
if (opnum < 0) {
if (hash == -5803803475088455571L) {
opnum = 0;
}
else if (hash == -8139341527526761862L) {
opnum = 1;
}
else {
throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
}
}
else if (hash != interfaceHash) {
throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
}
gnu.java.rmi.dgc.DGCImpl server = (gnu.java.rmi.dgc.DGCImpl)obj;
switch (opnum) {
case 0:
{
java.rmi.server.ObjID[] $param_0;
long $param_1;
java.rmi.dgc.VMID $param_2;
boolean $param_3;
try {
java.io.ObjectInput in = call.getInputStream();
$param_0 = (java.rmi.server.ObjID[])in.readObject();
$param_1 = (long)in.readLong();
$param_2 = (java.rmi.dgc.VMID)in.readObject();
$param_3 = (boolean)in.readBoolean();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
catch (java.lang.ClassCastException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
server.clean($param_0, $param_1, $param_2, $param_3);
try {
java.io.ObjectOutput out = call.getResultStream(true);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
case 1:
{
java.rmi.server.ObjID[] $param_0;
long $param_1;
java.rmi.dgc.Lease $param_2;
try {
java.io.ObjectInput in = call.getInputStream();
$param_0 = (java.rmi.server.ObjID[])in.readObject();
$param_1 = (long)in.readLong();
$param_2 = (java.rmi.dgc.Lease)in.readObject();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
catch (java.lang.ClassCastException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
java.rmi.dgc.Lease $result = server.dirty($param_0, $param_1, $param_2);
try {
java.io.ObjectOutput out = call.getResultStream(true);
out.writeObject($result);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
default:
throw new java.rmi.UnmarshalException("invalid method number");
}
}
}

View file

@ -0,0 +1,120 @@
// Stub class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.dgc;
public final class DGCImpl_Stub
extends java.rmi.server.RemoteStub
implements java.rmi.dgc.DGC
{
private static final long serialVersionUID = 2L;
private static final long interfaceHash = -669196253586618813L;
private static boolean useNewInvoke;
private static final java.rmi.server.Operation[] operations = {
new java.rmi.server.Operation("void clean(java.rmi.server.ObjID[], long, java.rmi.dgc.VMID, boolean)"),
new java.rmi.server.Operation("java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[], long, java.rmi.dgc.Lease)")
};
private static java.lang.reflect.Method $method_clean_0;
private static java.lang.reflect.Method $method_dirty_1;
static {
try {
java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
useNewInvoke = true;
$method_clean_0 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("clean", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.VMID.class, boolean.class});
$method_dirty_1 = gnu.java.rmi.dgc.DGCImpl.class.getMethod("dirty", new java.lang.Class[] {java.rmi.server.ObjID[].class, long.class, java.rmi.dgc.Lease.class});
}
catch (java.lang.NoSuchMethodException e) {
useNewInvoke = false;
}
}
public DGCImpl_Stub() {
super();
}
public DGCImpl_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
public void clean(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.VMID $param_2, boolean $param_3) throws java.rmi.RemoteException {
try {
if (useNewInvoke) {
ref.invoke(this, $method_clean_0, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2, new java.lang.Boolean($param_3)}, -5803803475088455571L);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
out.writeObject($param_0);
out.writeLong($param_1);
out.writeObject($param_2);
out.writeBoolean($param_3);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
try {
java.io.ObjectInput in = call.getInputStream();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
public java.rmi.dgc.Lease dirty(java.rmi.server.ObjID[] $param_0, long $param_1, java.rmi.dgc.Lease $param_2) throws java.rmi.RemoteException {
try {
if (useNewInvoke) {
java.lang.Object $result = ref.invoke(this, $method_dirty_1, new java.lang.Object[] {$param_0, new java.lang.Long($param_1), $param_2}, -8139341527526761862L);
return ((java.rmi.dgc.Lease)$result);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 1, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
out.writeObject($param_0);
out.writeLong($param_1);
out.writeObject($param_2);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
java.rmi.dgc.Lease $result;
try {
java.io.ObjectInput in = call.getInputStream();
$result = (java.rmi.dgc.Lease)in.readObject();
return ($result);
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,115 @@
/*
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 gnu.java.rmi.registry;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
import java.rmi.RemoteException;
import java.rmi.NotBoundException;
import java.rmi.AccessException;
import java.rmi.AlreadyBoundException;
import java.rmi.Remote;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.ObjID;
import java.util.Hashtable;
import java.util.Enumeration;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import gnu.java.rmi.server.UnicastServerRef;
public class RegistryImpl
extends UnicastRemoteObject implements Registry {
private Hashtable bindings = new Hashtable();
public RegistryImpl(int port) throws RemoteException {
this(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory());
}
public RegistryImpl(int port, RMIClientSocketFactory cf, RMIServerSocketFactory sf) throws RemoteException {
super(new UnicastServerRef(new ObjID(ObjID.REGISTRY_ID), port, sf));
((UnicastServerRef)getRef()).exportObject(this);
}
public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException {
Object obj = bindings.get(name);
if (obj == null) {
throw new NotBoundException(name);
}
return ((Remote)obj);
}
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException {
if (bindings.containsKey(name)) {
throw new AlreadyBoundException(name);
}
bindings.put(name, obj);
}
public void unbind(String name) throws RemoteException, NotBoundException, AccessException {
Object obj = bindings.remove(name);
if (obj == null) {
throw new NotBoundException(name);
}
}
public void rebind(String name, Remote obj) throws RemoteException, AccessException {
bindings.put(name, obj);
}
public String[] list() throws RemoteException, AccessException {
int size = bindings.size();
String[] strings = new String[size];
Enumeration e = bindings.keys();
for (int i = 0; i < size; i++) {
strings[i] = (String)e.nextElement();
}
return (strings);
}
public static void main(String[] args) {
int port = Registry.REGISTRY_PORT;
if (args.length > 0) {
try {
port = Integer.parseInt(args[0]);
}
catch (NumberFormatException _) {
System.err.println("Bad port number - using default");
}
}
try {
Registry impl = LocateRegistry.createRegistry(port);
}
catch (RemoteException _) {
System.err.println("Registry failed");
}
}
}

View file

@ -0,0 +1,189 @@
// Skel class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.registry;
public final class RegistryImpl_Skel
implements java.rmi.server.Skeleton
{
private static final long interfaceHash = 4905912898345647071L;
private static final java.rmi.server.Operation[] operations = {
new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote"),
new java.rmi.server.Operation("java.lang.String[] list("),
new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String"),
new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote"),
new java.rmi.server.Operation("void unbind(java.lang.String")
};
public java.rmi.server.Operation[] getOperations() {
return ((java.rmi.server.Operation[]) operations.clone());
}
public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {
if (opnum < 0) {
if (hash == 7583982177005850366L) {
opnum = 0;
}
else if (hash == 2571371476350237748L) {
opnum = 1;
}
else if (hash == -7538657168040752697L) {
opnum = 2;
}
else if (hash == -8381844669958460146L) {
opnum = 3;
}
else if (hash == 7305022919901907578L) {
opnum = 4;
}
else {
throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
}
}
else if (hash != interfaceHash) {
throw new java.rmi.server.SkeletonMismatchException("interface hash mismatch");
}
gnu.java.rmi.registry.RegistryImpl server = (gnu.java.rmi.registry.RegistryImpl)obj;
switch (opnum) {
case 0:
{
java.lang.String $param_0;
java.rmi.Remote $param_1;
try {
java.io.ObjectInput in = call.getInputStream();
$param_0 = (java.lang.String)in.readObject();
$param_1 = (java.rmi.Remote)in.readObject();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
catch (java.lang.ClassCastException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
server.bind($param_0, $param_1);
try {
java.io.ObjectOutput out = call.getResultStream(true);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
case 1:
{
try {
java.io.ObjectInput in = call.getInputStream();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
java.lang.String[] $result = server.list();
try {
java.io.ObjectOutput out = call.getResultStream(true);
out.writeObject($result);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
case 2:
{
java.lang.String $param_0;
try {
java.io.ObjectInput in = call.getInputStream();
$param_0 = (java.lang.String)in.readObject();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
catch (java.lang.ClassCastException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
java.rmi.Remote $result = server.lookup($param_0);
try {
java.io.ObjectOutput out = call.getResultStream(true);
out.writeObject($result);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
case 3:
{
java.lang.String $param_0;
java.rmi.Remote $param_1;
try {
java.io.ObjectInput in = call.getInputStream();
$param_0 = (java.lang.String)in.readObject();
$param_1 = (java.rmi.Remote)in.readObject();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
catch (java.lang.ClassCastException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
server.rebind($param_0, $param_1);
try {
java.io.ObjectOutput out = call.getResultStream(true);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
case 4:
{
java.lang.String $param_0;
try {
java.io.ObjectInput in = call.getInputStream();
$param_0 = (java.lang.String)in.readObject();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
catch (java.lang.ClassCastException e) {
throw new java.rmi.UnmarshalException("error unmarshalling arguments", e);
}
finally {
call.releaseInputStream();
}
server.unbind($param_0);
try {
java.io.ObjectOutput out = call.getResultStream(true);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling return", e);
}
break;
}
default:
throw new java.rmi.UnmarshalException("invalid method number");
}
}
}

View file

@ -0,0 +1,255 @@
// Stub class generated by rmic - DO NOT EDIT!
package gnu.java.rmi.registry;
public final class RegistryImpl_Stub
extends java.rmi.server.RemoteStub
implements java.rmi.registry.Registry
{
private static final long serialVersionUID = 2L;
private static final long interfaceHash = 4905912898345647071L;
private static boolean useNewInvoke;
private static final java.rmi.server.Operation[] operations = {
new java.rmi.server.Operation("void bind(java.lang.String, java.rmi.Remote)"),
new java.rmi.server.Operation("java.lang.String[] list()"),
new java.rmi.server.Operation("java.rmi.Remote lookup(java.lang.String)"),
new java.rmi.server.Operation("void rebind(java.lang.String, java.rmi.Remote)"),
new java.rmi.server.Operation("void unbind(java.lang.String)")
};
private static java.lang.reflect.Method $method_bind_0;
private static java.lang.reflect.Method $method_list_1;
private static java.lang.reflect.Method $method_lookup_2;
private static java.lang.reflect.Method $method_rebind_3;
private static java.lang.reflect.Method $method_unbind_4;
static {
try {
java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });
useNewInvoke = true;
$method_bind_0 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("bind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
$method_list_1 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("list", new java.lang.Class[] {});
$method_lookup_2 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("lookup", new java.lang.Class[] {java.lang.String.class});
$method_rebind_3 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("rebind", new java.lang.Class[] {java.lang.String.class, java.rmi.Remote.class});
$method_unbind_4 = gnu.java.rmi.registry.RegistryImpl.class.getMethod("unbind", new java.lang.Class[] {java.lang.String.class});
}
catch (java.lang.NoSuchMethodException e) {
useNewInvoke = false;
}
}
public RegistryImpl_Stub() {
super();
}
public RegistryImpl_Stub(java.rmi.server.RemoteRef ref) {
super(ref);
}
public void bind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.AlreadyBoundException, java.rmi.RemoteException {
try {
if (useNewInvoke) {
ref.invoke(this, $method_bind_0, new java.lang.Object[] {$param_0, $param_1}, 7583982177005850366L);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 0, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
out.writeObject($param_0);
out.writeObject($param_1);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
try {
java.io.ObjectInput in = call.getInputStream();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.AccessException e) {
throw e;
}
catch (java.rmi.AlreadyBoundException e) {
throw e;
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
public java.lang.String[] list() throws java.rmi.AccessException, java.rmi.RemoteException {
try {
if (useNewInvoke) {
java.lang.Object $result = ref.invoke(this, $method_list_1, null, 2571371476350237748L);
return ((java.lang.String[])$result);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 1, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
java.lang.String[] $result;
try {
java.io.ObjectInput in = call.getInputStream();
$result = (java.lang.String[])in.readObject();
return ($result);
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.AccessException e) {
throw e;
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
public java.rmi.Remote lookup(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException {
try {
if (useNewInvoke) {
java.lang.Object $result = ref.invoke(this, $method_lookup_2, new java.lang.Object[] {$param_0}, -7538657168040752697L);
return ((java.rmi.Remote)$result);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 2, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
out.writeObject($param_0);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
java.rmi.Remote $result;
try {
java.io.ObjectInput in = call.getInputStream();
$result = (java.rmi.Remote)in.readObject();
return ($result);
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.AccessException e) {
throw e;
}
catch (java.rmi.NotBoundException e) {
throw e;
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
public void rebind(java.lang.String $param_0, java.rmi.Remote $param_1) throws java.rmi.AccessException, java.rmi.RemoteException {
try {
if (useNewInvoke) {
ref.invoke(this, $method_rebind_3, new java.lang.Object[] {$param_0, $param_1}, -8381844669958460146L);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 3, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
out.writeObject($param_0);
out.writeObject($param_1);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
try {
java.io.ObjectInput in = call.getInputStream();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.AccessException e) {
throw e;
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
public void unbind(java.lang.String $param_0) throws java.rmi.AccessException, java.rmi.NotBoundException, java.rmi.RemoteException {
try {
if (useNewInvoke) {
ref.invoke(this, $method_unbind_4, new java.lang.Object[] {$param_0}, 7305022919901907578L);
}
else {
java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, 4, interfaceHash);
try {
java.io.ObjectOutput out = call.getOutputStream();
out.writeObject($param_0);
}
catch (java.io.IOException e) {
throw new java.rmi.MarshalException("error marshalling arguments", e);
}
ref.invoke(call);
try {
java.io.ObjectInput in = call.getInputStream();
}
catch (java.io.IOException e) {
throw new java.rmi.UnmarshalException("error unmarshalling return", e);
}
finally {
ref.done(call);
}
}
}
catch (java.rmi.AccessException e) {
throw e;
}
catch (java.rmi.NotBoundException e) {
throw e;
}
catch (java.rmi.RemoteException e) {
throw e;
}
catch (java.lang.Exception e) {
throw new java.rmi.UnexpectedException("undeclared checked exception", e);
}
}
}

View file

@ -0,0 +1,982 @@
/*
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 gnu.java.rmi.rmic;
import java.io.File;
import java.io.FileWriter;
import java.io.PrintWriter;
import java.io.IOException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Arrays;
import java.lang.Comparable;
import gnu.java.rmi.server.RMIHashes;
// import kaffe.tools.compiler.Compiler;
public class RMIC {
private String[] args;
private int next;
private Exception exception;
private boolean keep = false;
private boolean need11Stubs = true;
private boolean need12Stubs = true;
private boolean compile = true;
private boolean verbose;
private String destination;
private PrintWriter out;
private TabbedWriter ctrl;
private Class clazz;
private String classname;
private String fullclassname;
private MethodRef[] remotemethods;
private String stubname;
private String skelname;
public RMIC(String[] a) {
args = a;
}
public static void main(String args[]) {
RMIC r = new RMIC(args);
if (r.run() == false) {
Exception exception = r.getException();
if (exception != null) {
exception.printStackTrace();
}
else {
usage();
}
}
}
public boolean run() {
parseOptions();
if (next >= args.length) {
return (false);
}
for (int i = next; i < args.length; i++) {
try {
if (verbose) {
System.out.println("[Processing class " + args[i] + ".class]");
}
processClass(args[i]);
}
catch (Exception e) {
exception = e;
return (false);
}
}
return (true);
}
private boolean processClass(String classname) throws Exception {
analyzeClass(classname);
generateStub();
if (need11Stubs) {
generateSkel();
}
if (compile) {
compile(stubname + ".java");
if (need11Stubs) {
compile(skelname + ".java");
}
}
if (!keep) {
(new File(stubname + ".java")).delete();
if (need11Stubs) {
(new File(skelname + ".java")).delete();
}
}
return (true);
}
private void analyzeClass(String cname) throws Exception {
int p = cname.lastIndexOf('.');
if (p != -1) {
classname = cname.substring(p+1);
}
else {
classname = cname;
}
fullclassname = cname;
HashSet rmeths = new HashSet();
findClass();
for (Class cls = clazz; cls != null; cls = cls.getSuperclass()) {
// Keep going down the inheritence tree until we hit the system
if (cls.getName().startsWith("java.")) {
break;
}
Method[] meths = cls.getDeclaredMethods();
for (int i = 0; i < meths.length; i++) {
// Only include public methods
int mods = meths[i].getModifiers();
if (Modifier.isPublic(mods) && !Modifier.isStatic(mods)) {
// Should check exceptions here. - XXX
// Add this one in.
rmeths.add(meths[i]);
}
}
}
// Convert into a MethodRef array and sort them
remotemethods = new MethodRef[rmeths.size()];
int c = 0;
for (Iterator i = rmeths.iterator(); i.hasNext(); ) {
remotemethods[c++] = new MethodRef((Method)i.next());
}
Arrays.sort(remotemethods);
}
public Exception getException() {
return (exception);
}
private void findClass() throws ClassNotFoundException {
clazz = Class.forName(fullclassname);
}
private void generateStub() throws IOException {
stubname = classname + "_Stub";
ctrl = new TabbedWriter(new FileWriter(stubname + ".java"));
out = new PrintWriter(ctrl);
if (verbose) {
System.out.println("[Generating class " + stubname + ".java]");
}
out.println("// Stub class generated by rmic - DO NOT EDIT!");
out.println();
if (fullclassname != classname) {
String pname = fullclassname.substring(0, fullclassname.lastIndexOf('.'));
out.println("package " + pname + ";");
out.println();
}
out.print("public final class " + stubname);
ctrl.indent();
out.println("extends java.rmi.server.RemoteStub");
// Output interfaces we implement
out.print("implements ");
Class[] ifaces = clazz.getInterfaces();
for (int i = 0; i < ifaces.length; i++) {
out.print(ifaces[i].getName());
if (i+1 < ifaces.length) {
out.print(", ");
}
}
ctrl.unindent();
out.print("{");
ctrl.indent();
// UID
if (need12Stubs) {
out.println("private static final long serialVersionUID = 2L;");
out.println();
}
// InterfaceHash - don't know how to calculate this - XXX
if (need11Stubs) {
out.println("private static final long interfaceHash = " + RMIHashes.getInterfaceHash(clazz) + "L;");
out.println();
if (need12Stubs) {
out.println("private static boolean useNewInvoke;");
out.println();
}
// Operation table
out.print("private static final java.rmi.server.Operation[] operations = {");
ctrl.indent();
for (int i = 0; i < remotemethods.length; i++) {
Method m = remotemethods[i].meth;
out.print("new java.rmi.server.Operation(\"");
out.print(getPrettyName(m.getReturnType()) + " ");
out.print(m.getName() + "(");
// Output signature
Class[] sig = m.getParameterTypes();
for (int j = 0; j < sig.length; j++) {
out.print(getPrettyName(sig[j]));
if (j+1 < sig.length) {
out.print(", ");
}
}
out.print(")\")");
if (i + 1 < remotemethods.length) {
out.println(",");
}
}
ctrl.unindent();
out.println("};");
out.println();
}
// Set of method references.
if (need12Stubs) {
for (int i = 0; i < remotemethods.length; i++) {
Method m = remotemethods[i].meth;
out.println("private static java.lang.reflect.Method $method_" + m.getName() + "_" + i + ";");
}
// Initialize the methods references.
out.println();
out.print("static {");
ctrl.indent();
out.print("try {");
ctrl.indent();
if (need11Stubs) {
out.println("java.rmi.server.RemoteRef.class.getMethod(\"invoke\", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class });");
out.println("useNewInvoke = true;");
}
for (int i = 0; i < remotemethods.length; i++) {
Method m = remotemethods[i].meth;
out.print("$method_" + m.getName() + "_" + i + " = ");
out.print(fullclassname + ".class.getMethod(\"" + m.getName() + "\"");
out.print(", new java.lang.Class[] {");
// Output signature
Class[] sig = m.getParameterTypes();
for (int j = 0; j < sig.length; j++) {
out.print(getPrettyName(sig[j]) + ".class");
if (j+1 < sig.length) {
out.print(", ");
}
}
out.println("});");
}
ctrl.unindent();
out.println("}");
out.print("catch (java.lang.NoSuchMethodException e) {");
ctrl.indent();
if (need11Stubs) {
out.print("useNewInvoke = false;");
}
else {
out.print("throw new java.lang.NoSuchMethodError(\"stub class initialization failed\");");
}
ctrl.unindent();
out.print("}");
ctrl.unindent();
out.println("}");
out.println();
}
// Constructors
if (need11Stubs) {
out.print("public " + stubname + "() {");
ctrl.indent();
out.print("super();");
ctrl.unindent();
out.println("}");
}
if (need12Stubs) {
out.print("public " + stubname + "(java.rmi.server.RemoteRef ref) {");
ctrl.indent();
out.print("super(ref);");
ctrl.unindent();
out.println("}");
}
// Method implementations
for (int i = 0; i < remotemethods.length; i++) {
Method m = remotemethods[i].meth;
Class[] sig = m.getParameterTypes();
Class returntype = m.getReturnType();
Class[] except = sortExceptions(m.getExceptionTypes());
out.println();
out.print("public " + getPrettyName(returntype) + " " + m.getName() + "(");
for (int j = 0; j < sig.length; j++) {
out.print(getPrettyName(sig[j]));
out.print(" $param_" + j);
if (j+1 < sig.length) {
out.print(", ");
}
}
out.print(") ");
out.print("throws ");
for (int j = 0; j < except.length; j++) {
out.print(getPrettyName(except[j]));
if (j+1 < except.length) {
out.print(", ");
}
}
out.print(" {");
ctrl.indent();
out.print("try {");
ctrl.indent();
if (need12Stubs) {
if (need11Stubs) {
out.print("if (useNewInvoke) {");
ctrl.indent();
}
if (returntype != Void.TYPE) {
out.print("java.lang.Object $result = ");
}
out.print("ref.invoke(this, $method_" + m.getName() + "_" + i + ", ");
if (sig.length == 0) {
out.print("null, ");
}
else {
out.print("new java.lang.Object[] {");
for (int j = 0; j < sig.length; j++) {
if (sig[j] == Boolean.TYPE) {
out.print("new java.lang.Boolean($param_" + j + ")");
}
else if (sig[j] == Byte.TYPE) {
out.print("new java.lang.Byte($param_" + j + ")");
}
else if (sig[j] == Character.TYPE) {
out.print("new java.lang.Character($param_" + j + ")");
}
else if (sig[j] == Short.TYPE) {
out.print("new java.lang.Short($param_" + j + ")");
}
else if (sig[j] == Integer.TYPE) {
out.print("new java.lang.Integer($param_" + j + ")");
}
else if (sig[j] == Long.TYPE) {
out.print("new java.lang.Long($param_" + j + ")");
}
else if (sig[j] == Float.TYPE) {
out.print("new java.lang.Float($param_" + j + ")");
}
else if (sig[j] == Double.TYPE) {
out.print("new java.lang.Double($param_" + j + ")");
}
else {
out.print("$param_" + j);
}
if (j+1 < sig.length) {
out.print(", ");
}
}
out.print("}, ");
}
out.print(Long.toString(remotemethods[i].hash) + "L");
out.print(");");
if (returntype != Void.TYPE) {
out.println();
out.print("return (");
if (returntype == Boolean.TYPE) {
out.print("((java.lang.Boolean)$result).booleanValue()");
}
else if (returntype == Byte.TYPE) {
out.print("((java.lang.Byte)$result).byteValue()");
}
else if (returntype == Character.TYPE) {
out.print("((java.lang.Character)$result).charValue()");
}
else if (returntype == Short.TYPE) {
out.print("((java.lang.Short)$result).shortValue()");
}
else if (returntype == Integer.TYPE) {
out.print("((java.lang.Integer)$result).intValue()");
}
else if (returntype == Long.TYPE) {
out.print("((java.lang.Long)$result).longValue()");
}
else if (returntype == Float.TYPE) {
out.print("((java.lang.Float)$result).floatValue()");
}
else if (returntype == Double.TYPE) {
out.print("((java.lang.Double)$result).doubleValue()");
}
else {
out.print("(" + getPrettyName(returntype) + ")$result");
}
out.print(");");
}
if (need11Stubs) {
ctrl.unindent();
out.println("}");
out.print("else {");
ctrl.indent();
}
}
if (need11Stubs) {
out.println("java.rmi.server.RemoteCall call = ref.newCall((java.rmi.server.RemoteObject)this, operations, " + i + ", interfaceHash);");
out.print("try {");
ctrl.indent();
out.print("java.io.ObjectOutput out = call.getOutputStream();");
for (int j = 0; j < sig.length; j++) {
out.println();
if (sig[j] == Boolean.TYPE) {
out.print("out.writeBoolean(");
}
else if (sig[j] == Byte.TYPE) {
out.print("out.writeByte(");
}
else if (sig[j] == Character.TYPE) {
out.print("out.writeChar(");
}
else if (sig[j] == Short.TYPE) {
out.print("out.writeShort(");
}
else if (sig[j] == Integer.TYPE) {
out.print("out.writeInt(");
}
else if (sig[j] == Long.TYPE) {
out.print("out.writeLong(");
}
else if (sig[j] == Float.TYPE) {
out.print("out.writeFloat(");
}
else if (sig[j] == Double.TYPE) {
out.print("out.writeDouble(");
}
else {
out.print("out.writeObject(");
}
out.print("$param_" + j + ");");
}
ctrl.unindent();
out.println("}");
out.print("catch (java.io.IOException e) {");
ctrl.indent();
out.print("throw new java.rmi.MarshalException(\"error marshalling arguments\", e);");
ctrl.unindent();
out.println("}");
out.println("ref.invoke(call);");
if (returntype != Void.TYPE) {
out.println(getPrettyName(returntype) + " $result;");
}
out.print("try {");
ctrl.indent();
out.print("java.io.ObjectInput in = call.getInputStream();");
boolean needcastcheck = false;
if (returntype != Void.TYPE) {
out.println();
out.print("$result = ");
if (returntype == Boolean.TYPE) {
out.print("in.readBoolean();");
}
else if (returntype == Byte.TYPE) {
out.print("in.readByte();");
}
else if (returntype == Character.TYPE) {
out.print("in.readChar();");
}
else if (returntype == Short.TYPE) {
out.print("in.readShort();");
}
else if (returntype == Integer.TYPE) {
out.print("in.readInt();");
}
else if (returntype == Long.TYPE) {
out.print("in.readLong();");
}
else if (returntype == Float.TYPE) {
out.print("in.readFloat();");
}
else if (returntype == Double.TYPE) {
out.print("in.readDouble();");
}
else {
if (returntype != Object.class) {
out.print("(" + getPrettyName(returntype) + ")");
}
else {
needcastcheck = true;
}
out.print("in.readObject();");
}
out.println();
out.print("return ($result);");
}
ctrl.unindent();
out.println("}");
out.print("catch (java.io.IOException e) {");
ctrl.indent();
out.print("throw new java.rmi.UnmarshalException(\"error unmarshalling return\", e);");
ctrl.unindent();
out.println("}");
if (needcastcheck) {
out.print("catch (java.lang.ClassNotFoundException e) {");
ctrl.indent();
out.print("throw new java.rmi.UnmarshalException(\"error unmarshalling return\", e);");
ctrl.unindent();
out.println("}");
}
out.print("finally {");
ctrl.indent();
out.print("ref.done(call);");
ctrl.unindent();
out.print("}");
if (need12Stubs && need11Stubs) {
ctrl.unindent();
out.print("}");
}
}
ctrl.unindent();
out.print("}");
boolean needgeneral = true;
for (int j = 0; j < except.length; j++) {
out.println();
out.print("catch (" + getPrettyName(except[j]) + " e) {");
ctrl.indent();
out.print("throw e;");
ctrl.unindent();
out.print("}");
if (except[j] == Exception.class) {
needgeneral = false;
}
}
if (needgeneral) {
out.println();
out.print("catch (java.lang.Exception e) {");
ctrl.indent();
out.print("throw new java.rmi.UnexpectedException(\"undeclared checked exception\", e);");
ctrl.unindent();
out.print("}");
}
ctrl.unindent();
out.print("}");
out.println();
}
ctrl.unindent();
out.println("}");
out.close();
}
private void generateSkel() throws IOException {
skelname = classname + "_Skel";
ctrl = new TabbedWriter(new FileWriter(skelname + ".java"));
out = new PrintWriter(ctrl);
if (verbose) {
System.out.println("[Generating class " + skelname + ".java]");
}
out.println("// Skel class generated by rmic - DO NOT EDIT!");
out.println();
if (fullclassname != classname) {
String pname = fullclassname.substring(0, fullclassname.lastIndexOf('.'));
out.println("package " + pname + ";");
out.println();
}
out.print("public final class " + skelname);
ctrl.indent();
// Output interfaces we implement
out.print("implements java.rmi.server.Skeleton");
ctrl.unindent();
out.print("{");
ctrl.indent();
// Interface hash - don't know how to calculate this - XXX
out.println("private static final long interfaceHash = " + RMIHashes.getInterfaceHash(clazz) + "L;");
out.println();
// Operation table
out.print("private static final java.rmi.server.Operation[] operations = {");
ctrl.indent();
for (int i = 0; i < remotemethods.length; i++) {
Method m = remotemethods[i].meth;
out.print("new java.rmi.server.Operation(\"");
out.print(getPrettyName(m.getReturnType()) + " ");
out.print(m.getName() + "(");
// Output signature
Class[] sig = m.getParameterTypes();
for (int j = 0; j < sig.length; j++) {
out.print(getPrettyName(sig[j]));
if (j+1 < sig.length) {
out.print(", ");
}
}
out.print("\")");
if (i + 1 < remotemethods.length) {
out.println(",");
}
}
ctrl.unindent();
out.println("};");
out.println();
// getOpertions method
out.print("public java.rmi.server.Operation[] getOperations() {");
ctrl.indent();
out.print("return ((java.rmi.server.Operation[]) operations.clone());");
ctrl.unindent();
out.println("}");
out.println();
// Dispatch method
out.print("public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception {");
ctrl.indent();
out.print("if (opnum < 0) {");
ctrl.indent();
for (int i = 0; i < remotemethods.length; i++) {
out.print("if (hash == " + Long.toString(remotemethods[i].hash) + "L) {");
ctrl.indent();
out.print("opnum = " + i + ";");
ctrl.unindent();
out.println("}");
out.print("else ");
}
out.print("{");
ctrl.indent();
out.print("throw new java.rmi.server.SkeletonMismatchException(\"interface hash mismatch\");");
ctrl.unindent();
out.print("}");
ctrl.unindent();
out.println("}");
out.print("else if (hash != interfaceHash) {");
ctrl.indent();
out.print("throw new java.rmi.server.SkeletonMismatchException(\"interface hash mismatch\");");
ctrl.unindent();
out.println("}");
out.println();
out.println(fullclassname + " server = (" + fullclassname + ")obj;");
out.println("switch (opnum) {");
// Method dispatch
for (int i = 0; i < remotemethods.length; i++) {
Method m = remotemethods[i].meth;
out.println("case " + i + ":");
out.print("{");
ctrl.indent();
Class[] sig = m.getParameterTypes();
for (int j = 0; j < sig.length; j++) {
out.print(getPrettyName(sig[j]));
out.println(" $param_" + j + ";");
}
out.print("try {");
boolean needcastcheck = false;
ctrl.indent();
out.println("java.io.ObjectInput in = call.getInputStream();");
for (int j = 0; j < sig.length; j++) {
out.print("$param_" + j + " = ");
if (sig[j] == Boolean.TYPE) {
out.print("in.readBoolean();");
}
else if (sig[j] == Byte.TYPE) {
out.print("in.readByte();");
}
else if (sig[j] == Character.TYPE) {
out.print("in.readChar();");
}
else if (sig[j] == Short.TYPE) {
out.print("in.readShort();");
}
else if (sig[j] == Integer.TYPE) {
out.print("in.readInt();");
}
else if (sig[j] == Long.TYPE) {
out.print("in.readLong();");
}
else if (sig[j] == Float.TYPE) {
out.print("in.readFloat();");
}
else if (sig[j] == Double.TYPE) {
out.print("in.readDouble();");
}
else {
if (sig[j] != Object.class) {
out.print("(" + getPrettyName(sig[j]) + ")");
needcastcheck = true;
}
out.print("in.readObject();");
}
out.println();
}
ctrl.unindent();
out.println("}");
out.print("catch (java.io.IOException e) {");
ctrl.indent();
out.print("throw new java.rmi.UnmarshalException(\"error unmarshalling arguments\", e);");
ctrl.unindent();
out.println("}");
if (needcastcheck) {
out.print("catch (java.lang.ClassCastException e) {");
ctrl.indent();
out.print("throw new java.rmi.UnmarshalException(\"error unmarshalling arguments\", e);");
ctrl.unindent();
out.println("}");
}
out.print("finally {");
ctrl.indent();
out.print("call.releaseInputStream();");
ctrl.unindent();
out.println("}");
Class returntype = m.getReturnType();
if (returntype != Void.TYPE) {
out.print(getPrettyName(returntype) + " $result = ");
}
out.print("server." + m.getName() + "(");
for (int j = 0; j < sig.length; j++) {
out.print("$param_" + j);
if (j + 1 < sig.length) {
out.print(", ");
}
}
out.println(");");
out.print("try {");
ctrl.indent();
out.print("java.io.ObjectOutput out = call.getResultStream(true);");
if (returntype != Void.TYPE) {
out.println();
if (returntype == Boolean.TYPE) {
out.print("out.writeBoolean($result);");
}
else if (returntype == Byte.TYPE) {
out.print("out.writeByte($result);");
}
else if (returntype == Character.TYPE) {
out.print("out.writeChar($result);");
}
else if (returntype == Short.TYPE) {
out.print("out.writeShort($result);");
}
else if (returntype == Integer.TYPE) {
out.print("out.writeInt($result);");
}
else if (returntype == Long.TYPE) {
out.print("out.writeLong($result);");
}
else if (returntype == Float.TYPE) {
out.print("out.writeFloat($result);");
}
else if (returntype == Double.TYPE) {
out.print("out.writeDouble($result);");
}
else {
out.print("out.writeObject($result);");
}
}
ctrl.unindent();
out.println("}");
out.print("catch (java.io.IOException e) {");
ctrl.indent();
out.print("throw new java.rmi.MarshalException(\"error marshalling return\", e);");
ctrl.unindent();
out.println("}");
out.print("break;");
ctrl.unindent();
out.println("}");
out.println();
}
out.print("default:");
ctrl.indent();
out.print("throw new java.rmi.UnmarshalException(\"invalid method number\");");
ctrl.unindent();
out.print("}");
ctrl.unindent();
out.print("}");
ctrl.unindent();
out.println("}");
out.close();
}
private void compile(String name) throws Exception {
throw new Error ("Not implemented");
// Compiler comp = Compiler.getInstance();
// if (verbose) {
// System.out.println("[Compiling class " + name + "]");
// }
// comp.setDestination(destination);
// boolean result = comp.compile(name);
// if (result == false) {
// throw comp.getException();
// }
}
private static String getPrettyName(Class cls) {
StringBuffer str = new StringBuffer();
for (int count = 0;; count++) {
if (!cls.isArray()) {
str.append(cls.getName());
for (; count > 0; count--) {
str.append("[]");
}
return (str.toString());
}
cls = cls.getComponentType();
}
}
/**
* Sort exceptions so the most general go last.
*/
private Class[] sortExceptions(Class[] except) {
for (int i = 0; i < except.length; i++) {
for (int j = i+1; j < except.length; j++) {
if (except[i].isAssignableFrom(except[j])) {
Class tmp = except[i];
except[i] = except[j];
except[j] = tmp;
}
}
}
return (except);
}
/**
* Process the options until we find the first argument.
*/
private void parseOptions() {
for (;;) {
if (next >= args.length || args[next].charAt(0) != '-') {
break;
}
String arg = args[next];
next++;
if (arg.equals("-keep")) {
keep = true;
}
else if (arg.equals("-keepgenerated")) {
keep = true;
}
else if (arg.equals("-v1.1")) {
need11Stubs = true;
need12Stubs = false;
}
else if (arg.equals("-vcompat")) {
need11Stubs = true;
need12Stubs = true;
}
else if (arg.equals("-v1.2")) {
need11Stubs = false;
need12Stubs = true;
}
else if (arg.equals("-g")) {
}
else if (arg.equals("-depend")) {
}
else if (arg.equals("-nowarn")) {
}
else if (arg.equals("-verbose")) {
verbose = true;
}
else if (arg.equals("-nocompile")) {
compile = false;
}
else if (arg.equals("-classpath")) {
next++;
}
else if (arg.equals("-d")) {
destination = args[next];
next++;
}
else if (arg.charAt(1) == 'J') {
}
else {
System.err.println("Unknown option: " + arg);
}
}
}
private static void usage() {
System.out.println(
"usage: rmic [-options] classes\n" +
"Options are:\n" +
" -keep Don't delete any intermediate files\n" +
" -keepgenerated Same as -keep\n" +
" -v1.1 Java 1.1 style stubs only\n" +
" -vcompat Java 1.1 & Java 1.2 stubs\n" +
" -v1.2 Java 1.2 style stubs only\n" +
" -g * Generated debugging information\n" +
" -depend * Recompile out-of-date files\n" +
" -nowarn * Suppress warning messages\n" +
" -nocompile Don't compile the generated files\n" +
" -verbose Output what's going on\n" +
" -classpath <path> * Use given path as classpath\n" +
" -d <directory> Specify where to place generated classes\n" +
" -J<flag> * Pass flag to Java\n" +
" * Option currently ignored"
);
}
static class MethodRef
implements Comparable {
Method meth;
String sig;
long hash;
MethodRef(Method m) {
meth = m;
// We match on the name - but what about overloading? - XXX
sig = m.getName();
hash = RMIHashes.getMethodHash(m);
}
public int compareTo(Object obj) {
MethodRef that = (MethodRef)obj;
return (this.sig.compareTo(that.sig));
}
}
}

View file

@ -0,0 +1,90 @@
/*
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 gnu.java.rmi.rmic;
import java.io.FilterWriter;
import java.io.Writer;
import java.io.IOException;
public class TabbedWriter
extends FilterWriter {
private static final String defaultTabstring = " ";
private char[] tabstring;
private int tabs;
public TabbedWriter(Writer o) {
this(o, defaultTabstring);
}
public TabbedWriter(Writer o, String str) {
super(o);
tabs = 0;
tabstring = str.toCharArray();
}
public void write(int c) throws IOException {
out.write(c);
if (c == '\n') {
for (int i = 0; i < tabs; i++) {
out.write(tabstring, 0, tabstring.length);
}
}
}
public void write(char cbuf[], int off, int len) throws IOException {
for (int i = 0; i < len; i++) {
write((int)cbuf[i+off]);
}
}
public void write(String str, int off, int len) throws IOException {
write(str.toCharArray(), off, len);
}
public void unindent() throws IOException {
unindent(1);
}
public void unindent(int nr) throws IOException {
indent(-nr);
}
public void indent() throws IOException {
indent(1);
}
public void indent(int nr) throws IOException {
tabs += nr;
if (tabs < 0) {
tabs = 0;
}
write((int)'\n');
}
}

View file

@ -0,0 +1,53 @@
/*
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 gnu.java.rmi.server;
public interface ProtocolConstants {
final public static int PROTOCOL_HEADER = 0x4a524d49; // JRMI
final public static int PROTOCOL_VERSION = 2;
final public static int STREAM_PROTOCOL = 0x4b;
final public static int SINGLE_OP_PROTOCOL = 0x4c;
final public static int MULTIPLEX_PROTOCOL = 0x4d;
final public static int PROTOCOL_ACK = 0x4e;
final public static int PROTOCOL_NACK = 0x4f;
final public static int MESSAGE_CALL = 0x50;
final public static int MESSAGE_CALL_ACK = 0x51;
final public static int MESSAGE_PING = 0x52;
final public static int MESSAGE_PING_ACK = 0x53;
final public static int MESSAGE_DGCACK = 0x54;
final public static int RETURN_ACK = 0x01;
final public static int RETURN_NACK = 0x02;
final public static int DEFAULT_PROTOCOL = STREAM_PROTOCOL;
};

View file

@ -0,0 +1,49 @@
/*
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 gnu.java.rmi.server;
import java.rmi.server.RMISocketFactory;
import java.io.IOException;
import java.net.Socket;
import java.net.ServerSocket;
public class RMIDefaultSocketFactory
extends RMISocketFactory {
public RMIDefaultSocketFactory() {
}
public Socket createSocket(String host, int port) throws IOException {
return (new Socket(host, port));
}
public ServerSocket createServerSocket(int port) throws IOException {
return (new ServerSocket(port));
}
}

View file

@ -0,0 +1,45 @@
/*
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 gnu.java.rmi.server;
import java.lang.reflect.Method;
import java.lang.Class;
import gnu.java.security.provider.SHA;
public class RMIHashes
{
public static long getMethodHash(Method meth)
{
return meth.hashCode ();
}
public static long getInterfaceHash(Class clazz)
{
return clazz.hashCode ();
}
}

View file

@ -0,0 +1,65 @@
/*
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 gnu.java.rmi.server;
import java.io.ObjectStreamClass;
import java.io.ObjectInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
import java.net.MalformedURLException;
import java.rmi.server.RMIClassLoader;
public class RMIObjectInputStream
extends ObjectInputStream {
UnicastConnectionManager manager;
public RMIObjectInputStream(InputStream strm, UnicastConnectionManager man) throws IOException {
super(strm);
manager = man;
enableResolveObject(true);
}
protected Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
//System.out.println("Resolving class: " + desc.getName());
String annotation = (String)readObject();
if (annotation == null) {
return (super.resolveClass(desc));
}
else {
try {
return (RMIClassLoader.loadClass(new URL(annotation), desc.getName()));
}
catch (MalformedURLException _) {
throw new ClassNotFoundException(desc.getName());
}
}
}
}

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 gnu.java.rmi.server;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.IOException;
import java.rmi.server.RMIClassLoader;
public class RMIObjectOutputStream
extends ObjectOutputStream {
public RMIObjectOutputStream(OutputStream strm) throws IOException {
super(strm);
}
protected void annotateClass(Class cls) throws IOException {
//System.out.println("Annotating class: " + cls);
writeObject(RMIClassLoader.getClassAnnotation(cls));
}
}

View file

@ -0,0 +1,162 @@
/*
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 gnu.java.rmi.server;
import java.lang.Runnable;
import java.net.Socket;
import java.net.ServerSocket;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.IOException;
import java.rmi.RemoteException;
public class UnicastConnection
implements Runnable, ProtocolConstants {
UnicastConnectionManager manager;
Socket sock;
DataInputStream din;
DataOutputStream dout;
ObjectInputStream oin;
ObjectOutputStream oout;
UnicastConnection(UnicastConnectionManager man, Socket sock) {
this.manager = man;
this.sock = sock;
}
void acceptConnection() throws IOException {
//System.out.println("Accepting connection on " + lport);
din = new DataInputStream(sock.getInputStream());
dout = new DataOutputStream(sock.getOutputStream());
int sig = din.readInt();
if (sig != PROTOCOL_HEADER) {
throw new IOException("bad protocol header");
}
short ver = din.readShort();
if (ver != PROTOCOL_VERSION) {
throw new IOException("bad protocol version");
}
int protocol = din.readUnsignedByte();
if (protocol != SINGLE_OP_PROTOCOL) {
// Send an ACK
dout.writeByte(PROTOCOL_ACK);
// Send my hostname and port
dout.writeUTF(manager.serverName);
dout.writeInt(manager.serverPort);
// Read their hostname and port
String rhost = din.readUTF();
int rport = din.readInt();
}
// Okay, ready to roll ...
}
void makeConnection(int protocol) throws IOException {
dout = new DataOutputStream(sock.getOutputStream());
din = new DataInputStream(sock.getInputStream());
// Send header
dout.writeInt(PROTOCOL_HEADER);
dout.writeShort(PROTOCOL_VERSION);
dout.writeByte(protocol);
dout.flush();
if (protocol != SINGLE_OP_PROTOCOL) {
// Get back ack.
int ack = din.readUnsignedByte();
if (ack != PROTOCOL_ACK) {
throw new RemoteException("Unsupported protocol");
}
// Read in host and port
String dicard_rhost = din.readUTF();
int discard_rport = din.readInt();
// Send them my endpoint
dout.writeUTF(manager.serverName);
dout.writeInt(manager.serverPort);
}
// Okay, ready to roll ...
}
DataInputStream getDataInputStream() throws IOException {
return (din);
}
DataOutputStream getDataOutputStream() throws IOException {
return (dout);
}
ObjectInputStream getObjectInputStream() throws IOException {
if (oin == null) {
oin = new RMIObjectInputStream(din, manager);
}
return (oin);
}
ObjectOutputStream getObjectOutputStream() throws IOException {
if (oout == null) {
oout = new RMIObjectOutputStream(dout);
}
return (oout);
}
void disconnect() {
oin = null;
oout = null;
try {
sock.close();
}
catch (IOException _) {
}
din = null;
dout = null;
sock = null;
}
/**
* We run connects on the server. Dispatch it then discard it.
*/
public void run() {
try {
UnicastServer.dispatch(this);
manager.discardConnection(this);
}
catch (Exception e) {
e.printStackTrace();
}
}
}

View file

@ -0,0 +1,262 @@
/*
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 gnu.java.rmi.server;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.RemoteException;
import gnu.java.rmi.server.UnicastConnection;
import java.util.Hashtable;
import java.net.Socket;
import java.net.ServerSocket;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.lang.Thread;
import java.lang.Runnable;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class UnicastConnectionManager
implements Runnable, ProtocolConstants {
private static String localhost;
private static Hashtable servers = new Hashtable();
private Thread serverThread;
private ServerSocket ssock;
String serverName;
int serverPort;
private RMIServerSocketFactory serverFactory;
private RMIClientSocketFactory clientFactory;
static {
try {
localhost = InetAddress.getLocalHost().getHostName();
}
catch (UnknownHostException _) {
localhost = "localhost";
}
}
private UnicastConnectionManager(String host, int port, RMIClientSocketFactory csf) {
ssock = null;
serverName = host;
serverPort = port;
serverFactory = null;
clientFactory = csf;
}
private UnicastConnectionManager(int port, RMIServerSocketFactory ssf) {
try {
ssock = ssf.createServerSocket(port);
serverPort = ssock.getLocalPort();
}
catch (IOException _) {
try {
ssock = ssf.createServerSocket(0);
serverPort = ssock.getLocalPort();
}
catch (IOException __) {
ssock = null;
serverPort = 0;
}
}
serverName = localhost;
serverFactory = ssf;
clientFactory = null;
}
/**
* Return a client connection manager which will connect to the given
* host/port.
*/
public static synchronized UnicastConnectionManager getInstance(String host, int port, RMIClientSocketFactory csf) {
//System.out.println("getInstance: " + host + "," + port + "," + csf);
if (csf == null) {
csf = RMISocketFactory.getSocketFactory();
}
TripleKey key = new TripleKey(host, port, csf);
UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
if (man == null) {
man = new UnicastConnectionManager(host, port, csf);
servers.put(key, man);
}
return (man);
}
/**
* Return a server connection manager which will accept connection on the
* given port.
*/
public static synchronized UnicastConnectionManager getInstance(int port, RMIServerSocketFactory ssf) {
//System.out.println("getInstance: " + port + "," + ssf);
if (ssf == null) {
ssf = RMISocketFactory.getSocketFactory();
}
TripleKey key = new TripleKey(localhost, port, ssf);
UnicastConnectionManager man = (UnicastConnectionManager)servers.get(key);
if (man == null) {
man = new UnicastConnectionManager(port, ssf);
// The provided port might not be the set port.
key.port = man.serverPort;
servers.put(key, man);
}
return (man);
}
/**
* Get a connection from this manager.
*/
public UnicastConnection getConnection() throws IOException {
if (ssock == null) {
return (getClientConnection());
}
else {
return (getServerConnection());
}
}
/**
* Accept a connection to this server.
*/
private UnicastConnection getServerConnection() throws IOException {
Socket sock = ssock.accept();
UnicastConnection conn = new UnicastConnection(this, sock);
conn.acceptConnection();
//System.out.println("Server connection " + conn);
return (conn);
}
/**
* Make a conection from this client to the server.
*/
private UnicastConnection getClientConnection() throws IOException {
Socket sock = clientFactory.createSocket(serverName, serverPort);
UnicastConnection conn = new UnicastConnection(this, sock);
conn.makeConnection(DEFAULT_PROTOCOL);
//System.out.println("Client connection " + conn);
return (conn);
}
/**
* Discard a connection when we're done with it - maybe it can be
* recycled.
*/
public void discardConnection(UnicastConnection conn) {
//System.out.println("Discarding connection " + conn);
conn.disconnect();
}
/**
* Start a server on this manager if it's a server socket and we've not
* already got one running.
*/
public void startServer() {
synchronized(this) {
if (ssock == null || serverThread != null) {
return;
}
serverThread = new Thread(this);
}
serverThread.start();
}
/**
* Server thread for connection manager.
*/
public void run() {
for (;;) {
try {
//System.out.println("Waiting for connection on " + serverPort);
UnicastConnection conn = getServerConnection();
(new Thread(conn)).start();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* Serialization routine.
*/
void write(ObjectOutput out) throws IOException {
out.writeUTF(serverName);
out.writeInt(serverPort);
}
/**
* Serialization routine.
*/
static UnicastConnectionManager read(ObjectInput in) throws IOException {
String host = in.readUTF();
int port = in.readInt();
RMIClientSocketFactory csf = ((RMIObjectInputStream)in).manager.clientFactory;
return (getInstance(host, port, csf));
}
}
/**
* This is use as the hashkey for the client/server connections.
*/
class TripleKey {
String host;
int port;
Object other;
TripleKey(String host, int port, Object other) {
this.host = host;
this.port = port;
this.other = other;
}
/**
* Hash code just include the host and other - we ignore the port since
* this has unusual matching behaviour.
*/
public int hashCode() {
return (host.hashCode() ^ other.hashCode());
}
public boolean equals(Object obj) {
if (obj instanceof TripleKey) {
TripleKey other = (TripleKey)obj;
if (this.host.equals(other.host) &&
this.other == other.other &&
(this.port == other.port || this.port == 0 || other.port == 0)) {
return (true);
}
}
return (false);
}
}

View file

@ -0,0 +1,219 @@
/*
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 gnu.java.rmi.server;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.RemoteRef;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RemoteObject;
import java.rmi.server.RemoteCall;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.Operation;
import java.rmi.server.ObjID;
import java.rmi.server.UID;
import java.lang.reflect.Method;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.IOException;
import java.net.Socket;
import java.net.InetAddress;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
public class UnicastRef
implements RemoteRef, ProtocolConstants {
public ObjID objid;
UnicastConnectionManager manager;
/**
* Used by serialization.
*/
private UnicastRef() {
}
public UnicastRef(ObjID objid, String host, int port, RMIClientSocketFactory csf) {
this(objid);
manager = UnicastConnectionManager.getInstance(host, port, csf);
}
public UnicastRef(ObjID objid) {
this.objid = objid;
}
public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception {
return (invokeCommon(obj, method, params, -1, opnum));
}
private Object invokeCommon(Remote obj, Method method, Object[] params, int opnum, long hash) throws Exception {
UnicastConnection conn;
try {
conn = manager.getConnection();
}
catch (IOException e1) {
throw new RemoteException("connection failed to host: " + manager.serverName, e1);
}
ObjectOutputStream out;
DataOutputStream dout;
try {
dout = conn.getDataOutputStream();
dout.writeByte(MESSAGE_CALL);
out = conn.getObjectOutputStream();
objid.write(out);
out.writeInt(opnum);
out.writeLong(hash);
if (params != null) {
for (int i = 0; i < params.length; i++) {
if (params[i] instanceof UnicastRemoteObject) {
out.writeObject(UnicastRemoteObject.exportObject((UnicastRemoteObject)params[i]));
}
else {
out.writeObject(params[i]);
}
}
}
out.flush();
}
catch (IOException e2) {
throw new RemoteException("call failed: ", e2);
}
int returncode;
Object returnval;
DataInputStream din;
ObjectInputStream in;
UID ack;
try {
din = conn.getDataInputStream();
if (din.readUnsignedByte() != MESSAGE_CALL_ACK) {
throw new RemoteException("Call not acked");
}
in = conn.getObjectInputStream();
returncode = in.readUnsignedByte();
ack = UID.read(in);
returnval = in.readObject();
}
catch (IOException e3) {
throw new RemoteException("call return failed: ", e3);
}
manager.discardConnection(conn);
if (returncode != RETURN_ACK) {
throw (Exception)returnval;
}
return (returnval);
}
/**
* @deprecated
*/
public RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException {
return (new UnicastRemoteCall(obj, opnum, hash));
}
/**
* @deprecated
*/
public void invoke(RemoteCall call) throws Exception {
UnicastRemoteCall c = (UnicastRemoteCall)call;
Object ret = invokeCommon((Remote)c.getObject(), (Method)null, c.getArguments(), c.getOpnum(), c.getHash());
c.setReturnValue(ret);
}
/**
* @deprecated
*/
public void done(RemoteCall call) throws RemoteException {
/* Does nothing */
}
public void writeExternal(ObjectOutput out) throws IOException {
if (manager == null) {
throw new IOException("no connection");
}
manager.write(out);
objid.write(out);
out.writeByte(RETURN_ACK);
}
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
manager = UnicastConnectionManager.read(in);
objid = ObjID.read(in);
if (in.readByte() != RETURN_ACK) {
throw new IOException("no ack found");
}
}
public boolean remoteEquals(RemoteRef ref) {
throw new Error("Not implemented");
}
public int remoteHashCode() {
throw new Error("Not implemented");
}
public String getRefClass(ObjectOutput out) {
return ("UnicastRef");
}
public String remoteToString() {
throw new Error("Not implemented");
}
public void dump(UnicastConnection conn) {
try {
DataInputStream din = conn.getDataInputStream();
for (;;) {
int b = din.readUnsignedByte();
System.out.print(Integer.toHexString(b));
if (b >= 32 && b < 128) {
System.out.print(": " + (char)b);
}
System.out.println();
}
}
catch (IOException _) {
}
}
}

View file

@ -0,0 +1,301 @@
/*
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 gnu.java.rmi.server;
import java.lang.Exception;
import java.io.IOException;
import java.io.ObjectOutput;
import java.io.ObjectInput;
import java.io.StreamCorruptedException;
import java.rmi.server.RemoteCall;
import java.util.Vector;
public class UnicastRemoteCall
implements RemoteCall {
private UnicastConnection conn;
private Object result;
private Object object;
private int opnum;
private long hash;
private Vector vec;
private int ptr;
/**
* Incoming call.
*/
UnicastRemoteCall(UnicastConnection conn) {
this.conn = conn;
}
/**
* Outgoing call.
*/
UnicastRemoteCall(Object obj, int opnum, long hash) {
this.object = obj;
this.opnum = opnum;
this.hash = hash;
}
public ObjectOutput getOutputStream() throws IOException {
vec = new Vector();
return (new DummyObjectOutputStream());
}
public void releaseOutputStream() throws IOException {
// Does nothing.
}
public ObjectInput getInputStream() throws IOException {
if (conn != null) {
return (conn.getObjectInputStream());
}
else {
ptr = 0;
return (new DummyObjectInputStream());
}
}
public void releaseInputStream() throws IOException {
// Does nothing.
}
public ObjectOutput getResultStream(boolean success) throws IOException, StreamCorruptedException {
vec = new Vector();
return (new DummyObjectOutputStream());
}
public void executeCall() throws Exception {
throw new Error("Not implemented");
}
public void done() throws IOException {
/* Does nothing */
}
Object returnValue() {
return (vec.elementAt(0));
}
Object[] getArguments() {
return (vec.toArray());
}
Object getObject() {
return (object);
}
int getOpnum() {
return (opnum);
}
long getHash() {
return (hash);
}
void setReturnValue(Object obj) {
vec.removeAllElements();
vec.addElement(obj);
}
/**
* Dummy object output class.
*/
private class DummyObjectOutputStream implements ObjectOutput {
public void writeBoolean(boolean v) throws IOException {
vec.addElement(new Boolean(v));
}
public void writeByte(int v) throws IOException {
vec.addElement(new Byte((byte)v));
}
public void writeChar(int v) throws IOException {
vec.addElement(new Character((char)v));
}
public void writeDouble(double v) throws IOException {
vec.addElement(new Double(v));
}
public void writeFloat(float v) throws IOException {
vec.addElement(new Float(v));
}
public void writeInt(int v) throws IOException {
vec.addElement(new Integer(v));
}
public void writeLong(long v) throws IOException {
vec.addElement(new Long(v));
}
public void writeShort(int v) throws IOException {
vec.addElement(new Short((short)v));
}
public void writeObject(Object obj) throws IOException {
vec.addElement(obj);
}
public void write(byte b[]) throws IOException {
throw new IOException("not required");
}
public void write(byte b[], int off, int len) throws IOException {
throw new IOException("not required");
}
public void write(int b) throws IOException {
throw new IOException("not required");
}
public void writeBytes(String s) throws IOException {
throw new IOException("not required");
}
public void writeChars(String s) throws IOException {
throw new IOException("not required");
}
public void writeUTF(String str) throws IOException {
throw new IOException("not required");
}
public void flush() throws IOException {
}
public void close() throws IOException {
}
}
/**
* Dummy object input class.
*/
private class DummyObjectInputStream implements ObjectInput {
public boolean readBoolean() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Boolean)obj).booleanValue());
}
public byte readByte() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Byte)obj).byteValue());
}
public char readChar() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Character)obj).charValue());
}
public double readDouble() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Double)obj).doubleValue());
}
public float readFloat() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Float)obj).floatValue());
}
public int readInt() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Integer)obj).intValue());
}
public long readLong() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Long)obj).longValue());
}
public short readShort() throws IOException {
Object obj = vec.elementAt(ptr++);
return (((Short)obj).shortValue());
}
public Object readObject() throws IOException {
return (vec.elementAt(ptr++));
}
public int read(byte b[]) throws IOException {
throw new IOException("not required");
}
public int read(byte b[], int off, int len) throws IOException {
throw new IOException("not required");
}
public int read() throws IOException {
throw new IOException("not required");
}
public long skip(long n) throws IOException {
throw new IOException("not required");
}
public int available() throws IOException {
throw new IOException("not required");
}
public void readFully(byte b[]) throws IOException {
throw new IOException("not required");
}
public void readFully(byte b[], int off, int len) throws IOException {
throw new IOException("not required");
}
public String readLine() throws IOException {
throw new IOException("not required");
}
public String readUTF() throws IOException {
throw new IOException("not required");
}
public int readUnsignedByte() throws IOException {
throw new IOException("not required");
}
public int readUnsignedShort() throws IOException {
throw new IOException("not required");
}
public int skipBytes(int n) throws IOException {
throw new IOException("not required");
}
public void close() throws IOException {
}
}
}

View file

@ -0,0 +1,40 @@
/*
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 gnu.java.rmi.server;
import java.rmi.server.RemoteStub;
import java.rmi.server.RemoteRef;
public class UnicastRemoteStub
extends RemoteStub {
public static void setStubRef(RemoteStub stub, RemoteRef ref) {
setRef(stub, ref);
}
}

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 gnu.java.rmi.server;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Hashtable;
import java.net.UnknownHostException;
import java.rmi.server.ObjID;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.UID;
import java.rmi.server.RemoteRef;
import java.rmi.RemoteException;
import java.rmi.NoSuchObjectException;
import gnu.java.rmi.dgc.DGCImpl;
public class UnicastServer
implements ProtocolConstants {
static private Hashtable objects = new Hashtable();
static private DGCImpl dgc;
public static void exportObject(UnicastServerRef obj) {
startDGC();
objects.put(obj.objid, obj);
obj.manager.startServer();
}
private static synchronized void startDGC() {
if (dgc == null) {
try {
dgc = new DGCImpl();
((UnicastServerRef)dgc.getRef()).exportObject(dgc);
}
catch (RemoteException e) {
e.printStackTrace();
}
}
}
public static void dispatch(UnicastConnection conn) throws Exception {
switch (conn.getDataInputStream().readUnsignedByte()) {
case MESSAGE_CALL:
incomingMessageCall(conn);
break;
default:
throw new Exception("bad method type");
}
}
private static void incomingMessageCall(UnicastConnection conn) throws IOException {
ObjectInputStream in = conn.getObjectInputStream();
ObjID objid = ObjID.read(in);
int method = in.readInt();
long hash = in.readLong();
//System.out.println("ObjID: " + objid + ", method: " + method + ", hash: " + hash);
// Use the objid to locate the relevant UnicastServerRef
UnicastServerRef uref = (UnicastServerRef)objects.get(objid);
Object returnval;
int returncode = RETURN_ACK;
if (uref != null) {
try {
// Dispatch the call to it.
returnval = uref.incomingMessageCall(conn, method, hash);
}
catch (Exception e) {
returnval = e;
returncode = RETURN_NACK;
}
}
else {
returnval = new NoSuchObjectException("");
returncode = RETURN_NACK;
}
conn.getDataOutputStream().writeByte(MESSAGE_CALL_ACK);
ObjectOutputStream out = conn.getObjectOutputStream();
out.writeByte(returncode);
(new UID()).write(out);
out.writeObject(returnval);
out.flush();
}
}

View file

@ -0,0 +1,198 @@
/*
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 gnu.java.rmi.server;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.RemoteStub;
import java.rmi.server.ObjID;
import java.rmi.server.ServerRef;
import java.rmi.server.RemoteRef;
import java.rmi.server.ServerNotActiveException;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.UID;
import java.rmi.server.Skeleton;
import java.rmi.server.RemoteCall;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
import java.lang.Thread;
import java.lang.Exception;
import java.io.IOException;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Hashtable;
public class UnicastServerRef
extends UnicastRef {
final static private Class[] stubprototype = new Class[] { RemoteRef.class };
Remote myself;
private Skeleton skel;
private RemoteStub stub;
private Hashtable methods;
public UnicastServerRef(ObjID id, int port, RMIServerSocketFactory ssf) {
super(id);
manager = UnicastConnectionManager.getInstance(port, ssf);
}
public RemoteStub exportObject(Remote obj) throws RemoteException {
if (myself == null) {
myself = obj;
// Find and install the stub
Class cls = obj.getClass();
stub = (RemoteStub)getHelperClass(cls, "_Stub");
if (stub == null) {
throw new RemoteException("failed to export: " + cls);
}
// Find and install the skeleton (if there is one)
skel = (Skeleton)getHelperClass(cls, "_Skel");
// Build hash of methods which may be called.
buildMethodHash(obj.getClass());
// Export it.
UnicastServer.exportObject(this);
}
return (stub);
}
private Object getHelperClass(Class cls, String type) {
try {
String classname = cls.getName();
Class scls = Class.forName(classname + type);
if (type.equals("_Stub")) {
try {
// JDK 1.2 stubs
Constructor con = scls.getConstructor(stubprototype);
return (con.newInstance(new Object[]{this}));
}
catch (NoSuchMethodException e) {
}
catch (InstantiationException e) {
}
catch (IllegalAccessException e) {
}
catch (IllegalArgumentException e) {
}
catch (InvocationTargetException e) {
}
// JDK 1.1 stubs
RemoteStub stub = (RemoteStub)scls.newInstance();
UnicastRemoteStub.setStubRef(stub, this);
return (stub);
}
else {
// JDK 1.1 skel
return (scls.newInstance());
}
}
catch (ClassNotFoundException e) {
}
catch (InstantiationException e) {
}
catch (IllegalAccessException e) {
}
return (null);
}
public String getClientHost() throws ServerNotActiveException {
throw new Error("Not implemented");
}
private void buildMethodHash(Class cls) {
methods = new Hashtable();
Method[] meths = cls.getMethods();
for (int i = 0; i < meths.length; i++) {
/* Don't need to include any java.xxx related stuff */
if (meths[i].getDeclaringClass().getName().startsWith("java.")) {
continue;
}
long hash = RMIHashes.getMethodHash(meths[i]);
methods.put(new Long (hash), meths[i]);
//System.out.println("meth = " + meths[i] + ", hash = " + hash);
}
}
public Object incomingMessageCall(UnicastConnection conn, int method, long hash) throws Exception {
//System.out.println("method = " + method + ", hash = " + hash);
// If method is -1 then this is JDK 1.2 RMI - so use the hash
// to locate the method
if (method == -1) {
Method meth = (Method)methods.get(new Long (hash));
//System.out.println("class = " + myself.getClass() + ", meth = " + meth);
if (meth == null) {
throw new NoSuchMethodException();
}
ObjectInputStream in = conn.getObjectInputStream();
int nrargs = meth.getParameterTypes().length;
Object[] args = new Object[nrargs];
for (int i = 0; i < nrargs; i++) {
/**
* For debugging purposes - we don't handle CodeBases
* quite right so we don't always find the stubs. This
* lets us know that.
*/
try {
args[i] = in.readObject();
}
catch (Exception t) {
t.printStackTrace();
throw t;
}
}
return (meth.invoke(myself, args));
}
// Otherwise this is JDK 1.1 style RMI - we find the skeleton
// and invoke it using the method number. We wrap up our
// connection system in a UnicastRemoteCall so it appears in a
// way the Skeleton can handle.
else {
if (skel == null) {
throw new NoSuchMethodException();
}
UnicastRemoteCall call = new UnicastRemoteCall(conn);
skel.dispatch(myself, call, method, hash);
return (call.returnValue());
}
}
}

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;
public class AccessException
extends RemoteException {
public static final long serialVersionUID = 6314925228044966088l;
public AccessException(String s) {
super(s);
}
public AccessException(String s, Exception e) {
super (s, e);
}
}

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;
public class AlreadyBoundException
extends Exception {
public AlreadyBoundException() {
super();
}
public AlreadyBoundException(String s) {
super (s);
}
}

View file

@ -0,0 +1,42 @@
/*
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;
public class ConnectException
extends RemoteException {
public ConnectException(String s) {
super(s);
}
public ConnectException(String s, Exception e) {
super (s, e);
}
}

View file

@ -0,0 +1,42 @@
/*
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;
public class ConnectIOException
extends RemoteException {
public ConnectIOException(String s) {
super(s);
}
public ConnectIOException(String s, Exception e) {
super (s, e);
}
}

View file

@ -0,0 +1,42 @@
/*
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;
public class MarshalException
extends RemoteException {
public MarshalException(String s) {
super(s);
}
public MarshalException(String s, Exception e) {
super (s, e);
}
}

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;
import java.io.Serializable;
public final class MarshalledObject
extends Object implements Serializable {
public MarshalledObject(Object obj) {
throw new Error("Not implemented");
}
public boolean equals(Object obj) {
throw new Error("Not implemented");
}
public Object get() {
throw new Error("Not implemented");
}
public int hashCode() {
throw new Error("Not implemented");
}
}

View file

@ -0,0 +1,70 @@
/*
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;
import java.net.MalformedURLException;
import java.net.URL;
import java.rmi.registry.Registry;
import java.rmi.registry.LocateRegistry;
public final class Naming {
public static Remote lookup(String name) throws NotBoundException, MalformedURLException, RemoteException {
URL u = new URL("http:" + name);
return (getRegistry(u).lookup(u.getFile().substring(1)));
}
public static void bind(String name, Remote obj) throws AlreadyBoundException, MalformedURLException, RemoteException {
URL u = new URL("http:" + name);
getRegistry(u).bind(u.getFile().substring(1), obj);
}
public static void unbind(String name) throws RemoteException, NotBoundException, MalformedURLException {
URL u = new URL("http:" + name);
getRegistry(u).unbind(u.getFile().substring(1));
}
public static void rebind(String name, Remote obj) throws RemoteException, MalformedURLException {
URL u = new URL("http:" + name);
getRegistry(u).rebind(u.getFile().substring(1), obj);
}
public static String[] list(String name) throws RemoteException, MalformedURLException {
return (getRegistry(new URL("http:" + name)).list());
}
private static Registry getRegistry(URL u) throws RemoteException {
if (u.getPort() == -1) {
return (LocateRegistry.getRegistry(u.getHost()));
}
else {
return (LocateRegistry.getRegistry(u.getHost(), u.getPort()));
}
}
}

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;
public class NoSuchObjectException
extends RemoteException {
public static final long serialVersionUID = 6619395951570472985L;
public NoSuchObjectException(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;
public class NotBoundException
extends Exception {
public static final long serialVersionUID = -1857741824849069317l;
public NotBoundException() {
super();
}
public NotBoundException(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;
import java.lang.SecurityException;
public class RMISecurityException
extends SecurityException {
public RMISecurityException(String n) {
super(n);
}
public RMISecurityException(String n, String a) {
super(n);
}
}

View file

@ -0,0 +1,139 @@
/*
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;
import java.io.FileDescriptor;
import java.lang.Thread;
import java.lang.Class;
import java.lang.SecurityManager;
import java.net.InetAddress;
import java.security.Permission;
public class RMISecurityManager extends SecurityManager {
public RMISecurityManager() {
}
public void checkAccept(String host, int port) {
}
public void checkAccess(Thread g) {
}
public void checkAccess(ThreadGroup g) {
}
public void checkAwtEventQueueAccess() {
}
public void checkConnect(String host, int port) {
}
public void checkConnect(String host, int port, Object context) {
}
public void checkCreateClassLoader() {
}
public void checkDelete(String file) {
}
public void checkExec(String cmd) {
}
public void checkExit(int status) {
}
public void checkLink(String lib) {
}
public void checkListen(int port) {
}
public void checkMemberAccess ( Class clazz, int which ) {
}
public void checkMulticast(InetAddress maddr) {
}
public void checkMulticast(InetAddress maddr, byte ttl) {
}
public void checkPackageAccess(String pkg) {
}
public void checkPackageDefinition(String pkg) {
}
public void checkPermission(Permission perm) {
}
public void checkPermission(Permission perm, Object context) {
}
public void checkPrintJobAccess() {
}
public void checkPropertiesAccess() {
}
public void checkPropertyAccess(String key) {
}
/* public void checkPropertyAccess(String key, String def) {
}*/
public void checkRead(FileDescriptor fd) {
}
public void checkRead(String file) {
}
public void checkRead(String file, Object context) {
}
public void checkSecurityAccess(String action) {
}
public void checkSetFactory() {
}
public void checkSystemClipboardAccess() {
}
public boolean checkTopLevelWindow(Object window) {
return (true);
}
public void checkWrite(FileDescriptor fd) {
}
public void checkWrite(String file) {
}
}

View file

@ -0,0 +1,31 @@
/*
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;
public interface Remote {
}

View file

@ -0,0 +1,85 @@
/*
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;
import java.lang.Throwable;
import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
public class RemoteException
extends IOException {
public static final long serialVersionUID = -5148567311918794206l;
public Throwable detail;
public RemoteException() {
super();
detail = null;
}
public RemoteException(String s) {
super(s);
detail = null;
}
public RemoteException(String s, Throwable e) {
super(s);
detail = e;
}
public String getMessage() {
if (detail == null) {
return (super.getMessage());
}
else {
return (super.getMessage() + "; nested exception is: " + detail.getMessage());
}
}
public void printStackTrace(PrintStream s) {
if (detail != null) {
detail.printStackTrace(s);
}
super.printStackTrace(s);
}
public void printStackTrace(PrintWriter s) {
if (detail != null) {
detail.printStackTrace(s);
}
super.printStackTrace(s);
}
public void printStackTrace() {
printStackTrace(System.err);
}
}

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;
public class ServerError
extends RemoteException {
public ServerError(String s, Error 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;
public class ServerException
extends RemoteException {
public static final long serialVersionUID = -4775845313121906682l;
public ServerException(String s) {
super(s);
}
public ServerException(String s, Exception e) {
super(s, e);
}
}

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;
public class ServerRuntimeException
extends RemoteException {
public ServerRuntimeException(String s, Exception e) {
super(s, e);
}
}

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;
public class StubNotFoundException
extends RemoteException {
public StubNotFoundException(String s) {
super(s);
}
public StubNotFoundException(String s, Exception e) {
super(s, e);
}
}

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;
public class UnexpectedException
extends RemoteException {
public UnexpectedException(String s) {
super(s);
}
public UnexpectedException(String s, Exception e) {
super(s, e);
}
}

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;
public class UnknownHostException
extends RemoteException {
public UnknownHostException(String s) {
super(s);
}
public UnknownHostException(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;
public class UnmarshalException
extends RemoteException {
public static final long serialVersionUID = 594380845140740218l;
public UnmarshalException(String s) {
super(s);
}
public UnmarshalException(String s, Exception e) {
super(s, e);
}
}

View file

@ -0,0 +1,93 @@
/*
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.activation;
import java.rmi.server.RemoteServer;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.RemoteException;
import java.rmi.Remote;
import java.rmi.NoSuchObjectException;
import java.rmi.MarshalledObject;
public abstract class Activatable
extends RemoteServer {
protected Activatable(String location, MarshalledObject data, boolean restart, int port) throws ActivationException, RemoteException {
throw new Error("Not implemented");
}
protected Activatable(String location, MarshalledObject data, boolean restart, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws ActivationException, RemoteException {
throw new Error("Not implemented");
}
protected Activatable(ActivationID id, int port) throws RemoteException {
throw new Error("Not implemented");
}
protected Activatable(ActivationID id, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
throw new Error("Not implemented");
}
protected ActivationID getID() {
throw new Error("Not implemented");
}
public static Remote register(ActivationDesc desc) throws UnknownGroupException, ActivationException, RemoteException {
throw new Error("Not implemented");
}
public static boolean inactive(ActivationID id) throws UnknownObjectException, ActivationException, RemoteException {
throw new Error("Not implemented");
}
public static void unregister(ActivationID id) throws UnknownObjectException, ActivationException, RemoteException {
throw new Error("Not implemented");
}
public static ActivationID exportObject(Remote obj, String location, MarshalledObject data, boolean restart, int port) throws ActivationException, RemoteException {
throw new Error("Not implemented");
}
public static ActivationID exportObject(Remote obj, String location, MarshalledObject data, boolean restart, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws ActivationException, RemoteException {
throw new Error("Not implemented");
}
public static Remote exportObject(Remote obj, ActivationID id, int port) throws RemoteException {
throw new Error("Not implemented");
}
public static Remote exportObject(Remote obj, ActivationID id, int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
throw new Error("Not implemented");
}
public static boolean unexportObject(Remote obj, boolean force) throws NoSuchObjectException {
throw new Error("Not implemented");
}
}

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.activation;
import java.rmi.RemoteException;
public class ActivateFailedException
extends RemoteException {
public ActivateFailedException(String s) {
super(s);
}
public ActivateFailedException(String s, Exception ex) {
super(s, ex);
}
}

View file

@ -0,0 +1,102 @@
/*
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.activation;
import java.io.Serializable;
import java.rmi.MarshalledObject;
public final class ActivationDesc
implements Serializable {
private ActivationGroupID groupid;
private String classname;
private String location;
private MarshalledObject data;
private boolean restart;
public ActivationDesc(String className, String location, MarshalledObject data) throws ActivationException {
this(ActivationGroup.currentGroupID(), className, location, data, false);
}
public ActivationDesc(String className, String location, MarshalledObject data, boolean restart) throws ActivationException {
this(ActivationGroup.currentGroupID(), className, location, data, restart);
}
public ActivationDesc(ActivationGroupID groupID, String className, String location, MarshalledObject data) {
this(groupID, className, location, data, false);
}
public ActivationDesc(ActivationGroupID groupID, String className, String location, MarshalledObject data, boolean restart) {
this.groupid = groupID;
this.classname = className;
this.location = location;
this.data = data;
this.restart = restart;
}
public ActivationGroupID getGroupID() {
return (groupid);
}
public String getClassName() {
return (classname);
}
public String getLocation() {
return (location);
}
public MarshalledObject getData() {
return (data);
}
public boolean getRestartMode() {
return (restart);
}
public boolean equals(Object obj) {
if (!(obj instanceof ActivationDesc)) {
return (false);
}
ActivationDesc that = (ActivationDesc)obj;
if (this.groupid.equals(that.groupid) &&
this.classname.equals(that.classname) &&
this.location.equals(that.location) &&
this.data.equals(that.data) &&
this.restart == that.restart) {
return (true);
}
return (false);
}
public int hashCode() {
return (groupid.hashCode() ^ classname.hashCode() ^ location.hashCode() ^ data.hashCode());
}
}

View file

@ -0,0 +1,78 @@
/*
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.activation;
import java.io.PrintStream;
import java.io.PrintWriter;
public class ActivationException
extends Exception {
public Throwable detail;
public ActivationException() {
super();
}
public ActivationException(String s) {
super(s);
}
public ActivationException(String s, Throwable ex) {
super(s);
detail = ex;
}
public String getMessage() {
if (detail == null) {
return (super.getMessage());
}
else {
return (super.getMessage() + ":" + detail.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,73 @@
/*
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.activation;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.RemoteException;
import java.rmi.Remote;
import java.rmi.MarshalledObject;
public abstract class ActivationGroup
extends UnicastRemoteObject
implements ActivationInstantiator {
protected ActivationGroup(ActivationGroupID groupID) throws RemoteException {
throw new Error("Not implemented");
}
public boolean inactiveObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException {
throw new Error("Not implemented");
}
public abstract void activeObject(ActivationID id, Remote obj) throws ActivationException, UnknownObjectException, RemoteException;
public static ActivationGroup createGroup(ActivationGroupID id, ActivationGroupDesc desc, long incarnation) throws ActivationException {
throw new Error("Not implemented");
}
public static ActivationGroupID currentGroupID() {
throw new Error("Not implemented");
}
public static void setSystem(ActivationSystem system) throws ActivationException {
throw new Error("Not implemented");
}
public static ActivationSystem getSystem() throws ActivationException {
throw new Error("Not implemented");
}
protected void activeObject(ActivationID id, MarshalledObject mobj) throws ActivationException, UnknownObjectException, RemoteException {
throw new Error("Not implemented");
}
protected void inactiveGroup() throws UnknownGroupException, RemoteException {
throw new Error("Not implemented");
}
}

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.activation;
import java.io.Serializable;
import java.util.Properties;
import java.rmi.MarshalledObject;
public final class ActivationGroupDesc
implements Serializable {
public static class CommandEnvironment
implements Serializable {
private String cmdpath;
private String[] argv;
public CommandEnvironment(String cmdpath, String[] argv) {
this.cmdpath = cmdpath;
this.argv = argv;
}
public String getCommandPath() {
return (cmdpath);
}
public String[] getCommandOptions() {
return (argv);
}
public boolean equals(Object obj) {
if (!(obj instanceof CommandEnvironment)) {
return (false);
}
CommandEnvironment that = (CommandEnvironment)obj;
if (!this.cmdpath.equals(that.cmdpath)) {
return (false);
}
int len = this.argv.length;
if (len != that.argv.length) {
return (false);
}
for (int i = 0; i < len; i++) {
if (!this.argv[i].equals(that.argv[i])) {
return (false);
}
}
return (true);
}
public int hashCode() {
return (cmdpath.hashCode()); // Not a very good hash code.
}
}
public ActivationGroupDesc(Properties overrides, ActivationGroupDesc.CommandEnvironment cmd) {
throw new Error("Not implemented");
}
public ActivationGroupDesc(String className, String location, MarshalledObject data, Properties overrides, ActivationGroupDesc.CommandEnvironment cmd) {
throw new Error("Not implemented");
}
public String getClassName() {
throw new Error("Not implemented");
}
public String getLocation() {
throw new Error("Not implemented");
}
public MarshalledObject getData() {
throw new Error("Not implemented");
}
public Properties getPropertyOverrides() {
throw new Error("Not implemented");
}
public ActivationGroupDesc.CommandEnvironment getCommandEnvironment() {
throw new Error("Not implemented");
}
public boolean equals(Object obj) {
throw new Error("Not implemented");
}
public int hashCode() {
throw new Error("Not implemented");
}
}

View file

@ -0,0 +1,59 @@
/*
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.activation;
import java.io.Serializable;
public class ActivationGroupID
implements Serializable {
private ActivationSystem system;
public ActivationGroupID(ActivationSystem system) {
this.system = system;
}
public ActivationSystem getSystem() {
return (system);
}
public int hashCode() {
return (system.hashCode());
}
public boolean equals(Object obj) {
if (obj instanceof ActivationGroupID) {
ActivationGroupID that = (ActivationGroupID)obj;
if (this.system.equals(that.system)) {
return (true);
}
}
return (false);
}
}

View file

@ -0,0 +1,61 @@
/*
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.activation;
import java.io.Serializable;
import java.rmi.Remote;
import java.rmi.RemoteException;
public class ActivationID
implements Serializable {
private Activator activator;
public ActivationID(Activator activator) {
this.activator = activator;
}
public Remote activate(boolean force) throws ActivationException, UnknownObjectException, RemoteException {
throw new Error("Not implemented");
}
public int hashCode() {
return (activator.hashCode());
}
public boolean equals(Object obj) {
if (obj instanceof ActivationID) {
ActivationID that = (ActivationID)obj;
if (this.activator.equals(that.activator)) {
return (true);
}
}
return (false);
}
}

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.activation;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.MarshalledObject;
public interface ActivationInstantiator
extends Remote {
public MarshalledObject newInstance(ActivationID id, ActivationDesc desc) throws ActivationException, RemoteException;
}

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.activation;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.MarshalledObject;
public interface ActivationMonitor
extends Remote {
public void inactiveObject(ActivationID id) throws UnknownObjectException, RemoteException;
public void activeObject(ActivationID id, MarshalledObject obj) throws UnknownObjectException, RemoteException;
public void inactiveGroup(ActivationGroupID id, long incarnation) throws UnknownGroupException, RemoteException;
}

View file

@ -0,0 +1,49 @@
/*
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.activation;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ActivationSystem
extends Remote {
public static final int SYSTEM_PORT = 0; // XXX
public ActivationID registerObject(ActivationDesc desc) throws ActivationException, UnknownGroupException, RemoteException;
public void unregisterObject(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException;
public ActivationGroupID registerGroup(ActivationGroupDesc desc) throws ActivationException, RemoteException;
public ActivationMonitor activeGroup(ActivationGroupID id, ActivationInstantiator group, long incarnation) throws UnknownGroupException, ActivationException, RemoteException;
public void unregisterGroup(ActivationGroupID id) throws ActivationException, UnknownGroupException, RemoteException;
public void shutdown() throws RemoteException;
public ActivationDesc setActivationDesc(ActivationID id, ActivationDesc desc) throws ActivationException, UnknownObjectException, UnknownGroupException, RemoteException;
public ActivationGroupDesc setActivationGroupDesc(ActivationGroupID id, ActivationGroupDesc desc) throws ActivationException, UnknownGroupException, RemoteException;
public ActivationDesc getActivationDesc(ActivationID id) throws ActivationException, UnknownObjectException, RemoteException;
public ActivationGroupDesc getActivationGroupDesc(ActivationGroupID id) throws ActivationException, UnknownGroupException, RemoteException;
}

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.activation;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.MarshalledObject;
public interface Activator
extends Remote {
public MarshalledObject activate(ActivationID id, boolean force) throws ActivationException, UnknownObjectException, RemoteException;
}

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.activation;
public class UnknownGroupException
extends ActivationException {
public UnknownGroupException(String s) {
super(s);
}
}

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.activation;
public class UnknownObjectException
extends ActivationException {
public UnknownObjectException(String s) {
super(s);
}
}

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.dgc;
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.rmi.server.ObjID;
public interface DGC
extends Remote {
public Lease dirty(ObjID[] ids, long sequenceNum, Lease lease) throws RemoteException;
public void clean(ObjID[] ids, long sequenceNum, VMID vmid, boolean strong) throws RemoteException;
}

View file

@ -0,0 +1,58 @@
/*
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.dgc;
import java.io.Serializable;
import java.rmi.dgc.VMID;
public final class Lease
implements Serializable {
static final long serialVersionUID = -5713411624328831948L;
private VMID vmid;
private long value;
public Lease(VMID id, long duration) {
vmid = id;
value = duration;
}
public VMID getVMID() {
return (vmid);
}
public long getValue() {
return (value);
}
public String toString() {
return ("[" + vmid.toString() + ", " + Long.toString(value) + "]");
}
}

View file

@ -0,0 +1,106 @@
/*
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.dgc;
import java.io.Serializable;
import java.rmi.server.UID;
import java.net.InetAddress;
import java.net.UnknownHostException;
public final class VMID
implements Serializable {
static final long serialVersionUID = -538642295484486218L;
static final boolean areWeUnique;
static byte[] localAddr;
private byte[] addr;
private UID uid;
static {
byte[] addr;
boolean awu = true;
try {
addr = InetAddress.getLocalHost().getAddress();
if (addr[0] == 127 && addr[1] == 0 && addr[2] == 0 && addr[3] == 1) {
awu = false;
}
}
catch (UnknownHostException _) {
addr = new byte[]{ 127, 0, 0, 1 };
awu = false;
}
localAddr = addr;
areWeUnique = awu;
}
public VMID() {
addr = localAddr;
uid = new UID();
}
public static boolean isUnique() {
return (areWeUnique);
}
public int hashCode() {
return (super.hashCode());
}
public boolean equals(Object obj) {
if (!(obj instanceof VMID)) {
return (false);
}
VMID other = (VMID)obj;
if (addr.length != other.addr.length) {
return (false);
}
for (int i = addr.length - 1; i >= 0; i--) {
if (addr[i] != other.addr[i]) {
return (false);
}
}
return (uid.equals(other.uid));
}
public String toString() {
StringBuffer buf = new StringBuffer("[VMID: ");
for (int i = 0; i < addr.length; i++) {
if (i > 0) {
buf.append(".");
}
buf.append(Integer.toString(addr[i]));
}
buf.append(" ");
buf.append(uid.toString());
buf.append("]");
return (buf.toString());
}
}

View file

@ -0,0 +1,75 @@
/*
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.registry;
import java.io.IOException;
import java.rmi.RemoteException;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.RemoteRef;
import java.rmi.server.ObjID;
import java.net.Socket;
import gnu.java.rmi.server.UnicastRef;
import gnu.java.rmi.server.UnicastServerRef;
import gnu.java.rmi.registry.RegistryImpl;
import gnu.java.rmi.registry.RegistryImpl_Stub;
public final class LocateRegistry {
public static Registry getRegistry() throws RemoteException {
return (getRegistry("localhost", Registry.REGISTRY_PORT));
}
public static Registry getRegistry(int port) throws RemoteException {
return (getRegistry("localhost", port));
}
public static Registry getRegistry(String host) throws RemoteException {
return (getRegistry(host, Registry.REGISTRY_PORT));
}
public static Registry getRegistry(String host, int port) throws RemoteException {
return (getRegistry(host, port, RMISocketFactory.getSocketFactory()));
}
public static Registry getRegistry(String host, int port, RMIClientSocketFactory csf) throws RemoteException {
RemoteRef ref = new UnicastRef(new ObjID(ObjID.REGISTRY_ID), host, port, csf);
return (new RegistryImpl_Stub(ref));
}
public static Registry createRegistry(int port) throws RemoteException {
return (createRegistry(port, RMISocketFactory.getSocketFactory(), RMISocketFactory.getSocketFactory()));
}
public static Registry createRegistry(int port, RMIClientSocketFactory csf, RMIServerSocketFactory ssf) throws RemoteException {
return (new RegistryImpl(port, csf, ssf));
}
}

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.registry;
import java.rmi.RemoteException;
import java.rmi.NotBoundException;
import java.rmi.AccessException;
import java.rmi.AlreadyBoundException;
import java.rmi.Remote;
public interface Registry
extends Remote {
public static int REGISTRY_PORT = 1099;
public Remote lookup(String name) throws RemoteException, NotBoundException, AccessException;
public void bind(String name, Remote obj) throws RemoteException, AlreadyBoundException, AccessException;
public void unbind(String name) throws RemoteException, NotBoundException, AccessException;
public void rebind(String name, Remote obj) throws RemoteException, AccessException;
public String[] list() throws RemoteException, AccessException;
}

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.registry;
import java.rmi.RemoteException;
import java.rmi.UnknownHostException;
public interface RegistryHandler {
public Registry registryStub(String host, int port) throws RemoteException, UnknownHostException;
public Registry registryImpl(int port) throws RemoteException;
}

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