KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.enhydra.shark.corba;
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 Sasa Bojanic
10  */

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