1:
37:
38:
39: package ;
40:
41: import ;
42: import ;
43: import ;
44: import ;
45: import ;
46: import ;
47: import ;
48: import ;
49: import ;
50: import ;
51: import ;
52: import ;
53: import ;
54: import ;
55: import ;
56: import ;
57: import ;
58: import ;
59: import ;
60: import ;
61: import ;
62: import ;
63: import ;
64: import ;
65: import ;
66: import ;
67: import ;
68: import ;
69: import ;
70: import ;
71: import ;
72:
73:
78: public class HolderLocator
79: {
80:
84: private static final Class[] holders;
85:
86: private static final Class[] seqHolders;
87:
88: static
89: {
90: holders = new Class[32];
91: holders[TCKind._tk_Principal] = PrincipalHolder.class;
92: holders[TCKind._tk_TypeCode] = TypeCodeHolder.class;
93: holders[TCKind._tk_any] = AnyHolder.class;
94: holders[TCKind._tk_boolean] = BooleanHolder.class;
95: holders[TCKind._tk_char] = CharHolder.class;
96: holders[TCKind._tk_double] = DoubleHolder.class;
97: holders[TCKind._tk_float] = FloatHolder.class;
98: holders[TCKind._tk_fixed] = FixedHolder.class;
99: holders[TCKind._tk_long] = IntHolder.class;
100: holders[TCKind._tk_longdouble] = DoubleHolder.class;
101: holders[TCKind._tk_longlong] = LongHolder.class;
102: holders[TCKind._tk_octet] = OctetHolder.class;
103: holders[TCKind._tk_short] = ShortHolder.class;
104: holders[TCKind._tk_string] = StringHolder.class;
105: holders[TCKind._tk_ulong] = IntHolder.class;
106: holders[TCKind._tk_ulonglong] = LongHolder.class;
107: holders[TCKind._tk_ushort] = ShortHolder.class;
108: holders[TCKind._tk_wchar] = WCharHolder.class;
109: holders[TCKind._tk_wstring] = WStringHolder.class;
110: holders[TCKind._tk_objref] = ObjectHolder.class;
111:
112: seqHolders = new Class[32];
113:
114: seqHolders[TCKind._tk_ulonglong] = ULongLongSeqHolder.class;
115: seqHolders[TCKind._tk_short] = ShortSeqHolder.class;
116: seqHolders[TCKind._tk_octet] = OctetSeqHolder.class;
117: seqHolders[TCKind._tk_any] = AnySeqHolder.class;
118: seqHolders[TCKind._tk_long] = LongSeqHolder.class;
119: seqHolders[TCKind._tk_longlong] = LongLongSeqHolder.class;
120: seqHolders[TCKind._tk_float] = FloatSeqHolder.class;
121: seqHolders[TCKind._tk_double] = DoubleSeqHolder.class;
122: seqHolders[TCKind._tk_char] = CharSeqHolder.class;
123: seqHolders[TCKind._tk_boolean] = BooleanSeqHolder.class;
124: seqHolders[TCKind._tk_wchar] = WCharSeqHolder.class;
125: seqHolders[TCKind._tk_ushort] = UShortSeqHolder.class;
126: seqHolders[TCKind._tk_ulong] = ULongSeqHolder.class;
127: seqHolders[TCKind._tk_string] = StringSeqHolder.class;
128: seqHolders[TCKind._tk_wstring] = WStringSeqHolder.class;
129: }
130:
131:
142: public static Streamable createHolder(TypeCode t)
143: {
144: try
145: {
146: int kind = t.kind().value();
147: int componentKind;
148:
149: Streamable holder = null;
150:
151: if (kind < holders.length && holders[kind] != null)
152: holder = (Streamable) holders[kind].newInstance();
153:
154: if (holder != null)
155: return holder;
156:
157: switch (kind)
158: {
159: case TCKind._tk_sequence:
160: componentKind = t.content_type().kind().value();
161: if (componentKind < seqHolders.length)
162: return (Streamable) seqHolders[componentKind].newInstance();
163: break;
164:
165: default:
166: break;
167: }
168: }
169: catch (Exception ex)
170: {
171: throw new Unexpected(ex);
172: }
173:
174: try
175: {
176: Object ox = ObjectCreator.createObject(t.id(), "Holder");
177: return (Streamable) ox;
178: }
179: catch (Exception ex)
180: {
181: return null;
182: }
183: }
184: }