Source for javax.rmi.CORBA.PortableRemoteObjectDelegate

   1: /* PortableRemoteObjectDelegate.java -- Interface supporting PortableRemoteObject
   2:    Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
   3: 
   4: This file is part of GNU Classpath.
   5: 
   6: GNU Classpath is free software; you can redistribute it and/or modify
   7: it under the terms of the GNU General Public License as published by
   8: the Free Software Foundation; either version 2, or (at your option)
   9: any later version.
  10: 
  11: GNU Classpath is distributed in the hope that it will be useful, but
  12: WITHOUT ANY WARRANTY; without even the implied warranty of
  13: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14: General Public License for more details.
  15: 
  16: You should have received a copy of the GNU General Public License
  17: along with GNU Classpath; see the file COPYING.  If not, write to the
  18: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19: 02110-1301 USA.
  20: 
  21: Linking this library statically or dynamically with other modules is
  22: making a combined work based on this library.  Thus, the terms and
  23: conditions of the GNU General Public License cover the whole
  24: combination.
  25: 
  26: As a special exception, the copyright holders of this library give you
  27: permission to link this library with independent modules to produce an
  28: executable, regardless of the license terms of these independent
  29: modules, and to copy and distribute the resulting executable under
  30: terms of your choice, provided that you also meet, for each linked
  31: independent module, the terms and conditions of the license of that
  32: module.  An independent module is a module which is not derived from
  33: or based on this library.  If you modify this library, you may extend
  34: this exception to your version of the library, but you are not
  35: obligated to do so.  If you do not wish to do so, delete this
  36: exception statement from your version. */
  37: 
  38: 
  39: package javax.rmi.CORBA;
  40: 
  41: import java.rmi.NoSuchObjectException;
  42: import java.rmi.Remote;
  43: import java.rmi.RemoteException;
  44: 
  45: /**
  46:  * A delegate, implementing the functionality, provided by the
  47:  * {@link PortableRemoteObject}.
  48:  * 
  49:  * The default delegate can be altered by setting the system property
  50:  * "javax.rmi.CORBA.PortableRemoteObjectClass" to the name of the alternative
  51:  * class that must implement {@link PortableRemoteObjectDelegate}.
  52:  * 
  53:  * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
  54:  */
  55: public interface PortableRemoteObjectDelegate
  56: {
  57:   /**
  58:    * <p>
  59:    * Makes the remote object <code>target</code> ready for remote
  60:    * communication using the same communications runtime as for the passed
  61:    * <code>source</code> parameter. Connection normally happens implicitly
  62:    * when the object is sent or received as an argument on a remote method call.
  63:    * </p>
  64:    * <p>
  65:    * The target object is connected to the same ORB as source by calling the
  66:    * {@link Stub#connect} if it is a stub or by associating its tie with an ORB
  67:    * if it is an implementation object.
  68:    * </p>
  69:    * 
  70:    * @param target the target object that may be either an RMI/IDL stub or an
  71:    * exported RMI/IDL implementation object
  72:    * @param source the source object may also be either an RMI/IDL stub or an
  73:    * exported RMI/IDL implementation object.
  74:    * 
  75:    * @throws RemoteException if the target is already connected to another ORB.
  76:    */
  77:   void connect(Remote target, Remote source)
  78:     throws RemoteException;
  79: 
  80:   /**
  81:    * Register the passed object with the ORB runtimes, making it remotely
  82:    * accessible. When called on jre with no objects exported, creates a
  83:    * non-daemon thread that prevents jre from terminating until all objects are
  84:    * unexported. Also, such object cannot be collected by garbage collector.
  85:    * This is usually impemented via {@link Util#unexportObject}
  86:    * 
  87:    * @param object the object to export.
  88:    * 
  89:    * @throws RemoteException
  90:    */
  91:   void exportObject(Remote obj)
  92:     throws RemoteException;
  93: 
  94:   /**
  95:    * Narrows the passed object to conform to the given interface or IDL type.
  96:    * This method may return different instance and cannot be replaced by the
  97:    * direct cast.
  98:    * 
  99:    * @param narrowFrom an object to narrow.
 100:    * @param narrowTo a type to that the object must be narrowed.
 101:    * 
 102:    * @return On success, an object of type narrowTo or null, if narrowFrom =
 103:    * null.
 104:    * 
 105:    * @throws ClassCastException if no narrowing is possible.
 106:    */
 107:   Object narrow(Object narrowFrom, Class narrowTo)
 108:     throws ClassCastException;
 109: 
 110:   /**
 111:    * Takes a server implementation object and returns a stub object that can be
 112:    * used to access that server object (target). If the target is connected, the
 113:    * returned stub is also connected to the same ORB. If the target is
 114:    * unconnected, the returned stub is unconnected.
 115:    * 
 116:    * @param target a server side object.
 117:    * @return a stub object that can be used to access that server object.
 118:    * 
 119:    * @throws NoSuchObjectException if a stub cannot be located for the given
 120:    * target.
 121:    */
 122:   Remote toStub(Remote obj)
 123:     throws NoSuchObjectException;
 124: 
 125:   /**
 126:    * Deregister a currently exported server object from the ORB runtimes. The
 127:    * object to becomes available for garbage collection. This is usually
 128:    * impemented via {@link Util#unexportObject}
 129:    * 
 130:    * @param object the object to unexport.
 131:    * 
 132:    * @throws NoSuchObjectException if the passed object is not currently
 133:    * exported.
 134:    */
 135:   void unexportObject(Remote obj)
 136:     throws NoSuchObjectException;
 137: }