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.PublishesDef; 43 import org.omg.CORBA.ComponentIR.PublishesDefHelper; 44 45 58 59 public class PublishesDeclImpl 60 extends EventPortDeclImpl 61 implements org.objectweb.openccm.ast.api.PublishesDecl 62 { 63 69 70 private PublishesDef publishes_def_; 71 72 73 private OperationDecl[] local_context_mapping_; 74 75 81 87 protected 88 PublishesDeclImpl(Repository rep, 89 ScopeImpl parent) 90 { 91 super(rep, parent); 93 94 publishes_def_ = null; 96 local_context_mapping_ = null; 97 } 98 99 105 111 116 protected void 117 load(org.omg.CORBA.Contained contained) 118 { 119 publishes_def_ = PublishesDefHelper.narrow(contained); 120 super.load(contained); 121 } 122 123 129 protected org.omg.CORBA.Contained 130 getContained() 131 { 132 return publishes_def_; 133 } 134 135 141 147 153 158 public long 159 getDeclKind() 160 { 161 return DeclarationKind.dk_publishes; 162 } 163 164 167 public void 168 create() 169 { 170 publishes_def_ = the_parent_.getComponentDef(). 171 create_publishes(getId(), getName(), getVersion(), 172 event_.getEventDef()); 173 super.create(); 174 } 175 176 182 187 public OperationDecl[] 188 getClientMapping() 189 { 190 if (client_mapping_!=null) 191 return client_mapping_; 192 193 InterfaceDecl client = ((ComponentDecl)the_parent_).getClientMapping(); 195 client.getContents(true, DeclarationKind.dk_null); 196 197 client_mapping_ = new OperationDecl[2]; 198 client_mapping_[0] = (OperationDecl)client.find("subscribe_"+getName()); 199 client_mapping_[1] = (OperationDecl)client.find("unsubscribe_"+getName()); 200 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_).getLocalContextMapping(); 229 context.getContents(true, DeclarationKind.dk_null); 230 231 local_context_mapping_ = new OperationDecl[1]; 232 local_context_mapping_[0] = (OperationDecl) 233 context.find("push_"+getName()); 234 return local_context_mapping_; 235 } 236 } 237 | Popular Tags |