1 26 27 package org.objectweb.openccm.Containers.Plugins; 28 29 36 37 public class PortSpecificConfiguration 38 extends org.omg.CORBA.LocalObject 39 implements org.objectweb.openccm.Containers.SystemConfiguration 40 { 41 47 50 protected org.objectweb.ccm.util.Table call_coordinator_sh_; 51 52 55 protected org.objectweb.ccm.util.Table call_controllers_sh_; 56 57 60 protected org.objectweb.ccm.util.Table call_coordinator_ps_; 61 62 65 protected org.objectweb.ccm.util.Table call_controllers_ps_; 66 67 70 protected org.objectweb.ccm.util.Table act_coordinator_sh_; 71 72 75 protected org.objectweb.ccm.util.Table act_controllers_sh_; 76 77 80 protected org.objectweb.ccm.util.Table act_coordinator_ps_; 81 82 85 protected org.objectweb.ccm.util.Table act_controllers_ps_; 86 87 90 protected java.lang.String [] policies_; 91 92 95 protected org.objectweb.openccm.Containers.SystemConfiguration parent_configuration_; 96 97 100 protected java.lang.String the_component_base_uid_; 101 102 105 protected java.lang.String the_component_version_; 106 107 113 117 public 118 PortSpecificConfiguration() 119 { 120 call_coordinator_sh_ = new org.objectweb.ccm.util.Table(); 121 call_controllers_sh_ = new org.objectweb.ccm.util.Table(); 122 call_coordinator_ps_ = new org.objectweb.ccm.util.Table(); 123 call_controllers_ps_ = new org.objectweb.ccm.util.Table(); 124 act_coordinator_sh_ = new org.objectweb.ccm.util.Table(); 125 act_controllers_sh_ = new org.objectweb.ccm.util.Table(); 126 act_coordinator_ps_ = new org.objectweb.ccm.util.Table(); 127 act_controllers_ps_ = new org.objectweb.ccm.util.Table(); 128 policies_ = new java.lang.String [0]; 129 parent_configuration_ = null; 130 the_component_base_uid_ = ""; 131 the_component_version_ = "1.0"; 132 } 133 134 140 143 protected java.lang.String 144 getCallCoordinatorSystemHome(java.lang.String uid) 145 { 146 return (java.lang.String )call_coordinator_sh_.get(uid); 147 } 148 149 152 protected org.objectweb.openccm.Containers.PropertySet 153 getCallCoordinatorPropertySet(java.lang.String uid) 154 { 155 return (org.objectweb.openccm.Containers.PropertySet)call_coordinator_ps_.get(uid); 156 } 157 158 161 protected java.lang.String [] 162 getCallControllersSystemHome(java.lang.String uid) 163 { 164 return (java.lang.String [])call_controllers_sh_.get(uid); 165 } 166 167 170 protected org.objectweb.openccm.Containers.PropertySet[] 171 getCallControllersPropertySet(java.lang.String uid) 172 { 173 return (org.objectweb.openccm.Containers.PropertySet[])call_controllers_ps_.get(uid); 174 } 175 176 179 protected java.lang.String 180 getActCoordinatorSystemHome(java.lang.String uid) 181 { 182 return (java.lang.String )act_coordinator_sh_.get(uid); 183 } 184 185 188 protected org.objectweb.openccm.Containers.PropertySet 189 getActCoordinatorPropertySet(java.lang.String uid) 190 { 191 return (org.objectweb.openccm.Containers.PropertySet)act_coordinator_ps_.get(uid); 192 } 193 194 197 protected java.lang.String [] 198 getActControllersSystemHome(java.lang.String uid) 199 { 200 return (java.lang.String [])act_controllers_sh_.get(uid); 201 } 202 203 206 protected org.objectweb.openccm.Containers.PropertySet[] 207 getActControllersPropertySet(java.lang.String uid) 208 { 209 return (org.objectweb.openccm.Containers.PropertySet[])act_controllers_ps_.get(uid); 210 } 211 212 215 protected java.lang.String [] 216 getPCAPolicies() 217 { 218 return policies_; 219 } 220 221 227 230 public void 231 setComponentUId(java.lang.String comp_uid) 232 { 233 int idx = comp_uid.lastIndexOf(':'); 234 the_component_base_uid_ = comp_uid.substring(0, idx); 235 the_component_version_ = comp_uid.substring(idx+1); 236 } 237 238 241 public void 242 setCallCoordinator(java.lang.String port_name, 243 java.lang.String home_alias) 244 { 245 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 247 call_coordinator_sh_.put(uid, home_alias); 248 } 249 250 253 public void 254 setCallCoordinatorConfig(java.lang.String port_name, 255 org.objectweb.openccm.Containers.PropertySet config) 256 { 257 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 259 call_coordinator_ps_.put(uid, config); 260 } 261 262 265 public void 266 setCallControllers(java.lang.String port_name, 267 java.lang.String [] homes_alias) 268 { 269 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 271 call_controllers_sh_.put(uid, homes_alias); 272 } 273 274 277 public void 278 setCallControllersConfig(java.lang.String port_name, 279 org.objectweb.openccm.Containers.PropertySet[] configs) 280 { 281 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 283 call_controllers_ps_.put(uid, configs); 284 } 285 286 289 public void 290 setActCoordinator(java.lang.String port_name, 291 java.lang.String home_alias) 292 { 293 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 295 act_coordinator_sh_.put(uid, home_alias); 296 } 297 298 301 public void 302 setActCoordinatorConfig(java.lang.String port_name, 303 org.objectweb.openccm.Containers.PropertySet config) 304 { 305 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 307 act_coordinator_ps_.put(uid, config); 308 } 309 310 313 public void 314 setActControllers(java.lang.String port_name, 315 java.lang.String [] homes_alias) 316 { 317 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 319 act_controllers_sh_.put(uid, homes_alias); 320 } 321 322 325 public void 326 setActControllersConfig(java.lang.String port_name, 327 org.objectweb.openccm.Containers.PropertySet[] configs) 328 { 329 java.lang.String uid = the_component_base_uid_ + '/' + port_name + ':' + the_component_version_; 331 act_controllers_ps_.put(uid, configs); 332 } 333 334 337 public void 338 setPCAPolicies(java.lang.String [] policies) 339 { 340 policies_ = policies; 341 } 342 343 349 355 public org.objectweb.openccm.Containers.CallCoordinator 356 create_call_coordinator(java.lang.String uid, 357 java.lang.String op_name, 358 org.objectweb.openccm.Containers.SystemHomeFinder finder) 359 { 360 java.lang.String home_alias = null; 361 org.objectweb.openccm.Containers.PropertySet config = null; 362 363 home_alias = getCallCoordinatorSystemHome(uid); 364 config = getCallCoordinatorPropertySet(uid); 365 366 if ((home_alias==null) && (parent_configuration_!=null)) 367 return parent_configuration_.create_call_coordinator(uid, op_name, finder); 368 else if (home_alias==null) 369 home_alias = "EmptyCoordinatorHome"; 370 371 try 372 { 373 org.objectweb.openccm.Containers.SystemHome home = null; 374 org.objectweb.openccm.Containers.CallCoordinator result = null; 375 376 home = finder.find_system_home(home_alias); 377 result = (org.objectweb.openccm.Containers.CallCoordinator)home.create_component(config); 378 result.configure(config); 379 return result; 380 } 381 catch(org.objectweb.openccm.Containers.HomeNotFound ex) 382 { 383 throw new Error ("System home : "+home_alias+" was not found"); 384 } 385 catch(org.objectweb.openccm.Containers.CreationFailed ex) 386 { 387 throw new Error ("Creation of system component for system home : "+home_alias+" failed"); 388 } 389 catch(org.objectweb.openccm.Containers.ConfigurationFailed ex) 390 { 391 throw new Error ("Configuration of system component for system home : "+home_alias+" failed"); 392 } 393 } 394 395 401 public org.objectweb.openccm.Containers.CallController[] 402 create_call_controllers(java.lang.String uid, 403 java.lang.String op_name, 404 org.objectweb.openccm.Containers.SystemHomeFinder finder) 405 { 406 org.objectweb.openccm.Containers.CallController[] result = null; 407 java.lang.String [] homes_alias = null; 408 org.objectweb.openccm.Containers.PropertySet[] configs = null; 409 410 homes_alias = getCallControllersSystemHome(uid); 411 configs = getCallControllersPropertySet(uid); 412 413 if ((homes_alias==null) && (parent_configuration_!=null)) 414 return parent_configuration_.create_call_controllers(uid, op_name, finder); 415 else if (homes_alias==null) 416 { 417 homes_alias = new java.lang.String [1]; 418 homes_alias[0] = "EmptyControllerHome"; 419 configs = new org.objectweb.openccm.Containers.PropertySet[1]; 420 configs[0] = null; 421 } 422 423 int i=0; 424 425 try 426 { 427 result = new org.objectweb.openccm.Containers.CallController[homes_alias.length]; 428 org.objectweb.openccm.Containers.SystemHome home = null; 429 for (;i<homes_alias.length;i++) 430 { 431 home = finder.find_system_home(homes_alias[i]); 432 result[i] = (org.objectweb.openccm.Containers.CallController)home.create_component(configs[i]); 433 result[i].configure(configs[i]); 434 } 435 436 if (parent_configuration_!=null) 437 { 438 org.objectweb.openccm.Containers.CallController[] tmp1 = null; 439 org.objectweb.openccm.Containers.CallController[] tmp2 = null; 440 tmp1 = parent_configuration_.create_call_controllers(uid, op_name, finder); 441 if (tmp1!=null) 442 { 443 int l = tmp1.length + result.length; 444 tmp2 = new org.objectweb.openccm.Containers.CallController[l]; 445 java.lang.System.arraycopy(result, 0, tmp2, 0, result.length); 446 java.lang.System.arraycopy(tmp1, 0, tmp2, result.length, tmp1.length); 447 return tmp2; 448 } 449 } 450 451 return result; 452 } 453 catch(org.objectweb.openccm.Containers.HomeNotFound ex) 454 { 455 throw new Error ("System home :"+homes_alias[i]+" was not found"); 456 } 457 catch(org.objectweb.openccm.Containers.CreationFailed ex) 458 { 459 throw new Error ("Creation of system component for system home :"+homes_alias[i]+" failed"); 460 } 461 catch(org.objectweb.openccm.Containers.ConfigurationFailed ex) 462 { 463 throw new Error ("Configuration of system component for system home :"+homes_alias[i]+" failed"); 464 } 465 } 466 467 473 public org.objectweb.openccm.Containers.ActivationCoordinator 474 create_activation_coordinator(java.lang.String uid, 475 org.objectweb.openccm.Containers.SystemHomeFinder finder) 476 { 477 java.lang.String home_alias = null; 478 org.objectweb.openccm.Containers.PropertySet config = null; 479 480 home_alias = getActCoordinatorSystemHome(uid); 481 config = getActCoordinatorPropertySet(uid); 482 483 if ((home_alias==null) && (parent_configuration_!=null)) 484 return parent_configuration_.create_activation_coordinator(uid, finder); 485 else if (home_alias==null) 486 throw new java.lang.Error ("Can\'t use an empty coordinator for activation"); 488 489 490 try 491 { 492 org.objectweb.openccm.Containers.SystemHome home = null; 493 org.objectweb.openccm.Containers.ActivationCoordinator result = null; 494 495 home = finder.find_system_home(home_alias); 496 result = (org.objectweb.openccm.Containers.ActivationCoordinator)home.create_component(config); 497 result.configure(config); 498 return result; 499 } 500 catch(org.objectweb.openccm.Containers.HomeNotFound ex) 501 { 502 throw new Error ("System home : "+home_alias+" was not found"); 503 } 504 catch(org.objectweb.openccm.Containers.CreationFailed ex) 505 { 506 throw new Error ("Creation of system component for system home : "+home_alias+" failed"); 507 } 508 catch(org.objectweb.openccm.Containers.ConfigurationFailed ex) 509 { 510 throw new Error ("Configuration of system component for system home : "+home_alias+" failed"); 511 } 512 } 513 514 520 public org.objectweb.openccm.Containers.ActivationController[] 521 create_activation_controllers(java.lang.String uid, 522 org.objectweb.openccm.Containers.SystemHomeFinder finder) 523 { 524 org.objectweb.openccm.Containers.ActivationController[] result = null; 525 org.objectweb.openccm.Containers.ActivationController[] tmp = null; 526 java.lang.String [] homes_alias = null; 527 org.objectweb.openccm.Containers.PropertySet[] configs = null; 528 529 homes_alias = getActControllersSystemHome(uid); 530 configs = getActControllersPropertySet(uid); 531 532 if ((homes_alias==null) && (parent_configuration_!=null)) 533 return parent_configuration_.create_activation_controllers(uid, finder); 534 else if (homes_alias==null) 535 throw new java.lang.Error ("Can\'t use an empty controller for activation"); 537 538 int i=0; 539 540 try 541 { 542 result = new org.objectweb.openccm.Containers.ActivationController[homes_alias.length]; 543 org.objectweb.openccm.Containers.SystemHome home = null; 544 for (;i<homes_alias.length;i++) 545 { 546 home = finder.find_system_home(homes_alias[i]); 547 result[i] = (org.objectweb.openccm.Containers.ActivationController)home.create_component(configs[i]); 548 result[i].configure(configs[i]); 549 } 550 551 if (parent_configuration_!=null) 552 { 553 org.objectweb.openccm.Containers.ActivationController[] tmp1 = null; 554 org.objectweb.openccm.Containers.ActivationController[] tmp2 = null; 555 tmp1 = parent_configuration_.create_activation_controllers(uid, finder); 556 if (tmp1!=null) 557 { 558 int l = tmp1.length + result.length; 559 tmp2 = new org.objectweb.openccm.Containers.ActivationController[l]; 560 java.lang.System.arraycopy(result, 0, tmp2, 0, result.length); 561 java.lang.System.arraycopy(tmp1, 0, tmp2, result.length, tmp1.length); 562 return tmp2; 563 } 564 } 565 566 return result; 567 } 568 catch(org.objectweb.openccm.Containers.HomeNotFound ex) 569 { 570 throw new Error ("System home :"+homes_alias[i]+" was not found"); 571 } 572 catch(org.objectweb.openccm.Containers.CreationFailed ex) 573 { 574 throw new Error ("Creation of system component for system home :"+homes_alias[i]+" failed"); 575 } 576 catch(org.objectweb.openccm.Containers.ConfigurationFailed ex) 577 { 578 throw new Error ("Configuration of system component for system home :"+homes_alias[i]+" failed"); 579 } 580 } 581 582 588 public org.objectweb.openccm.Containers.PCAPolicy[] 589 create_PCAPolicies(java.lang.String uid, 590 org.objectweb.openccm.Containers.SystemHomeFinder finder) 591 { 592 org.objectweb.openccm.Containers.PCAPolicy[] result = null; 593 java.lang.String [] homes_alias = null; 594 595 homes_alias = getPCAPolicies(); 596 int i=0; 597 try 598 { 599 result = new org.objectweb.openccm.Containers.PCAPolicy[homes_alias.length]; 600 org.objectweb.openccm.Containers.SystemHome home = null; 601 for (;i<homes_alias.length;i++) 602 { 603 home = finder.find_system_home(homes_alias[i]); 604 result[i] = (org.objectweb.openccm.Containers.PCAPolicy)home.create_component(null); 605 result[i].configure(null); 606 } 607 } 608 catch(org.objectweb.openccm.Containers.HomeNotFound ex) 609 { 610 throw new Error ("System home :"+homes_alias[i]+" was not found"); 611 } 612 catch(org.objectweb.openccm.Containers.CreationFailed ex) 613 { 614 throw new Error ("Creation of system component for system home :"+homes_alias[i]+" failed"); 615 } 616 catch(org.objectweb.openccm.Containers.ConfigurationFailed ex) 617 { 618 throw new Error ("Configuration of system component for system home :"+homes_alias[i]+" failed"); 619 } 620 621 if ((result.length==0) && (parent_configuration_!=null)) 622 return parent_configuration_.create_PCAPolicies(uid, finder); 623 else if (result.length==0) 624 return new org.objectweb.openccm.Containers.PCAPolicy[0]; 625 626 return result; 627 } 628 629 635 public void 636 set_parent_configuration(org.objectweb.openccm.Containers.SystemConfiguration config) 637 { 638 parent_configuration_ = config; 639 } 640 641 647 653 659 public void 660 configure(org.objectweb.openccm.Containers.PropertySet config) 661 throws org.objectweb.openccm.Containers.ConfigurationFailed 662 { 663 throw new org.objectweb.openccm.Containers.ConfigurationFailed("not implemented !"); 667 } 668 } 669 | Popular Tags |