1 package org.enhydra.shark.corba; 2 3 import org.enhydra.shark.corba.WorkflowService.*; 4 import org.omg.CORBA.ORB ; 5 import org.omg.WfBase.BaseException; 6 import org.omg.WorkflowModel.*; 7 8 15 public class SharkConnectionCORBA extends _SharkConnectionImplBase implements 16 Collective { 17 18 org.enhydra.shark.api.client.wfservice.SharkConnection mySharkConn; 19 private SharkCORBAServer myServer; 20 21 SharkConnectionCORBA(SharkCORBAServer server, org.enhydra.shark.api.client.wfservice.SharkConnection sc) { 22 this.myServer = server; 23 this.mySharkConn = sc; 24 if (myServer.trackObjects) { 25 __collective = new Collective.CollectiveCORBA(); 26 } 27 } 28 29 public void connect(String userId, 30 String password, 31 String engineName, 32 String scope) throws BaseException, ConnectFailed { 33 try { 34 mySharkConn.connect(userId, password, engineName, scope); 35 } catch (org.enhydra.shark.api.client.wfservice.ConnectFailed cf) { 36 throw new ConnectFailed(); 37 } catch (Exception ex) { 38 throw new BaseException(); 39 } 40 } 41 42 public void disconnect() throws BaseException, NotConnected { 43 try { 44 mySharkConn.disconnect(); 45 } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) { 46 throw new NotConnected(nc.getMessage()); 47 } catch (Exception ex) { 48 throw new BaseException(); 49 } finally { 50 this.__disband(this._orb()); 51 } 52 } 53 54 public WfResource getResourceObject() throws BaseException, NotConnected { 55 try { 56 return new WfResourceCORBA(this, 57 mySharkConn.getResourceObject()); 58 } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) { 59 throw new NotConnected(nc.getMessage()); 60 } catch (Exception ex) { 61 throw new BaseException(); 62 } 63 } 64 65 public WfProcess createProcess(String pkgId, String pDefId) throws BaseException, 66 NotConnected, 67 NotEnabled { 68 try { 69 WfProcessCORBA ret = new WfProcessCORBA(this, 70 mySharkConn.createProcess(pkgId, 71 pDefId)); 72 return ret; 73 } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) { 74 throw new NotConnected(nc.getMessage()); 75 } catch (org.enhydra.shark.api.client.wfmodel.NotEnabled ne) { 76 throw new NotEnabled(ne.getMessage()); 77 } catch (Exception ex) { 78 throw new BaseException(); 79 } 80 } 81 82 public WfProcess createProcessWithRequester (WfRequester requester, 83 String pkgId, 84 String pDefId) throws BaseException, 85 NotConnected, 86 NotEnabled, 87 InvalidRequester, 88 RequesterRequired { 89 try { 90 WfLinkingRequesterForCORBA lr = new WfLinkingRequesterForCORBA(); 91 org.enhydra.shark.api.client.wfmodel.WfProcess procInternal= 92 mySharkConn.createProcess(lr,pkgId,pDefId); 93 WfLinkingRequesterForCORBA.setCORBARequester(procInternal.key(), requester); 94 WfProcessCORBA ret = new WfProcessCORBA(this,procInternal); 95 return ret; 96 } catch (org.enhydra.shark.api.client.wfservice.NotConnected nc) { 97 throw new NotConnected(nc.getMessage()); 98 } catch (org.enhydra.shark.api.client.wfmodel.NotEnabled ne) { 99 throw new NotEnabled(ne.getMessage()); 100 } catch (org.enhydra.shark.api.client.wfmodel.InvalidRequester ir) { 101 throw new InvalidRequester(ir.getMessage()); 102 } catch (org.enhydra.shark.api.client.wfmodel.RequesterRequired rr) { 103 throw new RequesterRequired(rr.getMessage()); 104 } catch (Exception ex) { 105 throw new BaseException(); 106 } 107 108 } 109 Collective __collective; 110 111 public void __recruit(org.omg.CORBA.Object obj) { 112 if (myServer.trackObjects) 113 __collective.__recruit(obj); 114 } 115 116 public void __leave(org.omg.CORBA.Object obj) { 117 if (myServer.trackObjects) 118 __collective.__leave(obj); 119 } 120 121 public void __disband(ORB _orb) { 122 if (myServer.trackObjects) { 123 __collective.__disband(_orb); 124 } 125 this._orb().disconnect(this); 126 } 127 128 public void doneWith(org.omg.CORBA.Object toDisconnect) { 129 myServer.doneWith(toDisconnect); 130 __leave(toDisconnect); 131 } 132 } | Popular Tags |