1 26 27 package org.objectweb.openccm.OpenCCM_DCI.cif; 28 29 import org.objectweb.openccm.OpenCCM_DCI.*; 30 31 39 40 public class AssemblyManagerImpl 41 extends org.objectweb.openccm.OpenCCM_DCI. 42 AssemblyManagerSessionComposition.AssemblyManagerImpl 43 { 44 private String assemblyLoc; 51 private org.objectweb.openccm.OpenCCM_DCI.AssemblyManagerRegistration AMR; 53 private org.omg.Components.Cookie cookie; 55 private boolean removed; 57 public String instanceUUID; 59 private org.objectweb.openccm.OpenCCM_DCI.AssemblyManager AM; 61 62 private String suffix=null; 63 64 70 public AssemblyManagerImpl(String xmlFilePath){ 76 this.assemblyLoc=xmlFilePath; 77 suffix=System.currentTimeMillis()+""; 78 suffix.substring(suffix.length()-5,suffix.length()); 79 suffix=":AssemblyManagerInstance:"+suffix; 80 } 82 83 89 90 public void 91 configuration_complete() 92 { 93 94 try{ 95 96 AMR=get_context().get_connection_assembly_manager_registration(); 97 98 org.omg.Components.SessionContext sc= 99 (org.omg.Components.SessionContext)get_context(); 100 AM=org.objectweb.openccm. 101 OpenCCM_DCI.AssemblyManagerHelper 102 .narrow(sc.get_CCM_object()); 103 104 cookie= 105 AMR.register_assembly_manager(AM); 106 ((AssemblySegImpl)obtain_executor("assembly")) 107 .setupAssemblyManager(org.objectweb.openccm. 108 OpenCCM_DCI.AssemblyManagerHelper 109 .narrow(sc.get_CCM_object())); 110 ((AssemblySegImpl)obtain_executor("assembly")) 111 .setupXMLFilePath(assemblyLoc); 112 ((AssemblySegImpl)obtain_executor("assembly")).registerAssembly(); 113 instanceUUID=((AssemblySegImpl)obtain_executor("assembly")).getName()+suffix; 114 } 115 catch(Exception e){ 116 e.printStackTrace(); 117 } 118 119 120 } 121 122 123 public void 124 ccm_remove() 125 throws org.omg.Components.CCMException 126 { 127 129 130 if(!removed){ 131 removed=true; 132 ((AssemblySegImpl)obtain_executor("assembly")).unregisterAssembly(); 133 try{ 134 AMR.unregister_assembly_manager(cookie); 136 get_context().push_assembly_manager_removed 137 (new AssemblyManagerRemovedImpl(AM)); 138 140 if(org.omg.Components.Deployment.AssemblyState.INSERVICE== 141 ((AssemblySegImpl)obtain_executor("assembly")).get_state()) 142 ((AssemblySegImpl)obtain_executor("assembly")).tear_down(); 143 } 144 catch(Exception e ) 145 { 146 System.out.println("Cannot tear_down assembly"); 147 e.printStackTrace(); 148 } 149 150 } 151 } 152 153 public void 154 push(org.objectweb.openccm.OpenCCM_DCI.ComponentServerManagerRemoved csmr) 155 { 156 return ; 157 } 158 159 165 public org.ist.coach.DCI.DeploymentDescriptor[] descriptors(){ 166 return new org.ist.coach.DCI.DeploymentDescriptor[0]; 167 } 168 169 public String ass_id(){ 170 171 return instanceUUID; 172 173 } 174 175 public void 176 assembly_loc(java.lang.String assemblyLoc) 177 { 178 this.assemblyLoc=assemblyLoc; 179 } 180 181 public String 182 assembly_loc() 183 { 184 return this.assemblyLoc; 185 } 186 187 188 } 189 190 | Popular Tags |