001/* ServantLocatorOperations.java --
002   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
003
004This file is part of GNU Classpath.
005
006GNU Classpath is free software; you can redistribute it and/or modify
007it under the terms of the GNU General Public License as published by
008the Free Software Foundation; either version 2, or (at your option)
009any later version.
010
011GNU Classpath is distributed in the hope that it will be useful, but
012WITHOUT ANY WARRANTY; without even the implied warranty of
013MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014General Public License for more details.
015
016You should have received a copy of the GNU General Public License
017along with GNU Classpath; see the file COPYING.  If not, write to the
018Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
01902110-1301 USA.
020
021Linking this library statically or dynamically with other modules is
022making a combined work based on this library.  Thus, the terms and
023conditions of the GNU General Public License cover the whole
024combination.
025
026As a special exception, the copyright holders of this library give you
027permission to link this library with independent modules to produce an
028executable, regardless of the license terms of these independent
029modules, and to copy and distribute the resulting executable under
030terms of your choice, provided that you also meet, for each linked
031independent module, the terms and conditions of the license of that
032module.  An independent module is a module which is not derived from
033or based on this library.  If you modify this library, you may extend
034this exception to your version of the library, but you are not
035obligated to do so.  If you do not wish to do so, delete this
036exception statement from your version. */
037
038
039package org.omg.PortableServer;
040
041import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
042
043/**
044 * Defines the operations, applicable to the {@link ServantLocator}.
045 *
046 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
047 */
048public interface ServantLocatorOperations
049  extends ServantManagerOperations
050{
051  /**
052   * If the POA has the USE_SERVANT_MANAGER and NON_RETAIN policies, it
053   * invokes this method whenever the object being requested that is not
054   * inactive. This method has access to all details of the received
055   * request and can use them to choose between servaral alternative servants.
056   * It can also forward the request to another server.
057   *
058   * @param Object_Id the id of the object, on which the request was called.
059   * @param poa the POA in those scope the object is active.
060   * @param operation the name of the method or operation being invoked.
061   * @param cookie_holder the holder where the servant manager can store
062   * an arbitrary java.lang.Object. This object will be later passed as a
063   * <code>cookie</code> parameter for {@link #postinvoke}, to create tie
064   * between preinvoke and postinvoke. The application should <i>not</i>
065   * suppose that each call of preinvoke is followed by the subsequent
066   * postinvoke for the same invocation; under multi threaded policy these
067   * calls may be intermixed.
068   *
069   * @return a servant that will serve the incoming request.
070   *
071   * @throws ForwardRequest if the locator decides to forward the request
072   * to another object. The exception contains the object that should
073   * handle this request. This object is usually remote, but can also
074   * be local. As <code>preinvoke</code> is called on each method
075   * invocation, the thrown exception will forward only this current request.
076   */
077  Servant preinvoke(byte[] Object_Id, POA poa, String operation,
078                    CookieHolder cookie_holder
079                   )
080             throws ForwardRequest;
081
082  /**
083   * If the POA has the USE_SERVANT_MANAGER and NON_RETAIN policies, it
084   * invokes this method whenever a servant completes a request.
085   *
086   * @param Object_Id the id of the object, on which the request was called.
087   * @param poa the POA in those scope the object is active.
088   * @param operation the name of the method or operation that was invoked.
089   * @param cookie the object that has been previously set by preinvoke in
090   * the <code>cookie_holder</code> parameter.
091   * @param servant the servant, associated with the object.
092   */
093  void postinvoke(byte[] Object_Id, POA poa, String operation,
094                  java.lang.Object cookie, Servant servant
095                 );
096}