KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > corba > ExecutionAdminCORBA


1 package org.enhydra.shark.corba;
2
3 import org.enhydra.shark.api.common.SharkConstants;
4 import org.enhydra.shark.corba.WorkflowService.*;
5 import org.omg.CORBA.ORB JavaDoc;
6 import org.omg.WfBase.*;
7 import org.omg.WorkflowModel.*;
8
9 /**
10  * The client interface through which client accesses the engine
11  * objects, and performs the various actions on engine.
12  *
13  * @author Sasa Bojanic
14  */

15 public class ExecutionAdminCORBA extends _ExecutionAdministrationImplBase implements
16                                                                          Collective {
17    private SharkCORBAServer myServer;
18    org.enhydra.shark.api.client.wfservice.ExecutionAdministration myExecAdmin;
19
20    ExecutionAdminCORBA(SharkCORBAServer theServer, org.enhydra.shark.api.client.wfservice.ExecutionAdministration ea) {
21       this.myServer = theServer;
22       this.myExecAdmin = ea;
23       if (myServer.trackObjects) {
24          __collective = new Collective.CollectiveCORBA();
25       }
26    }
27
28    public void connect(String JavaDoc userId,
29                        String JavaDoc password,
30                        String JavaDoc engineName,
31                        String JavaDoc scope) throws BaseException, ConnectFailed {
32       try {
33          myExecAdmin.connect(userId, password, engineName, scope);
34       } catch (org.enhydra.shark.api.client.wfservice.ConnectFailed cf) {
35          throw new ConnectFailed();
36       } catch (Exception JavaDoc ex) {
37          throw new BaseException();
38       }
39    }
40
41    public void disconnect() throws BaseException, NotConnected {
42       try {
43          myExecAdmin.disconnect();
44       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
45          throw new NotConnected(nc.getMessage());
46       } catch (Exception JavaDoc ex) {
47          throw new BaseException();
48       } finally {
49          this.__disband(this._orb());
50       }
51    }
52
53    public void shutdown() throws BaseException, NotConnected {
54       myServer.shutdown();
55    }
56
57    public void removeProcessRequester (String JavaDoc procId) throws BaseException, NotConnected {
58       try {
59          myExecAdmin.getProcess(procId).set_requester(null);
60          WfLinkingRequesterForCORBA.removeCORBARequester(procId);
61       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
62          throw new NotConnected(nc.getMessage());
63       } catch (Exception JavaDoc ex) {
64          throw new BaseException();
65       }
66    }
67    
68    public WfProcessMgrIterator get_iterator_processmgr() throws BaseException,
69                                                         NotConnected {
70       try {
71          return new WfProcessMgrIteratorCORBA(this,
72                                               myExecAdmin.get_iterator_processmgr());
73       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
74          throw new NotConnected(nc.getMessage());
75       } catch (Exception JavaDoc ex) {
76          throw new BaseException();
77       }
78    }
79
80    public WfProcessMgr[] get_sequence_processmgr(int max_number) throws BaseException,
81                                                                 NotConnected {
82       try {
83          return SharkCORBAUtilities.makeCORBAProcessMgrs(this,
84                                                          myExecAdmin.get_sequence_processmgr(max_number));
85       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
86          throw new NotConnected(nc.getMessage());
87       } catch (Exception JavaDoc ex) {
88          throw new BaseException();
89       }
90    }
91
92    public WfResourceIterator get_iterator_resource() throws BaseException,
93                                                     NotConnected {
94       try {
95          return new WfResourceIteratorCORBA(this,
96                                             myExecAdmin.get_iterator_resource());
97       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
98          throw new NotConnected(nc.getMessage());
99       } catch (Exception JavaDoc ex) {
100          throw new BaseException();
101       }
102    }
103
104    public WfResource[] get_sequence_resource(int max_number) throws BaseException,
105                                                             NotConnected {
106       try {
107          return SharkCORBAUtilities.makeCORBAResources(this,
108                                                        myExecAdmin.get_sequence_resource(max_number));
109       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
110          throw new NotConnected(nc.getMessage());
111       } catch (Exception JavaDoc ex) {
112          throw new BaseException();
113       }
114    }
115
116    public NameValue[] getLoggedUsers() throws BaseException, NotConnected {
117       try {
118          return SharkCORBAUtilities.makeCORBANameValueArray(myServer.getBoundORB(),
119                                                             myExecAdmin.getLoggedUsers());
120       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
121          throw new NotConnected(nc.getMessage());
122       } catch (Exception JavaDoc ex) {
123          throw new BaseException();
124       }
125    }
126
127    public void startActivity(String JavaDoc procId, String JavaDoc blockActId, String JavaDoc actDefId) throws BaseException,
128                                                                                NotConnected {
129       try {
130          myExecAdmin.startActivity(procId, blockActId, actDefId);
131       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
132          throw new NotConnected(nc.getMessage());
133       } catch (Exception JavaDoc ex) {
134          throw new BaseException();
135       }
136    }
137
138    public WfProcessMgr getProcessMgrByName(String JavaDoc name) throws BaseException,
139                                                        NotConnected {
140       try {
141          return new WfProcessMgrCORBA(this,
142                                       myExecAdmin.getProcessMgr(name));
143       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
144          throw new NotConnected(nc.getMessage());
145       } catch (Exception JavaDoc ex) {
146          throw new BaseException();
147       }
148    }
149
150    public WfProcessMgr getProcessMgrByXPDLDefinition(String JavaDoc pkgId,
151                                                      String JavaDoc pDefId) throws BaseException,
152                                                                    NotConnected {
153       try {
154          return new WfProcessMgrCORBA(this,
155                                       myExecAdmin.getProcessMgr(pkgId, pDefId));
156       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
157          throw new NotConnected(nc.getMessage());
158       } catch (Exception JavaDoc ex) {
159          throw new BaseException();
160       }
161    }
162
163    public NameValueInfo[] getProcessMgrInputSignatureByMgrName(String JavaDoc name) throws BaseException,
164                                                                            NotConnected {
165       try {
166          return SharkCORBAUtilities.makeCORBANameValueInfoArray(myExecAdmin.getProcessMgrInputSignature(name));
167       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
168          throw new NotConnected(nc.getMessage());
169       } catch (Exception JavaDoc ex) {
170          throw new BaseException();
171       }
172    }
173
174    public NameValueInfo[] getProcessMgrInputSignatureByXPDLDefinition(String JavaDoc pkgId,
175                                                                       String JavaDoc pDefId) throws BaseException,
176                                                                                     NotConnected {
177       try {
178          return SharkCORBAUtilities.makeCORBANameValueInfoArray(myExecAdmin.getProcessMgrInputSignature(pkgId,
179                                                                                                         pDefId));
180       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
181          throw new NotConnected(nc.getMessage());
182       } catch (Exception JavaDoc ex) {
183          throw new BaseException();
184       }
185    }
186
187    public NameValueInfo[] getProcessMgrInputSignatureByXPDLDefinitionWithVersion(String JavaDoc pkgId,
188                                                                                  String JavaDoc pkgVer,
189                                                                                  String JavaDoc pDefId) throws BaseException,
190                                                                                                NotConnected {
191       try {
192          return SharkCORBAUtilities.makeCORBANameValueInfoArray(myExecAdmin.getProcessMgrInputSignature(pkgId,
193                                                                                                         pkgVer,
194                                                                                                         pDefId));
195       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
196          throw new NotConnected(nc.getMessage());
197       } catch (Exception JavaDoc ex) {
198          throw new BaseException();
199       }
200    }
201
202    public WfProcess getProcess(String JavaDoc procId) throws BaseException,
203                                              NotConnected {
204       try {
205          return new WfProcessCORBA(this, myExecAdmin.getProcess(procId));
206       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
207          throw new NotConnected(nc.getMessage());
208       } catch (Exception JavaDoc ex) {
209          throw new BaseException();
210       }
211    }
212
213    public WfActivity getActivity(String JavaDoc procId, String JavaDoc actId) throws BaseException,
214                                                              NotConnected {
215       try {
216          return new WfActivityCORBA(this, myExecAdmin.getActivity(procId,
217                                                                       actId));
218       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
219          throw new NotConnected(nc.getMessage());
220       } catch (Exception JavaDoc ex) {
221          throw new BaseException();
222       }
223    }
224
225    public WfResource getResource(String JavaDoc username) throws BaseException,
226                                                  NotConnected {
227       try {
228          return new WfResourceCORBA(this,
229                                     myExecAdmin.getResource(username));
230       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
231          throw new NotConnected(nc.getMessage());
232       } catch (Exception JavaDoc ex) {
233          throw new BaseException();
234       }
235    }
236
237    public WfAssignment getAssignment(String JavaDoc procId,
238                                      String JavaDoc actId,
239                                      String JavaDoc username) throws BaseException,
240                                                      NotConnected {
241       try {
242          return new WfAssignmentCORBA(this,
243                                       myExecAdmin.getAssignment(procId,
244                                                                 actId,
245                                                                 username));
246       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
247          throw new NotConnected(nc.getMessage());
248       } catch (Exception JavaDoc ex) {
249          throw new BaseException();
250       }
251    }
252
253    public WfAssignment getAssignmentById(String JavaDoc procId, String JavaDoc assId) throws BaseException,
254                                                                      NotConnected {
255       try {
256          return new WfAssignmentCORBA(this,
257                                       myExecAdmin.getAssignment(procId, assId));
258       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
259          throw new NotConnected(nc.getMessage());
260       } catch (Exception JavaDoc ex) {
261          throw new BaseException();
262       }
263    }
264
265    public void reevaluateAssignments() throws BaseException, NotConnected {
266       try {
267          myExecAdmin.reevaluateAssignments();
268       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
269          throw new NotConnected(nc.getMessage());
270       } catch (Exception JavaDoc ex) {
271          throw new BaseException();
272       }
273    }
274
275    public void reevaluateAssignmentsForPkg(String JavaDoc pkgId) throws BaseException,
276                                                         NotConnected {
277       try {
278          myExecAdmin.reevaluateAssignments(pkgId);
279       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
280          throw new NotConnected(nc.getMessage());
281       } catch (Exception JavaDoc ex) {
282          throw new BaseException();
283       }
284    }
285
286    public void reevaluateAssignmentsForProcessDefinition(String JavaDoc pkgId,
287                                                          String JavaDoc pDefId) throws BaseException,
288                                                                        NotConnected {
289       try {
290          myExecAdmin.reevaluateAssignments(pkgId, pDefId);
291       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
292          throw new NotConnected(nc.getMessage());
293       } catch (Exception JavaDoc ex) {
294          throw new BaseException();
295       }
296    }
297
298    public void reevaluateAssignmentsForActivityDefinition(String JavaDoc pkgId,
299                                                           String JavaDoc pDefId,
300                                                           String JavaDoc aDefId) throws BaseException,
301                                                                         NotConnected {
302       try {
303          myExecAdmin.reevaluateAssignments(pkgId, pDefId, aDefId);
304       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
305          throw new NotConnected(nc.getMessage());
306       } catch (Exception JavaDoc ex) {
307          throw new BaseException();
308       }
309    }
310
311    public WfCreateProcessEventAudit getCreateProcessHistory(String JavaDoc procId) throws BaseException,
312                                                                           NotConnected {
313       try {
314          String JavaDoc query = "event_type.equals(\""
315                         + SharkConstants.EVENT_PROCESS_CREATED + "\")";
316          return new WfCreateProcessEventAuditCORBA(this,
317                                                    (org.enhydra.shark.api.client.wfmodel.WfCreateProcessEventAudit) myExecAdmin.getProcess(procId)
318                                                       .get_iterator_history(query,
319                                                                             null)
320                                                       .get_next_object());
321       } catch (Exception JavaDoc ex) {
322          throw new BaseException();
323       }
324    }
325
326    public WfDataEventAudit[] getProcessSequenceDataHistory(String JavaDoc procId,
327                                                            int max_number) throws BaseException,
328                                                                           NotConnected {
329       try {
330          String JavaDoc query = "event_type.equals(\""
331                         + SharkConstants.EVENT_PROCESS_CONTEXT_CHANGED
332                         + "\")";
333          return SharkCORBAUtilities.makeCORBADataEventAudits(this,
334                                                              myExecAdmin.getProcess(procId)
335                                                                 .get_iterator_history(query,
336                                                                                       null)
337                                                                 .get_next_n_sequence(0));
338       } catch (Exception JavaDoc ex) {
339          throw new BaseException();
340       }
341    }
342
343    public WfStateEventAudit[] getProcessSequenceStateHistory(String JavaDoc procId,
344                                                              int max_number) throws BaseException,
345                                                                             NotConnected {
346       try {
347          String JavaDoc query = "event_type.equals(\""
348                         + SharkConstants.EVENT_PROCESS_STATE_CHANGED + "\")";
349          return SharkCORBAUtilities.makeCORBAStateEventAudits(this,
350                                                               myExecAdmin.getProcess(procId)
351                                                                  .get_iterator_history(query,
352                                                                                        null)
353                                                                  .get_next_n_sequence(0));
354       } catch (Exception JavaDoc ex) {
355          throw new BaseException();
356       }
357    }
358
359    public WfAssignmentEventAudit[] getSequenceAssignmentHistory(String JavaDoc procId,
360                                                                 String JavaDoc actId,
361                                                                 int max_number) throws BaseException,
362                                                                                NotConnected {
363       try {
364          String JavaDoc query = "event_type.equals(\""
365                         + SharkConstants.EVENT_ACTIVITY_ASSIGNMENT_CHANGED
366                         + "\")";
367          return SharkCORBAUtilities.makeCORBAAssignmentEventAudits(this,
368                                                                    myExecAdmin.getActivity(procId,
369                                                                                            actId)
370                                                                       .get_iterator_history(query,
371                                                                                             null)
372                                                                       .get_next_n_sequence(0));
373       } catch (Exception JavaDoc ex) {
374          throw new BaseException();
375       }
376    }
377
378    public WfDataEventAudit[] getActivitySequenceDataHistory(String JavaDoc procId,
379                                                             String JavaDoc actId,
380                                                             int max_number) throws BaseException,
381                                                                            NotConnected {
382       try {
383          String JavaDoc query = "event_type.equals(\""
384                         + SharkConstants.EVENT_ACTIVITY_CONTEXT_CHANGED
385                         + "\") || " + "event_type.equals(\""
386                         + SharkConstants.EVENT_ACTIVITY_RESULT_CHANGED
387                         + "\")";
388          return SharkCORBAUtilities.makeCORBADataEventAudits(this,
389                                                              myExecAdmin.getActivity(procId,
390                                                                                      actId)
391                                                                 .get_iterator_history(query,
392                                                                                       null)
393                                                                 .get_next_n_sequence(0));
394       } catch (Exception JavaDoc ex) {
395          throw new BaseException();
396       }
397    }
398
399    public WfStateEventAudit[] getActivitySequenceStateHistory(String JavaDoc procId,
400                                                               String JavaDoc actId,
401                                                               int max_number) throws BaseException,
402                                                                              NotConnected {
403       try {
404          String JavaDoc query = "event_type.equals(\""
405                         + SharkConstants.EVENT_ACTIVITY_STATE_CHANGED + "\")";
406          return SharkCORBAUtilities.makeCORBAStateEventAudits(this,
407                                                               myExecAdmin.getActivity(procId,
408                                                                                       actId)
409                                                                  .get_iterator_history(query,
410                                                                                        null)
411                                                                  .get_next_n_sequence(0));
412       } catch (Exception JavaDoc ex) {
413          throw new BaseException();
414       }
415    }
416
417    public void deleteClosedProcesses() throws BaseException, NotConnected {
418       try {
419          myExecAdmin.deleteClosedProcesses();
420       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
421          throw new NotConnected(nc.getMessage());
422       } catch (Exception JavaDoc ex) {
423          throw new BaseException();
424       }
425    }
426
427    public void deleteClosedProcessesForPkg(String JavaDoc pkgId) throws BaseException,
428                                                         NotConnected {
429       try {
430          myExecAdmin.deleteClosedProcesses(pkgId);
431       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
432          throw new NotConnected(nc.getMessage());
433       } catch (Exception JavaDoc ex) {
434          throw new BaseException();
435       }
436    }
437
438    public void deleteClosedProcessesForMgr(String JavaDoc mgrName) throws BaseException,
439                                                           NotConnected {
440       try {
441          myExecAdmin.deleteClosedProcessesForMgr(mgrName);
442       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
443          throw new NotConnected(nc.getMessage());
444       } catch (Exception JavaDoc ex) {
445          throw new BaseException();
446       }
447    }
448
449    public void deleteClosedProcessesForPkgWithVersion(String JavaDoc pkgId,
450                                                       String JavaDoc pkgVer) throws BaseException,
451                                                                     NotConnected {
452       try {
453          myExecAdmin.deleteClosedProcessesWithVersion(pkgId, pkgVer);
454       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
455          throw new NotConnected(nc.getMessage());
456       } catch (Exception JavaDoc ex) {
457          throw new BaseException();
458       }
459    }
460
461    public void deleteClosedProcessesForProcessDefinition(String JavaDoc pkgId,
462                                                          String JavaDoc pDefId) throws BaseException,
463                                                                        NotConnected {
464       try {
465          myExecAdmin.deleteClosedProcesses(pkgId, pDefId);
466       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
467          throw new NotConnected(nc.getMessage());
468       } catch (Exception JavaDoc ex) {
469          throw new BaseException();
470       }
471    }
472
473    public void deleteClosedProcess(String JavaDoc procId) throws BaseException,
474                                                  NotConnected {
475       try {
476          myExecAdmin.deleteClosedProcess(procId);
477       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
478          throw new NotConnected(nc.getMessage());
479       } catch (Exception JavaDoc ex) {
480          throw new BaseException();
481       }
482    }
483
484    public String JavaDoc[] deleteClosedProcessesMultiTrans(int instancesPerTransaction,
485                                                    int failuresToIgnore) throws BaseException,
486                                                                         NotConnected {
487       try {
488          return myExecAdmin.deleteClosedProcesses(instancesPerTransaction,
489                                                   failuresToIgnore);
490       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
491          throw new NotConnected(nc.getMessage());
492       } catch (Exception JavaDoc ex) {
493          throw new BaseException();
494       }
495    }
496
497    public String JavaDoc[] deleteClosedProcessesForMgrMultiTrans(String JavaDoc mgrName,
498                                                          int instancesPerTransaction,
499                                                          int failuresToIgnore) throws BaseException,
500                                                                               NotConnected {
501       try {
502          return myExecAdmin.deleteClosedProcessesForMgr(mgrName,
503                                                         instancesPerTransaction,
504                                                         failuresToIgnore);
505       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
506          throw new NotConnected(nc.getMessage());
507       } catch (Exception JavaDoc ex) {
508          throw new BaseException();
509       }
510    }
511
512    public NameValue[] getProcessContext(String JavaDoc processId,
513                                         String JavaDoc[] variablesDefIds) throws BaseException,
514                                                                  NotConnected {
515       try {
516          return SharkCORBAUtilities.makeCORBANameValueArray(myServer.getBoundORB(),
517                                                             myExecAdmin.getProcessContext(processId,
518                                                                                           variablesDefIds));
519       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
520          throw new NotConnected(nc.getMessage());
521       } catch (Exception JavaDoc ex) {
522          throw new BaseException();
523       }
524    }
525
526    public NameValue[] getActivityContext(String JavaDoc processId,
527                                          String JavaDoc actId,
528                                          String JavaDoc[] variablesDefIds) throws BaseException,
529                                                                   NotConnected {
530       try {
531          return SharkCORBAUtilities.makeCORBANameValueArray(myServer.getBoundORB(),
532                                                             myExecAdmin.getActivityContext(processId,
533                                                                                            actId,
534                                                                                            variablesDefIds));
535       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
536          throw new NotConnected(nc.getMessage());
537       } catch (Exception JavaDoc ex) {
538          throw new BaseException();
539       }
540    }
541
542    public WfAssignmentIterator get_iterator_assignment() throws BaseException,
543                                                         NotConnected {
544       try {
545          return new WfAssignmentIteratorCORBA(this,
546                                               myExecAdmin.get_iterator_assignment());
547       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
548          throw new NotConnected(nc.getMessage());
549       } catch (Exception JavaDoc ex) {
550          throw new BaseException();
551       }
552    }
553
554    public WfProcessIterator get_iterator_process() throws BaseException,
555                                                   NotConnected {
556       try {
557          return new WfProcessIteratorCORBA(this,
558                                            myExecAdmin.get_iterator_process());
559       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
560          throw new NotConnected(nc.getMessage());
561       } catch (Exception JavaDoc ex) {
562          throw new BaseException();
563       }
564    }
565
566    public WfActivityIterator get_iterator_activity() throws BaseException,
567                                                     NotConnected {
568       try {
569          return new WfActivityIteratorCORBA(this,
570                                             myExecAdmin.get_iterator_activity());
571       } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) {
572          throw new NotConnected(nc.getMessage());
573       } catch (Exception JavaDoc ex) {
574          throw new BaseException();
575       }
576    }
577
578    Collective __collective;
579
580    public void __recruit(org.omg.CORBA.Object JavaDoc obj) {
581       if (myServer.trackObjects) {
582          __collective.__recruit(obj);
583       }
584    }
585
586    public void __leave(org.omg.CORBA.Object JavaDoc obj) {
587       if (myServer.trackObjects)
588          __collective.__leave(obj);
589    }
590    
591    public void __disband(ORB JavaDoc _orb) {
592       if (myServer.trackObjects) {
593          __collective.__disband(_orb);
594       }
595       this._orb().disconnect(this);
596    }
597
598    public void doneWith(org.omg.CORBA.Object JavaDoc toDisconnect) {
599       myServer.doneWith(toDisconnect);
600       __leave(toDisconnect);
601    }
602 }
Popular Tags