KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba.poa;
2
3 import org.omg.WfBase.*;
4 import org.enhydra.shark.corba.WorkflowService.*;
5
6
7 /**
8  * The implementation of client interface through which client can check deadlines.
9  * @author David Forslund
10  */

11 public class DeadlineAdminCORBA extends DeadlineAdministrationPOA {
12    private SharkCORBAServer myServer;
13
14    private String JavaDoc userId;
15    private boolean connected=false;
16
17    org.enhydra.shark.api.client.wfservice.DeadlineAdministration myDeadlineAdmin;
18
19    DeadlineAdminCORBA (SharkCORBAServer server,org.enhydra.shark.api.client.wfservice.DeadlineAdministration da) {
20       this.myServer=server;
21       this.myDeadlineAdmin=da;
22
23    }
24
25    public void connect(String JavaDoc userId, String JavaDoc password, String JavaDoc engineName, String JavaDoc scope) throws BaseException, ConnectFailed {
26       this.userId=userId;
27
28       try {
29          if (!myServer.validateUser(userId,password)) {
30             throw new ConnectFailed("Connection failed, invalid username or password");
31          }
32          connected=true;
33          myDeadlineAdmin.connect(userId);
34       } catch (ConnectFailed cf) {
35          throw cf;
36       } catch (Exception JavaDoc ex) {
37          throw new BaseException();
38       }
39    }
40
41    public void disconnect() throws BaseException, NotConnected {
42       if (!connected) {
43          throw new NotConnected("The connection is not established...");
44       }
45       connected=false;
46       _this()._release();
47    }
48
49
50    public void checkDeadlines () throws BaseException, NotConnected {
51       if (!connected) {
52          throw new NotConnected("The connection is not established...");
53       }
54       try {
55          myDeadlineAdmin.checkDeadlines();
56       } catch (Exception JavaDoc e) {
57          throw new BaseException();
58       }
59    }
60
61    public String JavaDoc[] checkDeadlines(final int instancesPerTransaction, int failuresToIgnore) throws BaseException,NotConnected {
62       if (!connected) {
63          throw new NotConnected("The connection is not established...");
64       }
65       try {
66          return myDeadlineAdmin.checkDeadlines(instancesPerTransaction,failuresToIgnore);
67       } catch (Exception JavaDoc e) {
68          throw new BaseException();
69       }
70    }
71
72    public void checkDeadlinesForProcesses (String JavaDoc[] procIds) throws BaseException, NotConnected {
73       if (!connected) {
74          throw new NotConnected("The connection is not established...");
75       }
76       try {
77          myDeadlineAdmin.checkDeadlines(procIds);
78       } catch (Exception JavaDoc e) {
79          throw new BaseException();
80       }
81    }
82
83    public void checkProcessDeadlines (String JavaDoc procId) throws BaseException, NotConnected {
84       if (!connected) {
85          throw new NotConnected("The connection is not established...");
86       }
87       try {
88          myDeadlineAdmin.checkDeadlines(procId);
89       } catch (Exception JavaDoc e) {
90          throw new BaseException();
91       }
92    }
93
94    public void checkActivityDeadline (String JavaDoc procId,String JavaDoc actId) throws BaseException, NotConnected {
95       if (!connected) {
96          throw new NotConnected("The connection is not established...");
97       }
98       try {
99          myDeadlineAdmin.checkDeadline(procId,actId);
100       } catch (Exception JavaDoc e) {
101          throw new BaseException();
102       }
103    }
104
105    public String JavaDoc[] checkDeadlinesMultiTrans(int instancesPerTransaction, int failuresToIgnore) throws BaseException, NotConnected {
106       if (!connected) {
107          throw new NotConnected("The connection is not established...");
108       }
109       try {
110          return myDeadlineAdmin.checkDeadlines(instancesPerTransaction, failuresToIgnore);
111       } catch (Exception JavaDoc e) {
112          throw new BaseException();
113       }
114    }
115
116    public DeadlineInfo[] getDeadlineInfoForProcess (String JavaDoc procId) throws BaseException, NotConnected {
117       if (!connected) {
118          throw new NotConnected("The connection is not established...");
119       }
120       try {
121          return SharkCORBAUtilities.makeDeadlineInfoArray(myDeadlineAdmin.getDeadlineInfo(procId));
122       } catch (Exception JavaDoc e) {
123          throw new BaseException();
124       }
125    }
126
127    public DeadlineInfo[] getDeadlineInfoForActivity (String JavaDoc procId,String JavaDoc actId) throws BaseException, NotConnected {
128       if (!connected) {
129          throw new NotConnected("The connection is not established...");
130       }
131       try {
132          return SharkCORBAUtilities.makeDeadlineInfoArray(myDeadlineAdmin.getDeadlineInfo(procId,actId));
133       } catch (Exception JavaDoc e) {
134          throw new BaseException();
135       }
136    }
137
138 }
139
Popular Tags