001: /*
002: * Copyright 1998-2002 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: /* @(#)WStringValueHelper.java 1.23 07/05/05 */
026:
027: /**
028: * The Helper for <tt>WStringValue</tt>. For more information on
029: * Helper files, see <a href="doc-files/generatedfiles.html#helper">
030: * "Generated Files: Helper Files"</a>.<P>
031: */package org.omg.CORBA;
032:
033: /**
034: * org/omg/CORBA/WStringValueHelper.java
035: * Generated by the IDL-to-Java compiler (portable), version "3.0"
036: * from orb.idl
037: * 31 May 1999 22:27:30 o'clock GMT+00:00
038: *
039: * The class definition has been modified to conform to the following
040: * OMG specifications :
041: * <ul>
042: * <li> ORB core as defined by CORBA 2.3.1
043: * (<a href="http://cgi.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
044: * </li>
045: *
046: * <li> IDL/Java Language Mapping as defined in
047: * <a href="http://cgi.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
048: * </li>
049: * </ul>
050: */
051:
052: public class WStringValueHelper implements
053: org.omg.CORBA.portable.BoxedValueHelper {
054: private static String _id = "IDL:omg.org/CORBA/WStringValue:1.0";
055:
056: private static WStringValueHelper _instance = new WStringValueHelper();
057:
058: public static void insert(org.omg.CORBA.Any a, String that) {
059: org.omg.CORBA.portable.OutputStream out = a
060: .create_output_stream();
061: a.type(type());
062: write(out, that);
063: a.read_value(out.create_input_stream(), type());
064: }
065:
066: public static String extract(org.omg.CORBA.Any a) {
067: return read(a.create_input_stream());
068: }
069:
070: private static org.omg.CORBA.TypeCode __typeCode = null;
071: private static boolean __active = false;
072:
073: synchronized public static org.omg.CORBA.TypeCode type() {
074: if (__typeCode == null) {
075: synchronized (org.omg.CORBA.TypeCode.class) {
076: if (__typeCode == null) {
077: if (__active) {
078: return org.omg.CORBA.ORB.init()
079: .create_recursive_tc(_id);
080: }
081: __active = true;
082: __typeCode = org.omg.CORBA.ORB.init()
083: .create_wstring_tc(0);
084: __typeCode = org.omg.CORBA.ORB.init()
085: .create_value_box_tc(_id, "WStringValue",
086: __typeCode);
087: __active = false;
088: }
089: }
090: }
091: return __typeCode;
092: }
093:
094: public static String id() {
095: return _id;
096: }
097:
098: public static String read(org.omg.CORBA.portable.InputStream istream) {
099: if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
100: throw new org.omg.CORBA.BAD_PARAM();
101: }
102: return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream)
103: .read_value(_instance);
104: }
105:
106: public java.io.Serializable read_value(
107: org.omg.CORBA.portable.InputStream istream) {
108: String tmp;
109: tmp = istream.read_wstring();
110: return (java.io.Serializable) tmp;
111: }
112:
113: public static void write(
114: org.omg.CORBA.portable.OutputStream ostream, String value) {
115: if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
116: throw new org.omg.CORBA.BAD_PARAM();
117: }
118: ((org.omg.CORBA_2_3.portable.OutputStream) ostream)
119: .write_value(value, _instance);
120: }
121:
122: public void write_value(
123: org.omg.CORBA.portable.OutputStream ostream,
124: java.io.Serializable value) {
125: if (!(value instanceof String)) {
126: throw new org.omg.CORBA.MARSHAL();
127: }
128: String valueType = (String) value;
129: ostream.write_wstring(valueType);
130: }
131:
132: public String get_id() {
133: return _id;
134: }
135:
136: }
|