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 PackageAdminCORBA extends _PackageAdministrationImplBase { 13 private SharkCORBAServer myServer; 14 15 private String userId; 16 private boolean connected=false; 17 18 org.enhydra.shark.api.client.wfservice.PackageAdministration myPkgAdmin; 19 20 PackageAdminCORBA (SharkCORBAServer server,org.enhydra.shark.api.client.wfservice.PackageAdministration pa) { 21 this.myServer=server; 22 this.myPkgAdmin=pa; 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 myPkgAdmin.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 public String [] getOpenedPackageIds () throws BaseException, NotConnected { 50 if (!connected) { 51 throw new NotConnected("The connection is not established..."); 52 } 53 try { 54 return myPkgAdmin.getOpenedPackageIds(); 55 } catch (Exception ex) { 56 throw new BaseException(); 57 } 58 } 59 60 public String [] getPackageVersions (String pkgId) throws BaseException, NotConnected { 61 if (!connected) { 62 throw new NotConnected("The connection is not established..."); 63 } 64 try { 65 return myPkgAdmin.getPackageVersions(pkgId); 66 } catch (Exception ex) { 67 throw new BaseException(); 68 } 69 } 70 71 public boolean isPackageOpened (String pkgId) throws BaseException, NotConnected { 72 if (!connected) { 73 throw new NotConnected("The connection is not established..."); 74 } 75 try { 76 return myPkgAdmin.isPackageOpened(pkgId); 77 } catch (Exception ex) { 78 throw new BaseException(); 79 } 80 } 81 82 public byte[] getPackageContent (String pkgId) throws BaseException, NotConnected { 83 if (!connected) { 84 throw new NotConnected("The connection is not established..."); 85 } 86 try { 87 return myPkgAdmin.getPackageContent(pkgId); 88 } catch (Exception ex) { 89 throw new BaseException(); 90 } 91 } 92 93 public byte[] getPackageVersionContent (String pkgId,String pkgVer) throws BaseException, NotConnected { 94 if (!connected) { 95 throw new NotConnected("The connection is not established..."); 96 } 97 try { 98 return myPkgAdmin.getPackageContent(pkgId,pkgVer); 99 } catch (Exception ex) { 100 throw new BaseException(); 101 } 102 } 103 104 public String getCurrentPackageVersion(String pkgId) throws BaseException, NotConnected { 105 if (!connected) { 106 throw new NotConnected("The connection is not established..."); 107 } 108 try { 109 return myPkgAdmin.getCurrentPackageVersion(pkgId); 110 } catch (Exception ex) { 111 throw new BaseException(); 112 } 113 } 114 115 public String openPkg (String relativePath) throws BaseException, NotConnected, PackageInvalid, ExternalPackageInvalid { 116 if (!connected) { 117 throw new NotConnected("The connection is not established..."); 118 } 119 try { 120 return myPkgAdmin.openPackage(relativePath); 121 } catch (org.enhydra.shark.api.client.wfservice.PackageInvalid pi) { 122 throw new PackageInvalid(pi.getXPDLValidationErrors()); 123 } catch (org.enhydra.shark.api.client.wfservice.ExternalPackageInvalid epi) { 124 throw new ExternalPackageInvalid(epi.getXPDLValidationErrors()); 125 } catch (Exception ex) { 126 throw new BaseException(); 127 } 128 } 129 130 public void updatePackage1 (String id, String relativePathToNewPackage) throws BaseException, NotConnected, PackageUpdateNotAllowed, PackageInvalid, ExternalPackageInvalid { 131 if (!connected) { 132 throw new NotConnected("The connection is not established..."); 133 } 134 try { 135 myPkgAdmin.updatePackage(id,relativePathToNewPackage); 136 } catch (org.enhydra.shark.api.client.wfservice.PackageInvalid pi) { 137 throw new PackageInvalid(pi.getXPDLValidationErrors()); 138 } catch (org.enhydra.shark.api.client.wfservice.ExternalPackageInvalid epi) { 139 throw new ExternalPackageInvalid(epi.getXPDLValidationErrors()); 140 } catch (org.enhydra.shark.api.client.wfservice.PackageUpdateNotAllowed pna) { 141 throw new PackageUpdateNotAllowed(); 142 } catch (Exception ex) { 143 throw new BaseException(); 144 } 145 } 146 147 public void closePkg (String pkgId) throws BaseException, NotConnected, PackageInUse, PackageHasActiveProcesses { 148 if (!connected) { 149 throw new NotConnected("The connection is not established..."); 150 } 151 try { 152 myPkgAdmin.closePackage(pkgId); 153 } catch (org.enhydra.shark.api.client.wfservice.PackageInUse piu) { 154 throw new PackageInUse(); 155 } catch (org.enhydra.shark.api.client.wfservice.PackageHasActiveProcesses phap) { 156 throw new PackageHasActiveProcesses(); 157 } catch (Exception ex) { 158 throw new BaseException(); 159 } 160 } 161 162 public void closePkgWithVersion(String pkgId,String pkgVer) throws BaseException, NotConnected, PackageInUse, PackageHasActiveProcesses { 163 if (!connected) { 164 throw new NotConnected("The connection is not established..."); 165 } 166 try { 167 myPkgAdmin.closePackage(pkgId,pkgVer); 168 } catch (org.enhydra.shark.api.client.wfservice.PackageInUse piu) { 169 throw new PackageInUse(); 170 } catch (org.enhydra.shark.api.client.wfservice.PackageHasActiveProcesses phap) { 171 throw new PackageHasActiveProcesses(); 172 } catch (Exception ex) { 173 throw new BaseException(); 174 } 175 } 176 177 public boolean isPackageReferenced (String pkgId) throws BaseException, NotConnected { 178 if (!connected) { 179 throw new NotConnected("The connection is not established..."); 180 } 181 try { 182 return myPkgAdmin.isPackageReferenced(pkgId); 183 } catch (Exception ex) { 184 throw new BaseException(); 185 } 186 } 187 188 public void synchronizeXPDLCache () throws BaseException, NotConnected { 189 if (!connected) { 190 throw new NotConnected("The connection is not established..."); 191 } 192 try { 193 myPkgAdmin.synchronizeXPDLCache(); 194 } catch (Exception ex) { 195 throw new BaseException(); 196 } 197 } 198 199 public void clearXPDLCache () throws BaseException, NotConnected { 200 if (!connected) { 201 throw new NotConnected("The connection is not established..."); 202 } 203 try { 204 myPkgAdmin.clearXPDLCache(); 205 } catch (Exception ex) { 206 throw new BaseException(); 207 } 208 } 209 210 public void refreshXPDLCache () throws BaseException, NotConnected { 211 if (!connected) { 212 throw new NotConnected("The connection is not established..."); 213 } 214 try { 215 myPkgAdmin.refreshXPDLCache(); 216 } catch (Exception ex) { 217 throw new BaseException(); 218 } 219 } 220 221 } 222 223 | Popular Tags |