1 26 27 package org.objectweb.openccm.ir3; 28 29 import org.omg.CORBA.*; 31 import org.omg.CORBA.ExtValueDefPackage.ExtFullValueDescription; 32 33 41 42 public class ExtValueDef_impl 43 extends ValueDef_impl 44 implements ExtValueDefOperations 45 { 46 52 55 protected ExtInitializer_impl[] ext_initializers_; 56 57 63 66 public 67 ExtValueDef_impl(IFR ifr, 68 Container_impl container) 69 { 70 super(ifr, container); 72 73 ext_initializers_ = new ExtInitializer_impl[0]; 74 75 setServant(new ExtValueDefPOATie(this)); 77 } 78 79 85 88 public ExtValueDef 89 asExtValueDef() 90 { 91 return ExtValueDefHelper.narrow(asObject()); 92 } 93 94 100 103 public AttributeDef 104 create_attribute(String id, 105 String name, 106 String version, 107 IDLType type, 108 AttributeMode mode) 109 { 110 ExtAttributeDef_impl attr = new ExtAttributeDef_impl(getIFR(), this); 111 112 try 113 { 114 addContained(attr, id, name, version); 115 attr.type_def(type); 116 attr.mode(mode); 117 attr.get_exceptions(new ExceptionDef[0]); 118 attr.set_exceptions(new ExceptionDef[0]); 119 } 120 catch(SystemException exc) 121 { 122 attr.destroy(); 123 throw exc; 124 } 125 126 return attr.asAttributeDef(); 127 } 128 129 132 public Initializer[] 133 initializers() 134 { 135 Initializer[] result = new Initializer[initializers_.length]; 136 137 for(int i=0; i<result.length; i++) 138 result[i] = ext_initializers_[i].getInitializer(); 139 140 return result; 141 } 142 143 public void 144 initializers(Initializer[] val) 145 { 146 ExtInitializer_impl[] tmp = new ExtInitializer_impl[val.length]; 147 for(int i=0; i<tmp.length; i++) 148 { 149 tmp[i] = new ExtInitializer_impl(this); 150 tmp[i].setInitializer(val[i]); 151 } 152 ext_initializers_ = tmp; 153 } 154 155 161 164 public ExtAttributeDef 165 create_ext_attribute(String id, 166 String name, 167 String version, 168 IDLType type, 169 AttributeMode mode, 170 ExceptionDef[] get_exceptions, 171 ExceptionDef[] set_exceptions) 172 { 173 ExtAttributeDef_impl attr = new ExtAttributeDef_impl(getIFR(), this); 174 175 try 176 { 177 addContained(attr, id, name, version); 178 attr.type_def(type); 179 attr.mode(mode); 180 attr.get_exceptions(get_exceptions); 181 attr.set_exceptions(set_exceptions); 182 } 183 catch(SystemException exc) 184 { 185 attr.destroy(); 186 throw exc; 187 } 188 189 return attr.asExtAttributeDef(); 190 } 191 192 195 public ExtInitializer[] 196 ext_initializers() 197 { 198 ExtInitializer[] result = new ExtInitializer[ext_initializers_.length]; 199 200 for(int i=0; i<result.length; i++) 201 result[i] = ext_initializers_[i].getExtInitializer(); 202 203 return result; 204 } 205 206 209 public void 210 ext_initializers(ExtInitializer[] val) 211 { 212 ExtInitializer_impl[] tmp = new ExtInitializer_impl[val.length]; 213 for(int i=0; i<tmp.length; i++) 214 { 215 tmp[i] = new ExtInitializer_impl(this); 216 tmp[i].setExtInitializer(val[i]); 217 } 218 ext_initializers_ = tmp; 219 } 220 221 224 public ExtFullValueDescription 225 describe_ext_value() 226 { 227 ExtFullValueDescription description = new ExtFullValueDescription(); 228 description.name = name(); 229 description.id = id(); 230 description.is_abstract = is_abstract(); 231 description.is_custom = is_custom(); 232 description.defined_in = getContainerID(); 233 description.version = version(); 234 description.operations = getOpDescriptionSeq(); 235 description.attributes = getExtAttrDescriptionSeq(); 236 description.members = getValueMemberSeq(); 237 description.initializers = ext_initializers(); 238 description.supported_interfaces = InterfaceDef_ref. 239 computeRepositoryIdSeq(supported_interfaces_); 240 description.abstract_base_values = ValueDef_ref. 241 computeRepositoryIdSeq(abstract_base_values_); 242 description.is_truncatable = is_truncatable(); 243 description.base_value = base_value_.getId(); 244 description.type = type(); 245 return description; 246 } 247 248 254 257 protected void 258 whenCreated() 259 { 260 if (abstract_base_values_.length==0) 261 return ; 262 263 for (int i=0;i<abstract_base_values_.length;i++) 264 { 265 if (abstract_base_values_[i].getImpl().absolute_name().equals("::Components::EventBase")) 266 { 267 String cont_base_id = getBaseContainerID(); 271 String name = name() + "Consumer"; 272 String version = version(); 273 String id = cont_base_id + name + ":" + version; 274 org.omg.CORBA.InterfaceDef [] bases = new org.omg.CORBA.InterfaceDef [1]; 275 bases[0] = org.omg.CORBA.InterfaceDefHelper.narrow( 276 getIFR().getRepository().lookup("::Components::EventConsumerBase")); 277 org.omg.CORBA.InterfaceDef consumer = container_.create_interface(id, name, version, bases); 278 279 id = cont_base_id + name + "/push:" + version; 283 name = "push"; 284 org.omg.CORBA.ParameterDescription [] params = new org.omg.CORBA.ParameterDescription [1]; 285 params[0] = new org.omg.CORBA.ParameterDescription (); 286 params[0].name = "event"; 287 params[0].type_def = asValueDef(); 288 params[0].type = params[0].type_def.type(); 289 params[0].mode = org.omg.CORBA.ParameterMode.PARAM_IN; 290 consumer.create_operation(id, name, version, 291 getIFR().getRepository().get_primitive( 292 org.omg.CORBA.PrimitiveKind.pk_void), 293 org.omg.CORBA.OperationMode.OP_NORMAL, 294 params, 295 new org.omg.CORBA.ExceptionDef [0], 296 new java.lang.String [0]); 297 break ; 298 } 299 } 300 } 301 } 302 | Popular Tags |