KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > omg > CORBA > SystemExceptionHelper


1 package org.omg.CORBA;
2
3
4 /**
5  * Custom Helper class for CORBA System Exceptions.
6  */

7
8 public final class SystemExceptionHelper
9 {
10    private static org.omg.CORBA.TypeCode JavaDoc _type = org.omg.CORBA.ORB.init().create_exception_tc( org.omg.CORBA.SystemExceptionHelper.id(),"SystemException",new org.omg.CORBA.StructMember JavaDoc[]{new org.omg.CORBA.StructMember JavaDoc("minor",org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.from_int(5)),null),new org.omg.CORBA.StructMember JavaDoc("completed",org.omg.CORBA.ORB.init().create_enum_tc(org.omg.CORBA.CompletionStatusHelper.id(),"CompletionStatus",new String JavaDoc[]{"COMPLETED_YES","COMPLETED_NO","COMPLETED_MAYBE"}),null)});
11
12    public static void insert(org.omg.CORBA.Any JavaDoc any, org.omg.CORBA.SystemException JavaDoc s)
13    {
14       any.type(getTypeCode(s));
15       write(any.create_output_stream (), s);
16    }
17
18    public static org.omg.CORBA.SystemException JavaDoc extract(org.omg.CORBA.Any JavaDoc any)
19    {
20       return read(any.create_input_stream());
21    }
22
23    public static org.omg.CORBA.TypeCode JavaDoc type()
24    {
25       return _type;
26    }
27
28    public static String JavaDoc id()
29    {
30       return "IDL:omg.org/CORBA/SystemException:1.0";
31    }
32
33    public static org.omg.CORBA.SystemException JavaDoc read(org.omg.CORBA.portable.InputStream JavaDoc in)
34    {
35       String JavaDoc id=in.read_string();
36       org.omg.CORBA.SystemException JavaDoc result=getSystemException(id);
37       result.minor=in.read_ulong();
38       result.completed=org.omg.CORBA.CompletionStatusHelper.read(in);
39       return result;
40    }
41
42    public static void write(org.omg.CORBA.portable.OutputStream JavaDoc out, org.omg.CORBA.SystemException JavaDoc s)
43    {
44       out.write_string(getId(s));
45       out.write_ulong(s.minor);
46       org.omg.CORBA.CompletionStatusHelper.write(out,s.completed);
47    }
48
49
50    private static org.omg.CORBA.TypeCode JavaDoc getTypeCode
51       (org.omg.CORBA.SystemException JavaDoc s)
52    {
53       if (s instanceof org.omg.CORBA.BAD_CONTEXT JavaDoc)
54       {
55          return org.omg.CORBA.BAD_CONTEXTHelper.type ();
56       }
57       else if (s instanceof org.omg.CORBA.BAD_INV_ORDER JavaDoc)
58       {
59          return org.omg.CORBA.BAD_INV_ORDERHelper.type ();
60       }
61       else if (s instanceof org.omg.CORBA.BAD_OPERATION JavaDoc)
62       {
63          return org.omg.CORBA.BAD_OPERATIONHelper.type ();
64       }
65       else if (s instanceof org.omg.CORBA.BAD_PARAM JavaDoc)
66       {
67          return org.omg.CORBA.BAD_PARAMHelper.type ();
68       }
69       else if (s instanceof org.omg.CORBA.BAD_TYPECODE JavaDoc)
70       {
71          return org.omg.CORBA.BAD_TYPECODEHelper.type ();
72       }
73       else if (s instanceof org.omg.CORBA.CODESET_INCOMPATIBLE JavaDoc)
74       {
75          return org.omg.CORBA.CODESET_INCOMPATIBLEHelper.type ();
76       }
77       else if (s instanceof org.omg.CORBA.COMM_FAILURE JavaDoc)
78       {
79          return org.omg.CORBA.COMM_FAILUREHelper.type ();
80       }
81       else if (s instanceof org.omg.CORBA.DATA_CONVERSION JavaDoc)
82       {
83          return org.omg.CORBA.DATA_CONVERSIONHelper.type ();
84       }
85       else if (s instanceof org.omg.CORBA.FREE_MEM JavaDoc)
86       {
87          return org.omg.CORBA.FREE_MEMHelper.type ();
88       }
89       else if (s instanceof org.omg.CORBA.IMP_LIMIT JavaDoc)
90       {
91          return org.omg.CORBA.IMP_LIMITHelper.type ();
92       }
93       else if (s instanceof org.omg.CORBA.INITIALIZE JavaDoc)
94       {
95          return org.omg.CORBA.INITIALIZEHelper.type ();
96       }
97       else if (s instanceof org.omg.CORBA.INTERNAL JavaDoc)
98       {
99          return org.omg.CORBA.INTERNALHelper.type ();
100       }
101       else if (s instanceof org.omg.CORBA.INTF_REPOS JavaDoc)
102       {
103          return org.omg.CORBA.INTF_REPOSHelper.type ();
104       }
105       else if (s instanceof org.omg.CORBA.INVALID_TRANSACTION JavaDoc)
106       {
107          return org.omg.CORBA.INVALID_TRANSACTIONHelper.type ();
108       }
109       else if (s instanceof org.omg.CORBA.INV_FLAG JavaDoc)
110       {
111          return org.omg.CORBA.INV_FLAGHelper.type ();
112       }
113       else if (s instanceof org.omg.CORBA.INV_IDENT JavaDoc)
114       {
115          return org.omg.CORBA.INV_IDENTHelper.type ();
116       }
117       else if (s instanceof org.omg.CORBA.INV_OBJREF JavaDoc)
118       {
119          return org.omg.CORBA.INV_OBJREFHelper.type ();
120       }
121       else if (s instanceof org.omg.CORBA.INV_POLICY JavaDoc)
122       {
123          return org.omg.CORBA.INV_POLICYHelper.type ();
124       }
125       else if (s instanceof org.omg.CORBA.MARSHAL JavaDoc)
126       {
127          return org.omg.CORBA.MARSHALHelper.type ();
128       }
129       else if (s instanceof org.omg.CORBA.NO_IMPLEMENT JavaDoc)
130       {
131          return org.omg.CORBA.NO_IMPLEMENTHelper.type ();
132       }
133       else if (s instanceof org.omg.CORBA.NO_MEMORY JavaDoc)
134       {
135          return org.omg.CORBA.NO_MEMORYHelper.type ();
136       }
137       else if (s instanceof org.omg.CORBA.NO_PERMISSION JavaDoc)
138       {
139          return org.omg.CORBA.NO_PERMISSIONHelper.type ();
140       }
141       else if (s instanceof org.omg.CORBA.NO_RESOURCES JavaDoc)
142       {
143          return org.omg.CORBA.NO_RESOURCESHelper.type ();
144       }
145       else if (s instanceof org.omg.CORBA.NO_RESPONSE JavaDoc)
146       {
147          return org.omg.CORBA.NO_RESPONSEHelper.type ();
148       }
149       else if (s instanceof org.omg.CORBA.OBJECT_NOT_EXIST JavaDoc)
150       {
151          return org.omg.CORBA.OBJECT_NOT_EXISTHelper.type ();
152       }
153       else if (s instanceof org.omg.CORBA.OBJ_ADAPTER JavaDoc)
154       {
155          return org.omg.CORBA.OBJ_ADAPTERHelper.type ();
156       }
157       else if (s instanceof org.omg.CORBA.PERSIST_STORE JavaDoc)
158       {
159          return org.omg.CORBA.PERSIST_STOREHelper.type ();
160       }
161       else if (s instanceof org.omg.CORBA.TRANSACTION_MODE JavaDoc)
162       {
163          return org.omg.CORBA.TRANSACTION_MODEHelper.type ();
164       }
165       else if (s instanceof org.omg.CORBA.TRANSACTION_REQUIRED JavaDoc)
166       {
167          return org.omg.CORBA.TRANSACTION_REQUIREDHelper.type ();
168       }
169       else if (s instanceof org.omg.CORBA.TRANSACTION_ROLLEDBACK JavaDoc)
170       {
171          return org.omg.CORBA.TRANSACTION_ROLLEDBACKHelper.type ();
172       }
173       else if (s instanceof org.omg.CORBA.TRANSACTION_UNAVAILABLE JavaDoc)
174       {
175          return org.omg.CORBA.TRANSACTION_UNAVAILABLEHelper.type ();
176       }
177       else if (s instanceof org.omg.CORBA.TRANSIENT JavaDoc)
178       {
179          return org.omg.CORBA.TRANSIENTHelper.type ();
180       }
181       else if (s instanceof org.omg.CORBA.UNKNOWN JavaDoc)
182       {
183          return org.omg.CORBA.UNKNOWNHelper.type ();
184       }
185       else
186       {
187          throw new org.omg.CORBA.BAD_PARAM JavaDoc ("unrecognized system exception: " + s.getClass ().getName ());
188       }
189    }
190
191
192    private static String JavaDoc getId (org.omg.CORBA.SystemException JavaDoc s)
193    {
194       if (s instanceof org.omg.CORBA.BAD_CONTEXT JavaDoc)
195       {
196          return org.omg.CORBA.BAD_CONTEXTHelper.id ();
197       }
198       else if (s instanceof org.omg.CORBA.BAD_INV_ORDER JavaDoc)
199       {
200          return org.omg.CORBA.BAD_INV_ORDERHelper.id ();
201       }
202       else if (s instanceof org.omg.CORBA.BAD_OPERATION JavaDoc)
203       {
204          return org.omg.CORBA.BAD_OPERATIONHelper.id ();
205       }
206       else if (s instanceof org.omg.CORBA.BAD_PARAM JavaDoc)
207       {
208          return org.omg.CORBA.BAD_PARAMHelper.id ();
209       }
210       else if (s instanceof org.omg.CORBA.BAD_TYPECODE JavaDoc)
211       {
212          return org.omg.CORBA.BAD_TYPECODEHelper.id ();
213       }
214       else if (s instanceof org.omg.CORBA.CODESET_INCOMPATIBLE JavaDoc)
215       {
216          return org.omg.CORBA.CODESET_INCOMPATIBLEHelper.id ();
217       }
218       else if (s instanceof org.omg.CORBA.COMM_FAILURE JavaDoc)
219       {
220          return org.omg.CORBA.COMM_FAILUREHelper.id ();
221       }
222       else if (s instanceof org.omg.CORBA.DATA_CONVERSION JavaDoc)
223       {
224          return org.omg.CORBA.DATA_CONVERSIONHelper.id ();
225       }
226       else if (s instanceof org.omg.CORBA.FREE_MEM JavaDoc)
227       {
228          return org.omg.CORBA.FREE_MEMHelper.id ();
229       }
230       else if (s instanceof org.omg.CORBA.IMP_LIMIT JavaDoc)
231       {
232          return org.omg.CORBA.IMP_LIMITHelper.id ();
233       }
234       else if (s instanceof org.omg.CORBA.INITIALIZE JavaDoc)
235       {
236          return org.omg.CORBA.INITIALIZEHelper.id ();
237       }
238       else if (s instanceof org.omg.CORBA.INTERNAL JavaDoc)
239       {
240          return org.omg.CORBA.INTERNALHelper.id ();
241       }
242       else if (s instanceof org.omg.CORBA.INTF_REPOS JavaDoc)
243       {
244          return org.omg.CORBA.INTF_REPOSHelper.id ();
245       }
246       else if (s instanceof org.omg.CORBA.INVALID_TRANSACTION JavaDoc)
247       {
248          return org.omg.CORBA.INVALID_TRANSACTIONHelper.id ();
249       }
250       else if (s instanceof org.omg.CORBA.INV_FLAG JavaDoc)
251       {
252          return org.omg.CORBA.INV_FLAGHelper.id ();
253       }
254       else if (s instanceof org.omg.CORBA.INV_IDENT JavaDoc)
255       {
256          return org.omg.CORBA.INV_IDENTHelper.id ();
257       }
258       else if (s instanceof org.omg.CORBA.INV_OBJREF JavaDoc)
259       {
260          return org.omg.CORBA.INV_OBJREFHelper.id ();
261       }
262       else if (s instanceof org.omg.CORBA.INV_POLICY JavaDoc)
263       {
264          return org.omg.CORBA.INV_POLICYHelper.id ();
265       }
266       else if (s instanceof org.omg.CORBA.MARSHAL JavaDoc)
267       {
268          return org.omg.CORBA.MARSHALHelper.id ();
269       }
270       else if (s instanceof org.omg.CORBA.NO_IMPLEMENT JavaDoc)
271       {
272          return org.omg.CORBA.NO_IMPLEMENTHelper.id ();
273       }
274       else if (s instanceof org.omg.CORBA.NO_MEMORY JavaDoc)
275       {
276          return org.omg.CORBA.NO_MEMORYHelper.id ();
277       }
278       else if (s instanceof org.omg.CORBA.NO_PERMISSION JavaDoc)
279       {
280          return org.omg.CORBA.NO_PERMISSIONHelper.id ();
281       }
282       else if (s instanceof org.omg.CORBA.NO_RESOURCES JavaDoc)
283       {
284          return org.omg.CORBA.NO_RESOURCESHelper.id ();
285       }
286       else if (s instanceof org.omg.CORBA.NO_RESPONSE JavaDoc)
287       {
288          return org.omg.CORBA.NO_RESPONSEHelper.id ();
289       }
290       else if (s instanceof org.omg.CORBA.OBJECT_NOT_EXIST JavaDoc)
291       {
292          return org.omg.CORBA.OBJECT_NOT_EXISTHelper.id ();
293       }
294       else if (s instanceof org.omg.CORBA.OBJ_ADAPTER JavaDoc)
295       {
296          return org.omg.CORBA.OBJ_ADAPTERHelper.id ();
297       }
298       else if (s instanceof org.omg.CORBA.PERSIST_STORE JavaDoc)
299       {
300          return org.omg.CORBA.PERSIST_STOREHelper.id ();
301       }
302       else if (s instanceof org.omg.CORBA.TRANSACTION_MODE JavaDoc)
303       {
304          return org.omg.CORBA.TRANSACTION_MODEHelper.id ();
305       }
306       else if (s instanceof org.omg.CORBA.TRANSACTION_REQUIRED JavaDoc)
307       {
308          return org.omg.CORBA.TRANSACTION_REQUIREDHelper.id ();
309       }
310       else if (s instanceof org.omg.CORBA.TRANSACTION_ROLLEDBACK JavaDoc)
311       {
312          return org.omg.CORBA.TRANSACTION_ROLLEDBACKHelper.id ();
313       }
314       else if (s instanceof org.omg.CORBA.TRANSACTION_UNAVAILABLE JavaDoc)
315       {
316          return org.omg.CORBA.TRANSACTION_UNAVAILABLEHelper.id ();
317       }
318       else if (s instanceof org.omg.CORBA.TRANSIENT JavaDoc)
319       {
320          return org.omg.CORBA.TRANSIENTHelper.id ();
321       }
322       else if (s instanceof org.omg.CORBA.UNKNOWN JavaDoc)
323       {
324          return org.omg.CORBA.UNKNOWNHelper.id ();
325       }
326       else
327       {
328          throw new org.omg.CORBA.BAD_PARAM JavaDoc ("unrecognized system exception: " + s.getClass ().getName ());
329       }
330    }
331
332
333    private static org.omg.CORBA.SystemException JavaDoc getSystemException (String JavaDoc id)
334    {
335       if (id.equals (org.omg.CORBA.BAD_CONTEXTHelper.id ()))
336       {
337          return new org.omg.CORBA.BAD_CONTEXT JavaDoc ();
338       }
339       else if (id.equals (org.omg.CORBA.BAD_INV_ORDERHelper.id ()))
340       {
341          return new org.omg.CORBA.BAD_INV_ORDER JavaDoc ();
342       }
343       else if (id.equals (org.omg.CORBA.BAD_OPERATIONHelper.id ()))
344       {
345          return new org.omg.CORBA.BAD_OPERATION JavaDoc ();
346       }
347       else if (id.equals (org.omg.CORBA.BAD_PARAMHelper.id ()))
348       {
349          return new org.omg.CORBA.BAD_PARAM JavaDoc ();
350       }
351       else if (id.equals (org.omg.CORBA.BAD_TYPECODEHelper.id ()))
352       {
353          return new org.omg.CORBA.BAD_TYPECODE JavaDoc ();
354       }
355       else if (id.equals (org.omg.CORBA.CODESET_INCOMPATIBLEHelper.id ()))
356       {
357          return new org.omg.CORBA.CODESET_INCOMPATIBLE JavaDoc ();
358       }
359       else if (id.equals (org.omg.CORBA.COMM_FAILUREHelper.id ()))
360       {
361          return new org.omg.CORBA.COMM_FAILURE JavaDoc ();
362       }
363       else if (id.equals (org.omg.CORBA.DATA_CONVERSIONHelper.id ()))
364       {
365          return new org.omg.CORBA.DATA_CONVERSION JavaDoc ();
366       }
367       else if (id.equals (org.omg.CORBA.FREE_MEMHelper.id ()))
368       {
369          return new org.omg.CORBA.FREE_MEM JavaDoc ();
370       }
371       else if (id.equals (org.omg.CORBA.IMP_LIMITHelper.id ()))
372       {
373          return new org.omg.CORBA.IMP_LIMIT JavaDoc ();
374       }
375       else if (id.equals (org.omg.CORBA.INITIALIZEHelper.id ()))
376       {
377          return new org.omg.CORBA.INITIALIZE JavaDoc ();
378       }
379       else if (id.equals (org.omg.CORBA.INTERNALHelper.id ()))
380       {
381          return new org.omg.CORBA.INTERNAL JavaDoc ();
382       }
383       else if (id.equals (org.omg.CORBA.INTF_REPOSHelper.id ()))
384       {
385          return new org.omg.CORBA.INTF_REPOS JavaDoc ();
386       }
387       else if (id.equals (org.omg.CORBA.INVALID_TRANSACTIONHelper.id ()))
388       {
389          return new org.omg.CORBA.INVALID_TRANSACTION JavaDoc ();
390       }
391       else if (id.equals (org.omg.CORBA.INV_FLAGHelper.id ()))
392       {
393          return new org.omg.CORBA.INV_FLAG JavaDoc ();
394       }
395       else if (id.equals (org.omg.CORBA.INV_IDENTHelper.id ()))
396       {
397          return new org.omg.CORBA.INV_IDENT JavaDoc ();
398       }
399       else if (id.equals (org.omg.CORBA.INV_OBJREFHelper.id ()))
400       {
401          return new org.omg.CORBA.INV_OBJREF JavaDoc ();
402       }
403       else if (id.equals (org.omg.CORBA.INV_POLICYHelper.id ()))
404       {
405          return new org.omg.CORBA.INV_POLICY JavaDoc ();
406       }
407       else if (id.equals (org.omg.CORBA.MARSHALHelper.id ()))
408       {
409          return new org.omg.CORBA.MARSHAL JavaDoc ();
410       }
411       else if (id.equals (org.omg.CORBA.NO_IMPLEMENTHelper.id ()))
412       {
413          return new org.omg.CORBA.NO_IMPLEMENT JavaDoc ();
414       }
415       else if (id.equals (org.omg.CORBA.NO_MEMORYHelper.id ()))
416       {
417          return new org.omg.CORBA.NO_MEMORY JavaDoc ();
418       }
419       else if (id.equals (org.omg.CORBA.NO_PERMISSIONHelper.id ()))
420       {
421          return new org.omg.CORBA.NO_PERMISSION JavaDoc ();
422       }
423       else if (id.equals (org.omg.CORBA.NO_RESOURCESHelper.id ()))
424       {
425          return new org.omg.CORBA.NO_RESOURCES JavaDoc ();
426       }
427       else if (id.equals (org.omg.CORBA.NO_RESPONSEHelper.id ()))
428       {
429          return new org.omg.CORBA.NO_RESPONSE JavaDoc ();
430       }
431       else if (id.equals (org.omg.CORBA.OBJECT_NOT_EXISTHelper.id ()))
432       {
433          return new org.omg.CORBA.OBJECT_NOT_EXIST JavaDoc ();
434       }
435       else if (id.equals (org.omg.CORBA.OBJ_ADAPTERHelper.id ()))
436       {
437          return new org.omg.CORBA.OBJ_ADAPTER JavaDoc ();
438       }
439       else if (id.equals (org.omg.CORBA.PERSIST_STOREHelper.id ()))
440       {
441          return new org.omg.CORBA.PERSIST_STORE JavaDoc ();
442       }
443       else if (id.equals (org.omg.CORBA.TRANSACTION_MODEHelper.id ()))
444       {
445          return new org.omg.CORBA.TRANSACTION_MODE JavaDoc ();
446       }
447       else if (id.equals (org.omg.CORBA.TRANSACTION_REQUIREDHelper.id ()))
448       {
449          return new org.omg.CORBA.TRANSACTION_REQUIRED JavaDoc ();
450       }
451       else if (id.equals (org.omg.CORBA.TRANSACTION_ROLLEDBACKHelper.id ()))
452       {
453          return new org.omg.CORBA.TRANSACTION_ROLLEDBACK JavaDoc ();
454       }
455       else if (id.equals (org.omg.CORBA.TRANSACTION_UNAVAILABLEHelper.id ()))
456       {
457          return new org.omg.CORBA.TRANSACTION_UNAVAILABLE JavaDoc ();
458       }
459       else if (id.equals (org.omg.CORBA.TRANSIENTHelper.id ()))
460       {
461          return new org.omg.CORBA.TRANSIENT JavaDoc ();
462       }
463       else if (id.equals (org.omg.CORBA.UNKNOWNHelper.id ()))
464       {
465          return new org.omg.CORBA.UNKNOWN JavaDoc ();
466       }
467       else
468       {
469          throw new org.omg.CORBA.MARSHAL JavaDoc("wrong or unrecognized id: " + id);
470       }
471    }
472 }
473
Popular Tags