1 26 27 package org.objectweb.openccm.ir3; 28 29 37 38 public class EventDef_impl 39 extends ExtValueDef_impl 40 implements org.omg.CORBA.ComponentIR.EventDefOperations 41 { 42 48 49 protected ValueDef_ref event_base_; 50 51 52 protected org.omg.CORBA.InterfaceDef consumer_itf_; 53 54 55 protected org.omg.CORBA.LocalInterfaceDef ccm_consumer_itf_; 56 57 63 64 public 65 EventDef_impl(IFR ifr, 66 Container_impl container) 67 { 68 super(ifr, container); 70 71 setServant(new org.omg.CORBA.ComponentIR.EventDefPOATie(this)); 73 74 event_base_ = null; 76 consumer_itf_ = null; 77 ccm_consumer_itf_ = null; 78 } 79 80 86 89 protected ValueDef_ref[] 90 getAbstractBaseValues() 91 { 92 if ((!getIFR().getRepository().isIDL2Repository()) || 93 (event_base_==null)) 94 return abstract_base_values_; 95 96 ValueDef_ref[] values = new ValueDef_ref[abstract_base_values_.length+1]; 97 values[0] = event_base_; 98 for (int i=0;i<abstract_base_values_.length;i++) 99 values[i+1] = abstract_base_values_[i]; 100 101 return values; 102 } 103 104 110 113 public org.omg.CORBA.ComponentIR.EventDef 114 asEventDef() 115 { 116 return org.omg.CORBA.ComponentIR.EventDefHelper.narrow(asObject()); 117 } 118 119 125 128 protected void 129 checkDependencies() 130 { 131 if (getReferencedByCounter() == 2) 136 { 137 org.objectweb.util.ref.api.Referencable[] referenced_by = getReferencedBy(); 139 140 if ( ((Contained_impl)referenced_by[0]).defined_in()._is_equivalent(consumer_itf_) 141 && ((Contained_impl)referenced_by[1]).defined_in()._is_equivalent(ccm_consumer_itf_)) 142 { 143 return; 144 } 145 } 146 147 super.checkDependencies(); 149 } 150 151 154 protected void 155 cutDependencies() 156 { 157 if(ccm_consumer_itf_ != null) 159 { 160 try 161 { 162 ccm_consumer_itf_.destroy(); 163 } 164 catch(org.omg.CORBA.OBJECT_NOT_EXIST exc) 165 { 166 } 168 ccm_consumer_itf_ = null; 169 } 170 171 if(consumer_itf_ != null) 173 { 174 try 175 { 176 consumer_itf_.destroy(); 177 } 178 catch(org.omg.CORBA.OBJECT_NOT_EXIST exc) 179 { 180 } 182 consumer_itf_ = null; 183 } 184 185 if (event_base_!=null) 187 { 188 event_base_.cutDependency(); 189 event_base_ = null; 190 } 191 192 super.cutDependencies(); 194 } 195 196 202 205 public org.omg.CORBA.DefinitionKind 206 def_kind() 207 { 208 if (getIFR().getRepository().isIDL2Repository()) 209 return org.omg.CORBA.DefinitionKind.dk_Value; 210 211 return org.omg.CORBA.DefinitionKind.dk_Event; 212 } 213 214 220 223 public void 224 move(org.omg.CORBA.Container new_container, 225 String new_name, 226 String new_version) 227 { 228 super.move(new_container, new_name, new_version); 230 231 if (!getIFR().getRepository().enable_mappings_) 233 return ; 234 235 org.omg.CORBA.InterfaceDef litf = null; 236 String cont_base_id = getBaseContainerID(); 237 238 container_.mapping_started_ = true; 239 240 java.lang.String name = name()+"Consumer"; 242 java.lang.String id = cont_base_id + name + ':' + new_version; 243 litf = org.omg.CORBA.InterfaceDefHelper.narrow( 244 getIFR().getRepository().lookup_mapped_id(id)); 245 litf.move(new_container, name, new_version); 246 247 name = "CCM_"+name()+"Consumer"; 249 id = cont_base_id + name + ':' + new_version; 250 litf = org.omg.CORBA.InterfaceDefHelper.narrow( 251 getIFR().getRepository().lookup_mapped_id(id)); 252 litf.move(new_container, name, new_version); 253 254 container_.mapping_started_ = false; 255 } 256 257 258 264 267 protected void 268 whenCreated() 269 { 270 if (!getIFR().getRepository().enable_mappings_) 272 return ; 273 274 if (getBaseValue().getImpl()==null) 281 { 282 ValueDef_impl val_impl = castToLocal(org.omg.CORBA.ValueDefHelper.narrow( 283 getIFR().getRepository().lookup("::Components::EventBase"))); 284 event_base_ = new ValueDef_ref(this, val_impl); 285 } 286 287 container_.mapping_started_ = true; 289 getIFR().getRepository().addRID(id(), this); 290 container_.mapping_started_ = false; 291 292 String base_id = computeIDWithoutVersion(id()); 296 String name = name() + "Consumer"; 297 String version = version(); 298 String id = base_id + "Consumer:" + version; 299 org.omg.CORBA.InterfaceDef [] bases = new org.omg.CORBA.InterfaceDef [1]; 300 if ( ( getBaseValue().getImpl()==null ) 301 || !(getBaseValue().getImpl() instanceof EventDef_impl) ) 302 { 303 bases[0] = org.omg.CORBA.InterfaceDefHelper.narrow( 309 getIFR().getRepository().lookup("::Components::EventConsumerBase")); 310 } 311 else 312 { 313 String base_consumer_id = computeIDWithoutVersion(getBaseValue().getId()); 317 base_consumer_id = base_consumer_id + 318 "Consumer:" + getBaseValue().getImpl().version(); 319 bases[0] = org.omg.CORBA.InterfaceDefHelper.narrow( 320 getIFR().getRepository().lookup_mapped_id(base_consumer_id)); 321 } 322 323 container_.mapping_started_ = true; 324 consumer_itf_ = container_.create_ext_interface(id, name, version, bases); 325 container_.mapping_started_ = false; 326 327 id = base_id + "Consumer/push_" + name() + ':' + version; 331 name = "push_" + name(); 332 org.omg.CORBA.ParameterDescription [] params = new org.omg.CORBA.ParameterDescription [1]; 333 params[0] = new org.omg.CORBA.ParameterDescription (); 334 params[0].name = "the_" + name().toLowerCase(); 335 params[0].type_def = asValueDef(); 336 params[0].type = params[0].type_def.type(); 337 params[0].mode = org.omg.CORBA.ParameterMode.PARAM_IN; 338 339 consumer_itf_.create_operation(id, name, version, 340 getIFR().getRepository().get_primitive(org.omg.CORBA.PrimitiveKind.pk_void), 341 org.omg.CORBA.OperationMode.OP_NORMAL, 342 params, 343 new org.omg.CORBA.ExceptionDef [0], 344 new java.lang.String [0]); 345 346 String cont_base_id = getBaseContainerID(); 355 name = "CCM_"+name()+"Consumer"; 356 id = cont_base_id + name + ':' + version; 357 358 container_.mapping_started_ = true; 359 org.omg.CORBA.LocalInterfaceDef litf = 360 container_.create_ext_local_interface(id, name, version, 361 new org.omg.CORBA.InterfaceDef [0]); 362 ccm_consumer_itf_ = litf; 363 container_.mapping_started_ = false; 364 365 id = cont_base_id + name + "/push" + ':' + version; 366 name = "push"; 367 params = new org.omg.CORBA.ParameterDescription [1]; 368 params[0] = new org.omg.CORBA.ParameterDescription (); 369 params[0].name = "event"; 370 params[0].type_def = asValueDef(); 371 params[0].type = params[0].type_def.type(); 372 params[0].mode = org.omg.CORBA.ParameterMode.PARAM_IN; 373 litf.create_operation(id, name, version, 374 getIFR().getRepository().get_primitive(org.omg.CORBA.PrimitiveKind.pk_void), 375 org.omg.CORBA.OperationMode.OP_NORMAL, 376 params, 377 new org.omg.CORBA.ExceptionDef [0], 378 new java.lang.String [0]); 379 } 380 } 381 | Popular Tags |