1 2 package SOFA.Connector.Boot; 3 4 import SOFA.Component.ComponentLifecycleException; 5 import SOFA.Component.NamingException; 6 import SOFA.Component.DCUP.DCUPComponentManager; 7 import SOFA.Connector.LinkException; 8 import SOFA.Connector.RoleBaseImpl; 9 import SOFA.Connector.TaggedProfile; 10 import SOFA.SOFAnode.Run.Storage; 11 12 public class DCUPComponentManagerCRole extends RoleBaseImpl implements DCUPComponentManager { 13 14 private DCUPComponentManager tgt = null; 15 16 public DCUPComponentManagerCRole() {} 17 18 public void link(Object target) throws LinkException { 19 try { 20 if (target instanceof SOFA.Connector.Reference) { 21 SOFA.Connector.Reference ref = (SOFA.Connector.Reference) target; 22 setSOFAReference(ref); 23 TaggedProfile[] profiles = ref.profiles; 24 for (int i = 0; i<profiles.length; i++) { 25 if ("LOCAL".equals(profiles[i].tag)) { 26 tgt = (DCUPComponentManager)((SOFA.Connector.ECG.Profiles.LocalProfile)profiles[i]).link; 27 return; 28 } else if ("RMI".equals(profiles[i].tag)) { 29 tgt = new DCUPComponentManagerRMIStub(((SOFA.Connector.ECG.Profiles.RMIProfile)profiles[i]).URL); 30 return; 31 } 32 } 33 } else { 34 tgt = (DCUPComponentManager) target; 35 } 36 } catch (Exception e) { 37 throw new LinkException("Can't link DCUPComponentManagerCRole.", e); 38 } 39 } 40 41 public void createComponent(Storage stateStore) throws ComponentLifecycleException { 42 tgt.createComponent(stateStore); 43 } 44 45 public void destroyComponent(Storage stateStore) throws ComponentLifecycleException { 46 tgt.destroyComponent(stateStore); 47 } 48 49 public void storeComponent(Storage stateStore) throws ComponentLifecycleException { 50 tgt.storeComponent(stateStore); 51 } 52 53 public void restoreComponent(Storage stateStore) throws ComponentLifecycleException { 54 tgt.restoreComponent(stateStore); 55 } 56 57 public void registerSubcomponent(java.lang.String name, SOFA.Connector.Reference target) throws SOFA.Component.NamingException, SOFA.Component.InstantiationException { 58 tgt.registerSubcomponent(name, target); 59 } 60 61 public void unregisterSubcomponent(java.lang.String name) throws SOFA.Component.NamingException { 62 tgt.unregisterSubcomponent(name); 63 } 64 65 66 public void updateComponent(SOFA.SOFAnode.Run.Deployment.DeploymentDescriptor newDeploymentDescriptor, Storage stateStore) throws ComponentLifecycleException { 67 tgt.updateComponent(newDeploymentDescriptor, stateStore); 68 } 69 70 public SOFA.Connector.Reference getProvisionReference(String name) throws NamingException { 71 return tgt.getProvisionReference(name); 72 } 73 74 public void setRequirement(String name, SOFA.Connector.Reference ref) throws SOFA.Component.InstantiationException, NamingException { 75 tgt.setRequirement(name, ref); 76 } 77 78 public void connectSubsumable() throws NamingException, SOFA.Component.InstantiationException { 79 tgt.connectSubsumable(); 80 } 81 82 public SOFA.SOFAnode.Run.Deployment.DeplDock getLocalDeplDock() { 83 return tgt.getLocalDeplDock(); 84 } 85 86 public String getFullName() { 87 return tgt.getFullName(); 88 } 89 90 public boolean isUpdatable() { 91 return tgt.isUpdatable(); 92 } 93 94 public Object [] getFcInterfaces() { 95 return tgt.getFcInterfaces(); 96 } 97 98 public Object getFcInterface(java.lang.String itfName) throws org.objectweb.fractal.api.NoSuchInterfaceException { 99 return tgt.getFcInterface(itfName); 100 } 101 102 public org.objectweb.fractal.api.Type getFcType() { 103 return this; 104 } 105 106 public boolean isFcSubtypeOf(org.objectweb.fractal.api.Type t) { 107 return tgt.isFcSubtypeOf(t); 108 } 109 } 110 | Popular Tags |