InvokeHandler.java revision 662:753f4114e6d6
1/*
2 * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package org.omg.CORBA.portable;
26
27/**
28This interface provides a dispatching mechanism for an incoming call.
29It is invoked by the ORB to dispatch a request to a servant.
30*/
31
32public interface InvokeHandler {
33    /**
34     * Invoked by the ORB to dispatch a request to the servant.
35     *
36     * ORB passes the method name, an InputStream containing the
37     * marshalled arguments, and a ResponseHandler which the servant
38     * uses to construct a proper reply.
39     *
40     * Only CORBA SystemException may be thrown by this method.
41     *
42     * The method must return an OutputStream created by the
43     * ResponseHandler which contains the marshalled reply.
44     *
45     * A servant must not retain a reference to the ResponseHandler
46     * beyond the lifetime of a method invocation.
47     *
48     * Servant behaviour is defined as follows:
49     * <p>1. Determine correct method, and unmarshal parameters from
50     *    InputStream.
51     * <p>2. Invoke method implementation.
52     * <p>3. If no user exception, create a normal reply using
53     *    ResponseHandler.
54     * <p>4. If user exception occurred, create exception reply using
55     *    ResponseHandler.
56     * <p>5. Marshal reply into OutputStream returned by
57     *    ResponseHandler.
58     * <p>6. Return OutputStream to ORB.
59     *
60     * @param method The method name.
61     * @param input The <code>InputStream</code> containing the marshalled arguments.
62     * @param handler The <code>ResponseHandler</code> which the servant uses
63     * to construct a proper reply
64     * @return The <code>OutputStream</code> created by the
65     * ResponseHandler which contains the marshalled reply
66     * @throws SystemException is thrown when invocation fails due to a CORBA system exception.
67     */
68
69    OutputStream _invoke(String method, InputStream input,
70                         ResponseHandler handler)
71        throws org.omg.CORBA.SystemException;
72}
73