home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 November / Chip_1998-11_cd.bin / tema / Cafe / main.bin / RemoteRef.java < prev    next >
Text File  |  1997-05-20  |  4KB  |  106 lines

  1. /*
  2.  * @(#)RemoteRef.java    1.5 97/02/11
  3.  * 
  4.  * Copyright (c) 1995, 1996 Sun Microsystems, Inc. All Rights Reserved.
  5.  * 
  6.  * This software is the confidential and proprietary information of Sun
  7.  * Microsystems, Inc. ("Confidential Information").  You shall not
  8.  * disclose such Confidential Information and shall use it only in
  9.  * accordance with the terms of the license agreement you entered into
  10.  * with Sun.
  11.  * 
  12.  * SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
  13.  * SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  14.  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  15.  * PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
  16.  * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
  17.  * THIS SOFTWARE OR ITS DERIVATIVES.
  18.  * 
  19.  * CopyrightVersion 1.1_beta
  20.  */
  21.  
  22. package java.rmi.server;
  23.  
  24. import java.rmi.*;
  25.  
  26. /**
  27.  * RemoteRef represents the handle for a remote object.
  28.  */
  29. public interface RemoteRef extends java.io.Externalizable {
  30.  
  31.     /**
  32.      * Find server package prefix: assumes that the implementation of
  33.      * server ref classes (e.g., UnicastRef, UnicastServerRef) are
  34.      * located in the package defined by the prefix.
  35.      */
  36.     final static String packagePrefix =
  37.     System.getProperty("java.rmi.server.packagePrefix", "sun.rmi.server");
  38.     
  39.     /**
  40.      * Creates an appropriate call object for a new remote method
  41.      * invocation on this object.  Passing operation array and index,
  42.      * allows the stubs generator to assign the operation indexes and
  43.      * interpret them. The remote reference may need the operation to
  44.      * encode in the call.
  45.      *
  46.      * @exception RemoteException if registry could not be contacted.
  47.      */
  48.     RemoteCall newCall(RemoteObject obj, Operation[] op, int opnum, long hash) 
  49.     throws RemoteException;
  50.     
  51.     /**
  52.      * Executes the remote call.
  53.      * 
  54.      * Invoke will raise any "user" exceptions which
  55.      * should pass through and not be caught by the stub.  If any
  56.      * exception is raised during the remote invocation, invoke should
  57.      * take care of cleaning up the connection before raising the
  58.      * "user" or remote exception.
  59.      *
  60.      * @exception java.lang.Exception if a general exception occurs.
  61.      */
  62.     void invoke(RemoteCall call) throws Exception;
  63.     
  64.     /**
  65.      * Allows the remote reference to clean up (or reuse) the connection.
  66.      * Done should only be called if the invoke returns successfully
  67.      * (non-exceptionally) to the stub.
  68.      *
  69.      * @exception RemoteException if registry could not be contacted.
  70.      */
  71.     void done(RemoteCall call) throws RemoteException;
  72.     
  73.     /**
  74.      * Returns the class name of the ref type to be serialized onto
  75.      * the stream 'out'.
  76.      */
  77.     String getRefClass(java.io.ObjectOutput out);
  78.     
  79.     /**
  80.      * Returns a hashcode for a remote object.  Two remote object stubs
  81.      * that refer to the same remote object will have the same hash code
  82.      * (in order to support remote objects as keys in hash tables).
  83.      *
  84.      * @see        java.util.Hashtable
  85.      */
  86.     int remoteHashCode();
  87.  
  88.     /**
  89.      * Compares two remote objects for equality.
  90.      * Returns a boolean that indicates whether this remote object is
  91.      * equivalent to the specified Object. This method is used when a
  92.      * remote object is stored in a hashtable.
  93.      * @param    obj    the Object to compare with
  94.      * @return    true if these Objects are equal; false otherwise.
  95.      * @see        java.util.Hashtable
  96.      */
  97.     boolean remoteEquals(RemoteRef obj);
  98.  
  99.     /**
  100.      * Returns a String that represents the reference of this remote
  101.      * object.
  102.      */
  103.     String remoteToString();
  104.     
  105. }
  106.