1 2 package SOFA.Connector.Boot; 3 4 import SOFA.Connector.ConnectorException; 5 import SOFA.Connector.Linkable; 6 import SOFA.Connector.Reference; 7 import SOFA.Connector.RoleBase; 8 import SOFA.Connector.TaggedProfile; 9 import SOFA.SOFAnode.Run.Deployment.DeplDock; 10 11 15 public class DeplDockConnector { 16 17 22 public static RoleBase createSrv(DeplDock ddock, String name) throws ConnectorException { 23 RoleBase role = new SOFA.Connector.Boot.DeplDockSRole(); 24 SOFA.Connector.ECG.DeploymentDescriptor cDD = new SOFA.Connector.ECG.DeploymentDescriptor(); 25 cDD.unit="Server"; 26 role.setDeploymentDescriptor(cDD); 27 28 Linkable skelRMI; 29 String rmiName; 30 String rmihost = System.getProperty("sofa.rmihost", "localhost"); 31 String rmiport = System.getProperty("sofa.rmiport", "1099"); 32 try { 33 rmiName="//"+rmihost+":"+rmiport+"/SOFA/Connectors/Boot/DeplDockRMISkel/"+name; 34 skelRMI = new SOFA.Connector.Boot.DeplDockRMISkel(name); 35 } catch (Exception e) { 36 throw new ConnectorException("Can't instantiate DeplDockRMISkel.",e); 37 } 38 skelRMI.link(role); 39 40 Reference ref=new Reference("SOFA.Connector.ECG.SGenerator.Connectors.DeplDockConnector", 42 new TaggedProfile[] { new SOFA.Connector.ECG.Profiles.LocalProfile(role), new SOFA.Connector.ECG.Profiles.RMIProfile(rmiName) } ); 43 role.setSOFAReference(ref); 44 role.link(ddock); 45 return role; 46 } 47 48 52 public static RoleBase createClt(SOFA.Connector.Reference ref) throws ConnectorException { 53 RoleBase role = new SOFA.Connector.Boot.DeplDockCRole(); 54 try { 55 role.link(ref); 56 } catch (SOFA.Connector.LinkException e) { 57 throw new ConnectorException("Can't link connector to DeplDock.", e); 58 } 59 return role; 60 } 61 } 62 | Popular Tags |