1 26 27 package org.objectweb.openccm.ir3; 28 29 37 38 public class UsesDef_impl 39 extends FeatureContained 40 implements org.omg.CORBA.ComponentIR.UsesDefOperations 41 { 42 48 49 protected InterfaceDef_ref interface_type_; 50 51 52 protected boolean is_multiple_; 53 54 60 61 public 62 UsesDef_impl(IFR ifr, 63 Container_impl container) 64 { 65 super(ifr, container); 67 68 setServant(new org.omg.CORBA.ComponentIR.UsesDefPOATie(this)); 70 71 interface_type_ = new InterfaceDef_ref(this); 73 is_multiple_ = false; 74 } 75 76 82 85 public org.omg.CORBA.ComponentIR.UsesDef 86 asUsesDef() 87 { 88 return org.omg.CORBA.ComponentIR.UsesDefHelper.narrow(asObject()); 89 } 90 91 94 public org.omg.CORBA.ComponentIR.UsesDescription 95 describe_uses() 96 { 97 org.omg.CORBA.ComponentIR.UsesDescription description = new org.omg.CORBA.ComponentIR.UsesDescription(); 99 description.name = name(); 100 description.id = id(); 101 description.defined_in = getContainerID(); 102 description.version = version(); 103 description.interface_type = interface_type().id(); 104 description.is_multiple = is_multiple(); 105 106 return description; 107 } 108 109 115 118 public void 119 setDescriptionValue(org.omg.CORBA.Any any) 120 { 121 org.omg.CORBA.ComponentIR.UsesDescriptionHelper.insert(any, describe_uses()); 123 } 124 125 131 134 protected void 135 cutDependencies() 136 { 137 interface_type_.cutDependency(); 139 interface_type_ = null; 140 141 super.cutDependencies(); 143 } 144 145 151 154 public org.omg.CORBA.DefinitionKind 155 def_kind() 156 { 157 return org.omg.CORBA.DefinitionKind.dk_Uses; 158 } 159 160 166 169 public org.omg.CORBA.InterfaceDef 170 interface_type() 171 { 172 return interface_type_.asInterfaceDef(); 174 } 175 176 184 public void 185 interface_type(org.omg.CORBA.InterfaceDef val) 186 { 187 interface_type_.setDependency(castToLocal(val)); 190 } 191 192 195 public boolean 196 is_multiple() 197 { 198 return is_multiple_; 199 } 200 201 209 public void 210 is_multiple(boolean val) 211 { 212 is_multiple_ = val; 213 } 214 215 221 224 protected void 225 whenCreated() 226 { 227 if (!getIFR().getRepository().enable_mappings_) 229 return ; 230 231 233 String cont_base_id = getBaseContainerID(); 238 239 String version = version(); 240 String name = ""; 241 String id = ""; 242 InterfaceDef_impl container = (InterfaceDef_impl)container_; 243 org.omg.CORBA.AliasDef connection_sequence = null; 244 245 if (is_multiple_) 247 { 248 name = name() + "Connection"; 255 id = cont_base_id + name + ':' + version; 256 org.omg.CORBA.StructMember [] members = new org.omg.CORBA.StructMember [2]; 257 members[0] = new org.omg.CORBA.StructMember (); 258 members[0].name = "objref"; 259 members[0].type_def = interface_type_.asIDLType(); 260 members[0].type = members[0].type_def.type(); 261 members[1] = new org.omg.CORBA.StructMember (); 262 members[1].name = "ck"; 263 members[1].type_def = org.omg.CORBA.IDLTypeHelper.narrow( 264 getIFR().getRepository().lookup("::Components::Cookie")); 265 members[1].type = members[1].type_def.type(); 266 267 container_.mapping_started_ = true; 268 org.omg.CORBA.IDLType struct = container_.create_struct(id, name, version, members); 269 container_.mapping_started_ = false; 270 271 name = name() + "Connections"; 275 id = cont_base_id + name + ':' + version; 276 org.omg.CORBA.IDLType type = getIFR().getRepository().create_sequence(0, struct); 277 278 container_.mapping_started_ = true; 279 connection_sequence = container_.create_alias(id, name, version, type); 280 container_.mapping_started_ = false; 281 282 name = "connect_" + name(); 288 id = cont_base_id + name + ':' + version; 289 org.omg.CORBA.ParameterDescription [] params = new org.omg.CORBA.ParameterDescription [1]; 290 params[0] = new org.omg.CORBA.ParameterDescription (); 291 params[0].name = "connexion"; 292 params[0].type_def = interface_type_.asIDLType(); 293 params[0].type = params[0].type_def.type(); 294 params[0].mode = org.omg.CORBA.ParameterMode.PARAM_IN; 295 org.omg.CORBA.ExceptionDef [] excs = new org.omg.CORBA.ExceptionDef [1]; 296 excs[0] = org.omg.CORBA.ExceptionDefHelper.narrow( 297 getIFR().getRepository().lookup("::Components::ExceededConnectionLimit")); 298 304 305 container_.mapping_started_ = true; 306 container.create_operation(id, name, version, 307 members[1].type_def, 308 org.omg.CORBA.OperationMode.OP_NORMAL, 309 params, excs, new java.lang.String [0]); 310 container_.mapping_started_ = false; 311 312 name = "disconnect_" + name(); 317 id = cont_base_id + name + ':' + version; 318 params = new org.omg.CORBA.ParameterDescription [1]; 319 params[0] = new org.omg.CORBA.ParameterDescription (); 320 params[0].name = "ck"; 321 params[0].type_def = members[1].type_def; 322 params[0].type = params[0].type_def.type(); 323 params[0].mode = org.omg.CORBA.ParameterMode.PARAM_IN; 324 org.omg.CORBA.ExceptionDef [] excs2 = new org.omg.CORBA.ExceptionDef [1]; 325 excs2[0] = org.omg.CORBA.ExceptionDefHelper.narrow( 326 getIFR().getRepository().lookup("::Components::InvalidConnection")); 327 328 container_.mapping_started_ = true; 329 container.create_operation(id, name, version, 330 interface_type_.asIDLType(), 331 org.omg.CORBA.OperationMode.OP_NORMAL, 332 params, excs, new java.lang.String [0]); 333 container_.mapping_started_ = false; 334 335 name = "get_connections_" + name(); 339 id = cont_base_id + name + ':' + version; 340 params = new org.omg.CORBA.ParameterDescription [0]; 341 excs = new org.omg.CORBA.ExceptionDef [0]; 342 343 container_.mapping_started_ = true; 344 container.create_operation(id, name, version, 345 connection_sequence, 346 org.omg.CORBA.OperationMode.OP_NORMAL, 347 params, excs, new java.lang.String [0]); 348 container_.mapping_started_ = false; 349 } 350 else 352 { 353 name = "connect_" + name(); 359 id = cont_base_id + name + ':' + version; 360 org.omg.CORBA.ParameterDescription [] params = new org.omg.CORBA.ParameterDescription [1]; 361 params[0] = new org.omg.CORBA.ParameterDescription (); 362 params[0].name = "connexion"; 363 params[0].type_def = interface_type_.asIDLType(); 364 params[0].type = params[0].type_def.type(); 365 params[0].mode = org.omg.CORBA.ParameterMode.PARAM_IN; 366 org.omg.CORBA.ExceptionDef [] excs = new org.omg.CORBA.ExceptionDef [1]; 367 excs[0] = org.omg.CORBA.ExceptionDefHelper.narrow( 368 getIFR().getRepository().lookup("::Components::AlreadyConnected")); 369 375 376 container_.mapping_started_ = true; 377 container.create_operation(id, name, version, 378 getIFR().getRepository().get_primitive( 379 org.omg.CORBA.PrimitiveKind.pk_void), 380 org.omg.CORBA.OperationMode.OP_NORMAL, 381 params, excs, new java.lang.String [0]); 382 container_.mapping_started_ = false; 383 384 name = "disconnect_" + name(); 389 id = cont_base_id + name + ':' + version; 390 params = new org.omg.CORBA.ParameterDescription [0]; 391 excs = new org.omg.CORBA.ExceptionDef [1]; 392 excs[0] = org.omg.CORBA.ExceptionDefHelper.narrow( 393 getIFR().getRepository().lookup("::Components::NoConnection")); 394 395 container_.mapping_started_ = true; 396 container.create_operation(id, name, version, 397 interface_type_.asIDLType(), 398 org.omg.CORBA.OperationMode.OP_NORMAL, 399 params, excs, new java.lang.String [0]); 400 container_.mapping_started_ = false; 401 402 name = "get_connection_" + name(); 406 id = cont_base_id + name + ':' + version; 407 params = new org.omg.CORBA.ParameterDescription [0]; 408 excs = new org.omg.CORBA.ExceptionDef [0]; 409 410 container_.mapping_started_ = true; 411 container.create_operation(id, name, version, 412 interface_type_.asIDLType(), 413 org.omg.CORBA.OperationMode.OP_NORMAL, 414 params, excs, new java.lang.String [0]); 415 container_.mapping_started_ = false; 416 } 417 418 cont_base_id = interface_type_.getImpl().getBaseContainerID(); 423 version = interface_type_.getImpl().version(); 424 425 name = "CCM_"+interface_type_.getImpl().name(); 426 id = cont_base_id + name + ':' + version; 427 org.omg.CORBA.Contained contained = getIFR().getRepository().lookup_mapped_id(id); 428 org.omg.CORBA.InterfaceDef facet_executor = null; 429 if (contained==null) 430 { 431 org.omg.CORBA.InterfaceDef [] bases = new org.omg.CORBA.InterfaceDef [1]; 435 bases[0] = interface_type(); 436 interface_type_.getImpl().container_.mapping_started_ = true; 437 facet_executor = interface_type_.getImpl().container_.create_ext_local_interface(id, name, version, bases); 438 interface_type_.getImpl().container_.mapping_started_ = false; 439 } 440 else 441 { 442 facet_executor = org.omg.CORBA.InterfaceDefHelper.narrow(contained); 443 } 444 445 cont_base_id = container_.getBaseContainerID(); 452 version = container_.version(); 453 454 String litf_id = cont_base_id + "CCM_" + container_.name() + "_Context:" + version; 455 org.omg.CORBA.ExtLocalInterfaceDef litf = org.omg.CORBA.ExtLocalInterfaceDefHelper.narrow( 456 getIFR().getRepository().lookup_mapped_id(litf_id)); 457 458 cont_base_id = computeBaseID(litf_id); 459 version = litf.version(); 460 if (!is_multiple_) 462 { 463 name = "get_connection_" + name(); 464 id = cont_base_id + name + ':' + version; 465 466 litf.create_operation(id, name, version, 467 interface_type_.asIDLType(), 468 org.omg.CORBA.OperationMode.OP_NORMAL, 469 new org.omg.CORBA.ParameterDescription [0], 470 new org.omg.CORBA.ExceptionDef [0], 471 new java.lang.String [0]); 472 } 473 else 475 { 476 name = "get_connections_" + name(); 477 id = cont_base_id + name + ':' + version; 478 479 litf.create_operation(id, name, version, 480 connection_sequence, 481 org.omg.CORBA.OperationMode.OP_NORMAL, 482 new org.omg.CORBA.ParameterDescription [0], 483 new org.omg.CORBA.ExceptionDef [0], 484 new java.lang.String [0]); 485 } 486 } 487 } 488 | Popular Tags |