KickJava   Java API By Example, From Geeks To Geeks.

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


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 limits.
9  * @author Sasa Bojanic
10  */

11 public class LimitAdminCORBA extends _LimitAdministrationImplBase {
12    private SharkCORBAServer myServer;
13
14    private String JavaDoc userId;
15    private boolean connected=false;
16
17    org.enhydra.shark.api.client.wfservice.LimitAdministration myLimitAdmin;
18
19    LimitAdminCORBA (SharkCORBAServer server,org.enhydra.shark.api.client.wfservice.LimitAdministration la) {
20       this.myServer=server;
21       this.myLimitAdmin=la;
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          myLimitAdmin.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
50    public void checkLimits () throws BaseException, NotConnected {
51       if (!connected) {
52          throw new NotConnected("The connection is not established...");
53       }
54       try {
55          myLimitAdmin.checkLimits();
56       } catch (Exception JavaDoc e) {
57          throw new BaseException();
58       }
59    }
60
61    public void checkLimitsForProcesses (String JavaDoc[] procIds) throws BaseException, NotConnected {
62       if (!connected) {
63          throw new NotConnected("The connection is not established...");
64       }
65       try {
66          myLimitAdmin.checkLimits(procIds);
67       } catch (Exception JavaDoc e) {
68          throw new BaseException();
69       }
70    }
71
72    public void checkLimitsForProcess (String JavaDoc procId) throws BaseException, NotConnected {
73       if (!connected) {
74          throw new NotConnected("The connection is not established...");
75       }
76       try {
77          myLimitAdmin.checkLimits(procId);
78       } catch (Exception JavaDoc e) {
79          throw new BaseException();
80       }
81    }
82
83    public void checkProcessLimit (String JavaDoc procId) throws BaseException, NotConnected {
84       if (!connected) {
85          throw new NotConnected("The connection is not established...");
86       }
87       try {
88          myLimitAdmin.checkProcessLimit(procId);
89       } catch (Exception JavaDoc e) {
90          throw new BaseException();
91       }
92    }
93
94    public void checkActivityLimit (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          myLimitAdmin.checkActivityLimit(procId,actId);
100       } catch (Exception JavaDoc e) {
101          throw new BaseException();
102       }
103    }
104
105 }
106
Popular Tags