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.ConsumesDef; 43 import org.omg.CORBA.ComponentIR.ConsumesDefHelper; 44 45 56 57 public class ConsumesDeclImpl 58 extends EventPortDeclImpl 59 implements org.objectweb.openccm.ast.api.ConsumesDecl 60 { 61 67 68 private ConsumesDef consumes_def_; 69 70 76 82 protected 83 ConsumesDeclImpl(Repository rep, 84 ScopeImpl parent) 85 { 86 super(rep, parent); 88 89 consumes_def_ = null; 91 } 92 93 99 105 110 protected void 111 load(org.omg.CORBA.Contained contained) 112 { 113 consumes_def_ = ConsumesDefHelper.narrow(contained); 114 super.load(contained); 115 } 116 117 122 protected org.omg.CORBA.Contained 123 getContained() 124 { 125 return consumes_def_; 126 } 127 128 134 140 146 151 public long 152 getDeclKind() 153 { 154 return DeclarationKind.dk_consumes; 155 } 156 157 160 public void 161 create() 162 { 163 consumes_def_ = the_parent_.getComponentDef(). 164 create_consumes(getId(), getName(), getVersion(), 165 event_.getEventDef()); 166 super.create(); 167 } 168 169 175 180 public OperationDecl[] 181 getClientMapping() 182 { 183 if (client_mapping_!=null) 184 return client_mapping_; 185 186 InterfaceDecl client = ((ComponentDecl)the_parent_).getClientMapping(); 188 client.getContents(true, DeclarationKind.dk_null); 189 190 client_mapping_ = new OperationDecl[1]; 191 client_mapping_[0] = (OperationDecl) 192 client.find("get_consumer_"+getName()); 193 return client_mapping_; 194 } 195 } 196 | Popular Tags |