1 26 27 package org.objectweb.openccm.ast.lib; 28 29 30 import org.objectweb.openccm.ast.api.DeclarationKind; 31 32 33 import org.objectweb.openccm.ast.api.InterfaceDecl; 34 35 36 import org.objectweb.openccm.ast.api.OperationDecl; 37 38 39 import org.objectweb.openccm.ast.api.ComponentDecl; 40 41 42 import org.omg.CORBA.ComponentIR.EmitsDef; 43 import org.omg.CORBA.ComponentIR.EmitsDefHelper; 44 45 58 59 public class EmitsDeclImpl 60 extends EventPortDeclImpl 61 implements org.objectweb.openccm.ast.api.EmitsDecl 62 { 63 69 70 private EmitsDef emits_def_; 71 72 73 private OperationDecl[] local_context_mapping_; 74 75 81 87 protected 88 EmitsDeclImpl(Repository rep, 89 ScopeImpl parent) 90 { 91 super(rep, parent); 93 94 emits_def_ = null; 96 local_context_mapping_ = null; 97 } 98 99 105 111 116 protected void 117 load(org.omg.CORBA.Contained contained) 118 { 119 emits_def_ = EmitsDefHelper.narrow(contained); 120 super.load(contained); 121 } 122 123 128 protected org.omg.CORBA.Contained 129 getContained() 130 { 131 return emits_def_; 132 } 133 134 140 146 152 157 public long 158 getDeclKind() 159 { 160 return DeclarationKind.dk_emits; 161 } 162 163 166 public void 167 create() 168 { 169 emits_def_ = the_parent_.getComponentDef(). 170 create_emits(getId(), getName(), getVersion(), 171 event_.getEventDef()); 172 super.create(); 173 } 174 175 181 186 public OperationDecl[] 187 getClientMapping() 188 { 189 if (client_mapping_!=null) 190 return client_mapping_; 191 192 InterfaceDecl client = ((ComponentDecl)the_parent_).getClientMapping(); 194 client.getContents(true, DeclarationKind.dk_null); 195 196 client_mapping_ = new OperationDecl[2]; 197 client_mapping_[0] = (OperationDecl) 198 client.find("connect_"+getName()); 199 client_mapping_[1] = (OperationDecl) 200 client.find("disconnect_"+getName()); 201 return client_mapping_; 202 } 203 204 210 216 221 public OperationDecl[] 222 getLocalContextMapping() 223 { 224 if (local_context_mapping_!=null) 225 return local_context_mapping_; 226 227 InterfaceDecl context = ((ComponentDecl)the_parent_). 229 getLocalContextMapping(); 230 context.getContents(true, DeclarationKind.dk_null); 231 232 local_context_mapping_ = new OperationDecl[1]; 233 local_context_mapping_[0] = (OperationDecl) 234 context.find("push_"+getName()); 235 return local_context_mapping_; 236 } 237 } 238 | Popular Tags |