info.jedi
Class Proxy

java.lang.Object
  |
  +--info.jedi.Proxy

public class Proxy
extends java.lang.Object
implements java.io.Serializable

Class Proxy represents an object on a remote machine. It is created with a machine address, a port, and the name of the object in the registry that is associated with that port. Any method of that object can be called by calling the function() method of Proxy. In addition ot the general one that takes a Vector of arguments, there are several other versions provided for convenience.

See Also:
RMCHandler, LocalRepository, LocalRepositoryImplementation, Repository, Remote, Serialized Form

Constructor Summary
Proxy(java.lang.String objectName)
          Same, but uses the default port on the current machine
Proxy(java.lang.String machineName, int port, java.lang.String objectName)
          Creates a Proxy for an object with a machine address, a port, and the name of the object in the registry that is associated with that port.
Proxy(java.lang.String machineName, java.lang.String objectName)
          Same, but uses the default port
 
Method Summary
 java.lang.Object function(java.lang.String methodName)
          A shortcut for the above function; when the method takes no arguments
 java.lang.Object function(java.lang.String methodName, java.lang.Object firstArg)
          A shortcut for the above function; when the method takes one argument
 java.lang.Object function(java.lang.String methodName, java.lang.Object firstArg, java.lang.Object secondArg)
          A shortcut for the above function; when the method takes two arguments
 java.lang.Object function(java.lang.String methodName, java.util.Vector args)
          Calls a general function on the remote machine.
 java.lang.String machineName()
          Returns the name of the machine where the object for this Proxy is
 int port()
          Returns the port on the remote machine where the object for this Proxy is
 int timeout()
          Returns the timeout in milliseconds for messages sent through this proxy
 void timeout(int newTimeout)
          Sets timeout in milliseconds for messages sent through this proxy
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Proxy

public Proxy(java.lang.String machineName,
             int port,
             java.lang.String objectName)
      throws java.net.UnknownHostException
Creates a Proxy for an object with a machine address, a port, and the name of the object in the registry that is associated with that port.
Throws:
java.net.UnknownHostException - if the machineName cannot be resolved

Proxy

public Proxy(java.lang.String machineName,
             java.lang.String objectName)
      throws java.net.UnknownHostException
Same, but uses the default port
Throws:
java.net.UnknownHostException - if the machineName cannot be resolved

Proxy

public Proxy(java.lang.String objectName)
      throws java.net.UnknownHostException
Same, but uses the default port on the current machine
Throws:
java.net.UnknownHostException - if the local machine name cannot be resolved
Method Detail

function

public java.lang.Object function(java.lang.String methodName,
                                 java.util.Vector args)
                          throws java.lang.Exception
Calls a general function on the remote machine.
Parameters:
methodName - the name of the method to call
args - the arguments of the method, in a vector
Returns:
whatever the method on the remote machine returns
Throws:
java.lang.Exception - if there is a network problem, or the method doesn't exist, or the method cannot be called for security or privacy reasons, or the method threw an exception.

function

public java.lang.Object function(java.lang.String methodName)
                          throws java.lang.Exception
A shortcut for the above function; when the method takes no arguments
Throws:
java.lang.Exception - if there is a network problem, or the method doesn't exist, or the method cannot be called for security or privacy reasons, or the method threw an exception.

function

public java.lang.Object function(java.lang.String methodName,
                                 java.lang.Object firstArg)
                          throws java.lang.Exception
A shortcut for the above function; when the method takes one argument
Throws:
java.lang.Exception - if there is a network problem, or the method doesn't exist, or the method cannot be called for security or privacy reasons, or the method threw an exception.

function

public java.lang.Object function(java.lang.String methodName,
                                 java.lang.Object firstArg,
                                 java.lang.Object secondArg)
                          throws java.lang.Exception
A shortcut for the above function; when the method takes two arguments
Throws:
java.lang.Exception - if there is a network problem, or the method doesn't exist, or the method cannot be called for security or privacy reasons, or the method threw an exception.

machineName

public java.lang.String machineName()
Returns the name of the machine where the object for this Proxy is

port

public int port()
Returns the port on the remote machine where the object for this Proxy is

timeout

public int timeout()
Returns the timeout in milliseconds for messages sent through this proxy

timeout

public void timeout(int newTimeout)
Sets timeout in milliseconds for messages sent through this proxy