1 20 package org.objectweb.modfact.corba.provider; 21 22 import java.util.Hashtable ; 23 import java.util.StringTokenizer ; 24 import java.util.Vector ; 25 26 import org.omg.CORBA.TCKind ; 27 import org.omg.CORBA.TypeCode ; 28 import org.omg.CORBA.TypeCodePackage.BadKind ; 29 import org.omg.CORBA.TypeCodePackage.Bounds ; 30 import org.omg.mof.Model.ClassHelper; 31 import org.omg.mof.Model.Classifier; 32 import org.omg.mof.Model.DataType; 33 import org.omg.mof.Model.DataTypeHelper; 34 import org.omg.mof.Model.ModelElement; 35 import org.omg.mof.Model.Namespace; 36 import org.omg.mof.Model.PackageHelper; 37 import org.omg.mof.Reflective.MofError; 38 import org.omg.mof.Reflective.NotSet; 39 40 import org.objectweb.modfact.corba.helper.JavaCommon; 41 import org.objectweb.modfact.corba.helper.MOFCommon; 42 43 46 public class JavaProvider extends IDLProvider implements JavaCommon { 47 48 public JavaProvider(MOFCommon helper) { 49 super(helper); 50 mofHelper = helper; 51 } 52 53 MOFCommon mofHelper; 54 55 public String testJavaConflict(String _input) { 56 if (_input 57 .matches("((.+(Package|Helper|Holder|Operations|POA|POATie)\\z)|(abstract|default|if|private|throw|boolean|do|implements|protected|throws|break|double|import|public|transient|byte|else|instanceof|return|try|case|extends|int|short|void||catch|final|interface|static|volatilechar|finally|long|super|while|class|float|native|switch|const|for|new|synchronized|continue|goto|package|this|true|false|null|clone|equals|finalize|getClass|hashCode|notify|notifyAll|toString|wait))")) 58 return "_" + _input; 59 else return _input; 60 } 61 62 65 public String format1Idl2JavaConflict(String _input) { 66 Vector s1 = splitAndDelete(_input); 67 String buffer = " "; 68 for (int i = 0; i < s1.size(); i++) { 69 char[] s2 = s1.elementAt(i).toString().toCharArray(); 70 s2[0] = Character.toUpperCase(s1.elementAt(i).toString().charAt(0)); 71 String s3 = String.valueOf(s2); 72 buffer = buffer.concat(s3); 73 } 74 return testJavaConflict(buffer.trim()); 75 } 76 77 80 public String format2Idl2JavaConflict(String _input) { 81 Vector s1 = splitAndDelete(_input); 82 String buffer = " "; 83 for (int i = 0; i < s1.size(); i++) { 84 String s2 = s1.elementAt(i).toString().toLowerCase(); 85 buffer = buffer.concat(s2); 86 if (i != (s1.size() - 1)) 87 buffer = buffer.concat("_"); 88 } 89 return testJavaConflict(buffer.trim()); 90 } 91 92 private Hashtable javaQualifiedNames = new Hashtable (); 93 96 public String javaQualifiedName(ModelElement element) throws MofError , NotSet { 97 String qualifiedName; 98 String _key = element.ref_mof_id(); 100 if (javaQualifiedNames.containsKey(_key)) 101 qualifiedName = (String ) javaQualifiedNames.get(_key); 102 else { 103 if (element._is_a(ClassHelper.id())) qualifiedName = javaClassName(ClassHelper.narrow(element)); 104 else qualifiedName = format1(element.name()); 105 try { 106 boolean outermost = false; 107 while (!outermost) { 108 Namespace container = element.container(); 109 qualifiedName = format1(container.name()) + "." + qualifiedName; 110 if (container._is_a(PackageHelper.id())) { 112 String prefix = 113 mofHelper.idlPrefixForPackage( 114 PackageHelper.narrow(container)); 115 if (prefix.compareTo("") != 0) 116 qualifiedName = 117 idlPrefix2Java(prefix) + "." + qualifiedName; 118 } 119 if (mofHelper.isOutermostPackage(container)) 120 outermost = true; 121 else 122 element = container; 123 } 124 } catch (NotSet ex) { 125 } 126 } 127 return qualifiedName; 128 129 } 130 131 public String javaClassName(org.omg.mof.Model.Class clazz) 132 throws NotSet, MofError { 133 String idlSubstitute = mofHelper.idlSubstituteIdentifierForClass(clazz); 134 String n = clazz.name(); 135 if (idlSubstitute.compareTo("") == 0) 136 return format1(clazz.name()); 137 else 138 return idlSubstitute; 139 } 140 141 144 public String javaClassifierName(org.omg.mof.Model.Classifier clazz) 145 throws NotSet, MofError { 146 String idlSubstitute = mofHelper.idlSubstituteIdentifierForClass(clazz); 147 String n = clazz.name(); 148 if (idlSubstitute.compareTo("") == 0) 149 return format1(clazz.name()); 150 else 151 return idlSubstitute; 152 } 153 154 public String idl2Java(String _type) { 156 if (_type.equalsIgnoreCase("boolean")) 157 return "boolean"; 158 else if (_type.equalsIgnoreCase("octet")) 159 return "byte"; 160 else if (_type.equalsIgnoreCase("char")) 161 return "char"; 162 else if (_type.equalsIgnoreCase("wchar")) 163 return "char"; 164 else if (_type.equalsIgnoreCase("short")) 165 return "Short"; 166 else if (_type.equalsIgnoreCase("unsigned short")) 167 return "Short"; 168 else if (_type.equalsIgnoreCase("long")) 169 return "int"; 170 else if (_type.equalsIgnoreCase("unsigned long")) 171 return "int"; 172 else if (_type.equalsIgnoreCase("long long")) 173 return "long"; 174 else if (_type.equalsIgnoreCase("unsigned long long")) 175 return "long"; 176 else if (_type.equalsIgnoreCase("double")) 177 return "double"; 178 else if (_type.equalsIgnoreCase("float")) 179 return "float"; 180 else if (_type.equalsIgnoreCase("string")) 181 return "String"; 182 else if (_type.equalsIgnoreCase("wstring")) 183 return "String"; 184 else if (_type.equalsIgnoreCase("CORBA::TypeCode")) 185 return "org.omg.CORBA.TypeCode"; 186 else if (_type.equalsIgnoreCase("any")) 187 return "org.omg.CORBA.Any"; 188 else if (_type.equalsIgnoreCase("Object")) 189 return "Object"; 190 else 192 return _type; 193 } 194 195 public String typeCode2Java(TypeCode type) throws BadKind { 197 switch (type.kind().value()) { 198 case TCKind._tk_boolean : 199 return "boolean"; 200 case TCKind._tk_octet : 201 return "byte"; 202 case TCKind._tk_char : 203 return "char"; 204 case TCKind._tk_wchar : 205 return "char"; 206 case TCKind._tk_short : 207 return "Short"; 208 case TCKind._tk_ushort : 209 return "Short"; 210 case TCKind._tk_long : 211 return "int"; 212 case TCKind._tk_ulong : 213 return "int"; 214 case TCKind._tk_longlong : 215 return "long"; 216 case TCKind._tk_ulonglong : 217 return "long"; 218 case TCKind._tk_double : 219 return "double"; 220 case TCKind._tk_float : 221 return "float"; 222 case TCKind._tk_string : 223 return "String"; 224 case TCKind._tk_wstring : 225 return "String"; 226 case TCKind._tk_TypeCode : 227 return "org.omg.CORBA.TypeCode"; 228 case TCKind._tk_any : 229 return "org.omg.CORBA.Any"; 230 case TCKind._tk_objref : 231 return "org.omg.CORBA.Object"; 232 default : 233 return "String"; } 235 } 236 237 240 public String javaType(Classifier classifier) 241 throws MofError, BadKind , Bounds , NotSet{ 242 243 String resu = ""; if (classifier._is_a(DataTypeHelper.id())) { 245 DataType dt = DataTypeHelper.narrow(classifier); 247 TypeCode tc = dt.type_code(); 248 if (tc.kind().value() == org.omg.CORBA.TCKind._tk_alias) { 249 try { 250 resu = typeCode2Java(tc.content_type()); 251 } catch (org.omg.CORBA.TypeCodePackage.BadKind badKind) { 252 resu = typeCode2Java(tc); 253 } 254 } else { 255 if (isBaseType(tc)) { 256 resu = typeCode2Java(tc); 257 } else { 258 try { 259 Namespace container = classifier.container(); 260 if (container._is_a(ClassHelper.id())) { resu = 262 javaQualifiedName(container) 263 + "ClassPackage." 264 + format1(dt.name()); 265 } else 266 resu = javaQualifiedName(classifier); 267 } catch (NotSet ex) { 268 resu = format1(dt.name()); 269 } 270 } 271 } 272 } else { 273 resu = javaQualifiedName(classifier); 274 } 275 return resu; 276 } 277 278 281 private Hashtable packagesNameTable = new Hashtable (); 282 public String javaPackage(org.omg.mof.Model.Package namespace) 283 throws MofError { 284 285 String _key = namespace.ref_mof_id(); 287 String packageName = null; 288 if (packagesNameTable.containsKey(_key)) 289 packageName = (String ) packagesNameTable.get(_key); 290 else { 291 String prefix = mofHelper.idlPrefixForPackage(namespace); 293 String [] qualifiedName = namespace.qualified_name(); 294 packageName = format1Idl2JavaConflict(qualifiedName[0]); 295 for (int i = 1; i < qualifiedName.length; i++) 296 packageName = format1(qualifiedName[i]) + "." + packageName; 297 if (prefix != "") 298 packageName = prefix + "." + packageName; 299 } 300 return packageName; 301 } 302 303 private java.util.Hashtable _attributs = new java.util.Hashtable (); 306 307 public String attributeTemplate(org.omg.mof.Model.MofAttribute _attribute) 308 throws org.omg.mof.Reflective.MofError, BadKind , Bounds , NotSet { 309 310 String _key = _attribute.ref_mof_id(); 312 if (_attributs.containsKey(_key)) { 313 String _temp = (String ) _attributs.get(_key); 314 return _temp; 315 } else { 316 String _code_attribute = "//" + _attribute.annotation() + "\n"; 318 319 String _type_format1 = javaType(_attribute.type()); 320 String _aformat2 = format2(_attribute.name()); 321 org.omg.mof.Model.MultiplicityType _multiplicity = 322 _attribute.multiplicity(); 323 int _upper = _multiplicity.upper; 324 int _lower = _multiplicity.lower; 325 boolean _is_ordered = _multiplicity.isOrdered; 326 boolean _is_unique = _multiplicity.isUnique; 327 boolean _is_changeable = _attribute.is_changeable(); 328 boolean _is_derived = _attribute.is_derived(); 329 330 if (!_is_derived) { 332 if ((_upper > 1) || (_upper == -1)) 333 _code_attribute = 334 _code_attribute.concat( 335 "private java.util.Vector _" 336 + _aformat2 337 + "s = new java.util.Vector();\n"); 338 else 339 _code_attribute = 340 _code_attribute.concat( 341 "private " 342 + _type_format1 343 + " _" 344 + _aformat2 345 + " ;\n"); 346 if ((_lower == 0) && (_upper == 1)) 347 _code_attribute = 348 _code_attribute.concat( 349 "private boolean _exist_" 350 + _aformat2 351 + " = false;\n"); 352 } 353 354 if ((_lower == 0) && (_upper == 1)) { 356 if (_is_derived) { 357 _code_attribute = 358 _code_attribute.concat( 359 "public " 360 + _type_format1 361 + " " 362 + _aformat2 363 + "() throws org.omg.mof.Reflective.NotSet, org.omg.mof.Reflective.MofError { \n"); 364 _code_attribute = 365 _code_attribute.concat( 366 "//inserer le code contenu\n"); 367 _code_attribute = _code_attribute.concat("}\n"); 368 } else { 369 _code_attribute = 370 _code_attribute.concat( 371 "public " 372 + _type_format1 373 + " " 374 + _aformat2 375 + "() throws org.omg.mof.Reflective.NotSet, org.omg.mof.Reflective.MofError { \n"); 376 _code_attribute = 377 _code_attribute.concat( 378 "if (_exist_" 379 + _aformat2 380 + ") return _" 381 + _aformat2 382 + ";\n"); 383 _code_attribute = 384 _code_attribute.concat( 385 "else throw new org.omg.mof.Reflective.NotSet();\n"); 386 _code_attribute = _code_attribute.concat("}\n"); 387 } 388 } 389 390 if ((_lower == 1) && (_upper == 1)) { 391 if (_is_derived) { 392 _code_attribute = 393 _code_attribute.concat( 394 "public " 395 + _type_format1 396 + " " 397 + _aformat2 398 + "() throws org.omg.mof.Reflective.MofError {\n "); 399 _code_attribute = 400 _code_attribute.concat( 401 "//inserer le code contenu\n"); 402 _code_attribute = _code_attribute.concat("}\n"); 403 } else { 404 _code_attribute = 405 _code_attribute.concat( 406 "public " 407 + _type_format1 408 + " " 409 + _aformat2 410 + "() throws org.omg.mof.Reflective.MofError {\n "); 411 _code_attribute = 412 _code_attribute.concat( 413 "return _" + _aformat2 + ";\n"); 414 _code_attribute = _code_attribute.concat("}\n"); 415 } 416 } 417 418 if ((_upper > 1) || (_upper == -1)) { 419 if (_is_derived) { 420 _code_attribute = 421 _code_attribute.concat( 422 "\tpublic " 423 + _type_format1 424 + "[] " 425 + _aformat2 426 + "() throws org.omg.mof.Reflective.MofError { \n"); 427 _code_attribute = 428 _code_attribute.concat( 429 "//inserer le code contenu\n"); 430 _code_attribute = _code_attribute.concat("}\n"); 431 } else { 432 _code_attribute = 433 _code_attribute.concat( 434 "public " 435 + _type_format1 436 + "[] " 437 + _aformat2 438 + "() throws org.omg.mof.Reflective.MofError { \n"); 439 _code_attribute = 440 _code_attribute.concat( 441 _type_format1 442 + "[] temp1 = new " 443 + _type_format1 444 + "[_" 445 + _aformat2 446 + "s.size()];\n"); 447 _code_attribute = 448 _code_attribute.concat( 449 "for(int i=0; i< _" 450 + _aformat2 451 + "s.size(); i++) temp1[i] = (" 452 + _type_format1 453 + ")_" 454 + _aformat2 455 + "s.elementAt(i);\n"); 456 _code_attribute = 457 _code_attribute.concat("return temp1;\n"); 458 _code_attribute = _code_attribute.concat("}\n"); 459 } 460 } 461 462 if ((_upper == 1) && (_is_changeable)) { 463 _code_attribute = 464 _code_attribute.concat( 465 "public void set_" 466 + _aformat2 467 + "(" 468 + _type_format1 469 + " new_value) throws org.omg.mof.Reflective.MofError { \n"); 470 if (!_is_derived) { 471 _code_attribute = 472 _code_attribute.concat( 473 "_" + _aformat2 + " = new_value ;\n"); 474 if (_lower == 0) { 475 _code_attribute = 476 _code_attribute.concat( 477 "_exist_" + _aformat2 + " = true;\n"); 478 } 479 } else _code_attribute = _code_attribute.concat( 480 "throw new org.omg.mof.Reflective.MofError();\n"); 481 _code_attribute = _code_attribute.concat("}\n"); 482 } 483 484 if (((_upper > 1) || (_upper == -1)) && (_is_changeable)) { 485 _code_attribute = 486 _code_attribute.concat( 487 "public void set_" 488 + _aformat2 489 + "(" 490 + _type_format1 491 + "[] new_value) throws org.omg.mof.Reflective.MofError { \n"); 492 if (!_is_derived) { 493 _code_attribute = 494 _code_attribute.concat( 495 "_" + _aformat2 + "s.removeAllElements();\n"); 496 _code_attribute = 497 _code_attribute.concat( 498 "for(int i= 0; i< new_value.length ; i++) _" 499 + _aformat2 500 + "s.addElement(new_value[i]);\n");} 501 else _code_attribute = _code_attribute.concat( 502 "throw new org.omg.mof.Reflective.MofError();\n"); 503 _code_attribute = _code_attribute.concat("}\n"); 504 } 505 506 if ((_lower == 0) && (_upper == 1) && (_is_changeable)) { 507 _code_attribute = 508 _code_attribute.concat( 509 "public void unset_" 510 + _aformat2 511 + "() throws org.omg.mof.Reflective.MofError{ \n"); 512 if (!_is_derived) { 513 _code_attribute = 514 _code_attribute.concat( 515 "_exist_" + _aformat2 + " = false;\n");} 516 else _code_attribute =_code_attribute.concat( 517 "throw new org.omg.mof.Reflective.MofError();\n"); 518 _code_attribute = _code_attribute.concat("}\n"); 519 } 520 521 if ((_upper > 1) || (_upper == -1) && (_is_changeable)) { 522 _code_attribute = 523 _code_attribute.concat( 524 "public void add_" 525 + _aformat2 526 + " (" 527 + _type_format1 528 + " new_element) throws org.omg.mof.Reflective.MofError{ \n"); 529 if (!_is_derived) { 530 _code_attribute = 531 _code_attribute.concat( 532 "_" + _aformat2 + "s.addElement(new_element);\n");} 533 else _code_attribute = _code_attribute.concat( 534 "throw new org.omg.mof.Reflective.MofError();\n"); 535 _code_attribute = _code_attribute.concat("}\n"); 536 } 537 538 if ((_upper > 1) 539 || (_upper == -1) 540 && (_is_changeable) 541 && (_is_ordered)) { 542 _code_attribute = 543 _code_attribute.concat( 544 "public void add_" 545 + _aformat2 546 + "_before (" 547 + _type_format1 548 + " new_element, " 549 + _type_format1 550 + " before_element) throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError{ \n"); 551 if (!_is_derived) { 552 _code_attribute = 553 _code_attribute.concat( 554 "if(_" 555 + _aformat2 556 + "s.contains(before_element)) {\n"); 557 _code_attribute = 558 _code_attribute.concat( 559 "int i = _" 560 + _aformat2 561 + "s.indexOf(before_element);\n"); 562 _code_attribute = 563 _code_attribute.concat( 564 "_" 565 + _aformat2 566 + "s.insertElementAt(new_element, i);\n"); 567 _code_attribute = _code_attribute.concat("}\n"); 568 _code_attribute = 569 _code_attribute.concat( 570 "else throw new org.omg.mof.Reflective.NotFound() ;\n");} 571 else _code_attribute =_code_attribute.concat( 572 "throw new org.omg.mof.Reflective.MofError();\n"); 573 _code_attribute = _code_attribute.concat("}\n"); 574 } 575 576 if ((_upper > 1) 577 || (_upper == -1) 578 && (_is_changeable) 579 && (_is_ordered) 580 && (!_is_unique)) { 581 _code_attribute = 582 _code_attribute.concat( 583 "public void add_" 584 + _aformat2 585 + "_at (" 586 + _type_format1 587 + " new_element, int position) throws org.omg.mof.Reflective.BadPosition, org.omg.mof.Reflective.MofError{ \n"); 588 if (!_is_derived) { 589 _code_attribute = 590 _code_attribute.concat( 591 "if(_" 592 + _aformat2 593 + "s.size()> position) _" 594 + _aformat2 595 + "s.insertElementAt(new_element, position);\n"); 596 _code_attribute = 597 _code_attribute.concat( 598 "else throw new org.omg.mof.Reflective.BadPosition() ;\n");} 599 else _code_attribute = _code_attribute.concat( 600 "throw new org.omg.mof.Reflective.MofError();\n"); 601 _code_attribute = _code_attribute.concat("}\n"); 602 } 603 604 if ((_upper > 1) || (_upper == -1) && (_is_changeable)) { 605 _code_attribute = 606 _code_attribute.concat( 607 "public void modify_" 608 + _aformat2 609 + " (" 610 + _type_format1 611 + " old_element," 612 + _type_format1 613 + " new_element) throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError{ \n"); 614 if (!_is_derived) { 615 _code_attribute = 616 _code_attribute.concat( 617 "if( _" 618 + _aformat2 619 + "s.contains(old_element)) {\n"); 620 _code_attribute = 621 _code_attribute.concat( 622 "int i =_" 623 + _aformat2 624 + "s.indexOf(old_element);\n"); 625 _code_attribute = 626 _code_attribute.concat( 627 "_" 628 + _aformat2 629 + "s.setElementAt(new_element, i);\n"); 630 _code_attribute = _code_attribute.concat("}\n"); 631 _code_attribute = 632 _code_attribute.concat( 633 "else throw new org.omg.mof.Reflective.NotFound();\n");} 634 else _code_attribute = _code_attribute.concat( 635 "throw new org.omg.mof.Reflective.MofError();\n"); 636 _code_attribute = _code_attribute.concat("}\n"); 637 } 638 639 if ((_upper > 1) 640 || (_upper == -1) 641 && (_is_changeable) 642 && (_is_ordered) 643 && (!_is_unique)) { 644 _code_attribute = 645 _code_attribute.concat( 646 "public void modify_" 647 + _aformat2 648 + "_at (" 649 + _type_format1 650 + " new_element, int position) throws org.omg.mof.Reflective.BadPosition, org.omg.mof.Reflective.MofError{\n"); 651 if (!_is_derived) { 652 _code_attribute = 653 _code_attribute.concat( 654 "if(_" 655 + _aformat2 656 + "s.size()> position) _" 657 + _aformat2 658 + "s.setElementAt(new_element, position);\n"); 659 _code_attribute = 660 _code_attribute.concat( 661 "else throw new org.omg.mof.Reflective.BadPosition() ;\n");} 662 else _code_attribute = _code_attribute.concat( 663 "throw new org.omg.mof.Reflective.MofError();\n"); 664 _code_attribute = _code_attribute.concat("}\n"); 665 } 666 667 if ((_upper > 1) 668 || (_upper == -1) 669 && (_upper != _lower) 670 && (_is_changeable)) { 671 _code_attribute = 672 _code_attribute.concat( 673 "public void remove_" 674 + _aformat2 675 + " (" 676 + _type_format1 677 + " old_element ) throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError { \n"); 678 if (!_is_derived) { 679 _code_attribute = 680 _code_attribute.concat( 681 "if(_" 682 + _aformat2 683 + "s.contains(old_element)) _" 684 + _aformat2 685 + "s.removeElement(old_element);\n"); 686 _code_attribute = 687 _code_attribute.concat( 688 "else throw new org.omg.mof.Reflective.NotFound() ;\n");} 689 else _code_attribute = _code_attribute.concat( 690 "throw new org.omg.mof.Reflective.MofError();\n"); 691 692 _code_attribute = _code_attribute.concat("}\n"); 693 } 694 695 if ((_upper > 1) 696 || (_upper == -1) 697 && (_upper != _lower) 698 && (_is_changeable) 699 && (_is_ordered) 700 && (!_is_unique)) { 701 _code_attribute = 702 _code_attribute.concat( 703 "public void remove_" 704 + _aformat2 705 + "_at (int position) throws org.omg.mof.Reflective.BadPosition, org.omg.mof.Reflective.MofError { \n"); 706 if (!_is_derived) { 707 _code_attribute = 708 _code_attribute.concat( 709 "if(_" 710 + _aformat2 711 + "s.size()> position) _" 712 + _aformat2 713 + "s.remove( position);\n"); 714 _code_attribute = 715 _code_attribute.concat( 716 "else throw new org.omg.mof.Reflective.BadPosition() ;\n");} 717 else _code_attribute = _code_attribute.concat( 718 "throw new org.omg.mof.Reflective.MofError();\n"); 719 _code_attribute = _code_attribute.concat("}\n"); 720 } 721 _attributs.put(_key, _code_attribute); 722 return _code_attribute; 723 } 724 } 725 726 private java.util.Hashtable _references = new java.util.Hashtable (); 729 730 public String referenceTemplate(org.omg.mof.Model.Reference _reference) 731 throws org.omg.mof.Reflective.MofError , NotSet { 732 733 String _key = _reference.ref_mof_id(); 735 if (_references.containsKey(_key)) { 736 String _temp = (String ) _references.get(_key); 737 return _temp; 738 } else { 739 String _code_reference = "//" + _reference.annotation() + "\n"; 741 742 String _type_format1 = javaQualifiedName(_reference.type()); 743 String _aformat2 = format2(_reference.name()); 744 String _aformat2Idl2JavaConflict = format2Idl2JavaConflict(_reference.name()); 745 org.omg.mof.Model.MultiplicityType _multiplicity = 746 _reference.multiplicity(); 747 int _upper = _multiplicity.upper; 748 int _lower = _multiplicity.lower; 749 boolean _is_ordered = _multiplicity.isOrdered; 750 boolean _is_unique = _multiplicity.isUnique; 751 boolean _is_changeable = _reference.is_changeable(); 752 753 if ((_upper > 1) || (_upper == -1)) 755 _code_reference = 756 _code_reference.concat( 757 "private java.util.Vector _" 758 + _aformat2 759 + "s = new java.util.Vector();\n"); 760 else 761 _code_reference = 762 _code_reference.concat( 763 "private " 764 + _type_format1 765 + " _" 766 + _aformat2 767 + " = null;\n"); 768 769 if ((_lower == 0) && (_upper == 1)) { 771 _code_reference = 772 _code_reference.concat( 773 "public " 774 + _type_format1 775 + " " 776 + _aformat2Idl2JavaConflict 777 + "() throws org.omg.mof.Reflective.NotSet, org.omg.mof.Reflective.MofError { \n"); 778 _code_reference = 779 _code_reference.concat( 780 "if (_" 781 + _aformat2 782 + "!= null) return _" 783 + _aformat2 784 + ";\n"); 785 _code_reference = 786 _code_reference.concat( 787 "else throw new org.omg.mof.Reflective.NotSet();\n"); 788 _code_reference = _code_reference.concat("}\n"); 789 } 790 791 if ((_lower == 1) && (_upper == 1)) { 792 _code_reference = 793 _code_reference.concat( 794 "public " 795 + _type_format1 796 + " " 797 + _aformat2Idl2JavaConflict 798 + "() throws org.omg.mof.Reflective.MofError { \n"); 799 _code_reference = 800 _code_reference.concat("return _" + _aformat2 + ";\n"); 801 _code_reference = _code_reference.concat("}\n"); 802 } 803 804 if ((_upper > 1) || (_upper == -1)) { 805 _code_reference = 806 _code_reference.concat( 807 "public " 808 + _type_format1 809 + "[] " 810 + _aformat2Idl2JavaConflict 811 + "() throws org.omg.mof.Reflective.MofError { \n"); 812 _code_reference = 813 _code_reference.concat( 814 "" 815 + _type_format1 816 + "[] temp1 = new " 817 + _type_format1 818 + "[_" 819 + _aformat2 820 + "s.size()];\n"); 821 _code_reference = 822 _code_reference.concat( 823 "for(int i=0; i< _" 824 + _aformat2 825 + "s.size(); i++) temp1[i] = (" 826 + _type_format1 827 + ")_" 828 + _aformat2 829 + "s.elementAt(i);\n"); 830 _code_reference = _code_reference.concat("return temp1;\n"); 831 _code_reference = _code_reference.concat("}\n"); 832 } 833 834 if ((_upper == 1) && (_is_changeable)) { 835 _code_reference = 836 _code_reference.concat( 837 "public void set_" 838 + _aformat2 839 + "(" 840 + _type_format1 841 + " new_value) throws org.omg.mof.Reflective.MofError { \n"); 842 _code_reference = 843 _code_reference.concat( 844 "_" + _aformat2 + " = new_value ;\n"); 845 _code_reference = _code_reference.concat("}\n"); 846 } 847 848 if (((_upper > 1) || (_upper == -1)) && (_is_changeable)) { 849 _code_reference = 850 _code_reference.concat( 851 "public void set_" 852 + _aformat2 853 + "(" 854 + _type_format1 855 + "[] new_value) throws org.omg.mof.Reflective.MofError { \n"); 856 _code_reference = 857 _code_reference.concat( 858 "_" + _aformat2 + "s.removeAllElements();\n"); 859 _code_reference = 860 _code_reference.concat( 861 "for(int i= 0; i< new_value.length ; i++) _" 862 + _aformat2 863 + "s.addElement(new_value[i]);\n"); 864 _code_reference = _code_reference.concat("}\n"); 865 } 866 867 if ((_lower == 0) && (_upper == 1) && (_is_changeable)) { 868 _code_reference = 869 _code_reference.concat( 870 "public void unset_" 871 + _aformat2 872 + "() throws org.omg.mof.Reflective.MofError{ \n"); 873 _code_reference = 874 _code_reference.concat("_" + _aformat2 + " = null;\n"); 875 _code_reference = _code_reference.concat("}\n"); 876 } 877 878 if ((_upper > 1) || (_upper == -1) && (_is_changeable)) { 879 _code_reference = 880 _code_reference.concat( 881 "public void add_" 882 + _aformat2 883 + " (" 884 + _type_format1 885 + " new_element) throws org.omg.mof.Reflective.MofError{ \n"); 886 _code_reference = 887 _code_reference.concat( 888 "_" + _aformat2 + "s.addElement(new_element);\n"); 889 _code_reference = _code_reference.concat("}\n"); 890 } 891 892 if ((_upper > 1) 893 || (_upper == -1) 894 && (_is_changeable) 895 && (_is_ordered)) { 896 _code_reference = 897 _code_reference.concat( 898 "public void add_" 899 + _aformat2 900 + "_before (" 901 + _type_format1 902 + " new_element, " 903 + _type_format1 904 + " before_element) throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError{ \n"); 905 _code_reference = 906 _code_reference.concat( 907 "if(_" 908 + _aformat2 909 + "s.contains(before_element)) {\n"); 910 _code_reference = 911 _code_reference.concat( 912 "int i = _" 913 + _aformat2 914 + "s.indexOf(before_element);\n"); 915 _code_reference = 916 _code_reference.concat( 917 "_" 918 + _aformat2 919 + "s.insertElementAt(new_element, i);\n"); 920 _code_reference = _code_reference.concat("}\n"); 921 _code_reference = 922 _code_reference.concat( 923 "else throw new org.omg.mof.Reflective.NotFound() ;\n"); 924 _code_reference = _code_reference.concat("}\n"); 925 } 926 927 if ((_upper > 1) || (_upper == -1) && (_is_changeable)) { 928 _code_reference = 929 _code_reference.concat( 930 "public void modify_" 931 + _aformat2 932 + " (" 933 + _type_format1 934 + " old_element," 935 + _type_format1 936 + " new_element) throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError{ \n"); 937 _code_reference = 938 _code_reference.concat( 939 "if( _" 940 + _aformat2 941 + "s.contains(old_element)) {\n"); 942 _code_reference = 943 _code_reference.concat( 944 "int i =_" 945 + _aformat2 946 + "s.indexOf(old_element);\n"); 947 _code_reference = 948 _code_reference.concat( 949 "_" 950 + _aformat2 951 + "s.setElementAt(new_element, i);\n"); 952 _code_reference = _code_reference.concat("}\n"); 953 _code_reference = 954 _code_reference.concat( 955 "else throw new org.omg.mof.Reflective.NotFound();\n"); 956 _code_reference = _code_reference.concat("}\n"); 957 } 958 959 if ((_upper > 1) 960 || (_upper == -1) 961 && (_upper != _lower) 962 && (_is_changeable)) { 963 _code_reference = 964 _code_reference.concat( 965 "public void remove_" 966 + _aformat2 967 + " (" 968 + _type_format1 969 + " old_element ) throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError { \n"); 970 _code_reference = 971 _code_reference.concat( 972 "if(_" 973 + _aformat2 974 + "s.contains(old_element)) _" 975 + _aformat2 976 + "s.removeElement(old_element);\n"); 977 _code_reference = 978 _code_reference.concat( 979 "else throw new org.omg.mof.Reflective.NotFound() ;\n"); 980 _code_reference = _code_reference.concat("}\n"); 981 } 982 _references.put(_key, _code_reference); 983 return _code_reference; 984 } 985 } 986 987 private java.util.Hashtable _operations = new java.util.Hashtable (); 990 991 public String operationTemplate(org.omg.mof.Model.Operation _operation) 992 throws org.omg.mof.Reflective.MofError, BadKind , Bounds , NotSet{ 993 994 String _key = _operation.ref_mof_id(); 996 if (_operations.containsKey(_key)) { 997 String _temp = (String ) _operations.get(_key); 998 return _temp; 999 } else { 1000 1001 String _code_operation = "//" + _operation.annotation() + "\n"; 1002 String _oformat2 = format2Idl2JavaConflict(_operation.name()); 1004 1005 org.omg.mof.Model.ModelElement[] _contents = _operation.contents(); 1006 1007 boolean bool = false; 1008 int j = 0; 1009 while (!bool && (j < _contents.length)) { 1010 org.omg.mof.Model.Parameter _parameter = 1011 org.omg.mof.Model.ParameterHelper.narrow(_contents[j]); 1012 if ((_parameter.direction()) 1013 .equals(org.omg.mof.Model.DirectionKind.return_dir)) { 1014 bool = true; 1015 if ((_parameter.multiplicity().upper > 1) 1016 || (_parameter.multiplicity().upper == -1)) 1017 _code_operation = 1018 _code_operation.concat( 1019 "public " 1020 + javaType(_parameter.type()) 1021 + "[] " 1022 + _oformat2 1023 + " ("); 1024 else 1025 _code_operation = 1026 _code_operation.concat( 1027 "public " 1028 + javaType(_parameter.type()) 1029 + " " 1030 + _oformat2 1031 + "("); 1032 j = j + 1; 1033 } 1034 } 1035 if (!bool) 1036 _code_operation = _code_operation.concat("public void "+_oformat2 +"("); 1037 for (int i = 0; i < _contents.length; i++) { 1038 org.omg.mof.Model.Parameter _parameter = 1039 org.omg.mof.Model.ParameterHelper.narrow(_contents[i]); 1040 String _type_format1 = javaType(_parameter.type()); 1041 String _pformat2 = format2(_parameter.name()); 1042 if (!(_parameter 1043 .direction() 1044 .equals(org.omg.mof.Model.DirectionKind.return_dir))) { 1045 if ((_parameter.multiplicity().upper > 1) 1046 || (_parameter.multiplicity().upper == -1)) 1047 _code_operation = 1048 _code_operation.concat( 1049 _type_format1 + "[] " + _pformat2 + " "); 1050 else 1051 _code_operation = 1052 _code_operation.concat( 1053 _type_format1 + " " + _oformat2 + " "); 1054 if (i != (_contents.length - 1)) 1055 _code_operation = _code_operation.concat(", "); 1056 } 1057 } 1058 _code_operation = _code_operation.concat(") throws "); 1059 org.omg.mof.Model.MofException[] _exceptions = 1060 _operation.exceptions(); 1061 for (int i = 0; i < _exceptions.length; i++) { 1062 org.omg.mof.Model.MofException _exception = _exceptions[i]; 1063 String _eformat1 = format1Idl2JavaConflict(_exception.name()); 1064 _code_operation = _code_operation.concat(_eformat1); 1065 _code_operation = _code_operation.concat(", "); 1066 } 1067 _code_operation = 1068 _code_operation.concat("org.omg.mof.Reflective.MofError {\n"); 1069 _code_operation = 1070 _code_operation.concat("//inserer le code contenu\n"); 1071 _code_operation = 1072 _code_operation.concat( 1073 "throw new org.omg.CORBA.NO_IMPLEMENT(\" method not implemented \",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1074 _code_operation = _code_operation.concat("}\n"); 1075 _references.put(_key, _code_operation); 1076 return _code_operation; 1077 } 1078 } 1079 1080 private String _code_ref_base_object = null; 1082 public String refBaseObjectTemplate() { 1083 1084 if (_code_ref_base_object != null) 1086 return _code_ref_base_object; 1087 1088 else { 1089 String _code_temp = ""; 1090 _code_temp = 1091 _code_temp.concat("//Ajout de la partie RefBaseObject \n"); 1092 _code_temp = _code_temp.concat("// Operation ref_mof_id\n"); 1093 _code_temp = 1094 _code_temp.concat( 1095 "public java.lang.String ref_mof_id(){\n"); 1096 _code_temp = 1097 _code_temp.concat( 1098 "int id = _orb().object_to_string(_this()).hashCode();\n"); 1099 _code_temp = 1100 _code_temp.concat("return String.valueOf(id);\n"); 1101 _code_temp = _code_temp.concat("}\n"); 1102 1103 _code_temp = 1104 _code_temp.concat("// Operation ref_meta_object\n"); 1105 _code_temp = 1106 _code_temp.concat( 1107 "public org.omg.mof.Reflective.RefObject ref_meta_object(){\n"); 1108 _code_temp = 1109 _code_temp.concat( 1110 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_meta_object method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1111 _code_temp = _code_temp.concat("}\n"); 1112 1113 _code_temp = _code_temp.concat("// Operation ref_itself\n"); 1114 _code_temp = 1115 _code_temp.concat( 1116 "public boolean ref_itself(org.omg.mof.Reflective.RefBaseObject other_object){\n"); 1117 _code_temp = 1118 _code_temp.concat( 1119 "String id_obj = other_object.ref_mof_id();\n"); 1120 _code_temp = 1121 _code_temp.concat( 1122 "if (ref_mof_id().equals(id_obj)) return true;\n"); 1123 _code_temp = _code_temp.concat("else return false;\n"); 1124 _code_temp = _code_temp.concat("}\n"); 1125 1126 _code_temp = 1127 _code_temp.concat("// Operation ref_immediate_package\n"); 1128 _code_temp = 1129 _code_temp.concat( 1130 "public org.omg.mof.Reflective._RefPackage ref_immediate_package(){\n"); 1131 _code_temp = 1132 _code_temp.concat( 1133 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_immediate_package method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1134 _code_temp = _code_temp.concat("}\n"); 1135 1136 _code_temp = 1137 _code_temp.concat("// Operation ref_outermost_package\n"); 1138 _code_temp = 1139 _code_temp.concat( 1140 "public org.omg.mof.Reflective._RefPackage ref_outermost_package(){\n"); 1141 _code_temp = 1142 _code_temp.concat( 1143 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_moutermost_package method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1144 _code_temp = _code_temp.concat("}\n"); 1145 1146 _code_temp = _code_temp.concat("// Operation ref_delete\n"); 1147 _code_temp = 1148 _code_temp.concat( 1149 "public void ref_delete() throws org.omg.mof.Reflective.MofError {\n"); 1150 _code_temp = 1151 _code_temp.concat( 1152 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_delete method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1153 _code_temp = _code_temp.concat("}\n"); 1154 1155 _code_ref_base_object = _code_temp; 1157 return _code_ref_base_object; 1158 } 1159 1160 } 1161 1162 private String _code_ref_association = null; 1164 public String refAssociationTemplate() { 1165 1166 if (_code_ref_association != null) 1168 return _code_ref_association; 1169 1170 else { 1171 String _code_temp = ""; 1172 _code_temp = _code_temp.concat("// Operation ref_all_links\n"); 1173 _code_temp = 1174 _code_temp.concat( 1175 "public org.omg.mof.Reflective.RefObject[][] ref_all_links(){\n"); 1176 _code_temp = 1177 _code_temp.concat( 1178 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_all_links method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1179 _code_temp = _code_temp.concat("}\n"); 1180 1181 _code_temp = 1182 _code_temp.concat("// Operation ref_link_exists\n"); 1183 _code_temp = 1184 _code_temp.concat( 1185 "public boolean ref_link_exists(org.omg.mof.Reflective.RefObject[] some_link)\n"); 1186 _code_temp = 1187 _code_temp.concat( 1188 " throws org.omg.mof.Reflective.MofError{\n"); 1189 _code_temp = 1190 _code_temp.concat( 1191 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_link_exists method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1192 _code_temp = _code_temp.concat("}\n"); 1193 1194 _code_temp = _code_temp.concat("// Operation ref_query\n"); 1195 _code_temp = 1196 _code_temp.concat( 1197 "public org.omg.mof.Reflective.RefObject[] ref_query(org.omg.mof.Reflective.RefObject query_end, org.omg.mof.Reflective.RefObject query_object)\n"); 1198 _code_temp = 1199 _code_temp.concat( 1200 " throws org.omg.mof.Reflective.MofError{\n"); 1201 _code_temp = 1202 _code_temp.concat( 1203 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_query method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1204 _code_temp = _code_temp.concat("}\n"); 1205 1206 _code_temp = _code_temp.concat("// Operation ref_add_link\n"); 1207 _code_temp = 1208 _code_temp.concat( 1209 "public void ref_add_link(org.omg.mof.Reflective.RefObject[] new_link)\n"); 1210 _code_temp = 1211 _code_temp.concat( 1212 " throws org.omg.mof.Reflective.MofError{\n"); 1213 _code_temp = 1214 _code_temp.concat( 1215 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_add_link method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1216 _code_temp = _code_temp.concat("}\n"); 1217 1218 _code_temp = 1219 _code_temp.concat("// Operation ref_add_link_before\n"); 1220 _code_temp = 1221 _code_temp.concat( 1222 "public void ref_add_link_before(org.omg.mof.Reflective.RefObject[] new_link, org.omg.mof.Reflective.RefObject position_end, org.omg.mof.Reflective.RefObject before)\n"); 1223 _code_temp = 1224 _code_temp.concat( 1225 " throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError{\n"); 1226 _code_temp = 1227 _code_temp.concat( 1228 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_add_link_before method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1229 _code_temp = _code_temp.concat("}\n"); 1230 1231 _code_temp = 1232 _code_temp.concat("// Operation ref_modify_link\n"); 1233 _code_temp = 1234 _code_temp.concat( 1235 "public void ref_modify_link(org.omg.mof.Reflective.RefObject[] old_link, org.omg.mof.Reflective.RefObject position_end, org.omg.mof.Reflective.RefObject new_object)\n"); 1236 _code_temp = 1237 _code_temp.concat( 1238 " throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError{\n"); 1239 _code_temp = 1240 _code_temp.concat( 1241 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_modify_link method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1242 _code_temp = _code_temp.concat("}\n"); 1243 1244 _code_temp = 1245 _code_temp.concat("// Operation ref_remove_link\n"); 1246 _code_temp = 1247 _code_temp.concat( 1248 "public void ref_remove_link(org.omg.mof.Reflective.RefObject[] old_link)\n"); 1249 _code_temp = 1250 _code_temp.concat( 1251 " throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError {\n"); 1252 _code_temp = 1253 _code_temp.concat( 1254 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_remove_link method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1255 _code_temp = _code_temp.concat("}\n"); 1256 _code_ref_association = _code_temp; 1258 return _code_ref_association; 1259 } 1260 } 1261 1262 private String _code_ref_object = null; 1264 public String refObjectTemplate() { 1265 1266 if (_code_ref_object != null) 1268 return _code_ref_object; 1269 1270 else { 1271 String _code_temp = ""; 1272 _code_temp = 1273 _code_temp.concat("//Ajout de la partie RefObject\n"); 1274 _code_temp = 1275 _code_temp.concat("// Operation ref_is_instance_of\n"); 1276 _code_temp = 1277 _code_temp.concat( 1278 "public boolean ref_is_instance_of(org.omg.mof.Reflective.RefObject some_class, boolean consider_subtypes) {\n"); 1279 _code_temp = 1280 _code_temp.concat( 1281 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_is_instance_of method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1282 _code_temp = _code_temp.concat("}\n"); 1283 1284 _code_temp = 1285 _code_temp.concat("// Operation ref_create_instance\n"); 1286 _code_temp = 1287 _code_temp.concat( 1288 "public org.omg.mof.Reflective.RefObject ref_create_instance(org.omg.CORBA.Any[] args) throws org.omg.mof.Reflective.MofError {\n"); 1289 _code_temp = 1290 _code_temp.concat( 1291 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_create_instance method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1292 _code_temp = _code_temp.concat("}\n"); 1293 1294 _code_temp = 1295 _code_temp.concat("// Operation ref_all_objects\n"); 1296 _code_temp = 1297 _code_temp.concat( 1298 "public org.omg.mof.Reflective.RefObject[] ref_all_objects(boolean include_subtypes){\n"); 1299 _code_temp = 1300 _code_temp.concat( 1301 " throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_all_objects method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1302 _code_temp = _code_temp.concat("}\n"); 1303 1304 _code_temp = _code_temp.concat("// Operation ref_set_value\n"); 1305 _code_temp = 1306 _code_temp.concat( 1307 "public void ref_set_value(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any new_value) throws org.omg.mof.Reflective.MofError {\n"); 1308 _code_temp = 1309 _code_temp.concat( 1310 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_set_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1311 _code_temp = _code_temp.concat("}\n"); 1312 1313 _code_temp = _code_temp.concat("// Operation ref_value\n"); 1314 _code_temp = 1315 _code_temp.concat( 1316 "public org.omg.CORBA.Any ref_value(org.omg.mof.Reflective.RefObject feature) throws org.omg.mof.Reflective.NotSet, org.omg.mof.Reflective.MofError {\n"); 1317 _code_temp = 1318 _code_temp.concat( 1319 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1320 _code_temp = _code_temp.concat("}\n"); 1321 1322 _code_temp = 1323 _code_temp.concat("// Operation ref_unset_value\n"); 1324 _code_temp = 1325 _code_temp.concat( 1326 "public void ref_unset_value() throws org.omg.mof.Reflective.MofError {\n"); 1327 _code_temp = 1328 _code_temp.concat( 1329 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_unset_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1330 _code_temp = _code_temp.concat("}\n"); 1331 1332 _code_temp = _code_temp.concat("// Operation ref_add_value\n"); 1333 _code_temp = 1334 _code_temp.concat( 1335 "public void ref_add_value(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any new_element) throws org.omg.mof.Reflective.MofError {\n"); 1336 _code_temp = 1337 _code_temp.concat( 1338 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_add_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1339 _code_temp = _code_temp.concat("}\n"); 1340 1341 _code_temp = 1342 _code_temp.concat("// Operation ref_add_value_before\n"); 1343 _code_temp = 1344 _code_temp.concat( 1345 "public void ref_add_value_before(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any new_element, org.omg.CORBA.Any before_element)\n"); 1346 _code_temp = 1347 _code_temp.concat( 1348 " throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError {\n"); 1349 _code_temp = 1350 _code_temp.concat( 1351 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_add_value_before method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1352 _code_temp = _code_temp.concat("}\n"); 1353 1354 _code_temp = 1355 _code_temp.concat("// Operation ref_add_value_at\n"); 1356 _code_temp = 1357 _code_temp.concat( 1358 "public void ref_add_value_at(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any new_element, int position)\n"); 1359 _code_temp = 1360 _code_temp.concat( 1361 " throws org.omg.mof.Reflective.BadPosition, org.omg.mof.Reflective.MofError {\n"); 1362 _code_temp = 1363 _code_temp.concat( 1364 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_add_value_at method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1365 _code_temp = _code_temp.concat("}\n"); 1366 1367 _code_temp = 1368 _code_temp.concat("// Operation ref_modify_value\n"); 1369 _code_temp = 1370 _code_temp.concat( 1371 "public void ref_modify_value(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any old_element, org.omg.CORBA.Any new_element)\n"); 1372 _code_temp = 1373 _code_temp.concat( 1374 " throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError {\n"); 1375 _code_temp = 1376 _code_temp.concat( 1377 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_modify_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1378 _code_temp = _code_temp.concat("}\n"); 1379 1380 _code_temp = 1381 _code_temp.concat("// Operation ref_modify_value_at\n"); 1382 _code_temp = 1383 _code_temp.concat( 1384 "public void ref_modify_value_at(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any new_element, int position)\n"); 1385 _code_temp = 1386 _code_temp.concat( 1387 " throws org.omg.mof.Reflective.BadPosition, org.omg.mof.Reflective.MofError {\n"); 1388 _code_temp = 1389 _code_temp.concat( 1390 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_modify_value_at method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1391 _code_temp = _code_temp.concat("}\n"); 1392 1393 _code_temp = 1394 _code_temp.concat("// Operation ref_remove_value\n"); 1395 _code_temp = 1396 _code_temp.concat( 1397 "public void ref_remove_value(org.omg.mof.Reflective.RefObject feature, org.omg.CORBA.Any existing_element)\n"); 1398 _code_temp = 1399 _code_temp.concat( 1400 " throws org.omg.mof.Reflective.NotFound, org.omg.mof.Reflective.MofError {\n"); 1401 _code_temp = 1402 _code_temp.concat( 1403 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_remove_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1404 _code_temp = _code_temp.concat("}\n"); 1405 1406 _code_temp = 1407 _code_temp.concat("// Operation ref_remove_value_at\n"); 1408 _code_temp = 1409 _code_temp.concat( 1410 "public void ref_remove_value_at(org.omg.mof.Reflective.RefObject feature, int position)\n"); 1411 _code_temp = 1412 _code_temp.concat( 1413 " throws org.omg.mof.Reflective.BadPosition, org.omg.mof.Reflective.MofError {\n"); 1414 _code_temp = 1415 _code_temp.concat( 1416 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_remove_value_at method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1417 _code_temp = _code_temp.concat("}\n"); 1418 1419 _code_temp = 1420 _code_temp.concat("// Operation ref_immediate_composite\n"); 1421 _code_temp = 1422 _code_temp.concat( 1423 "public org.omg.mof.Reflective.RefObject ref_immediate_composite() {\n"); 1424 _code_temp = 1425 _code_temp.concat( 1426 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_remove_value method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1427 _code_temp = _code_temp.concat("}\n"); 1428 1429 _code_temp = 1430 _code_temp.concat("// Operation ref_outermost_composite\n"); 1431 _code_temp = 1432 _code_temp.concat( 1433 "public org.omg.mof.Reflective.RefObject ref_outermost_composite() {\n"); 1434 _code_temp = 1435 _code_temp.concat( 1436 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_outermost_composite method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1437 _code_temp = _code_temp.concat("}\n"); 1438 1439 _code_temp = 1440 _code_temp.concat("// Operation ref_invoke_operation(\n"); 1441 _code_temp = 1442 _code_temp.concat( 1443 "public org.omg.CORBA.Any ref_invoke_operation(org.omg.mof.Reflective.RefObject requested_temp, org.omg.mof.Reflective.ValueTypeListHolder args)\n"); 1444 _code_temp = 1445 _code_temp.concat( 1446 " throws org.omg.mof.Reflective.OtherException, org.omg.mof.Reflective.MofError {\n"); 1447 _code_temp = 1448 _code_temp.concat( 1449 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_invoke_operation( method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1450 _code_temp = _code_temp.concat("}\n"); 1451 1452 _code_ref_object = _code_temp; 1454 return _code_ref_object; 1455 } 1456 } 1457 1458 private String _code_ref_package = null; 1459 1462 public String refPackageTemplate() { 1463 if (_code_ref_package != null) 1465 return _code_ref_package; 1466 1467 else { 1468 String _code_temp = ""; 1469 _code_temp = _code_temp.concat("// Operation ref_class_ref\n"); 1470 _code_temp = 1471 _code_temp.concat( 1472 "public org.omg.mof.Reflective.RefObject ref_class_ref(org.omg.mof.Reflective.RefObject _class)\n"); 1473 _code_temp = 1474 _code_temp.concat( 1475 " throws org.omg.mof.Reflective.MofError{\n"); 1476 _code_temp = 1477 _code_temp.concat( 1478 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_class_ref method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1479 _code_temp = _code_temp.concat(" }\n"); 1480 1481 _code_temp = 1482 _code_temp.concat("// Operation ref_association_ref\n"); 1483 _code_temp = 1484 _code_temp.concat( 1485 "public org.omg.mof.Reflective.RefAssociation ref_association_ref(org.omg.mof.Reflective.RefObject association)\n"); 1486 _code_temp = 1487 _code_temp.concat( 1488 " throws org.omg.mof.Reflective.MofError {\n"); 1489 _code_temp = 1490 _code_temp.concat( 1491 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_association_ref method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1492 _code_temp = _code_temp.concat("}\n"); 1493 1494 _code_temp = 1495 _code_temp.concat("// Operation ref_package_ref\n"); 1496 _code_temp = 1497 _code_temp.concat( 1498 "public org.omg.mof.Reflective._RefPackage ref_package_ref(org.omg.mof.Reflective.RefObject _package)\n"); 1499 _code_temp = 1500 _code_temp.concat( 1501 " throws org.omg.mof.Reflective.MofError{\n"); 1502 _code_temp = 1503 _code_temp.concat( 1504 "throw new org.omg.CORBA.NO_IMPLEMENT(\"ref_package_ref method not implemented\",1 ,org.omg.CORBA.CompletionStatus.COMPLETED_NO);\n"); 1505 _code_temp = _code_temp.concat("}\n"); 1506 1507 _code_ref_package = _code_temp; 1509 return _code_ref_package; 1510 } 1511 1512 } 1513 1514 1517 public String idlPrefix2Java(String prefix) { 1518 StringTokenizer st = new StringTokenizer (prefix, "."); 1519 String resu = ""; 1520 while (st.hasMoreTokens()) { 1521 resu = resu + st.nextToken(); 1522 if (st.hasMoreTokens()) 1523 resu = resu + "."; 1524 } 1525 return resu; 1526 } 1527 1528 1532 public MOFCommon getMofHelper() { 1533 return mofHelper; 1534 } 1535 1536 1540 public void setMofHelper(MOFCommon mofHelper) { 1541 this.mofHelper = mofHelper; 1542 } 1543 1544} 1545 | Popular Tags |