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.InOut2Client; 14 import SOFA.Util.VMProperties; 15 16 21 public class InOut2ClientConnector { 22 23 30 public static RoleBase createSrv (InOut2Client inOut) throws ConnectorException { 31 RoleBase role = new InOut2ClientSRole(); 32 SOFA.Connector.ECG.DeploymentDescriptor cDD = new SOFA.Connector.ECG.DeploymentDescriptor(); 33 cDD.unit = "Server"; 34 role.setDeploymentDescriptor(cDD); 35 36 Linkable skelRMI; 37 String rmiName; 38 String rmihost = System.getProperty(VMProperties.RMI_HOST, "localhost"); 39 String rmiport = System.getProperty(VMProperties.RMI_PORT, "1099"); 40 String inOutName = System.getProperty(VMProperties.TR_NAME, "localInOut"); 41 inOutName = "/SOFA/SOFAnode/InOut/Connector/InOut2ClientRMISkel/" + inOutName; 42 rmiName = "//" + rmihost + ":" + rmiport + inOutName; 43 try { 44 skelRMI = new InOut2ClientRMISkel(inOutName); 45 } catch (Exception e) { 46 throw new ConnectorException("Can't instantiate InOut2ClientRMISkel.\n" + rmiName + "\n", e); 47 } 48 skelRMI.link(role); 49 50 Reference ref = new Reference("SOFA.Connector.ECG.SGenerator.Connectors.DeplDockConnector", 52 new TaggedProfile[]{new SOFA.Connector.ECG.Profiles.LocalProfile(role), new SOFA.Connector.ECG.Profiles.RMIProfile(rmiName)}); 53 role.setSOFAReference(ref); 54 role.link(inOut); 55 return role; 56 } 57 58 63 public static RoleBase createClt (Reference ref) throws ConnectorException { 64 RoleBase role = new SOFA.SOFAnode.InOut.Connector.InOut2ClientCRole(); 65 try { 66 role.link(ref); 67 } catch (LinkException e) { 68 throw new ConnectorException("Can't link connector to InOut.\n" + ref + "\n", e); 69 } 70 return role; 71 } 72 73 } 74 | Popular Tags |