KickJava   Java API By Example, From Geeks To Geeks.

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


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

11 public class LimitAdminCORBA extends LimitAdministrationPOA {
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
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          myLimitAdmin.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
51    public void checkLimits () throws BaseException, NotConnected {
52       if (!connected) {
53          throw new NotConnected("The connection is not established...");
54       }
55       try {
56          myLimitAdmin.checkLimits();
57       } catch (Exception JavaDoc e) {
58          throw new BaseException();
59       }
60    }
61
62    public void checkLimitsForProcesses (String JavaDoc[] procIds) throws BaseException, NotConnected {
63       if (!connected) {
64          throw new NotConnected("The connection is not established...");
65       }
66       try {
67          myLimitAdmin.checkLimits(procIds);
68       } catch (Exception JavaDoc e) {
69          throw new BaseException();
70       }
71    }
72
73    public void checkLimitsForProcess (String JavaDoc procId) throws BaseException, NotConnected {
74       if (!connected) {
75          throw new NotConnected("The connection is not established...");
76       }
77       try {
78          myLimitAdmin.checkLimits(procId);
79       } catch (Exception JavaDoc e) {
80          throw new BaseException();
81       }
82    }
83
84    public void checkProcessLimit (String JavaDoc procId) throws BaseException, NotConnected {
85       if (!connected) {
86          throw new NotConnected("The connection is not established...");
87       }
88       try {
89          myLimitAdmin.checkProcessLimit(procId);
90       } catch (Exception JavaDoc e) {
91          throw new BaseException();
92       }
93    }
94
95    public void checkActivityLimit (String JavaDoc procId,String JavaDoc actId) throws BaseException, NotConnected {
96       if (!connected) {
97          throw new NotConnected("The connection is not established...");
98       }
99       try {
100          myLimitAdmin.checkActivityLimit(procId,actId);
101       } catch (Exception JavaDoc e) {
102          throw new BaseException();
103       }
104    }
105
106 }
107
Popular Tags