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