1 2 package SOFA.Connector.Boot; 3 4 import SOFA.Connector.LinkException; 5 import SOFA.Connector.TaggedProfile; 6 7 11 public class DeplDockCRole extends SOFA.Connector.RoleBaseImpl implements SOFA.SOFAnode.Run.Deployment.DeplDock { 12 13 private CNDeplDock tgt = null; 14 15 public DeplDockCRole() {} 16 17 public void link(Object target) throws SOFA.Connector.LinkException { 18 try { 19 if (target instanceof SOFA.Connector.Reference) { 20 SOFA.Connector.Reference ref = (SOFA.Connector.Reference) target; 21 setSOFAReference(ref); 22 TaggedProfile[] profiles = ref.profiles; 23 for (int i = 0; i<profiles.length; i++) { 24 if (profiles[i].tag.compareTo("LOCAL")==0 ) { 25 tgt = (CNDeplDock) ((SOFA.Connector.ECG.Profiles.LocalProfile) profiles[i]).link; 26 return; 27 } else if (profiles[i].tag.compareTo("RMI")==0 ) { 28 tgt = new DeplDockRMIStub(((SOFA.Connector.ECG.Profiles.RMIProfile) profiles[i]).URL); 29 return; 30 } 31 } 32 } else { 33 tgt=(CNDeplDock)target; 34 } 35 } catch (Exception e) { 36 throw new LinkException("Can't link DeplDockCRole.",e); 37 } 38 } 39 40 public SOFA.SOFAnode.Run.Deployment.TechnologyDescriptor[] describeUnderlyingEnvironment() { 41 return tgt.describeUnderlyingEnvironment(); 42 } 43 44 public SOFA.Connector.Reference instantiate(SOFA.SOFAnode.Run.Deployment.DeploymentDescriptor dd, String name) throws SOFA.SOFAnode.Run.Deployment.DeploymentException { 45 return tgt.instantiate(dd, name); 46 } 47 48 public String [] namesOfAllRunningComponents() { 49 return tgt.namesOfAllRunningComponents(); 50 } 51 52 public String [] namesOfAllRunningApplications() { 53 return tgt.namesOfAllRunningApplications(); 54 } 55 56 public SOFA.Connector.Reference getReference(String name) throws SOFA.SOFAnode.Run.Deployment.DeploymentException { 57 return tgt.getReference(name); 58 } 59 60 public void removeComponent(String name) throws SOFA.SOFAnode.Run.Deployment.DeploymentException { 61 tgt.removeComponent(name); 62 } 63 64 } 65 | Popular Tags |