1 package org.enhydra.shark.corba; 2 3 import org.omg.WfBase.*; 4 import org.enhydra.shark.corba.WorkflowService.*; 5 6 7 12 public class CacheAdminCORBA extends _CacheAdministrationImplBase { 13 private SharkCORBAServer myServer; 14 15 private String userId; 16 private boolean connected=false; 17 18 org.enhydra.shark.api.client.wfservice.CacheAdministration myCacheAdmin; 19 20 CacheAdminCORBA (SharkCORBAServer server,org.enhydra.shark.api.client.wfservice.CacheAdministration ca) { 21 this.myServer=server; 22 this.myCacheAdmin=ca; 23 } 24 25 public void connect(String userId, String password, String engineName, String 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 myCacheAdmin.connect(userId); 34 } catch (ConnectFailed cf) { 35 throw cf; 36 } catch (Exception 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._orb().disconnect(this); 47 } 48 49 50 public int getProcessCacheSize () throws BaseException, NotConnected { 51 if (!connected) { 52 throw new NotConnected("The connection is not established..."); 53 } 54 try { 55 return myCacheAdmin.getProcessCacheSize(); 56 } catch (Exception e) { 57 throw new BaseException(); 58 } 59 } 60 61 public void setProcessCacheSize (int size) throws BaseException, NotConnected { 62 if (!connected) { 63 throw new NotConnected("The connection is not established..."); 64 } 65 try { 66 myCacheAdmin.setProcessCacheSize(size); 67 } catch (Exception e) { 68 throw new BaseException(); 69 } 70 } 71 72 public int howManyCachedProcesses() throws BaseException, NotConnected { 73 if (!connected) { 74 throw new NotConnected("The connection is not established..."); 75 } 76 try { 77 return myCacheAdmin.howManyCachedProcesses(); 78 } catch (Exception e) { 79 throw new BaseException(); 80 } 81 } 82 83 public void clearProcessCache () throws BaseException, NotConnected { 84 if (!connected) { 85 throw new NotConnected("The connection is not established..."); 86 } 87 try { 88 myCacheAdmin.clearProcessCache(); 89 } catch (Exception e) { 90 throw new BaseException(); 91 } 92 } 93 94 95 public int getResourceCacheSize () throws BaseException, NotConnected { 96 if (!connected) { 97 throw new NotConnected("The connection is not established..."); 98 } 99 try { 100 return myCacheAdmin.getResourceCacheSize(); 101 } catch (Exception e) { 102 throw new BaseException(); 103 } 104 } 105 106 public void setResourceCacheSize(int size) throws BaseException, NotConnected { 107 if (!connected) { 108 throw new NotConnected("The connection is not established..."); 109 } 110 try { 111 myCacheAdmin.setResourceCacheSize(size); 112 } catch (Exception e) { 113 throw new BaseException(); 114 } 115 } 116 117 public int howManyCachedResources() throws BaseException, NotConnected { 118 if (!connected) { 119 throw new NotConnected("The connection is not established..."); 120 } 121 try { 122 return myCacheAdmin.howManyCachedResources(); 123 } catch (Exception e) { 124 throw new BaseException(); 125 } 126 } 127 128 public void clearResourceCache () throws BaseException, NotConnected { 129 if (!connected) { 130 throw new NotConnected("The connection is not established..."); 131 } 132 try { 133 myCacheAdmin.clearResourceCache(); 134 } catch (Exception e) { 135 throw new BaseException(); 136 } 137 } 138 139 } 140 | Popular Tags |