1 5 package SOFA.SOFAnode.InOut.Connector; 6 7 import SOFA.Connector.ConnectorException; 8 import SOFA.Connector.LinkException; 9 import SOFA.Connector.Linkable; 10 import SOFA.Connector.Reference; 11 import SOFA.Connector.RoleBase; 12 import SOFA.Connector.TaggedProfile; 13 import SOFA.SOFAnode.InOut.InOut2InOut; 14 import SOFA.Util.VMProperties; 15 16 20 public class InOut2InOutConnector { 21 26 public static RoleBase createSrv (InOut2InOut inOut) throws ConnectorException { 27 RoleBase role = new InOut2InOutSRole(); 28 SOFA.Connector.ECG.DeploymentDescriptor cDD = new SOFA.Connector.ECG.DeploymentDescriptor(); 29 cDD.unit = "Server"; 30 role.setDeploymentDescriptor(cDD); 31 32 Linkable skelRMI; 33 String rmiName; 34 String rmihost = System.getProperty(VMProperties.RMI_HOST, "localhost"); 35 String rmiport = System.getProperty(VMProperties.RMI_PORT, "1099"); 36 String inOutName = System.getProperty(VMProperties.TR_NAME, "localInOut"); 37 inOutName = "/SOFA/SOFAnode/InOut/Connector/InOut2InOutRMISkel/" + inOutName; 38 rmiName = "//" + rmihost + ":" + rmiport + inOutName; 39 try { 40 skelRMI = new InOut2InOutRMISkel(inOutName); 41 } catch (Exception e) { 42 throw new ConnectorException("Can't instantiate InOut2InOutRMISkel.\n" + rmiName + "\n", e); 43 } 44 skelRMI.link(role); 45 46 Reference ref = new Reference("SOFA.Connector.ECG.SGenerator.Connectors.DeplDockConnector", 48 new TaggedProfile[]{new SOFA.Connector.ECG.Profiles.LocalProfile(role), new SOFA.Connector.ECG.Profiles.RMIProfile(rmiName)}); 49 role.setSOFAReference(ref); 50 role.link(inOut); 51 return role; 52 } 53 54 59 public static RoleBase createClt (Reference ref) throws ConnectorException { 60 RoleBase role = new SOFA.SOFAnode.InOut.Connector.InOut2InOutCRole(); 61 try { 62 role.link(ref); 63 } catch (LinkException e) { 64 throw new ConnectorException("Can't link connector to InOut.\n" + ref + "\n", e); 65 } 66 return role; 67 } 68 69 } 70 | Popular Tags |