KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > corba > poa > SharkCORBAUtilities


1 package org.enhydra.shark.corba.poa;
2
3 import org.omg.WfBase.*;
4 import org.omg.WorkflowModel.*;
5 import org.enhydra.shark.corba.WorkflowService.*;
6 import org.enhydra.shark.corba.poa.ApplicationMapCORBA;
7 import org.enhydra.shark.corba.poa.Collective;
8 import org.enhydra.shark.corba.poa.ParticipantMapCORBA;
9 import org.omg.CORBA.*;
10 import org.omg.PortableServer.POA JavaDoc;
11 import org.omg.PortableServer.POAHelper JavaDoc;
12 import org.omg.PortableServer.POAPackage.ServantAlreadyActive JavaDoc;
13 import org.omg.PortableServer.POAPackage.WrongPolicy JavaDoc;
14 import org.omg.PortableServer.POAPackage.ServantNotActive JavaDoc;
15
16 import java.util.*;
17
18 import org.enhydra.shark.utilities.SequencedHashMap;
19
20 import java.io.Serializable JavaDoc;
21
22 /**
23  * The various utilities needed by engine.
24  *
25  * @author David Forslund
26  * @version 1.1
27  */

28 public class SharkCORBAUtilities {
29
30     static POA JavaDoc rootPOA;
31     static ORB orb;
32
33     static void setPOA(POA JavaDoc poa) {
34         rootPOA = poa;
35     }
36     static void setORB(ORB the_orb) {
37         orb = the_orb;
38     }
39     static POA JavaDoc getPOA() {
40         return rootPOA;
41     }
42     static NameValueInfo makeCORBANameValueInfo(String JavaDoc attribute_name,
43                                                 String JavaDoc type_name) {
44         NameValueInfo nvic = new NameValueInfo();
45         nvic.attribute_name = attribute_name;
46         nvic.type_name = type_name;
47         return nvic;
48     }
49
50     static NameValueInfo[] makeCORBANameValueInfoArray(Map nvia) {
51         int size = 0;
52         if (nvia != null) size = nvia.size();
53         NameValueInfo[] nvica = new NameValueInfo[size];
54         int i = 0;
55         if (nvia != null) {
56             for (Iterator it = nvia.entrySet().iterator(); it.hasNext(); i++) {
57                 Map.Entry me = (Map.Entry) it.next();
58                 nvica[i] = makeCORBANameValueInfo(me.getKey().toString(),
59                         me.getValue().toString());
60             }
61         }
62         return nvica;
63     }
64
65     static NameValue makeCORBANameValue(ORB orb,
66                                         String JavaDoc the_name,
67                                         java.lang.Object JavaDoc the_value) {
68         NameValue nvc = new NameValue();
69         nvc.the_name = the_name;
70         nvc.the_value = createAnyFromValue(orb, the_value);
71         return nvc;
72     }
73
74     static NameValue[] makeCORBANameValueArray(ORB orb, Map nva) {
75         int size = 0;
76         if (nva != null) size = nva.size();
77         NameValue[] nvca = new NameValue[size];
78         int i = 0;
79         if (nva != null) {
80             for (Iterator it = nva.entrySet().iterator(); it.hasNext(); i++) {
81                 Map.Entry me = (Map.Entry) it.next();
82                 nvca[i] = makeCORBANameValue(orb,
83                         me.getKey().toString(),
84                         me.getValue());
85             }
86         }
87         return nvca;
88     }
89
90     static NameValue[] makeCORBANameValueArray(ORB orb, String JavaDoc[][] nva) {
91         int size = 0;
92         if (nva != null) size = nva.length;
93
94         NameValue[] nvca = new NameValue[size];
95         if (nva != null) {
96             for (int i = 0; i < size; i++) {
97                 nvca[i] = makeCORBANameValue(orb, nva[i][0], nva[i][1]);
98             }
99         }
100         return nvca;
101     }
102
103     static NameValue[] makeCORBANameValueArray(ORB orb, Properties props) {
104         int size = 0;
105         if (props != null) size = props.size();
106         NameValue[] nvca = new NameValue[size];
107         if (props != null) {
108             Iterator it = props.entrySet().iterator();
109             int i = 0;
110             while (it.hasNext()) {
111                 Map.Entry me = (Map.Entry) it.next();
112                 nvca[i] = makeCORBANameValue(orb,
113                         (String JavaDoc) me.getKey(),
114                         (String JavaDoc) me.getValue());
115                 i++;
116             }
117         }
118         return nvca;
119     }
120
121     static Map makeMap(NameValue[] nvca) {
122         Map m = new SequencedHashMap();
123         if (nvca != null) {
124             for (int i = 0; i < nvca.length; i++) {
125                 m.put(nvca[i].the_name, extractValueFromAny(nvca[i].the_value));
126             }
127         }
128         return m;
129     }
130
131     static DeadlineInfo[] makeDeadlineInfoArray(org.enhydra.shark.api.common.DeadlineInfo[] di) {
132         DeadlineInfo[] cdi = new DeadlineInfo[di.length];
133         for (int i = 0; i < di.length; i++) {
134             cdi[i] = new DeadlineInfo();
135             cdi[i].procId = di[i].procId;
136             cdi[i].actId = di[i].actId;
137             cdi[i].isExecuted = di[i].isExecuted;
138             cdi[i].timeLimit = di[i].timeLimit;
139             cdi[i].exceptionName = di[i].exceptionName;
140             cdi[i].isSynchronous = di[i].isSynchronous;
141         }
142         return cdi;
143     }
144
145     static java.lang.Object JavaDoc extractValueFromAny(Any any) {
146         java.lang.Object JavaDoc value = null;
147         try {
148             int kind = any.type().kind().value();
149             if (kind == TCKind._tk_boolean) {
150                 value = new Boolean JavaDoc(any.extract_boolean());
151             } else if (kind == TCKind._tk_wstring) {
152                 value = new String JavaDoc(any.extract_wstring());
153             } else if (kind == TCKind._tk_long) {
154                 value = new Integer JavaDoc(any.extract_long());
155             } else if (kind == TCKind._tk_longlong) {
156                 value = new Long JavaDoc(any.extract_longlong());
157             } else if (kind == TCKind._tk_double) {
158                 value = new Double JavaDoc(any.extract_double());
159             } else if (kind == TCKind._tk_value) {
160                 value = any.extract_Value();
161             }
162         } catch (BAD_OPERATION bo) {
163             System.out.println("Extracting value failed - bo exception "+bo);
164             //bo.printStackTrace();
165
return null;
166         }
167         return value;
168     }
169
170     static Any createAnyFromValue(ORB orb, java.lang.Object JavaDoc value) {
171         Any any = orb.create_any();
172
173         try {
174             if (value instanceof Boolean JavaDoc) {
175                 any.insert_boolean(((Boolean JavaDoc) value).booleanValue());
176             } else if (value instanceof String JavaDoc) {
177                 any.insert_wstring((String JavaDoc) value);
178             } else if (value instanceof Long JavaDoc) {
179                 any.insert_longlong(((Long JavaDoc) value).longValue());
180             } else if (value instanceof Double JavaDoc) {
181                 any.insert_double(((Double JavaDoc) value).doubleValue());
182             } else if (value instanceof Serializable JavaDoc) {
183                 any.insert_Value((Serializable JavaDoc) value);
184             }
185         } catch (BAD_OPERATION bo) {
186             System.out.println("Creating any from val failed - bo exception");
187             //bo.printStackTrace();
188
}
189         return any;
190     }
191
192     static WfProcessMgr[] makeCORBAProcessMgrs(org.omg.CORBA.ORB JavaDoc orb, Collective toJoin,
193                                                org.enhydra.shark.api.client.wfmodel.WfProcessMgr[] objs) {
194         int size = 0;
195         if (objs != null) size = objs.length;
196         WfProcessMgr[] cobjs = new WfProcessMgr[size];
197         for (int i = 0; i < cobjs.length; i++) {
198             try {
199                 cobjs[i] = makeWfProcessMgr(new WfProcessMgrCORBA(orb, toJoin, objs[i]));
200                 toJoin.__recruit(cobjs[i]);
201             } catch (Exception JavaDoc ex) {
202                 ex.printStackTrace();
203             }
204         }
205         return cobjs;
206     }
207
208     static WfProcess[] makeCORBAProcesses(Collective toJoin,
209                                           org.enhydra.shark.api.client.wfmodel.WfProcess[] objs) {
210         int size = 0;
211         if (objs != null) size = objs.length;
212         WfProcess[] cobjs = new WfProcess[size];
213         for (int i = 0; i < cobjs.length; i++) {
214             cobjs[i] = makeWfProcess(new WfProcessCORBA(orb, toJoin, objs[i]));
215             toJoin.__recruit(cobjs[i]);
216         }
217         return cobjs;
218     }
219
220     static WfActivity[] makeCORBAActivities(Collective toJoin,
221                                             org.enhydra.shark.api.client.wfmodel.WfActivity[] objs) {
222         int size = 0;
223         if (objs != null) size = objs.length;
224         WfActivity[] cobjs = new WfActivity[size];
225         for (int i = 0; i < cobjs.length; i++) {
226             cobjs[i] = makeWfActivity(new WfActivityCORBA(orb, toJoin, objs[i]));
227             toJoin.__recruit(cobjs[i]);
228         }
229         return cobjs;
230     }
231
232     static WfAssignment[] makeCORBAAssignments( Collective toJoin,
233                                                org.enhydra.shark.api.client.wfmodel.WfAssignment[] objs) {
234         int size = 0;
235         if (objs != null) size = objs.length;
236         WfAssignment[] cobjs = new WfAssignment[size];
237         for (int i = 0; i < cobjs.length; i++) {
238             try {
239                 cobjs[i] = makeWfAssignment(new WfAssignmentCORBA(orb, toJoin, objs[i]));
240                 toJoin.__recruit(cobjs[i]);
241             } catch (Exception JavaDoc ex) {
242                 ex.printStackTrace();
243             }
244         }
245         return cobjs;
246     }
247
248     static WfResource[] makeCORBAResources(Collective toJoin,
249                                            org.enhydra.shark.api.client.wfmodel.WfResource[] objs) {
250         int size = 0;
251         if (objs != null) size = objs.length;
252         WfResource[] cobjs = new WfResource[size];
253         for (int i = 0; i < cobjs.length; i++) {
254             try {
255                 cobjs[i] = makeWfResource( new WfResourceCORBA(orb, toJoin, objs[i]));
256                 toJoin.__recruit(cobjs[i]);
257             } catch (Exception JavaDoc ex) {
258                ex.printStackTrace();
259             }
260         }
261         return cobjs;
262     }
263
264     static WfEventAudit makeCORBAEventAudit(Collective toJoin,
265                                             org.enhydra.shark.api.client.wfmodel.WfEventAudit obj) {
266         try {
267             if (obj instanceof org.enhydra.shark.api.client.wfmodel.WfCreateProcessEventAudit) {
268                 WfCreateProcessEventAuditCORBA impl = new WfCreateProcessEventAuditCORBA(orb, toJoin,
269                         (org.enhydra.shark.api.client.wfmodel.WfCreateProcessEventAudit) obj);
270                 WfCreateProcessEventAudit ret = null;
271                 try {
272                     byte[] o = rootPOA.activate_object(impl);
273                     ret = WfCreateProcessEventAuditHelper.narrow(rootPOA.id_to_reference(o));
274                     toJoin.__recruit(ret);
275                 } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
276                     servantAlreadyActive.printStackTrace();
277                 } catch (WrongPolicy JavaDoc wrongPolicy) {
278                     wrongPolicy.printStackTrace();
279                 } catch (Exception JavaDoc ex) {
280                     System.err.println("WfCreateProcessEventAudit: "+ex);
281                 }
282                 return ret;
283             } else if (obj instanceof org.enhydra.shark.api.client.wfmodel.WfAssignmentEventAudit) {
284                 WfAssignmentEventAuditCORBA impl = new WfAssignmentEventAuditCORBA(orb, toJoin,
285                         (org.enhydra.shark.api.client.wfmodel.WfAssignmentEventAudit) obj);
286                 WfAssignmentEventAudit ret = null;
287                 try {
288                   // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
289
byte[] o = rootPOA.activate_object(impl);
290                     ret = WfAssignmentEventAuditHelper.narrow(rootPOA.id_to_reference(o));
291                    toJoin.__recruit(ret);
292                 } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
293                     servantAlreadyActive.printStackTrace();
294                 } catch (WrongPolicy JavaDoc wrongPolicy) {
295                     wrongPolicy.printStackTrace();
296          // } catch (ServantNotActive servantNotActive) {
297
// servantNotActive.printStackTrace();
298

299                 } catch (Exception JavaDoc ex) {
300                     System.err.println("WfAssignmentEventAudit creation: "+ex);
301                 }
302                 return ret;
303             } else if (obj instanceof org.enhydra.shark.api.client.wfmodel.WfDataEventAudit) {
304                 WfDataEventAuditCORBA impl = new WfDataEventAuditCORBA(orb, toJoin,
305                         (org.enhydra.shark.api.client.wfmodel.WfDataEventAudit) obj);
306                 WfDataEventAudit ret = null;
307                 try {
308                   // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
309
// rootPOA.the_POAManager().activate();
310

311                     byte[] o = rootPOA.activate_object(impl);
312                     ret = WfDataEventAuditHelper.narrow(rootPOA.id_to_reference(o));
313                    toJoin.__recruit(ret);
314                 } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
315                     servantAlreadyActive.printStackTrace();
316                 } catch (WrongPolicy JavaDoc wrongPolicy) {
317                     wrongPolicy.printStackTrace();
318           // } catch (ServantNotActive servantNotActive) {
319
// servantNotActive.printStackTrace();
320

321                 } catch (Exception JavaDoc ex) {
322                     System.err.println("WfDataEventAudit creation: "+ex);
323                 }
324                 return ret;
325             } else if (obj instanceof org.enhydra.shark.api.client.wfmodel.WfStateEventAudit) {
326                 WfStateEventAuditCORBA impl = new WfStateEventAuditCORBA(toJoin,
327                         (org.enhydra.shark.api.client.wfmodel.WfStateEventAudit) obj);
328                 WfStateEventAudit ret = null;
329                 try {
330                   // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
331
// rootPOA.the_POAManager().activate();
332

333                     byte[] o = rootPOA.activate_object(impl);
334                     ret = WfStateEventAuditHelper.narrow(rootPOA.id_to_reference(o));
335                     toJoin.__recruit(ret);
336                 } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
337                     servantAlreadyActive.printStackTrace();
338                 } catch (WrongPolicy JavaDoc wrongPolicy) {
339                     wrongPolicy.printStackTrace();
340   // } catch (ServantNotActive servantNotActive) {
341
// servantNotActive.printStackTrace();
342

343                 } catch (Exception JavaDoc ex) {
344                     System.err.println("WfStateEventAudit creation: "+ex);
345                 }
346                 return ret;
347             } else {
348                 return null;
349             }
350         } catch (Exception JavaDoc ex) {
351             return null;
352         }
353     }
354
355     static WfEventAudit[] makeCORBAEventAudits(Collective toJoin,
356                                                org.enhydra.shark.api.client.wfmodel.WfEventAudit[] objs) {
357         int size = 0;
358         if (objs != null) size = objs.length;
359         WfEventAudit[] cobjs = new WfEventAudit[size];
360         for (int i = 0; i < cobjs.length; i++) {
361             cobjs[i] = makeCORBAEventAudit(toJoin, objs[i]);
362             toJoin.__recruit(cobjs[i]);
363         }
364         return cobjs;
365     }
366
367     static WfStateEventAudit[] makeCORBAStateEventAudits(Collective toJoin,
368                                                          org.enhydra.shark.api.client.wfmodel.WfEventAudit[] objs) throws Exception JavaDoc {
369         int size = 0;
370         if (objs != null) size = objs.length;
371         WfStateEventAudit[] cobjs = new WfStateEventAudit[size];
372         for (int i = 0; i < cobjs.length; i++) {
373             cobjs[i] = (WfStateEventAudit) makeCORBAEventAudit(toJoin, objs[i]);
374             toJoin.__recruit(cobjs[i]);
375         }
376         return cobjs;
377     }
378
379     static WfDataEventAudit[] makeCORBADataEventAudits(Collective toJoin,
380                                                        org.enhydra.shark.api.client.wfmodel.WfEventAudit[] objs) throws Exception JavaDoc {
381         int size = 0;
382         if (objs != null) size = objs.length;
383         WfDataEventAudit[] cobjs = new WfDataEventAudit[size];
384         for (int i = 0; i < cobjs.length; i++) {
385             cobjs[i] = (WfDataEventAudit) makeCORBAEventAudit(toJoin, objs[i]);
386             toJoin.__recruit(cobjs[i]);
387         }
388         return cobjs;
389     }
390
391     static WfAssignmentEventAudit[] makeCORBAAssignmentEventAudits(Collective toJoin,
392                                                                    org.enhydra.shark.api.client.wfmodel.WfEventAudit[] objs) throws Exception JavaDoc {
393         int size = 0;
394         if (objs != null) size = objs.length;
395         WfAssignmentEventAudit[] cobjs = new WfAssignmentEventAudit[size];
396         for (int i = 0; i < cobjs.length; i++) {
397             cobjs[i] = (WfAssignmentEventAudit) makeCORBAEventAudit(toJoin,
398                     objs[i]);
399             toJoin.__recruit(cobjs[i]);
400         }
401         return cobjs;
402     }
403
404     static ParticipantMap[] makeCORBAParticipantMaps(Collective toJoin,
405                                                      org.enhydra.shark.api.client.wfservice.ParticipantMap[] objs) {
406         int size = 0;
407         if (objs != null) size = objs.length;
408         ParticipantMap[] cobjs = new ParticipantMap[size];
409         for (int i = 0; i < cobjs.length; i++) {
410             cobjs[i] = makeParticipantMap(new ParticipantMapCORBA(objs[i]));
411             toJoin.__recruit(cobjs[i]);
412         }
413         return cobjs;
414     }
415
416     static ApplicationMap[] makeCORBAApplicationMaps(ORB orb, Collective toJoin,
417                                                      org.enhydra.shark.api.client.wfservice.ApplicationMap[] objs) {
418         int size = 0;
419         if (objs != null) size = objs.length;
420         ApplicationMap[] cobjs = new ApplicationMap[size];
421         for (int i = 0; i < cobjs.length; i++) {
422             cobjs[i] = makeApplicationMap(new ApplicationMapCORBA(toJoin, objs[i]));
423             toJoin.__recruit(cobjs[i]);
424         }
425         return cobjs;
426     }
427
428     static org.enhydra.shark.api.client.wfservice.ApplicationMap fillApplicationMap(org.enhydra.shark.api.client.wfservice.ApplicationMap nm,
429                                                                                     ApplicationMap am) {
430         nm.setToolAgentClassName(am.getToolAgentClassName());
431         nm.setUsername(am.getUsername());
432         nm.setPassword(am.getPassword());
433         nm.setApplicationName(am.getApplicationName());
434         if (am.getApplicationMode() != -Integer.MAX_VALUE) {
435             nm.setApplicationMode(new Integer JavaDoc(am.getApplicationMode()));
436         }
437         nm.setPackageId(am.getPackageId());
438         nm.setProcessDefinitionId(am.getProcessDefinitionId());
439         nm.setApplicationDefinitionId(am.getApplicationDefinitionId());
440         return nm;
441     }
442
443     static org.enhydra.shark.api.client.wfservice.ParticipantMap fillParticipantMap(org.enhydra.shark.api.client.wfservice.ParticipantMap nm,
444                                                                                     ParticipantMap pm) {
445         nm.setParticipantId(pm.getParticipantId());
446         nm.setPackageId(pm.getPackageId());
447         nm.setProcessDefinitionId(pm.getProcessDefinitionId());
448         nm.setUsername(pm.getUsername());
449         nm.setIsGroupUser(pm.getIsGroupUser());
450         return nm;
451     }
452
453     static WfActivity makeWfActivity(WfActivityCORBA impl) {
454         WfActivity ret = null;
455         try {
456          // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
457
// rootPOA.the_POAManager().activate();
458
byte[] o = rootPOA.activate_object(impl);
459             ret = WfActivityHelper.narrow(rootPOA.id_to_reference(o));
460
461         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
462             servantAlreadyActive.printStackTrace();
463         } catch (WrongPolicy JavaDoc wrongPolicy) {
464             wrongPolicy.printStackTrace();
465       // } catch (ServantNotActive servantNotActive) {
466
// servantNotActive.printStackTrace();
467

468
469         } catch (Exception JavaDoc ex) {
470                  ex.printStackTrace();
471         }
472         return ret;
473     }
474
475     static WfActivityIterator makeWfActivityIterator(WfActivityIteratorCORBA impl) {
476         WfActivityIterator ret = null;
477         try {
478         // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
479
// rootPOA.the_POAManager().activate();
480

481             byte[] o = rootPOA.activate_object(impl);
482             ret = WfActivityIteratorHelper.narrow(rootPOA.id_to_reference(o));
483
484         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
485             servantAlreadyActive.printStackTrace();
486         } catch (WrongPolicy JavaDoc wrongPolicy) {
487             wrongPolicy.printStackTrace();
488         //} catch (ServantNotActive servantNotActive) {
489
// servantNotActive.printStackTrace();
490

491
492         } catch (Exception JavaDoc ex) {
493                    ex.printStackTrace();
494         }
495         return ret;
496     }
497
498     static WfAssignmentIterator makeWfAssignmentIterator(WfAssignmentIteratorCORBA impl) {
499         WfAssignmentIterator ret = null;
500         try {
501         // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
502
// rootPOA.the_POAManager().activate();
503
byte[] o = rootPOA.activate_object(impl);
504             ret = WfAssignmentIteratorHelper.narrow(rootPOA.id_to_reference(o));
505
506         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
507             servantAlreadyActive.printStackTrace();
508         } catch (WrongPolicy JavaDoc wrongPolicy) {
509             wrongPolicy.printStackTrace();
510       // } catch (ServantNotActive servantNotActive) {
511
// servantNotActive.printStackTrace();
512
} catch (Exception JavaDoc ex) {
513                ex.printStackTrace();
514         }
515         return ret;
516     }
517
518     static ApplicationMap makeApplicationMap(ApplicationMapCORBA impl) {
519         ApplicationMap ret = null;
520         try {
521        // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
522
// rootPOA.the_POAManager().activate();
523

524             byte[] o = rootPOA.activate_object(impl);
525             ret = ApplicationMapHelper.narrow(rootPOA.id_to_reference(o));
526
527         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
528             servantAlreadyActive.printStackTrace();
529         } catch (WrongPolicy JavaDoc wrongPolicy) {
530             wrongPolicy.printStackTrace();
531    // } catch (ServantNotActive servantNotActive) {
532
// servantNotActive.printStackTrace();
533
} catch (Exception JavaDoc ex) {
534                 ex.printStackTrace();
535         }
536         return ret;
537     }
538
539     static WfEventAuditIterator makeWfEventAuditIterator(WfEventAuditIteratorCORBA impl) {
540
541         WfEventAuditIterator ret = null;
542         try {
543          // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
544
// rootPOA.the_POAManager().activate();
545

546            byte[] o = rootPOA.activate_object(impl);
547             ret = WfEventAuditIteratorHelper.narrow(rootPOA.id_to_reference(o));
548
549         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
550             servantAlreadyActive.printStackTrace();
551         } catch (WrongPolicy JavaDoc wrongPolicy) {
552             wrongPolicy.printStackTrace();
553    // } catch (ServantNotActive servantNotActive) {
554
// servantNotActive.printStackTrace();
555
} catch (Exception JavaDoc ex) {
556                  ex.printStackTrace();
557         }
558         return ret;
559     }
560
561     static WfProcess makeWfProcess(WfProcessCORBA impl) {
562         WfProcess ret = null;
563         try {
564          // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
565
// rootPOA.the_POAManager().activate();
566
byte[] b = rootPOA.activate_object(impl);
567             ret = WfProcessHelper.narrow(rootPOA.id_to_reference(b));
568
569         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
570             servantAlreadyActive.printStackTrace();
571         } catch (WrongPolicy JavaDoc wrongPolicy) {
572             wrongPolicy.printStackTrace();
573      // } catch (ServantNotActive servantNotActive) {
574
// servantNotActive.printStackTrace();
575
} catch (Exception JavaDoc ex) {
576               ex.printStackTrace();
577         }
578         return ret;
579     }
580
581     static WfProcessIterator makeWfProcessIterator(WfProcessIteratorCORBA impl) {
582         WfProcessIterator ret = null;
583         try {
584             //POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
585
rootPOA.the_POAManager().activate();
586
587             byte[] o = rootPOA.activate_object(impl);
588           // ret = WfProcessIteratorHelper.narrow(rootPOA.servant_to_reference(impl));
589
ret = WfProcessIteratorHelper.narrow(rootPOA.id_to_reference(o));
590
591         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
592             servantAlreadyActive.printStackTrace();
593         } catch (WrongPolicy JavaDoc wrongPolicy) {
594             wrongPolicy.printStackTrace();
595       // } catch (ServantNotActive servantNotActive) {
596
// servantNotActive.printStackTrace();
597

598
599         } catch (Exception JavaDoc ex) {
600               ex.printStackTrace();
601         }
602         return ret;
603     }
604
605     static WfProcessMgr makeWfProcessMgr(WfProcessMgrCORBA impl) {
606         WfProcessMgr ret = null;
607         try {
608          // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
609
// rootPOA.the_POAManager().activate();
610
byte[] b = rootPOA.activate_object(impl);
611           // ret = WfProcessMgrHelper.narrow(rootPOA.servant_to_reference(impl));
612
// System.out.println("makeWfProcessMgr: "+new String(b));
613
ret = WfProcessMgrHelper.narrow(rootPOA.id_to_reference(b));
614
615         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
616             servantAlreadyActive.printStackTrace();
617         } catch (WrongPolicy JavaDoc wrongPolicy) {
618             wrongPolicy.printStackTrace();
619      // } catch (ServantNotActive servantNotActive) {
620
// servantNotActive.printStackTrace();
621
} catch (Exception JavaDoc ex) {
622                 ex.printStackTrace();
623         }
624         return ret;
625     }
626
627     static WfProcessMgrIterator makeWfProcessMgrIterator(WfProcessMgrIteratorCORBA impl) {
628         WfProcessMgrIterator ret = null;
629         try {
630         // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
631
// rootPOA.the_POAManager().activate();
632
byte[] b = rootPOA.activate_object(impl);
633             ret = WfProcessMgrIteratorHelper.narrow(rootPOA.id_to_reference(b));
634         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
635             servantAlreadyActive.printStackTrace();
636         } catch (WrongPolicy JavaDoc wrongPolicy) {
637             wrongPolicy.printStackTrace();
638        // } catch (ServantNotActive servantNotActive) {
639
// servantNotActive.printStackTrace();
640

641
642         } catch (Exception JavaDoc ex) {
643             ex.printStackTrace();
644         }
645         return ret;
646     }
647
648     static ParticipantMap makeParticipantMap(ParticipantMapCORBA impl) {
649         ParticipantMap ret = null;
650         try {
651         // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
652
// rootPOA.the_POAManager().activate();
653
byte[] b = rootPOA.activate_object(impl);
654             ret = ParticipantMapHelper.narrow(rootPOA.id_to_reference(b));
655         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
656             servantAlreadyActive.printStackTrace();
657         } catch (WrongPolicy JavaDoc wrongPolicy) {
658             wrongPolicy.printStackTrace();
659     // } catch (ServantNotActive servantNotActive) {
660
// servantNotActive.printStackTrace();
661
} catch (Exception JavaDoc ex) {
662                ex.printStackTrace();
663         }
664         return ret;
665     }
666
667     static WfRequester makeWfRequester(WfRequesterCORBA impl) {
668         WfRequester ret = null;
669         try {
670        // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
671
// rootPOA.the_POAManager().activate();
672

673            byte[] o = rootPOA.activate_object(impl);
674             ret = org.omg.WorkflowModel.WfRequesterHelper.narrow(rootPOA.id_to_reference(o));
675         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
676             servantAlreadyActive.printStackTrace();
677         } catch (WrongPolicy JavaDoc wrongPolicy) {
678             wrongPolicy.printStackTrace();
679    // } catch (ServantNotActive servantNotActive) {
680
// servantNotActive.printStackTrace();
681

682         } catch (Exception JavaDoc ex) {
683                ex.printStackTrace();
684         }
685         return ret;
686     }
687
688     static org.omg.WorkflowModel.WfResource makeWfResource( WfResourceCORBA impl) {
689         org.omg.WorkflowModel.WfResource ret = null;
690         try {
691          // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
692
// rootPOA.the_POAManager().activate();
693
byte[] o = rootPOA.activate_object(impl);
694         // ret = org.omg.WorkflowModel.WfResourceHelper.narrow(rootPOA.servant_to_reference(impl));
695
ret = org.omg.WorkflowModel.WfResourceHelper.narrow(rootPOA.id_to_reference(o));
696            // System.out.println("makeWfResource: "+ret.toString());
697
} catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
698             servantAlreadyActive.printStackTrace();
699         } catch (WrongPolicy JavaDoc wrongPolicy) {
700             wrongPolicy.printStackTrace();
701        // } catch (ServantNotActive servantNotActive) {
702
// servantNotActive.printStackTrace();
703
} catch (Exception JavaDoc ex) {
704              ex.printStackTrace();
705         }
706         return ret;
707     }
708
709     static WfResourceIterator makeWfResourceIterator( WfResourceIteratorCORBA impl) {
710         WfResourceIterator ret = null;
711         try {
712          // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
713
// rootPOA.the_POAManager().activate();
714

715             byte[] o = rootPOA.activate_object(impl);
716             ret = WfResourceIteratorHelper.narrow(rootPOA.id_to_reference(o));
717
718         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
719             servantAlreadyActive.printStackTrace();
720         } catch (WrongPolicy JavaDoc wrongPolicy) {
721             wrongPolicy.printStackTrace();
722        // } catch (ServantNotActive servantNotActive) {
723
// servantNotActive.printStackTrace();
724

725         } catch (Exception JavaDoc ex) {
726                ex.printStackTrace();
727         }
728         return ret;
729     }
730
731     static WfAssignment makeWfAssignment(WfAssignmentCORBA impl) {
732         WfAssignment ret = null;
733         try {
734       // POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
735
// rootPOA.the_POAManager().activate();
736

737             byte[] o = rootPOA.activate_object(impl);
738             ret = WfAssignmentHelper.narrow(rootPOA.id_to_reference(o));
739
740         } catch (ServantAlreadyActive JavaDoc servantAlreadyActive) {
741             servantAlreadyActive.printStackTrace();
742         } catch (WrongPolicy JavaDoc wrongPolicy) {
743             wrongPolicy.printStackTrace();
744        // } catch (ServantNotActive servantNotActive) {
745
// servantNotActive.printStackTrace();
746

747         } catch (Exception JavaDoc ex) {
748              ex.printStackTrace();
749         }
750         return ret;
751     }
752 }
Popular Tags