home *** CD-ROM | disk | FTP | other *** search
- package java.rmi.server;
-
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.io.Serializable;
- import java.rmi.MarshalException;
- import java.rmi.NoSuchObjectException;
- import java.rmi.Remote;
- import java.rmi.UnmarshalException;
- import sun.rmi.transport.ObjectTable;
-
- public abstract class RemoteObject implements Remote, Serializable {
- protected transient RemoteRef ref;
- private static final long serialVersionUID = -3215090123894869218L;
-
- protected RemoteObject() {
- this.ref = null;
- }
-
- protected RemoteObject(RemoteRef var1) {
- this.ref = var1;
- }
-
- public RemoteRef getRef() {
- return this.ref;
- }
-
- public static Remote toStub(Remote var0) throws NoSuchObjectException {
- return var0 instanceof RemoteStub ? (RemoteStub)var0 : ObjectTable.getStub(var0);
- }
-
- public int hashCode() {
- return this.ref == null ? super.hashCode() : this.ref.remoteHashCode();
- }
-
- public boolean equals(Object var1) {
- if (var1 instanceof RemoteObject) {
- if (this.ref == null) {
- return var1 == this;
- } else {
- return this.ref.remoteEquals(((RemoteObject)var1).ref);
- }
- } else {
- return var1 != null ? var1.equals(this) : false;
- }
- }
-
- public String toString() {
- String var1 = this.getClass().getName();
- return this.ref == null ? var1 : var1 + "[" + this.ref.remoteToString() + "]";
- }
-
- private void writeObject(ObjectOutputStream var1) throws IOException, ClassNotFoundException {
- if (this.ref == null) {
- throw new MarshalException("Invalid remote object");
- } else {
- String var2 = this.ref.getRefClass(var1);
- if (var2 != null && var2.length() != 0) {
- var1.writeUTF(var2);
- this.ref.writeExternal(var1);
- } else {
- var1.writeUTF("");
- var1.writeObject(this.ref);
- }
-
- }
- }
-
- private void readObject(ObjectInputStream var1) throws IOException, ClassNotFoundException {
- try {
- String var2 = var1.readUTF();
- if (var2 != null && var2.length() != 0) {
- Class var3 = Class.forName("sun.rmi.server." + var2);
- this.ref = (RemoteRef)var3.newInstance();
- this.ref.readExternal(var1);
- } else {
- this.ref = (RemoteRef)var1.readObject();
- }
-
- } catch (InstantiationException var4) {
- throw new UnmarshalException("Unable to create remote reference", var4);
- } catch (IllegalAccessException var5) {
- throw new UnmarshalException("Illegal access creating remote reference");
- }
- }
- }
-