1 26 27 package org.objectweb.ccm.IDL3; 28 29 37 38 public class EventDeclImpl 39 extends ValueDeclImpl 40 implements EventRef, EventDecl 41 { 42 48 51 private org.omg.CORBA.ComponentIR.EventDef event_def_; 52 53 56 private InterfaceDeclImpl client_mapping_; 57 58 61 private InterfaceDeclImpl local_consumer_mapping_; 62 63 69 74 public 75 EventDeclImpl(Repository rep, ScopeImpl parent) 76 { 77 super(rep, parent); 79 80 event_def_ = null; 82 client_mapping_ = null; 83 local_consumer_mapping_ = null; 84 the_declaration_kind_ = DeclarationKind._dk_event; 85 } 86 87 93 98 protected void 99 load(org.omg.CORBA.Contained contained) 100 { 101 event_def_ = org.omg.CORBA.ComponentIR.EventDefHelper.narrow(contained); 102 103 getClientMapping(); 105 getLocalConsumerMapping(); 106 107 super.load(contained); 108 } 109 110 116 121 public org.omg.CORBA.IDLType 122 getIDLType() 123 { 124 return event_def_; 125 } 126 127 130 public int 131 getTypeKind() 132 { 133 return TypeKind._tk_event; 134 } 135 136 142 147 public org.omg.CORBA.ComponentIR.EventDef 148 getEventDef() 149 { 150 return event_def_; 151 } 152 153 159 164 public org.omg.CORBA.ExtValueDef 165 getExtValueDef() 166 { 167 return event_def_; 168 } 169 170 175 public org.omg.CORBA.ValueDef 176 getValueDef() 177 { 178 return event_def_; 179 } 180 181 187 190 public InterfaceDecl 191 getClientMapping() 192 { 193 if (client_mapping_!=null) 194 return client_mapping_; 195 196 String base_id = getId(); 198 int idx = base_id.lastIndexOf(':'); 199 base_id = base_id.substring(0, idx); 200 String id = base_id + "Consumer:"+getVersion(); 201 202 client_mapping_ = (InterfaceDeclImpl)getRepository().loadMapping(getParent(), id); 203 return client_mapping_; 204 } 205 206 209 public InterfaceDecl 210 getLocalConsumerMapping() 211 { 212 if (local_consumer_mapping_!=null) 213 return local_consumer_mapping_; 214 215 String parent_base_id = the_parent_.getId(); 217 int idx = parent_base_id.lastIndexOf(':'); 218 parent_base_id = parent_base_id.substring(0, idx); 219 String id = parent_base_id + "/CCM_"+getName()+"Consumer:"+getVersion(); 220 221 local_consumer_mapping_ = (InterfaceDeclImpl)getRepository().loadMapping(getParent(), id); 222 return local_consumer_mapping_; 223 } 224 225 231 236 protected org.omg.CORBA.Contained 237 getContained() 238 { 239 return event_def_; 240 } 241 242 248 253 protected org.omg.CORBA.Container 254 getContainer() 255 { 256 return event_def_; 257 } 258 259 265 268 protected void 269 createContainer() 270 { 271 org.omg.CORBA.ValueDef [] abstract_base_values = 272 new org.omg.CORBA.ValueDef [abstract_base_values_.size()]; 273 for(int i=0; i<abstract_base_values.length; i++) 274 { 275 abstract_base_values[i] = 276 ((ValueRef)(abstract_base_values_.get(i))).getExtValueDef(); 277 } 278 279 org.omg.CORBA.InterfaceDef [] supported_interfaces = 280 new org.omg.CORBA.InterfaceDef [supported_interfaces_.size()]; 281 for(int i=0; i<supported_interfaces.length; i++) 282 { 283 supported_interfaces[i] = 284 ((InterfaceRef)(supported_interfaces_.get(i))).getExtInterfaceDef(); 285 } 286 287 event_def_ = the_parent_.getComponentContainer().create_event( 289 getId(), getName(), getVersion(), 290 is_custom_, is_abstract_, 291 getBaseValueDef(), 292 is_truncatable_, 293 abstract_base_values, 294 supported_interfaces, 295 new org.omg.CORBA.ExtInitializer[0]); 296 } 297 } 298 | Popular Tags |