1 package org.enhydra.shark.corba.poa; 2 3 import org.enhydra.shark.corba.ExpressionBuilders.*; 4 import org.enhydra.shark.corba.WorkflowService.ConnectFailed; 5 import org.enhydra.shark.corba.WorkflowService.NotConnected; 6 import org.enhydra.shark.corba.WorkflowService.ExpressionBuilderManagerPOA; 7 import org.enhydra.shark.corba.poa.ActivityIteratorExpressionBuilderCORBA; 8 import org.enhydra.shark.corba.poa.AssignmentIteratorExpressionBuilderCORBA; 9 import org.enhydra.shark.corba.poa.Collective; 10 import org.omg.CORBA.ORB ; 11 import org.omg.CORBA.ORBPackage.InvalidName ; 12 import org.omg.WfBase.BaseException; 13 import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; 14 import org.omg.PortableServer.POAPackage.WrongPolicy ; 15 import org.omg.PortableServer.POAPackage.ServantNotActive ; 16 import org.omg.PortableServer.POAPackage.ObjectNotActive ; 17 import org.omg.PortableServer.POA ; 18 import org.omg.PortableServer.POAHelper ; 19 import org.omg.PortableServer.POAManagerPackage.AdapterInactive ; 20 21 26 public class ExpressionBuilderMgrCORBA extends ExpressionBuilderManagerPOA implements Collective{ 27 28 org.enhydra.shark.api.client.wfservice.ExpressionBuilderManager myEBM; 29 private SharkCORBAServer myServer; 30 private Collective __collective; 31 private AssignmentIteratorExpressionBuilder assignmentIteratorExpressionBuilder = null; 32 private ActivityIteratorExpressionBuilder activityIteratorExpressionBuilder = null; 33 private ProcessIteratorExpressionBuilder processIteratorExpressionBuilder = null; 34 private ProcessMgrIteratorExpressionBuilder processMgrIteratorExpressionBuilder = null; 35 private ResourceIteratorExpressionBuilder resourceIteratorExpressionBuilder = null; 36 37 public ExpressionBuilderMgrCORBA (SharkCORBAServer server, org.enhydra.shark.api.client.wfservice.ExpressionBuilderManager ebm) { 38 this.myEBM=ebm; 39 this.myServer = server; 40 41 if (myServer.trackObjects) { 42 __collective = new Collective.CollectiveCORBA(); 43 } 44 } 45 46 public void connect(String userId, String password, String engineName, String scope) throws BaseException, ConnectFailed { 47 try { 48 if (!myServer.validateUser(userId,password)) { 49 throw new ConnectFailed("Connection failed, invalid username or password"); 50 } 51 } catch (ConnectFailed cf) { 52 throw cf; 53 } catch (Exception ex) { 54 throw new BaseException(); 55 } 56 } 57 58 public void disconnect() throws BaseException, NotConnected { 59 this.__disband(this._orb()); 60 } 61 62 public ActivityIteratorExpressionBuilder getActivityIteratorExpressionBuilder () { 63 ActivityIteratorExpressionBuilderCORBA impl = new ActivityIteratorExpressionBuilderCORBA( myEBM.getActivityIteratorExpressionBuilder()); 65 try { 66 POA rootPOA = SharkCORBAUtilities.getPOA(); 68 byte[] o = rootPOA.activate_object(impl); 69 activityIteratorExpressionBuilder = ActivityIteratorExpressionBuilderHelper.narrow(rootPOA.id_to_reference(o)); 70 71 } catch (ServantAlreadyActive servantAlreadyActive) { 72 servantAlreadyActive.printStackTrace(); 73 } catch (WrongPolicy wrongPolicy) { 74 wrongPolicy.printStackTrace(); 75 }catch (ObjectNotActive objectNotActive) { 76 objectNotActive.printStackTrace(); 77 } 80 81 this.__recruit(activityIteratorExpressionBuilder); 82 return activityIteratorExpressionBuilder; 83 } 84 85 public AssignmentIteratorExpressionBuilder getAssignmentIteratorExpressionBuilder () { 86 AssignmentIteratorExpressionBuilderCORBA impl = new AssignmentIteratorExpressionBuilderCORBA( myEBM.getAssignmentIteratorExpressionBuilder()); 88 89 try { 90 POA rootPOA = SharkCORBAUtilities.getPOA(); 92 byte[] o = rootPOA.activate_object(impl); 93 assignmentIteratorExpressionBuilder = AssignmentIteratorExpressionBuilderHelper.narrow(rootPOA.id_to_reference(o)); 94 95 } catch (ServantAlreadyActive servantAlreadyActive) { 96 servantAlreadyActive.printStackTrace(); 97 } catch (WrongPolicy wrongPolicy) { 98 wrongPolicy.printStackTrace(); 99 } catch (ObjectNotActive objectNotActive) { 100 objectNotActive.printStackTrace(); 101 } 104 105 this.__recruit(assignmentIteratorExpressionBuilder); 106 return assignmentIteratorExpressionBuilder; 107 } 108 109 public EventAuditIteratorExpressionBuilder getEventAuditIteratorExpressionBuilder () { 110 throw new RuntimeException ("Currently not implemented !"); 111 } 113 114 public ProcessIteratorExpressionBuilder getProcessIteratorExpressionBuilder () { 115 ProcessIteratorExpressionBuilderCORBA impl = new ProcessIteratorExpressionBuilderCORBA(myEBM.getProcessIteratorExpressionBuilder()); 117 try { 118 POA rootPOA = SharkCORBAUtilities.getPOA(); 120 byte[] o = rootPOA.activate_object(impl); 121 processIteratorExpressionBuilder = ProcessIteratorExpressionBuilderHelper.narrow(rootPOA.id_to_reference(o)); 122 124 } catch (ServantAlreadyActive servantAlreadyActive) { 125 servantAlreadyActive.printStackTrace(); 126 } catch (WrongPolicy wrongPolicy) { 127 wrongPolicy.printStackTrace(); 128 } catch (ObjectNotActive objectNotActive) { 129 objectNotActive.printStackTrace(); 130 } 133 134 this.__recruit(processIteratorExpressionBuilder); 135 return processIteratorExpressionBuilder; 136 } 137 138 public ProcessMgrIteratorExpressionBuilder getProcessMgrIteratorExpressionBuilder () { 139 ProcessMgrIteratorExpressionBuilderCORBA impl = new ProcessMgrIteratorExpressionBuilderCORBA( myEBM.getProcessMgrIteratorExpressionBuilder()); 141 try { 142 POA rootPOA = SharkCORBAUtilities.getPOA(); 145 byte[] o = rootPOA.activate_object(impl); 146 processMgrIteratorExpressionBuilder = ProcessMgrIteratorExpressionBuilderHelper.narrow(rootPOA.id_to_reference(o)); 148 149 } catch (ServantAlreadyActive servantAlreadyActive) { 150 } catch (WrongPolicy wrongPolicy) { 152 wrongPolicy.printStackTrace(); 153 } catch (ObjectNotActive inActive) { 154 inActive.printStackTrace(); 155 } 158 this.__recruit(processMgrIteratorExpressionBuilder); 159 return processMgrIteratorExpressionBuilder; 160 } 161 162 public ResourceIteratorExpressionBuilder getResourceIteratorExpressionBuilder () { 163 ResourceIteratorExpressionBuilderCORBA impl = new ResourceIteratorExpressionBuilderCORBA(myEBM.getResourceIteratorExpressionBuilder()); 165 try { 166 POA rootPOA = SharkCORBAUtilities.getPOA(); 168 byte[] o = rootPOA.activate_object(impl); 169 resourceIteratorExpressionBuilder = ResourceIteratorExpressionBuilderHelper.narrow(rootPOA.id_to_reference(o)); 170 } catch (ServantAlreadyActive servantAlreadyActive) { 172 servantAlreadyActive.printStackTrace(); 173 } catch (WrongPolicy wrongPolicy) { 174 wrongPolicy.printStackTrace(); 175 } catch (ObjectNotActive objectNotActive) { 178 objectNotActive.printStackTrace(); } 180 this.__recruit(resourceIteratorExpressionBuilder); 181 return resourceIteratorExpressionBuilder; 182 } 183 184 public void __recruit(org.omg.CORBA.Object obj) { 185 if (myServer.trackObjects) 186 __collective.__recruit(obj); 187 } 188 189 public void __leave(org.omg.CORBA.Object obj) { 190 if (myServer.trackObjects) 191 __collective.__leave(obj); 192 } 193 194 public void __disband(ORB _orb) { 195 if (myServer.trackObjects) { 196 __collective.__disband(_orb); 197 } 198 _this()._release(); 200 } 206 } 207 | Popular Tags |