1 26 27 package org.objectweb.openccm.ast.lib; 28 29 30 import org.objectweb.openccm.ast.api.TypeKind; 31 32 33 import org.objectweb.openccm.ast.api.DeclarationKind; 34 35 36 import org.objectweb.openccm.ast.api.InterfaceDecl; 37 38 39 import org.omg.CORBA.ComponentIR.EventDef; 40 import org.omg.CORBA.ComponentIR.EventDefHelper; 41 42 65 66 public class EventDeclImpl 67 extends ValueDeclImpl 68 implements org.objectweb.openccm.ast.api.EventDecl 69 { 70 76 77 private EventDef event_def_; 78 79 80 private InterfaceDeclImpl client_mapping_; 81 82 83 private InterfaceDeclImpl local_consumer_mapping_; 84 85 91 96 public 97 EventDeclImpl(Repository rep, 98 ScopeImpl parent) 99 { 100 super(rep, parent); 102 103 event_def_ = null; 105 client_mapping_ = null; 106 local_consumer_mapping_ = null; 107 } 108 109 115 121 126 protected void 127 load(org.omg.CORBA.Contained contained) 128 { 129 event_def_ = EventDefHelper.narrow(contained); 130 131 getClientMapping(); 133 getLocalConsumerMapping(); 134 135 super.load(contained); 136 } 137 138 143 protected org.omg.CORBA.Contained 144 getContained() 145 { 146 return event_def_; 147 } 148 149 155 160 protected org.omg.CORBA.Container 161 getContainer() 162 { 163 return event_def_; 164 } 165 166 172 175 protected void 176 createContainer() 177 { 178 event_def_ = the_parent_.getComponentContainer(). 180 create_event(getId(), getName(), getVersion(), 181 is_custom_, is_abstract_, 182 getBaseValueDef(), 183 is_truncatable_, 184 abstract_base_values_.getValueDefSeq(), 185 supported_interfaces_.getInterfaceDefSeq(), 186 new org.omg.CORBA.ExtInitializer[0]); 187 } 188 189 195 200 public org.omg.CORBA.ExtValueDef 201 getExtValueDef() 202 { 203 return event_def_; 204 } 205 206 211 public org.omg.CORBA.ValueDef 212 getValueDef() 213 { 214 return event_def_; 215 } 216 217 222 public EventDef 223 getEventDef() 224 { 225 return event_def_; 226 } 227 228 234 240 245 public long 246 getDeclKind() 247 { 248 return DeclarationKind.dk_event; 249 } 250 251 257 263 269 274 public TypeKind 275 getTypeKind() 276 { 277 return TypeKind.tk_event; 278 } 279 280 286 292 297 public org.omg.CORBA.IDLType 298 getIDLType() 299 { 300 return event_def_; 301 } 302 303 309 314 public InterfaceDecl 315 getClientMapping() 316 { 317 if (client_mapping_==null) 318 { 319 String base_id = getId(); 321 int idx = base_id.lastIndexOf(':'); 322 base_id = base_id.substring(0, idx); 323 String id = base_id + "Consumer:" + getVersion(); 324 325 client_mapping_ = (InterfaceDeclImpl)getRepository(). 326 loadMapping(getParent(), id); 327 } 328 return client_mapping_; 329 } 330 331 337 342 public InterfaceDecl 343 getLocalConsumerMapping() 344 { 345 if (local_consumer_mapping_==null) 346 { 347 String parent_base_id = the_parent_.getId(); 349 int idx = parent_base_id.lastIndexOf(':'); 350 parent_base_id = parent_base_id.substring(0, idx); 351 String id = parent_base_id + "/CCM_" + getName() + 352 "Consumer:" + getVersion(); 353 354 local_consumer_mapping_ = (InterfaceDeclImpl)getRepository(). 355 loadMapping(getParent(), id); 356 } 357 return local_consumer_mapping_; 358 } 359 } 360 | Popular Tags |