001: package org.omg.CORBA;
002:
003: /**
004: * Custom Helper class for CORBA System Exceptions.
005: */
006:
007: public final class SystemExceptionHelper {
008: private static org.omg.CORBA.TypeCode _type = org.omg.CORBA.ORB
009: .init()
010: .create_exception_tc(
011: org.omg.CORBA.SystemExceptionHelper.id(),
012: "SystemException",
013: new org.omg.CORBA.StructMember[] {
014: new org.omg.CORBA.StructMember(
015: "minor",
016: org.omg.CORBA.ORB
017: .init()
018: .get_primitive_tc(
019: org.omg.CORBA.TCKind
020: .from_int(5)),
021: null),
022: new org.omg.CORBA.StructMember(
023: "completed",
024: org.omg.CORBA.ORB
025: .init()
026: .create_enum_tc(
027: org.omg.CORBA.CompletionStatusHelper
028: .id(),
029: "CompletionStatus",
030: new String[] {
031: "COMPLETED_YES",
032: "COMPLETED_NO",
033: "COMPLETED_MAYBE" }),
034: null) });
035:
036: public static void insert(org.omg.CORBA.Any any,
037: org.omg.CORBA.SystemException s) {
038: any.type(getTypeCode(s));
039: write(any.create_output_stream(), s);
040: }
041:
042: public static org.omg.CORBA.SystemException extract(
043: org.omg.CORBA.Any any) {
044: return read(any.create_input_stream());
045: }
046:
047: public static org.omg.CORBA.TypeCode type() {
048: return _type;
049: }
050:
051: public static String id() {
052: return "IDL:omg.org/CORBA/SystemException:1.0";
053: }
054:
055: public static org.omg.CORBA.SystemException read(
056: org.omg.CORBA.portable.InputStream in) {
057: String id = in.read_string();
058: org.omg.CORBA.SystemException result = getSystemException(id);
059: result.minor = in.read_ulong();
060: result.completed = org.omg.CORBA.CompletionStatusHelper
061: .read(in);
062: return result;
063: }
064:
065: public static void write(org.omg.CORBA.portable.OutputStream out,
066: org.omg.CORBA.SystemException s) {
067: out.write_string(getId(s));
068: out.write_ulong(s.minor);
069: org.omg.CORBA.CompletionStatusHelper.write(out, s.completed);
070: }
071:
072: private static org.omg.CORBA.TypeCode getTypeCode(
073: org.omg.CORBA.SystemException s) {
074: if (s instanceof org.omg.CORBA.BAD_CONTEXT) {
075: return org.omg.CORBA.BAD_CONTEXTHelper.type();
076: } else if (s instanceof org.omg.CORBA.BAD_INV_ORDER) {
077: return org.omg.CORBA.BAD_INV_ORDERHelper.type();
078: } else if (s instanceof org.omg.CORBA.BAD_OPERATION) {
079: return org.omg.CORBA.BAD_OPERATIONHelper.type();
080: } else if (s instanceof org.omg.CORBA.BAD_PARAM) {
081: return org.omg.CORBA.BAD_PARAMHelper.type();
082: } else if (s instanceof org.omg.CORBA.BAD_TYPECODE) {
083: return org.omg.CORBA.BAD_TYPECODEHelper.type();
084: } else if (s instanceof org.omg.CORBA.CODESET_INCOMPATIBLE) {
085: return org.omg.CORBA.CODESET_INCOMPATIBLEHelper.type();
086: } else if (s instanceof org.omg.CORBA.COMM_FAILURE) {
087: return org.omg.CORBA.COMM_FAILUREHelper.type();
088: } else if (s instanceof org.omg.CORBA.DATA_CONVERSION) {
089: return org.omg.CORBA.DATA_CONVERSIONHelper.type();
090: } else if (s instanceof org.omg.CORBA.FREE_MEM) {
091: return org.omg.CORBA.FREE_MEMHelper.type();
092: } else if (s instanceof org.omg.CORBA.IMP_LIMIT) {
093: return org.omg.CORBA.IMP_LIMITHelper.type();
094: } else if (s instanceof org.omg.CORBA.INITIALIZE) {
095: return org.omg.CORBA.INITIALIZEHelper.type();
096: } else if (s instanceof org.omg.CORBA.INTERNAL) {
097: return org.omg.CORBA.INTERNALHelper.type();
098: } else if (s instanceof org.omg.CORBA.INTF_REPOS) {
099: return org.omg.CORBA.INTF_REPOSHelper.type();
100: } else if (s instanceof org.omg.CORBA.INVALID_TRANSACTION) {
101: return org.omg.CORBA.INVALID_TRANSACTIONHelper.type();
102: } else if (s instanceof org.omg.CORBA.INV_FLAG) {
103: return org.omg.CORBA.INV_FLAGHelper.type();
104: } else if (s instanceof org.omg.CORBA.INV_IDENT) {
105: return org.omg.CORBA.INV_IDENTHelper.type();
106: } else if (s instanceof org.omg.CORBA.INV_OBJREF) {
107: return org.omg.CORBA.INV_OBJREFHelper.type();
108: } else if (s instanceof org.omg.CORBA.INV_POLICY) {
109: return org.omg.CORBA.INV_POLICYHelper.type();
110: } else if (s instanceof org.omg.CORBA.MARSHAL) {
111: return org.omg.CORBA.MARSHALHelper.type();
112: } else if (s instanceof org.omg.CORBA.NO_IMPLEMENT) {
113: return org.omg.CORBA.NO_IMPLEMENTHelper.type();
114: } else if (s instanceof org.omg.CORBA.NO_MEMORY) {
115: return org.omg.CORBA.NO_MEMORYHelper.type();
116: } else if (s instanceof org.omg.CORBA.NO_PERMISSION) {
117: return org.omg.CORBA.NO_PERMISSIONHelper.type();
118: } else if (s instanceof org.omg.CORBA.NO_RESOURCES) {
119: return org.omg.CORBA.NO_RESOURCESHelper.type();
120: } else if (s instanceof org.omg.CORBA.NO_RESPONSE) {
121: return org.omg.CORBA.NO_RESPONSEHelper.type();
122: } else if (s instanceof org.omg.CORBA.OBJECT_NOT_EXIST) {
123: return org.omg.CORBA.OBJECT_NOT_EXISTHelper.type();
124: } else if (s instanceof org.omg.CORBA.OBJ_ADAPTER) {
125: return org.omg.CORBA.OBJ_ADAPTERHelper.type();
126: } else if (s instanceof org.omg.CORBA.PERSIST_STORE) {
127: return org.omg.CORBA.PERSIST_STOREHelper.type();
128: } else if (s instanceof org.omg.CORBA.TRANSACTION_MODE) {
129: return org.omg.CORBA.TRANSACTION_MODEHelper.type();
130: } else if (s instanceof org.omg.CORBA.TRANSACTION_REQUIRED) {
131: return org.omg.CORBA.TRANSACTION_REQUIREDHelper.type();
132: } else if (s instanceof org.omg.CORBA.TRANSACTION_ROLLEDBACK) {
133: return org.omg.CORBA.TRANSACTION_ROLLEDBACKHelper.type();
134: } else if (s instanceof org.omg.CORBA.TRANSACTION_UNAVAILABLE) {
135: return org.omg.CORBA.TRANSACTION_UNAVAILABLEHelper.type();
136: } else if (s instanceof org.omg.CORBA.TRANSIENT) {
137: return org.omg.CORBA.TRANSIENTHelper.type();
138: } else if (s instanceof org.omg.CORBA.UNKNOWN) {
139: return org.omg.CORBA.UNKNOWNHelper.type();
140: } else {
141: throw new org.omg.CORBA.BAD_PARAM(
142: "unrecognized system exception: "
143: + s.getClass().getName());
144: }
145: }
146:
147: private static String getId(org.omg.CORBA.SystemException s) {
148: if (s instanceof org.omg.CORBA.BAD_CONTEXT) {
149: return org.omg.CORBA.BAD_CONTEXTHelper.id();
150: } else if (s instanceof org.omg.CORBA.BAD_INV_ORDER) {
151: return org.omg.CORBA.BAD_INV_ORDERHelper.id();
152: } else if (s instanceof org.omg.CORBA.BAD_OPERATION) {
153: return org.omg.CORBA.BAD_OPERATIONHelper.id();
154: } else if (s instanceof org.omg.CORBA.BAD_PARAM) {
155: return org.omg.CORBA.BAD_PARAMHelper.id();
156: } else if (s instanceof org.omg.CORBA.BAD_TYPECODE) {
157: return org.omg.CORBA.BAD_TYPECODEHelper.id();
158: } else if (s instanceof org.omg.CORBA.CODESET_INCOMPATIBLE) {
159: return org.omg.CORBA.CODESET_INCOMPATIBLEHelper.id();
160: } else if (s instanceof org.omg.CORBA.COMM_FAILURE) {
161: return org.omg.CORBA.COMM_FAILUREHelper.id();
162: } else if (s instanceof org.omg.CORBA.DATA_CONVERSION) {
163: return org.omg.CORBA.DATA_CONVERSIONHelper.id();
164: } else if (s instanceof org.omg.CORBA.FREE_MEM) {
165: return org.omg.CORBA.FREE_MEMHelper.id();
166: } else if (s instanceof org.omg.CORBA.IMP_LIMIT) {
167: return org.omg.CORBA.IMP_LIMITHelper.id();
168: } else if (s instanceof org.omg.CORBA.INITIALIZE) {
169: return org.omg.CORBA.INITIALIZEHelper.id();
170: } else if (s instanceof org.omg.CORBA.INTERNAL) {
171: return org.omg.CORBA.INTERNALHelper.id();
172: } else if (s instanceof org.omg.CORBA.INTF_REPOS) {
173: return org.omg.CORBA.INTF_REPOSHelper.id();
174: } else if (s instanceof org.omg.CORBA.INVALID_TRANSACTION) {
175: return org.omg.CORBA.INVALID_TRANSACTIONHelper.id();
176: } else if (s instanceof org.omg.CORBA.INV_FLAG) {
177: return org.omg.CORBA.INV_FLAGHelper.id();
178: } else if (s instanceof org.omg.CORBA.INV_IDENT) {
179: return org.omg.CORBA.INV_IDENTHelper.id();
180: } else if (s instanceof org.omg.CORBA.INV_OBJREF) {
181: return org.omg.CORBA.INV_OBJREFHelper.id();
182: } else if (s instanceof org.omg.CORBA.INV_POLICY) {
183: return org.omg.CORBA.INV_POLICYHelper.id();
184: } else if (s instanceof org.omg.CORBA.MARSHAL) {
185: return org.omg.CORBA.MARSHALHelper.id();
186: } else if (s instanceof org.omg.CORBA.NO_IMPLEMENT) {
187: return org.omg.CORBA.NO_IMPLEMENTHelper.id();
188: } else if (s instanceof org.omg.CORBA.NO_MEMORY) {
189: return org.omg.CORBA.NO_MEMORYHelper.id();
190: } else if (s instanceof org.omg.CORBA.NO_PERMISSION) {
191: return org.omg.CORBA.NO_PERMISSIONHelper.id();
192: } else if (s instanceof org.omg.CORBA.NO_RESOURCES) {
193: return org.omg.CORBA.NO_RESOURCESHelper.id();
194: } else if (s instanceof org.omg.CORBA.NO_RESPONSE) {
195: return org.omg.CORBA.NO_RESPONSEHelper.id();
196: } else if (s instanceof org.omg.CORBA.OBJECT_NOT_EXIST) {
197: return org.omg.CORBA.OBJECT_NOT_EXISTHelper.id();
198: } else if (s instanceof org.omg.CORBA.OBJ_ADAPTER) {
199: return org.omg.CORBA.OBJ_ADAPTERHelper.id();
200: } else if (s instanceof org.omg.CORBA.PERSIST_STORE) {
201: return org.omg.CORBA.PERSIST_STOREHelper.id();
202: } else if (s instanceof org.omg.CORBA.TRANSACTION_MODE) {
203: return org.omg.CORBA.TRANSACTION_MODEHelper.id();
204: } else if (s instanceof org.omg.CORBA.TRANSACTION_REQUIRED) {
205: return org.omg.CORBA.TRANSACTION_REQUIREDHelper.id();
206: } else if (s instanceof org.omg.CORBA.TRANSACTION_ROLLEDBACK) {
207: return org.omg.CORBA.TRANSACTION_ROLLEDBACKHelper.id();
208: } else if (s instanceof org.omg.CORBA.TRANSACTION_UNAVAILABLE) {
209: return org.omg.CORBA.TRANSACTION_UNAVAILABLEHelper.id();
210: } else if (s instanceof org.omg.CORBA.TRANSIENT) {
211: return org.omg.CORBA.TRANSIENTHelper.id();
212: } else if (s instanceof org.omg.CORBA.UNKNOWN) {
213: return org.omg.CORBA.UNKNOWNHelper.id();
214: } else {
215: throw new org.omg.CORBA.BAD_PARAM(
216: "unrecognized system exception: "
217: + s.getClass().getName());
218: }
219: }
220:
221: private static org.omg.CORBA.SystemException getSystemException(
222: String id) {
223: if (id.equals(org.omg.CORBA.BAD_CONTEXTHelper.id())) {
224: return new org.omg.CORBA.BAD_CONTEXT();
225: } else if (id.equals(org.omg.CORBA.BAD_INV_ORDERHelper.id())) {
226: return new org.omg.CORBA.BAD_INV_ORDER();
227: } else if (id.equals(org.omg.CORBA.BAD_OPERATIONHelper.id())) {
228: return new org.omg.CORBA.BAD_OPERATION();
229: } else if (id.equals(org.omg.CORBA.BAD_PARAMHelper.id())) {
230: return new org.omg.CORBA.BAD_PARAM();
231: } else if (id.equals(org.omg.CORBA.BAD_TYPECODEHelper.id())) {
232: return new org.omg.CORBA.BAD_TYPECODE();
233: } else if (id.equals(org.omg.CORBA.CODESET_INCOMPATIBLEHelper
234: .id())) {
235: return new org.omg.CORBA.CODESET_INCOMPATIBLE();
236: } else if (id.equals(org.omg.CORBA.COMM_FAILUREHelper.id())) {
237: return new org.omg.CORBA.COMM_FAILURE();
238: } else if (id.equals(org.omg.CORBA.DATA_CONVERSIONHelper.id())) {
239: return new org.omg.CORBA.DATA_CONVERSION();
240: } else if (id.equals(org.omg.CORBA.FREE_MEMHelper.id())) {
241: return new org.omg.CORBA.FREE_MEM();
242: } else if (id.equals(org.omg.CORBA.IMP_LIMITHelper.id())) {
243: return new org.omg.CORBA.IMP_LIMIT();
244: } else if (id.equals(org.omg.CORBA.INITIALIZEHelper.id())) {
245: return new org.omg.CORBA.INITIALIZE();
246: } else if (id.equals(org.omg.CORBA.INTERNALHelper.id())) {
247: return new org.omg.CORBA.INTERNAL();
248: } else if (id.equals(org.omg.CORBA.INTF_REPOSHelper.id())) {
249: return new org.omg.CORBA.INTF_REPOS();
250: } else if (id.equals(org.omg.CORBA.INVALID_TRANSACTIONHelper
251: .id())) {
252: return new org.omg.CORBA.INVALID_TRANSACTION();
253: } else if (id.equals(org.omg.CORBA.INV_FLAGHelper.id())) {
254: return new org.omg.CORBA.INV_FLAG();
255: } else if (id.equals(org.omg.CORBA.INV_IDENTHelper.id())) {
256: return new org.omg.CORBA.INV_IDENT();
257: } else if (id.equals(org.omg.CORBA.INV_OBJREFHelper.id())) {
258: return new org.omg.CORBA.INV_OBJREF();
259: } else if (id.equals(org.omg.CORBA.INV_POLICYHelper.id())) {
260: return new org.omg.CORBA.INV_POLICY();
261: } else if (id.equals(org.omg.CORBA.MARSHALHelper.id())) {
262: return new org.omg.CORBA.MARSHAL();
263: } else if (id.equals(org.omg.CORBA.NO_IMPLEMENTHelper.id())) {
264: return new org.omg.CORBA.NO_IMPLEMENT();
265: } else if (id.equals(org.omg.CORBA.NO_MEMORYHelper.id())) {
266: return new org.omg.CORBA.NO_MEMORY();
267: } else if (id.equals(org.omg.CORBA.NO_PERMISSIONHelper.id())) {
268: return new org.omg.CORBA.NO_PERMISSION();
269: } else if (id.equals(org.omg.CORBA.NO_RESOURCESHelper.id())) {
270: return new org.omg.CORBA.NO_RESOURCES();
271: } else if (id.equals(org.omg.CORBA.NO_RESPONSEHelper.id())) {
272: return new org.omg.CORBA.NO_RESPONSE();
273: } else if (id.equals(org.omg.CORBA.OBJECT_NOT_EXISTHelper.id())) {
274: return new org.omg.CORBA.OBJECT_NOT_EXIST();
275: } else if (id.equals(org.omg.CORBA.OBJ_ADAPTERHelper.id())) {
276: return new org.omg.CORBA.OBJ_ADAPTER();
277: } else if (id.equals(org.omg.CORBA.PERSIST_STOREHelper.id())) {
278: return new org.omg.CORBA.PERSIST_STORE();
279: } else if (id.equals(org.omg.CORBA.TRANSACTION_MODEHelper.id())) {
280: return new org.omg.CORBA.TRANSACTION_MODE();
281: } else if (id.equals(org.omg.CORBA.TRANSACTION_REQUIREDHelper
282: .id())) {
283: return new org.omg.CORBA.TRANSACTION_REQUIRED();
284: } else if (id.equals(org.omg.CORBA.TRANSACTION_ROLLEDBACKHelper
285: .id())) {
286: return new org.omg.CORBA.TRANSACTION_ROLLEDBACK();
287: } else if (id
288: .equals(org.omg.CORBA.TRANSACTION_UNAVAILABLEHelper
289: .id())) {
290: return new org.omg.CORBA.TRANSACTION_UNAVAILABLE();
291: } else if (id.equals(org.omg.CORBA.TRANSIENTHelper.id())) {
292: return new org.omg.CORBA.TRANSIENT();
293: } else if (id.equals(org.omg.CORBA.UNKNOWNHelper.id())) {
294: return new org.omg.CORBA.UNKNOWN();
295: } else {
296: throw new org.omg.CORBA.MARSHAL(
297: "wrong or unrecognized id: " + id);
298: }
299: }
300: }
|