Voyager ORB

com.objectspace.voyager
Class Proxy

com.objectspace.voyager.Proxy

public abstract class Proxy
implements java.io.Externalizable

A proxy represents another object. A proxy implements the same interfaces as its object, and method calls made to the proxy are forwarded to its object even if the object is in a different VM.

Version:
3.0
See Also:
Serialized Form

Method Summary
 boolean equals(java.lang.Object object)
          Return true if the specified object is a proxy that refers to the same object as myself.
static Proxy export(java.lang.Object object)
          Export the object on any local URL that is accepting connections and return a proxy to the exported object.
static Proxy export(java.lang.Object object, java.lang.String url)
          Export the object on the specified URL and return a proxy to the exported object.
 java.lang.Object getLocal()
          If I'm in the same VM as my object, return a regular Java reference to my object, otherwise return null.
 java.lang.String getURL()
          Return my object's URL.
 int hashCode()
          Return my hashcode.
 boolean isExported()
          Return true if my object is exported.
 boolean isLocal()
          Return true if I'm in the same VM as my associated object.
static Proxy of(java.lang.Object object)
          Return a proxy to the specified object.
 boolean remoteEquals(java.lang.Object object)
          Return true if my associated object is equal to the specified object.
 int remoteHashCode()
          Return the result of sending hashCode() to my associated object.
 java.lang.String toExternalForm()
          Return a string that may be used as a parameter to Namespace.lookup() for obtaining a proxy to my object.
 java.lang.String toString()
          Return the result of sending toString() to my associated object.
static void unexport(java.lang.Object object)
          Unexport the specified object.
 

Method Detail

toString

public java.lang.String toString()
Return the result of sending toString() to my associated object.

hashCode

public int hashCode()
Return my hashcode. This method does not cause any network traffic.

equals

public boolean equals(java.lang.Object object)
Return true if the specified object is a proxy that refers to the same object as myself.
Parameters:
object - The object to compare against.

remoteEquals

public boolean remoteEquals(java.lang.Object object)
Return true if my associated object is equal to the specified object.
Parameters:
object - The object to compare against.

remoteHashCode

public int remoteHashCode()
Return the result of sending hashCode() to my associated object.

isLocal

public boolean isLocal()
Return true if I'm in the same VM as my associated object.

isExported

public boolean isExported()
Return true if my object is exported.

getURL

public java.lang.String getURL()
Return my object's URL.

toExternalForm

public java.lang.String toExternalForm()
Return a string that may be used as a parameter to Namespace.lookup() for obtaining a proxy to my object.

getLocal

public java.lang.Object getLocal()
If I'm in the same VM as my object, return a regular Java reference to my object, otherwise return null.

export

public static Proxy export(java.lang.Object object)
                    throws java.io.IOException
Export the object on any local URL that is accepting connections and return a proxy to the exported object.
Parameters:
object - The object to export
Throws:
java.io.IOException - The object was already exported.

export

public static Proxy export(java.lang.Object object,
                           java.lang.String url)
                    throws java.io.IOException
Export the object on the specified URL and return a proxy to the exported object.
Parameters:
object - The object to export
url - The URL on which the object should be exported.
Throws:
java.io.IOException - The object was already exported.

unexport

public static void unexport(java.lang.Object object)
                     throws java.io.IOException
Unexport the specified object.
Parameters:
object - The object to unexport.

of

public static Proxy of(java.lang.Object object)
Return a proxy to the specified object. If the object is already a proxy, simply return the argument.
Parameters:
object - The object.

ObjectSpace Inc.

(c) Copyright 1997-1999 ObjectSpace, Inc.
14850 Quorum Drive, Suite 500
Dallas, Texas 75240