KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba.poa;
2
3 import org.omg.WfBase.BaseException;
4 import org.omg.WorkflowModel.*;
5 import org.omg.CORBA.ORB JavaDoc;
6 import org.enhydra.shark.corba.poa.Collective;
7 import org.enhydra.shark.corba.poa.SharkCORBAUtilities;
8 import org.enhydra.shark.corba.poa.WfProcessIteratorCORBA;
9
10
11 /**
12  * WfRequesterImpl - Workflow Requester implementation
13  */

14 public class WfRequesterCORBA extends WfRequesterPOA {
15
16    org.enhydra.shark.api.client.wfmodel.WfRequester reqInternal;
17
18    private Collective __collective;
19    private ORB JavaDoc orb;
20
21    public WfRequesterCORBA(ORB JavaDoc orb, Collective toJoin,
22                            org.enhydra.shark.api.client.wfmodel.WfRequester reqInternal) {
23       __collective = toJoin;
24
25       this.orb = orb;
26       //toJoin.__recruit(this);
27
this.reqInternal = reqInternal;
28    }
29
30    /**
31     * Gets the number of processes.
32     */

33    public int how_many_performer() throws BaseException {
34       try {
35          return reqInternal.how_many_performer();
36       } catch (Exception JavaDoc ex) {
37          throw new BaseException();
38       }
39    }
40
41    /**
42     * Gets an iterator of processes.
43     */

44    public WfProcessIterator get_iterator_performer() throws BaseException {
45
46       try {
47          WfProcessIterator iter = SharkCORBAUtilities.makeWfProcessIterator(new WfProcessIteratorCORBA(orb, __collective,
48                                            reqInternal.get_iterator_performer()));
49           __collective.__recruit(iter);
50           return iter;
51
52       } catch (Exception JavaDoc ex) {
53          throw new BaseException();
54       }
55
56    }
57
58    /**
59     * A list of processes
60     *
61     * @return List of WfProcess objects.
62     */

63    public WfProcess[] get_sequence_performer(int max_number) throws BaseException {
64       try {
65          return SharkCORBAUtilities.makeCORBAProcesses(__collective, reqInternal.get_sequence_performer(max_number));
66       } catch (Exception JavaDoc ex) {
67          throw new BaseException();
68       }
69    }
70
71    /**
72     * Checks if a WfProcess is associated with this requester object
73     *
74     * @return true if the process is found.
75     */

76    public boolean is_member_of_performer(WfProcess member) throws BaseException {
77       try {
78          boolean ret = false;
79          WfProcess[] perfs = SharkCORBAUtilities.makeCORBAProcesses(__collective, reqInternal.get_sequence_performer(0));
80          if (perfs != null) {
81             for (int i = 0; i < perfs.length; i++) {
82                WfProcess perf = perfs[i];
83                if (perf.key().equals(member.key())) {
84                   ret = true;
85                   break;
86                }
87             }
88          }
89          return ret;
90       } catch (Exception JavaDoc ex) {
91          throw new BaseException();
92       }
93    }
94
95    public void receive_event(WfEventAudit event) throws BaseException,
96                                                 InvalidPerformer {
97       throw new BaseException();
98    }
99
100 }
101
102
Popular Tags