ValueHandler.java revision 608:7e06bf1dcb09
1/*
2 * Copyright (c) 1998, 1999, 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 */
25/*
26 * Licensed Materials - Property of IBM
27 * RMI-IIOP v1.0
28 * Copyright IBM Corp. 1998 1999  All Rights Reserved
29 *
30 */
31
32package javax.rmi.CORBA;
33
34/**
35 * Defines methods which allow serialization of Java objects
36 * to and from GIOP streams.
37 **/
38public interface ValueHandler {
39
40    /**
41     * Writes a value to the stream using Java semantics.
42     * @param out the stream to write the value to.
43     * @param value the value to be written to the stream.
44     **/
45    void writeValue(org.omg.CORBA.portable.OutputStream out,
46                    java.io.Serializable value);
47
48    /**
49     * Reads a value from the stream using Java semantics.
50     * @param in the stream to read the value from.
51     * @param offset the current position in the input stream.
52     * @param clz the type of the value to be read in.
53     * @param repositoryID the RepositoryId of the value to be read in.
54     * @param sender the sending context runtime codebase.
55     * @return the value read from the stream.
56     **/
57    java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in,
58                                   int offset,
59                                   java.lang.Class clz,
60                                   String repositoryID,
61                                   org.omg.SendingContext.RunTime sender);
62
63    /**
64     * Returns the CORBA RepositoryId for the given Java class.
65     * @param clz a Java class.
66     * @return the CORBA RepositoryId for the class.
67     **/
68    java.lang.String getRMIRepositoryID(java.lang.Class clz);
69
70    /**
71     * Indicates whether the given class performs custom or
72     * default marshaling.
73     * @param clz the class to test for custom marshaling.
74     * @return <code>true</code> if the class performs custom marshaling, <code>false</code>
75     * if it does not.
76     **/
77    boolean isCustomMarshaled(java.lang.Class clz);
78
79    /**
80     * Returns the CodeBase for this ValueHandler.  This is used by
81     * the ORB runtime.  The server sends the service context containing
82     * the IOR for this CodeBase on the first GIOP reply.  The client
83     * does the same on the first GIOP request.
84     * @return the SendingContext.CodeBase of this ValueHandler.
85     **/
86    org.omg.SendingContext.RunTime getRunTimeCodeBase();
87
88    /**
89     * If the value contains a <code>writeReplace</code> method then the result
90     * is returned.  Otherwise, the value itself is returned.
91     * @param value the value to be marshaled.
92     * @return the true value to marshal on the wire.
93     **/
94    java.io.Serializable writeReplace(java.io.Serializable value);
95
96}
97