src/share/classes/org/omg/CORBA/StringValueHelper.java

changeset 1
55540e827aef
child 158
91006f157c46
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/share/classes/org/omg/CORBA/StringValueHelper.java	Sat Dec 01 00:00:00 2007 +0000
     1.3 @@ -0,0 +1,138 @@
     1.4 +/*
     1.5 + * Copyright 1998-2001 Sun Microsystems, Inc.  All Rights Reserved.
     1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.7 + *
     1.8 + * This code is free software; you can redistribute it and/or modify it
     1.9 + * under the terms of the GNU General Public License version 2 only, as
    1.10 + * published by the Free Software Foundation.  Sun designates this
    1.11 + * particular file as subject to the "Classpath" exception as provided
    1.12 + * by Sun in the LICENSE file that accompanied this code.
    1.13 + *
    1.14 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.16 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.17 + * version 2 for more details (a copy is included in the LICENSE file that
    1.18 + * accompanied this code).
    1.19 + *
    1.20 + * You should have received a copy of the GNU General Public License version
    1.21 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.23 + *
    1.24 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    1.25 + * CA 95054 USA or visit www.sun.com if you need additional information or
    1.26 + * have any questions.
    1.27 + */
    1.28 +/*
    1.29 + * Licensed Materials - Property of IBM
    1.30 + * RMI-IIOP v1.0
    1.31 + * Copyright IBM Corp. 1998 1999  All Rights Reserved
    1.32 + *
    1.33 + */
    1.34 +
    1.35 +package org.omg.CORBA;
    1.36 +
    1.37 +/**
    1.38 +* The Helper for <tt>StringValue</tt>.  For more information on
    1.39 +* Helper files, see <a href="doc-files/generatedfiles.html#helper">
    1.40 +* "Generated Files: Helper Files"</a>.<P>
    1.41 +* org/omg/CORBA/StringValueHelper.java
    1.42 +* Generated by the IDL-to-Java compiler (portable), version "3.0"
    1.43 +* from orb.idl
    1.44 +* 31 May 1999 22:27:30 o'clock GMT+00:00
    1.45 +*
    1.46 +* The class definition has been modified to conform to the following
    1.47 +* OMG specifications :
    1.48 +*   <ul>
    1.49 +*       <li> ORB core as defined by CORBA 2.3.1
    1.50 +*       (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
    1.51 +*       </li>
    1.52 +*
    1.53 +*       <li> IDL/Java Language Mapping as defined in
    1.54 +*       <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
    1.55 +*       </li>
    1.56 +*   </ul>
    1.57 +*/
    1.58 +
    1.59 +public class StringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
    1.60 +{
    1.61 +    private static String  _id = "IDL:omg.org/CORBA/StringValue:1.0";
    1.62 +
    1.63 +  private static StringValueHelper _instance = new StringValueHelper ();
    1.64 +
    1.65 +    public static void insert (org.omg.CORBA.Any a, String that)
    1.66 +    {
    1.67 +        org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
    1.68 +        a.type (type ());
    1.69 +        write (out, that);
    1.70 +        a.read_value (out.create_input_stream (), type ());
    1.71 +    }
    1.72 +
    1.73 +    public static String extract (org.omg.CORBA.Any a)
    1.74 +    {
    1.75 +        return read (a.create_input_stream ());
    1.76 +    }
    1.77 +
    1.78 +    private static org.omg.CORBA.TypeCode __typeCode = null;
    1.79 +    private static boolean __active = false;
    1.80 +    synchronized public static org.omg.CORBA.TypeCode type ()
    1.81 +    {
    1.82 +        if (__typeCode == null)
    1.83 +            {
    1.84 +                synchronized (org.omg.CORBA.TypeCode.class)
    1.85 +                    {
    1.86 +                        if (__typeCode == null)
    1.87 +                            {
    1.88 +                                if (__active)
    1.89 +                                    {
    1.90 +                                        return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
    1.91 +                                    }
    1.92 +                                __active = true;
    1.93 +                                __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
    1.94 +                                __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "StringValue", __typeCode);
    1.95 +                                __active = false;
    1.96 +                            }
    1.97 +                    }
    1.98 +            }
    1.99 +        return __typeCode;
   1.100 +    }
   1.101 +
   1.102 +    public static String id ()
   1.103 +    {
   1.104 +        return _id;
   1.105 +    }
   1.106 +
   1.107 +    public static String read (org.omg.CORBA.portable.InputStream istream)
   1.108 +    {
   1.109 +    if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
   1.110 +      throw new org.omg.CORBA.BAD_PARAM(); }
   1.111 +    return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
   1.112 +    }
   1.113 +
   1.114 +  public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
   1.115 +    {
   1.116 +    String tmp;
   1.117 +    tmp = istream.read_string ();
   1.118 +    return (java.io.Serializable) tmp;
   1.119 +    }
   1.120 +
   1.121 +  public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
   1.122 +    {
   1.123 +    if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
   1.124 +      throw new org.omg.CORBA.BAD_PARAM(); }
   1.125 +    ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
   1.126 +    }
   1.127 +
   1.128 +    public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
   1.129 +    {
   1.130 +    if (!(value instanceof String)) {
   1.131 +      throw new org.omg.CORBA.MARSHAL(); }
   1.132 +    String valueType = (String) value;
   1.133 +    ostream.write_string (valueType);
   1.134 +    }
   1.135 +
   1.136 +    public String get_id ()
   1.137 +    {
   1.138 +        return _id;
   1.139 +    }
   1.140 +
   1.141 +}

mercurial