1 package org.enhydra.shark.corba; 2 3 import org.omg.WfBase.*; 4 import org.enhydra.shark.corba.WorkflowService.*; 5 6 11 public class RepositoryManagerCORBA extends _RepositoryMgrImplBase { 12 private SharkCORBAServer myServer; 13 14 private String userId; 15 16 private boolean connected = false; 17 18 org.enhydra.shark.api.client.wfservice.RepositoryMgr myRepMgr; 19 20 RepositoryManagerCORBA(SharkCORBAServer server, 21 org.enhydra.shark.api.client.wfservice.RepositoryMgr rm) { 22 this.myServer = server; 23 this.myRepMgr = rm; 24 } 25 26 public void connect(String userId, 27 String password, 28 String engineName, 29 String scope) throws BaseException, ConnectFailed { 30 this.userId = userId; 31 32 try { 33 if (!myServer.validateUser(userId, password)) { throw new ConnectFailed("Connection failed, invalid username or password"); } 34 connected = true; 35 myRepMgr.connect(userId); 36 } catch (ConnectFailed cf) { 37 throw cf; 38 } catch (Exception ex) { 39 throw new BaseException(); 40 } 41 } 42 43 public void disconnect() throws BaseException, NotConnected { 44 if (!connected) { throw new NotConnected("The connection is not established..."); } 45 connected = false; 46 this._orb().disconnect(this); 47 } 48 49 public void deletePkg(String relativePath) throws BaseException, 50 NotConnected, 51 RepositoryInvalid { 52 if (!connected) { throw new NotConnected("The connection is not established..."); } 53 try { 54 myRepMgr.deletePackage(relativePath); 55 } catch (org.enhydra.shark.api.client.wfservice.RepositoryInvalid ri) { 56 throw new RepositoryInvalid(ri.getXPDLValidationErrors()); 57 } catch (Exception ex) { 58 throw new BaseException(); 59 } 60 } 61 62 public void uploadPkg(byte[] pkgContent, String relativePath) throws BaseException, 63 NotConnected, 64 RepositoryInvalid { 65 if (!connected) { throw new NotConnected("The connection is not established..."); } 66 try { 67 myRepMgr.uploadPackage(pkgContent, relativePath); 68 } catch (org.enhydra.shark.api.client.wfservice.RepositoryInvalid ri) { 69 throw new RepositoryInvalid(ri.getXPDLValidationErrors()); 70 } catch (Exception ex) { 71 throw new BaseException(); 72 } 73 } 74 75 public String [] getPackagePaths() throws BaseException, NotConnected { 76 if (!connected) { throw new NotConnected("The connection is not established..."); } 77 try { 78 return myRepMgr.getPackagePaths(); 79 } catch (Exception ex) { 80 throw new BaseException(); 81 } 82 } 83 84 public NameValue[] getPackagePathToIdMapping() throws BaseException, 85 NotConnected { 86 if (!connected) { throw new NotConnected("The connection is not established..."); } 87 try { 88 return SharkCORBAUtilities.makeCORBANameValueArray(this._orb(), 89 myRepMgr.getPackagePathToIdMapping()); 90 } catch (Exception ex) { 91 throw new BaseException(); 92 } 93 } 94 95 public String getPackageId(String relativePath) throws BaseException, 96 NotConnected { 97 if (!connected) { throw new NotConnected("The connection is not established..."); } 98 try { 99 return myRepMgr.getPackageId(relativePath); 100 } catch (Exception ex) { 101 throw new BaseException(); 102 } 103 } 104 105 } | Popular Tags |