KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > corba > se > impl > protocol > giopmsgheaders > TargetAddressHelper


1 /*
2  * @(#)TargetAddressHelper.java 1.8 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.corba.se.impl.protocol.giopmsgheaders;
9
10
11 /**
12 * com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java
13 * Generated by the IDL-to-Java compiler (portable), version "3.0"
14 * from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl
15 * Sunday, June 4, 2000 5:18:54 PM PDT
16 */

17
18 abstract public class TargetAddressHelper
19 {
20   private static String JavaDoc _id = "IDL:messages/TargetAddress:1.0";
21
22   public static void insert (org.omg.CORBA.Any JavaDoc a, com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress that)
23   {
24     org.omg.CORBA.portable.OutputStream JavaDoc out = a.create_output_stream ();
25     a.type (type ());
26     write (out, that);
27     a.read_value (out.create_input_stream (), type ());
28   }
29
30   public static com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress extract (org.omg.CORBA.Any JavaDoc a)
31   {
32     return read (a.create_input_stream ());
33   }
34
35   private static org.omg.CORBA.TypeCode JavaDoc __typeCode = null;
36   synchronized public static org.omg.CORBA.TypeCode JavaDoc type ()
37   {
38     if (__typeCode == null)
39     {
40       org.omg.CORBA.TypeCode JavaDoc _disTypeCode0;
41       _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short);
42       _disTypeCode0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.corba.se.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id (), "AddressingDisposition", _disTypeCode0);
43       org.omg.CORBA.UnionMember JavaDoc[] _members0 = new org.omg.CORBA.UnionMember JavaDoc [3];
44       org.omg.CORBA.TypeCode JavaDoc _tcOf_members0;
45       org.omg.CORBA.Any JavaDoc _anyOf_members0;
46
47       // Branch for object_key
48
_anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
49       _anyOf_members0.insert_short ((short)com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value);
50       _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet);
51       _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0);
52       _members0[0] = new org.omg.CORBA.UnionMember JavaDoc (
53         "object_key",
54         _anyOf_members0,
55         _tcOf_members0,
56         null);
57
58       // Branch for profile
59
_anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
60       _anyOf_members0.insert_short ((short)com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value);
61       _tcOf_members0 = org.omg.IOP.TaggedProfileHelper.type ();
62       _members0[1] = new org.omg.CORBA.UnionMember JavaDoc (
63         "profile",
64         _anyOf_members0,
65         _tcOf_members0,
66         null);
67
68       // Branch for ior
69
_anyOf_members0 = org.omg.CORBA.ORB.init ().create_any ();
70       _anyOf_members0.insert_short ((short)com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value);
71       _tcOf_members0 = com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.type ();
72       _members0[2] = new org.omg.CORBA.UnionMember JavaDoc (
73         "ior",
74         _anyOf_members0,
75         _tcOf_members0,
76         null);
77       __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddressHelper.id (), "TargetAddress", _disTypeCode0, _members0);
78     }
79     return __typeCode;
80   }
81
82   public static String JavaDoc id ()
83   {
84     return _id;
85   }
86
87   public static com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress read (org.omg.CORBA.portable.InputStream JavaDoc istream)
88   {
89     com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress value = new com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress ();
90     short _dis0 = (short)0;
91     _dis0 = istream.read_short ();
92     switch (_dis0)
93     {
94       case com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value:
95         byte _object_key[] = null;
96         int _len1 = istream.read_long ();
97         _object_key = new byte[_len1];
98         istream.read_octet_array (_object_key, 0, _len1);
99         value.object_key (_object_key);
100         break;
101       case com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value:
102         org.omg.IOP.TaggedProfile JavaDoc _profile = null;
103         _profile = org.omg.IOP.TaggedProfileHelper.read (istream);
104         value.profile (_profile);
105         break;
106       case com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value:
107         com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo _ior = null;
108         _ior = com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.read (istream);
109         value.ior (_ior);
110         break;
111       default:
112         throw new org.omg.CORBA.BAD_OPERATION JavaDoc ();
113     }
114     return value;
115   }
116
117   public static void write (org.omg.CORBA.portable.OutputStream JavaDoc ostream, com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress value)
118   {
119     ostream.write_short (value.discriminator ());
120     switch (value.discriminator ())
121     {
122       case com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value:
123         ostream.write_long (value.object_key ().length);
124         ostream.write_octet_array (value.object_key (), 0, value.object_key ().length);
125         break;
126       case com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value:
127         org.omg.IOP.TaggedProfileHelper.write (ostream, value.profile ());
128         break;
129       case com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value:
130         com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.write (ostream, value.ior ());
131         break;
132       default:
133         throw new org.omg.CORBA.BAD_OPERATION JavaDoc ();
134     }
135   }
136
137 }
138
Popular Tags