1 20 package org.objectweb.modfact.corba.io; 21 22 import java.io.FileInputStream ; 23 import java.io.FileNotFoundException ; 24 import java.io.IOException ; 25 import java.io.InputStream ; 26 import java.util.Enumeration ; 27 import java.util.Hashtable ; 28 import java.util.StringTokenizer ; 29 import java.util.Vector ; 30 31 import javax.xml.parsers.DocumentBuilder ; 32 import javax.xml.parsers.DocumentBuilderFactory ; 33 import javax.xml.parsers.ParserConfigurationException ; 34 import org.w3c.dom.Document ; 35 import org.w3c.dom.Element ; 36 import org.w3c.dom.Node ; 37 import org.w3c.dom.NodeList ; 38 import org.xml.sax.SAXException ; 39 40 import org.omg.CORBA.ORB ; 41 import org.omg.CORBA.TypeCode ; 42 import org.omg.CORBA.TypeCodePackage.BadKind ; 43 import org.omg.mof.Model.*; 44 import org.omg.mof.Reflective.MofError; 45 import org.objectweb.modfact.corba.helper.IDLCommon; 46 import org.objectweb.modfact.corba.logging.Level; 47 import org.objectweb.modfact.corba.logging.ModFactLogger; 48 49 public class Import { 50 51 private ModFactLogger logger; 53 54 private IDLCommon idlHelper; 56 57 private PackageClass _package_class; 59 private ClassClass _class_class; 60 private MofAttributeClass _attribute_class; 61 private ReferenceClass _reference_class; 62 private AssociationClass _association_class; 63 private AssociationEndClass _association_end_class; 64 private RefersTo _refers_to_class; 65 private Exposes _exposes_class; 66 private DataTypeClass _datatype_class; 67 private ConstantClass _constant_class; 68 private ConstraintClass _constraint_class; 69 private TagClass _tag_class; 70 private OperationClass _operation_class; 71 private ParameterClass _parameter_class; 72 private MofExceptionClass _exception_class; 73 private ImportClass _import_class; 74 75 private ORB _orb; 77 private Element _document; 78 79 private Hashtable _types = new Hashtable (); 81 private Hashtable _elementsToType = new Hashtable (); 82 private Hashtable _elementsToSupertype = new Hashtable (); 83 84 private Hashtable _tags = new Hashtable (); 86 private Hashtable _Id2element = new Hashtable (); 87 88 private Hashtable _Id2exception = new Hashtable (); 90 private Hashtable _Exception4Operations = new Hashtable (); 91 92 private Hashtable _Import2Imported = new Hashtable (); 94 95 private Hashtable _OtherEnd = new Hashtable (); 97 private Hashtable _Id2End = new Hashtable (); 98 private Hashtable _referencedEndTable = new Hashtable (); 99 private Hashtable _constantValue = new Hashtable (); 100 101 private java.util.Hashtable _dataTypes = new Hashtable (); 104 public void initiate(_ModelPackage _model_package, org.omg.CORBA.ORB orb) 106 throws MofError { 107 108 _package_class = _model_package.package_ref(); 110 _class_class = _model_package.class_ref(); 111 _attribute_class = _model_package.mof_attribute_ref(); 112 _reference_class = _model_package.reference_ref(); 113 _association_class = _model_package.association_ref(); 114 _association_end_class = _model_package.association_end_ref(); 115 _refers_to_class = _model_package.refers_to_ref(); 116 _exposes_class = _model_package.exposes_ref(); 117 _datatype_class = _model_package.data_type_ref(); 118 _constant_class = _model_package.constant_ref(); 119 _constraint_class = _model_package.constraint_ref(); 120 _tag_class = _model_package.tag_ref(); 121 _operation_class = _model_package.operation_ref(); 122 _parameter_class = _model_package.parameter_ref(); 123 _exception_class = _model_package.mof_exception_ref(); 124 _import_class = _model_package.import_ref(); 125 _orb = orb; 126 initPrimitiveTypes(); 127 } 128 129 132 protected void initPrimitiveTypes() throws org.omg.mof.Reflective.MofError { 133 org.omg.mof.Model.VisibilityKind pvis = org.omg.mof.Model.VisibilityKind.public_vis; 134 org.omg.mof.Model.DataType pt_integer = _datatype_class.create_data_type( 135 "*long", "", pvis, true, true, false, _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long)); 136 org.omg.mof.Model.DataType pt_long = _datatype_class.create_data_type( 137 "*long long", "", pvis, true, true, false, _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_longlong)); 138 org.omg.mof.Model.DataType pt_float = _datatype_class.create_data_type( 139 "*float", "", pvis, true, true, false, _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_float)); 140 org.omg.mof.Model.DataType pt_double = _datatype_class.create_data_type( 141 "*double", "", pvis, true, true, false, _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_double)); 142 org.omg.mof.Model.DataType pt_boolean = _datatype_class.create_data_type( 143 "*boolean", "", pvis, true, true, false, _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean)); 144 org.omg.mof.Model.DataType pt_string = _datatype_class.create_data_type( 145 "*string", "", pvis, true, true, false, _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string)); 146 147 _types.put("Integer", pt_integer); 148 _types.put("Long", pt_long); 149 _types.put("Float", pt_float); 150 _types.put("Double", pt_double); 151 _types.put("Boolean", pt_boolean); 152 _types.put("String", pt_string); 153 } 154 155 public org.omg.mof.Model.Package[] parse(String _fichier) 157 throws 158 SAXException , 159 ParserConfigurationException , 160 IOException , 161 BadKind , 162 MofError { 163 164 FileInputStream _xml_input_file = new FileInputStream (_fichier); 166 167 return parse(_xml_input_file); 168 } 169 170 public org.omg.mof.Model.Package[] parse(InputStream _xml_input_file) 171 throws 172 SAXException , 173 ParserConfigurationException , 174 IOException , 175 BadKind , 176 MofError { 177 178 logger.log(Level.FINE, "Begin parsing"); 179 Vector packagesV = new Vector (); 181 182 DocumentBuilderFactory _factory = DocumentBuilderFactory.newInstance(); 183 _factory.setIgnoringComments(true); 184 DocumentBuilder _builder = _factory.newDocumentBuilder(); 185 186 Document doc = _builder.parse(_xml_input_file); 188 logger.log(Level.FINE, "Document is valid"); 189 190 Element model = doc.getDocumentElement(); 192 193 delSpaces(model); 195 196 Element xmiContent = null; 198 NodeList modelContents = model.getChildNodes(); 199 for (int i = 0; i < modelContents.getLength(); i++) { 200 Node node = modelContents.item(i); 201 if (node.getNodeType() == Node.ELEMENT_NODE) { 202 Element contentElement = (Element ) node; 203 String currentName = contentElement.getNodeName().trim(); 204 if (currentName.endsWith("XMI.content")) { 205 xmiContent = contentElement; 206 } 207 } 208 } 209 if (xmiContent == null) { 210 logger.log(Level.FATAL, "There is no XMI.content element !"); 211 return null; 212 } 213 214 NodeList contents = xmiContent.getChildNodes(); 216 for (int i = 0; i < contents.getLength(); i++) { 217 Node node = contents.item(i); 218 if (node.getNodeType() == Node.ELEMENT_NODE) { 219 Element element = (Element ) node; 220 String name = element.getNodeName().trim(); 221 222 if (name.toLowerCase().endsWith("package")) { 223 packagesV.addElement(packageTemplate(element, null)); 224 } 225 } 226 } 227 org.omg.mof.Model.Package[] packages = 228 new org.omg.mof.Model.Package[packagesV.size()]; 229 for (int i = 0; i < packages.length; i++) { 230 packages[i] = (org.omg.mof.Model.Package) packagesV.elementAt(i); 231 } 232 logger.log(Level.FINE, packagesV.size() + " Package(s) parsed"); 233 234 typing(); 236 logger.log(Level.FINE, "typing is done"); 237 associationEnds4Reference(); 238 logger.log(Level.FINE, "associationEnds4Reference is done"); 239 putSupertypes(); 240 logger.log(Level.FINE, "putSupertypes is done"); 241 taggedElement(); 242 logger.log(Level.FINE, "taggedElement is done"); 243 importElements(); 244 logger.log(Level.FINE, "ImportElements is done"); 245 exceptions4Operations(); 246 logger.log(Level.FINE, "Exceptions4Operations is done"); 247 248 logger.log(Level.FINE, "Parsing is done"); 249 250 return packages; 251 } 252 253 public org.omg.mof.Model.Package packageTemplate( 255 Element _package_element, 256 Namespace _container) 257 throws BadKind , MofError { 258 org.omg.mof.Model.Package _package = 260 _package_class.create_package( 261 "name", 262 "", 263 VisibilityKind.public_vis, 264 false, 265 false, 266 false); 267 268 String name = getValue(_package_element, "name"); 270 logger.log(Level.FINE, " Package " + name + " parsing"); 271 if (name.compareTo("") != 0) 272 _package.set_name(name); 273 String annotation = getValue(_package_element, "annotation"); 274 if (annotation.compareTo("") != 0) 275 _package.set_annotation(annotation); 276 String visibility = getValue(_package_element, "visibility"); 277 if (visibility.endsWith("protected_vis")) 278 _package.set_visibility(VisibilityKind.protected_vis); 279 else if (visibility.endsWith("private_vis")) 280 _package.set_visibility(VisibilityKind.private_vis); 281 String isAbstract = getValue(_package_element, "isAbstract"); 282 if (isAbstract.endsWith("true")) 283 _package.set_is_abstract(true); 284 String isLeaf = getValue(_package_element, "isLeaf"); 285 if (isLeaf.endsWith("true")) 286 _package.set_is_leaf(true); 287 String isRoot = getValue(_package_element, "isRoot"); 288 if (isRoot.endsWith("true")) 289 _package.set_is_root(true); 290 291 NodeList contents = _package_element.getChildNodes(); 293 for (int i = 0; i < contents.getLength(); i++) { 294 Node node = contents.item(i); 295 if (node.getNodeType() == Node.ELEMENT_NODE) { 296 Element contentElement = (Element ) node; 297 String currentName = contentElement.getNodeName().trim(); 298 if (currentName.endsWith("Namespace.contents")) { 299 NodeList namespaceContents = contentElement.getChildNodes(); 300 for (int j = 0; j < namespaceContents.getLength(); j++) { 301 if (namespaceContents.item(j).getNodeType() 302 == Node.ELEMENT_NODE) { 303 Element _element = 304 (Element ) namespaceContents.item(j); 305 String _element_name = 306 _element.getNodeName().trim(); 307 if (_element_name.endsWith("DataType")) 308 dataTypeTemplate(_element, _package); 309 else if (_element_name.endsWith("PrimitiveType")) 310 primitiveTypeTemplate(_element, _package); 311 else if (_element_name.endsWith("EnumerationType")) 312 enumerationTypeTemplate(_element, _package); 313 else if (_element_name.endsWith("StructureType")) 314 structureTypeTemplate(_element, _package); 315 else if (_element_name.endsWith("AliasType")) 316 aliasTypeTemplate(_element, _package); 317 else if (_element_name.endsWith("CollectionType")) 318 collectionTypeTemplate(_element, _package); 319 else if (_element_name.endsWith("Association")) 320 associationTemplate(_element, _package); 321 else if (_element_name.endsWith("Class")) 322 classTemplate(_element, _package); 323 else if (_element_name.endsWith("Constant")) 324 constantTemplate(_element, _package); 325 else if (_element_name.endsWith("Tag")) 326 tagTemplate(_element, _package); 327 else if (_element_name.endsWith("Exception")) 328 mofExceptionTemplate(_element, _package); 329 else if (_element_name.endsWith("Import")) 330 importTemplate(_element, _package); 331 else if (_element_name.endsWith("Package")) 332 packageTemplate(_element, _package); 333 } 334 } 335 } 336 } 337 } 338 339 String _key = _package_element.getAttribute("xmi.id").trim(); 341 _Id2element.put(_key, _package); 342 343 _package.set_container(_container); 344 if (_container != null) 345 _container.add_contents(_package); 346 return _package; 347 } 348 349 public void classTemplate(Element _class_element, Namespace _container) 351 throws MofError { 352 String _key = _class_element.getAttribute("xmi.id").trim(); 354 355 org.omg.mof.Model.Class _class = 357 _class_class.create_class( 358 "name", 359 "", 360 VisibilityKind.public_vis, 361 false, 362 false, 363 false, 364 false); 365 366 String name = getValue(_class_element, "name"); 368 logger.log(Level.FINE, " Class " + name + " parsing"); 369 if (name.compareTo("") != 0) 370 _class.set_name(name); 371 372 String annotation = getValue(_class_element, "annotation"); 373 if (annotation.compareTo("") != 0) 374 _class.set_annotation(annotation); 375 376 String visibility = getValue(_class_element, "visibility"); 377 if (visibility.endsWith("protected_vis")) 378 _class.set_visibility(VisibilityKind.protected_vis); 379 else if (visibility.endsWith("private_vis")) 380 _class.set_visibility(VisibilityKind.private_vis); 381 382 String isAbstract = getValue(_class_element, "isAbstract"); 383 if (isAbstract.endsWith("true")) 384 _class.set_is_abstract(true); 385 386 String isLeaf = getValue(_class_element, "isLeaf"); 387 if (isLeaf.endsWith("true")) 388 _class.set_is_leaf(true); 389 390 String isRoot = getValue(_class_element, "isRoot"); 391 if (isRoot.endsWith("true")) 392 _class.set_is_root(true); 393 394 String isSingleton = getValue(_class_element, "isSingleton"); 395 if (isSingleton.endsWith("true")) 396 _class.set_is_singleton(true); 397 398 String supertypes = _class_element.getAttribute("supertypes"); 400 if (supertypes.compareTo("") != 0) { 401 Vector supers = new Vector (); 402 StringTokenizer supRefs = new StringTokenizer (supertypes, " "); 403 while (supRefs.hasMoreTokens()) { 404 String part = supRefs.nextToken(); 405 supers.addElement(part); 406 } 407 _elementsToSupertype.put(_class, supers); 408 } 409 410 NodeList contents = _class_element.getChildNodes(); 411 for (int i = 0; i < contents.getLength(); i++) { 412 Node node = contents.item(i); 413 if (node.getNodeType() == Node.ELEMENT_NODE) { 414 Element contentElement = (Element ) node; 415 String currentName = contentElement.getNodeName().trim(); 416 417 if (currentName.endsWith("GeneralizableElement.supertypes")) { 419 Vector supers = new Vector (); 420 NodeList supertypeNodes = contentElement.getChildNodes(); 421 for (int j = 0; j < supertypeNodes.getLength(); j++) { 422 if (supertypeNodes.item(j).getNodeType() 423 == Node.ELEMENT_NODE) { 424 Element element = (Element ) supertypeNodes.item(j); 425 String _element_name = element.getNodeName().trim(); 426 if (_element_name 427 .endsWith("GeneralizableElement")) { 428 String _ref = 429 element.getAttribute("xmi.idref").trim(); 430 supers.addElement(_ref); 431 } 432 } 433 } 434 _elementsToSupertype.put(_class, supers); 435 } else if (currentName.endsWith("Namespace.contents")) { 436 NodeList namespaceContents = contentElement.getChildNodes(); 437 for (int j = 0; j < namespaceContents.getLength(); j++) { 438 if (namespaceContents.item(j).getNodeType() 439 == Node.ELEMENT_NODE) { 440 Element element = 441 (Element ) namespaceContents.item(j); 442 String _element_name = element.getNodeName().trim(); 443 if (_element_name.endsWith("Attribute")) 444 mofAttributeTemplate(element, _class); 445 else if (_element_name.endsWith("Reference")) 446 referenceTemplate(element, _class); 447 else if (_element_name.endsWith("Operation")) 448 operationTemplate(element, _class); 449 else if (_element_name.endsWith("DataType")) 450 dataTypeTemplate(element, _class); 451 else if (_element_name.endsWith("PrimitiveType")) 452 primitiveTypeTemplate(element, _class); 453 else if (_element_name.endsWith("EnumerationType")) 454 enumerationTypeTemplate(element, _class); 455 else if (_element_name.endsWith("StructureType")) 456 structureTypeTemplate(element, _class); 457 else if (_element_name.endsWith("AliasType")) 458 aliasTypeTemplate(element, _class); 459 else if (_element_name.endsWith("CollectionType")) 460 collectionTypeTemplate(element, _class); 461 else if (_element_name.endsWith("Exception")) 462 mofExceptionTemplate(element, _class); 463 else if (_element_name.endsWith("Constant")) 464 constantTemplate(element, _class); 465 } 466 } 467 468 } 469 } 470 } 471 _class.set_container(_container); 473 _container.add_contents(_class); 474 475 _types.put(_key, _class); 477 _Id2element.put(_key, _class); 478 } 479 480 public void mofAttributeTemplate( 482 Element _attribute_element, 483 org.omg.mof.Model.Class _class) 484 throws MofError { 485 MofAttribute _attribute = 487 _attribute_class.create_mof_attribute( 488 "name", 489 "", 490 VisibilityKind.public_vis, 491 ScopeKind.instance_level, 492 new MultiplicityType(0, 1, false, false), 493 true, 494 false); 495 496 String name = getValue(_attribute_element, "name"); 498 if (name.compareTo("") != 0) 499 _attribute.set_name(name); 500 501 String annotation = getValue(_attribute_element, "annotation"); 502 if (annotation.compareTo("") != 0) 503 _attribute.set_annotation(annotation); 504 505 String visibility = getValue(_attribute_element, "visibility"); 506 if (visibility.endsWith("protected_vis")) 507 _attribute.set_visibility(VisibilityKind.protected_vis); 508 else if (visibility.endsWith("private_vis")) 509 _attribute.set_visibility(VisibilityKind.private_vis); 510 511 String scope = getValue(_attribute_element, "scope"); 512 if (scope.endsWith("classifier_level")) 513 _attribute.set_scope(ScopeKind.classifier_level); 514 515 String isDerived = getValue(_attribute_element, "isDerived"); 516 if (isDerived.endsWith("true")) 517 _attribute.set_is_derived(true); 518 519 String changeable = getValue(_attribute_element, "isChangeable"); 520 if (changeable.endsWith("false")) 521 _attribute.set_is_changeable(false); 522 523 _attribute.set_multiplicity(getMultiplicity(_attribute_element)); 525 526 _elementsToType.put(_attribute, getType(_attribute_element)); 528 529 _attribute.set_container(_class); 530 _class.add_contents(_attribute); 531 } 532 533 public void referenceTemplate( 535 Element _reference_element, 536 org.omg.mof.Model.Class _class) 537 throws MofError { 538 Reference _reference = 540 _reference_class.create_reference( 541 "name", 542 "", 543 VisibilityKind.public_vis, 544 ScopeKind.instance_level, 545 new MultiplicityType(0, 1, false, false), 546 true); 547 548 String name = getValue(_reference_element, "name"); 550 if (name.compareTo("") != 0) 551 _reference.set_name(name); 552 553 String annotation = getValue(_reference_element, "annotation"); 554 if (annotation.compareTo("") != 0) 555 _reference.set_annotation(annotation); 556 557 String visibility = getValue(_reference_element, "visibility"); 558 if (visibility.endsWith("protected_vis")) 559 _reference.set_visibility(VisibilityKind.protected_vis); 560 else if (visibility.endsWith("private_vis")) 561 _reference.set_visibility(VisibilityKind.private_vis); 562 563 String scope = getValue(_reference_element, "scope"); 564 if (scope.endsWith("classifier_level")) 565 _reference.set_scope(ScopeKind.classifier_level); 566 567 String changeable = getValue(_reference_element, "isChangeable"); 568 if (changeable.endsWith("false")) 569 _reference.set_is_changeable(false); 570 571 _reference.set_multiplicity(getMultiplicity(_reference_element)); 573 574 _elementsToType.put(_reference, getType(_reference_element)); 576 577 _referencedEndTable.put( 579 _reference, 580 getReferencedEnd(_reference_element)); 581 582 _reference.set_container(_class); 583 _class.add_contents(_reference); 584 } 585 586 public void operationTemplate( 588 Element _operation_element, 589 org.omg.mof.Model.Class _class) 590 throws MofError { 591 592 Operation _operation = 594 _operation_class.create_operation( 595 "name", 596 "", 597 VisibilityKind.public_vis, 598 ScopeKind.instance_level, 599 true); 600 601 String name = getValue(_operation_element, "name"); 603 if (name.compareTo("") != 0) 604 _operation.set_name(name); 605 606 String annotation = getValue(_operation_element, "annotation"); 607 if (annotation.compareTo("") != 0) 608 _operation.set_annotation(annotation); 609 610 String visibility = getValue(_operation_element, "visibility"); 611 if (visibility.endsWith("protected_vis")) 612 _operation.set_visibility(VisibilityKind.protected_vis); 613 else if (visibility.endsWith("private_vis")) 614 _operation.set_visibility(VisibilityKind.private_vis); 615 616 String scope = getValue(_operation_element, "scope"); 617 if (scope.endsWith("classifier_level")) 618 _operation.set_scope(ScopeKind.classifier_level); 619 620 String isQuery = getValue(_operation_element, "isQuery"); 621 if (isQuery.endsWith("true")) 622 _operation.set_is_query(true); 623 624 NodeList list = _operation_element.getChildNodes(); 626 for (int i = 0; i < list.getLength(); i++) { 627 Node node = list.item(i); 628 if (node.getNodeType() == Node.ELEMENT_NODE) { 629 Element exceptionsBloc = (Element ) node; 630 String currentName = exceptionsBloc.getNodeName().trim(); 631 if (currentName.endsWith("Operation.exceptions")) { 632 Vector listExceptions = new Vector (); 633 NodeList exceptionsList = exceptionsBloc.getChildNodes(); 634 for (int j = 0; j < exceptionsList.getLength(); j++) { 635 if (exceptionsList.item(j).getNodeType() 636 == Node.ELEMENT_NODE) { 637 Element _element = (Element ) exceptionsList.item(i); 638 String _element_name = 639 _element.getNodeName().trim(); 640 if (_element_name.endsWith("Exception")) { 641 String ref = _element.getAttribute("xmi.idref"); 642 listExceptions.addElement(ref); 643 } 644 } 645 } 646 _Exception4Operations.put(_operation, listExceptions); 647 } 648 } 649 } 650 651 NodeList contents = _operation_element.getChildNodes(); 653 for (int i = 0; i < contents.getLength(); i++) { 654 Node node = contents.item(i); 655 if (node.getNodeType() == Node.ELEMENT_NODE) { 656 Element contentElement = (Element ) node; 657 String currentName = contentElement.getNodeName().trim(); 658 if (currentName.endsWith("Namespace.contents")) { 659 NodeList namespaceContents = contentElement.getChildNodes(); 660 for (int j = 0; j < namespaceContents.getLength(); j++) { 661 if (namespaceContents.item(j).getNodeType() 662 == Node.ELEMENT_NODE) { 663 664 Element _element = 665 (Element ) namespaceContents.item(j); 666 String _element_name = 667 _element.getNodeName().trim(); 668 669 if (_element_name.endsWith("Parameter")) 670 parameterTemplate(_element, _operation); 671 } 672 } 673 } 674 } 675 } 676 _operation.set_container(_class); 677 _class.add_contents(_operation); 678 } 679 680 public void parameterTemplate( 682 Element _parameter_element, 683 Namespace _container) 684 throws MofError { 685 Parameter _parameter = 687 _parameter_class.create_parameter( 688 "name", 689 "", 690 new MultiplicityType(1, 1, false, false), 691 DirectionKind.in_dir); 692 693 String name = getValue(_parameter_element, "name"); 695 if (name.compareTo("") != 0) 696 _parameter.set_name(name); 697 698 String annotation = getValue(_parameter_element, "annotation"); 699 if (annotation.compareTo("") != 0) 700 _parameter.set_annotation(annotation); 701 702 String direction = getValue(_parameter_element, "direction"); 703 if (direction.endsWith("out_dir")) 704 _parameter.set_direction(DirectionKind.out_dir); 705 else if (direction.endsWith("inout_dir")) 706 _parameter.set_direction(DirectionKind.inout_dir); 707 else if (direction.endsWith("return_dir")) 708 _parameter.set_direction(DirectionKind.return_dir); 709 710 _parameter.set_multiplicity(getMultiplicity(_parameter_element)); 712 713 _elementsToType.put(_parameter, getType(_parameter_element)); 715 716 _container.add_contents(_parameter); 717 _parameter.set_container(_container); 718 } 719 720 public void mofExceptionTemplate( 722 Element _exception_element, 723 Namespace _container) 724 throws MofError { 725 MofException _exception = 727 _exception_class.create_mof_exception( 728 "name", 729 "", 730 VisibilityKind.public_vis, 731 ScopeKind.instance_level); 732 733 String name = getValue(_exception_element, "name"); 735 if (name.compareTo("") != 0) 736 _exception.set_name(name); 737 738 String annotation = getValue(_exception_element, "annotation"); 739 if (annotation.compareTo("") != 0) 740 _exception.set_annotation(annotation); 741 742 String visibility = getValue(_exception_element, "visibility"); 743 if (visibility.endsWith("protected_vis")) 744 _exception.set_visibility(VisibilityKind.protected_vis); 745 else if (visibility.endsWith("private_vis")) 746 _exception.set_visibility(VisibilityKind.private_vis); 747 748 String scope = getValue(_exception_element, "scope"); 749 if (scope.endsWith("classifier_level")) 750 _exception.set_scope(ScopeKind.classifier_level); 751 752 NodeList contents = _exception_element.getChildNodes(); 754 for (int i = 0; i < contents.getLength(); i++) { 755 Node node = contents.item(i); 756 if (node.getNodeType() == Node.ELEMENT_NODE) { 757 Element contentElement = (Element ) node; 758 String currentName = contentElement.getNodeName().trim(); 759 if (currentName.endsWith("Namespace.contents")) { 760 NodeList namespaceContents = contentElement.getChildNodes(); 761 for (int j = 0; j < namespaceContents.getLength(); j++) { 762 if (namespaceContents.item(j).getNodeType() 763 == Node.ELEMENT_NODE) { 764 765 Element _element = 766 (Element ) namespaceContents.item(j); 767 String _element_name = 768 _element.getNodeName().trim(); 769 770 if (_element_name.endsWith("Parameter")) 771 parameterTemplate(_element, _exception); 772 } 773 } 774 } 775 } 776 } 777 778 String _key = _exception_element.getAttribute("xmi.id").trim(); 780 _Id2exception.put(_key, _exception); 781 782 _container.add_contents(_exception); 783 _exception.set_container(_container); 784 } 785 786 public void associationTemplate( 788 Element _association_element, 789 Namespace _container) 790 throws MofError { 791 792 Association _association = 794 _association_class.create_association( 795 "name", 796 "", 797 VisibilityKind.public_vis, 798 false, 799 false, 800 false, 801 false); 802 803 String name = getValue(_association_element, "name"); 805 if (name.compareTo("") != 0) 806 _association.set_name(name); 807 808 String annotation = getValue(_association_element, "annotation"); 809 if (annotation.compareTo("") != 0) 810 _association.set_annotation(annotation); 811 812 String visibility = getValue(_association_element, "visibility"); 813 if (visibility.endsWith("protected_vis")) 814 _association.set_visibility(VisibilityKind.protected_vis); 815 else if (visibility.endsWith("private_vis")) 816 _association.set_visibility(VisibilityKind.private_vis); 817 818 String isAbstract = getValue(_association_element, "isAbstract"); 819 if (isAbstract.endsWith("true")) 820 _association.set_is_abstract(true); 821 822 String isLeaf = getValue(_association_element, "isLeaf"); 823 if (isLeaf.endsWith("true")) 824 _association.set_is_leaf(true); 825 826 String isRoot = getValue(_association_element, "isRoot"); 827 if (isRoot.endsWith("true")) 828 _association.set_is_root(true); 829 830 String isDerived = getValue(_association_element, "isDerived"); 831 if (isRoot.endsWith("true")) 832 _association.set_is_root(true); 833 834 String [] _ends = new String [2]; 837 int k = 0; 838 NodeList contents = _association_element.getChildNodes(); 839 for (int i = 0; i < contents.getLength(); i++) { 840 Node node = contents.item(i); 841 if (node.getNodeType() == Node.ELEMENT_NODE) { 842 Element contentElement = (Element ) node; 843 String currentName = contentElement.getNodeName().trim(); 844 if (currentName.endsWith("Namespace.contents")) { 845 NodeList namespaceContents = contentElement.getChildNodes(); 846 for (int j = 0; j < namespaceContents.getLength(); j++) { 847 if (namespaceContents.item(j).getNodeType() 848 == Node.ELEMENT_NODE) { 849 Element element = 850 (Element ) namespaceContents.item(j); 851 String _element_name = element.getNodeName().trim(); 852 if (_element_name.endsWith("AssociationEnd")) { 853 associationEndTemplate(element, _association); 854 _ends[k] = 855 element.getAttribute("xmi.id").trim(); 856 k++; 857 } 858 } 859 } 860 } 861 } 862 } 863 864 _association.set_container(_container); 866 _container.add_contents(_association); 867 868 _OtherEnd.put(_ends[0], _ends[1]); 870 _OtherEnd.put(_ends[1], _ends[0]); 871 872 String _key = _association_element.getAttribute("xmi.id").trim(); 874 _types.put(_key, _association); 875 } 876 877 public void associationEndTemplate( 879 Element _end_element, 880 Association _association) 881 throws MofError { 882 AssociationEnd _association_end = 884 _association_end_class.create_association_end( 885 "name", 886 "", 887 true, 888 AggregationKind.none, 889 new MultiplicityType(0, 1, false, false), 890 true); 891 892 String name = getValue(_end_element, "name"); 894 if (name.compareTo("") != 0) 895 _association_end.set_name(name); 896 897 String annotation = getValue(_end_element, "annotation"); 898 if (annotation.compareTo("") != 0) 899 _association_end.set_annotation(annotation); 900 901 String aggregation = getValue(_end_element, "aggregation"); 902 if (aggregation.endsWith("shared")) 903 _association_end.set_aggregation(AggregationKind.shared); 904 else if (aggregation.endsWith("composite")) 905 _association_end.set_aggregation(AggregationKind.composite); 906 907 String isChangeable = getValue(_end_element, "isChangeable"); 908 if (isChangeable.endsWith("false")) 909 _association_end.set_is_changeable(false); 910 911 String isNavigable = getValue(_end_element, "isNavigable"); 912 if (isNavigable.endsWith("false")) 913 _association_end.set_is_navigable(false); 914 915 _association_end.set_multiplicity(getMultiplicity(_end_element)); 917 918 _elementsToType.put(_association_end, getType(_end_element)); 920 921 String _key = _end_element.getAttribute("xmi.id").trim(); 923 _Id2End.put(_key, _association_end); 924 925 _association_end.set_container(_association); 927 _association.add_contents(_association_end); 928 } 929 930 933 public org.omg.mof.Model.DataType dataTypeAbstractTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 934 DataType _datatype = 936 _datatype_class.create_data_type( 937 "name", 938 "", 939 VisibilityKind.public_vis, 940 false, 941 false, 942 false, 943 _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any)); 944 945 String name = getValue(_datatype_element, "name"); 947 if (name.compareTo("") != 0) 948 _datatype.set_name(name); 949 950 String annotation = getValue(_datatype_element, "annotation"); 951 if (annotation.compareTo("") != 0) 952 _datatype.set_annotation(annotation); 953 954 String visibility = getValue(_datatype_element, "visibility"); 955 if (visibility.endsWith("protected_vis")) 956 _datatype.set_visibility(VisibilityKind.protected_vis); 957 else if (visibility.endsWith("private_vis")) 958 _datatype.set_visibility(VisibilityKind.private_vis); 959 960 String isAbstract = getValue(_datatype_element, "isAbstract"); 961 if (isAbstract.endsWith("true")) 962 _datatype.set_is_abstract(true); 963 964 String isLeaf = getValue(_datatype_element, "isLeaf"); 965 if (isLeaf.endsWith("true")) 966 _datatype.set_is_leaf(true); 967 968 String isRoot = getValue(_datatype_element, "isRoot"); 969 if (isRoot.endsWith("true")) 970 _datatype.set_is_root(true); 971 972 NodeList contents = _datatype_element.getChildNodes(); 974 for (int i = 0; i < contents.getLength(); i++) { 975 Node node = contents.item(i); 976 if (node.getNodeType() == Node.ELEMENT_NODE) { 977 Element contentElement = (Element ) node; 978 String currentName = contentElement.getNodeName().trim(); 979 if (currentName.endsWith("DataType.typeCode")) { 980 Element typecode = null; 981 NodeList listCorbaTypecode = 982 contentElement.getElementsByTagName( 983 "XMI.CorbaTypeCode"); 984 if (listCorbaTypecode.getLength() != 0) { 985 Element corbaTypecode = 986 (Element ) listCorbaTypecode.item(0); 987 NodeList childrens = corbaTypecode.getChildNodes(); 988 int j = 0; 989 boolean isTypecode = false; 990 while (j < childrens.getLength() && !isTypecode) { 991 Node children = childrens.item(j); 992 if (children.getNodeType() == Node.ELEMENT_NODE) { 993 typecode = (Element ) children; 994 isTypecode = true; 995 } 996 j++; 997 } 998 999 String RepositoryID = getValue(typecode, "xmi.tcId"); 1001 if (RepositoryID == null) 1002 RepositoryID = 1003 "IDL:" + idlHelper.format1(_namespace.name()); 1004 1005 TypeCode _type_code = 1007 xml2TypeCode(typecode, RepositoryID); 1008 _datatype.set_type_code(_type_code); 1009 } 1010 } 1011 } 1012 } 1013 1014 _datatype.set_container(_namespace); 1016 _namespace.add_contents(_datatype); 1017 1018 String _key = _datatype_element.getAttribute("xmi.id").trim(); 1020 _types.put(_key, _datatype); 1021 _Id2element.put(_key, _datatype); 1022 1023 return _datatype; 1024 } 1025 1026 1029 public void dataTypeTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 1030 org.omg.mof.Model.DataType _datatype = dataTypeAbstractTemplate(_datatype_element, _namespace); 1031 _dataTypes.put(_datatype_element.getAttribute("xmi.id"), _datatype.type_code()); 1032 } 1033 1034 1037 public void primitiveTypeTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 1038 if (_datatype_element.hasAttribute("xmi.idref")) 1039 return; 1040 org.omg.mof.Model.DataType _datatype = dataTypeAbstractTemplate(_datatype_element, _namespace); 1041 org.omg.mof.Model.DataType dt = (org.omg.mof.Model.DataType) _types.get(_datatype.name()); 1042 if (dt != null) { 1043 org.omg.CORBA.TypeCode typeCode = dt.type_code(); 1044 _datatype.set_type_code(typeCode); 1045 _dataTypes.put(_datatype_element.getAttribute("xmi.id"), typeCode); 1046 } 1047 } 1048 1049 1050 1051 public void typeElementTypeTemplate (org.w3c.dom.Element _element, org.omg.mof.Model.Namespace _namespace) 1052 throws org.omg.mof.Reflective.MofError { 1053 NodeList namespaceContents = _element.getChildNodes(); 1054 for (int j = 0; j < namespaceContents.getLength(); j++) { 1055 if (namespaceContents.item(j).getNodeType() == Node.ELEMENT_NODE) { 1056 Element subElement = (Element ) namespaceContents.item(j); 1057 String _sub_element_name = subElement.getNodeName().trim(); 1058 if (_sub_element_name.endsWith("Association")) 1059 associationTemplate(subElement, _namespace); 1060 else if (_sub_element_name.endsWith("StructureType")) 1061 structureTypeTemplate(subElement, _namespace); 1062 else if (_sub_element_name.endsWith("CollectionType")) 1063 collectionTypeTemplate(subElement, _namespace); 1064 else if (_sub_element_name.endsWith("AliasType")) 1065 aliasTypeTemplate(subElement, _namespace); 1066 else if (_sub_element_name.endsWith("EnumerationType")) 1067 enumerationTypeTemplate(subElement, _namespace); 1068 else if (_sub_element_name.endsWith("PrimitiveType")) 1069 primitiveTypeTemplate(subElement, _namespace); 1070 else if (_sub_element_name.endsWith("DataType")) 1071 dataTypeTemplate(subElement, _namespace); 1072 } 1073 } 1074 } 1075 1076 1077 1080 public void aliasTypeTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 1081 if (_datatype_element.hasAttribute("xmi.idref")) 1082 return; 1083 org.omg.mof.Model.DataType _datatype = dataTypeAbstractTemplate(_datatype_element, _namespace); 1084 String repID = "IDL:" + this.idlHelper.format1(_namespace.name()) + "/" + _datatype.name() + ":1.0"; 1085 org.w3c.dom.NodeList _contents = _datatype_element.getChildNodes(); 1086 for (int i = 0; i < _contents.getLength(); i++) { 1087 org.w3c.dom.Element _element = (Element ) _contents.item(i); 1088 String _element_name = _element.getNodeName().trim(); 1089 if (_element_name.endsWith("TypedElement.type")) { 1090 String idref = new String (); 1091 if (_element.hasAttribute("xmi.idref")) { 1092 idref = _element.getAttribute("xmi.idref"); 1093 } else { 1094 typeElementTypeTemplate(_element, _namespace); 1095 if (_element.getFirstChild().getNodeType() == Node.ELEMENT_NODE) { 1096 idref = ((org.w3c.dom.Element )_element.getFirstChild()).getAttribute("xmi.id"); 1097 if (idref == null || idref.length() == 0) 1098 idref = ((org.w3c.dom.Element )_element.getFirstChild()).getAttribute("xmi.idref"); 1099 } 1100 } 1101 org.omg.CORBA.TypeCode tc = (org.omg.CORBA.TypeCode ) _dataTypes.get(idref); 1102 if (tc != null) { 1103 org.omg.CORBA.TypeCode _typecode = _orb.create_alias_tc(repID, _datatype.name(), tc); 1104 _datatype.set_type_code(_typecode); 1105 _dataTypes.put(_datatype_element.getAttribute("xmi.id"), _typecode); 1106 } 1107 } 1108 } 1109 } 1110 1111 1114 public void collectionTypeTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 1115 if (_datatype_element.hasAttribute("xmi.idref")) 1116 return; 1117 org.omg.mof.Model.DataType _datatype = dataTypeAbstractTemplate(_datatype_element, _namespace); 1118 String repID = "IDL:" + this.idlHelper.format1(_namespace.name()) + "/" + _datatype.name() + ":1.0"; 1119 org.w3c.dom.NodeList _contents = _datatype_element.getChildNodes(); 1120 for (int i = 0; i < _contents.getLength(); i++) { 1121 org.w3c.dom.Element _element = (Element ) _contents.item(i); 1122 String _element_name = _element.getNodeName().trim(); 1123 if (_element_name.endsWith("TypedElement.type")) { 1124 String idref = new String (); 1125 if (_element.hasAttribute("xmi.idref")) { 1126 idref = _element.getAttribute("xmi.idref"); 1127 } else { 1128 typeElementTypeTemplate(_element, _namespace); 1129 if (_element.getFirstChild().getNodeType() == Node.ELEMENT_NODE) { 1130 idref = ((org.w3c.dom.Element )_element.getFirstChild()).getAttribute("xmi.id"); 1131 if (idref == null || idref.length() == 0) 1132 idref = ((org.w3c.dom.Element )_element.getFirstChild()).getAttribute("xmi.idref"); 1133 } 1134 } 1135 org.omg.CORBA.TypeCode tc = (org.omg.CORBA.TypeCode ) _dataTypes.get(idref); 1136 if (tc != null) { 1137 org.omg.CORBA.TypeCode _typecode = _orb.create_sequence_tc(0, tc); 1138 _datatype.set_type_code(_typecode); 1139 _dataTypes.put(_datatype_element.getAttribute("xmi.id"), _typecode); 1140 } 1141 } 1142 } 1143 } 1144 1145 1148 public void enumerationTypeTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 1149 if (_datatype_element.hasAttribute("xmi.idref")) 1150 return; 1151 org.omg.mof.Model.DataType _datatype = dataTypeAbstractTemplate(_datatype_element, _namespace); 1152 1153 Vector _members = new Vector (); 1154 org.w3c.dom.NodeList _labels = _datatype_element.getChildNodes(); 1155 for (int i = 0; i < _labels.getLength(); i++) { 1156 org.w3c.dom.Element _element = (Element ) _labels.item(i); 1157 String _element_name = _element.getNodeName().trim(); 1158 if (_element_name.endsWith("EnumerationType.labels")) { 1159 _members.addElement(_element.getFirstChild().getNodeValue().trim()); 1160 } 1161 } 1162 String [] _enum_members = new String [_members.size()]; 1163 for (int i = 0; i < _members.size(); i++) 1164 _enum_members[i] = (String ) _members.elementAt(i); 1165 String repID = "IDL:" + this.idlHelper.format1(_namespace.name()) + "/" + _datatype.name() + ":1.0"; 1166 org.omg.CORBA.TypeCode typeCode = _orb.create_enum_tc(repID, _datatype.name(), _enum_members); 1167 _datatype.set_type_code(typeCode); 1168 _dataTypes.put(_datatype_element.getAttribute("xmi.id"), typeCode); 1169 } 1170 1171 1174 public void structureTypeTemplate(org.w3c.dom.Element _datatype_element, org.omg.mof.Model.Namespace _namespace) throws org.omg.mof.Reflective.MofError { 1175 if (_datatype_element.hasAttribute("xmi.idref")) 1176 return; 1177 org.omg.mof.Model.DataType _datatype = dataTypeAbstractTemplate(_datatype_element, _namespace); 1178 org.w3c.dom.NodeList _child = _datatype_element.getChildNodes(); 1179 for (int i = 0; i < _child.getLength(); i++) { 1180 org.w3c.dom.Element _current = (Element ) _child.item(i); 1181 readStructureTypeContents(_namespace, _datatype, _current); 1182 } 1183 } 1184 1185 public void readStructureFieldType(org.omg.CORBA.StructMember _member, org.w3c.dom.Element _type) throws org.omg.mof.Reflective.MofError { 1186 org.w3c.dom.Element classifier = (Element ) _type.getFirstChild(); 1187 org.omg.CORBA.TypeCode _field_typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any); 1188 if (classifier.hasAttribute("xmi.idref")) { 1189 if (_dataTypes.containsKey(classifier.getAttribute("xmi.idref"))) { 1191 _field_typecode = (org.omg.CORBA.TypeCode ) _dataTypes.get(classifier.getAttribute("xmi.idref")); 1192 } 1193 if (_types.containsKey(classifier.getAttribute("xmi.idref"))) { 1194 org.omg.mof.Model.DataType type = (org.omg.mof.Model.DataType) _types.get(classifier.getAttribute("xmi.idref")); 1195 _field_typecode = type.type_code(); 1196 } 1197 } else if (classifier.hasAttribute("href")) { 1198 } 1200 _member.type = _field_typecode; 1201 } 1202 1203 public void readStructureTypeContents(org.omg.mof.Model.Namespace _namespace, org.omg.mof.Model.DataType _datatype, Element element) throws org.omg.mof.Reflective.MofError { 1204 String repID = "IDL:" + idlHelper.format1(_namespace.name()) + "/" + _datatype.name(); 1205 Vector _struct_members = new Vector (); 1206 org.w3c.dom.NodeList _fields = element.getChildNodes(); 1207 for (int i = 0; i < _fields.getLength(); i++) { 1208 org.w3c.dom.Element _element = (Element ) _fields.item(i); 1209 String _element_name = _element.getNodeName().trim(); 1210 if (_element_name.endsWith("StructureField")) { 1211 org.omg.CORBA.StructMember _member = new org.omg.CORBA.StructMember (); 1212 _member.name = _element.getAttribute("name").trim(); 1213 org.w3c.dom.NodeList _types = _element.getChildNodes(); 1214 for (int j = 0; j < _types.getLength(); j++) { 1215 org.w3c.dom.Element _type = (Element ) _types.item(j); 1216 String _type_name = _type.getNodeName().trim(); 1217 if (_type_name.endsWith("TypedElement.type")) { 1218 readStructureFieldType(_member, _type); 1219 } 1220 } 1221 _struct_members.addElement(_member); 1222 } 1223 } 1224 org.omg.CORBA.StructMember [] _members = new org.omg.CORBA.StructMember [_struct_members.size()]; 1225 for (int j = 0; j < _struct_members.size(); j++) 1226 _members[j] = (org.omg.CORBA.StructMember ) _struct_members.elementAt(j); 1227 _datatype.set_type_code(_orb.create_struct_tc(repID + ":1.0", _datatype.name(), _members)); 1228 _dataTypes.put(element.getAttribute("xmi.id"), _datatype.type_code()); 1229 } 1230 1231 1232 public void constantTemplate( 1234 Element _constant_element, 1235 Namespace _namespace) 1236 throws MofError { 1237 1238 Constant _constant = 1240 _constant_class.create_constant("name", "", _orb.create_any()); 1241 String _id = _constant_element.getAttribute("xmi.id").trim(); 1243 1244 String name = getValue(_constant_element, "name"); 1246 if (name.compareTo("") != 0) 1247 _constant.set_name(name); 1248 1249 String annotation = getValue(_constant_element, "annotation"); 1250 if (annotation.compareTo("") != 0) 1251 _constant.set_annotation(annotation); 1252 1253 _elementsToType.put(_constant, getType(_constant_element)); 1255 1256 NodeList contents = _constant_element.getChildNodes(); 1258 for (int i = 0; i < contents.getLength(); i++) { 1259 Node node = contents.item(i); 1260 if (node.getNodeType() == Node.ELEMENT_NODE) { 1261 Element contentElement = (Element ) node; 1262 String currentName = contentElement.getNodeName().trim(); 1263 if (currentName.endsWith("Constant.value")) { 1264 NodeList elements = contentElement.getChildNodes(); 1265 for (int j = 0; j < elements.getLength(); j++) { 1266 if (elements.item(j).getNodeType() 1267 == Node.ELEMENT_NODE) { 1268 Element element = (Element ) elements.item(j); 1269 String _element_name = element.getNodeName().trim(); 1270 if (_element_name.endsWith("XMI.any")) { 1271 String value = 1272 element.getFirstChild().getNodeValue(); 1273 _constantValue.put(_constant, value); 1274 } 1275 } 1276 } 1277 } 1278 } 1279 } 1280 _constant.set_container(_namespace); 1281 _namespace.add_contents(_constant); 1282 } 1283 1284 public void tagTemplate(Element _tag_element, Namespace _namespace) 1286 throws MofError { 1287 1288 org.omg.CORBA.Any [] _any_t = new org.omg.CORBA.Any [1]; 1290 org.omg.CORBA.Any _mof_tag = _orb.create_any(); 1291 _mof_tag.insert_string(""); 1292 _any_t[0] = _mof_tag; 1293 Tag _tag = _tag_class.create_tag("name", "", "", _any_t); 1294 1295 String name = getValue(_tag_element, "name"); 1297 if (name.compareTo("") != 0) 1298 _tag.set_name(name); 1299 1300 String annotation = getValue(_tag_element, "annotation"); 1301 if (annotation.compareTo("") != 0) 1302 _tag.set_annotation(annotation); 1303 1304 String tagId = getValue(_tag_element, "tagId"); 1305 _tag.set_tag_id(tagId); 1306 1307 String taggedeElements = _tag_element.getAttribute("elements"); 1309 if (taggedeElements.compareTo("") != 0) { 1310 Vector _tagged_elements = new Vector (); 1311 StringTokenizer supRefs = 1312 new StringTokenizer (taggedeElements, " "); 1313 while (supRefs.hasMoreTokens()) { 1314 String part = supRefs.nextToken(); 1315 _tagged_elements.addElement(part); 1316 } 1317 _tags.put(_tag, _tagged_elements); 1318 } 1319 1320 NodeList children = _tag_element.getChildNodes(); 1322 for (int i = 0; i < children.getLength(); i++) { 1323 Element currentElement = (Element ) children.item(i); 1324 String childrenName = currentElement.getNodeName().trim(); 1325 if (childrenName.endsWith("Tag.values")) { 1326 NodeList anylist = 1327 currentElement.getElementsByTagName("XMI.any"); 1328 if (anylist.getLength() != 0) { 1329 Element anyElement = (Element ) anylist.item(0); 1330 String type = anyElement.getAttribute("xmi.type").trim(); 1331 if (type.endsWith("string")) { 1332 org.omg.CORBA.Any [] any_tc = new org.omg.CORBA.Any [1]; 1333 org.omg.CORBA.Any mof_tag_c = _orb.create_any(); 1334 1335 NodeList temp = anyElement.getChildNodes(); 1336 for (int j = 0; j < temp.getLength(); j++) { 1337 Node current = temp.item(j); 1338 if (current.getNodeType() == Node.TEXT_NODE) { 1339 String tagValue = current.getNodeValue().trim(); 1340 mof_tag_c.insert_string(tagValue); 1341 any_tc[0] = mof_tag_c; 1342 _tag.set_values(any_tc); 1343 } 1344 } 1345 } 1346 } 1347 } else 1348 if (childrenName.endsWith("elements")) { 1350 Vector _tagged_elements = new Vector (); 1351 NodeList elements = currentElement.getChildNodes(); 1352 for (int j = 0; j < elements.getLength(); j++) { 1353 Node node = elements.item(j); 1354 if (node.getNodeType() == Node.ELEMENT_NODE) { 1355 Element contentElement = (Element ) node; 1356 String currentName = 1357 contentElement.getNodeName().trim(); 1358 if (currentName.endsWith("ModelElement")) { 1359 String _key_element = 1360 contentElement 1361 .getAttribute("xmi.idref") 1362 .trim(); 1363 _tagged_elements.addElement(_key_element); 1364 1365 } 1366 } 1367 } 1368 _tags.put(_tag, _tagged_elements); 1369 } 1370 } 1371 1372 _tag.set_container(_namespace); 1373 _namespace.add_contents(_tag); 1374 } 1375 1376 1380 public void importTemplate(Element _import_element, Namespace _container) 1381 throws MofError { 1382 1383 org.omg.mof.Model.Import _import = 1385 _import_class.create_import( 1386 "name", 1387 "", 1388 VisibilityKind.public_vis, 1389 false); 1390 1391 String _key = _import_element.getAttribute("xmi.id").trim(); 1393 1394 String name = getValue(_import_element, "name"); 1396 if (name.compareTo("") != 0) 1397 _import.set_name(name); 1398 1399 String annotation = getValue(_import_element, "annotation"); 1400 if (annotation.compareTo("") != 0) 1401 _import.set_annotation(annotation); 1402 1403 String visibility = getValue(_import_element, "visibility"); 1404 if (visibility.endsWith("protected_vis")) 1405 _import.set_visibility(VisibilityKind.protected_vis); 1406 else if (visibility.endsWith("private_vis")) 1407 _import.set_visibility(VisibilityKind.private_vis); 1408 1409 String isClustered = getValue(_import_element, "isClustered"); 1410 if (isClustered.endsWith("true")) 1411 _import.set_is_clustered(true); 1412 1413 String refImported = _import_element.getAttribute("importedNamespace"); 1415 if (refImported.compareTo("") != 0) 1416 _Import2Imported.put(_import, refImported); 1417 1418 NodeList contents = _import_element.getChildNodes(); 1420 for (int i = 0; i < contents.getLength(); i++) { 1421 Node node = contents.item(i); 1422 if (node.getNodeType() == Node.ELEMENT_NODE) { 1423 Element contentElement = (Element ) node; 1424 String currentName = contentElement.getNodeName().trim(); 1425 if (currentName.endsWith("Import.importedNamespace")) { 1426 NodeList elements = contentElement.getChildNodes(); 1427 for (int j = 0; j < elements.getLength(); j++) { 1428 if (elements.item(j).getNodeType() 1429 == Node.ELEMENT_NODE) { 1430 Element element = (Element ) elements.item(j); 1431 String _element_name = element.getNodeName().trim(); 1432 if (_element_name.endsWith("Namespace")) { 1433 1434 String ref = element.getAttribute("xmi.idref"); 1435 _Import2Imported.put(_import, ref); 1437 } 1438 } 1439 } 1440 } 1441 } 1442 } 1443 1444 _import.set_container(_container); 1446 _container.add_contents(_import); 1447 1448 } 1449 1450 public org.omg.CORBA.TypeCode xml2TypeCode( 1452 Element _element, 1453 String RepositoryID) 1454 throws org.omg.CORBA.BAD_TYPECODE { 1455 String _element_name = _element.getNodeName().trim(); 1456 org.omg.CORBA.TypeCode _typecode = null; 1457 if (_element_name.startsWith("XMI.CorbaTcBoolean")) 1458 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_boolean); 1459 else if (_element_name.startsWith("XMI.CorbaTcOctet")) 1460 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_octet); 1461 else if (_element_name.startsWith("XMI.CorbaTcChar")) 1462 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_char); 1463 else if (_element_name.startsWith("XMI.CorbaTcWchar")) 1464 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_wchar); 1465 else if (_element_name.startsWith("XMI.CorbaTcShort")) 1466 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_short); 1467 else if (_element_name.startsWith("XMI.CorbaTcUshort")) 1468 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ushort); 1469 else if (_element_name.startsWith("XMI.CorbaTcLong")) 1470 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_long); 1471 else if (_element_name.startsWith("XMI.CorbaTcUlong")) 1472 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong); 1473 else if (_element_name.startsWith("XMI.CorbaTcLongLong")) 1474 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_longlong); 1475 else if (_element_name.startsWith("XMI.CorbaTcULongLong")) 1476 _typecode = 1477 _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulonglong); 1478 else if (_element_name.startsWith("XMI.CorbaTcDouble")) 1479 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_double); 1480 else if (_element_name.startsWith("XMI.CorbaTcFloat")) 1481 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_float); 1482 else if (_element_name.startsWith("XMI.CorbaTcTypeCode")) 1483 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_TypeCode); 1484 else if (_element_name.startsWith("XMI.CorbaTcAny")) 1485 _typecode = _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_any); 1486 else if (_element_name.startsWith("XMI.CorbaTcString")) { 1487 String _bound_value = _element.getAttribute("xmi.tcLength").trim(); 1488 if (_bound_value.compareTo("") == 0) 1489 _typecode = 1490 _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string); 1491 else { 1492 int _bound = Integer.parseInt(_bound_value); 1493 _typecode = _orb.create_string_tc(_bound); 1494 } 1495 } else if (_element_name.startsWith("XMI.CorbaTcWstring")) { 1496 String _bound_value = _element.getAttribute("xmi.tcLength").trim(); 1497 if (_bound_value.compareTo("") != 0) 1498 _typecode = 1499 _orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_string); 1500 else { 1501 int _bound = Integer.parseInt(_bound_value); 1502 _typecode = _orb.create_string_tc(_bound); 1503 } 1504 } else if (_element_name.startsWith("XMI.CorbaTcStruct")) { 1505 1506 String _name = _element.getAttribute("xmi.tcName").trim(); 1508 String RepID = RepositoryID + "/" + _name + ":1.0"; 1509 1510 NodeList _fields = _element.getChildNodes(); 1512 Vector _struct_members = new Vector (); 1513 for (int i = 0; i < _fields.getLength(); i++) { 1514 Element _field = (Element ) _fields.item(i); 1515 String _tag = _field.getNodeName(); 1516 if (_tag.endsWith("CorbaTcField")) { 1517 Element _type_field = 1518 (Element ) _field.getElementsByTagName( 1519 "XMI.CorbaTypeCode").item( 1520 0); 1521 org.omg.CORBA.StructMember _member = 1523 new org.omg.CORBA.StructMember (); 1524 String _field_name = 1526 _field.getAttribute("xmi.tcName").trim(); 1527 _member.name = _field_name; 1528 Element _type_element = 1530 (Element ) _field.getElementsByTagName( 1531 "XMI.CorbaTypeCode").item( 1532 0); 1533 Element _typecode_element = 1534 (Element ) _type_element.getFirstChild(); 1535 org.omg.CORBA.TypeCode _field_typecode = 1536 xml2TypeCode( 1537 _typecode_element, 1538 RepID.substring(0, RepID.lastIndexOf(":"))); 1539 _member.type = _field_typecode; 1540 _struct_members.addElement(_member); 1542 } 1543 } org.omg.CORBA.StructMember [] _members = 1545 new org.omg.CORBA.StructMember [_struct_members.size()]; 1546 for (int j = 0; j < _struct_members.size(); j++) 1547 _members[j] = 1548 (org.omg.CORBA.StructMember ) _struct_members.elementAt(j); 1549 _typecode = _orb.create_struct_tc(RepID, _name, _members); 1550 } else if (_element_name.startsWith("XMI.CorbaTcSequence")) { 1551 String _bound_value = _element.getAttribute("xmi.tcLength").trim(); 1553 int _bound = 0; 1554 if (_bound_value.compareTo("") != 0) 1555 _bound = Integer.parseInt(_bound_value); 1556 Element _type_code = 1558 (Element ) _element.getElementsByTagName( 1559 "XMI.CorbaTypeCode").item( 1560 0); 1561 Element _sequence_element = (Element ) _type_code.getFirstChild(); 1562 org.omg.CORBA.TypeCode _sequence_type = 1564 xml2TypeCode(_sequence_element, ""); 1565 _typecode = _orb.create_sequence_tc(_bound, _sequence_type); 1566 } else if (_element_name.startsWith("XMI.CorbaTcEnum")) { 1567 1568 String _name = _element.getAttribute("xmi.tcName").trim(); 1570 String RepID = RepositoryID + "/" + _name + ":1.0"; 1571 Vector members = new Vector (); 1573 NodeList enumLabel = 1574 _element.getElementsByTagName("XMI.CorbaTcEnumLabel"); 1575 for (int j = 0; j < enumLabel.getLength(); j++) { 1576 Element memeber = (Element ) enumLabel.item(j); 1577 String value = memeber.getAttribute("xmi.tcName").trim(); 1578 members.addElement(value); 1579 } 1580 String [] enumMembers = new String [members.size()]; 1581 for (int i = 0; i < members.size(); i++) 1582 enumMembers[i] = (String ) members.elementAt(i); 1583 _typecode = _orb.create_enum_tc(RepID, _name, enumMembers); 1584 } else if (_element_name.startsWith("XMI.CorbaTcAlias")) { 1585 String _name = _element.getAttribute("xmi.tcName").trim(); 1587 String RepID = RepositoryID + "/" + _name + ":1.0"; 1588 Element _type_code = 1590 (Element ) _element.getElementsByTagName( 1591 "XMI.CorbaTypeCode").item( 1592 0); 1593 Element _alias_element = (Element ) _type_code.getFirstChild(); 1594 org.omg.CORBA.TypeCode _original_type = 1596 xml2TypeCode( 1597 _alias_element, 1598 RepID.substring(0, RepID.lastIndexOf(":"))); 1599 _typecode = _orb.create_alias_tc(RepID, _name, _original_type); 1600 } 1601 return _typecode; 1602 } 1603 1604 public void typing() throws BadKind , MofError { 1606 Enumeration _keys = _elementsToType.keys(); 1607 while (_keys.hasMoreElements()) { 1608 TypedElement _typed_element = (TypedElement) _keys.nextElement(); 1609 1610 String _key = ((String ) _elementsToType.get(_typed_element)).trim(); 1612 1613 Classifier _classifier = (Classifier) _types.get(_key); 1615 1616 _typed_element.set_type(_classifier); 1618 1619 if (_typed_element._is_a(ConstantHelper.id())) { 1621 Constant _constant = ConstantHelper.narrow(_typed_element); 1622 String _value = (String ) _constantValue.get(_constant); 1623 putConstantValue(_constant, _value); 1624 1625 } 1626 } 1627 } 1628 1629 public void putConstantValue(Constant _constant, String _value) 1631 throws BadKind , MofError { 1632 1633 Classifier _classifier = _constant.type(); 1634 1635 if (_classifier._is_a(DataTypeHelper.id())) { 1636 DataType _datatype = DataTypeHelper.narrow(_classifier); 1637 org.omg.CORBA.TypeCode _typecode = _datatype.type_code(); 1638 org.omg.CORBA.Any _any = _orb.create_any(); 1639 switch (_typecode.kind().value()) { 1640 case org.omg.CORBA.TCKind._tk_boolean : 1641 _any.insert_boolean(Boolean.valueOf(_value).booleanValue()); 1642 break; 1643 case org.omg.CORBA.TCKind._tk_octet : 1644 1645 _any.insert_octet(Byte.valueOf(_value).byteValue()); 1646 break; 1647 case org.omg.CORBA.TCKind._tk_char : 1648 _any.insert_char(_value.charAt(0)); 1649 break; 1650 case org.omg.CORBA.TCKind._tk_wchar : 1651 _any.insert_wchar(_value.charAt(0)); 1652 break; 1653 1654 case org.omg.CORBA.TCKind._tk_short : 1655 _any.insert_short(Short.valueOf(_value).shortValue()); 1656 break; 1657 1658 case org.omg.CORBA.TCKind._tk_ushort : 1659 _any.insert_ushort(Short.valueOf(_value).shortValue()); 1660 break; 1661 1662 case org.omg.CORBA.TCKind._tk_long : 1663 _any.insert_long(Integer.valueOf(_value).intValue()); 1664 break; 1665 1666 case org.omg.CORBA.TCKind._tk_ulong : 1667 _any.insert_ulong(Integer.valueOf(_value).intValue()); 1668 break; 1669 1670 case org.omg.CORBA.TCKind._tk_longlong : 1671 _any.insert_longlong(Long.valueOf(_value).longValue()); 1672 break; 1673 1674 case org.omg.CORBA.TCKind._tk_ulonglong : 1675 _any.insert_ulonglong(Long.valueOf(_value).longValue()); 1676 break; 1677 1678 case org.omg.CORBA.TCKind._tk_double : 1679 _any.insert_double(Double.valueOf(_value).doubleValue()); 1680 break; 1681 1682 case org.omg.CORBA.TCKind._tk_float : 1683 _any.insert_float(Float.valueOf(_value).floatValue()); 1684 break; 1685 1686 case org.omg.CORBA.TCKind._tk_string : 1687 _any.insert_string(_value.trim()); 1688 break; 1689 1690 case org.omg.CORBA.TCKind._tk_wstring : 1691 _any.insert_wstring(_value.trim()); 1692 break; 1693 1694 default : 1695 throw new BadKind (); 1696 } 1697 _constant.set_value(_any); 1698 } 1699 } 1700 1701 1704 private void putSupertypes() throws MofError { 1705 Enumeration _keys = _elementsToSupertype.keys(); 1706 while (_keys.hasMoreElements()) { 1707 org.omg.mof.Model.Class _class = 1708 (org.omg.mof.Model.Class) _keys.nextElement(); 1709 Vector _supertypes = ((Vector ) _elementsToSupertype.get(_class)); 1711 for (int i = 0; i < _supertypes.size(); i++) { 1712 String _key = ((String ) _supertypes.elementAt(i)).trim(); 1713 org.omg.mof.Model.Class _super = 1714 (org.omg.mof.Model.Class) _types.get(_key); 1715 _class.add_supertypes(_super); 1716 } 1717 } 1718 } 1719 1720 1723 public void taggedElement() throws MofError { 1724 Enumeration _keys = _tags.keys(); 1725 while (_keys.hasMoreElements()) { 1726 Tag _tag = (Tag) _keys.nextElement(); 1727 Vector _tagged_elements = (Vector ) _tags.get(_tag); 1729 for (int i = 0; i < _tagged_elements.size(); i++) { 1730 String _key = ((String ) _tagged_elements.elementAt(i)).trim(); 1731 ModelElement _element = (ModelElement) _Id2element.get(_key); 1732 _tag.add_elements(_element); 1733 } 1734 } 1735 } 1736 1737 1740 public void associationEnds4Reference() throws MofError { 1741 Enumeration _keys = _referencedEndTable.keys(); 1742 1743 while (_keys.hasMoreElements()) { 1744 Reference _reference = (Reference) _keys.nextElement(); 1745 String _refend_id = (String ) _referencedEndTable.get(_reference); 1746 AssociationEnd _ref_end = (AssociationEnd) _Id2End.get(_refend_id); 1747 _reference.set_type(_ref_end.type()); 1748 _reference.set_referenced_end(_ref_end); 1749 1750 String _expend_id = (String ) _OtherEnd.get(_refend_id); 1752 AssociationEnd _exp_end = (AssociationEnd) _Id2End.get(_expend_id); 1753 _reference.set_exposed_end(_exp_end); 1754 } 1755 } 1756 1757 1760 public void delSpaces(Node _node) 1761 throws 1762 SAXException , 1763 ParserConfigurationException , 1764 FileNotFoundException , 1765 IOException { 1766 1767 NodeList _fils = _node.getChildNodes(); 1768 int i = 0; 1769 while (i < _fils.getLength()) { 1770 Node _temp = _fils.item(i); 1771 if (_temp.getNodeType() == 3) { 1772 String _temp1 = _temp.getNodeValue(); 1773 if (_temp1.trim().compareTo("") == 0) 1774 _node.removeChild(_temp); 1775 else 1776 i++; 1777 } else { 1778 delSpaces(_temp); 1779 i++; 1780 } 1781 } 1782 } 1783 1784 1787 public void exceptions4Operations() throws MofError { 1788 Enumeration _keys = _Exception4Operations.keys(); 1789 while (_keys.hasMoreElements()) { 1790 Operation _operation = (Operation) _keys.nextElement(); 1791 Vector _exceptions = (Vector ) _Exception4Operations.get(_operation); 1793 for (int i = 0; i < _exceptions.size(); i++) { 1794 String _idException = 1795 ((String ) _exceptions.elementAt(i)).trim(); 1796 MofException _exception = 1797 (MofException) _Id2exception.get(_idException); 1798 _operation.add_exceptions(_exception); 1799 1801 } 1802 } 1803 } 1804 1805 1808 private void importElements() throws MofError { 1809 for (Enumeration keys = _Import2Imported.keys(); 1810 keys.hasMoreElements(); 1811 ) { 1812 org.omg.mof.Model.Import importElement = 1813 (org.omg.mof.Model.Import) keys.nextElement(); 1814 1815 String refOfImported = (String ) _Import2Imported.get(importElement); 1817 1818 Namespace _namespace = (Namespace) _Id2element.get(refOfImported); 1820 1821 importElement.set_imported_namespace(_namespace); 1823 } 1824 } 1825 1826 1830 public void setIdlHelper(IDLCommon idlHelper) { 1831 this.idlHelper = idlHelper; 1832 } 1833 1834 1838 public String getValue(Element elt, String propertyName) { 1839 String res = ""; 1840 res = elt.getAttribute(propertyName); 1842 1843 if ((res == null) || (res.compareTo("") == 0)) { 1845 NodeList children = elt.getChildNodes(); 1846 for (int i = 0; i < children.getLength(); i++) { 1847 Node current = children.item(i); 1848 if (current.getNodeType() == Node.ELEMENT_NODE) { 1849 Element currentElement = (Element ) current; 1850 if (currentElement 1851 .getNodeName() 1852 .toLowerCase() 1853 .endsWith(propertyName.toLowerCase())) { 1854 res = currentElement.getAttribute("xmi.value"); 1855 if ((res == null) || (res.compareTo("") == 0)) { 1856 Node temp = currentElement.getFirstChild(); 1857 if (temp != null) 1858 res = temp.getNodeValue().trim(); 1859 } 1860 } 1861 } 1862 } 1863 } 1864 1865 return res; 1866 } 1867 1868 1871 public String getType(Element elt) { 1872 1873 String type = elt.getAttribute("type"); 1875 if (type.compareTo("") != 0) 1876 return type; 1877 NodeList contents = elt.getChildNodes(); 1879 for (int i = 0; i < contents.getLength(); i++) { 1880 Node node = contents.item(i); 1881 if (node.getNodeType() == Node.ELEMENT_NODE) { 1882 Element contentElement = (Element ) node; 1883 String currentName = contentElement.getNodeName().trim(); 1884 if (currentName.endsWith("TypedElement.type")) { 1885 1886 NodeList children = contentElement.getChildNodes(); 1887 1888 for (int j = 0; j < children.getLength(); j++) { 1889 Node current = children.item(j); 1890 if (current.getNodeType() == Node.ELEMENT_NODE) { 1891 Element currentElement = (Element ) current; 1892 String classifierType = 1893 currentElement.getNodeName().trim(); 1894 1895 if (classifierType.endsWith("Classifier") 1896 || classifierType.endsWith("Class") 1897 || classifierType.endsWith("Association") 1898 || classifierType.endsWith("DataType")) 1899 type = 1900 currentElement 1901 .getAttribute("xmi.idref") 1902 .trim(); 1903 1904 } 1905 } 1906 } 1907 } 1908 } 1909 1910 return type; 1911 } 1912 1913 1916 public String getReferencedEnd(Element elt) { 1917 1918 String ref = elt.getAttribute("referencedEnd").trim(); 1920 if (ref.compareTo("") != 0) 1921 return ref; 1922 1923 NodeList contents = elt.getChildNodes(); 1925 for (int i = 0; i < contents.getLength(); i++) { 1926 Node node = contents.item(i); 1927 if (node.getNodeType() == Node.ELEMENT_NODE) { 1928 Element contentElement = (Element ) node; 1929 String currentName = contentElement.getNodeName().trim(); 1930 if (currentName.endsWith("Reference.referencedEnd")) { 1931 1932 NodeList children = contentElement.getChildNodes(); 1933 1934 for (int j = 0; j < children.getLength(); j++) { 1935 Node current = children.item(j); 1936 if (current.getNodeType() == Node.ELEMENT_NODE) { 1937 Element currentElement = (Element ) current; 1938 String referencedEndName = 1939 currentElement.getNodeName().trim(); 1940 1941 if (referencedEndName.endsWith("AssociationEnd")) 1942 ref = 1943 currentElement 1944 .getAttribute("xmi.idref") 1945 .trim(); 1946 } 1947 } 1948 } 1949 } 1950 } 1951 1952 return ref; 1953 } 1954 1955 1958 public MultiplicityType getMultiplicity(Element elt) { 1959 1960 NodeList contents = elt.getChildNodes(); 1961 for (int i = 0; i < contents.getLength(); i++) { 1962 Node node = contents.item(i); 1963 if (node.getNodeType() == Node.ELEMENT_NODE) { 1964 Element contentElement = (Element ) node; 1965 String currentName = contentElement.getNodeName().trim(); 1966 if (currentName.endsWith("multiplicity")) { 1967 NodeList list = contentElement.getChildNodes(); 1968 for (int j = 0; j < list.getLength(); j++) { 1969 if (list.item(j).getNodeType() == Node.ELEMENT_NODE) { 1970 Element element = (Element ) list.item(j); 1971 String _element_name = element.getNodeName().trim(); 1972 1973 if (_element_name.endsWith("MultiplicityType")) 1975 return new MultiplicityType( 1976 Integer.parseInt( 1977 element.getAttribute("lower").trim()), 1978 Integer.parseInt( 1979 element.getAttribute("upper").trim()), 1980 Boolean.getBoolean( 1981 element 1982 .getAttribute("is_ordered") 1983 .trim()), 1984 Boolean.getBoolean( 1985 element 1986 .getAttribute("is_unique") 1987 .trim())); 1988 1989 boolean is_unique = false, is_ordered = false; 1991 int lower = 0, upper = -1; 1992 NodeList properties = 1993 contentElement.getChildNodes(); 1994 for (int k = 0; k < properties.getLength(); k++) { 1995 if (properties.item(k).getNodeType() 1996 == Node.ELEMENT_NODE) { 1997 Element item = (Element ) properties.item(k); 1998 String value = 1999 item 2000 .getFirstChild() 2001 .getNodeValue() 2002 .trim(); 2003 if (k == 0) { 2004 lower = Integer.parseInt(value); 2005 } else if (k == 1) { 2006 upper = Integer.parseInt(value); 2007 } else if (k == 2) { 2008 if (value.endsWith("true")) 2009 is_ordered = true; 2010 } else if (k == 3) { 2011 if (value.endsWith("true")) 2012 is_unique = true; 2013 } 2014 } 2015 } 2016 return new MultiplicityType( 2017 lower, 2018 upper, 2019 is_ordered, 2020 is_unique); 2021 } 2022 } 2023 } 2024 } 2025 } 2026 return null; 2027 } 2028 2029 2033 public void setLogger(ModFactLogger logger) { 2034 this.logger = logger; 2035 } 2036 2037} | Popular Tags |