summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2005-01-14 10:24:02 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2005-01-14 10:24:02 +0000
commitc61f399b1d3c471a8e459a4a2be645f95560f088 (patch)
tree14e7f5759d2cded647d22e019435a770b8ed69e5
parent451c55a31fbc6b949f7609dd90932bb2a0d91a19 (diff)
downloadclasspath-c61f399b1d3c471a8e459a4a2be645f95560f088.tar.gz
2005-01-14 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of September 2004 HEAD patches to generics branch.
-rw-r--r--.settings/org.eclipse.core.resources.prefs3
-rw-r--r--ChangeLog2641
-rw-r--r--LICENSE94
-rw-r--r--Makefile.am2
-rw-r--r--NEWS30
-rw-r--r--configure.ac41
-rw-r--r--doc/api/Makefile.am24
-rwxr-xr-xdoc/www.gnu.org/announce/20040913.wml245
-rw-r--r--doc/www.gnu.org/downloads/downloads.wml14
-rw-r--r--doc/www.gnu.org/newsitems.txt8
-rw-r--r--examples/.cvsignore (renamed from external/.cvsignore)0
-rw-r--r--examples/README5
-rw-r--r--examples/examples.zipbin0 -> 72517 bytes
-rw-r--r--examples/gnu/classpath/examples/awt/Demo.java6
-rw-r--r--examples/gnu/classpath/examples/swing/Demo.java31
-rw-r--r--external/Makefile.am288
-rw-r--r--external/README21
-rw-r--r--external/jaxp/.cvsignore11
-rw-r--r--external/jaxp/AUTHORS9
-rw-r--r--external/jaxp/COPYING340
-rw-r--r--external/jaxp/COPYRIGHT.html100
-rw-r--r--external/jaxp/HACKING30
-rw-r--r--external/jaxp/LICENSE25
-rw-r--r--external/jaxp/Makefile.aj435
-rw-r--r--external/jaxp/Makefile.in466
-rw-r--r--external/jaxp/README122
-rw-r--r--external/jaxp/aclocal.m434
-rwxr-xr-xexternal/jaxp/automakejar133
-rw-r--r--external/jaxp/configure.in16
-rw-r--r--external/jaxp/manifest.mf28
-rw-r--r--external/jaxp/source/gnu/xml/aelfred2/JAXPFactory.java182
-rw-r--r--external/jaxp/source/gnu/xml/aelfred2/SAXDriver.java1272
-rw-r--r--external/jaxp/source/gnu/xml/aelfred2/XmlParser.java4761
-rw-r--r--external/jaxp/source/gnu/xml/aelfred2/XmlReader.java304
-rw-r--r--external/jaxp/source/gnu/xml/aelfred2/package.html477
-rw-r--r--external/jaxp/source/gnu/xml/dom/Consumer.java329
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomAttr.java263
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomCDATA.java84
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomCharacterData.java263
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomComment.java73
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomDoctype.java357
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomDocument.java789
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomElement.java339
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomEntity.java111
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomEntityReference.java102
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomEvent.java271
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomEx.java146
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomExtern.java104
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomFragment.java68
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomImpl.java172
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomIterator.java320
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomNamedNodeMap.java342
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomNode.java1567
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomNotation.java85
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomNsNode.java161
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomPI.java142
-rw-r--r--external/jaxp/source/gnu/xml/dom/DomText.java107
-rw-r--r--external/jaxp/source/gnu/xml/dom/JAXPFactory.java231
-rw-r--r--external/jaxp/source/gnu/xml/dom/package.html270
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/CallFilter.java239
-rwxr-xr-xexternal/jaxp/source/gnu/xml/pipeline/DomConsumer.java943
-rwxr-xr-xexternal/jaxp/source/gnu/xml/pipeline/EventConsumer.java84
-rwxr-xr-xexternal/jaxp/source/gnu/xml/pipeline/EventFilter.java786
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/LinkFilter.java232
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/NSFilter.java329
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/PipelineFactory.java712
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/TeeConsumer.java402
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/TextConsumer.java106
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/ValidationConsumer.java1911
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/WellFormednessFilter.java350
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/XIncludeFilter.java569
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/XsltFilter.java120
-rw-r--r--external/jaxp/source/gnu/xml/pipeline/package.html257
-rw-r--r--external/jaxp/source/gnu/xml/util/DoParse.java295
-rw-r--r--external/jaxp/source/gnu/xml/util/DomParser.java793
-rw-r--r--external/jaxp/source/gnu/xml/util/Resolver.java252
-rw-r--r--external/jaxp/source/gnu/xml/util/SAXNullTransformerFactory.java539
-rw-r--r--external/jaxp/source/gnu/xml/util/XCat.java1598
-rw-r--r--external/jaxp/source/gnu/xml/util/XHTMLWriter.java101
-rw-r--r--external/jaxp/source/gnu/xml/util/XMLWriter.java1916
-rw-r--r--external/jaxp/source/gnu/xml/util/package.html22
-rw-r--r--external/jaxp/source/javax/xml/parsers/ClassStuff.java158
-rw-r--r--external/jaxp/source/javax/xml/parsers/DocumentBuilder.java180
-rw-r--r--external/jaxp/source/javax/xml/parsers/DocumentBuilderFactory.java154
-rw-r--r--external/jaxp/source/javax/xml/parsers/FactoryConfigurationError.java81
-rw-r--r--external/jaxp/source/javax/xml/parsers/ParserConfigurationException.java51
-rw-r--r--external/jaxp/source/javax/xml/parsers/SAXParser.java279
-rw-r--r--external/jaxp/source/javax/xml/parsers/SAXParserFactory.java160
-rw-r--r--external/jaxp/source/javax/xml/parsers/package.html16
-rw-r--r--external/jaxp/source/javax/xml/transform/ClassStuff.java155
-rw-r--r--external/jaxp/source/javax/xml/transform/ErrorListener.java52
-rw-r--r--external/jaxp/source/javax/xml/transform/OutputKeys.java61
-rw-r--r--external/jaxp/source/javax/xml/transform/Result.java57
-rw-r--r--external/jaxp/source/javax/xml/transform/Source.java60
-rw-r--r--external/jaxp/source/javax/xml/transform/SourceLocator.java52
-rw-r--r--external/jaxp/source/javax/xml/transform/Templates.java50
-rw-r--r--external/jaxp/source/javax/xml/transform/Transformer.java142
-rw-r--r--external/jaxp/source/javax/xml/transform/TransformerConfigurationException.java70
-rw-r--r--external/jaxp/source/javax/xml/transform/TransformerException.java183
-rw-r--r--external/jaxp/source/javax/xml/transform/TransformerFactory.java140
-rw-r--r--external/jaxp/source/javax/xml/transform/TransformerFactoryConfigurationError.java73
-rw-r--r--external/jaxp/source/javax/xml/transform/URIResolver.java44
-rw-r--r--external/jaxp/source/javax/xml/transform/dom/DOMLocator.java49
-rw-r--r--external/jaxp/source/javax/xml/transform/dom/DOMResult.java90
-rw-r--r--external/jaxp/source/javax/xml/transform/dom/DOMSource.java90
-rw-r--r--external/jaxp/source/javax/xml/transform/dom/package.html5
-rw-r--r--external/jaxp/source/javax/xml/transform/package.html38
-rw-r--r--external/jaxp/source/javax/xml/transform/sax/SAXResult.java94
-rw-r--r--external/jaxp/source/javax/xml/transform/sax/SAXSource.java152
-rw-r--r--external/jaxp/source/javax/xml/transform/sax/SAXTransformerFactory.java142
-rw-r--r--external/jaxp/source/javax/xml/transform/sax/TemplatesHandler.java52
-rw-r--r--external/jaxp/source/javax/xml/transform/sax/TransformerHandler.java63
-rw-r--r--external/jaxp/source/javax/xml/transform/sax/package.html9
-rw-r--r--external/jaxp/source/javax/xml/transform/stream/StreamResult.java116
-rw-r--r--external/jaxp/source/javax/xml/transform/stream/StreamSource.java163
-rw-r--r--external/jaxp/source/javax/xml/transform/stream/package.html6
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Attr.java124
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/CDATASection.java48
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/CharacterData.java159
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Comment.java24
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/DOMException.java116
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/DOMImplementation.java110
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Document.java428
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/DocumentFragment.java52
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/DocumentType.java80
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Element.java322
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Entity.java68
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/EntityReference.java39
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/NamedNodeMap.java174
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Node.java526
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/NodeList.java41
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Notation.java40
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/ProcessingInstruction.java47
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/Text.java56
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2Azimuth.java94
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2BackgroundPosition.java144
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2BorderSpacing.java106
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2CounterIncrement.java49
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2CounterReset.java49
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2Cursor.java46
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2FontFaceSrc.java57
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2FontFaceWidths.java45
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2PageSize.java126
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2PlayDuring.java84
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2Properties.java2265
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSS2TextShadow.java50
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSCharsetRule.java56
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSFontFaceRule.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSImportRule.java44
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSMediaRule.java76
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSPageRule.java48
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSPrimitiveValue.java296
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSRule.java105
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSRuleList.java43
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSStyleDeclaration.java164
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSStyleRule.java51
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSStyleSheet.java85
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSUnknownRule.java22
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSValue.java78
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/CSSValueList.java46
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/Counter.java38
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/DOMImplementationCSS.java40
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/DocumentCSS.java50
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/ElementCSSInlineStyle.java32
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/RGBColor.java47
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/Rect.java44
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/ViewCSS.java43
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/css/package.html11
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/DocumentEvent.java56
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/Event.java141
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/EventException.java36
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/EventListener.java41
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/EventTarget.java102
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/MouseEvent.java156
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/MutationEvent.java108
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/UIEvent.java58
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/events/package.html18
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLAnchorElement.java112
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLAppletElement.java103
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLAreaElement.java79
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLBRElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLBaseElement.java34
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLBaseFontElement.java43
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLBodyElement.java69
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLButtonElement.java67
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLCollection.java57
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLDListElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLDOMImplementation.java36
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLDirectoryElement.java29
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLDivElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLDocument.java155
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLElement.java66
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLFieldSetElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLFontElement.java43
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLFormElement.java87
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLFrameElement.java86
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLFrameSetElement.java35
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLHRElement.java50
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLHeadElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLHeadingElement.java29
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLHtmlElement.java29
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLIFrameElement.java99
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLImageElement.java110
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLInputElement.java197
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLIsIndexElement.java35
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLLIElement.java36
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLLabelElement.java42
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLLegendElement.java43
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLLinkElement.java84
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLMapElement.java33
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLMenuElement.java29
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLMetaElement.java49
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLModElement.java36
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLOListElement.java42
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLObjectElement.java160
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLOptGroupElement.java36
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLOptionElement.java78
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLParagraphElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLParamElement.java51
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLPreElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLQuoteElement.java29
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLScriptElement.java67
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLSelectElement.java134
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLStyleElement.java42
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTableCaptionElement.java28
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTableCellElement.java126
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTableColElement.java63
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTableElement.java189
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTableRowElement.java103
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTableSectionElement.java85
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTextAreaElement.java114
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLTitleElement.java27
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/HTMLUListElement.java35
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/html/package.html8
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/package.html9
-rw-r--r--external/jaxp/source/org/w3c/dom/ranges/DocumentRange.java33
-rw-r--r--external/jaxp/source/org/w3c/dom/ranges/Range.java416
-rw-r--r--external/jaxp/source/org/w3c/dom/ranges/RangeException.java39
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/ranges/package.html10
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/stylesheets/DocumentStyle.java34
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/stylesheets/LinkStyle.java31
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/stylesheets/MediaList.java90
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/stylesheets/StyleSheet.java103
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/stylesheets/StyleSheetList.java42
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/stylesheets/package.html10
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/traversal/DocumentTraversal.java92
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/traversal/NodeFilter.java144
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/traversal/NodeIterator.java109
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/traversal/TreeWalker.java182
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/traversal/package.html10
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/views/AbstractView.java27
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/views/DocumentView.java30
-rwxr-xr-xexternal/jaxp/source/org/w3c/dom/views/package.html10
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/AttributeList.java192
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/Attributes.java249
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/ContentHandler.java406
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/DTDHandler.java116
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/DocumentHandler.java231
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/EntityResolver.java118
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/ErrorHandler.java124
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/HandlerBase.java369
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/InputSource.java335
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/Locator.java135
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/Parser.java208
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/SAXException.java152
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/SAXNotRecognizedException.java52
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/SAXNotSupportedException.java52
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/SAXParseException.java269
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/XMLFilter.java64
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/XMLReader.java396
-rw-r--r--external/jaxp/source/org/xml/sax/ext/Attributes2.java91
-rw-r--r--external/jaxp/source/org/xml/sax/ext/Attributes2Impl.java279
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/ext/DeclHandler.java142
-rw-r--r--external/jaxp/source/org/xml/sax/ext/DefaultHandler2.java129
-rw-r--r--external/jaxp/source/org/xml/sax/ext/EntityResolver2.java196
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/ext/LexicalHandler.java211
-rw-r--r--external/jaxp/source/org/xml/sax/ext/Locator2.java76
-rw-r--r--external/jaxp/source/org/xml/sax/ext/Locator2Impl.java100
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/ext/package.html46
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/AttributeListImpl.java311
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/AttributesImpl.java617
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/DefaultHandler.java466
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/LocatorImpl.java213
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/NamespaceSupport.java768
-rw-r--r--external/jaxp/source/org/xml/sax/helpers/NewInstance.java78
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/ParserAdapter.java1024
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/ParserFactory.java128
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/XMLFilterImpl.java712
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/XMLReaderAdapter.java537
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java200
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/helpers/package.html11
-rwxr-xr-xexternal/jaxp/source/org/xml/sax/package.html229
-rw-r--r--external/jaxp/tests/dom/NodeType.java73
-rw-r--r--external/jaxp/tests/dom/nodetype.xml26
-rw-r--r--gnu/classpath/Configuration.java113
-rw-r--r--gnu/java/awt/peer/gtk/GdkGraphics.java4
-rw-r--r--gnu/java/awt/peer/gtk/GdkGraphics2D.java15
-rw-r--r--gnu/java/awt/peer/gtk/GtkButtonPeer.java8
-rw-r--r--gnu/java/awt/peer/gtk/GtkCheckboxPeer.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkClipboard.java91
-rw-r--r--gnu/java/awt/peer/gtk/GtkComponentPeer.java68
-rw-r--r--gnu/java/awt/peer/gtk/GtkDialogPeer.java11
-rw-r--r--gnu/java/awt/peer/gtk/GtkFileDialogPeer.java1
-rw-r--r--gnu/java/awt/peer/gtk/GtkFramePeer.java92
-rw-r--r--gnu/java/awt/peer/gtk/GtkGenericPeer.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkImagePainter.java4
-rw-r--r--gnu/java/awt/peer/gtk/GtkLabelPeer.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkListPeer.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkMenuBarPeer.java21
-rw-r--r--gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java15
-rw-r--r--gnu/java/awt/peer/gtk/GtkMenuItemPeer.java32
-rw-r--r--gnu/java/awt/peer/gtk/GtkTextAreaPeer.java2
-rw-r--r--gnu/java/awt/peer/gtk/GtkTextFieldPeer.java2
-rw-r--r--gnu/java/io/EncodingManager.java272
-rw-r--r--gnu/java/net/protocol/file/Connection.java185
-rw-r--r--gnu/java/net/protocol/file/Handler.java5
-rw-r--r--gnu/java/rmi/server/UnicastServer.java5
-rw-r--r--gnu/java/rmi/server/UnicastServerRef.java11
-rw-r--r--gnu/regexp/RE.java23
-rw-r--r--gnu/regexp/RETokenLookAhead.java87
-rw-r--r--include/Makefile.am6
-rw-r--r--include/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h22
-rw-r--r--include/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.h19
-rw-r--r--include/gnu_java_awt_peer_gtk_GdkGlyphVector.h32
-rw-r--r--include/gnu_java_awt_peer_gtk_GdkGraphics2D.h55
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkButtonPeer.h4
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h2
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkComponentPeer.h5
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkFramePeer.h4
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkGenericPeer.h1
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkLabelPeer.h2
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkListPeer.h2
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h1
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h2
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h2
-rw-r--r--include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h2
-rw-r--r--include/java_util_TimeZone.h19
-rw-r--r--include/java_util_VMTimeZone.h19
-rw-r--r--java/applet/Applet.java17
-rw-r--r--java/applet/AppletContext.java2
-rw-r--r--java/applet/AppletStub.java3
-rw-r--r--java/applet/AudioClip.java3
-rw-r--r--java/awt/AWTEventMulticaster.java76
-rw-r--r--java/awt/AWTKeyStroke.java4
-rw-r--r--java/awt/Adjustable.java4
-rw-r--r--java/awt/Canvas.java8
-rw-r--r--java/awt/CardLayout.java7
-rw-r--r--java/awt/CheckboxMenuItem.java12
-rw-r--r--java/awt/Color.java6
-rw-r--r--java/awt/Component.java58
-rw-r--r--java/awt/Container.java35
-rw-r--r--java/awt/DefaultFocusTraversalPolicy.java24
-rw-r--r--java/awt/DefaultKeyboardFocusManager.java33
-rw-r--r--java/awt/EventDispatchThread.java11
-rw-r--r--java/awt/FileDialog.java3
-rw-r--r--java/awt/FlowLayout.java7
-rw-r--r--java/awt/Font.java29
-rw-r--r--java/awt/FontMetrics.java112
-rw-r--r--java/awt/Frame.java2
-rw-r--r--java/awt/Graphics2D.java7
-rw-r--r--java/awt/GraphicsEnvironment.java7
-rw-r--r--java/awt/GridBagConstraints.java11
-rw-r--r--java/awt/GridBagLayout.java4
-rw-r--r--java/awt/GridLayout.java5
-rw-r--r--java/awt/Image.java3
-rw-r--r--java/awt/KeyboardFocusManager.java11
-rw-r--r--java/awt/Label.java8
-rw-r--r--java/awt/List.java3
-rw-r--r--java/awt/MediaTracker.java4
-rw-r--r--java/awt/Menu.java49
-rw-r--r--java/awt/MenuBar.java86
-rw-r--r--java/awt/MenuComponent.java1053
-rw-r--r--java/awt/MenuItem.java4
-rw-r--r--java/awt/Panel.java37
-rw-r--r--java/awt/Point.java2
-rw-r--r--java/awt/Polygon.java2
-rw-r--r--java/awt/PopupMenu.java3
-rw-r--r--java/awt/Rectangle.java2
-rw-r--r--java/awt/ScrollPane.java3
-rw-r--r--java/awt/Scrollbar.java6
-rw-r--r--java/awt/Shape.java26
-rw-r--r--java/awt/SystemColor.java58
-rw-r--r--java/awt/TextArea.java69
-rw-r--r--java/awt/TextField.java4
-rw-r--r--java/awt/Toolkit.java6
-rw-r--r--java/awt/Window.java7
-rw-r--r--java/awt/color/ICC_Profile.java2
-rw-r--r--java/awt/datatransfer/Clipboard.java162
-rw-r--r--java/awt/datatransfer/ClipboardOwner.java3
-rw-r--r--java/awt/datatransfer/DataFlavor.java4
-rw-r--r--java/awt/datatransfer/StringSelection.java4
-rw-r--r--java/awt/datatransfer/SystemFlavorMap.java4
-rw-r--r--java/awt/dnd/Autoscroll.java5
-rw-r--r--java/awt/dnd/DropTarget.java5
-rw-r--r--java/awt/dnd/DropTargetContext.java6
-rw-r--r--java/awt/dnd/DropTargetDragEvent.java5
-rw-r--r--java/awt/dnd/package.html4
-rw-r--r--java/awt/dnd/peer/DropTargetContextPeer.java5
-rw-r--r--java/awt/event/AdjustmentEvent.java4
-rw-r--r--java/awt/event/InputEvent.java5
-rw-r--r--java/awt/event/InvocationEvent.java4
-rw-r--r--java/awt/event/KeyEvent.java5
-rw-r--r--java/awt/event/MouseEvent.java5
-rw-r--r--java/awt/font/TextLayout.java6
-rw-r--r--java/awt/geom/Arc2D.java133
-rw-r--r--java/awt/geom/Area.java98
-rw-r--r--java/awt/geom/CubicCurve2D.java11
-rw-r--r--java/awt/geom/Ellipse2D.java56
-rw-r--r--java/awt/geom/GeneralPath.java98
-rw-r--r--java/awt/geom/PathIterator.java4
-rw-r--r--java/awt/geom/Point2D.java11
-rw-r--r--java/awt/geom/QuadCurve2D.java11
-rw-r--r--java/awt/geom/Rectangle2D.java2
-rw-r--r--java/awt/im/InputContext.java8
-rw-r--r--java/awt/im/spi/InputMethodContext.java4
-rw-r--r--java/awt/image/AffineTransformOp.java13
-rw-r--r--java/awt/image/BandedSampleModel.java538
-rw-r--r--java/awt/image/BufferedImage.java26
-rw-r--r--java/awt/image/ColorModel.java89
-rw-r--r--java/awt/image/ComponentColorModel.java32
-rw-r--r--java/awt/image/ComponentSampleModel.java16
-rw-r--r--java/awt/image/CropImageFilter.java5
-rw-r--r--java/awt/image/DataBuffer.java231
-rw-r--r--java/awt/image/DataBufferByte.java105
-rw-r--r--java/awt/image/DataBufferDouble.java105
-rw-r--r--java/awt/image/DataBufferFloat.java105
-rw-r--r--java/awt/image/DataBufferInt.java108
-rw-r--r--java/awt/image/DataBufferShort.java105
-rw-r--r--java/awt/image/DataBufferUShort.java97
-rw-r--r--java/awt/image/DirectColorModel.java16
-rw-r--r--java/awt/image/IndexColorModel.java170
-rw-r--r--java/awt/image/MemoryImageSource.java4
-rw-r--r--java/awt/image/MultiPixelPackedSampleModel.java387
-rw-r--r--java/awt/image/PackedColorModel.java6
-rw-r--r--java/awt/image/PixelGrabber.java70
-rw-r--r--java/awt/image/Raster.java55
-rw-r--r--java/awt/image/RasterOp.java5
-rw-r--r--java/awt/image/RescaleOp.java210
-rw-r--r--java/awt/image/SinglePixelPackedSampleModel.java10
-rw-r--r--java/awt/peer/MenuBarPeer.java1
-rw-r--r--java/io/DeleteFileHelper.java5
-rw-r--r--java/io/ObjectInputStream.java13
-rw-r--r--java/io/ObjectOutputStream.java6
-rw-r--r--java/lang/Comparable.java19
-rw-r--r--java/lang/Runtime.java26
-rw-r--r--java/lang/StackTraceElement.java14
-rw-r--r--java/lang/System.java2
-rw-r--r--java/lang/Throwable.java2
-rw-r--r--java/net/Inet4Address.java3
-rw-r--r--java/net/Socket.java5
-rw-r--r--java/net/URL.java4
-rw-r--r--java/net/URLClassLoader.java39
-rw-r--r--java/net/URLConnection.java143
-rw-r--r--java/nio/ByteBuffer.java20
-rw-r--r--java/nio/CharBuffer.java18
-rw-r--r--java/nio/DoubleBuffer.java20
-rw-r--r--java/nio/FloatBuffer.java20
-rw-r--r--java/nio/IntBuffer.java20
-rw-r--r--java/nio/LongBuffer.java20
-rw-r--r--java/nio/ShortBuffer.java20
-rw-r--r--java/security/BasicPermission.java16
-rw-r--r--java/security/cert/X509CRLSelector.java445
-rw-r--r--java/security/cert/X509CertSelector.java1111
-rw-r--r--java/text/Format.java3
-rw-r--r--java/text/MessageFormat.java2
-rw-r--r--java/util/Arrays.java17
-rw-r--r--java/util/Calendar.java74
-rw-r--r--java/util/Collections.java26
-rw-r--r--java/util/TimeZone.java292
-rw-r--r--java/util/TreeMap.java9
-rw-r--r--javax/crypto/BadPaddingException.java79
-rw-r--r--javax/crypto/Cipher.java1097
-rw-r--r--javax/crypto/CipherInputStream.java383
-rw-r--r--javax/crypto/CipherOutputStream.java268
-rw-r--r--javax/crypto/CipherSpi.java398
-rw-r--r--javax/crypto/EncryptedPrivateKeyInfo.java284
-rw-r--r--javax/crypto/ExemptionMechanism.java226
-rw-r--r--javax/crypto/ExemptionMechanismException.java81
-rw-r--r--javax/crypto/ExemptionMechanismSpi.java149
-rw-r--r--javax/crypto/IllegalBlockSizeException.java (renamed from native/jni/java-util/java_util_TimeZone.c)63
-rw-r--r--javax/crypto/KeyAgreement.java373
-rw-r--r--javax/crypto/KeyAgreementSpi.java160
-rw-r--r--javax/crypto/KeyGenerator.java284
-rw-r--r--javax/crypto/KeyGeneratorSpi.java112
-rw-r--r--javax/crypto/Mac.java414
-rw-r--r--javax/crypto/MacSpi.java145
-rw-r--r--javax/crypto/NoSuchPaddingException.java71
-rw-r--r--javax/crypto/NullCipher.java62
-rw-r--r--javax/crypto/NullCipherImpl.java127
-rw-r--r--javax/crypto/SealedObject.java355
-rw-r--r--javax/crypto/SecretKey.java67
-rw-r--r--javax/crypto/SecretKeyFactory.java249
-rw-r--r--javax/crypto/SecretKeyFactorySpi.java108
-rw-r--r--javax/crypto/ShortBufferException.java70
-rw-r--r--javax/crypto/interfaces/DHKey.java61
-rw-r--r--javax/crypto/interfaces/DHPrivateKey.java70
-rw-r--r--javax/crypto/interfaces/DHPublicKey.java69
-rw-r--r--javax/crypto/interfaces/PBEKey.java91
-rw-r--r--javax/crypto/interfaces/package.html46
-rw-r--r--javax/crypto/package.html46
-rw-r--r--javax/crypto/spec/DESKeySpec.java220
-rw-r--r--javax/crypto/spec/DESedeKeySpec.java151
-rw-r--r--javax/crypto/spec/DHGenParameterSpec.java100
-rw-r--r--javax/crypto/spec/DHParameterSpec.java135
-rw-r--r--javax/crypto/spec/DHPrivateKeySpec.java115
-rw-r--r--javax/crypto/spec/DHPublicKeySpec.java115
-rw-r--r--javax/crypto/spec/IvParameterSpec.java96
-rw-r--r--javax/crypto/spec/PBEKeySpec.java176
-rw-r--r--javax/crypto/spec/PBEParameterSpec.java100
-rw-r--r--javax/crypto/spec/RC2ParameterSpec.java166
-rw-r--r--javax/crypto/spec/RC5ParameterSpec.java202
-rw-r--r--javax/crypto/spec/SecretKeySpec.java154
-rw-r--r--javax/crypto/spec/package.html46
-rw-r--r--javax/naming/CompoundName.java4
-rw-r--r--javax/net/ServerSocketFactory.java122
-rw-r--r--javax/net/SocketFactory.java157
-rw-r--r--javax/net/VanillaServerSocketFactory.java (renamed from gnu/java/net/content/text/plain.java)77
-rw-r--r--javax/net/VanillaSocketFactory.java88
-rw-r--r--javax/net/package.html46
-rw-r--r--javax/net/ssl/HandshakeCompletedEvent.java152
-rw-r--r--javax/net/ssl/HandshakeCompletedListener.java57
-rw-r--r--javax/net/ssl/HostnameVerifier.java64
-rw-r--r--javax/net/ssl/HttpsURLConnection.java256
-rw-r--r--javax/net/ssl/KeyManager.java51
-rw-r--r--javax/net/ssl/KeyManagerFactory.java281
-rw-r--r--javax/net/ssl/KeyManagerFactorySpi.java102
-rw-r--r--javax/net/ssl/ManagerFactoryParameters.java50
-rw-r--r--javax/net/ssl/SSLContext.java269
-rw-r--r--javax/net/ssl/SSLContextSpi.java109
-rw-r--r--javax/net/ssl/SSLException.java59
-rw-r--r--javax/net/ssl/SSLHandshakeException.java51
-rw-r--r--javax/net/ssl/SSLKeyException.java52
-rw-r--r--javax/net/ssl/SSLPeerUnverifiedException.java51
-rw-r--r--javax/net/ssl/SSLPermission.java66
-rw-r--r--javax/net/ssl/SSLProtocolException.java53
-rw-r--r--javax/net/ssl/SSLServerSocket.java188
-rw-r--r--javax/net/ssl/SSLServerSocketFactory.java172
-rw-r--r--javax/net/ssl/SSLSession.java168
-rw-r--r--javax/net/ssl/SSLSessionBindingEvent.java94
-rw-r--r--javax/net/ssl/SSLSessionBindingListener.java65
-rw-r--r--javax/net/ssl/SSLSessionContext.java103
-rw-r--r--javax/net/ssl/SSLSocket.java229
-rw-r--r--javax/net/ssl/SSLSocketFactory.java192
-rw-r--r--javax/net/ssl/TrivialHostnameVerifier.java51
-rw-r--r--javax/net/ssl/TrustManager.java47
-rw-r--r--javax/net/ssl/TrustManagerFactory.java279
-rw-r--r--javax/net/ssl/TrustManagerFactorySpi.java88
-rw-r--r--javax/net/ssl/X509KeyManager.java108
-rw-r--r--javax/net/ssl/X509TrustManager.java76
-rw-r--r--javax/net/ssl/package.html46
-rw-r--r--javax/rmi/CORBA/Stub.java5
-rw-r--r--javax/security/auth/AuthPermission.java146
-rw-r--r--javax/security/auth/DestroyFailedException.java67
-rw-r--r--javax/security/auth/Destroyable.java64
-rw-r--r--javax/security/auth/Policy.java79
-rw-r--r--javax/security/auth/PrivateCredentialPermission.java326
-rw-r--r--javax/security/auth/RefreshFailedException.java63
-rw-r--r--javax/security/auth/Refreshable.java65
-rw-r--r--javax/security/auth/Subject.java559
-rw-r--r--javax/security/auth/SubjectDomainCombiner.java96
-rw-r--r--javax/security/auth/callback/Callback.java65
-rw-r--r--javax/security/auth/callback/CallbackHandler.java156
-rw-r--r--javax/security/auth/callback/ChoiceCallback.java237
-rw-r--r--javax/security/auth/callback/ConfirmationCallback.java506
-rw-r--r--javax/security/auth/callback/LanguageCallback.java101
-rw-r--r--javax/security/auth/callback/NameCallback.java179
-rw-r--r--javax/security/auth/callback/PasswordCallback.java169
-rw-r--r--javax/security/auth/callback/TextInputCallback.java178
-rw-r--r--javax/security/auth/callback/TextOutputCallback.java141
-rw-r--r--javax/security/auth/callback/UnsupportedCallbackException.java102
-rw-r--r--javax/security/auth/callback/package.html46
-rw-r--r--javax/security/auth/login/AccountExpiredException.java64
-rw-r--r--javax/security/auth/login/AppConfigurationEntry.java135
-rw-r--r--javax/security/auth/login/Configuration.java109
-rw-r--r--javax/security/auth/login/CredentialExpiredException.java64
-rw-r--r--javax/security/auth/login/FailedLoginException.java63
-rw-r--r--javax/security/auth/login/LoginContext.java44
-rw-r--r--javax/security/auth/login/LoginException.java65
-rw-r--r--javax/security/auth/login/NullConfiguration.java64
-rw-r--r--javax/security/auth/login/package.html46
-rw-r--r--javax/security/auth/package.html46
-rw-r--r--javax/security/auth/x500/X500PrivateCredential.java148
-rw-r--r--javax/security/cert/Certificate.java176
-rw-r--r--javax/security/cert/CertificateEncodingException.java60
-rw-r--r--javax/security/cert/CertificateException.java60
-rw-r--r--javax/security/cert/CertificateExpiredException.java60
-rw-r--r--javax/security/cert/CertificateNotYetValidException.java60
-rw-r--r--javax/security/cert/CertificateParsingException.java59
-rw-r--r--javax/security/cert/X509CertBridge.java203
-rw-r--r--javax/security/cert/X509Certificate.java191
-rw-r--r--javax/security/cert/package.html46
-rw-r--r--javax/security/package.html46
-rw-r--r--javax/security/sasl/AuthenticationException.java105
-rw-r--r--javax/security/sasl/AuthorizeCallback.java171
-rw-r--r--javax/security/sasl/RealmCallback.java75
-rw-r--r--javax/security/sasl/RealmChoiceCallback.java71
-rw-r--r--javax/security/sasl/Sasl.java691
-rw-r--r--javax/security/sasl/SaslClient.java231
-rw-r--r--javax/security/sasl/SaslClientFactory.java117
-rw-r--r--javax/security/sasl/SaslException.java185
-rw-r--r--javax/security/sasl/SaslServer.java226
-rw-r--r--javax/security/sasl/SaslServerFactory.java114
-rw-r--r--javax/security/sasl/package.html46
-rw-r--r--javax/swing/AbstractButton.java290
-rw-r--r--javax/swing/AbstractSpinnerModel.java115
-rw-r--r--javax/swing/ActionMap.java2
-rw-r--r--javax/swing/Box.java2
-rw-r--r--javax/swing/ButtonGroup.java76
-rw-r--r--javax/swing/ComboBoxEditor.java95
-rw-r--r--javax/swing/ComboBoxModel.java46
-rw-r--r--javax/swing/DebugGraphics.java1402
-rw-r--r--javax/swing/DefaultButtonModel.java267
-rw-r--r--javax/swing/DefaultComboBoxModel.java317
-rw-r--r--javax/swing/DefaultListCellRenderer.java117
-rw-r--r--javax/swing/DefaultListSelectionModel.java14
-rw-r--r--javax/swing/InputMap.java2
-rw-r--r--javax/swing/InputVerifier.java72
-rw-r--r--javax/swing/JApplet.java314
-rw-r--r--javax/swing/JCheckBox.java3
-rw-r--r--javax/swing/JColorChooser.java932
-rw-r--r--javax/swing/JComboBox.java1791
-rw-r--r--javax/swing/JComponent.java360
-rw-r--r--javax/swing/JFrame.java344
-rw-r--r--javax/swing/JInternalFrame.java22
-rw-r--r--javax/swing/JLabel.java194
-rw-r--r--javax/swing/JList.java22
-rw-r--r--javax/swing/JMenu.java21
-rw-r--r--javax/swing/JPasswordField.java309
-rw-r--r--javax/swing/JPopupMenu.java9
-rw-r--r--javax/swing/JRadioButton.java235
-rw-r--r--javax/swing/JRootPane.java31
-rw-r--r--javax/swing/JScrollPane.java37
-rw-r--r--javax/swing/JSpinner.java550
-rw-r--r--javax/swing/JTabbedPane.java135
-rw-r--r--javax/swing/JTable.java1414
-rw-r--r--javax/swing/JTextArea.java163
-rw-r--r--javax/swing/JTextField.java157
-rw-r--r--javax/swing/JToggleButton.java176
-rw-r--r--javax/swing/JTree.java115
-rw-r--r--javax/swing/JViewport.java53
-rw-r--r--javax/swing/KeyStroke.java288
-rw-r--r--javax/swing/MutableComboBoxModel.java70
-rw-r--r--javax/swing/ScrollPaneLayout.java6
-rw-r--r--javax/swing/SpinnerListModel.java296
-rw-r--r--javax/swing/SpinnerNumberModel.java298
-rw-r--r--javax/swing/SpringLayout.java2
-rw-r--r--javax/swing/SwingUtilities.java103
-rw-r--r--javax/swing/Timer.java7
-rw-r--r--javax/swing/ToolTipManager.java2
-rw-r--r--javax/swing/TransferHandler.java55
-rw-r--r--javax/swing/UIDefaults.java2
-rw-r--r--javax/swing/UIManager.java109
-rw-r--r--javax/swing/colorchooser/AbstractColorChooserPanel.java190
-rw-r--r--javax/swing/colorchooser/ColorChooserComponentFactory.java78
-rw-r--r--javax/swing/colorchooser/DefaultColorSelectionModel.java73
-rw-r--r--javax/swing/colorchooser/DefaultHSBChooserPanel.java874
-rw-r--r--javax/swing/colorchooser/DefaultPreviewPanel.java317
-rw-r--r--javax/swing/colorchooser/DefaultRGBChooserPanel.java395
-rw-r--r--javax/swing/colorchooser/DefaultSwatchChooserPanel.java891
-rw-r--r--javax/swing/plaf/basic/BasicArrowButton.java347
-rw-r--r--javax/swing/plaf/basic/BasicButtonListener.java40
-rw-r--r--javax/swing/plaf/basic/BasicButtonUI.java63
-rw-r--r--javax/swing/plaf/basic/BasicColorChooserUI.java338
-rw-r--r--javax/swing/plaf/basic/BasicComboBoxEditor.java170
-rw-r--r--javax/swing/plaf/basic/BasicComboBoxRenderer.java143
-rw-r--r--javax/swing/plaf/basic/BasicComboBoxUI.java1240
-rw-r--r--javax/swing/plaf/basic/BasicComboPopup.java946
-rw-r--r--javax/swing/plaf/basic/BasicFormattedTextFieldUI.java62
-rw-r--r--javax/swing/plaf/basic/BasicGraphicsUtils.java6
-rw-r--r--javax/swing/plaf/basic/BasicInternalFrameTitlePane.java12
-rw-r--r--javax/swing/plaf/basic/BasicLookAndFeel.java11
-rw-r--r--javax/swing/plaf/basic/BasicPasswordFieldUI.java67
-rw-r--r--javax/swing/plaf/basic/BasicPopupMenuUI.java53
-rw-r--r--javax/swing/plaf/basic/BasicScrollBarUI.java398
-rw-r--r--javax/swing/plaf/basic/BasicSliderUI.java13
-rw-r--r--javax/swing/plaf/basic/BasicSpinnerUI.java572
-rw-r--r--javax/swing/plaf/basic/BasicSplitPaneDivider.java119
-rw-r--r--javax/swing/plaf/basic/BasicTabbedPaneUI.java115
-rw-r--r--javax/swing/plaf/basic/BasicTableHeaderUI.java301
-rw-r--r--javax/swing/plaf/basic/BasicTableUI.java374
-rw-r--r--javax/swing/plaf/basic/BasicTextAreaUI.java69
-rw-r--r--javax/swing/plaf/basic/BasicTextUI.java177
-rw-r--r--javax/swing/plaf/basic/BasicToggleButtonUI.java12
-rw-r--r--javax/swing/plaf/basic/BasicToolBarUI.java6
-rw-r--r--javax/swing/plaf/basic/ComboPopup.java103
-rw-r--r--javax/swing/table/DefaultTableCellRenderer.java23
-rw-r--r--javax/swing/table/DefaultTableColumnModel.java108
-rw-r--r--javax/swing/table/DefaultTableModel.java826
-rw-r--r--javax/swing/table/JTableHeader.java555
-rw-r--r--javax/swing/table/TableColumn.java10
-rw-r--r--javax/swing/text/AbstractDocument.java323
-rw-r--r--javax/swing/text/AttributeSet.java5
-rw-r--r--javax/swing/text/DefaultCaret.java134
-rw-r--r--javax/swing/text/DefaultEditorKit.java212
-rw-r--r--javax/swing/text/DefaultHighlighter.java111
-rw-r--r--javax/swing/text/DocumentFilter.java42
-rw-r--r--javax/swing/text/FieldView.java8
-rw-r--r--javax/swing/text/JTextComponent.java625
-rw-r--r--javax/swing/text/NavigationFilter.java30
-rw-r--r--javax/swing/text/PasswordView.java136
-rw-r--r--javax/swing/text/PlainView.java104
-rw-r--r--javax/swing/text/Segment.java57
-rw-r--r--javax/swing/text/SimpleAttributeSet.java192
-rw-r--r--javax/swing/text/StyleConstants.java439
-rw-r--r--javax/swing/text/StyleContext.java697
-rw-r--r--javax/swing/text/TabSet.java102
-rw-r--r--javax/swing/text/TabStop.java133
-rw-r--r--javax/swing/text/TextAction.java8
-rw-r--r--javax/swing/text/Utilities.java182
-rw-r--r--javax/swing/text/View.java31
-rw-r--r--javax/swing/text/html/HTML.java5
-rw-r--r--lib/Makefile.am4
-rwxr-xr-xlib/gen-classlist.sh.in4
-rw-r--r--lib/resources0
-rw-r--r--native/jni/gtk-peer/Makefile.am1
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c138
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c18
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c13
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c81
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c236
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c12
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c23
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c179
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c31
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c15
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c24
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c69
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c1
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c9
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c2
-rw-r--r--native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c274
-rw-r--r--native/jni/gtk-peer/gtkpeer.h1
-rw-r--r--native/jni/java-util/Makefile.am2
-rw-r--r--native/jni/java-util/java_util_VMTimeZone.c220
-rw-r--r--native/target/generic/target_generic_misc.h51
-rw-r--r--org/ietf/jgss/ChannelBinding.java215
-rw-r--r--org/ietf/jgss/GSSContext.java924
-rw-r--r--org/ietf/jgss/GSSCredential.java334
-rw-r--r--org/ietf/jgss/GSSException.java435
-rw-r--r--org/ietf/jgss/GSSManager.java501
-rw-r--r--org/ietf/jgss/GSSName.java269
-rw-r--r--org/ietf/jgss/MessageProp.java273
-rw-r--r--org/ietf/jgss/Oid.java385
-rw-r--r--resource/java/util/Makefile.am3
-rw-r--r--resource/java/util/logging/Makefile374
-rw-r--r--resource/java/util/logging/Makefile.am4
-rw-r--r--resource/java/util/logging/logging.properties (renamed from java/util/logging/logging.properties)0
-rw-r--r--resource/org/.cvsignore2
-rw-r--r--resource/org/Makefile.am1
-rw-r--r--resource/org/ietf/.cvsignore2
-rw-r--r--resource/org/ietf/Makefile.am1
-rw-r--r--resource/org/ietf/jgss/.cvsignore2
-rw-r--r--resource/org/ietf/jgss/Makefile.am1
-rw-r--r--resource/org/ietf/jgss/MessagesBundle.properties60
-rw-r--r--scripts/checkstyle-config.xml132
-rw-r--r--scripts/checkstyle-header.regex38
-rw-r--r--scripts/checkstyle-suppressions.xml25
-rw-r--r--scripts/jalopy-gnu.xml378
-rw-r--r--vm/reference/java/io/VMFile.java22
-rw-r--r--vm/reference/java/lang/VMCompiler.java112
-rw-r--r--vm/reference/java/lang/VMProcess.java8
-rw-r--r--vm/reference/java/util/VMTimeZone.java345
766 files changed, 54606 insertions, 62312 deletions
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..e1373e63c
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Mon Sep 20 12:53:19 MDT 2004
+eclipse.preferences.version=1
+encoding/ChangeLog=ISO-8859-1
diff --git a/ChangeLog b/ChangeLog
index 75406560f..ccca56edf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -467,10 +467,396 @@
signum, reverseBytes, reverse): New methods.
(TYPE): Changed type.
+2004-09-28 Tom Tromey <tromey@redhat.com>
+
+ * java/text/MessageFormat.java (Field): Constructor now
+ protected.
+
+ * java/net/URLConnection.java (setFileNameMap): Now synchronized.
+
+ * javax/crypto/MacSpi.java: Fixed typo.
+
+ * java/lang/System.java (getenv): Added @specnote.
+
+2004-09-28 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/IndexColorModel.java: Add class docs.
+ (getRGBs, convertToIntDiscrete): Implement.
+ (isValid, getValidPixels): Implement.
+ * java/awt/image/RescaleOp.java: Implement.
+
+2004-09-28 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URLConnection.java:
+ Reformatted.
+ (getContent): Make sure we are connected. Moved code to get content
+ handler to getContentHandler() method for easier merging with libgcj's
+ version.
+ (getContentHandler): New method.
+
+2004-09-28 Michael Koch <konqueror@gmx.de>
+
+ * java/net/URLClassLoader.java:
+ Reformated.
+ (addURLImpl): Partly merged with libgcj's version.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * java/awt/AWTKeyStroke.java,
+ java/awt/Canvas.java,
+ java/awt/CardLayout.java,
+ java/awt/CheckboxMenuItem.java,
+ java/awt/Component.java,
+ java/awt/Container.java,
+ java/awt/DefaultKeyboardFocusManager.java,
+ java/awt/EventDispatchThread.java,
+ java/awt/FileDialog.java,
+ java/awt/FlowLayout.java,
+ java/awt/Font.java,
+ java/awt/Frame.java,
+ java/awt/Graphics2D.java,
+ java/awt/GraphicsEnvironment.java,
+ java/awt/GridBagConstraints.java,
+ java/awt/GridBagLayout.java,
+ java/awt/GridLayout.java,
+ java/awt/Image.java,
+ java/awt/KeyboardFocusManager.java,
+ java/awt/Label.java,
+ java/awt/List.java,
+ java/awt/MediaTracker.java,
+ java/awt/Menu.java,
+ java/awt/MenuBar.java,
+ java/awt/MenuComponent.java,
+ java/awt/Panel.java,
+ java/awt/PopupMenu.java,
+ java/awt/ScrollPane.java,
+ java/awt/Scrollbar.java,
+ java/awt/SystemColor.java,
+ java/awt/TextArea.java,
+ java/awt/TextField.java,
+ java/awt/Toolkit.java,
+ java/awt/Window.java,
+ java/awt/color/ICC_Profile.java,
+ java/awt/datatransfer/DataFlavor.java,
+ java/awt/datatransfer/StringSelection.java,
+ java/awt/datatransfer/SystemFlavorMap.java,
+ java/awt/dnd/Autoscroll.java,
+ java/awt/dnd/DropTarget.java,
+ java/awt/dnd/DropTargetContext.java,
+ java/awt/dnd/DropTargetDragEvent.java,
+ java/awt/dnd/peer/DropTargetContextPeer.java,
+ java/awt/event/AdjustmentEvent.java,
+ java/awt/event/InputEvent.java,
+ java/awt/event/InvocationEvent.java,
+ java/awt/event/KeyEvent.java,
+ java/awt/event/MouseEvent.java,
+ java/awt/font/TextLayout.java,
+ java/awt/geom/GeneralPath.java,
+ java/awt/geom/Point2D.java,
+ java/awt/im/InputContext.java,
+ java/awt/im/spi/InputMethodContext.java,
+ java/awt/image/AffineTransformOp.java,
+ java/awt/image/BufferedImage.java,
+ java/awt/image/ColorModel.java,
+ java/awt/image/ComponentColorModel.java,
+ java/awt/image/CropImageFilter.java,
+ java/awt/image/DirectColorModel.java,
+ java/awt/image/MemoryImageSource.java,
+ java/awt/image/PackedColorModel.java,
+ java/awt/image/PixelGrabber.java,
+ java/awt/image/RasterOp.java,
+ java/awt/peer/MenuBarPeer.java:
+ Some fixes for checkstyle. Import statement and modifier order
+ redordering.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTable.java
+ (setModel): Reimplemented.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextArea.java
+ (insert): Renaming of method local variables.
+
+2004-09-27 Per Bothner <per@bothner.com>
+
+ * java/util/Collections.java (sort): Copy from array in forwards
+ order, rather than reverse order which may be much less
+ efficient.
+
+2004-09-27 Bryce McKinlay <mckinlay@redhat.com>
+
+ * java.util.Calendar.java (cache): New private static field. Cached
+ mappings of locales->calendar classes.
+ (ctorArgTypes): New private static field. Singleton argument for
+ calendar class constructor lookup.
+ (getInstance): Cache Locale->Calendar class mappings using HashMap.
+ Optimize by bypassing reflection instantiation for the
+ GregorianCalendar case.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/SpinnerNumberModel.java
+ (SpinnerNumberModel): Implements java.io.Serializable.
+
+2004-09-27 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/BandedSampleModel.java: Implement.
+ * java/awt/image/ColorModel.java (getDataElement,
+ getDataElements): Document since 1.4.
+ * java/awt/image/ComponentColorModel.java (ComponentColorModel):
+ Implement missing 1.4 constructor.
+ * java/awt/image/IndexColorModel.java (IndexColorModel): Implement
+ missing constructor.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JFrame.java,
+ javax/swing/JRadioButton.java,
+ javax/swing/JRootPane.java,
+ javax/swing/JTextField.java,
+ javax/swing/SpinnerNumberModel.java,
+ javax/swing/plaf/basic/BasicArrowButton.java,
+ javax/swing/plaf/basic/BasicScrollBarUI.java,
+ javax/swing/plaf/basic/BasicSplitPaneDivider.java,
+ javax/swing/table/DefaultTableColumnModel.java,
+ javax/swing/table/JTableHeader.java,
+ javax/swing/text/DocumentFilter.java,
+ javax/swing/text/JTextComponent.java,
+ javax/swing/text/NavigationFilter.java:
+ Whitespace cleanup.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextArea.java
+ (getColumnWidth): New method.
+ (getLineCount): Likewise.
+ (getLineStartOffset): Likewise.
+ (getLineEndOffset): Likewise.
+ (getLineOfOffset): Likewise.
+ (getRowHeight): Likewise.
+ (replaceRange): Likewise.
+ (insert): Reformatted.
+
+2004-09-27 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JSpinner.java:
+ Some Re-formatting.
+ (spinner): New field.
+ (DefaultEditor): New method.
+ (getSpinner): Likewise.
+ (NumberEdito): Likewise.
+ (getModel): Likewise.
+ (setModel): Likewise.
+
2004-09-27 Tom Tromey <tromey@redhat.com>
* java/lang/Deprecated.java: Fixed retention.
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextField.java
+ (scrollOffset): new field.
+ (getScrollOffset): New method.
+ (setScrollOffset): Likewise.
+ (getColumnWidth): Likewise.
+ (action): New field.
+ (actionCommand): Likewise.
+ (actionPropertyChangeListener): Likewise.
+ (setHorizontalAlignment): Abort soon if new value == old value. Fire
+ event before repainting.
+ (postActionEvent): New method.
+ (getAction): Likewise.
+ (setAction): Likewise.
+ (getActionCommand): Likewise.
+ (setActionCommand): Likewise.
+ (createActionPropertyChangeListener): Likewise.
+ (configurePropertiesFromAction): Likewise.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/JTextComponent.java
+ (dragEnabled): New field.
+ (getSelectedText): New method.
+ (getDragEnabled): Likewise.
+ (setDragEnabled): Likewise.
+ (replaceSelection): Reimplemented.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JRootPane.java
+ (NONE): New static field.
+ (FRAME): Likewise.
+ (PLAIN_DIALOG): Likewise.
+ (INFORMATION_DIALOG): Likewise.
+ (ERROR_DIALOG): Likewise.
+ (COLOR_CHOOSER_DIALOG): Likewise.
+ (FILE_CHOOSER_DIALOG): Likewise.
+ (QUESTION_DIALOG): Likewise.
+ (WARNING_DIALOG): Likewise.
+ (defaultButton): New field.
+ (getDefaultButton): New method.
+ (setDefaultButton): Likewise.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/DefaultHighlighter.java
+ (drawsLayeredHighlights): New field.
+ (getDrawsLayeredHighlights): New method.
+ (setDrawsLayeredHighlights): Likewise.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/SpringLayout.java
+ (Constraints): May not be final.
+
+2004-09-26 Mark Wielaard <mark@klomp.org>
+
+ * java/lang/Throwable.java (StaticData.nl): Make package private.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/SpinnerNumberModel.java
+ (SpinnerNumberModel): Implements java.io.Serializable.
+ (serialVersionUID): New field.
+ (SpinnerNumberModel): Added missing @throws tags to javadocs.
+ (getMinimum): New method.
+ (setMinimum): Likewise.
+ (getMaximum): Likewise.
+ (setMaximum): Likewise.
+ (getStepSize): Likewise.
+ (setStepSize): Likewise.
+
+2004-09-26 Kim Ho <kho@redhat.com>
+
+ * javax/swing/plaf/basic/BasicArrowButton.java:
+ Jalopy. Reimplement.
+ * javax/swing/plaf/basic/BasicScrollBarUI.java:
+ Jalopy.
+ (arrowIcon, upIcon, downIcon, leftIcon,
+ rightIcon): Removed.
+ (createIncreaseButton): Use BasicArrowButton.
+ (createDecreaseButton): Ditto.
+ * javax/swing/plaf/basic/BasicSplitPaneDivider.java:
+ (createRightOneTouchButton): Remove button border.
+ (createLeftOneTouchButton): Ditto.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTree.java
+ (ANCHOR_SELECTION_PATH_PROPERTY): New static field.
+ (CELL_EDITOR_PROPERTY): Likewise.
+ (CELL_RENDERER_PROPERTY): Likewise.
+ (EDITABLE_PROPERTY): Likewise.
+ (EXPANDS_SELECTED_PATHS_PROPERTY): Likewise.
+ (INVOKES_STOP_CELL_EDITING_PROPERTY): Likewise.
+ (LARGE_MODEL_PROPERTY): Likewise.
+ (LEAD_SELECTION_PATH_PROPERTY): Likewise.
+ (ROOT_VISIBLE_PROPERTY): Likewise.
+ (ROW_HEIGHT_PROPERTY): Likewise.
+ (SCROLLS_ON_EXPAND_PROPERTY): Likewise.
+ (SELECTION_MODEL_PROPERTY): Likewise.
+ (SHOWS_ROOT_HANDLES_PROPERTY): Likewise.
+ (TOGGLE_CLICK_COUNT_PROPERTY): Likewise.
+ (TREE_MODEL_PROPERTY): Likewise.
+ (VISIBLE_ROW_COUNT_PROPERTY): Likewise.
+ (cellEditor): New field.
+ (invokesStopCellEditing): Likewise.
+ (largeModel): Likewise.
+ (rowHeight): Likewise.
+ (scrollsOnExpand): Likewise.
+ (selectionModel): Likewise.
+ (toggleClickCount): Likewise.
+ (visibleRowCount): Likewise.
+ (setShowsRootHandles): Fixed typo in method name.
+ (getCellEditor): New method.
+ (setCellEditor): Likewise.
+ (getSelectionModel): Likewise.
+ (setSelectionModel): Likewise.
+ (getVisibleRowCount): Likewise.
+ (setVisibleRowCount): Likewise.
+ (isLargeModel): Likewise.
+ (setLargeModel): Likewise.
+ (getRowHeight): Likewise.
+ (setRowHeight): Likewise.
+ (getInvokesStopCellEditing): Likewise.
+ (setInvokesStopCellEditing): Likewise.
+ (getToggleClickCount): Likewise.
+ (setToggleClickCount): Likewise.
+ (getScrollsOnExpand): Likewise.
+ (setScrollsOnExpand): Likewise.
+ * javax/swing/table/DefaultTableColumnModel.java
+ (addColumnModelListener): Fixed javadoc.
+ (removeColumnModelListener): Implemented. Fixed javadoc.
+ (getColumnModelListeners): New method.
+ * javax/swing/table/JTableHeader.java
+ (columnModel): Made protected.
+ (draggedColumn): Likewise.
+ (draggedDistance): Likewise.
+ (reorderingAllowed): Likewise.
+ (resizingAllowed): Likewise.
+ (resizingColumn): Likewise.
+ (table): Likewise.
+ (updateTableInRealTime): Likewise.
+ (createDefaultColumnModel): Renamed from
+ createDefaultTableColumnModel.
+ (setDefaultRenderer): New method.
+ * javax/swing/table/TableColumn.java
+ (getPropertyChangeListeners): New method.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JPasswordField.java:
+ Reformated. Implemented construtors.
+ * javax/swing/plaf/basic/BasicPasswordFieldUI.java
+ (create): New method.
+ * javax/swing/text/PlainView.java
+ (selectedColor): Made package-private to allow access from sub-classes
+ in same package too.
+ (unselectedColor): Likewise.
+ (font): Likewise.
+ (drawSelectedText): Make protected.
+ (drawUnselectedText): Likewise.
+ * javax/swing/text/PasswordView.java: New file.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/DocumentFilter.java
+ (FilterBypass): New inner class.
+ (insertString): New method.
+ (remove): Likewise.
+ (replace): Likewise.
+ * javax/swing/text/NavigationFilter.java
+ (FilterBypass): New inner class.
+ (NavigationFilter): New method.
+ (moveDot): Likewise.
+ (setDot): Likewise.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/SimpleAttributeSet.java
+ (EMPTY): Made public final.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/UIManager.java
+ (get): New method.
+ (getBoolean): Likewise.
+ (getBorder): Likewise.
+ (getColor): Likewise.
+ (getDimension): Likewise.
+ (getFont): Likewise.
+ (getIcon): Likewise.
+ (getInsets): Likewise.
+ (getInt): Likewise.
+ (getString): Likewise.
+
+2004-09-26 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/UIDefaults.java
+ (removePropertyChangeListener): Made public.
+
2004-09-26 Andrew John Hughes <gnu_andrew@member.fsf.org>
* java/lang/Appendable.java
@@ -488,12 +874,844 @@
* java/lang/Thread.java
(UncaughtExceptionHandler): documented.
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JApplet.java:
+ Whitespace fixes.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JApplet.java
+ (rootPaneCheckingEnabled): Renamed from checking.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTable.java
+ (getUI): Javadoc added.
+ (setUI): New method.
+
+2004-09-25 Shashank Bapat <shashankbapat@yahoo.com>
+ Mark Wielaard <mark@klomp.org>
+
+ * gnu/regexp/RE.java (initialize): Add RETokenLookAhead support.
+ * gnu/regexp/RETokenLookAhead.java: New file.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JViewport.java
+ (getUI): New method.
+ (setUI): Likewise.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JScrollPane.java
+ (getUI): New method.
+ (setUI): Likewise.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JMenu.java
+ (getMenuListeners): New method.
+ (fireMenuSelected): Simplified.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JFrame.java
+ Re-formatted a bit and reordered some methods.
+ (rootPaneCheckingEnabled): Renamed from checking.
+ (getPreferredSize): Simplified.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java
+ (isMaximumSizeSet): New method.
+ (isMinimumSizeSet): Likewise.
+ (isPreferredSizeSet): Likewise.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java
+ (JComponent): Added javadoc comment.
+ (setBorder): Fire property change event.
+ (setEnabled): Likewise.
+ (setMaximumSize): Likewise.
+ (setMinimumSize): Likewise.
+ (setPreferredSize): Likewise.
+ (setOpaque): Likewise.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JCheckBox.java
+ (BORDER_PAINTED_FLAT_CHANGED_PROPERTY): New static field.
+
+2004-09-25 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JApplet.java, javax/swing/JFrame.java:
+ Re-indented.
+
+2004-09-24 Andrew Haley <aph@redhat.com>
+
+ * java/security/BasicPermission.java: Don't check wildcards.
+
+2004-09-24 Andrew Haley <aph@redhat.com>
+
+ * java/io/ObjectInputStream.java
+ (readObject): Save and restore this.currentObject and
+ this.currentObjectStreamClass around calls to callReadMethod().
+
+2004-09-24 Andrew Haley <aph@redhat.com>
+
+ * java/io/ObjectOutputStream.java
+ (readObject): Save and restore this.currentObject and
+ this.currentObjectStreamClass around calls to callReadMethod().
+
+2004-09-24 David Daney <ddaney@avtrex.com>
+
+ * java/net/URL.java (URL): Copy userInfo from context.
+ (getUserInfo): Return cached userInfo if present.
+
+2004-09-23 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/table/DefaultTableModel.java: Whitespace cleanup.
+
+2004-09-23 Mark Wielaard <mark@klomp.org>
+
+ * java/awt/Component.java: Whitespace cleanup.
+ * java/awt/Container.java: Likewise.
+ * java/awt/DefaultFocusTraversalPolicy.java: Likewise.
+ * java/awt/DefaultKeyboardFocusManager.java: Likewise.
+ * java/awt/KeyboardFocusManager.java: Likewise.
+
+2004-09-23 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/awt/Demo.java: Add help menu
+ example.
+
+ * include/gnu_java_awt_peer_gtk_GtkButtonPeer.h: Regenerate with gcjh
+ from CVS.
+ * include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkComponentPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkFramePeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkGenericPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkLabelPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkListPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h: Likewise.
+ * include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h: Likewise.
+
+2004-09-23 David Jee <djee@redhat.com>
+
+ PR AWT/17059
+ * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
+ (nativeSetHelpMenu): New native method declaration.
+ (addHelpMenu): Call nativeSetHelpMenu().
+ (addMenu): Remove.
+ * java/awt/MenuBar.java
+ (setHelpMenu): Call addNotify() on the new help menu.
+ (add): Call addNotify() on the new menu.
+ (addNotify): Set the help menu if one exists.
+ * java/awt/peer/MenuBarPeer.java
+ (addMenu): Remove.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+ (nativeSetHelpMenu): New method.
+
+2004-09-23 Mark Wielaard <mark@klomp.org>
+
+ * javax/swing/AbstractButton.java: Whitespace cleanup.
+ * javax/swing/DefaultButtonModel.java: Likewise.
+ * javax/swing/JLabel.java: Likewise.
+ * javax/swing/KeyStroke.java: Likewise.
+ * javax/swing/plaf/basic/BasicButtonListener.java: Likewise.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java: Likewise.
+ * javax/swing/plaf/basic/BasicComboPopup.java: Likewise.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java: Likewise.
+ * javax/swing/plaf/basic/BasicTableUI.java: Likewise.
+ * javax/swing/plaf/basic/BasicTextUI.java: Likewise.
+ * javax/swing/table/DefaultTableCellRenderer.java: Likewise.
+ * javax/swing/text/AbstractDocument.java: Likewise.
+ * javax/swing/text/AttributeSet.java: Likewise.
+ * javax/swing/text/DefaultEditorKit.java: Likewise.
+
+2004-09-23 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/InputVerifier.java:
+ Re-formatted.
+ * javax/swing/JComponent.java
+ (inputVerifier): New property field.
+ (getInputVerifier): New method.
+ (setInputVerifier): Likewise.
+
+2004-09-23 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/DebugGraphics.java:
+ Re-formatted. Fixed some javadocs.
+
+2004-09-23 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/AbstractButton.java:
+ Little re-formatting.
+ (changeEvent): Made protected.
+ (fireStateChanged): Removed argument.
+ (setHorizontalAlignment): Abort method when old value is equal too new
+ value.
+ (setHorizontalTextPosition): Likewise.
+ (setVerticalAlignment): Likewise.
+ (setVerticalTextPosition): Likewise.
+ (setBorderPainted): Likewise.
+ (setIcon): Likewise.
+ (setText): Likewise.
+ (setIconTextGap): Likewise.
+ (setMargin): Likewise.
+ (setPressedIcon): Likewise.
+ (setFocusPainted): Likewise.
+ (setDisabledSelectedIcon): Likewise.
+ (setRolloverIcon): Likewise.
+ (setRolloverSelectedIcon): Likewise.
+ (setSelectedIcon): Likewise.
+ (setContentAreaFilled): Likewise.
+
+2004-09-23 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ComponentSampleModel.java: Add documentation.
+
+2004-09-22 Patrik Reali <reali@acm.org>
+
+ * doc/www.gnu.org/announce/20040913.wml: classpath 0.11 release announce
+ * doc/www.gnu.org/downloads/downloads.wml: classpath 0.11 download added
+ * doc/www.gnu.org/newsitems.txt: classpath 0.11, inetlib 1.1
+
+2004-09-22 David Jee <djee@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
+ (setEnabled): Make it a native method.
+ * java/awt/DefaultKeyboardFocusManager.java
+ (postProcessKeyEvent): Only post event if the menu item
+ is active.
+ * java/awt/MenuItem.java:
+ Private field 'enabled' should be true by default.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+ (setEnabled): New function.
+
+2004-09-22 Jerry Quinn <jlquinn@optonline.net>
+
+ * java/awt/image/ColorModel.java (getDataElement): Implemented.
+ Update javadoc.
+ (getDataElements): Add missing version. Remove bogus version.
+ Update javadoc.
+ * java/awt/image/MultiPixelPackedSampleModel.java: Implement.
+ * java/awt/image/Raster.java
+ (createPackedRaster(int,int,int,int,int,Point)): Implement for
+ bands>1.
+ (getNumBands): Implement.
+ * java/awt/image/SinglePixelPackedSampleModel.java
+ (SinglePixelPackedSampleModel): Throw exception for unsupported
+ datatype.
+
+
+2004-09-22 Olga Rodimina <rodimina@redhat.com>
+
+ * javax/swing/plaf/basic/BasicComboBoxUI.java:
+ (paintCurrentValue): Pass correct parameters to
+ getListCellRendererComponent().
+ (ListDataHandler.intervalRemoved): Implemented.
+ (PropertyChangeHandler.propertyChange): Handle changes in
+ MODEL_CHANGED_PROPERTY of the JComboBox
+ * javax/swing/plaf/basic/BasicComboPopup.java:
+ (BasicComboPopup): Moved code that configures popup to
+ configurePopup() and call it instead.
+ (firePopupMenuWillBecomeVisible): Implemented.
+ (firePopupMenuWillBecomeInvisible): Likewise.
+ (firePopupMenuCanceled): Likewise.
+ (configureList): Set list's visibleRowCount same as
+ comboBox's visibleRowCount.
+ (configurePopup): Implemented.
+ (getPopupHeightForRowCount): Get item's from JComboBox's model and
+ not from model of the JList.
+ (ListMouseMotionHandler.mouseMoved): Implemented.
+ (PropertyChangeHandler.propertyChange): Handles change in the
+ JComboBox's model.
+
+2004-09-22 Kim Ho <kho@redhat.com>
+
+ * javax/swing/colorchooser/DefaultHSBChooserPanel.java:
+ (stateChanged): Only update the image and the track if
+ the values are not being adjusted.
+ (updateChooser): Grab the new mouse point from the
+ spinner values. Update the image and track only if
+ the values are not being adjusted.
+ (getHSBValues): New method.
+ * javax/swing/colorchooser/DefaultRGBChooserPanel.java:
+ (SliderHandler::stateChanged): Changed internalChange
+ to updateChange. Set sliderChange.
+ (SpinnerHandler::stateChanged): Ditto. Set spinnerChange.
+ (spinnerChange): New variable.
+ (sliderChange): Ditto.
+ (updateChange): Renamed from internalChange.
+ (updateChooser): Do not update sliders if the sliders
+ were the original source of the change. Ditto for spinners.
+ * javax/swing/plaf/basic/BasicTabbedPaneUI.java:
+ (mousePress): Don't scroll the JViewport if there will
+ be extra space at the end of the run. Change layout() to
+ revalidate().
+ (calculateSize): Use the component's width/height unless
+ it is smaller than the max tab width/height.
+ (calculateTabRects): Subtract the tab run overlay.
+ (rotateTabRuns): Don't rotate if there's only one run.
+ (layoutContainer): Reuse the viewport point.
+ (createLayoutManager): Set the viewport to use no layout.
+ (paintTabArea): Don't paint the tabs that are not visible
+ to the JViewport.
+ (paintContentBorderTopEdge): Check for scroll tab layout before
+ looking for gap.
+ (paintContentBorderLeftEdge): Ditto.
+ (paintContentBorderBottomEdge): Ditto.
+ (paintContentBorderRightEdge): Ditto.
+
+2004-09-22 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/awt/peer/gtk/GtkClipboard.java,
+ java/awt/datatransfer/Clipboard.java,
+ java/awt/datatransfer/ClipboardOwner.java:
+ Reformated to make it use our coding standard.
+
+2004-09-22 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (setMenuBar): Set menu
+ bar's width.
+ * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (nativeSetHelpMenu):
+ Add FIXME comment.
+ (addHelpMenu): Elide call to nativeSetHelpMenu.
+ * java/awt/Menu.java (isTearOff): Rename to tearOff.
+ (menuSerializedDataVersion): Initialize to 1.
+ (separatorLabel): Mark transient.
+ (insert(MenuItem,int)): Implement.
+ * java/awt/MenuBar.java (setHelpMenu): Call getPeer to retrieve
+ peer.
+ (countMenus): Count help menu.
+ * java/awt/MenuItem.java: Remove event mask FIXME.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+ (gtkWidgetModifyFont): Only set font if label is non-NULL.
+ (setLabel): Don't treat "-" specially.
+
+2004-09-22 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java (gtkWidgetSetFont):
+ Rename ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
+ (setMenuBarWidth): New method.
+ (setBounds): Set the menu bar width.
+ (postConfigureEvent): Set the menu bar width if the window's
+ width has changed.
+ * gnu/java/awt/peer/gtk/GtkMenuBarPeer.java (GtkMenuBarPeer):
+ Don't call create.
+ (setFont): New method.
+ * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java (create): New
+ method.
+ (setFont): Likewise.
+ (GtkMenuComponentPeer): Call create and setFont.
+ * gnu/java/awt/peer/gtk/GtkMenuItemPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+ (connectSignals): Make package private.
+ (gtkWidgetModifyFont): New method.
+ (create): Likewise.
+ (GtkMenuItemPeer): Don't call create.
+ (setFont): New method.
+ * java/awt/CheckboxMenuItem.java (addNotify): Fix peer == null
+ condition.
+ * java/awt/Container.java (validateTree): Fix comment typos.
+ * java/awt/MenuComponent.java (getFont): Return parent's font if
+ our font is null.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
+ (create): Remove call to deprecated
+ gtk_check_menu_item_set_show_toggle function.
+
+2004-09-22 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java:
+ (gtkFixedMove): Remove method.
+
+2004-09-22 Thomas Fitzsimmons <fitzsim@redhat.com>
+
+ * Makefile.am (gtk_c_source_files): Add
+ gnu_java_awt_peer_gtk_GtkFramePeer.c.
+ * Makefile.in: Regenerate.
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (getClipBounds): Remove
+ comment.
+ * gnu/java/awt/peer/gtk/GtkButtonPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+ (create): Pack GtkButton in GtkEventBox.
+ (connectJObject): Remove.
+ (focus_in_cb): New function.
+ (focus_out_cb): Likewise.
+ (connectSignals): Connect focus-in-event and focus-out-event
+ signals.
+ (gtkSetFont): Rename to ...
+ (gtkWidgetModifyFont): New method.
+ (gtkWidgetRequestFocus): New method.
+ * gnu/java/awt/peer/gtk/GtkCheckboxPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+ (gtkSetFont): Rename to ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkComponentPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+ (isInRepaint): New field.
+ (gtkSetFont): Remove method.
+ (addExposeFilter): Likewise.
+ (removeExposeFilter): Likewise.
+ (gtkWidgetQueueDrawArea): Rename to ...
+ (gtkWidgetRepaintArea): New method.
+ (beginNativeRepaint): New method.
+ (endNativeRepaint): New method.
+ (setComponentBounds): Move implementation here from
+ GtkComponentPeer.
+ (paint): Remove implementation.
+ (repaint): Wrap call to gtkWidgetRepaintArea with calls to
+ beginNativeRepaint and endNativeRepaint.
+ (setBounds): Use menu bar height in bounds calculation.
+ (postExposeEvent): Only post paint event if we're not doing a
+ native repaint.
+ (gtkWidgetSetParent): Replace gtk_layout_put with gtk_fixed_put.
+ (setNativeBounds): Replace gtk_layout_move with gtk_fixed_move.
+ (find_gtk_layout): Remove function.
+ (filter_expose_event_handler): Likewise.
+ * gnu/java/awt/peer/gtk/GtkDialogPeer.java (postExposeEvent):
+ Likewise.
+ * gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+ (setComponentBounds): Call GtkComponentPeer's
+ setComponentBounds.
+ * gnu/java/awt/peer/gtk/GtkFramePeer.java (getMenuBarHeight):
+ New method.
+ (moveLayout): Rename to ...
+ (gtkFixedMove): New method.
+ (gtkLayoutSetVisible): Rename to ...
+ (gtkFixedSetVisible): New method.
+ (setMenuBar): Rearrange, to make the three separate cases
+ clearer.
+ (postExposeEvent): Only post paint event if we're not doing a
+ native repaint.
+ * gnu/java/awt/peer/gtk/GtkGenericPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkImagePainter.java
+ (GtkImagePainter(GtkImage,GdkGraphics,int,int,int,int,Color)):
+ Call run directly, rather than spawning a new thread.
+ (GtkImagePainter(GtkImage,GdkGraphics,int,int,int,int,int,int,int,int,Color)):
+ Likewise.
+ * gnu/java/awt/peer/gtk/GtkLabelPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c (gtkSetFont):
+ Rename to ...
+ (gtkWidgetModifyFont): New method.
+ (create): Rename ebox to eventbox.
+ * gnu/java/awt/peer/gtk/GtkListPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c (gtkSetFont):
+ Rename to ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+ (GtkMenuComponentPeer): Set the default font.
+ * gnu/java/awt/peer/gtk/GtkTextAreaPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+ (gtkSetFont): Rename to ...
+ (gtkWidgetModifyFont): New method.
+ * gnu/java/awt/peer/gtk/GtkTextFieldPeer.java,
+ jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c: Likewise.
+ * java/awt/Component.java (locale): Initialize to default
+ locale.
+ * java/awt/Container.java (invalidateTree): Make
+ package-private.
+ (paint): Paint self first.
+ (setMenuBar): Call invalidateTree.
+ * java/awt/Panel.java (dispatchEventImpl): Remove method.
+ * java/awt/Window.java (show): Call no-parameter variant of
+ requestFocusInWindow.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c (initState):
+ Remove special case for window widget.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+ (grab_current_drawable): Likewise.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
+ (create): Replace GtkLayout with GtkFixed.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+ (pre_event_handler): Remove special cases for GDK_EXPOSE events.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c: New file.
+ Move all GtkFramePeer native method implementations here from
+ gnu_java_awt_peer_gtk_GtkWindowPeer.c.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c (create):
+ Replace GtkLayout with GtkFixed.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+ (find_layout): Remove function.
+ (create): Replace GtkLayout with GtkFixed.
+ (connectSignals): Remove find_layout call.
+ (toBack): Replace XFlush with gdk_flush.
+ (toFront): Replace XFlush with gdk_flush.
+ Move GtkFramePeer native method implementations to
+ gnu_java_awt_peer_gtk_GtkFramePeer.c.
+ * jni/gtk-peer/gtkpeer.h: Remove declaration of find_gtk_layout.
+
+2004-09-22 Michael Koch <konqueror@gmx.de>
+
+ * native/jni/gtk-peer/Makefile.am:
+ Added new file gnu_java_awt_peer_gtk_GtkFramePeer.c.
+
+2004-09-21 Mark Wielaard <mark@klomp.org>
+
+ * vm/reference/java/util/VMTimeZone.java
+ (getDefaultTimeZoneId): Remove debug output.
+
+2004-09-21 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #10447
+ * java/util/Collections.java
+ (binarySearch(List, Object, Comparator): Explicitly reverse direction
+ in list iterator.
+
+2004-09-21 Michael Koch <konqueror@gmx.de>
+
+ * java/applet/Applet.java,
+ java/applet/AppletContext.java,
+ java/applet/AppletStub.java,
+ java/applet/AudioClip.java:
+ Jalopied and checkstyle clean.
+
+2004-09-21 Michael Koch <konqueror@gmx.de>
+
+ * scripts/jalopy-gnu.xml: throws clauses have to be indented by
+ two spaces.
+
+2004-09-21 Michael Koch <konqueror@gmx.de>
+
+ * scripts/checkstyle-config.xml:
+ Enabled check for ordered import statements.
+ * scripts/jalopy-gnu.xml:
+ Fix grouping of import statements.
+
+2004-09-21 Michael Koch <konqueror@gmx.de>
+
+ * scripts/jalopy-gnu.xml: Converted to use Unix-style EOL.
+
+2004-09-21 Michael Koch <konqueror@gmx.de>
+
+ * javax/crypto/package.html,
+ javax/crypto/interfaces/package.html,
+ javax/crypto/spec/package.html,
+ javax/net/package.html,
+ javax/net/ssl/package.html,
+ javax/security/package.html,
+ javax/security/auth/package.html,
+ javax/security/auth/callback/package.html,
+ javax/security/auth/login/package.html,
+ javax/security/cert/package.html,
+ javax/security/sasl/package.html:
+ New files for package documentation.
+
+2004-09-20 Michael Koch <konqueror@gmx.de>
+
+ * java/net/Socket.java
+ (getLocalAddress): Return InetAddress.ANY_IF if not bound yet.
+
+2004-09-20 Michael Koch <konqueror@gmx.de>
+
+ * scripts/checkstyle-config.xml,
+ scripts/checkstyle-header.regex,
+ scripts/checkstyle-suppressions.xml:
+ New files to check GNU classpath with checkstyle.
+
+2004-09-20 Tom Tromey <tromey@redhat.com>
+
+ * .settings/org.eclipse.core.resources.prefs: New file.
+ * .classpath: Updated.
+
+2004-09-20 Tom Tromey <tromey@redhat.com>
+
+ * scripts/jalopy-gnu.xml: New file.
+
+2004-09-20 Michael Koch <konqueror@gmx.de>
+
+ * javax/net/ssl/SSLServerSocket.java:
+ Removed comment about "Do not edit this file, it's generated.".
+
+2004-09-20 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/StackTraceElement.java
+ (className): Renamed field to declaringClass to be compatible
+ with Sun serialization format.
+
+2004-09-20 Ilya Perminov <iperminov@logicalsoft.com>
+
+ * gnu/java/rmi/server/UnicastServer.java
+ (incomingMessageCall): Added code to handle Errors.
+ * gnu/java/rmi/server/UnicastServerRef.java
+ (incomingMessageCall): Added code to handle Errors.
+
+2004-09-20 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/protocol/file/Handler.java
+ (openConnection): Clarified comment.
+
+2004-09-20 Jeroen Frijters <jeroen@frijters.net>
+
+ * javax/swing/JInternalFrame.java
+ (CONTENT_PANE_PROPERTY,FRAME_ICON_PROPERTY,GLASS_PANE_PROPERTY,
+ IS_CLOSED_PROPERTY,IS_ICON_PROPERTY,IS_MAXIMUM_PROPERTY,
+ IS_SELECTED_PROPERTY,LAYERED_PANE_PROPERTY,MENU_BAR_PROPERTY,
+ ROOT_PANE_PROPERTY,TITLE_PROPERTY): Made final as per API spec.
+ * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+ (CLOSE_CMD,ICONIFY_CMD,MAXIMIZE_CMD,MOVE_CMD,RESTORE_CMD,SIZE_CMD):
+ Made final as per API spec.
+
+2004-09-19 Tom Tromey <tromey@redhat.com>
+
+ * java/lang/ClassLoader.java (loadedClasses): Declare as HashMap.
+ (definedPackages): Likewise.
+
+2004-09-19 Mark Wielaard <mark@klomp.org>
+
+ * java/util/Collections.java (rotate): Just return when list is empty.
+
+2004-09-19 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #10383 reported by Ilya Perminov.
+ * java/util/TreeMap.java (root): Don't initialize.
+ (TreeMap(Comparator)): Call fabricateTree(0).
+ (fabricateTree): Initialize root and size when count is 0.
+
+2004-09-18 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Set version to 0.11+cvs.
+
2004-09-18 Tom Tromey <tromey@redhat.com>
* java/lang/annotation/Retention.java: Documented.
* java/lang/annotation/RetentionPolicy.java: Documented.
* java/lang/StringBuilder.java: Updated documentation.
+2004-09-17 Tom Tromey <tromey@redhat.com>
+
+ * vm/reference/java/lang/VMProcess.java (ProcessThread): Added
+ explicit constructor.
+
+2004-09-17 Dalibor Topic <robilad@kaffe.org>
+
+ * java/awt/Component.java (postEvent):
+ Only delegate to parent if a parent exists.
+
+ Reported by: Stephane Meslin-Weber <steph@tangency.co.uk>
+
+2004-09-17 Sven de Marothy <sven@physto.se>
+
+ * java/nio/ByteBuffer.java:
+ (hashCode): Implemented.
+ * java/nio/CharBuffer.java:
+ * java/nio/DoubleBuffer.java:
+ * java/nio/FloatBuffer.java:
+ * java/nio/LongBuffer.java:
+ * java/nio/IntBuffer.java:
+ * java/nio/ShortBuffer.java:
+ Likewise.
+
+2004-09-13 Mark Wielaard <mark@klomp.org>
+
+ * NEWS: Set release date.
+ * configure.ac: Set version to 0.11. Add java/util/logging/Makefile.
+
+ * java/util/logging/logging.properties: Removed.
+ * resource/java/util/Makefile.am (SUBDIRS): Add logging.
+ * resource/java/util/logging/Makefile.am: Added.
+ * resource/java/util/logging/logging.properties: Added.
+
+2004-09-12 Tom Tromey <tromey@redhat.com>
+
+ * javax/naming/CompoundName.java (CompoundName): Don't check for
+ separator in "flat" case.
+
+2004-09-11 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/MenuComponent.java
+ (newEventsOnly): added additional serialization
+ comment
+
+2004-09-11 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/Component.java
+ (translateEvent): made static with package access
+ rather than private
+ * java/awt/MenuBar.java
+ Added documentation
+ (getAccessibleContext()): implemented
+ (AccessibleAWTMenuBar): new class
+ (AccessibleAWTMenuBar()): new constructor
+ (getAccessibleRole()): implemented
+ * java/awt/MenuComponent.java
+ (accessibleContext, newEventsOnly, nameExplicitlySet,
+ focusHandler): new variables
+ (setName(String)): adding setting of nameExplicitlySet
+ (dispatchEventImpl(java.awt.AWTEvent)): converts 1.1 events
+ to 1.0
+ (processEvent): added focus handling for accessible component
+ (getAccessibleContext()): implemented
+ (AccessibleAWTMenuComponent): new class
+ (AccessibleAWTMenuComponent()): new constructor
+ (addAccessibleSelection(int)): stub for subclasses
+ (addFocusListener(java.awt.event.FocusListener)): implemented
+ (clearAccessibleSelection()): stub for subclasses
+ (contains(java.awt.Point)): implemented against getBounds()
+ (getAccessibleAt(java.awt.Point)): stub for subclasses
+ (getAccessibleChild(int)): stub for subclasses
+ (getAccessibleChildrenCount()): stub for subclasses
+ (getAccessibleComponent()): implemented
+ (getAccessibleDescription()): implemented
+ (getAccessibleIndexInParent()): implemented
+ (getAccessibleName()): implemented
+ (getAccessibleParent()): implemented
+ (getAccessibleRole()): implemented
+ (getAccessibleSelection()): implemented
+ (getAccessibleSelection(int)): stub for subclasses
+ (getAccessibleSelectionCount()): stub for subclasses
+ (getAccessibleStateSet()): implemented
+ (getBackground()): implemented
+ (getBounds()): stub for subclasses
+ (getCursor()): implemented
+ (getFont()): implemented
+ (getFontMetrics(java.awt.Font)): implemented
+ (getForeground()): implemented
+ (getLocale()): implemented
+ (getLocation()): implemented against getBounds()
+ (getLocationOnScreen()): stub for subclasses
+ (getSize()): implemented against getBounds()
+ (isAccessibleChildSelected(int)): stub for subclasses
+ (isEnabled()): stub for subclasses
+ (isFocusTraversable()): stub for subclasses
+ (isShowing()): stub for subclasses
+ (isVisible()): stub for subclasses
+ (removeAccessibleSelection(int)): stub for subclasses
+ (removeFocusListener(java.awt.event.FocusListener)): implemented
+ (selectAllAccessibleSelection()): implemented against addAccessibleSelection(int)
+ (setBackground(java.awt.Color)): stub for subclasses
+ (setBounds(java.awt.Rectangle)): stub for subclasses
+ (setCursor(java.awt.Cursor)): stub for subclasses
+ (setEnabled(boolean)): stub for subclasses
+ (setFont(java.awt.Font)): implemented
+ (setForeground(java.awt.Color)): stub for subclasses
+ (setLocation(java.awt.Point)): implemented against setBounds()
+ (setSize(java.awt.Dimension)): implemented against setBounds()
+ (setVisible(boolean)): stub for subclasses
+
+2004-09-10 Bryce McKinlay <mckinlay@redhat.com>
+
+ * gnu/java/net/protocol/file/Connection.java
+ (dateFormat): New static field.
+ (getHeaderField): Implemented.
+
+2004-09-10 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/protocol/file/Connection.java
+ (exists): Removed.
+ (isDirectory): Likewise.
+ (getListing): Likewise.
+
+2004-09-09 Mark Wielaard <mark@klomp.org>
+
+ Fixes bug #8991.
+ * java/net/URLConnection.java (getContent): Add support for
+ explicit mime types. Call getInputStream() if no handler found.
+ * gnu/java/net/content/text/plain.java: Removed
+
+2004-09-09 Casey Marshall <csm@gnu.org>
+
+ * java/io/ObjectInputStream.java (callReadMethod): re-throw
+ `ClassNotFoundException'.
+
+2004-09-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/SystemColor.java: Fix @link doc entries.
+
+2004-09-09 David Gilbert <david.gilbert@object-refinery.com>
+
+ * java/awt/image/DataBuffer.java: Update API documentation.
+ * java/awt/image/DataBufferByte.java: Likewise.
+ * java/awt/image/DataBufferDouble.java: Likewise.
+ * java/awt/image/DataBufferFloat.java: Likewise.
+ * java/awt/image/DataBufferInt.java: Likewise.
+ * java/awt/image/DataBufferShort.java: Likewise.
+ * java/awt/image/DataBufferUShort.java: Likewise.
+
+2004-09-09 Mark Wielaard <mark@klomp.org>
+
+ * NEWS: Mention JColorChooser, JComboBox and JTextField addition.
+ Set release date.
+
+2004-09-09 Mark Wielaard <mark@klomp.org>
+
+ * LICENSE: Reindent. List examples and all external libraries
+ distributed together with GNU Classpath.
+ * examples/README: Fix is/are as indicated by FSF legal.
+
+2004-09-09 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/protocol/file/Connection.java
+ (lineSeparator): Made non-final.
+ (static): Removed.
+ (connect): Initialize lineSeparator lazily. Use ByteArrayInputStream
+ instead of StringBufferInputStream.
+
+2004-09-09 Michael Koch <konqueror@gmx.de>
+
+ * gnu/java/net/protocol/file/Connection.java
+ (connect): Handle file is a directory case.
+
+2004-09-08 Sven de Marothy <sven@physto.se>
+
+ Patch from David Gilbert <david.gilbert@object-refinery.com>:
+ * java/awt/AWTEventMulticaster.java:
+ Fix a big number of documentation errors.
+ * java/awt/Adjustable.java
+ * java/awt/Point.java
+ * java/awt/Polygon.java
+ * java/awt/Rectangle.java
+ * java/awt/Shape.java
+ * java/awt/geom/Area.java
+ * java/awt/geom/Ellipse2D.java
+ * java/awt/geom/PathIterator.java
+ * java/awt/geom/Point2D.java
+ * java/awt/geom/Rectangle2D.java
+ * java/lang/Comparable.java
+ * java/util/Arrays.java:
+ Likewise. Thank you David!
+
+2004-09-07 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/doc-files/Area-1.png:
+ Graphics for Area documentation. New file.
+
+ * java/awt/geom/doc-files/Ellipse-1.png:
+ Graphics for Ellipse2D documentation. New file.
+
+ * java/awt/geom/doc-files/GeneralPath-1.png:
+ Graphics for GeneralPath documentation. New file.
+
+ * java/awt/geom/Arc2D.java:
+ (intersects): Fix: Now checks the arc segment.
+ (contains): Cleaned up.
+
+ * java/awt/geom/Area.java:
+ (isRectangular): Should return true on an empty path.
+ (equals): Check for null.
+ (rayIntersects): Fix insideness-test
+
+ * java/awt/geom/CubicCurve2D.java:
+ Fix insideness-test to comply with the correct behavior on edges
+ * java/awt/geom/GeneralPath.java:
+ Likewise
+ * java/awt/geom/QuadCurve2D.java:
+ Likewise
+
+2004-09-07 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/util/TimeZone.java
+ (getDefaultTimeZone): Fixed test to distinguish between hours and
+ minutes in specified timezone.
+
2004-09-07 Tom Tromey <tromey@redhat.com>
* java/lang/SuppressWarnings.java: Document.
@@ -505,18 +1723,688 @@
* java/lang/Override.java: Documented.
* java/lang/Deprecated.java: Documented.
+2004-09-06 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * java/awt/Canvas.java
+ (AccessibleAWTCanvas): added serialization UID
+ * java/awt/Label.java
+ (AccessibleAWTLabel): added serialization UID
+ * java/net/Inet4Address.java
+ (Inet4Address): added comment to serialization UID
+ * java/text/Format.java
+ (Format): added comment to serialization UID
+ * javax/rmi/CORBA/Stub.java
+ (Stub): added serialization UID
+ * javax/security/auth/PrivateCredentialPermission.java
+ (PrivateCredentialPermission): added serialization UID
+ * javax/swing/JRootPane.java
+ (AccessibleJRootPane): added comment to existing UID
+ * javax/swing/JSpinner.java
+ (DefaultEditor): added serialization UID
+ (NumberEditor): added serialization UID
+ * javax/swing/SpinnerListModel.java
+ (SpinnerListModel): added serialization UID
+ * javax/swing/SpinnerNumberModel.java
+ (SpinnerNumberModel): added serialization UID
+ * javax/swing/text/html/HTML.java
+ (UnknownTag): added serialization UID
+ * org/ietf/jgss/GSSException.java
+ (GSSException): added serialization UID
+
+2004-09-06 Jeroen Frijters <jeroen@frijters.net>
+
+ * java/lang/Runtime.java
+ (load): Added link security check.
+ (loadLib): Changed link security check to read check.
+ (loadLibrary): Added link security check and throw if ClassLoader
+ supplied library doesn't exist.
+
+2004-09-06 Jeroen Frijters <jeroen@frijters.net>
+
+ * gnu/java/io/EncodingManager.java
+ (decoder_cons): Removed.
+ (encoder_cons): Removed.
+ (getSystemProperty): New method. Replaced all direct calls to
+ System.getProperty with calls to this new helper that goes
+ via AccessController.doPrivileged.
+ (findDecoderConstructor): Removed unused caching support.
+ (findEncoderConstructor): Removed unused caching support.
+ (getDecoder(String,boolean)): Removed unused method.
+ (getDecoder(InputStream)): Added exception chaining.
+ (getDecoder(InputStream,String,boolean)): Removed unused method.
+ (getEncoder(String,boolean)): Removed unused method.
+ (getEncoder(OutputStream)): Added exception chaining.
+ (getEncoder(OutputStream,String,boolean)): Removed unused method.
+ (getEncoder(OutputStream,String)): Added exception chaining.
+
+2004-09-05 Andrew John Hughes <gnu_andrew@member.fsf.org>
+
+ * javax/swing/AbstractButton.java
+ Fixed a typo.
+ * javax/swing/JToggleButton.java
+ Added missing documentation.
+ (AccessibleJToggleButton): new inner class
+ (AccessibleJToggleButton()): new constructor
+ (getAccessibleRole()): new method
+ (itemStateChanged(ItemEvent)): new method
+ (JToggleButton(Icon, boolean)): new constructor
+ (getAccessibleContext()): implemented
+ (updateUI()): style cleanup
+ * javax/swing/JRadioButton.java
+ Added missing documentation.
+ (AccessibleJRadioButton): new inner class
+ (AccessibleJRadioButton()): new constructor
+ (getAccessibleRole()): new method
+ (JRadioButton(Icon, boolean)): new constructor
+ (JRadioButton(String, boolean)): new constructor
+ (JRadioButton(String, Icon, boolean)): new constructor
+ (getAccessibleContext()): implemented
+ (updateUI()): new method
+
+2004-09-05 Mark Wielaard <mark@klomp.org>
+
+ * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+ (setChars): Only call pango_itemize() when vec->glyphitems != NULL.
+ Only call pango_shape() when gi->glyphs->num_glyphs > 0.
+
+2004-09-05 Mark Wielaard <mark@klomp.org>
+
+ * gnu/java/awt/peer/gtk/GdkGraphics.java (setColor): Use
+ Color.BLACK if c == null, don't create new Color object each time.
+ * gnu/java/awt/peer/gtk/GdkGraphics2D.java (comp): New private
+ field.
+ (setColor): Use Color.BLACK when argument null.
+ (setComposite): Set this.comp field.
+ (getComposite): Return this.comp, or AlphaComposite.SrcOver when null.
+ (DrawState.comp): New private field.
+ (DrawState.save): Save Composite.
+ (DrawState.restore): Restore comp field.
+ * java/awt/FontMetrics.java (gRC): New static final private field.
+ (getLineMetrics(String, Graphics)): New method.
+ (getLineMetrics(String, int, int, Graphics)): Likewise.
+ (getLineMetrics(char[], int, int, Graphics)): Likewise.
+ (getLineMetrics(CharacterIterator, int, int, Graphics)): Likewise.
+ * javax/swing/JMenu.java (JMenu(String, boolean)): Ignore tearoff
+ argument. PR SWING/17294.
+ * javax/swing/plaf/basic/BasicGraphicsUtils.java (): Always use
+ the fall-back code since none of the TextArea methods are really
+ implemented now. PR SWING/17296.
+ * jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+ (GdkGlyphVector_setChars): Replace assert() with if block when
+ pango_itemize() returns null. PR AWT/17295.
+ (GdkGlyphVector_allInkExtents): Likewise when vec->glyphitems is null.
+
+2004-09-05 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (mkComboBox):
+ New method.
+
+2004-09-05 Olga Rodimina <rodimina@redhat.com>
+
+ * javax/swing/ComboBoxEditor.java: Added javadocs.
+ * javax/swing/ComboBoxModel.java: Likewise.
+ * javax/swing/DefaultComboBoxModel.java: Implemented.
+ * javax/swing/DefaultListCellRenderer.java: Added javadocs
+ and ran through jalopy to fix formatting style.
+ (getListCellRendererComponent): Use appropriate border
+ if renderer has focus and use noFocusBorder when it doesn't.
+ * javax/swing/JComboBox.java: Implemented.
+ * javax/swing/JList.java:
+ (locationToIndex): New Method. Implemented.
+ (indexToLocation): New Method.
+ * javax/swing/JPopupMenu.java:
+ (visible): New field.
+ (isVisible): Changed to use new field above.
+ (setVisible): Likewise.
+ * javax/swing/MutableComboBoxModel.java: Added javadocs.
+ * javax/swing/plaf/basic/BasicArrowButton.java:
+ (shadow): Changed default color to Color.gray.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java: New File.
+ UI delegate for JComboBox.
+ * javax/swing/plaf/basic/BasicComboPopup.java: New File.
+ Popup menu containing list of JComboBox's items.
+ * javax/swing/plaf/basic/BasicComboBoxEditor.java: New File.
+ * javax/swing/plaf/basic/BasicComboBoxRenderer.java: New File.
+ * javax/swing/plaf/basic/BasicComboBoxUI.java: New File.
+ * javax/swing/plaf/basic/BasicComboPopup.java: New File.
+ * javax/swing/plaf/basic/BasicPopupMenuUI.java:
+ (popupMenuWillBecomeVisible): Set selected path to the first
+ element only if it is of type MenuElement. Also fix formatting
+ style.
+ * javax/swing/plaf/basic/ComboPopup.java: Added javadocs and missing
+ methods signatures.
+
+2004-09-04 Tom Tromey <tromey@redhat.com>
+
+ * java/awt/dnd/package.html: Fixed typo.
+
+2004-09-04 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/Box.java: Fix setting of layout in ctor.
+ * javax/swing/JScrollPane.java: Scroll headers as well.
+ * javax/swing/JTable.java: Reimplement.
+ * javax/swing/JViewPort.java: Only add non-null children.
+ * javax/swing/ScrollPaneLayout.java: Correct header calculations.
+ * javax/swing/Timer.java: Fix stopping null waker.
+ * javax/swing/plaf/basic/BasicTableHeaderUI.java: New file.
+ * javax/swing/plaf/basic/BasicTableUI.java: New file.
+ * javax/swing/table/DefaultTableCellRenderer.java: Configure.
+ * javax/swing/table/DefaultTableColumnModel.java: Flesh out.
+ * javax/swing/table/DefaultTableModel.java: Clean up.
+ * javax/swing/table/JTableHeader.java: Implement.
+
+2004-09-04 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/DefaultButtonModel.java:
+ Skip group notification when no group is set.
+
+2004-09-04 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/JComponent.java
+ (resetKeyboardActions): Add null checks.
+
+2004-09-04 Mark Wielaard <mark@klomp.org>
+
+ * examples/gnu/classpath/examples/swing/Demo.java (mkColorChooser):
+ New method.
+
+2004-09-04 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/JColorChooser.java:
+ Make a couple inner classes static, for jikes.
+
+2004-09-04 Kim Ho <kho@redhat.com>
+
+ * java/awt/Color.java: Fix documentation.
+ (RGBtoHSB): Use floats for conversions.
+ * javax/swing/ButtonGroup.java: Run Jalopy.
+ (setSelected): Reimplement.
+ * javax/swing/DefaultButtonModel.java: Run Jalopy.
+ (changeState): Let ButtonGroup know that the button
+ is changing state.
+ * javax/swing/JColorChooser.java: Implement.
+ * javax/swing/JLabel.java: Run Jalopy.
+ * javax/swing/JSpinner.java: Run Jalopy.
+ (setValue): New method.
+ * javax/swing/JTabbedPane.java: Run Jalopy.
+ (removeTabAt): Call correct remove method.
+ * javax/swing/SpinnerNumberModel.java: Run Jalopy.
+ (getPreviousValue): Compare minimum value.
+ * javax/swing/Timer.java: Run Jalopy.
+ (run): Comment out println.
+ * javax/swing/ToolTipManager.java:
+ (mouseMoved): Get new tooltip text for location.
+ * javax/swing/colorchooser/AbstractColorChooserPanel.java:
+ Jalopy and Javadoc.
+ * javax/swing/colorchooser/ColorChooserComponentFactory.java:
+ Implement.
+ * javax/swing/colorchooser/DefaultColorSelectionModel.java:
+ Run Jalopy.
+ (setSelectedColor): Fire ChangeEvent.
+ * javax/swing/colorchooser/DefaultHSBChooserPanel.java:
+ New file. Implement.
+ * javax/swing/colorchooser/DefaultPreviewPanel.java:
+ Ditto.
+ * javax/swing/colorchooser/DefaultRGBChooserPanel.java:
+ Ditto.
+ * javax/swing/colorchooser/DefaultSwatchChooserPanel.java:
+ Ditto.
+ * javax/swing/plaf/basic/BasicArrowButton.java:
+ (getArrow): Fix size of upward pointing button.
+ * javax/swing/plaf/basic/BasicColorChooserUI.java:
+ Implement.
+ * javax/swing/plaf/basic/BasicSliderUI.java:
+ (getWidthOfWidestLabel): Use preferred dimensions.
+ (getHeightOfTallestLabel): Ditto.
+ * javax/swing/plaf/basic/BasicSpinnerUI.java:
+ Run Jalopy.
+ (mousePressed): Disable changes to spinner if it is not enabled.
+
+2004-09-04 Tom Tromey <tromey@redhat.com>
+
+ * java/io/DeleteFileHelper.java (DeleteFileHelper): No longer
+ public.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JTextArea.java
+ (lineWrap): Renamed from "wrapping".
+ (wrapStyleWord): NEw field.
+ (getLineWrap): Re-edited javadoc comment.
+ (setLineWrap): Likewise.
+ (getWrapStyleWord): New method.
+ (setWrapStyleWord): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicTextAreaUI.java
+ (create): New method.
+ * javax/swing/text/DefaultHighlighter.java
+ (DefaultHighlightPainter.debugRect): Removed.
+ * javax/swing/text/StyleContext.java
+ (DEFAULT_STYLE): New field.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (initComponentDefaults): Add keybindings for selection.backward and
+ selection-forward for text components.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (paintSafely): Paint highlight only when something is actually
+ selected.
+ * javax/swing/text/DefaultCaret.java
+ (handleHighlight): New method.
+ (setSelectionVisible): Don't do anything when nothing changes.
+ Handle highlight.
+ (moveDot): Reimplemented. Handle highlight.
+ (setDot): Set mark too. Handle highlight.
+ (getSelectionPainter): New method.
+ * javax/swing/text/DefaultEditorKit.java
+ (defaultActions): Added new actions for text selection.
+ * javax/swing/text/DefaultHighlighter.java
+ (DefaultHighlightPainter): New inner class.
+ (DefaultPainter): New field.
+ (paint): Implemented.
+ * javax/swing/text/PlainView.java
+ (paint): Don't draw background here again.
+ * javax/swing/text/Utilities.java
+ (getTabbedTextWidth): Use width of ' ' instead of 'm' for tabsize.
+ (drawTabbedText): Likewise.
+
+2004-09-04 Graydon Hoare <graydon@redhat.com>
+
+ * java/awt/Component.java
+ (isFocusTraversable): Predicate on isLightweight()
+ (setFocusable): Set isFocusTraversableOverridden.
+ (requestFocus): Predicate peer dispatch on !isLightweight()
+ (requestFocusInWindow): Likewise.
+ (dispatchEventImpl): Coordinate with KeyboardFocusManager.
+ * java/awt/Container.java
+ (dispatchEventImpl): Predicate on event mask.
+ (LightweightDispatcher): Remove focus machinery.
+ * java/awt/DefaultFocusTraversalPolicy.java
+ (accept): Expand predicate to include isFocusable().
+ * java/awt/DefaultKeyboardFocusManager.java:
+ Globally change c.dispatchEvent(e) to redispatchEvent(c,e)
+ * java/awt/KeyboardFocusManager.java
+ (redispatchEvent): Synchronize on event to prevent feedback.
+ * javax/swing/AbstractButton.java
+ (ButtonFocusListener): Remove class.
+ (init): Set focusPainted, focusable.
+ * javax/swing/ActionMap.java (get): Check parent for null.
+ * javax/swing/InputMap.java (get): Likewise.
+ * javax/swing/JComponent.java
+ (inputMap_whenFocused): New InputMap.
+ (inputMap_whenAncestorOfFocused): Likewise.
+ (inputMap_whenInFocusedWindow): Likewise.
+ (getActionForKeyStroke): Rewrite.
+ (getConditionForKeystroke): Likewise.
+ (ActionListenerProxy): New private class.
+ (setInputMap): Implement.
+ (getInputMap): Likewise.
+ (setActionMap): Likewise.
+ (getActionMap): Likewise.
+ (processComponentKeyEvent): New empty method.
+ (processKeyEvent): Implement.
+ (processKeyBinding): Likewise.
+ (resetKeyboardActions): Rewrite.
+ * javax/swing/KeyStroke.java: Rewrite.
+ * javax/swing/SwingUtilities.java
+ (notifyAction): Implement.
+ (replaceUIActionMap): Likewise.
+ (replaceUIInputMap): Likewise.
+ * javax/swing/plaf/basic/BasicButtonListener.java
+ (focusGained): Implement.
+ (focusLost): Repaint if focusPainted().
+ (installKeyboardActions): Install pressed / released actions.
+ (uninstallKeyboardActions): Implement.
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (focusColor): New field.
+ (installDefaults): Load focus color, install input map.
+ (installKeyboardActions): Implement.
+ (uninstallKeyboardActions): Likewise.
+ (paintFocus): Rewrite.
+ * javax/swing/plaf/basic/BasicLookAndFeel.java
+ (Button.focus): New default, midPurple.
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (kit): Make static.
+ (installUI): Get doc from kit, load defaults.
+ (getKeymapName): Implement.
+ (createKeymap): Likewise.
+ (installKeyboardActions): Likewise.
+ (getInputMap): Likewise.
+ (getActionMap): Likewise.
+ (createActionMap): Likewise.
+ * javax/swing/text/AbstractDocument.java
+ (getStartPosition): Implement.
+ (getEndPosition): Likewise.
+ * javax/swing/text/DefaultEditorKit.java
+ (CopyAction): New class.
+ (CutAction): Likewise.
+ (DefaultKeyTypedAction): Likewise.
+ (InsertBreakAction): Likewise.
+ (InsertContentAction): Likewise.
+ (InsertTabAction): Likewise.
+ (PasteAction): Likewise.
+ (defaultActions): New static table.
+ (createCaret): Implement.
+ (getActions): Likewise.
+ * javax/swing/text/JTextComponent.java
+ (KeymapWrapper): New private class.
+ (KeymapActionMap): Likewise.
+ (DefaultKeymap): New class.
+ (keymaps): New static table.
+ (keymap): New field.
+ (getKeymap): Implement.
+ (removeKeymap): Likewise.
+ (addKeymap): Likewise.
+ (setKeymap): Likewise.
+ (loadKeymap): Likewise.
+ (getActions): Likewise.
+ (margin): New field.
+ (JTextComponent): Build and install default keymap.
+ * javax/swing/text/TextAction.java
+ (textAction): Call super properly.
+ (getTextComponent): Implement.
+ * javax/swing/text/Utilities.java
+ (drawTabbedText): Adjust position by ascent.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RottView.modelToView): New method.
+ (UpdateHandler): Renamed from EventHandler.
+ (updateHandler): Renamed from eventHandler.
+ (modelToView): Implemented.
+ * javax/swing/text/AbstractDocument.java
+ (BranchElement.getElement): Return null for non-existing indeces.
+ (BranchElement.getElementIndex): Return 0 in some corner cases.
+ * javax/swing/text/FieldView.java
+ (modelToView): New method.
+ * javax/swing/text/PlainView.java
+ (modelToView): Made public.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/AbstractDocument.java
+ (createBranchElement): Use new constructor of BranchElement.
+ (createLeafElement): Renamed arguments.
+ (getRootElements): Implemented.
+ (BranchElement.start): Removed.
+ (BranchElement.end): Likewise.
+ (BranchElement.BranchElement): Fixed arguments.
+ (BranchElement.getEndOffset): Reimplemented.
+ (BranchElement.getStartOffset): Likewis.
+ * javax/swing/text/DefaultCaret.java
+ (paint): Draw simple vertical line as caret instead of a rectangle.
+ * javax/swing/text/JTextComponent.java
+ (setText): Use doc directly.
+ * javax/swing/text/PlainView.java
+ (nextTabStop): Implemented.
+ * javax/swing/text/Utilities.java
+ (drawTabbedText): nextTabStop() returns an absolute x position.
+ (getTabbedTextWidth): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/PlainView.java
+ (selectedColor): New field.
+ (unselectedColor): Likewise.
+ (font): Likewise.
+ (updateMetrics): New method.
+ (lineToRect): Likewise.
+ (modelToView): Likewise.
+ (drawSelectedText): Use color from JTextComponent ad draw with
+ Utilities class.
+ (drawUnselectedText): Likewise.
+ (paint): Initialize helper fields.
+ * javax/swing/text/View.java
+ (getChildAllocation): New method.
+ (getViewIndex): Likewise.
+ (getToolTipText): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/Utilities.java
+ (drawTabbedText): Reimplemented.
+ (getTabbedTextWidth): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installDefaults): Install caret and highlighter.
+ (modelToView): Use Bias.Forward when calling sibling.
+ * javax/swing/text/AbstractDocument.java
+ (ElementEdit): Implements DocumentEvent.ElementChange.
+ (ElementEdit.ElementEdit): New method.
+ (ElementEdit.getChildrenAdded): Likewise.
+ (ElementEdit.getChildrenRemoved): Likewise.
+ (ElementEdit.getElement): Likewise.
+ (ElementEdit.getIndex): Likewise.
+ * javax/swing/text/DefaultCaret.java
+ (color): Removed.
+ (textComponent): Renamed from parent, made private.
+ (selectionVisible): Renamed from vis_sel, made private.
+ (blinkRate): Renamed from blink, made private.
+ (magicCaretPosition): Renamed from magic, made private.
+ (visible): Renamed from vis, made private.
+ (dot): Made private.
+ (mark): Likewise.
+ (deinstall): Remove as MouseMotionListener.
+ (install): Initialize textComponent first. Add as
+ MouseMotionListener.
+ (paint): Reimplemented.
+ * javax/swing/text/JTextComponent.java
+ (setCaret): Deinstall old caret, install new one and fire property
+ change after setting property.
+ (setHighlighter): Deinstall old highlighter, install new one and fire
+ property change after setting property.
+ (setCaretColor): Fire property change after setting property.
+ (setDisabledTextColor): Likewise.
+ (setSelectedTextColor): Likewise.
+ (setSelectionColor): Likewise.
+ (modelToView): New method.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/AbstractDocument.java
+ (getText): Simplified.
+ * javax/swing/text/Segment.java
+ (current): New field.
+ (current): Reimplemented.
+ (first): Likewise.
+ (getIndex): Likewise.
+ (last): Likewise.
+ (next): Likewise.
+ (previous): Likewise.
+ (setIndex): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicButtonUI.java
+ (defaultTextIconGap): Made protected.
+ (defaultTextShiftOffset): Likewise.
+ (textShiftOffset): New field.
+ (clearTextShiftOffset): New method.
+ (getTextShiftOffset): Likewise.
+ (setTextShiftOffset): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (installUI): Add eventHandler as property listener.
+ (uninstallUI): remove eventHandler as propert listener.
+ (installDefaults): Added comment.
+ (installListeners): Likewise.
+ (installKeyboardActions): Likewise.
+ (uninstallDefaults): Likewise.
+ (uninstallListeners): Likewise.
+ (uninstallKeyboardActions): Likewise.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/AbstractDocument.java:
+ Fixed some typos in comments.
+ (insertString): Reimplemented.
+ (remove): Likewise.
+ (replace): New method.
+ (children): Dont use fully qualified class name.
+ (DefaultDocumentEvent.offset): Renamed from off.
+ (DefaultDocumentEvent.length): Renamed from len.
+ (DefaultDocumentEvent.type): New field.
+ (DefaultDocumentEvent.DefaultDocumentEvent): New constructor.
+ (DefaultDocumentEvent.getType): Implemented.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.textComponent): Removed.
+ (RootView.RootView): Don't initialize textComponent.
+ (RootView.getViewFactory): New method.
+ (EventHandler): New inner class.
+ (rootView): Initialize at instance creation.
+ (eventHandler): New field.
+ (installUI): Don't create view hierarchy directly,
+ call modelChanged() instead.
+ (modelChanged): New method.
+ * javax/swing/text/JTextComponent.java
+ (setDocument): Fire property change event.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicTextUI.java
+ (RootView.paint): Removed debug output.
+ (paintSafely): Draw highlighter before text.
+ (paintBackground): Use background color of text component.
+ * javax/swing/plaf/basic/BasicToggleButtonUI.java:
+ Reformatted.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicToolBarUI.java
+ (BasicToolBarUI): Fixed arguments for constructor.
+ (createUI): Fixed creation of object.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/text/TabSet.java
+ (TabSet): Implements java.io.Serializable.
+ * javax/swing/text/TabStop.java
+ (TabStop): Implements java.io.Serializable.
+ (TabStop): Made public.
+
+2004-09-04 Graydon Hoare <graydon@redhat.com>
+
+ * javax/swing/text/SimpleAttributeSet.java: New file.
+ * javax/swing/text/StyleConstants.java: New file.
+ * javax/swing/text/StyleContext.java: New file.
+ * javax/swing/text/TabSet.java: New file.
+ * javax/swing/text/TabStop.java: New file.
+ * javax/swing/text/AbstactDocument.java:
+ (AbstractElement): Implement attribute support.
+ * javax/swing/text/AttributeSet.java
+ (NameAttribute): New static field.
+ (ResolveAttribute): New static field.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/JComponent.java
+ (setUI): Fire PropertyChange.
+ * javax/swing/JLabel.java
+ (text): Renamed from labelText.
+ (horizontalAlignment): New default vlaue.
+ (icon): Renamed from activeIcon.
+ (displayedMnemonic): Renamed from mnemonicKey, added default value.
+ (displayedMnemonicIndex): Renamed from underlineChar.
+ (setDisplayedMnemonic): Reimplemented.
+ * javax/swing/JRadioButton.java
+ (JRadioButton): New constructors.
+ * javax/swing/JTextField.java
+ (JTextField): Throw exception if colums < 0, initialitialz
+ this.columns directly and initialize document with text
+ conditionally.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/plaf/basic/BasicFormattedTextFieldUI.java,
+ javax/swing/plaf/basic/BasicPasswordFieldUI.java,
+ javax/swing/plaf/basic/BasicTextAreaUI.java: New files.
+ * javax/swing/text/FieldView.java
+ (paint): Just call super method for now.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/TransferHandler.java,
+ javax/swing/plaf/basic/ComboPopup.java: New files
+
+2004-09-04 Roman Kennke <roman@ontographics.com>
+
+ * javax/swing/text/Utilities.java: New file.
+
+2004-09-04 Michael Koch <konqueror@gmx.de>
+
+ * examples/gnu/classpath/examples/swing/Demo.java:
+ Added demo for JTextField.
+
+
2004-09-04 Tom Tromey <tromey@redhat.com>
* java/lang/SuppressWarnings.java: Added imports.
* java/lang/Override.java: Added imports.
* java/lang/Deprecated.java: Added imports.
+2004-09-03 Mark Wielaard <mark@klomp.org>
+
+ * Makefile.am (SUBDIRS): Remove external.
+ * configure.ac (AC_CONFIG_FILES): Remove external/Makefile.
+ * doc/api/Makefile.am: Don't refer to external directory
+ * lib/Makefile.am: Likewise.
+ * lib/gen-classlist.sh.in: Likewise.
+ * external/*: Removed.
+ * NEWS: Mention GNU JAXP.
+
2004-09-03 Tom Tromey <tromey@redhat.com>
* java/util/EnumMap.java: New file.
* java/util/EnumSet.java: New file.
* java/util/BitSet.java (containsAll): New method.
+2004-08-31 Mark Wielaard <mark@klomp.org>
+
+ * NEWS: Add new news.
+
+2004-08-29 Mark Wielaard <mark@klomp.org>
+
+ * configure.ac: Check for sys/time.h, localtime_r, tm_gmtoff in
+ struct tm and for for global timezone variable.
+ * include/Makefile.am: Generate include/java_util_VMTimeZone.h.
+ * include/java_util_TimeZone.h: Removed.
+ * include/java_util_VMTimeZone.h: Added.
+ * java/util/TimeZone.java (defaultZone): Use VMTimeZone.
+ (getDefaultTimeZone): Make package private. Check that GMToffset
+ contains at least one digit.
+ (getDefaultTimeZoneId, readTimeZoneFile, readtzFile): (Re)Moved to
+ VMTimeZone.
+ * vm/reference/java/util/VMTimeZone.java: New file with above methods.
+ * native/jni/java-util/Makefile.am: Compile new java_util_VMTimeZone.c.
+ * native/jni/java-util/java_util_TimeZone.c: Removed.
+ * native/jni/java-util/java_util_VMTimeZone.c: New file.
+ * native/target/generic/target_generic_misc.h
+ (TARGET_NATIVE_MISC_GET_TIMEZONE_STRING): Removed unused macro.
+ * NEWS: Mention TimeZone/VMTimeZone split.
+
+2004-08-31 Michael Koch <konqueror@gmx.de>
+
+ * javax/swing/DefaultListSelectionModel.java
+ (fireValueChanged): Renamed from fireSelectionValueChanged,
+ made protected.
+
+2004-08-31 Michael Koch <konqueror@gmx.de>
+
+ * vm/reference/java/io/VMFile.java:
+ Reindented.
+
+
2004-08-29 Mark Wielaard <mark@klomp.org>
* resource/org/.cvsignore: New file.
@@ -1094,7 +2982,7 @@ PR AWT/16121
(throw): Replace bzero with memset.
2004-08-09 Andreas Tobler <a.tobler@schweiz.ch>
- Thomas Fitzsimmons <fitzsim@redhat.com>
+ Thomas Fitzsimmons <fitzsim@redhat.com>
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkPixbufDecoder.c: Move
NSA_PB macros to gtkpeer.h. Include gtkpeer.h.
@@ -1126,7 +3014,7 @@ PR AWT/16121
(setMultiClickThreshhold): Likewise.
2004-08-09 Craig Black <craig.black@aonix.com>
-
+
* gnu/java/awt/peer/gtk/GdkGraphics.java
(drawImage): Add support for scaling pixmaps.
* include/gnu_java_awt_peer_gtk_GdkGraphics.h,
@@ -1339,6 +3227,17 @@ PR AWT/16121
float[] coords.
* java/awt/geom/RoundRectangle2D.java: Several bugfixes (Bug #6007).
+2004-08-01 Sven de Marothy <sven@physto.se>
+
+ * java/awt/geom/CubicCurve2.java: Reindent.
+ (contains): Implemented.
+ (intersects): Implemented.
+ * java/awt/geom/QuadCurve2D.java: Likewise.
+ * java/awt/geom/GeneralPath.java: Reindent and document.
+ Fully (re)implemented using separate xpoints and ypoints
+ float[] coords.
+ * java/awt/geom/RoundRectangle2D.java: Several bugfixes (Bug #6007).
+
2004-08-01 Mark Wielaard <mark@klomp.org>
* NEWS: Mention new examples.
@@ -2112,7 +4011,7 @@ PR AWT/16121
2004-07-26 Patrik Reali <reali@acm.org>
* doc/www.gnu.org/newsitems.txt: AWT commit and inetlib HTTP client
- * doc/www.gnu.org/faq/faq.wml: add dependencies and CVS udpate to
+ * doc/www.gnu.org/faq/faq.wml: add dependencies and CVS udpate to
the installation (3.4) section
2004-07-25 Patrik Reali <reali@acm.org>
@@ -2704,25 +4603,25 @@ PR AWT/16121
2004-07-21 Michael Koch <konqueror@gmx.de>
* javax/swing/JCheckBox.java: Reformated.
- (JCheckBox): Fixed all constructors.
- (isBorderPaintedFlat): New method.
- (setBorderPaintedFlat): New method.
+ (JCheckBox): Fixed all constructors.
+ (isBorderPaintedFlat): New method.
+ (setBorderPaintedFlat): New method.
* javax/swing/JEditorPane.java
- (createEditorKitForContentType): Made public.
- (scrollToReference): Likewise.
+ (createEditorKitForContentType): Made public.
+ (scrollToReference): Likewise.
* javax/swing/JTextArea.java
- (setLineWrap): Fire property change.
+ (setLineWrap): Fire property change.
* javax/swing/JToggleButton.java
- (JToggleButton): New constructor.
- (JToggleButton): Simplified.
+ (JToggleButton): New constructor.
+ (JToggleButton): Simplified.
* javax/swing/text/AttributeSet.java
- (FontAttribute): Renamed from FontCharacterAttribute.
+ (FontAttribute): Renamed from FontCharacterAttribute.
* javax/swing/text/JTextComponent.java
- (KeyBinBinding): Added javadoc.
- (JTextComponent): Likewise.
- (getAccessibleContext): Fixed javadoc.
+ (KeyBinBinding): Added javadoc.
+ (JTextComponent): Likewise.
+ (getAccessibleContext): Fixed javadoc.
* javax/swing/text/View.java
- (View): Added javadoc.
+ (View): Added javadoc.
* javax/swing/text/TabableView.java: New file.
* Makefile.am: Added javax/swing/text/TabableView.java.
* Makefile.in: Regenerated.
@@ -3725,18 +5624,18 @@ PR AWT/16121
* java/beans/Makefile.am (EXTRA_DIST): Add new files.
2004-07-03 Mark Wielaard <mark@klomp.org>
- Anthony Green <green@redhat.com>
+ Anthony Green <green@redhat.com>
* java/net/URL.java (getFile): Clarify return value doc.
(getPath): Return null if file is empty - not
empty String.
2004-07-03 Mark Wielaard <mark@klomp.org>
- Anthony Green <green@redhat.com>
+ Anthony Green <green@redhat.com>
* java/net/URL.java (set): Convert protocol to lower case before
doing anything.
- Only change the protocol handler if it's different.
+ Only change the protocol handler if it's different.
2004-07-03 Anthony Green <green@redhat.com>
@@ -5017,7 +6916,7 @@ PR AWT/16121
native/jni/classpath/native_state.h,
native/jni/classpath/primlib.c, native/jni/classpath/primlib.h:
Reformatted according to GNU Coding standards.
-
+
2004-06-21 Steven Augart <augart@watson.ibm.com>
* gnu/java/awt/peer/gtk/Makefile.am (EXTRA_DIST): Fixed
@@ -5049,42 +6948,42 @@ PR AWT/16121
2003-06-15 Dalibor Topic <robilad@kaffe.org>
- * java/nio/Buffer.java,
- java/nio/ByteBuffer.java,
- java/nio/ByteBufferHelper.java,
- java/nio/ByteBufferImpl.java,
- java/nio/CharBuffer.java,
- java/nio/CharBufferImpl.java,
- java/nio/CharViewBufferImpl.java,
- java/nio/DirectByteBufferImpl.java,
- java/nio/DoubleBuffer.java,
- java/nio/DoubleBufferImpl.java,
- java/nio/DoubleViewBufferImpl.java,
- java/nio/FloatBuffer.java,
- java/nio/FloatBufferImpl.java,
- java/nio/FloatViewBufferImpl.java,
- java/nio/IntBuffer.java,
- java/nio/IntBufferImpl.java,
- java/nio/IntViewBufferImpl.java,
- java/nio/LongBuffer.java,
- java/nio/LongBufferImpl.java,
- java/nio/LongViewBufferImpl.java,
- java/nio/MappedByteBufferImpl.java,
- java/nio/ShortBuffer.java,
- java/nio/ShortBufferImpl.java,
- java/nio/ShortViewBufferImpl.java:
- Fixed javadocs all over. Improved input error
- checking.
-
- * java/nio/Buffer.java
- (checkForUnderflow, checkForOverflow, checkIndex,
- checkIfReadOnly, checkArraySize): New helper methods
- for error checking.
-
- * java/nio/ByteBufferHelper.java
- (checkRemainingForRead, checkRemainingForWrite,
- checkAvailableForRead, checkAvailableForWrite): Removed
- no longer needed methods.
+ * java/nio/Buffer.java,
+ java/nio/ByteBuffer.java,
+ java/nio/ByteBufferHelper.java,
+ java/nio/ByteBufferImpl.java,
+ java/nio/CharBuffer.java,
+ java/nio/CharBufferImpl.java,
+ java/nio/CharViewBufferImpl.java,
+ java/nio/DirectByteBufferImpl.java,
+ java/nio/DoubleBuffer.java,
+ java/nio/DoubleBufferImpl.java,
+ java/nio/DoubleViewBufferImpl.java,
+ java/nio/FloatBuffer.java,
+ java/nio/FloatBufferImpl.java,
+ java/nio/FloatViewBufferImpl.java,
+ java/nio/IntBuffer.java,
+ java/nio/IntBufferImpl.java,
+ java/nio/IntViewBufferImpl.java,
+ java/nio/LongBuffer.java,
+ java/nio/LongBufferImpl.java,
+ java/nio/LongViewBufferImpl.java,
+ java/nio/MappedByteBufferImpl.java,
+ java/nio/ShortBuffer.java,
+ java/nio/ShortBufferImpl.java,
+ java/nio/ShortViewBufferImpl.java:
+ Fixed javadocs all over. Improved input error
+ checking.
+
+ * java/nio/Buffer.java
+ (checkForUnderflow, checkForOverflow, checkIndex,
+ checkIfReadOnly, checkArraySize): New helper methods
+ for error checking.
+
+ * java/nio/ByteBufferHelper.java
+ (checkRemainingForRead, checkRemainingForWrite,
+ checkAvailableForRead, checkAvailableForWrite): Removed
+ no longer needed methods.
2004-06-15 Bryce McKinlay <mckinlay@redhat.com>
@@ -5165,7 +7064,7 @@ PR AWT/16121
2004-06-09 Steven Augart <augart@watson.ibm.com>
* configure.ac: Add SIZEOF_VOID_P to include/config.h.
- Quote '.*86'.
+ Quote '.*86'.
2004-06-07 Archie Cobbs <archie@dellroad.org>
@@ -5175,7 +7074,7 @@ PR AWT/16121
2004-06-07 Steven Augart <augart@watson.ibm.com>
* native/jni/gtk-peer/gthread-jni.c (c-font-lock-extra-types):
- Added jfieldID, jmethodID.
+ Added jfieldID, jmethodID.
* include/jni.h (c-font-lock-extra-types): Added.
2004-06-06 Steven Augart <augart@watson.ibm.com>
@@ -5234,7 +7133,7 @@ PR AWT/16121
2004-06-04 Steven Augart <augart@watson.ibm.com>
* resource/gnu/regexp/MessagesBundle.properties,
- resource/gnu/regexp/MessagesBundle_fr.properties:
+ resource/gnu/regexp/MessagesBundle_fr.properties:
Corrected apostrophes.
Replaced "expected" with "unexpected".
@@ -6327,7 +8226,7 @@ PR AWT/16121
WALL_TIME, STANDARD_TIME, UTC_TIME): New members.
(SimpleTimeZone): Tweak docs. Add new variation.
(setStartRule,setEndRule): Add new variations. Use
- startTimeMode and endTimeMode.
+ startTimeMode and endTimeMode.
2004-05-07 Jerry Quinn <jlquinn@optonline.net>
@@ -6347,7 +8246,7 @@ PR AWT/16121
09-20-03 Guilhem Lavaux <guilhem@kaffe.org>
- * java/io/File.java:
+ * java/io/File.java:
(File(File,String)): fixed the behaviour according to JDK 1.4.1.
dirPath should not be initialized to the full path if directory
is null, but to "/" if directory.getPath() is "" and the full path
@@ -7057,7 +8956,7 @@ PR AWT/16121
2004-04-28 Ingo Proetel <proetel@aicas.com>
* java/awt/image/ColorModel.java (getRGBdefault): Default ColorModel has
- 32 bit pixels not 8 bit pixels.
+ 32 bit pixels not 8 bit pixels.
(isCompatibleRaster): Added javadoc comment.
2004-04-28 Ingo Proetel <proetel@aicas.com>
@@ -7593,7 +9492,7 @@ PR AWT/16121
(URL): Set authority to the right value.
(getContent, openStream): Made final as in the Java spec.
(setURL): Fixed authority and file initialization.
-
+
* java/net/URLStreamHandler.java
(parseURL): Take care of the query tag. Build authority.
(toExternalForm): Fixed URL building using authority.
@@ -7791,14 +9690,14 @@ PR AWT/16121
* javax/swing/JCheckBoxMenuItem.java:
Mostly Implemented. Work in progress.
* javax/swing/JRadioButtonMenuItem.java:
- Reimplement constructors to use JToggleButtonModel.
+ Reimplement constructors to use JToggleButtonModel.
* javax/swing/plaf/basic/BasicIconFactory.java:
(getCheckBoxMenuItemIcon): return check box
icon.
* javax/swing/plaf/basic/BasicMenuItemUI.java:
paint menu item selected only when it is armed and
pressed.
-
+
2004-04-17 David Jee <djee@redhat.com>
* gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
@@ -8099,7 +9998,7 @@ PR AWT/16121
2004-04-16 Guilhem Lavaux <guilhem@kaffe.org>
- Reported by Nektarios Papadopoulos <npapadop@inaccessnetworks.com>
+ Reported by Nektarios Papadopoulos <npapadop@inaccessnetworks.com>
* java/io/FileOutputStream.java
(FileOutputStream) Reorganized constructors. Constructors now
check whether the given path is directory.
@@ -8800,7 +10699,7 @@ PR AWT/16121
* doc/www.gnu.org/README: some custom tags documented
* doc/www.gnu.org/newsitems.txt: planet classpath added
* doc/www.gnu.org/faq/faq.wml doc/www.gnu.org/include/layout.wml
- doc/www.gnu.org/include/macros.wml: faq entry on installing classpath
+ doc/www.gnu.org/include/macros.wml: faq entry on installing classpath
and mauve, custom tags for commented code
2004-04-02 Tom Tromey <tromey@redhat.com>
@@ -8939,8 +10838,8 @@ PR AWT/16121
2004-03-21 Ito Kazumitsu <kaz@maczuka.gcd.org>
- * libraries/javalib/java/net/ServerSocket.java
- (accept): Close the socket when error occured.
+ * libraries/javalib/java/net/ServerSocket.java
+ (accept): Close the socket when error occured.
2004-03-21 Norbert Frese <postfach@nfrese.net>
@@ -9268,7 +11167,7 @@ PR AWT/16121
(setFont): Call new native method gtkSetFont.
* gnu/java/awt/peer/gtk/GtkContainerPeer.java
(setFont): For all child components who do not their fonts set,
- set their peers' fonts with this container's font.
+ set their peers' fonts with this container's font.
* gnu/java/awt/peer/gtk/GtkLabelPeer.java:
Move all native method declarations to the top for readability.
(gtkSetFont): New native method declaration.
@@ -9693,7 +11592,7 @@ PR AWT/16121
Likewise.
2004-03-12 Thomas Fitzsimmons <fitzsim@redhat.com>
-
+
* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
(connectJObject): Replace printf calls with g_assert statements.
Move property-notify-event signal connection to ...
@@ -10204,7 +12103,7 @@ PR AWT/16121
2004-02-10 Ito Kazumitsu <kaz@maczuka.gcd.org>
* java/io/ObjectInputStream.java (readClassDescriptor): Avoid the
- overflow of fieldmapping.
+ overflow of fieldmapping.
2004-02-06 Mohan Embar <gnustuff@thisiscool.com>
@@ -10775,7 +12674,7 @@ PR AWT/16121
* gnu/java/awt/peer/gtk/GtkComponentPeer.java
(handleEvent): Implemented. Handles PaintEvents.
(paint): Implemented. Use GTK native methods to queue updates
- for this heavyweight peer.
+ for this heavyweight peer.
* gnu/java/awt/peer/gtk/GtkContainerPeer.java
(handleEvent): Removed.
* include/gnu_java_awt_peer_gtk_GtkComponentPeer.h: Regenerated.
@@ -10876,10 +12775,10 @@ PR AWT/16121
visible so that dialog can be reused.
2004-01-26 Fernando Nasser <fnasser@redhat.com>
-
+
* gnu/java/awt/peer/gtk/TestAWT.java (DialogWindow): Add WindowAdapter
to handle Window "Closing" events.
-
+
2004-01-26 Fernando Nasser <fnasser@redhat.com>
* gnu/java/awt/peer/gtk/TestAWT.java: Fix test program so that it does
@@ -11088,7 +12987,7 @@ PR AWT/16121
* gnu/java/awt/peer/gtk/GdkGraphics2D.java:
(doPolygon): set fill rule of polygon to
WIND_EVEN_ODD by default.
-
+
2004-01-16 Michael Koch <konqueror@gmx.de>
* acinclude.m4: Fixed quotation to get rid of warnings with
@@ -11190,7 +13089,7 @@ PR AWT/16121
Compile fixes.
2004-01-12 Arnaud Vandyck <arnaud.vandyck@ulg.ac.be>
- Michael Koch <konqueror@gmx.de>
+ Michael Koch <konqueror@gmx.de>
* javax/swing/table/DefaultTableCellRenderer.java
(DefaultTableCellRenderer): Added javadoc for the class and for
@@ -12304,7 +14203,7 @@ PR AWT/16121
(FileInputStream(File)): Check whether the argument is a directory.
2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
- Mark Wielaard <mark@klomp.org>
+ Mark Wielaard <mark@klomp.org>
* java/io/BufferedReader.java (BufferedReader): Throw
IllegalArgumentException when size <= 0.
@@ -12315,7 +14214,7 @@ PR AWT/16121
(skip): Throw IllegalArgumentException when count is negative.
2003-12-25 Guilhem Lavaux <guilhem@kaffe.org>
- Mark Wielaard <mark@klomp.org>
+ Mark Wielaard <mark@klomp.org>
* gnu/java/rmi/server/UnicastConnectionManager.java
(startScavenger): Set the client connection manager to daemon
@@ -12828,22 +14727,22 @@ PR AWT/16121
2003-11-28 Dalibor Topic <robilad@kaffe.org>
- Reported by: Jim Pick <jim@kaffe.org>
+ Reported by: Jim Pick <jim@kaffe.org>
- * libraries/javalib/java/util/Hashtable.java
- (internalcontainsValue): New method.
- (contains) Delegate to internalContainsValue.
+ * libraries/javalib/java/util/Hashtable.java
+ (internalcontainsValue): New method.
+ (contains) Delegate to internalContainsValue.
- Reported by: Mark Wielaard <mark@klomp.org>
+ Reported by: Mark Wielaard <mark@klomp.org>
- * libraries/javalib/java/util/Hashtable.java
- (contains): Improved comment.
+ * libraries/javalib/java/util/Hashtable.java
+ (contains): Improved comment.
- Reported by: Jeroen Frijters <jeroen@frijters.net>
+ Reported by: Jeroen Frijters <jeroen@frijters.net>
- * libraries/javalib/java/util/Hashtable.java
- (containsValue): Delegate to contains(Object) to make sure older
- code overwriting it continues to work.
+ * libraries/javalib/java/util/Hashtable.java
+ (containsValue): Delegate to contains(Object) to make sure older
+ code overwriting it continues to work.
2003-11-27 Michael Koch <konqueror@gmx.de>
@@ -12906,7 +14805,7 @@ PR AWT/16121
2003-11-26 Tom Fitzsimmons <fitzsim@redhat.com>
- * java/awt/GridBagLayout.java (getLayoutDimensions): Return array of
+ * java/awt/GridBagLayout.java (getLayoutDimensions): Return array of
two zero-length int arrays when layoutInfo is null.
(getLayoutWeights): Return array of two zero-length double arrays when
layoutInfo is null.
@@ -13066,9 +14965,9 @@ PR AWT/16121
* java/lang/Thread.java (start): Throw IllegalThreadStateException
instead of IllegalStateException.
- * vm/reference/java/lang/Runtime.java (exit): Moved shutdown hook
- processing to new method.
- (runShutdownHooks): New method.
+ * vm/reference/java/lang/Runtime.java (exit): Moved shutdown hook
+ processing to new method.
+ (runShutdownHooks): New method.
2003-11-21 Mark Wielaard <mark@klomp.org>
@@ -13483,8 +15382,8 @@ PR AWT/16121
2003-10-23 Sascha Brawer <brawer@dandelis.ch>
- * java/awt/geom/CubicCurve2D.java (contains): Docfix for URL of embedded drawing.
- * java/awt/geom/QuadCurve2D.java: Likewise.
+ * java/awt/geom/CubicCurve2D.java (contains): Docfix for URL of embedded drawing.
+ * java/awt/geom/QuadCurve2D.java: Likewise.
2003-10-23 Sascha Brawer <brawer@dandelis.ch>
@@ -13568,8 +15467,8 @@ PR AWT/16121
2003-10-21 Sascha Brawer <brawer@dandelis.ch>
Fix for bug #2944, reported by David Holmes <dholmes@dltech.com.au>
- * java/util/logging/ErrorManager.java (everUsed): Made volatile.
- (error): Synchronize on instance, not class.
+ * java/util/logging/ErrorManager.java (everUsed): Made volatile.
+ (error): Synchronize on instance, not class.
2003-10-20 Mark Wielaard <mark@klomp.org>
@@ -15042,8 +16941,8 @@ PR AWT/16121
2003-09-07 Dalibor Topic <robilad@kaffe.org>
- * java/awt/BasicStroke.java (BasicStroke): Fixed illegal argument
- checking to follow 1.4.2 spec.
+ * java/awt/BasicStroke.java (BasicStroke): Fixed illegal argument
+ checking to follow 1.4.2 spec.
2003-08-25 Scott Gilbertson <scottg@mantatest.com>
@@ -15072,14 +16971,14 @@ PR AWT/16121
* gnu/java/rmi/rmic/Compile_kjc.java: New file.
* gnu/java/rmi/rmic/Compile_jikes.java: Likewise.
* gnu/java/rmi/rmic/RMICException.java: Likewise.
-
+
* gnu/java/rmi/rmic/Compiler.java (getDestination): New method.
-
+
* gnu/java/rmi/rmic/CompilerProcess.java: Import java.io.InputStream.
(computeTypicalArguments): New method.
(compile): Print compiler output to System.out. Collect compiler
error output and use it in exception message.
-
+
* gnu/java/rmi/rmic/RMIC.java: Import java.util.Set.
(destination): Initialize to null.
(run): Replace file separator with '.' when processing class.
@@ -15150,7 +17049,7 @@ PR AWT/16121
implementation.
2003-08-22 Scott Gilbertson <scottg@mantatest.com>
- Thomas Fitzsimmons <fitzsim@redhat.com>
+ Thomas Fitzsimmons <fitzsim@redhat.com>
* gnu/java/awt/GLightweightPeer.java: Remove file.
* gnu/java/awt/Makefile.am (EXTRA_DIST): Remove
@@ -15200,7 +17099,7 @@ PR AWT/16121
* native/jni/java-nio/java_nio_FileChannelImpl.c:
Fixed return value of Java_java_nio_channels_FileChannelImpl_size(),
- Java_java_nio_channels_FileChannelImpl_implPosition__()
+ Java_java_nio_channels_FileChannelImpl_implPosition__()
2003-08-19 Torsten Rupp <rupp@lisa.aicas.com>
@@ -15358,7 +17257,7 @@ PR AWT/16121
2003-08-12 Jeroen Frijters <jeroen@frijters.net>
* java/net/URLClassLoader: (findClass): close InputStream after
- we're done with it
+ we're done with it
2003-08-12 Ingo Proetel <proetel@aicas.com>
@@ -15608,15 +17507,15 @@ PR AWT/16121
* java/lang/SecurityManager.java:
checkPackageList(): replace access of String.count with
- String.length() to make it compatible with other
- implementations of class String
+ String.length() to make it compatible with other
+ implementations of class String
2003-07-31 Torsten Rupp <rupp@lisa.aicas.com>
* java/io/File.java:
createTempFile(): use long names on system where file
- separator is not '\', otherwise limit filenames to
- 8+3-convention
+ separator is not '\', otherwise limit filenames to
+ 8+3-convention
2003-07-30 Tom Tromey <tromey@redhat.com>
@@ -15639,16 +17538,16 @@ PR AWT/16121
* include/java_nio_FileChannelImpl.h:
copied from gnu_java_nio_FileChannelImpl.h, renamed
- Java_gnu_java_nio_channels_* -> Java_java_nio_channels*
- to match new implementation of FileChannelImpl.java,
- added some missing native functions
+ Java_gnu_java_nio_channels_* -> Java_java_nio_channels*
+ to match new implementation of FileChannelImpl.java,
+ added some missing native functions
2003-07-30 Torsten Rupp <rupp@lisa.aicas.com>
* native/jni/java-nio/java_nio_FileChannelImpl.c:
rename Java_gnu_java_nio_channels_* -> Java_java_nio_channels*
- to match new implementation of FileChannelImpl.java, added some
- missing native functions
+ to match new implementation of FileChannelImpl.java, added some
+ missing native functions
2003-07-30 Torsten Rupp <rupp@lisa.aicas.com>
@@ -15659,7 +17558,7 @@ PR AWT/16121
* java/net/PlainSocketImpl.java:
implemented connect(SocketAddress address, int timeout)
- (preliminary implementation; timeout still not supported)
+ (preliminary implementation; timeout still not supported)
2003-07-29 Tom Tromey <tromey@redhat.com>
@@ -15706,7 +17605,7 @@ PR AWT/16121
* native/jni/java-net/java_net_PlainDatagramSocketImpl.c:
improved some exception messages in Java_java_net_PlainDatagramSocketImpl_receive,
- Java_java_net_PlainDatagramSocketImpl_sendto
+ Java_java_net_PlainDatagramSocketImpl_sendto
2003-07-28 Sascha Brawer <brawer@dandelis.ch>
@@ -15774,7 +17673,7 @@ PR AWT/16121
* native/target/generic/target_generic_file.h:
Fixed include of utime.h, sys/utime.h: rename HAVE_UTIME ->
- HAVE_UTIME_H, HAVE_SYS_UTIME -> HAVE_SYS_UTIME_H
+ HAVE_UTIME_H, HAVE_SYS_UTIME -> HAVE_SYS_UTIME_H
2003-07-23 Torsten Rupp <rupp@lisa.aicas.com>
@@ -15785,39 +17684,39 @@ PR AWT/16121
* native/jni/java-io/java_io_File.c:
Replaced JNI_JLONG_CONST* -> TARGET_NATIVE_MATH_INT_*, because
- JNI_JLONG_CONST* should be removed from jni.h
+ JNI_JLONG_CONST* should be removed from jni.h
2003-07-23 Torsten Rupp <rupp@lisa.aicas.com>
* native/jni/java-io/java_io_File.c:
Replaced JNI_JLONG_CONST* -> TARGET_NATIVE_MATH_INT_*, because
- JNI_JLONG_CONST* should be removed from jni.h
+ JNI_JLONG_CONST* should be removed from jni.h
2003-07-23 Torsten Rupp <rupp@lisa.aicas.com>
* native/jni/java-io/FileDescriptor.c:
Replaced JNI_JLONG_CONST* -> TARGET_NATIVE_MATH_INT_*, because
- JNI_JLONG_CONST* should be removed from jni.h
- removed HAVE_FTRUNCATE, HAVE_FSYNC, HAVE_SELECT (now set in
- configure)
+ JNI_JLONG_CONST* should be removed from jni.h
+ removed HAVE_FTRUNCATE, HAVE_FSYNC, HAVE_SELECT (now set in
+ configure)
2003-07-23 Torsten Rupp <rupp@lisa.aicas.com>
* native/jni/java-nio/java_nio.c:
Replaced JNI_JLONG_CONST_0 -> TARGET_NATIVE_MATH_INT_INT64_CONST_0,
- because JNI_JLONG_CONST* should be removed from jni.h
+ because JNI_JLONG_CONST* should be removed from jni.h
2003-07-23 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-net/javanet.c:
- Enable option SO_BROADCAST for datagram sockets
+ * native/jni/java-net/javanet.c:
+ Enable option SO_BROADCAST for datagram sockets
2003-07-23 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_file.h:
- added TARGET_NATIVE_FILE_FILEPERMISSION_READONLY, improved
- TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR: now use fcntl()
- or fstat()
+ * native/target/generic/target_generic_file.h:
+ added TARGET_NATIVE_FILE_FILEPERMISSION_READONLY, improved
+ TARGET_NATIVE_FILE_VALID_FILE_DESCRIPTOR: now use fcntl()
+ or fstat()
2003-07-22 Tom Tromey <tromey@redhat.com>
@@ -15833,16 +17732,16 @@ PR AWT/16121
2003-07-22 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_network.h:
- removed double defined macros, added
- TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_BROADCAST(),
- TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BROADCAST()
+ * native/target/generic/target_generic_network.h:
+ removed double defined macros, added
+ TARGET_NATIVE_NETWORK_SOCKET_SET_OPTION_BROADCAST(),
+ TARGET_NATIVE_NETWORK_SOCKET_GET_OPTION_BROADCAST()
2003-07-22 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_math_float.h:
- added macro TARGET_NATIVE_MATH_FLOAT_FLOAT_FINITE(),
- TARGET_NATIVE_MATH_FLOAT_DOUBLE_FINITE()
+ * native/target/generic/target_generic_math_float.h:
+ added macro TARGET_NATIVE_MATH_FLOAT_FLOAT_FINITE(),
+ TARGET_NATIVE_MATH_FLOAT_DOUBLE_FINITE()
2003-07-21 Thomas Fitzsimmons <fitzsim@redhat.com>
@@ -15867,12 +17766,12 @@ PR AWT/16121
2003-07-19 Torsten Rupp <rupp@lisa.aicas.com>
- * java/io/File.java:
- canWrite(): set prefix for temporary file to "tmp" to make methode
- usable on systems with DOS-style filesystems (8+3-limitation)
- createTempFile(): limit length of filename from temporary file to
- 8-length(prefix) to make methode usuable on systems with DOS-style
- filesystems (8+3-limitation)
+ * java/io/File.java:
+ canWrite(): set prefix for temporary file to "tmp" to make methode
+ usable on systems with DOS-style filesystems (8+3-limitation)
+ createTempFile(): limit length of filename from temporary file to
+ 8-length(prefix) to make methode usuable on systems with DOS-style
+ filesystems (8+3-limitation)
2003-07-18 Graydon Hoare <graydon@redhat.com>
@@ -15918,7 +17817,7 @@ PR AWT/16121
of the removed Thread.
* vm/reference/java/lang/Thread.java (setDaemon): Don't throw an
exception when called on an exited Thread.
-
+
2003-07-17 Jeroen Frijters <jeroen@sumatra.nl>
* java/lang/Class.java (newInstance): Improved constructor caching.
@@ -15930,29 +17829,29 @@ PR AWT/16121
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_file.h:
- Some fixes for target native layer (reported by Stephen Crawley)
+ * native/target/generic/target_generic_file.h:
+ Some fixes for target native layer (reported by Stephen Crawley)
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * configure.in:
- Some fixes for target native layer (reported by Stephen Crawley)
+ * configure.in:
+ Some fixes for target native layer (reported by Stephen Crawley)
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * java/io/class-dependencies.conf:
- java/lang/class-dependencies.conf:
- java/math/class-dependencies.conf:
- java/net/class-dependencies.conf:
- java/nio/class-dependencies.conf:
- java/text/class-dependencies.conf:
- java/util/class-dependencies.conf:
- Class dependencies file
+ * java/io/class-dependencies.conf:
+ java/lang/class-dependencies.conf:
+ java/math/class-dependencies.conf:
+ java/net/class-dependencies.conf:
+ java/nio/class-dependencies.conf:
+ java/text/class-dependencies.conf:
+ java/util/class-dependencies.conf:
+ Class dependencies file
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_file.h:
- Fixed typing error
+ * native/target/generic/target_generic_file.h:
+ Fixed typing error
2003-07-16 David Grove <groved@us.ibm.com
@@ -15983,8 +17882,8 @@ PR AWT/16121
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/classpath/jcl.c:
- Fixed wrong include
+ * native/jni/classpath/jcl.c:
+ Fixed wrong include
2003-07-16 Mark Wielaard <mark@klomp.org>
@@ -15993,20 +17892,20 @@ PR AWT/16121
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/classpath/jnilink.c:
- Removed include malloc.h, added stdlib.h
+ * native/jni/classpath/jnilink.c:
+ Removed include malloc.h, added stdlib.h
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/classpath/jcl.h,
- native/jni/classpath/jcl.c:
- Fixed some prototypes
+ * native/jni/classpath/jcl.h,
+ native/jni/classpath/jcl.c:
+ Fixed some prototypes
2003-07-16 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-io/FileDescriptor.c:
- Renamed some internal constants to avoid conflicts with existing
- constants in some OS (e. g. vxWorks)
+ * native/jni/java-io/FileDescriptor.c:
+ Renamed some internal constants to avoid conflicts with existing
+ constants in some OS (e. g. vxWorks)
2003-07-15 David Grove <groved@us.ibm.com
@@ -16017,37 +17916,37 @@ PR AWT/16121
2003-07-15 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-net/java_net_InetAddress.c,
- native/jni/java-net/java_net_NetworkInterface.c,
- native/jni/java-net/java_net_PlainDatagramSocketImpl.c,
- native/jni/java-net/java_net_PlainSocketImpl.c,
- native/jni/java-net/javanet.c:
- Added target native layer macros for native OS functions
+ * native/jni/java-net/java_net_InetAddress.c,
+ native/jni/java-net/java_net_NetworkInterface.c,
+ native/jni/java-net/java_net_PlainDatagramSocketImpl.c,
+ native/jni/java-net/java_net_PlainSocketImpl.c,
+ native/jni/java-net/javanet.c:
+ Added target native layer macros for native OS functions
2003-07-15 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_network.h:
- Added macro for BIND_ADDRESS
+ * native/target/generic/target_generic_network.h:
+ Added macro for BIND_ADDRESS
2003-07-15 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-util/java_util_TimeZone.c:
- renamed target native macro
+ * native/jni/java-util/java_util_TimeZone.c:
+ renamed target native macro
2003-07-15 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_misc.h:
- Fixed typing error
+ * native/target/generic/target_generic_misc.h:
+ Fixed typing error
2003-07-15 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_misc.h:
- Clean-up some target macro names
+ * native/target/generic/target_generic_misc.h:
+ Clean-up some target macro names
2003-07-15 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-util/java_util_TimeZone.c:
- Replace natve OS functions by target native layer macros
+ * native/jni/java-util/java_util_TimeZone.c:
+ Replace natve OS functions by target native layer macros
2003-07-14 Michael Koch <konqueror@gmx.de>
@@ -16115,18 +18014,18 @@ PR AWT/16121
2003-07-10 Torsten Rupp <rupp@lisa.aicas.com>
- * classpath/native/target/generic/target_generic_network.h:
- Adding missing #include <assert.h>
+ * classpath/native/target/generic/target_generic_network.h:
+ Adding missing #include <assert.h>
2003-07-09 Mark Wielaard <mark@klomp.org>
-
+
* java/io/ObjectOutputStream.java (writeObject): break after
calling writeClassDescriptor().
2003-07-09 Torsten Rupp <rupp@lisa.aicas.com>
- * classpath/include/jni.h.in:
- Fixed missing JNI_JLONG_CONST* definitions (preliminary fix)
+ * classpath/include/jni.h.in:
+ Fixed missing JNI_JLONG_CONST* definitions (preliminary fix)
2003-07-09 Michael Koch <konqueror@gmx.de>
@@ -16166,16 +18065,16 @@ PR AWT/16121
2003-07-09 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-io/FileDescriptor.c,
- native/jni/java-io/java_io_File.c,
- native/jni/java-io/java_io_ObjectInputStream.c,
- native/jni/java-io/javaio.c:
- Implemented target native layer macros for all native OS functions
+ * native/jni/java-io/FileDescriptor.c,
+ native/jni/java-io/java_io_File.c,
+ native/jni/java-io/java_io_ObjectInputStream.c,
+ native/jni/java-io/javaio.c:
+ Implemented target native layer macros for all native OS functions
2003-07-08 Torsten Rupp <rupp@lisa.aicas.com>
- * native/target/generic/target_generic_file.h:
- More fixed for native layer: open with sync/dsync, 64bit-clean
+ * native/target/generic/target_generic_file.h:
+ More fixed for native layer: open with sync/dsync, 64bit-clean
2003-07-07 Thomas Fitzsimmons <fitzsim@redhat.com>
@@ -16202,14 +18101,14 @@ PR AWT/16121
* native/tar2003-07-09 Torsten Rupp <rupp@lisa.aicas.com>
- * /cvsroot/classpath/classpath/native/jni/java-io/FileDescriptor.c:
- Implemented target native layer macros for all native OS functions
-get/Linux/target_native.h,
- native/target/Linux/target_native_file.h,
- native/target/Linux/target_native_math_float.h,
- native/target/Linux/target_native_math_int.h,
- native/target/Linux/target_native_misc.h,
- native/target/Linux/target_native_network.h:
+ * /cvsroot/classpath/classpath/native/jni/java-io/FileDescriptor.c:
+ Implemented target native layer macros for all native OS functions
+ * native/target/Linux/target_native.h,
+ native/target/Linux/target_native_file.h,
+ native/target/Linux/target_native_math_float.h,
+ native/target/Linux/target_native_math_int.h,
+ native/target/Linux/target_native_misc.h,
+ native/target/Linux/target_native_network.h:
Small fixes for target native layer
* native/target/Linux/target_native_io.h:
@@ -16218,11 +18117,11 @@ get/Linux/target_native.h,
2003-07-07 Torsten Rupp <rupp@lisa.aicas.com>
* native/target/generic/target_generic.h,
- native/target/generic/target_generic_file.h,
- native/target/generic/target_generic_math_float.h,
- native/target/generic/target_generic_math_int.h,
- native/target/generic/target_generic_misc.h,
- native/target/generic/target_generic_network.h:
+ native/target/generic/target_generic_file.h,
+ native/target/generic/target_generic_math_float.h,
+ native/target/generic/target_generic_math_int.h,
+ native/target/generic/target_generic_misc.h,
+ native/target/generic/target_generic_network.h:
Small fixes for target native layer
* native/target/generic/target_generic_io.h:
@@ -16230,13 +18129,13 @@ get/Linux/target_native.h,
2003-07-03 Torsten Rupp <rupp@lisa.aicas.com>
- * native/jni/java-nio/java_nio_FileChannelImpl.c:
- Fixed header Java_gnu_java_nio_FileChannelImpl_implPosition__
+ * native/jni/java-nio/java_nio_FileChannelImpl.c:
+ Fixed header Java_gnu_java_nio_FileChannelImpl_implPosition__
2003-07-03 Torsten Rupp <rupp@lisa.aicas.com>
- * gnu/java/rmi/server/UnicastServerRef.java:
- Fixed getReturnMethodType
+ * gnu/java/rmi/server/UnicastServerRef.java:
+ Fixed getReturnMethodType
2003-07-02 Michael Koch <konqueror@gmx.de>
@@ -16454,7 +18353,7 @@ get/Linux/target_native.h,
Fixed values of all serialVersionUIDs.
2003-06-26 Stephen Crawley <crawley@dstc.edu.au>
-
+
* java/test/RuleBasedCollator.java
(RuleBasedCollator): Fix bugs in building the collator data structures
that resulted in the wrong keys being associated collated characters.
@@ -16499,7 +18398,7 @@ get/Linux/target_native.h,
2003-06-26 Sascha Brawer <brawer@dandelis.ch>
- * javax/swing/plaf/TextUI.java: Made imports specific, reformatted,
+ * javax/swing/plaf/TextUI.java: Made imports specific, reformatted,
wrote JavaDoc.
(modelToView): Declare to throw javax.swing.text.BadLocationException.
(getToolTipText): New method.
@@ -16717,12 +18616,12 @@ get/Linux/target_native.h,
2003-06-23 Torsten Rupp <rupp@aicas.com>
- * configure.in:
- added includes 'Linux' and 'generic' as extra-include paths.
- This change is temporary and have to be replaced by more
- elaborated code to be able to select the target system for
- which Classpath is compiled. Currently only 'Linux' is
- supported; other targets will be added when available.
+ * configure.in:
+ added includes 'Linux' and 'generic' as extra-include paths.
+ This change is temporary and have to be replaced by more
+ elaborated code to be able to select the target system for
+ which Classpath is compiled. Currently only 'Linux' is
+ supported; other targets will be added when available.
2003-06-23 John Leuner <jewel@debian.org>
@@ -16896,10 +18795,10 @@ get/Linux/target_native.h,
* javax/swing/plaf/basic/BasicBorders.java (MenuBarBorder): Re-written.
(getMenuBarBorder): New method.
- * javax/swing/plaf/basic/doc-files/
- BasicBorders.SplitPaneBorder-1.png,
- BasicBorders.SplitPaneBorder-2.png,
- BasicBorders.SplitPaneDividerBorder-1.png: New image.
+ * javax/swing/plaf/basic/doc-files/
+ BasicBorders.SplitPaneBorder-1.png,
+ BasicBorders.SplitPaneBorder-2.png,
+ BasicBorders.SplitPaneDividerBorder-1.png: New image.
2003-06-20 Michael Koch <konqueror@gmx.de>
@@ -17296,14 +19195,14 @@ get/Linux/target_native.h,
2003-06-11 Torsten Rupp <rupp@aicas.com>
- * native/jni/java-io/java_io_File.c:
- replace lstat() -> stat() in isDirectory/isFile to be able to follow symbolic links
+ * native/jni/java-io/java_io_File.c:
+ replace lstat() -> stat() in isDirectory/isFile to be able to follow symbolic links
2003-06-11 Torsten Rupp <rupp@aicas.com>
- * native/jni/java-net/javanet.c:
- replace recvfrom() -> recv() in case of stream sockets
+ * native/jni/java-net/javanet.c:
+ replace recvfrom() -> recv() in case of stream sockets
2003-06-11 Sascha Brawer <brawer@dandelis.ch>
@@ -18344,18 +20243,18 @@ get/Linux/target_native.h,
2003-04-30 Torsten Rupp <rupp@homer.aicas.com>
- * /cvsroot/classpath/classpath/java/net/Socket.java:
- Added try-catch-blocks to
+ * /cvsroot/classpath/classpath/java/net/Socket.java:
+ Added try-catch-blocks to
- * Socket.java: socket()
- * ServerSocket.java: socket()
- * DatagramSocket.java: socket()
+ * Socket.java: socket()
+ * ServerSocket.java: socket()
+ * DatagramSocket.java: socket()
- with clean-up of file-descriptors in case bind(), connect() or listen()
- fail. This fix will avoid loss of file-descriptors in the case create()
- is executed successfully, but bind/connect/listen fail with an exception.
- Then close() was not called and the file-descriptor allcoated by create()
- was not returned to the OS.
+ with clean-up of file-descriptors in case bind(), connect() or listen()
+ fail. This fix will avoid loss of file-descriptors in the case create()
+ is executed successfully, but bind/connect/listen fail with an exception.
+ Then close() was not called and the file-descriptor allcoated by create()
+ was not returned to the OS.
2003-04-30 Michael Koch <konqueror@gmx.de>
@@ -18428,10 +20327,10 @@ get/Linux/target_native.h,
2003-04-29 Casey Marshall <rsdio@metastatic.org>
* java/security/cert/CertPathValidator.java:
- (getIntstance) renamed to proper name.
- (getInstance) renamed from getIntstance.
+ (getIntstance) renamed to proper name.
+ (getInstance) renamed from getIntstance.
* java/security/cert/X509CRL.java:
- (getIssuerX500Principal) new method (1.4 compatibility).
+ (getIssuerX500Principal) new method (1.4 compatibility).
2003-04-29 Michael Koch <konqueror@gmx.de>
@@ -18573,50 +20472,50 @@ get/Linux/target_native.h,
2003-04-25 Stephen Crawley <crawley@dstc.edu.au>
* java/io/FileDescriptor.java : do dummy initialisation of
- the in/out/err statics before calling nativeInit, not after
+ the in/out/err statics before calling nativeInit, not after
* native/jni/java-io/FileDescriptor.c (nativeInit) : correct
- the method signature for the FileDescriptor constructor used
- to create the in/out/err FileDescriptor objects
+ the method signature for the FileDescriptor constructor used
+ to create the in/out/err FileDescriptor objects
2003-04-23 Casey Marshall <rsdio@metastatic.org>
Removed files:
* java/security/Engine.java: moved to gnu/java/security/Engine.java.
* gnu/java/security/provider/DERReader.java: obsoleted by
- gnu/java/security/der/DERReader.java.
+ gnu/java/security/der/DERReader.java.
* gnu/java/security/provider/DERWriter.java: obsoleted by
- gnu/java/security/der/DERWriter.java.
+ gnu/java/security/der/DERWriter.java.
Added files:
* gnu/java/io/Base64InputStream.java: input stream for decoding
- Base-64.
+ Base-64.
* gnu/java/io/ASN1ParsingException.java: used to signal
- high-level errors in DER encoded data.
+ high-level errors in DER encoded data.
* gnu/java/security/OID.java: object identifier class.
* gnu/java/security/der/BitString.java: ASN.1 BIT STRING type.
* gnu/java/security/der/DER.java: DER constants.
* gnu/java/security/der/DERReader.java: DER parser.
* gnu/java/security/der/DERValue.java: A single value read or
- written to a DER stream.
+ written to a DER stream.
* gnu/java/security/der/DERWriter.java: DER encoder.
* gnu/java/security/Engine.java: from java/security/Engine.java.
- (Changes from java/security/Engine.java follow)
- * Class and getInstance method made public.
- * getInstance now throws java.lang.reflect.InvocationTargetException.
- * Added additional getInstance method that takes an array of
- parameters to be passed to the constructor.
+ (Changes from java/security/Engine.java follow)
+ - Class and getInstance method made public.
+ - getInstance now throws java.lang.reflect.InvocationTargetException.
+ - Added additional getInstance method that takes an array of
+ parameters to be passed to the constructor.
* gnu/java/security/provider/DSAKeyFactory.java: translator for
- DSA keys.
+ DSA keys.
* gnu/java/security/provider/X509CertificateFactory.java: X.509
- certificate factory class.
+ certificate factory class.
* gnu/java/security/x509/X500DistinguishedName.java: ASN.1 Name
- construct implementation.
+ construct implementation.
* gnu/java/security/x509/X509Certificate.java: X.509
- certificate class.
+ certificate class.
* gnu/java/security/x509/X509CRL.java: X.509 certificate
- revocation list.
+ revocation list.
* gnu/java/security/x509/X509CRLEntry.java: X.509 certificate
- revocation list entry.
+ revocation list entry.
* java/security/cert/CRLSelector.java: JDK 1.4 support.
* java/security/cert/CertPathBuilder.java: JDK 1.4 support.
* java/security/cert/CertPathBuilderResult.java: JDK 1.4 support.
@@ -18630,7 +20529,7 @@ get/Linux/target_native.h,
* java/security/cert/CertStoreParameters.java: JDK 1.4 support.
* java/security/cert/CertStoreSpi.java: JDK 1.4 support.
* java/security/cert/CollectionCertStoreParameters.java: JDK 1.4
- support.
+ support.
* java/security/cert/LDAPCertStoreParameters.java: JDK 1.4 support.
* java/security/cert/PKIXBuilderParameters.java: JDK 1.4 support.
* java/security/cert/PKIXCertPathBuilderResult.java: JDK 1.4 support.
@@ -18644,57 +20543,57 @@ get/Linux/target_native.h,
Modified files:
* gnu/java/security/der/DEREncodingException.java: extend
- java.io.IOException instead of Exception.
+ java.io.IOException instead of Exception.
* gnu/java/security/provider/DSAParameters.java: use new DER
- parser.
- (engineInit(AlgorithmParameterSpec)) variable assignment
- bugfix.
+ parser.
+ (engineInit(AlgorithmParameterSpec)) variable assignment
+ bugfix.
* gnu/java/security/provider/DSASignature.java:
- (engineVerify()) use new DER parser.
+ (engineVerify()) use new DER parser.
* gnu/java/security/provider/DSAPrivateKey.java: added
- toString() method.
+ toString() method.
* gnu/java/security/provider/DSAPrivateKey.java:
- (<init>) variable assignment bug fix.
- Added toString() method.
+ (<init>) variable assignment bug fix.
+ Added toString() method.
* gnu/java/security/provider/Gnu.java: added new key factory and
- certificate factory entries.
+ certificate factory entries.
* java/security/AlgorithmParameterGenerator.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/AlgorithmParameters.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/KeyFactory.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/KeyPairGenerator.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/KeyStore.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/MessageDigest.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/SecureRandom.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/Signature.java:
- (getInstance) accomodate changes to Engine class.
+ (getInstance) accomodate changes to Engine class.
* java/security/cert/Certificate.java: Added writeReplace() method.
* java/security/cert/CertificateFactory.java: (JDK 1.4 compatibility)
- (getInstance(String)) and modified to use generic getInstance
- method.
- (getInstance(String, String)) likewise.
- getInstance(String, Provider) method added.
- getInstance(String, String, Provider) method removed.
- generateCertPath(InputStream) method added.
- generateCertPath(InputStream, String) method added.
- generateCertPath(List) method added.
- getCertPathEncodings() method added.
+ (getInstance(String)) and modified to use generic getInstance
+ method.
+ (getInstance(String, String)) likewise.
+ getInstance(String, Provider) method added.
+ getInstance(String, String, Provider) method removed.
+ generateCertPath(InputStream) method added.
+ generateCertPath(InputStream, String) method added.
+ generateCertPath(List) method added.
+ getCertPathEncodings() method added.
* java/security/cert/CertificateFactorySpi.java: (1.4 compatibility)
- engineGenerateCertPath(InputStream) method added.
- engineGenerateCertPath(InputStream, String) method added.
- engineGenerateCertPath(List) method added.
- engineGetCertPathEncodings() method added.
+ engineGenerateCertPath(InputStream) method added.
+ engineGenerateCertPath(InputStream, String) method added.
+ engineGenerateCertPath(List) method added.
+ engineGetCertPathEncodings() method added.
2003-04-23 Torsten Rupp <rupp@homer.aicas.com>
- * /cvsroot/classpath/classpath/java/net/InetAddress.java:
- Fixed parsing of IP numbers in getByName if sub-numbers are >127
+ * /cvsroot/classpath/classpath/java/net/InetAddress.java:
+ Fixed parsing of IP numbers in getByName if sub-numbers are >127
2003-04-21 Tom Tromey <tromey@redhat.com>
@@ -19047,8 +20946,8 @@ get/Linux/target_native.h,
2003-03-28 Torsten Rupp <rupp@homer.aicas.com>
* native/target/generic/target_generic.h,
- native/target/generic/target_generic_file.h,
- native/target/generic/target_generic_math_float.h:
+ native/target/generic/target_generic_file.h,
+ native/target/generic/target_generic_math_float.h:
Fix in extern-C-declaration
* native/target/generic/target_generic_math_int.h:
@@ -19061,11 +20960,11 @@ get/Linux/target_native.h,
Added TARGET_NATIVE_FORMAT_STRING macro
* native/target/Linux/target_native.h,
- native/target/Linux/target_native_file.h,
- native/target/Linux/target_native_math_float.h,
- native/target/Linux/target_native_math_int.h,
- native/target/Linux/target_native_misc.h,
- native/target/Linux/target_native_network.h:
+ native/target/Linux/target_native_file.h,
+ native/target/Linux/target_native_math_float.h,
+ native/target/Linux/target_native_math_int.h,
+ native/target/Linux/target_native_misc.h,
+ native/target/Linux/target_native_network.h:
Fix in extern-C-declaration
2003-03-28 Michael Koch <konqueror@gmx.de>
@@ -19381,21 +21280,21 @@ get/Linux/target_native.h,
2003-03-21 Torsten Rupp <rupp@homer.aicas.com>
* native/target/generic/target_generic.h,
- native/target/generic/target_generic_file.h,
- native/target/generic/target_generic_math_float.h,
- native/target/generic/target_generic_math_int.h,
- native/target/generic/target_generic_misc.h
- native/target/generic/target_generic_network.h
- native/target/Linux/target_native.h
- native/target/Linux/target_native_file.h
- native/target/Linux/target_native_math_float.h
- native/target/Linux/target_native_math_int.h
- native/target/Linux/target_native_misc.h
- native/target/Linux/target_native_network.h:
+ native/target/generic/target_generic_file.h,
+ native/target/generic/target_generic_math_float.h,
+ native/target/generic/target_generic_math_int.h,
+ native/target/generic/target_generic_misc.h
+ native/target/generic/target_generic_network.h
+ native/target/Linux/target_native.h
+ native/target/Linux/target_native_file.h
+ native/target/Linux/target_native_math_float.h
+ native/target/Linux/target_native_math_int.h
+ native/target/Linux/target_native_misc.h
+ native/target/Linux/target_native_network.h:
Target specific native code. This code is still not used, but please
- have a look. aicas GmbH will add and activate this code soon as
- possible (currently we are very busy; please be patient, we will do
- our best!)
+ have a look. aicas GmbH will add and activate this code soon as
+ possible (currently we are very busy; please be patient, we will do
+ our best!)
2003-03-20 John Leuner <jewel@debian.org>
@@ -19404,11 +21303,11 @@ get/Linux/target_native.h,
initialization
* java/io/FileDescriptor.java (close) : clear nativeFD on success
* java/net/PlainDatagramSocketImpl.java (setTTL): remap the TTL passed
- as an unsigned byte to an integer in the range 0..255
+ as an unsigned byte to an integer in the range 0..255
* native/jni/java-net/javanet.c (_javanet_get_option):
- implement ..._get(SOCKOPT_SO_BINDADDR) -> 'getsockname' syscall
+ implement ..._get(SOCKOPT_SO_BINDADDR) -> 'getsockname' syscall
* native/jni/java-net/javanet.c (_javanet_set_option):
- implement ..._set(SOCKOPT_SO_BINDADDR) -> Exception
+ implement ..._set(SOCKOPT_SO_BINDADDR) -> Exception
2003-03-20 Raif S. Naffah <raif@fl.net.au>
@@ -20446,7 +22345,7 @@ get/Linux/target_native.h,
* gnu/java/awt/peer/gtk/GtkTextComponentPeer.java
(getIndexAtPoint): added method
(getCharacterBounds): ditto
- (filterEvents): ditto
+ (filterEvents): ditto
* doc/www.gnu.org/Makefile: fix wml invocation
* doc/www.gnu.org/home.wml: fix link to japitools, link to providers
of core packages not yet part of Classpath
@@ -20727,9 +22626,9 @@ get/Linux/target_native.h,
2003-02-16 C. Brian Jones <cbj@gnu.org>
* NEWS: updated
- * configure.in: updated VERSION to 0.05
- * doc/api/Makefile.am: updated for gjdoc 0.4.1
- * doc/api/xslt: directory removed; no longer needed
+ * configure.in: updated VERSION to 0.05
+ * doc/api/Makefile.am: updated for gjdoc 0.4.1
+ * doc/api/xslt: directory removed; no longer needed
2003-02-15 Julian Dolby <dolby@us.ibm.com>
@@ -20748,17 +22647,17 @@ get/Linux/target_native.h,
(releaseLock): new method
(g_mutex_new_jni_impl): uses allocatePlainObject instead
(g_mutex_lock_jni_impl): uses takeLock instead
- (g_mutex_unlock_jni_impl): uses releaseLock instead
+ (g_mutex_unlock_jni_impl): uses releaseLock instead
(g_mutex_free_jni_impl): uses freePlainObject instead
- (g_private_new_jni_impl): implemented
+ (g_private_new_jni_impl): implemented
(g_private_get_jni_impl): implemented
(g_private_set_jni_impl): implemented
(g_cond_new_jni_impl): implemented; uses allocatePlainObject
- (g_cond_signal_jni_impl): implemented
+ (g_cond_signal_jni_impl): implemented
(g_cond_broadcast_jni_impl): implemented
- (g_cond_wait_jni_impl): implemented
- (g_cond_timed_wait_jni_impl): implemented
- (g_cond_free_jni_impl): implemented; uses freePlainObject
+ (g_cond_wait_jni_impl): implemented
+ (g_cond_timed_wait_jni_impl): implemented
+ (g_cond_free_jni_impl): implemented; uses freePlainObject
* native/jni/gtk-peer/gthread-jni.h: extern JavaVM *gdk_vm
2003-02-15 C. Brian Jones <cbj@gnu.org>
@@ -20864,7 +22763,7 @@ get/Linux/target_native.h,
(setProperties): Likewise.
2003-02-14 Michael Koch <konqueror@gmx.de>
-
+
* java/util/prefs/NodeChangeEvent.java
(serialVersionUID): New member variable (Merge back from libgcj).
* java/util/prefs/PreferenceChangeEvent.java
@@ -20874,7 +22773,7 @@ get/Linux/target_native.h,
libgcj).
2003-02-13 Michael Koch <konqueror@gmx.de>
-
+
* java/awt/Label.java
(Label): Don't implement Serializable directly.
(addNotify): Fixed typo in documentation.
@@ -20905,7 +22804,7 @@ get/Linux/target_native.h,
* java/security/SecureRandom.java (next): Avoid bias in results.
2003-02-13 Michael Koch <konqueror@gmx.de>
-
+
* java/awt/GridBagConstraints.java
(FIRST_LINE_ENT, FIRST_LINE_START, LAST_LINE_END, LAST_LINE_START,
LINE_END, LINE_START, PAGE_END, PAGE_START): New constants.
@@ -20918,7 +22817,7 @@ get/Linux/target_native.h,
(getFontPeer): Added @deprecated.
(getColorModel): Added exception documentation.
(getProperty): Fixed documentation.
-
+
2003-02-12 Jeroen Frijters <jeroen@sumatra.nl>
* java/io/File.java (File(String)): Only remove tail separators while
@@ -21135,7 +23034,7 @@ get/Linux/target_native.h,
* java/text/CollationElementIterator.java (secondaryOrder): return
value is supposed to be a short instead of an int; merged with gcj
(tertiaryOrder): ditto
- (primaryOrder): merged with gcj
+ (primaryOrder): merged with gcj
2003-01-25 Stephen Crawley <crawley@dstc.edu.au>
@@ -21147,7 +23046,7 @@ get/Linux/target_native.h,
2003-01-25 C. Brian Jones <cbj@gnu.org>
* NEWS: note jni.h updates and patches
- * include/jni.h.in (AttachCurrentThreadAsDaemon): new function
+ * include/jni.h.in (AttachCurrentThreadAsDaemon): new function
2003-01-25 Stephen Crawley <crawley@dstc.edu.au>
@@ -21155,8 +23054,8 @@ get/Linux/target_native.h,
(NewDirectByteBuffer): new function
(GetDirectBufferAddress): new function
(GetDirectBufferCapacity): new function
- (_JNI_VM_INTERNAL_TYPES_DEFINED): if defined, do not use default
- declarations for jobject, jfieldID, and jmethodID
+ (_JNI_VM_INTERNAL_TYPES_DEFINED): if defined, do not use default
+ declarations for jobject, jfieldID, and jmethodID
2003-01-24 Mark Wielaard <mark@klomp.org>
@@ -22009,17 +23908,17 @@ get/Linux/target_native.h,
* doc/www.gnu.org/docs/orp.wml: link->createlink conversion.
* doc/www.gnu.org/docs/redistribution.wml: link->createlink conversion.
* doc/www.gnu.org/docs/docs.wml: fix link to hacking doc,
- link->createlink conversion.
+ link->createlink conversion.
* doc/www.gnu.org/announce/19990206.wml: link->createlink conversion.
* doc/www.gnu.org/announce/20001120.wml: link->createlink conversion.
* doc/www.gnu.org/announce/20010106.wml: link->createlink conversion.
* doc/www.gnu.org/announce/20020208.wml: link->createlink conversion.
* doc/www.gnu.org/announce/announcements.wml: link->createlink
- conversion.
+ conversion.
* doc/www.gnu.org/savannah.css: new file
* doc/www.gnu.org/include/macros.wml: rename 'link' tag 'createlink'
* doc/www.gnu.org/home.wml: link to cp-tools sub-project,
- link->createlink conversion.
+ link->createlink conversion.
* doc/www.gnu.org/Makefile: copy *.css to webroot when publishing
2002-12-17 Sascha Brawer <brawer@acm.org>
@@ -22077,7 +23976,7 @@ get/Linux/target_native.h,
(findLoadedClass): Likewise.
2002-12-10 Mark Wielaard <mark@klomp.org>
- Tom Tromey <tromey@redhat.com>
+ Tom Tromey <tromey@redhat.com>
* java/net/URLClassLoader.java (getCanonicalFileURL): New method.
(JarURLLoader): Use it.
@@ -22645,9 +24544,9 @@ get/Linux/target_native.h,
2002-11-18 Jesse Rosenstock <jmr@ugcs.caltech.edu>
- * java/nio/charset/CoderResult.java (Cache.get): Fix a bug
- that was causing CoderResults to be cached, not WeakReferences
- to CoderResults.
+ * java/nio/charset/CoderResult.java (Cache.get): Fix a bug
+ that was causing CoderResults to be cached, not WeakReferences
+ to CoderResults.
2002-11-18 Joerg Brunsmann <joerg_brunsmann@yahoo.de>
@@ -22932,7 +24831,7 @@ get/Linux/target_native.h,
gnu/java/nio/ShortBufferImpl.java,
gnu/java/nio/SocketChannelImpl.java:
Dont use capacity(cap).
- * java/nio/InvalidMarkException.java: New file.
+ * java/nio/InvalidMarkException.java: New file.
* java/nio/Makefile.am: Added InvalidMarkException.java.
2002-11-13 Michael Koch <konqueror@gmx.de>
@@ -23861,13 +25760,13 @@ get/Linux/target_native.h,
* gnu/java/io/PlatformHelper.java (INITIAL_MAX_PATH): new constant.
(toCanonicalForm): Use new constant to optimize StringBuffer usage.
Return lowercase path when isWindows == true.
- * gnu/java/lang/SystemClassLoader.java (classpath): New static field.
+ * gnu/java/lang/SystemClassLoader.java (classpath): New static field.
(pathinfos): Likewise.
(getSystemResource): Refactored, cache partial result for each path
item in classpath.
* gnu/java/net/protocol/file/Handler.java (toExternalForm): New
method implementation specific to file protocol.
- * gnu/java/net/protocol/http/HttpURLConnection.java
+ * gnu/java/net/protocol/http/HttpURLConnection.java
(buffered_out_stream): New field.
(connect): Don't set in_stream, wrap out_stream BufferedOutputStream.
Move sending request and receiveing reesponce to new methods.
@@ -24175,15 +26074,15 @@ get/Linux/target_native.h,
* java/awt/dnd/DropTargetListener.java: New file.
* java/awt/dnd/MouseDragGestureRecognizer.java: New file.
* java/awt/dnd/peer/DropTargetContextPeer.java: New file.
- * java/awt/dnd/Makefile.am: Adding all the new files.
+ * java/awt/dnd/Makefile.am: Adding all the new files.
2002-09-26 Eric Blake <ebb9@email.byu.edu>
- * java/applet/AppletContext.java (setStream): Fix signature typo.
- * javax/accessibility/AccessibleEditableText.java (cut, delete):
- Ditto.
- * javax/accessibility/AccessibleHyperlink.java
- (getAccessibleActionAnchor, getAccessibleActionObject): Ditto.
+ * java/applet/AppletContext.java (setStream): Fix signature typo.
+ * javax/accessibility/AccessibleEditableText.java (cut, delete):
+ Ditto.
+ * javax/accessibility/AccessibleHyperlink.java
+ (getAccessibleActionAnchor, getAccessibleActionObject): Ditto.
2002-09-26 Michael Koch <konqueror@gmx.de>
@@ -24300,7 +26199,7 @@ get/Linux/target_native.h,
* java/net/DatagramPacket.java: updated to JDK 1.4 API
new methods are:
DatagramPacket(byte[] buf, int offset, int length, SocketAddress
- address),
+ address),
DatagramPacket(byte[] buf, int length, SocketAddress address),
void setSocketAddress(SocketAddress address)
public SocketAddress getSocketAddress()
@@ -24321,7 +26220,7 @@ get/Linux/target_native.h,
2002-08-28 Michael Koch <konqueror@gmx.de>
* java/net/Authenticator.java: added some documentation.
-
+
2002-08-27 Michael Koch <konqueror@gmx.de>
* java/net/BindException.java,
@@ -24721,7 +26620,7 @@ get/Linux/target_native.h,
(deflateSlow): Likewise.
2002-07-02 Tom Tromey <tromey@redhat.com>
- David Hovemeyer <daveho@cs.umd.edu>
+ David Hovemeyer <daveho@cs.umd.edu>
* java/text/ChoiceFormat.java
(format(double,StringBuffer,FieldPosition)): Fix fencepost error
@@ -25318,9 +27217,9 @@ get/Linux/target_native.h,
2002-04-30 Etienne M. Gagnon <etienne.gagnon@uqam.ca>
* native/jni/java-io/Makefile.am: Re-added java_nio.c into JNI
- build.
+ build.
* native/jni/java-io/java_nio.c: Solved compile time problems under
- gcc 2.95.x and added missing Copyright statement.
+ gcc 2.95.x and added missing Copyright statement.
2002-04-30 Eric Blake <ebb9@email.byu.edu>
@@ -26642,7 +28541,7 @@ get/Linux/target_native.h,
2002-03-12 Ronald Veldema <rveldema@cs.vu.nl>
* Removes dependencies on manta; javax.swing,
- gnu.java.nio and java.nio now compile with jikes;
+ gnu.java.nio and java.nio now compile with jikes;
2002-03-11 C. Brian Jones <cbj@gnu.org>
@@ -29669,7 +31568,7 @@ get/Linux/target_native.h,
renamed CLASSPATH_CHECK_JAPHAR to CLASSPATH_WITH_JAPHAR
renamed CLASSPATH_CHECK_KAFFE to CLASSPATH_WITH_KAFFE
added CLASSPATH_FIND_JAVAC and supporting functions re-arranged,
- support for gcj added
+ support for gcj added
added CLASSPATH_FIND_JAVA and supporting functions
added CLASSPATH_WITH_JAVAH and supporting functions
added CLASSPATH_WITH_CLASSLIB
@@ -29680,17 +31579,17 @@ get/Linux/target_native.h,
added --enable-jni (not built by default)
added --enable-cni (not built by default, currently not implemented)
added automake conditional CREATE_JNI_HEADERS, if true then build
- JNI headers
+ JNI headers
added automake conditional CREATE_JNI_LIBRARIES, if true then build
- JNI native libraries
+ JNI native libraries
added automake conditional CREATE_CNI_LIBRARIES, if true then build
- CNI native libraries, currently not implemented
+ CNI native libraries, currently not implemented
moved checks related to building JNI libraries so they are avoided
- when not building JNI libraries
+ when not building JNI libraries
added AC_CYGWIN and AC_MINGW32 tests when building JNI libraries
removed JVM specific checks
moved --with-java, --with-javah, --with-classlib, --with-includedir
- macros to acinclude.m4
+ macros to acinclude.m4
removed --enable-developer-mode
added macro call to link jni_md.h
added jni.h to OUTPUT to place it in ${top_builddir}/include easily
@@ -30807,9 +32706,9 @@ get/Linux/target_native.h,
* java/awt/ActiveEvent.java: added this file (new interface)
* gnu/java/awt/peer/gtk/Test.java (new MouseAdapter): changed event name from e to me
* gnu/java/awt/peer/gtk/TestAWT.java: fixed ambiguous references to getSize()
- and getBackground()
+ and getBackground()
* gnu/java/awt/peer/gtk/GtkPopupMenuPeer.java (show): changed method to not use
- AWT 1.0 Event
+ AWT 1.0 Event
2001-08-11 John Leuner <jewel@debian.org>
@@ -31779,15 +33678,15 @@ get/Linux/target_native.h,
* Release classpath-0.02
* doc/www.gnu.org/announce/20010106.mhtml: New file.
* resource/japhar-0.09.patch.1: patch for Japhar 0.09 for
- GNU Classpath 0.02 release.
+ GNU Classpath 0.02 release.
* NEWS: Added 0.02 release information.
* configure.in: Update release number, add additional Makefile output
- files.
+ files.
* doc/Makefile.am: New target 'docs' can be used to generate
- formal postscript documentation.
+ formal postscript documentation.
* doc/texinfo.tex: Updated to tetex 1.0.7 release.
* doc/www.gnu.org/classpath.mhtml: Notice of license change and
- other small enhancements.
+ other small enhancements.
* gnu/java/beans/Makefile.am: Removed ChangeLog from EXTRA_DIST
* gnu/java/beans/editors/Makefile.am: Ditto.
* gnu/java/beans/info/Makefile.am: Ditto.
@@ -31803,7 +33702,7 @@ get/Linux/target_native.h,
* java/util/Makefile.am: Ditto.
* resource/Makefile.am: Add japhar-0.09.patch.1 to EXTRA_DIST
* resource/java/security/Makefile.am: Rules to install security
- policy in $(libdir)/security.
+ policy in $(libdir)/security.
2001-01-06 Anthony Green <green@redhat.com>
diff --git a/LICENSE b/LICENSE
index 55f62a13f..2678ffd7f 100644
--- a/LICENSE
+++ b/LICENSE
@@ -6,27 +6,77 @@ in the file COPYING. If you do not have the source code, it is available at:
http://www.gnu.org/software/classpath/
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version.
-
-External libraries included with GNU Classpath may be distributed under
-different licensing terms. Refer to the documentation for each package
-located in the external directory.
-
-Parts of the native library fdlibm in native/fdlibm are copyright of
-Sun Microsystems, Inc. or AT&T.
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version.
+
+GNU Classpath also contains other (example) code distributed under other
+terms. External libraries included with GNU Classpath may also be
+distributed under different licensing terms.
+The location and the exact terms of this other code is mentioned below.
+
+
+Directory examples.
+All example code is distributed under the GNU General Public License (GPL).
+Each example source code files carries the following notice:
+
+ GNU Classpath examples are free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ GNU Classpath examples are distributed in the hope that they will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath examples; see the file COPYING. If not,
+ write to the Free Software Foundation, 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+For more information see the README file in the examples directory.
+
+
+Directory native/fdlibm
+fdlimb contains general algorithms useful for runtimes and compilers to
+support strict double and float mathematical operations.
+
+fdlibm files carry the following notices:
+
+ Copyright (c) 1991 by AT&T.
+
+ Permission to use, copy, modify, and distribute this software for any
+ purpose without fee is hereby granted, provided that this entire notice
+ is included in all copies of any software which is or includes a copy
+ or modification of this software and in all copies of the supporting
+ documentation for such software.
+
+ THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
+ WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY
+ REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
+ OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
+
+ Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
+
+ Developed at SunPro, a Sun Microsystems, Inc. business.
+ Permission to use, copy, modify, and distribute this
+ software is freely granted, provided that this notice
+ is preserved.
+
+The upstream for fdlibm is libgcj (http://gcc.gnu.org/java/), they sync
+again with the 'real' upstream (http://www.netlib.org/fdlibm/readme).
diff --git a/Makefile.am b/Makefile.am
index 5b20831ef..4bd556bb3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,7 +1,7 @@
## Input file for automake to generate the Makefile.in used by configure
# lib first, to compile .class files before native code, last examples
-SUBDIRS = lib doc external include native resource examples
+SUBDIRS = lib doc include native resource examples
native: lib
diff --git a/NEWS b/NEWS
index 44c21952a..676235102 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-New in release 0.11 (not released yet)
+New in release 0.11 (Sep 13, 2004)
* javax.swing.Spring and SpringLayout support.
* Added pluggable look and feel support for BasicTextFieldUI and
@@ -13,6 +13,28 @@ New in release 0.11 (not released yet)
* Improved java.awt.image.BufferedImage support.
* AWT 1.0 event model support.
* GNU Classpath now comes with some example programs (see examples/README).
+* New javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.net,
+ javax.net.ssl, javax.security.auth, javax.security.auth.callback,
+ javax.security.auth.login, javax.security.auth.x500, javax.security.sasl
+ and org.ietf.jgss packages are now officially part of GNU Classpath.
+ Extra crypto algorithms can be obtained from the GNU Crypto project,
+ a full TLS implementation is provided by the Jessie project.
+ http://www.gnu.org/software/gnu-crypto/
+ http://www.nongnu.org/jessie/
+* Frame.setIconImage() support.
+* AWT GDKGraphics scaling.
+* New configure flag --enable-gtk-cairo to build Graphics2D implementation
+ build on cairo and pangoft2. Enabled at runtime by defining the system
+ property gnu.java.awt.peer.gtk.Graphics=Graphics2D.
+* javax.swing.JSpinner implemented.
+* Extensive documentation update for java.util collection classes.
+* java.awt.geom completed. Area, Arc2D, Ellipse2D and Line2D implemented.
+* GNU JAXP is no longer included with GNU Classpath. Runtime, compiler and
+ tool integrators are encouraged to directly integrate GNU JAXP.
+ This release has been tested against GNU JAXP 1.1.
+ http://www.gnu.org/software/classpathx/jaxp/jaxp.html
+* JColorChooser, JComboBox and JTextField implemented, including example
+ uses in GNU Classpath Examples swing Demo.
Runtime interface Changes:
@@ -20,6 +42,12 @@ Runtime interface Changes:
a reference implementation that most VMs can use.
* java.lang.VMSystem has a new getenv(String) method and a reference C/JNI
implementation that should work on most Posix like systems.
+* java.util.TimeZone has been split into a platform independent class and
+ a platform dependent class VMTimeZone. GNU Classpath comes with a generic
+ way to get at the default time zone for Posix/GNU-like platforms.
+* [VM]AccessController improvements. In particular it handles
+ `doPrivileged' calls better, and allows for recursive `doPrivileged'
+ calls in the same Thread. (see vm/reference/java/security/)
New in release 0.10 (Jul 9, 2004)
diff --git a/configure.ac b/configure.ac
index 0a5123bf9..c5ab115dc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ dnl -----------------------------------------------------------
dnl define([AC_CACHE_LOAD], )dnl
dnl define([AC_CACHE_SAVE], )dnl
-AC_INIT([GNU Classpath],[0.10+cvs],[classpath@gnu.org],[classpath])
+AC_INIT([GNU Classpath],[0.11+cvs],[classpath@gnu.org],[classpath])
AC_CONFIG_SRCDIR(java/lang/System.java)
AC_CANONICAL_TARGET
@@ -122,23 +122,48 @@ if test "x${COMPILE_JNI}" = xyes; then
dnl We check for sys/filio.h because Solaris 2.5 defines FIONREAD there.
dnl On that system, sys/ioctl.h will not include sys/filio.h unless
dnl BSD_COMP is defined; just including sys/filio.h is simpler.
- AC_CHECK_HEADERS(unistd.h sys/types.h sys/config.h sys/ioctl.h asm/ioctls.h)
- AC_CHECK_HEADERS(inttypes.h stdint.h utime.h sys/utime.h sys/filio.h)
+ AC_CHECK_HEADERS([unistd.h sys/types.h sys/config.h sys/ioctl.h asm/ioctls.h])
+ AC_CHECK_HEADERS([inttypes.h stdint.h utime.h sys/utime.h sys/filio.h])
+ AC_CHECK_HEADERS([sys/time.h])
AC_EGREP_HEADER(uint32_t, stdint.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
AC_EGREP_HEADER(uint32_t, inttypes.h, AC_DEFINE(HAVE_INT32_DEFINED, 1, [Define to 1 if you have uint32_t]))
AC_EGREP_HEADER(u_int32_t, sys/types.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
AC_EGREP_HEADER(u_int32_t, sys/config.h, AC_DEFINE(HAVE_BSD_INT32_DEFINED, 1, [Define to 1 if you have BSD u_int32_t]))
- AC_CHECK_FUNCS(ftruncate fsync select)
- AC_CHECK_FUNCS(gethostname socket strerror fork pipe execve open close lseek \
- fstat read write htonl memset htons connect getsockname sizeof getpeername \
- bind listen accept recvfrom send sendto setsockopt getsockopt time mktime)
+ AC_CHECK_FUNCS([ftruncate fsync select])
+ AC_CHECK_FUNCS([gethostname socket strerror fork pipe execve open close])
+ AC_CHECK_FUNCS([lseek fstat read write htonl memset htons connect])
+ AC_CHECK_FUNCS([getsockname sizeof getpeername bind listen accept])
+ AC_CHECK_FUNCS([recvfrom send sendto setsockopt getsockopt time mktime])
+ AC_CHECK_FUNCS([localtime_r])
AC_HEADER_TIME
AC_STRUCT_TM
AC_STRUCT_TIMEZONE
+ AC_MSG_CHECKING([for tm_gmtoff in struct tm])
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]],[[struct tm tim; tim.tm_gmtoff = 0;]])],
+ [AC_DEFINE(STRUCT_TM_HAS_GMTOFF, 1, [Define if struct tm has tm_gmtoff field.])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ AC_MSG_CHECKING([for global timezone variable])
+ dnl FIXME: we don't want a link check here because that won't work
+ dnl when cross-compiling. So instead we make an assumption that
+ dnl the header file will mention timezone if it exists.
+ dnl Don't find the win32 function timezone
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[void i(){long z2 = 2*timezone;}]])],
+ [AC_DEFINE(HAVE_TIMEZONE, 1, [Define if global 'timezone' exists.])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)
+ AC_MSG_CHECKING([for global _timezone variable])
+ dnl FIXME: As above, don't want link check
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <time.h>]], [[long z2 = _timezone;]])],
+ [AC_DEFINE(HAVE_UNDERSCORE_TIMEZONE, 1,
+ [Define if your platform has the global _timezone variable.])
+ AC_MSG_RESULT(yes)],
+ [AC_MSG_RESULT(no)])])])
+
AC_C_CONST
dnl FIXME - does not allow cross compiling
@@ -320,7 +345,6 @@ dnl -----------------------------------------------------------
AC_CONFIG_FILES([Makefile
doc/Makefile
doc/api/Makefile
-external/Makefile
gnu/classpath/Configuration.java
include/Makefile
native/Makefile
@@ -346,6 +370,7 @@ resource/gnu/java/awt/peer/gtk/Makefile
resource/gnu/regexp/Makefile
resource/java/Makefile
resource/java/util/Makefile
+resource/java/util/logging/Makefile
resource/java/security/Makefile
resource/org/Makefile
resource/org/ietf/Makefile
diff --git a/doc/api/Makefile.am b/doc/api/Makefile.am
index 12e782b81..73cff59eb 100644
--- a/doc/api/Makefile.am
+++ b/doc/api/Makefile.am
@@ -31,13 +31,11 @@ uninstall-local:
html: create_html
core := $(shell cd $(top_srcdir) && $(FIND) java javax -type d ! -name CVS ! -name doc-files -print | tr '/' '.' | grep -v "java.awt.dnd.peer" | grep -v "java.awt.peer")
-jaxp := $(shell cd $(top_srcdir)/external/jaxp/source && $(FIND) javax org -type d ! -name CVS -print | tr '/' '.' | grep -v "org.w3c.dom.")
# Just generate api doc for the core packages.
# Adding the external ones takes a lot more time and we should reference
# them anyway since we will place out own copyright notive on the generated
# pages.
-# packages = $(core) $(jaxp)
packages = $(core)
#| grep -v "^java\$" )
date := $(shell $(DATE))
@@ -51,7 +49,7 @@ clean:
#create_xml:
# -$(MKDIR) xml > /dev/null 2>&1
# $(GJDOC) -sourcepath \
-# "$(top_srcdir):$(top_srcdir)/external/jaxp/source:$(top_srcdir)/vm/reference" \
+# "$(top_srcdir):$(top_srcdir)/vm/reference" \
# -doclet gnu.classpath.tools.doclets.xmldoclet.Driver \
# -d xml $(packages)
# -touch create_xml
@@ -72,24 +70,4 @@ create_html:
$(GJDOC) -sourcepath "$(top_srcdir):$(top_srcdir)/vm/reference" \
-d html -bottomnote "$(srcdir)/classpath-copyright.xml" \
$(packages)
-
-# Including the external ones (jaxp) this would be:
-# create_html:
-# -$(MKDIR) html > /dev/null 2>&1
-# $(GJDOC) -sourcepath \
-# "$(top_srcdir):$(top_srcdir)/vm/reference:$(top_srcdir)/external/jaxp/source" \
-# -d html -bottomnote "$(srcdir)/classpath-copyright.xml" \
-# $(packages)
-
-# -$(CP) -Ru $(srcdir)/xslt/common html
-# $(XSLTPROC) \
-# --novalid \
-# --param verbose "1" \
-# --param now "'$(date)'" \
-# --param copyrightfile "'$(srcdir)/classpath-copyright.xml'" \
-# --param windowtitle "'GNU Classpath CVS'" \
-# --param targetdir "'html'" \
-# "$(srcdir)/xslt/gjdocxml2html.xsl" \
-# "xml/index.xml"
-touch create_html
-
diff --git a/doc/www.gnu.org/announce/20040913.wml b/doc/www.gnu.org/announce/20040913.wml
new file mode 100755
index 000000000..8d0ad3473
--- /dev/null
+++ b/doc/www.gnu.org/announce/20040913.wml
@@ -0,0 +1,245 @@
+#!wml --include=..
+
+#use wml::std::page
+#use wml::std::lang
+#use wml::fmt::isolatin
+#use wml::std::case global=upper
+
+<lang:star:slice:>
+
+<set-var last-modified-author="prr">
+
+#include <include/macros.wml>
+
+<header title="GNU Classpath 0.11 Announcement (2004-09-13)">
+<pre>
+We are pleased to announce a new developer snapshot release of GNU Classpath.
+
+GNU Classpath, Essential Libraries for Java, is a project to create free
+core class libraries for use with runtimes, compilers and tools for the
+java programming language.
+
+GNU Classpath 0.11 can be downloaded from
+ftp://ftp.gnu.org/pub/gnu/classpath/
+or one of the ftp.gnu.org mirrors
+http://www.gnu.org/order/ftp.html
+
+File: classpath-0.11.tar.gz
+MD5sum: fa0e0f2532b838e67f9d9f93d45556a2
+
+Some highlights of this release (more extensive list below):
+
+Inclusion of full javax.crypto, javax.security, javax.net and
+subpackages. Complete implementation of java.awt.geom. GTK+ 2.4 AWT
+peer implementation for AWT FileDialog, better java.awt.image
+LookupTable, Kernel and BufferedImage support. AWT 1.0 Event Model
+implemented, and new Swing classes (Spring, SpringLayout, JMenu,
+JPopupMenu, JColorChooser, JComboBox, JTextField, internal JFrame
+support and start of JTable and JTree implementations). The Collection
+classes have seen extensive documentation updates. GNU Classpath
+Examples have been added - a GPL demo framework for AWT and Swing.
+
+Included, but not activated by default in this release is a Graphics2D
+implementation based on the Cairo Graphics framework
+(http://www.cairographics.org). Enabling this makes programs like
+JFreeChart work on GNU Classpath based runtimes.
+
+[It is recommended that people wanting to experiment with the
+Graphics2D implementation follow the instructions for building gcj
+with jhbuild which automatically builds the latest CVS version of GCJ
+and Cairo at http://people.redhat.com/fitzsim/gcj-and-jhbuild.html]
+
+Not yet included is an implementation of Generic collection classes
+and classes for other 1.5 language extensions. Work on this is being
+done on a special development branch that will be included in a future
+GNU Classpath release when free runtimes, compilers and tools have all
+been upgraded to support these new language features.
+
+GNU Classpath uses the Mauve test suite for Compatibility, Completeness
+and Correctness checking. This release passes 16816 of 17102 mauve tests.
+Free Software programs and libraries tested against this release are
+Ant, Eclipse 2.1, Eclipse 3.0 (starts up, but does not yet completely
+run), JFreeChart (see above), the Nice programming language
+environment (which can now be bootstrapped with any GNU Classpath
+based runtime and which works out of the box with Kaffe and GCJ for
+creating native executables), gcjwebplugin and many other programs,
+libraries and applets.
+
+Here are answers to some questions you might have about this project and
+this release.
+
+1). Who should use this software?
+
+Although GNU Classpath is already capable of supporting many
+applications written in the java programming language, this is a
+development release. As such, there are still some unfinished
+components, and some problems are to be expected. You should install it
+if you are interested in GNU Classpath development or reporting bugs.
+We appreciate both.
+
+For end users we recommend to use one of the development environments
+based on GNU Classpath which combine the core libraries with compilers
+and other tools needed for creating applications and libraries.
+
+ * GCC with GCJ (http://gcc.gnu.org/java/)
+ * Kaffe (http://www.kaffe.org/)
+
+2). What is required to build/install/run?
+
+GNU Classpath requires a working GNU build environment and a byte code
+compiler such as jikes, gcj or kjc. When creating native code you will
+also need a working C compiler and up to date Gnome development
+libraries (gtk+, libart and gdk-pixbuf). More information on the
+precise version numbers for the tools and libraries can be found in
+the INSTALL file.
+
+You will also need a runtime environment. The following runtime
+environments should work out of the box with GNU Classpath
+
+ * JamVM (http://jamvm.sourceforge.net/)
+ * Jikes RVM (http://www.ibm.com/developerworks/oss/jikesrvm/)
+ * Kissme (http://kissme.sourceforge.net/)
+
+Note that these are just byte code execution runtimes. For development
+of programs written in the java programming language you will also
+need compilers and other tools for creating libraries and/or
+executables (see question 1).
+
+For other environments that might need modified version of the current
+release see the README file. A complete list of virtual machines and
+compilers known to be based on GNU Classpath can be found at our
+website: http://www.gnu.org/software/classpath/stories.html
+
+2). What platforms are supported?
+
+GNU/Linux and FreeBSD on x86 and powerpc are regularly tested by the
+developers. We plan to eventually support many others.
+
+5). Where do I go for more information?
+
+The project home page with information on our mailing list can be
+found at http://www.gnu.org/software/classpath/
+
+A good overview of the current status can be found on the GNU Classpath
+at FOSDEM'04 page which describes the last GNU Classpath hacker meeting.
+It includes reports and presentations on the current status and future
+plans: http://www.gnu.org/software/classpath/events/fosdem04.html
+
+The following presentation given during the Desktop Developers
+Conference shows how to integrate GNU Claspath and GCJ more with the
+Free Desktop environments: http://people.redhat.com/fitzsim/ddc2004/
+
+6). How do I extend the functionality of the core classes?
+
+Besides combining GNU Classpath with the runtimes and compilers above
+you might want to add support for additional encryption libraries and
+algorithms as provided by GNU Crypto
+(http://www.gnu.org/software/gnu-crypto/). And for additional
+extension libraries (mail, xml, activation, infobus, servlet) check
+out GNU ClasspathX (http://www.gnu.org/software/classpathx).
+
+Additional network protocol support is provided by a sub-project
+called GNU Classpath Inetlib, an extension library to provide extra
+network protocol support (ftp, finger, gopher) for GNU Classpath, but
+it can also standalone to ease adding http, imap, pop3 and smtp client
+support to applictions. Also distributed from
+<ftp://ftp.gnu.org/gnu/classpath/>
+
+The following projects extend the functionality of GNU Classpath
+with additional algorithms, new core packages and tools.
+All are released under GPL compatible licenses:
+
+* Jessie: A free implementation of the JSSE. Secure Sockets Extension.
+ http://www.nongnu.org/jessie/
+* Tritonus: A implementation of the javax.sound API.
+ http://www.tritonus.org/
+* gcjwebplugin: A plugin for the execution of applets in web browsers.
+ http://www.nongnu.org/gcjwebplugin/
+
+Note that the above libraries might already have been included in the
+various platforms that also integrate GNU Classpath like done by the
+Kaffe project.
+
+6). What is new in this release?
+
+New in release 0.11 (Sep 13, 2004)
+(See the ChangeLog file for a full list of changes.)
+
+* javax.swing.Spring and SpringLayout support.
+* Added pluggable look and feel support for BasicTextFieldUI and
+ BasicToolBarSeparatorUI.
+* java.swing.text support for (Default and Layered) Highlighter, FieldView,
+ PlainView, TabExpander and TabableView added.
+* Start of JTable and JTree implementation.
+* Internal Swing frames work.
+* JMenu and JPopupMenu work.
+* New gtk+ AWT FileDialog peer now based on gtk+2.4 or higher.
+* java.awt.image LookupTables and kernel support.
+* Improved java.awt.image.BufferedImage support.
+* AWT 1.0 event model support.
+* GNU Classpath now comes with some example programs (see examples/README).
+* New javax.crypto, javax.crypto.interfaces, javax.crypto.spec, javax.net,
+ javax.net.ssl, javax.security.auth, javax.security.auth.callback,
+ javax.security.auth.login, javax.security.auth.x500, javax.security.sasl
+ and org.ietf.jgss packages are now officially part of GNU Classpath.
+ Extra crypto algorithms can be obtained from the GNU Crypto project,
+ a full TLS implementation is provided by the Jessie project.
+ http://www.gnu.org/software/gnu-crypto/
+ http://www.nongnu.org/jessie/
+* Frame.setIconImage() support.
+* AWT GDKGraphics scaling.
+* New configure flag --enable-gtk-cairo to build Graphics2D implementation
+ build on cairo and pangoft2. Enabled at runtime by defining the system
+ property gnu.java.awt.peer.gtk.Graphics=Graphics2D.
+* javax.swing.JSpinner implemented.
+* Extensive documentation update for java.util collection classes.
+* java.awt.geom completed. Area, Arc2D, Ellipse2D and Line2D implemented.
+* GNU JAXP is no longer included with GNU Classpath. Runtime, compiler and
+ tool integrators are encouraged to directly integrate GNU JAXP.
+ This release has been tested against GNU JAXP 1.1.
+ http://www.gnu.org/software/classpathx/jaxp/jaxp.html
+* JColorChooser, JComboBox and JTextField implemented, including example
+ uses in GNU Classpath Examples swing Demo.
+
+Runtime interface Changes:
+
+* java.lang.Compiler now uses the new java.lang.VMCompiler; there is
+ a reference implementation that most VMs can use.
+* java.lang.VMSystem has a new getenv(String) method and a reference C/JNI
+ implementation that should work on most Posix like systems.
+* java.util.TimeZone has been split into a platform independent class and
+ a platform dependent class VMTimeZone. GNU Classpath comes with a generic
+ way to get at the default time zone for Posix/GNU-like platforms.
+* [VM]AccessController improvements. In particular it handles
+ `doPrivileged' calls better, and allows for recursive `doPrivileged'
+ calls in the same Thread. (see vm/reference/java/security/)
+
+The following people helped with this release:
+
+Andreas Tobler (libgcj merging), Andrew Haley (object streams), Andrew
+John Hughes (documentation, swing and acessibility), Archie Cobbs
+(freebsd testing and bugfixing), Bryce McKinlay (libgcj merging, image
+producers, access controller actions), Casey Marshall (crypto,
+security and access controller implementation), Craig Black (image
+scaling, round rect support, awt tear-off menus), Dalibor Topic (kaffe
+merging), David Gilbert (documentation updates, mauve tests, awt and
+geom bug fixes), David Jee (awt gtk+ image and choice fixes, frame
+icon support, focus manger), Florian Weimer (bug reporting), Graydon
+Hoare (lots of Swing and Graphics2D implementation and fixes), Guilhem
+Lavaux (java.text bug fixing), Jerry Quinn (java.awt.image lookup
+table and kernel implemented), Jeroen Frijters (Runtime loadlibrary,
+encoding manager, file and classloader fixes), Ka-Hing Cheung
+(jspinner implementation), Kim Ho (jcolorchooser, jtooltip, internal
+jfram implementations, event and repaint manager fixes), Mark Wielaard
+(packaging and coordination), Michael Koch (javax.swing.text
+implementation, build environment, embedded window support, libgcj
+merging, bug fixes), Olga Rodimina (swing combobox, jmenu and popup
+menu support), Patrik Reali (web master, nio vm class restructuring),
+Roman Kennke (boxlayout, spring and springlayout), Sven de Marothy
+(java.awt.geom), Thomas Fitzsimmons (lots of gtk+ peers work, awt 1.0
+event model), Tom Tromey (bug fixing, libgcj merging, vmcompiler).
+
+
+</pre>
+
+<footer>
diff --git a/doc/www.gnu.org/downloads/downloads.wml b/doc/www.gnu.org/downloads/downloads.wml
index 9c78e833b..a0f6c99fc 100644
--- a/doc/www.gnu.org/downloads/downloads.wml
+++ b/doc/www.gnu.org/downloads/downloads.wml
@@ -77,10 +77,10 @@ sub mylink {
<download-block>
<download
- date="12 July 2004"
- version="0.10"
- url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.10.tar.gz"
- notes="http://www.gnu.org/software/classpath/announce/20040712.html"
+ date="13 September 2004"
+ version="0.11"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.11.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20040913.html"
>
<!-- download
@@ -100,6 +100,12 @@ sub mylink {
<download-block>
<download
+ date="12 July 2004"
+ version="0.10"
+ url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.10.tar.gz"
+ notes="http://www.gnu.org/software/classpath/announce/20040712.html"
+>
+<download
date="02 May 2004"
version="0.09"
url="ftp://ftp.gnu.org/gnu/classpath/classpath-0.09.tar.gz"
diff --git a/doc/www.gnu.org/newsitems.txt b/doc/www.gnu.org/newsitems.txt
index ae25fefa2..1c8446ac4 100644
--- a/doc/www.gnu.org/newsitems.txt
+++ b/doc/www.gnu.org/newsitems.txt
@@ -1,3 +1,11 @@
+<newsitem date="13 Sep 2004">
+<createlink name="GNU Classpath 0.11" url="announce/20040913.html">
+</newsitem>
+
+<newsitem date="03 Sep 2004">
+<createlink url="ftp://ftp.gnu.org/gnu/classpath/inetlib-1.1.tar.gz" name="inetlib 1.1"> released.
+</newsitem>
+
<newsitem date="15 Aug 2004">
<createlink url="http://lists.gnu.org/archive/html/classpath-patches/2004-08/msg00078.html" name="JSpinner"> added to classpath.
</newsitem>
diff --git a/external/.cvsignore b/examples/.cvsignore
index 282522db0..282522db0 100644
--- a/external/.cvsignore
+++ b/examples/.cvsignore
diff --git a/examples/README b/examples/README
index ca10ef4be..5452b8023 100644
--- a/examples/README
+++ b/examples/README
@@ -1,4 +1,5 @@
-These examples show how the GNU Classpath library can be used.
+This directory contains example programs that show how the GNU Classpath
+library can be used.
Each example has its own package under gnu.classpath.examples and has a
class Demo which contains a main() method to run that particular example.
@@ -36,7 +37,7 @@ and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
-GNU Classpath examples is distributed in the hope that it will be
+GNU Classpath examples are distributed in the hope that they will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
diff --git a/examples/examples.zip b/examples/examples.zip
new file mode 100644
index 000000000..b144b9e24
--- /dev/null
+++ b/examples/examples.zip
Binary files differ
diff --git a/examples/gnu/classpath/examples/awt/Demo.java b/examples/gnu/classpath/examples/awt/Demo.java
index 5be8d6a28..91b67de1c 100644
--- a/examples/gnu/classpath/examples/awt/Demo.java
+++ b/examples/gnu/classpath/examples/awt/Demo.java
@@ -118,11 +118,17 @@ class Demo
});
menu.add(quit);
mb.add (menu);
+
menu = new Menu("Edit", true);
menu.add(new MenuItem("Cut"));
menu.add(new MenuItem("Copy"));
menu.add(new MenuItem("Paste"));
mb.add (menu);
+
+ Menu helpMenu = new Menu("Help");
+ helpMenu.add(new MenuItem("About"));
+ mb.add(helpMenu);
+ mb.setHelpMenu(helpMenu);
setMenuBar (mb);
diff --git a/examples/gnu/classpath/examples/swing/Demo.java b/examples/gnu/classpath/examples/swing/Demo.java
index 1565184f3..c9edf4462 100644
--- a/examples/gnu/classpath/examples/swing/Demo.java
+++ b/examples/gnu/classpath/examples/swing/Demo.java
@@ -550,6 +550,12 @@ public class Demo
return tabs;
}
+ public static JComboBox mkComboBox(String[] names)
+ {
+ JComboBox box = new JComboBox(names);
+ return box;
+ }
+
public static JSpinner mkSpinner()
{
JSpinner spinner = new JSpinner();
@@ -669,6 +675,11 @@ public class Demo
return close;
}
+ public static JColorChooser mkColorChooser()
+ {
+ return new JColorChooser();
+ }
+
private static class PopUpAction
implements ActionListener
{
@@ -754,10 +765,30 @@ public class Demo
mkSpinner(),
panel);
+ new PopUpAction("TextField",
+ mkTextField("Hello, World!"),
+ panel);
+
+ new PopUpAction("ColorChooser",
+ mkColorChooser(),
+ panel);
+
+ new PopUpAction("ComboBox",
+ mkComboBox(new String[] {"Stop",
+ "Software",
+ "Hoarders",
+ "Support",
+ "GNU!"}),
+ panel);
+
JButton exitDisposer = mkDisposerButton(frame);
panel.add(exitDisposer);
return panel;
}
+ public static JTextField mkTextField(String sometext)
+ {
+ return new JTextField(sometext, 40);
+ }
}
diff --git a/external/Makefile.am b/external/Makefile.am
deleted file mode 100644
index fcb086f56..000000000
--- a/external/Makefile.am
+++ /dev/null
@@ -1,288 +0,0 @@
-# automake generates Makefile.in from this file
-
-# When importing a new version of jaxp.
-# You need to add the output of the following command to the
-# jaxp_FILES in Makefile.am (remove the last \ from the last entry):
-# $ for i in $(find jaxp -type f -print | grep -v CVS); do echo $i \\; done
-
-jaxp_FILES = \
-jaxp/source/gnu/xml/aelfred2/JAXPFactory.java \
-jaxp/source/gnu/xml/aelfred2/SAXDriver.java \
-jaxp/source/gnu/xml/aelfred2/XmlParser.java \
-jaxp/source/gnu/xml/aelfred2/XmlReader.java \
-jaxp/source/gnu/xml/aelfred2/package.html \
-jaxp/source/gnu/xml/dom/Consumer.java \
-jaxp/source/gnu/xml/dom/DomAttr.java \
-jaxp/source/gnu/xml/dom/DomCDATA.java \
-jaxp/source/gnu/xml/dom/DomCharacterData.java \
-jaxp/source/gnu/xml/dom/DomComment.java \
-jaxp/source/gnu/xml/dom/DomDoctype.java \
-jaxp/source/gnu/xml/dom/DomDocument.java \
-jaxp/source/gnu/xml/dom/DomElement.java \
-jaxp/source/gnu/xml/dom/DomEntity.java \
-jaxp/source/gnu/xml/dom/DomEntityReference.java \
-jaxp/source/gnu/xml/dom/DomEvent.java \
-jaxp/source/gnu/xml/dom/DomEx.java \
-jaxp/source/gnu/xml/dom/DomExtern.java \
-jaxp/source/gnu/xml/dom/DomFragment.java \
-jaxp/source/gnu/xml/dom/DomImpl.java \
-jaxp/source/gnu/xml/dom/DomIterator.java \
-jaxp/source/gnu/xml/dom/DomNamedNodeMap.java \
-jaxp/source/gnu/xml/dom/DomNode.java \
-jaxp/source/gnu/xml/dom/DomNotation.java \
-jaxp/source/gnu/xml/dom/DomNsNode.java \
-jaxp/source/gnu/xml/dom/DomPI.java \
-jaxp/source/gnu/xml/dom/DomText.java \
-jaxp/source/gnu/xml/dom/JAXPFactory.java \
-jaxp/source/gnu/xml/dom/package.html \
-jaxp/source/gnu/xml/pipeline/CallFilter.java \
-jaxp/source/gnu/xml/pipeline/DomConsumer.java \
-jaxp/source/gnu/xml/pipeline/EventConsumer.java \
-jaxp/source/gnu/xml/pipeline/EventFilter.java \
-jaxp/source/gnu/xml/pipeline/LinkFilter.java \
-jaxp/source/gnu/xml/pipeline/NSFilter.java \
-jaxp/source/gnu/xml/pipeline/PipelineFactory.java \
-jaxp/source/gnu/xml/pipeline/TeeConsumer.java \
-jaxp/source/gnu/xml/pipeline/TextConsumer.java \
-jaxp/source/gnu/xml/pipeline/ValidationConsumer.java \
-jaxp/source/gnu/xml/pipeline/WellFormednessFilter.java \
-jaxp/source/gnu/xml/pipeline/XIncludeFilter.java \
-jaxp/source/gnu/xml/pipeline/XsltFilter.java \
-jaxp/source/gnu/xml/pipeline/package.html \
-jaxp/source/gnu/xml/util/DoParse.java \
-jaxp/source/gnu/xml/util/DomParser.java \
-jaxp/source/gnu/xml/util/Resolver.java \
-jaxp/source/gnu/xml/util/SAXNullTransformerFactory.java \
-jaxp/source/gnu/xml/util/XCat.java \
-jaxp/source/gnu/xml/util/XHTMLWriter.java \
-jaxp/source/gnu/xml/util/XMLWriter.java \
-jaxp/source/gnu/xml/util/package.html \
-jaxp/source/javax/xml/parsers/ClassStuff.java \
-jaxp/source/javax/xml/parsers/DocumentBuilder.java \
-jaxp/source/javax/xml/parsers/DocumentBuilderFactory.java \
-jaxp/source/javax/xml/parsers/FactoryConfigurationError.java \
-jaxp/source/javax/xml/parsers/ParserConfigurationException.java \
-jaxp/source/javax/xml/parsers/SAXParser.java \
-jaxp/source/javax/xml/parsers/SAXParserFactory.java \
-jaxp/source/javax/xml/parsers/package.html \
-jaxp/source/javax/xml/transform/dom/DOMLocator.java \
-jaxp/source/javax/xml/transform/dom/DOMResult.java \
-jaxp/source/javax/xml/transform/dom/DOMSource.java \
-jaxp/source/javax/xml/transform/dom/package.html \
-jaxp/source/javax/xml/transform/sax/SAXResult.java \
-jaxp/source/javax/xml/transform/sax/SAXSource.java \
-jaxp/source/javax/xml/transform/sax/SAXTransformerFactory.java \
-jaxp/source/javax/xml/transform/sax/TemplatesHandler.java \
-jaxp/source/javax/xml/transform/sax/TransformerHandler.java \
-jaxp/source/javax/xml/transform/sax/package.html \
-jaxp/source/javax/xml/transform/ClassStuff.java \
-jaxp/source/javax/xml/transform/ErrorListener.java \
-jaxp/source/javax/xml/transform/OutputKeys.java \
-jaxp/source/javax/xml/transform/Result.java \
-jaxp/source/javax/xml/transform/Source.java \
-jaxp/source/javax/xml/transform/SourceLocator.java \
-jaxp/source/javax/xml/transform/Templates.java \
-jaxp/source/javax/xml/transform/Transformer.java \
-jaxp/source/javax/xml/transform/TransformerConfigurationException.java \
-jaxp/source/javax/xml/transform/TransformerException.java \
-jaxp/source/javax/xml/transform/TransformerFactory.java \
-jaxp/source/javax/xml/transform/TransformerFactoryConfigurationError.java \
-jaxp/source/javax/xml/transform/URIResolver.java \
-jaxp/source/javax/xml/transform/package.html \
-jaxp/source/javax/xml/transform/stream/StreamResult.java \
-jaxp/source/javax/xml/transform/stream/StreamSource.java \
-jaxp/source/javax/xml/transform/stream/package.html \
-jaxp/source/org/w3c/dom/css/CSS2Azimuth.java \
-jaxp/source/org/w3c/dom/css/CSS2BackgroundPosition.java \
-jaxp/source/org/w3c/dom/css/CSS2BorderSpacing.java \
-jaxp/source/org/w3c/dom/css/CSS2CounterIncrement.java \
-jaxp/source/org/w3c/dom/css/CSS2CounterReset.java \
-jaxp/source/org/w3c/dom/css/CSS2Cursor.java \
-jaxp/source/org/w3c/dom/css/CSS2FontFaceSrc.java \
-jaxp/source/org/w3c/dom/css/CSS2FontFaceWidths.java \
-jaxp/source/org/w3c/dom/css/CSS2PageSize.java \
-jaxp/source/org/w3c/dom/css/CSS2PlayDuring.java \
-jaxp/source/org/w3c/dom/css/CSS2Properties.java \
-jaxp/source/org/w3c/dom/css/CSS2TextShadow.java \
-jaxp/source/org/w3c/dom/css/CSSCharsetRule.java \
-jaxp/source/org/w3c/dom/css/CSSFontFaceRule.java \
-jaxp/source/org/w3c/dom/css/CSSImportRule.java \
-jaxp/source/org/w3c/dom/css/CSSMediaRule.java \
-jaxp/source/org/w3c/dom/css/CSSPageRule.java \
-jaxp/source/org/w3c/dom/css/CSSPrimitiveValue.java \
-jaxp/source/org/w3c/dom/css/CSSRule.java \
-jaxp/source/org/w3c/dom/css/CSSRuleList.java \
-jaxp/source/org/w3c/dom/css/CSSStyleDeclaration.java \
-jaxp/source/org/w3c/dom/css/CSSStyleRule.java \
-jaxp/source/org/w3c/dom/css/CSSStyleSheet.java \
-jaxp/source/org/w3c/dom/css/CSSUnknownRule.java \
-jaxp/source/org/w3c/dom/css/CSSValue.java \
-jaxp/source/org/w3c/dom/css/CSSValueList.java \
-jaxp/source/org/w3c/dom/css/Counter.java \
-jaxp/source/org/w3c/dom/css/DOMImplementationCSS.java \
-jaxp/source/org/w3c/dom/css/DocumentCSS.java \
-jaxp/source/org/w3c/dom/css/ElementCSSInlineStyle.java \
-jaxp/source/org/w3c/dom/css/RGBColor.java \
-jaxp/source/org/w3c/dom/css/Rect.java \
-jaxp/source/org/w3c/dom/css/ViewCSS.java \
-jaxp/source/org/w3c/dom/css/package.html \
-jaxp/source/org/w3c/dom/html/HTMLAnchorElement.java \
-jaxp/source/org/w3c/dom/html/HTMLAppletElement.java \
-jaxp/source/org/w3c/dom/html/HTMLAreaElement.java \
-jaxp/source/org/w3c/dom/html/HTMLBRElement.java \
-jaxp/source/org/w3c/dom/html/HTMLBaseElement.java \
-jaxp/source/org/w3c/dom/html/HTMLBaseFontElement.java \
-jaxp/source/org/w3c/dom/html/HTMLBodyElement.java \
-jaxp/source/org/w3c/dom/html/HTMLButtonElement.java \
-jaxp/source/org/w3c/dom/html/HTMLCollection.java \
-jaxp/source/org/w3c/dom/html/HTMLDListElement.java \
-jaxp/source/org/w3c/dom/html/HTMLDOMImplementation.java \
-jaxp/source/org/w3c/dom/html/HTMLDirectoryElement.java \
-jaxp/source/org/w3c/dom/html/HTMLDivElement.java \
-jaxp/source/org/w3c/dom/html/HTMLDocument.java \
-jaxp/source/org/w3c/dom/html/HTMLElement.java \
-jaxp/source/org/w3c/dom/html/HTMLFieldSetElement.java \
-jaxp/source/org/w3c/dom/html/HTMLFontElement.java \
-jaxp/source/org/w3c/dom/html/HTMLFormElement.java \
-jaxp/source/org/w3c/dom/html/HTMLFrameElement.java \
-jaxp/source/org/w3c/dom/html/HTMLFrameSetElement.java \
-jaxp/source/org/w3c/dom/html/HTMLHRElement.java \
-jaxp/source/org/w3c/dom/html/HTMLHeadElement.java \
-jaxp/source/org/w3c/dom/html/HTMLHeadingElement.java \
-jaxp/source/org/w3c/dom/html/HTMLHtmlElement.java \
-jaxp/source/org/w3c/dom/html/HTMLIFrameElement.java \
-jaxp/source/org/w3c/dom/html/HTMLImageElement.java \
-jaxp/source/org/w3c/dom/html/HTMLInputElement.java \
-jaxp/source/org/w3c/dom/html/HTMLIsIndexElement.java \
-jaxp/source/org/w3c/dom/html/HTMLLIElement.java \
-jaxp/source/org/w3c/dom/html/HTMLLabelElement.java \
-jaxp/source/org/w3c/dom/html/HTMLLegendElement.java \
-jaxp/source/org/w3c/dom/html/HTMLLinkElement.java \
-jaxp/source/org/w3c/dom/html/HTMLMapElement.java \
-jaxp/source/org/w3c/dom/html/HTMLMenuElement.java \
-jaxp/source/org/w3c/dom/html/HTMLMetaElement.java \
-jaxp/source/org/w3c/dom/html/HTMLModElement.java \
-jaxp/source/org/w3c/dom/html/HTMLOListElement.java \
-jaxp/source/org/w3c/dom/html/HTMLObjectElement.java \
-jaxp/source/org/w3c/dom/html/HTMLOptGroupElement.java \
-jaxp/source/org/w3c/dom/html/HTMLOptionElement.java \
-jaxp/source/org/w3c/dom/html/HTMLParagraphElement.java \
-jaxp/source/org/w3c/dom/html/HTMLParamElement.java \
-jaxp/source/org/w3c/dom/html/HTMLPreElement.java \
-jaxp/source/org/w3c/dom/html/HTMLQuoteElement.java \
-jaxp/source/org/w3c/dom/html/HTMLScriptElement.java \
-jaxp/source/org/w3c/dom/html/HTMLSelectElement.java \
-jaxp/source/org/w3c/dom/html/HTMLStyleElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTableCaptionElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTableCellElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTableColElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTableElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTableRowElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTableSectionElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTextAreaElement.java \
-jaxp/source/org/w3c/dom/html/HTMLTitleElement.java \
-jaxp/source/org/w3c/dom/html/HTMLUListElement.java \
-jaxp/source/org/w3c/dom/html/package.html \
-jaxp/source/org/w3c/dom/Attr.java \
-jaxp/source/org/w3c/dom/CDATASection.java \
-jaxp/source/org/w3c/dom/CharacterData.java \
-jaxp/source/org/w3c/dom/Comment.java \
-jaxp/source/org/w3c/dom/DOMException.java \
-jaxp/source/org/w3c/dom/DOMImplementation.java \
-jaxp/source/org/w3c/dom/Document.java \
-jaxp/source/org/w3c/dom/DocumentFragment.java \
-jaxp/source/org/w3c/dom/DocumentType.java \
-jaxp/source/org/w3c/dom/Element.java \
-jaxp/source/org/w3c/dom/Entity.java \
-jaxp/source/org/w3c/dom/EntityReference.java \
-jaxp/source/org/w3c/dom/NamedNodeMap.java \
-jaxp/source/org/w3c/dom/Node.java \
-jaxp/source/org/w3c/dom/NodeList.java \
-jaxp/source/org/w3c/dom/Notation.java \
-jaxp/source/org/w3c/dom/ProcessingInstruction.java \
-jaxp/source/org/w3c/dom/Text.java \
-jaxp/source/org/w3c/dom/package.html \
-jaxp/source/org/w3c/dom/events/DocumentEvent.java \
-jaxp/source/org/w3c/dom/events/Event.java \
-jaxp/source/org/w3c/dom/events/EventException.java \
-jaxp/source/org/w3c/dom/events/EventListener.java \
-jaxp/source/org/w3c/dom/events/EventTarget.java \
-jaxp/source/org/w3c/dom/events/MouseEvent.java \
-jaxp/source/org/w3c/dom/events/MutationEvent.java \
-jaxp/source/org/w3c/dom/events/UIEvent.java \
-jaxp/source/org/w3c/dom/events/package.html \
-jaxp/source/org/w3c/dom/ranges/DocumentRange.java \
-jaxp/source/org/w3c/dom/ranges/Range.java \
-jaxp/source/org/w3c/dom/ranges/RangeException.java \
-jaxp/source/org/w3c/dom/ranges/package.html \
-jaxp/source/org/w3c/dom/stylesheets/DocumentStyle.java \
-jaxp/source/org/w3c/dom/stylesheets/LinkStyle.java \
-jaxp/source/org/w3c/dom/stylesheets/MediaList.java \
-jaxp/source/org/w3c/dom/stylesheets/StyleSheet.java \
-jaxp/source/org/w3c/dom/stylesheets/StyleSheetList.java \
-jaxp/source/org/w3c/dom/stylesheets/package.html \
-jaxp/source/org/w3c/dom/traversal/DocumentTraversal.java \
-jaxp/source/org/w3c/dom/traversal/NodeFilter.java \
-jaxp/source/org/w3c/dom/traversal/NodeIterator.java \
-jaxp/source/org/w3c/dom/traversal/TreeWalker.java \
-jaxp/source/org/w3c/dom/traversal/package.html \
-jaxp/source/org/w3c/dom/views/AbstractView.java \
-jaxp/source/org/w3c/dom/views/DocumentView.java \
-jaxp/source/org/w3c/dom/views/package.html \
-jaxp/source/org/xml/sax/ext/Attributes2.java \
-jaxp/source/org/xml/sax/ext/Attributes2Impl.java \
-jaxp/source/org/xml/sax/ext/DeclHandler.java \
-jaxp/source/org/xml/sax/ext/DefaultHandler2.java \
-jaxp/source/org/xml/sax/ext/EntityResolver2.java \
-jaxp/source/org/xml/sax/ext/LexicalHandler.java \
-jaxp/source/org/xml/sax/ext/Locator2.java \
-jaxp/source/org/xml/sax/ext/Locator2Impl.java \
-jaxp/source/org/xml/sax/ext/package.html \
-jaxp/source/org/xml/sax/AttributeList.java \
-jaxp/source/org/xml/sax/Attributes.java \
-jaxp/source/org/xml/sax/ContentHandler.java \
-jaxp/source/org/xml/sax/DTDHandler.java \
-jaxp/source/org/xml/sax/DocumentHandler.java \
-jaxp/source/org/xml/sax/EntityResolver.java \
-jaxp/source/org/xml/sax/ErrorHandler.java \
-jaxp/source/org/xml/sax/HandlerBase.java \
-jaxp/source/org/xml/sax/InputSource.java \
-jaxp/source/org/xml/sax/Locator.java \
-jaxp/source/org/xml/sax/Parser.java \
-jaxp/source/org/xml/sax/SAXException.java \
-jaxp/source/org/xml/sax/SAXNotRecognizedException.java \
-jaxp/source/org/xml/sax/SAXNotSupportedException.java \
-jaxp/source/org/xml/sax/SAXParseException.java \
-jaxp/source/org/xml/sax/XMLFilter.java \
-jaxp/source/org/xml/sax/XMLReader.java \
-jaxp/source/org/xml/sax/package.html \
-jaxp/source/org/xml/sax/helpers/AttributeListImpl.java \
-jaxp/source/org/xml/sax/helpers/AttributesImpl.java \
-jaxp/source/org/xml/sax/helpers/DefaultHandler.java \
-jaxp/source/org/xml/sax/helpers/LocatorImpl.java \
-jaxp/source/org/xml/sax/helpers/NamespaceSupport.java \
-jaxp/source/org/xml/sax/helpers/NewInstance.java \
-jaxp/source/org/xml/sax/helpers/ParserAdapter.java \
-jaxp/source/org/xml/sax/helpers/ParserFactory.java \
-jaxp/source/org/xml/sax/helpers/XMLFilterImpl.java \
-jaxp/source/org/xml/sax/helpers/XMLReaderAdapter.java \
-jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java \
-jaxp/source/org/xml/sax/helpers/package.html \
-jaxp/.cvsignore \
-jaxp/AUTHORS \
-jaxp/COPYING \
-jaxp/COPYRIGHT.html \
-jaxp/HACKING \
-jaxp/LICENSE \
-jaxp/Makefile.aj \
-jaxp/Makefile.in \
-jaxp/README \
-jaxp/aclocal.m4 \
-jaxp/automakejar \
-jaxp/configure.in \
-jaxp/manifest.mf \
-jaxp/tests/dom/NodeType.java \
-jaxp/tests/dom/nodetype.xml
-
-DISTFILES = README Makefile.am Makefile.in ${jaxp_FILES}
-
diff --git a/external/README b/external/README
deleted file mode 100644
index 5b8117f5c..000000000
--- a/external/README
+++ /dev/null
@@ -1,21 +0,0 @@
-This directory contains libraries maintained externally to GNU Classpath.
-
-jaxp - http://www.gnu.org/software/classpathx/jaxp/
-
- GNU JAXP, a part of the GNU Classpath Extensions project
- (hosted at savannah.gnu.org) is a free implementation of the
- standard XML processing APIs for Java:
-
- * SAX Parser API
- * DOM Level 2 generic XML data structures
- * JAXP v1.1 interface implementation
-
- Import method:
-
- cvs -d :ext:cbj@subversions.gnu.org:/cvsroot/classpath \
- import -m "import classpathx jaxp 20030123" \
- classpath/external/jaxp Classpathx JAXP_CVS_20030123
-
- You need to add the output of the following command to the
- jaxp_FILES in Makefile.am (remove the last \ from the last entry):
- $ for i in $(find jaxp -type f | grep -v CVS); do echo $i \\; done
diff --git a/external/jaxp/.cvsignore b/external/jaxp/.cvsignore
deleted file mode 100644
index ec2d0aa69..000000000
--- a/external/jaxp/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-config.cache
-config.log
-config.status
-configure
-Log
-gnujaxp.jar
-Makefile
-Diff
-bin
-apidoc
-apidoc.zip
diff --git a/external/jaxp/AUTHORS b/external/jaxp/AUTHORS
deleted file mode 100644
index 739873a50..000000000
--- a/external/jaxp/AUTHORS
+++ /dev/null
@@ -1,9 +0,0 @@
-David Brownell: dbrownell@users.sourceforge.net
- (AElfred v2, DOM implementation, SAX and XML utilities)
-
-David Megginson: david@megginson.com
- (original author: SAX1, SAX2 interface files; AElfred v1)
-
-Andrew Selkirk: aselkirk@mailandnews.com
- (original author: JAXP interface files)
-
diff --git a/external/jaxp/COPYING b/external/jaxp/COPYING
deleted file mode 100644
index 60549be51..000000000
--- a/external/jaxp/COPYING
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) 19yy <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/external/jaxp/COPYRIGHT.html b/external/jaxp/COPYRIGHT.html
deleted file mode 100644
index 26049b750..000000000
--- a/external/jaxp/COPYRIGHT.html
+++ /dev/null
@@ -1,100 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
- "http://www.w3.org/TR/REC-html40/loose.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>W3C IPR SOFTWARE NOTICE</title>
- </head>
- <body bgcolor="#FFFFFF" text="#000000">
- <h1>
- W3C IPR SOFTWARE NOTICE
- </h1>
- <h3>
- Copyright &copy; 2000 <loc href="http://www.w3.org/">World Wide Web
- Consortium</loc>, (<loc href="http://www.lcs.mit.edu/">Massachusetts
- Institute of Technology</loc>, <loc href="http://www.inria.fr/">Institut
- National de Recherche en Informatique et en Automatique</loc>, <loc
- href="http://www.keio.ac.jp/">Keio University</loc>). All Rights
- Reserved.
- </h3>
- <p>
- The DOM bindings are published under the W3C Software Copyright Notice
- and License. The software license requires "Notice of any changes or
- modifications to the W3C files, including the date changes were made."
- Consequently, modified versions of the DOM bindings must document that
- they do not conform to the W3C standard; in the case of the IDL binding,
- the pragma prefix can no longer be 'w3c.org'; in the case of the Java
- binding, the package names can no longer be in the 'org.w3c' package.
- </p>
- <p>
- <b>Note:</b> The original version of the W3C Software Copyright Notice
- and License could be found at <a
- href='http://www.w3.org/Consortium/Legal/copyright-software-19980720'>http://www.w3.org/Consortium/Legal/copyright-software-19980720</a>
- </p>
- <h3>
- Copyright &copy; 1994-2000 <a href="http://www.w3.org/">World Wide Web
- Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
- Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
- National de Recherche en Informatique et en Automatique</a>, <a
- href="http://www.keio.ac.jp/">Keio University</a>). All Rights
- Reserved. http://www.w3.org/Consortium/Legal/
- </h3>
- <p>
- This W3C work (including software, documents, or other related items) is
- being provided by the copyright holders under the following license. By
- obtaining, using and/or copying this work, you (the licensee) agree that
- you have read, understood, and will comply with the following terms and
- conditions:
- </p>
- <p>
- Permission to use, copy, and modify this software and its documentation,
- with or without modification,&nbsp; for any purpose and without fee or
- royalty is hereby granted, provided that you include the following on ALL
- copies of the software and documentation or portions thereof, including
- modifications, that you make:
- </p>
- <ol>
- <li>
- The full text of this NOTICE in a location viewable to users of the
- redistributed or derivative work.
- </li>
- <li>
- Any pre-existing intellectual property disclaimers, notices, or terms
- and conditions. If none exist, a short notice of the following form
- (hypertext is preferred, text is permitted) should be used within the
- body of any redistributed or derivative code: "Copyright &copy;
- [$date-of-software] <a href="http://www.w3.org/">World Wide Web
- Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts
- Institute of Technology</a>, <a href="http://www.inria.fr/">Institut
- National de Recherche en Informatique et en Automatique</a>, <a
- href="http://www.keio.ac.jp/">Keio University</a>). All Rights
- Reserved. http://www.w3.org/Consortium/Legal/"
- </li>
- <li>
- Notice of any changes or modifications to the W3C files, including the
- date changes were made. (We recommend you provide URIs to the location
- from which the code is derived.)
- </li>
- </ol>
- <p>
- THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT
- HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED,
- INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS
- FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR
- DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS,
- TRADEMARKS OR OTHER RIGHTS.
- </p>
- <p>
- COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR
- CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR
- DOCUMENTATION.
- </p>
- <p>
- The name and trademarks of copyright holders may NOT be used in
- advertising or publicity pertaining to the software without specific,
- written prior permission. Title to copyright in this software and any
- associated documentation will at all times remain with copyright
- holders.
- </p>
- </body>
-</html>
diff --git a/external/jaxp/HACKING b/external/jaxp/HACKING
deleted file mode 100644
index 2c0253f3a..000000000
--- a/external/jaxp/HACKING
+++ /dev/null
@@ -1,30 +0,0 @@
-HACKING GNUJAXP
----------------
-
-
-Building GNUJAXP from the CVS module
-------------------------------------
-To build GNUJAXP from the source in CVS you can simply run configure
-to generate the Makefile. The Makefile knows how to rebuild itself
-using the auto tools.
-
-To create new build files you should do:
-
- $ make mrproper
-
-Followed by the following:
-
- $ autoconf
- $ ./automakejar Makefile.in
- $ ./configure
- $ make all
-
-You will need the GNU autotools for this. Autoconf versions 2.13
-upward are supported.
-
-
-
-
-Nic Ferrier
-ClasspathX Maintainer
-nferrier@gnu.org
diff --git a/external/jaxp/LICENSE b/external/jaxp/LICENSE
deleted file mode 100644
index 2c19112cf..000000000
--- a/external/jaxp/LICENSE
+++ /dev/null
@@ -1,25 +0,0 @@
-The software in this package is distributed under the GNU General Public
-License (with "Library Exception" described below), with the exceptions
-of the DOM interface sources (which are subject instead to the W3C license)
-and the SAX2 r2pre2 files (which are in the public domain).
-
-A copy of GNU General Public License (GPL) is included in this distribution,
-in the file COPYING. If you do not have the source code, it is available at:
-
- http://www.gnu.org/software/classpathx/jaxp
-
-Source distributions include a copy of the W3C copyright as "COPYRIGHT.html".
-
-In addition, the files distributed under GPL include the following
-special exception.
-
- As a special exception, if you link this library with
- other files to produce an executable, this library does
- not by itself cause the resulting executable to be covered
- by the GNU General Public License. This exception does
- not however invalidate any other reasons why the executable
- file might be covered by the GNU General Public License.
-
-As such, this software can be used to run Free as well as proprietary
-applications and applets: static linking is permitted, so this can
-even be used in embedded configurations.
diff --git a/external/jaxp/Makefile.aj b/external/jaxp/Makefile.aj
deleted file mode 100644
index a9909b136..000000000
--- a/external/jaxp/Makefile.aj
+++ /dev/null
@@ -1,435 +0,0 @@
-# Makefile for GNU classpathx "GNUJAXP" project
-#
-# You are free to redistribute this file. NO WARRANTY or fitness
-# for purpose is implied by this notice.
-#
-# !!! !!!
-# !!! MAKE EDITS TO "Makefile.in", not "Makefile" !!!
-# !!! !!!
-#
-# Use the "configure" command to generate the project Makefile
-# from its "Makefile.in" template.
-#
-
-##set by configure
-
-PROJECTROOT = @srcdir@
-
-JAVAC = @JAVA_CC@
-JAVAC_OPTS = -g @JAVA_CC_OPTS@
-JAR = @JAR_TOOL@
-
-SOURCEDIR = $(PROJECTROOT)/source
-SOURCEFILES = $(SOURCEDIR)/gnu/xml/aelfred2/JAXPFactory.java \
- $(SOURCEDIR)/gnu/xml/aelfred2/SAXDriver.java \
- $(SOURCEDIR)/gnu/xml/aelfred2/XmlParser.java \
- $(SOURCEDIR)/gnu/xml/aelfred2/XmlReader.java \
- $(SOURCEDIR)/gnu/xml/dom/Consumer.java \
- $(SOURCEDIR)/gnu/xml/dom/DomAttr.java \
- $(SOURCEDIR)/gnu/xml/dom/DomCDATA.java \
- $(SOURCEDIR)/gnu/xml/dom/DomCharacterData.java \
- $(SOURCEDIR)/gnu/xml/dom/DomComment.java \
- $(SOURCEDIR)/gnu/xml/dom/DomDoctype.java \
- $(SOURCEDIR)/gnu/xml/dom/DomDocument.java \
- $(SOURCEDIR)/gnu/xml/dom/DomElement.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEntity.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEntityReference.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEvent.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEx.java \
- $(SOURCEDIR)/gnu/xml/dom/DomExtern.java \
- $(SOURCEDIR)/gnu/xml/dom/DomFragment.java \
- $(SOURCEDIR)/gnu/xml/dom/DomImpl.java \
- $(SOURCEDIR)/gnu/xml/dom/DomIterator.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNamedNodeMap.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNode.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNotation.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNsNode.java \
- $(SOURCEDIR)/gnu/xml/dom/DomPI.java \
- $(SOURCEDIR)/gnu/xml/dom/DomText.java \
- $(SOURCEDIR)/gnu/xml/dom/JAXPFactory.java \
- $(SOURCEDIR)/gnu/xml/pipeline/CallFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/DomConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/EventConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/EventFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/LinkFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/NSFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/PipelineFactory.java \
- $(SOURCEDIR)/gnu/xml/pipeline/TeeConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/TextConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/ValidationConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/WellFormednessFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/XIncludeFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/XsltFilter.java \
- $(SOURCEDIR)/gnu/xml/util/DoParse.java \
- $(SOURCEDIR)/gnu/xml/util/DomParser.java \
- $(SOURCEDIR)/gnu/xml/util/Resolver.java \
- $(SOURCEDIR)/gnu/xml/util/SAXNullTransformerFactory.java \
- $(SOURCEDIR)/gnu/xml/util/XCat.java \
- $(SOURCEDIR)/gnu/xml/util/XHTMLWriter.java \
- $(SOURCEDIR)/gnu/xml/util/XMLWriter.java \
- $(SOURCEDIR)/javax/xml/parsers/ClassStuff.java \
- $(SOURCEDIR)/javax/xml/parsers/DocumentBuilder.java \
- $(SOURCEDIR)/javax/xml/parsers/DocumentBuilderFactory.java \
- $(SOURCEDIR)/javax/xml/parsers/FactoryConfigurationError.java \
- $(SOURCEDIR)/javax/xml/parsers/ParserConfigurationException.java \
- $(SOURCEDIR)/javax/xml/parsers/SAXParser.java \
- $(SOURCEDIR)/javax/xml/parsers/SAXParserFactory.java \
- $(SOURCEDIR)/javax/xml/transform/ClassStuff.java \
- $(SOURCEDIR)/javax/xml/transform/ErrorListener.java \
- $(SOURCEDIR)/javax/xml/transform/OutputKeys.java \
- $(SOURCEDIR)/javax/xml/transform/Result.java \
- $(SOURCEDIR)/javax/xml/transform/Source.java \
- $(SOURCEDIR)/javax/xml/transform/SourceLocator.java \
- $(SOURCEDIR)/javax/xml/transform/Templates.java \
- $(SOURCEDIR)/javax/xml/transform/Transformer.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerConfigurationException.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerException.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerFactory.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerFactoryConfigurationError.java \
- $(SOURCEDIR)/javax/xml/transform/URIResolver.java \
- $(SOURCEDIR)/javax/xml/transform/dom/DOMLocator.java \
- $(SOURCEDIR)/javax/xml/transform/dom/DOMResult.java \
- $(SOURCEDIR)/javax/xml/transform/dom/DOMSource.java \
- $(SOURCEDIR)/javax/xml/transform/sax/SAXResult.java \
- $(SOURCEDIR)/javax/xml/transform/sax/SAXSource.java \
- $(SOURCEDIR)/javax/xml/transform/sax/SAXTransformerFactory.java \
- $(SOURCEDIR)/javax/xml/transform/sax/TemplatesHandler.java \
- $(SOURCEDIR)/javax/xml/transform/sax/TransformerHandler.java \
- $(SOURCEDIR)/javax/xml/transform/stream/StreamResult.java \
- $(SOURCEDIR)/javax/xml/transform/stream/StreamSource.java \
- $(SOURCEDIR)/org/w3c/dom/Attr.java \
- $(SOURCEDIR)/org/w3c/dom/CDATASection.java \
- $(SOURCEDIR)/org/w3c/dom/CharacterData.java \
- $(SOURCEDIR)/org/w3c/dom/Comment.java \
- $(SOURCEDIR)/org/w3c/dom/DOMException.java \
- $(SOURCEDIR)/org/w3c/dom/DOMImplementation.java \
- $(SOURCEDIR)/org/w3c/dom/Document.java \
- $(SOURCEDIR)/org/w3c/dom/DocumentFragment.java \
- $(SOURCEDIR)/org/w3c/dom/DocumentType.java \
- $(SOURCEDIR)/org/w3c/dom/Element.java \
- $(SOURCEDIR)/org/w3c/dom/Entity.java \
- $(SOURCEDIR)/org/w3c/dom/EntityReference.java \
- $(SOURCEDIR)/org/w3c/dom/NamedNodeMap.java \
- $(SOURCEDIR)/org/w3c/dom/Node.java \
- $(SOURCEDIR)/org/w3c/dom/NodeList.java \
- $(SOURCEDIR)/org/w3c/dom/Notation.java \
- $(SOURCEDIR)/org/w3c/dom/ProcessingInstruction.java \
- $(SOURCEDIR)/org/w3c/dom/Text.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2Azimuth.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2BackgroundPosition.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2BorderSpacing.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2CounterIncrement.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2CounterReset.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2Cursor.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2FontFaceSrc.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2FontFaceWidths.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2PageSize.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2PlayDuring.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2Properties.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2TextShadow.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSCharsetRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSFontFaceRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSImportRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSMediaRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSPageRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSPrimitiveValue.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSRuleList.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSStyleDeclaration.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSStyleRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSStyleSheet.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSUnknownRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSValue.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSValueList.java \
- $(SOURCEDIR)/org/w3c/dom/css/Counter.java \
- $(SOURCEDIR)/org/w3c/dom/css/DOMImplementationCSS.java \
- $(SOURCEDIR)/org/w3c/dom/css/DocumentCSS.java \
- $(SOURCEDIR)/org/w3c/dom/css/ElementCSSInlineStyle.java \
- $(SOURCEDIR)/org/w3c/dom/css/RGBColor.java \
- $(SOURCEDIR)/org/w3c/dom/css/Rect.java \
- $(SOURCEDIR)/org/w3c/dom/css/ViewCSS.java \
- $(SOURCEDIR)/org/w3c/dom/events/DocumentEvent.java \
- $(SOURCEDIR)/org/w3c/dom/events/Event.java \
- $(SOURCEDIR)/org/w3c/dom/events/EventException.java \
- $(SOURCEDIR)/org/w3c/dom/events/EventListener.java \
- $(SOURCEDIR)/org/w3c/dom/events/EventTarget.java \
- $(SOURCEDIR)/org/w3c/dom/events/MouseEvent.java \
- $(SOURCEDIR)/org/w3c/dom/events/MutationEvent.java \
- $(SOURCEDIR)/org/w3c/dom/events/UIEvent.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLAnchorElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLAppletElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLAreaElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBRElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBaseElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBaseFontElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBodyElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLButtonElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLCollection.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDListElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDOMImplementation.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDirectoryElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDivElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDocument.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFieldSetElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFontElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFormElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFrameElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFrameSetElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHRElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHeadElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHeadingElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHtmlElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLIFrameElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLImageElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLInputElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLIsIndexElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLIElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLabelElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLegendElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLinkElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLMapElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLMenuElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLMetaElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLModElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLOListElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLObjectElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLOptGroupElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLOptionElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLParagraphElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLParamElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLPreElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLQuoteElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLScriptElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLSelectElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLStyleElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableCaptionElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableCellElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableColElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableRowElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableSectionElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTextAreaElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTitleElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLUListElement.java \
- $(SOURCEDIR)/org/w3c/dom/ranges/DocumentRange.java \
- $(SOURCEDIR)/org/w3c/dom/ranges/Range.java \
- $(SOURCEDIR)/org/w3c/dom/ranges/RangeException.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/DocumentStyle.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/LinkStyle.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/MediaList.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/StyleSheet.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/StyleSheetList.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/DocumentTraversal.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/NodeFilter.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/NodeIterator.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/TreeWalker.java \
- $(SOURCEDIR)/org/w3c/dom/views/AbstractView.java \
- $(SOURCEDIR)/org/w3c/dom/views/DocumentView.java \
- $(SOURCEDIR)/org/xml/sax/AttributeList.java \
- $(SOURCEDIR)/org/xml/sax/Attributes.java \
- $(SOURCEDIR)/org/xml/sax/ContentHandler.java \
- $(SOURCEDIR)/org/xml/sax/DTDHandler.java \
- $(SOURCEDIR)/org/xml/sax/DocumentHandler.java \
- $(SOURCEDIR)/org/xml/sax/EntityResolver.java \
- $(SOURCEDIR)/org/xml/sax/ErrorHandler.java \
- $(SOURCEDIR)/org/xml/sax/HandlerBase.java \
- $(SOURCEDIR)/org/xml/sax/InputSource.java \
- $(SOURCEDIR)/org/xml/sax/Locator.java \
- $(SOURCEDIR)/org/xml/sax/Parser.java \
- $(SOURCEDIR)/org/xml/sax/SAXException.java \
- $(SOURCEDIR)/org/xml/sax/SAXNotRecognizedException.java \
- $(SOURCEDIR)/org/xml/sax/SAXNotSupportedException.java \
- $(SOURCEDIR)/org/xml/sax/SAXParseException.java \
- $(SOURCEDIR)/org/xml/sax/XMLFilter.java \
- $(SOURCEDIR)/org/xml/sax/XMLReader.java \
- $(SOURCEDIR)/org/xml/sax/ext/Attributes2.java \
- $(SOURCEDIR)/org/xml/sax/ext/Attributes2Impl.java \
- $(SOURCEDIR)/org/xml/sax/ext/DeclHandler.java \
- $(SOURCEDIR)/org/xml/sax/ext/DefaultHandler2.java \
- $(SOURCEDIR)/org/xml/sax/ext/EntityResolver2.java \
- $(SOURCEDIR)/org/xml/sax/ext/LexicalHandler.java \
- $(SOURCEDIR)/org/xml/sax/ext/Locator2.java \
- $(SOURCEDIR)/org/xml/sax/ext/Locator2Impl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/AttributeListImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/AttributesImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/DefaultHandler.java \
- $(SOURCEDIR)/org/xml/sax/helpers/LocatorImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/NamespaceSupport.java \
- $(SOURCEDIR)/org/xml/sax/helpers/NewInstance.java \
- $(SOURCEDIR)/org/xml/sax/helpers/ParserAdapter.java \
- $(SOURCEDIR)/org/xml/sax/helpers/ParserFactory.java \
- $(SOURCEDIR)/org/xml/sax/helpers/XMLFilterImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/XMLReaderAdapter.java \
- $(SOURCEDIR)/org/xml/sax/helpers/XMLReaderFactory.java
-
-PKGFILES = \
- $(SOURCEDIR)/gnu/xml/aelfred2/package.html \
- $(SOURCEDIR)/gnu/xml/dom/package.html \
- $(SOURCEDIR)/gnu/xml/pipeline/package.html \
- $(SOURCEDIR)/gnu/xml/util/package.html \
- $(SOURCEDIR)/javax/xml/parsers/package.html \
- $(SOURCEDIR)/javax/xml/transform/package.html \
- $(SOURCEDIR)/javax/xml/transform/dom/package.html \
- $(SOURCEDIR)/javax/xml/transform/sax/package.html \
- $(SOURCEDIR)/javax/xml/transform/stream/package.html \
- $(SOURCEDIR)/org/w3c/dom/package.html \
- $(SOURCEDIR)/org/w3c/dom/events/package.html \
- $(SOURCEDIR)/org/w3c/dom/traversal/package.html \
- $(SOURCEDIR)/org/w3c/dom/views/package.html \
- $(SOURCEDIR)/org/xml/sax/package.html \
- $(SOURCEDIR)/org/xml/sax/ext/package.html \
- $(SOURCEDIR)/org/xml/sax/helpers/package.html \
-
-
-#GCJ options.
-GCJ_OPTS = --encoding=8859_1 -fsyntax-only -femit-class-files
-GCJ_COMPILE = $(GCJ) $(GCJ_OPTS) -Isource -foutput-class-dir=$(CC-DESTDIR)
-
-# Variables which define some useful constants
-newline:=\\n
-empty:=
-space:=$(empty) $(empty)
-
-
-default: gnujaxp.jar
-
-all: gnujaxp.jar javadoc
-
-
-# Ensure the makefile can update itself.
-Makefile: Makefile.in configure.in
- $(SHELL) ./config.status
-
-Makefile.in: Makefile.aj
- $(SHELL) $(PROJECTROOT)/automakejar ./Makefile.in
-
-
-# Build the META-INF directory.
-META-INF META-INF/services:
- mkdir $@
-
-# Admin file targets.
-META-INF/COPYING: META-INF $(PROJECTROOT)/COPYING
- cp $(PROJECTROOT)/COPYING $@
-
-META-INF/LICENSE: META-INF $(PROJECTROOT)/LICENSE
- cp $(PROJECTROOT)/LICENSE $@
-
-# Support file targets.
-META-INF/services/org.xml.sax.driver: META-INF/services
- echo -n gnu.xml.aelfred2.XmlReader > $@
-
-META-INF/services/javax.xml.parsers.SAXParserFactory: META-INF/services
- echo -n gnu.xml.aelfred2.JAXPFactory > $@
-
-META-INF/services/javax.xml.parsers.DocumentBuilderFactory: META-INF/services
- echo -n gnu.xml.dom.JAXPFactory > $@
-
-SUPPORTFILES = \
- META-INF/COPYING \
- META-INF/LICENSE \
- META-INF/services/org.xml.sax.driver \
- META-INF/services/javax.xml.parsers.SAXParserFactory \
- META-INF/services/javax.xml.parsers.DocumentBuilderFactory
-
-
-# This is an automakejar target.
-# You must run the automakejar script on this Make file to
-# cause the target to be legal Make syntax.
-gnujaxp.jar:
- sourcedir=$(SOURCEDIR)
- sourcefiles=$(SOURCEFILES)
- classpath=$(wildcard lib/*.jar)
- classesdest=classes
- otherfiles=$(SUPPORTFILES)
- manifest=$(PROJECTROOT)/manifest.mf
-# End of automakejar target.
-
-
-
-# for normal development
-# must rerun "make" after this
-clean:
- -rm -rf gnujaxp.jar classes META-INF Log apidoc apidoc.zip
- -rm -rf gnujaxp-*.zip
-
-# Nust rerun automakejar and configure after this
-distclean: clean
- -rm -f Makefile Makefile.in config.cache config.log config.status
-
-# Nust rerun aclocal, autoconf, automakejar and configure after this
-mrproper: distclean
- -rm -f configure
-
-javadoc: apidoc.zip
-apidoc.zip:
- -rm -rf apidoc
- mkdir -p apidoc
- javadoc -d apidoc \
- -windowtitle "GNU JAXP Library" \
- -nodeprecatedlist \
- -version -author -use \
- -bottom "<p>Source code is under GPL \
- (with library exception) in the JAXP project at \
- <a href='http://www.gnu.org/software/classpathx/jaxp'> \
- http://www.gnu.org/software/classpathx/jaxp</a> \
- <br>This documentation was derived from that\
- source code on `date -I`.\
- </p>" \
- -classpath "$(SOURCEDIR)" \
- \
- -group "AElfred2 and SAX2 Utilities" \
- "gnu.xml.aelfred2:gnu.xml.pipeline:gnu.xml.util" \
- -group "DOM2, implementing DOM Level 2" \
- "gnu.xml.dom" \
- \
- -group "SAX and SAX2" \
- "org.xml.sax:org.xml.sax.ext:org.xml.sax.helpers" \
- -group "DOM Level 2 (W3C)" \
- "org.w3c.*" \
- -group "Java API for XML (v1.1) (Sun)" \
- "javax.xml.*" \
- \
- gnu.xml.aelfred2 gnu.xml.pipeline gnu.xml.util \
- gnu.xml.dom \
- org.xml.sax org.xml.sax.ext org.xml.sax.helpers \
- org.w3c.dom org.w3c.dom.events \
- javax.xml.parsers \
- javax.xml.transform javax.xml.transform.dom \
- javax.xml.transform.sax javax.xml.transform.stream
- jar cMf apidoc.zip apidoc
-
-#
-# RELEASE ENGINEERING:
-# "full" release has source, jarfile, javadoc, and extras
-#
-# override VERSION in environment, like:
-# $ VERSION=1.0beta1 make -e release
-#
-VERSION = dev
-
-release: gnujaxp-$(VERSION).zip
-
-
-DIST_DIR = gnujaxp-$(VERSION)
-
-# XXX ChangeLog
-FILES := \
- LICENSE COPYING COPYRIGHT.html README \
- gnujaxp.jar \
- configure Makefile.in manifest.mf
-
-gnujaxp-$(VERSION).zip: $(FILES) apidoc.zip $(SOURCEFILES) $(PKGFILES)
- for F in $(FILES) $(SOURCEFILES) $(PKGFILES) ;\
- do \
- mkdir -p `dirname $(DIST_DIR)/$$F` ;\
- cp $$F $(DIST_DIR)/$$F ;\
- done
- cd $(DIST_DIR); jar xf ../apidoc.zip
- chmod +x $(DIST_DIR)/configure
- cp gnujaxp.jar $(DIST_DIR)
- # jar cMf gnujaxp-$(VERSION).zip $(DIST_DIR)
- zip -qr9 gnujaxp-$(VERSION).zip $(DIST_DIR)
- rm -rf $(DIST_DIR)
-
diff --git a/external/jaxp/Makefile.in b/external/jaxp/Makefile.in
deleted file mode 100644
index 3bef3f131..000000000
--- a/external/jaxp/Makefile.in
+++ /dev/null
@@ -1,466 +0,0 @@
-# Makefile for GNU classpathx "GNUJAXP" project
-#
-# You are free to redistribute this file. NO WARRANTY or fitness
-# for purpose is implied by this notice.
-#
-# !!! !!!
-# !!! MAKE EDITS TO "Makefile.in", not "Makefile" !!!
-# !!! !!!
-#
-# Use the "configure" command to generate the project Makefile
-# from its "Makefile.in" template.
-#
-
-##set by configure
-
-PROJECTROOT = @srcdir@
-
-JAVAC = @JAVA_CC@
-JAVAC_OPTS = -g @JAVA_CC_OPTS@
-JAR = @JAR_TOOL@
-
-SOURCEDIR = $(PROJECTROOT)/source
-SOURCEFILES = $(SOURCEDIR)/gnu/xml/aelfred2/JAXPFactory.java \
- $(SOURCEDIR)/gnu/xml/aelfred2/SAXDriver.java \
- $(SOURCEDIR)/gnu/xml/aelfred2/XmlParser.java \
- $(SOURCEDIR)/gnu/xml/aelfred2/XmlReader.java \
- $(SOURCEDIR)/gnu/xml/dom/Consumer.java \
- $(SOURCEDIR)/gnu/xml/dom/DomAttr.java \
- $(SOURCEDIR)/gnu/xml/dom/DomCDATA.java \
- $(SOURCEDIR)/gnu/xml/dom/DomCharacterData.java \
- $(SOURCEDIR)/gnu/xml/dom/DomComment.java \
- $(SOURCEDIR)/gnu/xml/dom/DomDoctype.java \
- $(SOURCEDIR)/gnu/xml/dom/DomDocument.java \
- $(SOURCEDIR)/gnu/xml/dom/DomElement.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEntity.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEntityReference.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEvent.java \
- $(SOURCEDIR)/gnu/xml/dom/DomEx.java \
- $(SOURCEDIR)/gnu/xml/dom/DomExtern.java \
- $(SOURCEDIR)/gnu/xml/dom/DomFragment.java \
- $(SOURCEDIR)/gnu/xml/dom/DomImpl.java \
- $(SOURCEDIR)/gnu/xml/dom/DomIterator.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNamedNodeMap.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNode.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNotation.java \
- $(SOURCEDIR)/gnu/xml/dom/DomNsNode.java \
- $(SOURCEDIR)/gnu/xml/dom/DomPI.java \
- $(SOURCEDIR)/gnu/xml/dom/DomText.java \
- $(SOURCEDIR)/gnu/xml/dom/JAXPFactory.java \
- $(SOURCEDIR)/gnu/xml/pipeline/CallFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/DomConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/EventConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/EventFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/LinkFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/NSFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/PipelineFactory.java \
- $(SOURCEDIR)/gnu/xml/pipeline/TeeConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/TextConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/ValidationConsumer.java \
- $(SOURCEDIR)/gnu/xml/pipeline/WellFormednessFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/XIncludeFilter.java \
- $(SOURCEDIR)/gnu/xml/pipeline/XsltFilter.java \
- $(SOURCEDIR)/gnu/xml/util/DoParse.java \
- $(SOURCEDIR)/gnu/xml/util/DomParser.java \
- $(SOURCEDIR)/gnu/xml/util/Resolver.java \
- $(SOURCEDIR)/gnu/xml/util/SAXNullTransformerFactory.java \
- $(SOURCEDIR)/gnu/xml/util/XCat.java \
- $(SOURCEDIR)/gnu/xml/util/XHTMLWriter.java \
- $(SOURCEDIR)/gnu/xml/util/XMLWriter.java \
- $(SOURCEDIR)/javax/xml/parsers/ClassStuff.java \
- $(SOURCEDIR)/javax/xml/parsers/DocumentBuilder.java \
- $(SOURCEDIR)/javax/xml/parsers/DocumentBuilderFactory.java \
- $(SOURCEDIR)/javax/xml/parsers/FactoryConfigurationError.java \
- $(SOURCEDIR)/javax/xml/parsers/ParserConfigurationException.java \
- $(SOURCEDIR)/javax/xml/parsers/SAXParser.java \
- $(SOURCEDIR)/javax/xml/parsers/SAXParserFactory.java \
- $(SOURCEDIR)/javax/xml/transform/ClassStuff.java \
- $(SOURCEDIR)/javax/xml/transform/ErrorListener.java \
- $(SOURCEDIR)/javax/xml/transform/OutputKeys.java \
- $(SOURCEDIR)/javax/xml/transform/Result.java \
- $(SOURCEDIR)/javax/xml/transform/Source.java \
- $(SOURCEDIR)/javax/xml/transform/SourceLocator.java \
- $(SOURCEDIR)/javax/xml/transform/Templates.java \
- $(SOURCEDIR)/javax/xml/transform/Transformer.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerConfigurationException.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerException.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerFactory.java \
- $(SOURCEDIR)/javax/xml/transform/TransformerFactoryConfigurationError.java \
- $(SOURCEDIR)/javax/xml/transform/URIResolver.java \
- $(SOURCEDIR)/javax/xml/transform/dom/DOMLocator.java \
- $(SOURCEDIR)/javax/xml/transform/dom/DOMResult.java \
- $(SOURCEDIR)/javax/xml/transform/dom/DOMSource.java \
- $(SOURCEDIR)/javax/xml/transform/sax/SAXResult.java \
- $(SOURCEDIR)/javax/xml/transform/sax/SAXSource.java \
- $(SOURCEDIR)/javax/xml/transform/sax/SAXTransformerFactory.java \
- $(SOURCEDIR)/javax/xml/transform/sax/TemplatesHandler.java \
- $(SOURCEDIR)/javax/xml/transform/sax/TransformerHandler.java \
- $(SOURCEDIR)/javax/xml/transform/stream/StreamResult.java \
- $(SOURCEDIR)/javax/xml/transform/stream/StreamSource.java \
- $(SOURCEDIR)/org/w3c/dom/Attr.java \
- $(SOURCEDIR)/org/w3c/dom/CDATASection.java \
- $(SOURCEDIR)/org/w3c/dom/CharacterData.java \
- $(SOURCEDIR)/org/w3c/dom/Comment.java \
- $(SOURCEDIR)/org/w3c/dom/DOMException.java \
- $(SOURCEDIR)/org/w3c/dom/DOMImplementation.java \
- $(SOURCEDIR)/org/w3c/dom/Document.java \
- $(SOURCEDIR)/org/w3c/dom/DocumentFragment.java \
- $(SOURCEDIR)/org/w3c/dom/DocumentType.java \
- $(SOURCEDIR)/org/w3c/dom/Element.java \
- $(SOURCEDIR)/org/w3c/dom/Entity.java \
- $(SOURCEDIR)/org/w3c/dom/EntityReference.java \
- $(SOURCEDIR)/org/w3c/dom/NamedNodeMap.java \
- $(SOURCEDIR)/org/w3c/dom/Node.java \
- $(SOURCEDIR)/org/w3c/dom/NodeList.java \
- $(SOURCEDIR)/org/w3c/dom/Notation.java \
- $(SOURCEDIR)/org/w3c/dom/ProcessingInstruction.java \
- $(SOURCEDIR)/org/w3c/dom/Text.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2Azimuth.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2BackgroundPosition.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2BorderSpacing.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2CounterIncrement.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2CounterReset.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2Cursor.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2FontFaceSrc.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2FontFaceWidths.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2PageSize.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2PlayDuring.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2Properties.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSS2TextShadow.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSCharsetRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSFontFaceRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSImportRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSMediaRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSPageRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSPrimitiveValue.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSRuleList.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSStyleDeclaration.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSStyleRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSStyleSheet.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSUnknownRule.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSValue.java \
- $(SOURCEDIR)/org/w3c/dom/css/CSSValueList.java \
- $(SOURCEDIR)/org/w3c/dom/css/Counter.java \
- $(SOURCEDIR)/org/w3c/dom/css/DOMImplementationCSS.java \
- $(SOURCEDIR)/org/w3c/dom/css/DocumentCSS.java \
- $(SOURCEDIR)/org/w3c/dom/css/ElementCSSInlineStyle.java \
- $(SOURCEDIR)/org/w3c/dom/css/RGBColor.java \
- $(SOURCEDIR)/org/w3c/dom/css/Rect.java \
- $(SOURCEDIR)/org/w3c/dom/css/ViewCSS.java \
- $(SOURCEDIR)/org/w3c/dom/events/DocumentEvent.java \
- $(SOURCEDIR)/org/w3c/dom/events/Event.java \
- $(SOURCEDIR)/org/w3c/dom/events/EventException.java \
- $(SOURCEDIR)/org/w3c/dom/events/EventListener.java \
- $(SOURCEDIR)/org/w3c/dom/events/EventTarget.java \
- $(SOURCEDIR)/org/w3c/dom/events/MouseEvent.java \
- $(SOURCEDIR)/org/w3c/dom/events/MutationEvent.java \
- $(SOURCEDIR)/org/w3c/dom/events/UIEvent.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLAnchorElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLAppletElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLAreaElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBRElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBaseElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBaseFontElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLBodyElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLButtonElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLCollection.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDListElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDOMImplementation.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDirectoryElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDivElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLDocument.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFieldSetElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFontElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFormElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFrameElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLFrameSetElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHRElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHeadElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHeadingElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLHtmlElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLIFrameElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLImageElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLInputElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLIsIndexElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLIElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLabelElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLegendElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLLinkElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLMapElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLMenuElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLMetaElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLModElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLOListElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLObjectElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLOptGroupElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLOptionElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLParagraphElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLParamElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLPreElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLQuoteElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLScriptElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLSelectElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLStyleElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableCaptionElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableCellElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableColElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableRowElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTableSectionElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTextAreaElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLTitleElement.java \
- $(SOURCEDIR)/org/w3c/dom/html/HTMLUListElement.java \
- $(SOURCEDIR)/org/w3c/dom/ranges/DocumentRange.java \
- $(SOURCEDIR)/org/w3c/dom/ranges/Range.java \
- $(SOURCEDIR)/org/w3c/dom/ranges/RangeException.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/DocumentStyle.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/LinkStyle.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/MediaList.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/StyleSheet.java \
- $(SOURCEDIR)/org/w3c/dom/stylesheets/StyleSheetList.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/DocumentTraversal.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/NodeFilter.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/NodeIterator.java \
- $(SOURCEDIR)/org/w3c/dom/traversal/TreeWalker.java \
- $(SOURCEDIR)/org/w3c/dom/views/AbstractView.java \
- $(SOURCEDIR)/org/w3c/dom/views/DocumentView.java \
- $(SOURCEDIR)/org/xml/sax/AttributeList.java \
- $(SOURCEDIR)/org/xml/sax/Attributes.java \
- $(SOURCEDIR)/org/xml/sax/ContentHandler.java \
- $(SOURCEDIR)/org/xml/sax/DTDHandler.java \
- $(SOURCEDIR)/org/xml/sax/DocumentHandler.java \
- $(SOURCEDIR)/org/xml/sax/EntityResolver.java \
- $(SOURCEDIR)/org/xml/sax/ErrorHandler.java \
- $(SOURCEDIR)/org/xml/sax/HandlerBase.java \
- $(SOURCEDIR)/org/xml/sax/InputSource.java \
- $(SOURCEDIR)/org/xml/sax/Locator.java \
- $(SOURCEDIR)/org/xml/sax/Parser.java \
- $(SOURCEDIR)/org/xml/sax/SAXException.java \
- $(SOURCEDIR)/org/xml/sax/SAXNotRecognizedException.java \
- $(SOURCEDIR)/org/xml/sax/SAXNotSupportedException.java \
- $(SOURCEDIR)/org/xml/sax/SAXParseException.java \
- $(SOURCEDIR)/org/xml/sax/XMLFilter.java \
- $(SOURCEDIR)/org/xml/sax/XMLReader.java \
- $(SOURCEDIR)/org/xml/sax/ext/Attributes2.java \
- $(SOURCEDIR)/org/xml/sax/ext/Attributes2Impl.java \
- $(SOURCEDIR)/org/xml/sax/ext/DeclHandler.java \
- $(SOURCEDIR)/org/xml/sax/ext/DefaultHandler2.java \
- $(SOURCEDIR)/org/xml/sax/ext/EntityResolver2.java \
- $(SOURCEDIR)/org/xml/sax/ext/LexicalHandler.java \
- $(SOURCEDIR)/org/xml/sax/ext/Locator2.java \
- $(SOURCEDIR)/org/xml/sax/ext/Locator2Impl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/AttributeListImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/AttributesImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/DefaultHandler.java \
- $(SOURCEDIR)/org/xml/sax/helpers/LocatorImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/NamespaceSupport.java \
- $(SOURCEDIR)/org/xml/sax/helpers/NewInstance.java \
- $(SOURCEDIR)/org/xml/sax/helpers/ParserAdapter.java \
- $(SOURCEDIR)/org/xml/sax/helpers/ParserFactory.java \
- $(SOURCEDIR)/org/xml/sax/helpers/XMLFilterImpl.java \
- $(SOURCEDIR)/org/xml/sax/helpers/XMLReaderAdapter.java \
- $(SOURCEDIR)/org/xml/sax/helpers/XMLReaderFactory.java
-
-PKGFILES = \
- $(SOURCEDIR)/gnu/xml/aelfred2/package.html \
- $(SOURCEDIR)/gnu/xml/dom/package.html \
- $(SOURCEDIR)/gnu/xml/pipeline/package.html \
- $(SOURCEDIR)/gnu/xml/util/package.html \
- $(SOURCEDIR)/javax/xml/parsers/package.html \
- $(SOURCEDIR)/javax/xml/transform/package.html \
- $(SOURCEDIR)/javax/xml/transform/dom/package.html \
- $(SOURCEDIR)/javax/xml/transform/sax/package.html \
- $(SOURCEDIR)/javax/xml/transform/stream/package.html \
- $(SOURCEDIR)/org/w3c/dom/package.html \
- $(SOURCEDIR)/org/w3c/dom/events/package.html \
- $(SOURCEDIR)/org/w3c/dom/traversal/package.html \
- $(SOURCEDIR)/org/w3c/dom/views/package.html \
- $(SOURCEDIR)/org/xml/sax/package.html \
- $(SOURCEDIR)/org/xml/sax/ext/package.html \
- $(SOURCEDIR)/org/xml/sax/helpers/package.html \
-
-
-#GCJ options.
-GCJ_OPTS = --encoding=8859_1 -fsyntax-only -femit-class-files
-GCJ_COMPILE = $(GCJ) $(GCJ_OPTS) -Isource -foutput-class-dir=$(CC-DESTDIR)
-
-# Variables which define some useful constants
-newline:=\\n
-empty:=
-space:=$(empty) $(empty)
-
-
-default: gnujaxp.jar
-
-all: gnujaxp.jar javadoc
-
-
-# Ensure the makefile can update itself.
-Makefile: Makefile.in configure.in
- $(SHELL) ./config.status
-
-Makefile.in: Makefile.aj
- $(SHELL) $(PROJECTROOT)/automakejar ./Makefile.in
-
-
-# Build the META-INF directory.
-META-INF META-INF/services:
- mkdir $@
-
-# Admin file targets.
-META-INF/COPYING: META-INF $(PROJECTROOT)/COPYING
- cp $(PROJECTROOT)/COPYING $@
-
-META-INF/LICENSE: META-INF $(PROJECTROOT)/LICENSE
- cp $(PROJECTROOT)/LICENSE $@
-
-# Support file targets.
-META-INF/services/org.xml.sax.driver: META-INF/services
- echo -n gnu.xml.aelfred2.XmlReader > $@
-
-META-INF/services/javax.xml.parsers.SAXParserFactory: META-INF/services
- echo -n gnu.xml.aelfred2.JAXPFactory > $@
-
-META-INF/services/javax.xml.parsers.DocumentBuilderFactory: META-INF/services
- echo -n gnu.xml.dom.JAXPFactory > $@
-
-SUPPORTFILES = \
- META-INF/COPYING \
- META-INF/LICENSE \
- META-INF/services/org.xml.sax.driver \
- META-INF/services/javax.xml.parsers.SAXParserFactory \
- META-INF/services/javax.xml.parsers.DocumentBuilderFactory
-
-
-# This is an automakejar target.
-# You must run the automakejar script on this Make file to
-# cause the target to be legal Make syntax.
-gnujaxp_jar_sourcedir=$(SOURCEDIR)
-gnujaxp_jar_sourcefiles=$(SOURCEFILES)
-gnujaxp_jar_classpath=$(wildcard lib/*.jar)
-gnujaxp_jar_classesdest=classes
-gnujaxp_jar_otherfiles=$(SUPPORTFILES)
-gnujaxp_jar_manifest=$(PROJECTROOT)/manifest.mf
-# End of automakejar target.
-gnujaxp_jar_debugclasses=$(gnujaxp_jar_sourcefiles:.java=.class)
-gnujaxp_jar_classfiles=$(gnujaxp_jar_debugclasses:$(gnujaxp_jar_sourcedir)%=$(gnujaxp_jar_classesdest)%)
-
-gnujaxp.jar:
-gnujaxp.jar: gnujaxp-init $(gnujaxp_jar_classfiles) gnujaxp-compilation $(gnujaxp_jar_otherfiles) $(gnujaxp_jar_manifest)
- $(JAR) cf$(if $(gnujaxp_jar_manifest),m) gnujaxp.jar $(gnujaxp_jar_manifest) $(gnujaxp_jar_otherfiles) -C $(gnujaxp_jar_classesdest) .
-
-.PHONY: gnujaxp-init gnujaxp-compilation
-
-gnujaxp-init:
- echo > filelist
-
-gnujaxp-compilation: $(gnujaxp_jar_classesdest)
- $(if $(shell cat filelist),$(JAVAC) $(JAVAC_OPTS) -d $(gnujaxp_jar_classesdest) -classpath $(call PATHMK,$(gnujaxp_jar_classesdest) $(call PATHMK,$(gnujaxp_jar_classpath))) @filelist)
-
-$(gnujaxp_jar_classesdest):
- mkdir $@
-
-$(gnujaxp_jar_classesdest)/%.class: $(gnujaxp_jar_sourcedir)/%.java
- @echo $? >> filelist
-
-echo_gnujaxp_jar:
- @echo sourcedir = $(gnujaxp_jar_sourcedir)
- @echo sourcefiles = $(gnujaxp_jar_sourcefiles)
- @echo classpath = $(call PATHMK,$(gnujaxp_jar_classpath))
- @echo classesdest = $(gnujaxp_jar_classesdest)
- @echo classfiles = $(gnujaxp_jar_classfiles)
-
-ifeq (${OS},Windows_NT)
-PATHMK = $(subst $(space),;,$(1))
-else
-PATHMK = $(subst $(space),:,$(1))
-endif
-
-
-# for normal development
-# must rerun "make" after this
-clean:
- -rm -rf gnujaxp.jar classes META-INF Log apidoc apidoc.zip
- -rm -rf gnujaxp-*.zip
-
-# Nust rerun automakejar and configure after this
-distclean: clean
- -rm -f Makefile Makefile.in config.cache config.log config.status
-
-# Nust rerun aclocal, autoconf, automakejar and configure after this
-mrproper: distclean
- -rm -f configure
-
-javadoc: apidoc.zip
-apidoc.zip:
- -rm -rf apidoc
- mkdir -p apidoc
- javadoc -d apidoc \
- -windowtitle "GNU JAXP Library" \
- -nodeprecatedlist \
- -version -author -use \
- -bottom "<p>Source code is under GPL \
- (with library exception) in the JAXP project at \
- <a href='http://www.gnu.org/software/classpathx/jaxp'> \
- http://www.gnu.org/software/classpathx/jaxp</a> \
- <br>This documentation was derived from that\
- source code on `date -I`.\
- </p>" \
- -classpath "$(SOURCEDIR)" \
- \
- -group "AElfred2 and SAX2 Utilities" \
- "gnu.xml.aelfred2:gnu.xml.pipeline:gnu.xml.util" \
- -group "DOM2, implementing DOM Level 2" \
- "gnu.xml.dom" \
- \
- -group "SAX and SAX2" \
- "org.xml.sax:org.xml.sax.ext:org.xml.sax.helpers" \
- -group "DOM Level 2 (W3C)" \
- "org.w3c.*" \
- -group "Java API for XML (v1.1) (Sun)" \
- "javax.xml.*" \
- \
- gnu.xml.aelfred2 gnu.xml.pipeline gnu.xml.util \
- gnu.xml.dom \
- org.xml.sax org.xml.sax.ext org.xml.sax.helpers \
- org.w3c.dom org.w3c.dom.events \
- javax.xml.parsers \
- javax.xml.transform javax.xml.transform.dom \
- javax.xml.transform.sax javax.xml.transform.stream
- jar cMf apidoc.zip apidoc
-
-#
-# RELEASE ENGINEERING:
-# "full" release has source, jarfile, javadoc, and extras
-#
-# override VERSION in environment, like:
-# $ VERSION=1.0beta1 make -e release
-#
-VERSION = dev
-
-release: gnujaxp-$(VERSION).zip
-
-
-DIST_DIR = gnujaxp-$(VERSION)
-
-# XXX ChangeLog
-FILES := \
- LICENSE COPYING COPYRIGHT.html README \
- gnujaxp.jar \
- configure Makefile.in manifest.mf
-
-gnujaxp-$(VERSION).zip: $(FILES) apidoc.zip $(SOURCEFILES) $(PKGFILES)
- for F in $(FILES) $(SOURCEFILES) $(PKGFILES) ;\
- do \
- mkdir -p `dirname $(DIST_DIR)/$$F` ;\
- cp $$F $(DIST_DIR)/$$F ;\
- done
- cd $(DIST_DIR); jar xf ../apidoc.zip
- chmod +x $(DIST_DIR)/configure
- cp gnujaxp.jar $(DIST_DIR)
- # jar cMf gnujaxp-$(VERSION).zip $(DIST_DIR)
- zip -qr9 gnujaxp-$(VERSION).zip $(DIST_DIR)
- rm -rf $(DIST_DIR)
-
diff --git a/external/jaxp/README b/external/jaxp/README
deleted file mode 100644
index 17e81f136..000000000
--- a/external/jaxp/README
+++ /dev/null
@@ -1,122 +0,0 @@
-WHAT IS THIS
- GNUJAXP includes interfaces and implementations for basic XML
- processing in Java, and some general purpose SAX2 utilities.
-
- The standard distribution includes "gnujaxp.jar", javadoc, and full
- source code. The current software is available at:
-
- http://www.gnu.org/software/classpathx/jaxp
-
- This is intended only to require JDK 1.1 support to compile or run;
- that may change at some point, but for now portability to PJava and
- other widely used Java configurations/profiles is important.
-
- GCJ 3.0 has some bugs compiling this code, either to class files or
- to native code. Newer snapshots (GCJ 3.1) are currently needed to
- compile this code.
-
-JAVA PACKAGES
-
- javax.xml.* ... JAXP 1.1 interfaces
- org.xml.sax.* ... SAX2 (r2pre3, extensions 1.1beta) interfaces
- org.w3c.dom.* ... DOM Level 2 interfaces
-
- gnu.xml.aelfred2.* ... SAX2 parsers (+ optional validator, and JAXP glue)
- gnu.xml.dom.* ... DOM level 2 (XML) implementation (and JAXP glue)
- gnu.xml.pipeline.* ... SAX2 event pipeline support
- gnu.xml.util.* ... various XML utility classes
-
-LICENSING
- Briefly, most software in this package is distributed under the
- GNU General Public License with the "library exception" that
- permits its usage even in statically linked environments. That
- licensing is more permissive than the "LGPL".
-
- See the LICENSE file for more information.
-
-BUILDING
- The default build tools use autoconf and GNU make.
-
- $ ./configure
- ...
- $ make all
- ...
- $
-
- You will need a java compiler on the PATH to build GNUJAXP. You
- can specify one at configuration time like this:
-
- $ JAVA_CC=javac ./configure
- $ make all
-
- See the file HACKING for how to build from CVS.
-
-INSTALLATION AND CONFIGURATION
- The simplest way to use this software is to put the "gnujaxp.jar"
- file into $JAVA_HOME/jre/lib/ext so that it's automatically part
- of the classpath for every application. That works for JDK 1.2
- and later.
-
- Otherwise, you'll need some other way to put it into $CLASSPATH,
- such as an environment variable.
-
- If you have multiple XML tools implementations in your environment,
- you may need to configure software to use the implementations in
- the GNUJAXP distribution rather than some other one. See the project
- website (http://www.gnu.org/software/classpathx/jaxp) for information.
-
-CONFORMANCE TESTING
- The primary test resources are at http://xmlconf.sourceforge.net
- and include:
-
- SAX2/XML conformance tests
- That the "xml.testing.Driver" addresses the core XML 1.0
- specification requirements, which closely correspond to the
- functionality SAX1 provides. The driver uses SAX2 APIs to
- test that functionality It is used with a bugfixed version of
- the NIST/OASIS XML conformance test cases.
-
- The AElfred2 parser is highly conformant, though it still takes
- a few implementation shortcuts. See its package documentation
- for information about known XML conformance issues in AElfred2.
-
- The primary issue is using Unicode character tables, rather than
- those in the XML specification, for determining what names are
- valid. Most applications won't notice the difference, and this
- solution is smaller and faster than the alternative.
-
- For validation, a secondary issue is that issues relating to
- entity modularity are not validated; they can't all be cleanly
- layered. For example, validity constraints related to standalone
- declarations and PE nesting are not checked.
-
- SAX2
- SAX2 API conformance currently has a minimal JUNIT (0.2) test suite,
- which can be accessed at the xmlconf site listed above. It does
- not cover namespaces or LexicalHandler and Declhandler extensions
- anywhere as exhaustively as the SAX1 level functionality is
- tested by the "xml.testing.Driver". However:
-
- - Applying the DOM unit tests to this implementation gives
- the LexicalHandler (comments, and boundaries of DTDs,
- CDATA sections, and general entities) a workout, and
- does the same for DeclHandler entity declarations.
-
- - The pipeline package's layered validator demands that
- element and attribute declarations are reported correctly.
-
- By those metrics, SAX2 conformance for AElfred2 is also strong.
-
- DOM Level 1 (and Level 2 Events) Tests
- The "domunit 0.0.6" tests use the JAXP API to hook up a DOM
- implementation to a parser (out of scope for DOM Level 2).
- Those DOM unit tests are mostly related to Level 1, except
- for a few relating to the Level 2 events module.
-
- All of these tests pass.
-
- However, you may want to be aware that Entity nodes, and all
- EntityReference nodes not created by parsing a document, will
- have no children. Since you should as a rule avoid both these
- node types, you probably won't run into related problems.
-
diff --git a/external/jaxp/aclocal.m4 b/external/jaxp/aclocal.m4
deleted file mode 100644
index 033a8e586..000000000
--- a/external/jaxp/aclocal.m4
+++ /dev/null
@@ -1,34 +0,0 @@
-
-AC_DEFUN([IFVAL],
-[ifelse([$1], [], [$3], [$2])])
-
-
-# AC_PROG_JAVA_CC([COMPILER ...])
-# --------------------------
-# COMPILER ... is a space separated list of java compilers to search for.
-# This just gives the user an opportunity to specify an alternative
-# search list for the java compiler.
-# The compiler is set in the variable JAVA_CC and the compiler options
-# are set in the variable JAVA_CC_OPTS
-AC_DEFUN([AC_PROG_JAVA_CC],
-[IFVAL([$1],
- [AC_CHECK_PROGS(JAVA_CC, [$1], , $PATH)],
-[AC_CHECK_PROG(JAVA_CC, gcj, gcj, , $PATH)
-if test -z "$JAVA_CC"; then
- AC_CHECK_PROG(JAVA_CC, javac, javac, , $PATH)
-fi
-if test -z "$JAVA_CC"; then
- AC_CHECK_PROG(JAVA_CC, jikes, jikes, , $PATH)
-fi
-])
-
-if test "$JAVA_CC" = "gcj"; then
- if test "$GCJ_OPTS" = ""; then
- AC_SUBST(GCJ_OPTS,-C)
- echo > /dev/null
- fi
- AC_SUBST(JAVA_CC_OPTS, @GCJ_OPTS@,
- [Define the compilation options for GCJ])
-fi
-test -z "$JAVA_CC" && AC_MSG_ERROR([no acceptable java compiler found in \$PATH])
-])# AC_PROG_JAVA_CC
diff --git a/external/jaxp/automakejar b/external/jaxp/automakejar
deleted file mode 100755
index 6f29fd347..000000000
--- a/external/jaxp/automakejar
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/sh
-# Automagically generate make rules to compile jar files
-# specified in the Makefile.aj
-#
-# (C) Tapsell-Ferrier Limited 2002 <nferrier@tapsellferrier.co.uk>
-#
-# This results in a file called:
-# Makefile
-# unless there is an argument specified in which case
-# it results in a file specified in the argument.
-#
-# Therefore to produce a Makefile.in you could do this:
-#
-# automakejar Makefile.in
-#
-
-TMP=${TEMP:-/tmp/}
-
-# Create the generic editor script.
-SEDSCRIPT=$TMP/automakejar.$$
-cat > ${SEDSCRIPT} <<\EOF
-#-n
-# A first stage sed script to produce a Makefile from a template.
-# (C) Tapsell-Ferrier Limited 2002 <nferrier@tapsellferrier.co.uk>
-#
-# This script would be much easier if GNU Make's target specific variables
-# cascaded into sub-targets. But they don't as of 3.79.1.
-/^__JARFILENAME__.jar:.*$/,/^$/{
- # Store the dummy target.
- /^__JARFILENAME__.jar:.*/ {
- h
- d
- }
- # Make sure the variable definitions appear at the start of lines.
- s/^ sourcedir=/sourcedir=/
- s/^ sourcefiles=/sourcefiles=/
- s/^ classpath=/classpath=/
- s/^ classesdest=/classesdest=/
- s/^ otherfiles=/otherfiles=/
- s/^ manifest=/manifest=/
- # Mangle the names of the target variables
- s/sourcedir/__JARFILENAME___jar_sourcedir/
- s/sourcefiles/__JARFILENAME___jar_sourcefiles/
- s/classpath/__JARFILENAME___jar_classpath/
- s/classesdest/__JARFILENAME___jar_classesdest/
- s/otherfiles/__JARFILENAME___jar_otherfiles/
- s/manifest/__JARFILENAME___jar_manifest/
- # Ensure $variables are referenced properly
- s/\$\([A-Za-z_][A-Za-z_]*\)/$(\1)/g
- # Change quoted sh syntax to make syntax
- s/`\(.*\)`/$(shell \1)/
- # At the end of the automakejar decleration put the real Make decl.
- /^$/ {
- i\
-__JARFILENAME___jar_debugclasses=$(__JARFILENAME___jar_sourcefiles:.java=.class)\
-__JARFILENAME___jar_classfiles=$(__JARFILENAME___jar_debugclasses:$(__JARFILENAME___jar_sourcedir)%=$(__JARFILENAME___jar_classesdest)%)\
-
- # This ensures that the target that the user put in is inserted.
- {
- g
- p
- i\
-__JARFILENAME__.jar: __JARFILENAME__-init $(__JARFILENAME___jar_classfiles) __JARFILENAME__-compilation $(__JARFILENAME___jar_otherfiles) $(__JARFILENAME___jar_manifest)\
- $(JAR) cf$(if $(__JARFILENAME___jar_manifest),m) __JARFILENAME__.jar $(__JARFILENAME___jar_manifest) $(__JARFILENAME___jar_otherfiles) -C $(__JARFILENAME___jar_classesdest) .\
-\
-.PHONY: __JARFILENAME__-init __JARFILENAME__-compilation\
-\
-__JARFILENAME__-init:\
- echo > filelist\
-\
-__JARFILENAME__-compilation: $(__JARFILENAME___jar_classesdest)\
- $(if $(shell cat filelist),$(JAVAC) $(JAVAC_OPTS) -d $(__JARFILENAME___jar_classesdest) -classpath $(call PATHMK,$(__JARFILENAME___jar_classesdest) $(call PATHMK,$(__JARFILENAME___jar_classpath))) @filelist)\
-\
-$(__JARFILENAME___jar_classesdest):\
- mkdir $@\
-\
-$(__JARFILENAME___jar_classesdest)/%.class: $(__JARFILENAME___jar_sourcedir)/%.java\
- @echo $? >> filelist\
-\
-echo___JARFILENAME___jar:\
- @echo sourcedir = $(__JARFILENAME___jar_sourcedir)\
- @echo sourcefiles = $(__JARFILENAME___jar_sourcefiles)\
- @echo classpath = $(call PATHMK,$(__JARFILENAME___jar_classpath))\
- @echo classesdest = $(__JARFILENAME___jar_classesdest)\
- @echo classfiles = $(__JARFILENAME___jar_classfiles)\
-\
-ifeq (${OS},Windows_NT)\
-PATHMK = $(subst $(space),;,$(1))\
-else\
-PATHMK = $(subst $(space),:,$(1))\
-endif
- }
- # Ensure we branch to end of script once template is done.
- b end
- }
-}
-# Output all other lines as they are.
-p
-:end
-EOF
-
-# The file to produce.
-Makefile=${1:-Makefile}
-
-# The name of the template file.
-MakeTemplate=`dirname $0`/Makefile.aj
-
-echo Making $Makefile from $MakeTemplate
-
-
-# The Makefile to be mangled, changes every iteration.
-MakeSource=${MakeTemplate}
-# Make a bespoke sed script and then edit the source Makefile.
-for something in `sed -n 's/^\([A-Za-z0-9_-]*\)\.jar:.*$/\1/p' ${MakeTemplate}`
-do
- MakeOutput=${Makefile}.${RANDOM}
- echo creating the target: $something
- EDITSCRIPT=${SEDSCRIPT}.edit.$$
- sed -n "s/__JARFILENAME__/${something}/g ; p" ${SEDSCRIPT} > ${EDITSCRIPT}
- sed -n -f ${EDITSCRIPT} ${MakeSource} > ${MakeOutput}
- if [ "${MakeSource}" != "${MakeTemplate}" ] ;
- then
- rm ${MakeSource}
- fi
- MakeSource=${MakeOutput}
- rm $EDITSCRIPT
-done
-
-mv ${MakeOutput} ${Makefile}
-
-rm $SEDSCRIPT
-
-# end. \ No newline at end of file
diff --git a/external/jaxp/configure.in b/external/jaxp/configure.in
deleted file mode 100644
index 89bf01b92..000000000
--- a/external/jaxp/configure.in
+++ /dev/null
@@ -1,16 +0,0 @@
-AC_INIT(source/javax/xml/parsers/SAXParserFactory.java)
-
-
-dnl Tool discovery
-
-AC_PATH_PROG(JAR_TOOL, jar,)
-
-AC_PROG_JAVA_CC()
-
-
-dnl Setup the output files
-
-AC_OUTPUT(Makefile)
-
-
-dnl End.
diff --git a/external/jaxp/manifest.mf b/external/jaxp/manifest.mf
deleted file mode 100644
index cc6bbd391..000000000
--- a/external/jaxp/manifest.mf
+++ /dev/null
@@ -1,28 +0,0 @@
-Extension-Name: GNUJAXP
-Implementation-Title: GNU JAXP
-Implementation-URL: http://www.gnu.org/software/classpathx/jaxp
-Implementation-Vendor: Free Software Foundation
-Main-Class: gnu.xml.util.DoParse
-
-Name: gnu/xml/aelfred2/
-Implementation-Title: AElfred2
-
-Name: gnu/xml/dom/
-Implementation-Title: DOM2
-
-Name: org/w3c/dom
-Specification-Title: Document Object Model (DOM)
-Specification-Vendor: www.w3c.org
-Specification-Version: Level 2
-
-Name: org/xml/sax/
-Implementation-URL: http://sax.sourceforge.net
-Specification-Title: Simple API for XML (SAX) core
-Specification-Vendor: sax.sourceforge.net
-Specification-Version: 2.0
-
-Name: javax/xml/
-Specification-Title: Java API for XML Parsing (JAXP)
-Specification-Vendor: Sun Microsystems
-Specification-Version: 1.1
-
diff --git a/external/jaxp/source/gnu/xml/aelfred2/JAXPFactory.java b/external/jaxp/source/gnu/xml/aelfred2/JAXPFactory.java
deleted file mode 100644
index b7bdce336..000000000
--- a/external/jaxp/source/gnu/xml/aelfred2/JAXPFactory.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.aelfred2;
-
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import org.xml.sax.Parser;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.helpers.XMLReaderAdapter;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParser;
-import javax.xml.parsers.SAXParserFactory;
-
-
-/**
- * Configurable factory to create an &AElig;lfred2 JAXP parser; required
- * to bootstrap using JAXP. You should use SAX2 directly where possible,
- * rather than through JAXP, since that gives you better control.
- * This class would normally be configured as a platform default factory.
- *
- * @author David Brownell
- */
-public final class JAXPFactory extends SAXParserFactory
-{
- private Hashtable flags = new Hashtable ();
-
- /**
- * Constructs a factory which normally returns a non-validating
- * parser.
- */
- public JAXPFactory () { }
-
- public SAXParser newSAXParser ()
- throws ParserConfigurationException, SAXException
- {
- JaxpParser jaxp = new JaxpParser ();
- Enumeration e = flags.keys ();
- XMLReader parser = jaxp.getXMLReader ();
-
- parser.setFeature (
- SAXDriver.FEATURE + "namespaces",
- isNamespaceAware ());
- parser.setFeature (
- SAXDriver.FEATURE + "validation",
- isValidating ());
- // that makes SAX2 feature flags trump JAXP
-
- while (e.hasMoreElements ()) {
- String uri = (String) e.nextElement ();
- Boolean value = (Boolean) flags.get (uri);
- parser.setFeature (uri, value.booleanValue ());
- }
-
- return jaxp;
- }
-
- // yes, this "feature transfer" mechanism doesn't play well
-
- public void setFeature (String name, boolean value)
- throws
- ParserConfigurationException,
- SAXNotRecognizedException,
- SAXNotSupportedException
- {
- try {
- // force "early" detection of errors where possible
- // (flags can't necessarily be set before parsing)
- new JaxpParser ().getXMLReader ().setFeature (name, value);
-
- flags.put (name, new Boolean (value));
- } catch (SAXNotRecognizedException e) {
- throw new SAXNotRecognizedException (name);
- } catch (SAXNotSupportedException e) {
- throw new SAXNotSupportedException (name);
- } catch (Exception e) {
- throw new ParserConfigurationException (
- e.getClass ().getName ()
- + ": "
- + e.getMessage ());
- }
- }
-
- public boolean getFeature (String name)
- throws
- ParserConfigurationException,
- SAXNotRecognizedException,
- SAXNotSupportedException
- {
- Boolean value = (Boolean) flags.get (name);
-
- if (value == null)
- return value.booleanValue ();
- else
- try {
- return new JaxpParser ().getXMLReader ().getFeature (name);
- } catch (SAXNotRecognizedException e) {
- throw new SAXNotRecognizedException (name);
- } catch (SAXNotSupportedException e) {
- throw new SAXNotSupportedException (name);
- } catch (SAXException e) {
- throw new ParserConfigurationException (
- e.getClass ().getName ()
- + ": "
- + e.getMessage ());
- }
- }
-
- private static class JaxpParser extends SAXParser
- {
- private XmlReader ae2 = new XmlReader ();
- private XMLReaderAdapter parser = null;
-
- JaxpParser () { }
-
- public void setProperty (String id, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- { ae2.setProperty (id, value); }
-
- public Object getProperty (String id)
- throws SAXNotRecognizedException, SAXNotSupportedException
- { return ae2.getProperty (id); }
-
- public Parser getParser ()
- throws SAXException
- {
- if (parser == null)
- parser = new XMLReaderAdapter (ae2);
- return parser;
- }
-
- public XMLReader getXMLReader ()
- throws SAXException
- { return ae2; }
-
- public boolean isNamespaceAware ()
- {
- try {
- return ae2.getFeature (SAXDriver.FEATURE + "namespaces");
- } catch (Exception e) {
- throw new Error ();
- }
- }
-
- public boolean isValidating ()
- {
- try {
- return ae2.getFeature (SAXDriver.FEATURE + "validation");
- } catch (Exception e) {
- throw new Error ();
- }
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/aelfred2/SAXDriver.java b/external/jaxp/source/gnu/xml/aelfred2/SAXDriver.java
deleted file mode 100644
index 447cc8792..000000000
--- a/external/jaxp/source/gnu/xml/aelfred2/SAXDriver.java
+++ /dev/null
@@ -1,1272 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-//
-// Copyright (c) 1998 by Microstar Software Ltd.
-// From Microstar's README (the entire original license):
-//
-// Separate statements also said it's in the public domain.
-// All modifications are distributed under the license
-// above (GPL with library exception).
-//
-// AElfred is free for both commercial and non-commercial use and
-// redistribution, provided that Microstar's copyright and disclaimer are
-// retained intact. You are free to modify AElfred for your own use and
-// to redistribute AElfred with your modifications, provided that the
-// modifications are clearly documented.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// merchantability or fitness for a particular purpose. Please use it AT
-// YOUR OWN RISK.
-//
-
-
-package gnu.xml.aelfred2;
-
-import java.io.*;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Locale;
-import java.util.Stack;
-
-// maintaining 1.1 compatibility for now ... more portable, PJava, etc
-// Iterator, Hashmap and ArrayList ought to be faster
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.NamespaceSupport;
-
-
-/**
- * An enhanced SAX2 version of Microstar's &AElig;lfred XML parser.
- * The enhancements primarily relate to significant improvements in
- * conformance to the XML specification, and SAX2 support. Performance
- * has been improved. See the package level documentation for more
- * information.
- *
- * <table border="1" width='100%' cellpadding='3' cellspacing='0'>
- * <tr bgcolor='#ccccff'>
- * <th><font size='+1'>Name</font></th>
- * <th><font size='+1'>Notes</font></th></tr>
- *
- * <tr><td colspan=2><center><em>Features ... URL prefix is
- * <b>http://xml.org/sax/features/</b></em></center></td></tr>
- *
- * <tr><td>(URL)/external-general-entities</td>
- * <td>Value defaults to <em>true</em></td></tr>
- * <tr><td>(URL)/external-parameter-entities</td>
- * <td>Value defaults to <em>true</em></td></tr>
- * <tr><td>(URL)/is-standalone</td>
- * <td>(PRELIMINARY) Returns true iff the document's parsing
- * has started (some non-error event after <em>startDocument()</em>
- * was reported) and the document's standalone flag is set.</td></tr>
- * <tr><td>(URL)/namespace-prefixes</td>
- * <td>Value defaults to <em>false</em> (but XML 1.0 names are
- * always reported)</td></tr>
- * <tr><td>(URL)/lexical-handler/parameter-entities</td>
- * <td>Value is fixed at <em>true</em></td></tr>
- * <tr><td>(URL)/namespaces</td>
- * <td>Value defaults to <em>true</em></td></tr>
- * <tr><td>(URL)/resolve-dtd-uris</td>
- * <td>(PRELIMINARY) Value defaults to <em>true</em></td></tr>
- * <tr><td>(URL)/string-interning</td>
- * <td>Value is fixed at <em>true</em></td></tr>
- * <tr><td>(URL)/use-attributes2</td>
- * <td>(PRELIMINARY) Value is fixed at <em>true</em></td></tr>
- * <tr><td>(URL)/use-entity-resolver2</td>
- * <td>(PRELIMINARY) Value defaults to <em>true</em></td></tr>
- * <tr><td>(URL)/validation</td>
- * <td>Value is fixed at <em>false</em></td></tr>
- *
- * <tr><td colspan=2><center><em>Handler Properties ... URL prefix is
- * <b>http://xml.org/sax/properties/</b></em></center></td></tr>
- *
- * <tr><td>(URL)/declaration-handler</td>
- * <td>A declaration handler may be provided. </td></tr>
- * <tr><td>(URL)/lexical-handler</td>
- * <td>A lexical handler may be provided. </td></tr>
- * </table>
- *
- * <p>This parser currently implements the SAX1 Parser API, but
- * it may not continue to do so in the future.
- *
- * @author Written by David Megginson (version 1.2a from Microstar)
- * @author Updated by David Brownell &lt;dbrownell@users.sourceforge.net&gt;
- * @see org.xml.sax.Parser
- */
-final public class SAXDriver
- implements Locator, Attributes2, XMLReader, Parser, AttributeList
-{
- private final DefaultHandler2 base = new DefaultHandler2 ();
- private XmlParser parser;
-
- private EntityResolver entityResolver = base;
- private EntityResolver2 resolver2 = null;
- private ContentHandler contentHandler = base;
- private DTDHandler dtdHandler = base;
- private ErrorHandler errorHandler = base;
- private DeclHandler declHandler = base;
- private LexicalHandler lexicalHandler = base;
-
- private String elementName = null;
- private Stack entityStack = new Stack ();
-
- // could use just one vector (of object/struct): faster, smaller
- private Vector attributeNames = new Vector ();
- private Vector attributeNamespaces = new Vector ();
- private Vector attributeLocalNames = new Vector ();
- private Vector attributeValues = new Vector ();
- private boolean attributeSpecified [] = new boolean[10];
- private boolean attributeDeclared [] = new boolean[10];
-
- private boolean namespaces = true;
- private boolean xmlNames = false;
- private boolean extGE = true;
- private boolean extPE = true;
- private boolean resolveAll = true;
- private boolean useResolver2 = true;
-
- private int attributeCount = 0;
- private boolean attributes;
- private String nsTemp [] = new String [3];
- private NamespaceSupport prefixStack;
-
- //
- // Constructor.
- //
-
- /** Constructs a SAX Parser. */
- public SAXDriver () {}
-
-
- //
- // Implementation of org.xml.sax.Parser.
- //
-
- /**
- * <b>SAX1</b>: Sets the locale used for diagnostics; currently,
- * only locales using the English language are supported.
- * @param locale The locale for which diagnostics will be generated
- */
- public void setLocale (Locale locale)
- throws SAXException
- {
- if ("en".equals (locale.getLanguage ()))
- return ;
-
- throw new SAXException ("AElfred2 only supports English locales.");
- }
-
-
- /**
- * <b>SAX2</b>: Returns the object used when resolving external
- * entities during parsing (both general and parameter entities).
- */
- public EntityResolver getEntityResolver ()
- {
- return (entityResolver == base) ? null : entityResolver;
- }
-
- /**
- * <b>SAX1, SAX2</b>: Set the entity resolver for this parser.
- * @param handler The object to receive entity events.
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- if (resolver instanceof EntityResolver2)
- resolver2 = (EntityResolver2) resolver;
- else
- resolver2 = null;
- if (resolver == null)
- resolver = base;
- entityResolver = resolver;
- }
-
-
- /**
- * <b>SAX2</b>: Returns the object used to process declarations related
- * to notations and unparsed entities.
- */
- public DTDHandler getDTDHandler ()
- {
- return (dtdHandler == base) ? null : dtdHandler;
- }
-
- /**
- * <b>SAX1, SAX2</b>: Set the DTD handler for this parser.
- * @param handler The object to receive DTD events.
- */
- public void setDTDHandler (DTDHandler handler)
- {
- if (handler == null)
- handler = base;
- this.dtdHandler = handler;
- }
-
-
- /**
- * <b>SAX1</b>: Set the document handler for this parser. If a
- * content handler was set, this document handler will supplant it.
- * The parser is set to report all XML 1.0 names rather than to
- * filter out "xmlns" attributes (the "namespace-prefixes" feature
- * is set to true).
- *
- * @deprecated SAX2 programs should use the XMLReader interface
- * and a ContentHandler.
- *
- * @param handler The object to receive document events.
- */
- public void setDocumentHandler (DocumentHandler handler)
- {
- contentHandler = new Adapter (handler);
- xmlNames = true;
- }
-
- /**
- * <b>SAX2</b>: Returns the object used to report the logical
- * content of an XML document.
- */
- public ContentHandler getContentHandler ()
- {
- return contentHandler == base ? null : contentHandler;
- }
-
- /**
- * <b>SAX2</b>: Assigns the object used to report the logical
- * content of an XML document. If a document handler was set,
- * this content handler will supplant it (but XML 1.0 style name
- * reporting may remain enabled).
- */
- public void setContentHandler (ContentHandler handler)
- {
- if (handler == null)
- handler = base;
- contentHandler = handler;
- }
-
- /**
- * <b>SAX1, SAX2</b>: Set the error handler for this parser.
- * @param handler The object to receive error events.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- if (handler == null)
- handler = base;
- this.errorHandler = handler;
- }
-
- /**
- * <b>SAX2</b>: Returns the object used to receive callbacks for XML
- * errors of all levels (fatal, nonfatal, warning); this is never null;
- */
- public ErrorHandler getErrorHandler ()
- { return errorHandler == base ? null : errorHandler; }
-
-
- /**
- * <b>SAX1, SAX2</b>: Auxiliary API to parse an XML document, used mostly
- * when no URI is available.
- * If you want anything useful to happen, you should set
- * at least one type of handler.
- * @param source The XML input source. Don't set 'encoding' unless
- * you know for a fact that it's correct.
- * @see #setEntityResolver
- * @see #setDTDHandler
- * @see #setContentHandler
- * @see #setErrorHandler
- * @exception SAXException The handlers may throw any SAXException,
- * and the parser normally throws SAXParseException objects.
- * @exception IOException IOExceptions are normally through through
- * the parser if there are problems reading the source document.
- */
- public void parse (InputSource source)
- throws SAXException, IOException
- {
- synchronized (base) {
- parser = new XmlParser ();
- if (namespaces)
- prefixStack = new NamespaceSupport ();
- else if (!xmlNames)
- throw new IllegalStateException ();
- parser.setHandler (this);
-
- try {
-
- Reader r = source.getCharacterStream();
- InputStream in = source.getByteStream();
-
-
- parser.doParse (source.getSystemId (),
- source.getPublicId (),
- r,
- in,
- source.getEncoding ());
- } catch (SAXException e) {
- throw e;
- } catch (IOException e) {
- throw e;
- } catch (RuntimeException e) {
- throw e;
- } catch (Exception e) {
- throw new SAXParseException (e.getMessage (), this, e);
- } finally {
- contentHandler.endDocument ();
- entityStack.removeAllElements ();
- parser = null;
- prefixStack = null;
- }
- }
- }
-
-
- /**
- * <b>SAX1, SAX2</b>: Preferred API to parse an XML document, using a
- * system identifier (URI).
- */
- public void parse (String systemId)
- throws SAXException, IOException
- {
- parse (new InputSource (systemId));
- }
-
- //
- // Implementation of SAX2 "XMLReader" interface
- //
- static final String FEATURE = "http://xml.org/sax/features/";
- static final String PROPERTY = "http://xml.org/sax/properties/";
-
- /**
- * <b>SAX2</b>: Tells the value of the specified feature flag.
- *
- * @exception SAXNotRecognizedException thrown if the feature flag
- * is neither built in, nor yet assigned.
- */
- public boolean getFeature (String featureId)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if ((FEATURE + "validation").equals (featureId))
- return false;
-
- // external entities (both types) are optionally included
- if ((FEATURE + "external-general-entities").equals (featureId))
- return extGE;
- if ((FEATURE + "external-parameter-entities") .equals (featureId))
- return extPE;
-
- // element/attribute names are as written in document; no mangling
- if ((FEATURE + "namespace-prefixes").equals (featureId))
- return xmlNames;
-
- // report element/attribute namespaces?
- if ((FEATURE + "namespaces").equals (featureId))
- return namespaces;
-
- // all PEs and GEs are reported
- if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId))
- return true;
-
- // always interns
- if ((FEATURE + "string-interning").equals (featureId))
- return true;
-
- // EXTENSIONS 1.1
-
- // always returns isSpecified info
- if ((FEATURE + "use-attributes2").equals (featureId))
- return true;
-
- // meaningful between startDocument/endDocument
- if ((FEATURE + "is-standalone").equals (featureId)) {
- if (parser == null)
- throw new SAXNotSupportedException (featureId);
- return parser.isStandalone ();
- }
-
- // optionally don't absolutize URIs in declarations
- if ((FEATURE + "resolve-dtd-uris").equals (featureId))
- return resolveAll;
-
- // optionally use resolver2 interface methods, if possible
- if ((FEATURE + "use-entity-resolver2").equals (featureId))
- return useResolver2;
-
- throw new SAXNotRecognizedException (featureId);
- }
-
- // package private
- DeclHandler getDeclHandler () { return declHandler; }
-
- // package private
- boolean resolveURIs () { return resolveAll; }
-
- /**
- * <b>SAX2</b>: Returns the specified property.
- *
- * @exception SAXNotRecognizedException thrown if the property value
- * is neither built in, nor yet stored.
- */
- public Object getProperty (String propertyId)
- throws SAXNotRecognizedException
- {
- if ((PROPERTY + "declaration-handler").equals (propertyId))
- return declHandler == base ? null : declHandler;
-
- if ((PROPERTY + "lexical-handler").equals (propertyId))
- return lexicalHandler == base ? null : lexicalHandler;
-
- // unknown properties
- throw new SAXNotRecognizedException (propertyId);
- }
-
- /**
- * <b>SAX2</b>: Sets the state of feature flags in this parser. Some
- * built-in feature flags are mutable.
- */
- public void setFeature (String featureId, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- boolean state;
-
- // Features with a defined value, we just change it if we can.
- state = getFeature (featureId);
-
- if (state == value)
- return;
- if (parser != null)
- throw new SAXNotSupportedException ("not while parsing");
-
- if ((FEATURE + "namespace-prefixes").equals (featureId)) {
- // in this implementation, this only affects xmlns reporting
- xmlNames = value;
- // forcibly prevent illegal parser state
- if (!xmlNames)
- namespaces = true;
- return;
- }
-
- if ((FEATURE + "namespaces").equals (featureId)) {
- namespaces = value;
- // forcibly prevent illegal parser state
- if (!namespaces)
- xmlNames = true;
- return;
- }
-
- if ((FEATURE + "external-general-entities").equals (featureId)) {
- extGE = value;
- return;
- }
- if ((FEATURE + "external-parameter-entities") .equals (featureId)) {
- extPE = value;
- return;
- }
- if ((FEATURE + "resolve-dtd-uris").equals (featureId)) {
- resolveAll = value;
- return;
- }
-
- if ((FEATURE + "use-entity-resolver2").equals (featureId)) {
- useResolver2 = value;
- return;
- }
-
- throw new SAXNotRecognizedException (featureId);
- }
-
- /**
- * <b>SAX2</b>: Assigns the specified property. Like SAX1 handlers,
- * these may be changed at any time.
- */
- public void setProperty (String propertyId, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- // see if the property is recognized
- getProperty (propertyId);
-
- // Properties with a defined value, we just change it if we can.
-
- if ((PROPERTY + "declaration-handler").equals (propertyId)) {
- if (value == null)
- declHandler = base;
- else if (! (value instanceof DeclHandler))
- throw new SAXNotSupportedException (propertyId);
- else
- declHandler = (DeclHandler) value;
- return ;
- }
-
- if ((PROPERTY + "lexical-handler").equals (propertyId)) {
- if (value == null)
- lexicalHandler = base;
- else if (! (value instanceof LexicalHandler))
- throw new SAXNotSupportedException (propertyId);
- else
- lexicalHandler = (LexicalHandler) value;
- return ;
- }
-
- throw new SAXNotSupportedException (propertyId);
- }
-
-
- //
- // This is where the driver receives XmlParser callbacks and translates
- // them into SAX callbacks. Some more callbacks have been added for
- // SAX2 support.
- //
-
- void startDocument ()
- throws SAXException
- {
- contentHandler.setDocumentLocator (this);
- contentHandler.startDocument ();
- attributeNames.removeAllElements ();
- attributeValues.removeAllElements ();
- }
-
- void skippedEntity (String name)
- throws SAXException
- { contentHandler.skippedEntity (name); }
-
- InputSource getExternalSubset (String name, String baseURI)
- throws SAXException, IOException
- {
- if (resolver2 == null || !useResolver2 || !extPE)
- return null;
- return resolver2.getExternalSubset (name, baseURI);
- }
-
- InputSource resolveEntity (boolean isPE, String name,
- InputSource in, String baseURI)
- throws SAXException, IOException
- {
- InputSource source;
-
- // external entities might be skipped
- if (isPE && !extPE)
- return null;
- if (!isPE && !extGE)
- return null;
-
- // ... or not
- lexicalHandler.startEntity (name);
- if (resolver2 != null && useResolver2) {
- source = resolver2.resolveEntity (name, in.getPublicId (),
- baseURI, in.getSystemId ());
- if (source == null) {
- in.setSystemId (absolutize (baseURI,
- in.getSystemId (), false));
- source = in;
- }
- } else {
- in.setSystemId (absolutize (baseURI, in.getSystemId (), false));
- source = entityResolver.resolveEntity (in.getPublicId (),
- in.getSystemId ());
- if (source == null)
- source = in;
- }
- startExternalEntity (name, source.getSystemId (), true);
- return source;
- }
-
- // absolutize a system ID relative to the specified base URI
- // (temporarily) package-visible for external entity decls
- String absolutize (String baseURI, String systemId, boolean nice)
- throws MalformedURLException, SAXException
- {
- // FIXME normalize system IDs -- when?
- // - Convert to UTF-8
- // - Map reserved and non-ASCII characters to %HH
-
- try {
- if (baseURI == null) {
- warn ("No base URI; hope this SYSTEM id is absolute: "
- + systemId);
- return new URL (systemId).toString ();
- } else
- return new URL (new URL (baseURI), systemId).toString ();
-
- } catch (MalformedURLException e) {
-
- // Let unknown URI schemes pass through unless we need
- // the JVM to map them to i/o streams for us...
- if (!nice)
- throw e;
-
- // sometimes sysids for notations or unparsed entities
- // aren't really URIs...
- warn ("Can't absolutize SYSTEM id: " + e.getMessage ());
- return systemId;
- }
- }
-
- void startExternalEntity (String name, String systemId,
- boolean stackOnly)
- throws SAXException
- {
- // The following warning was deleted because the application has the
- // option of not setting systemId. Sun's JAXP or Xerces seems to
- // ignore this case.
- /*
- if (systemId == null)
- warn ("URI was not reported to parser for entity " + name);
- */
- if (!stackOnly) // spliced [dtd] needs startEntity
- lexicalHandler.startEntity (name);
- entityStack.push (systemId);
- }
-
- void endExternalEntity (String name)
- throws SAXException
- {
- if (!"[document]".equals (name))
- lexicalHandler.endEntity (name);
- entityStack.pop ();
- }
-
- void startInternalEntity (String name)
- throws SAXException
- {
- lexicalHandler.startEntity (name);
- }
-
- void endInternalEntity (String name)
- throws SAXException
- {
- lexicalHandler.endEntity (name);
- }
-
- void doctypeDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- lexicalHandler.startDTD (name, publicId, systemId);
-
- // ... the "name" is a declaration and should be given
- // to the DeclHandler (but sax2 doesn't).
-
- // the IDs for the external subset are lexical details,
- // as are the contents of the internal subset; but sax2
- // doesn't provide the internal subset "pre-parse"
- }
-
- void notationDecl (String name, String ids [])
- throws SAXException
- {
- try {
- dtdHandler.notationDecl (name, ids [0],
- (resolveAll && ids [1] != null)
- ? absolutize (ids [2], ids [1], true)
- : ids [1]);
- } catch (IOException e) {
- // "can't happen"
- throw new SAXParseException (e.getMessage (), this, e);
- }
- }
-
- void unparsedEntityDecl (String name, String ids [], String notation)
- throws SAXException
- {
- try {
- dtdHandler.unparsedEntityDecl (name, ids [0],
- resolveAll
- ? absolutize (ids [2], ids [1], true)
- : ids [1],
- notation);
- } catch (IOException e) {
- // "can't happen"
- throw new SAXParseException (e.getMessage (), this, e);
- }
- }
-
- void endDoctype ()
- throws SAXException
- {
- lexicalHandler.endDTD ();
- }
-
- private void declarePrefix (String prefix, String uri)
- throws SAXException
- {
- int index = uri.indexOf (':');
-
- // many versions of nwalsh docbook stylesheets
- // have bogus URLs; so this can't be an error...
- if (index < 1 && uri.length () != 0)
- warn ("relative URI for namespace: " + uri);
-
- // FIXME: char [0] must be ascii alpha; chars [1..index]
- // must be ascii alphanumeric or in "+-." [RFC 2396]
-
- uri = uri.intern ();
- prefixStack.declarePrefix (prefix, uri);
- contentHandler.startPrefixMapping (prefix, uri);
- }
-
- void attribute (String qname, String value, boolean isSpecified)
- throws SAXException
- {
- if (!attributes) {
- attributes = true;
- if (namespaces)
- prefixStack.pushContext ();
- }
-
- // process namespace decls immediately;
- // then maybe forget this as an attribute
- if (namespaces) {
- int index;
-
- // default NS declaration?
- if ("xmlns" == qname) {
- declarePrefix ("", value);
- if (!xmlNames)
- return;
- }
-
- // NS prefix declaration?
- else if ((index = qname.indexOf (':')) == 5
- && qname.startsWith ("xmlns")) {
- String prefix = qname.substring (6);
-
- if (value.length () == 0) {
- verror ("missing URI in namespace decl attribute: "
- + qname);
- } else
- declarePrefix (prefix, value);
- if (!xmlNames)
- return;
- }
- }
-
- // remember this attribute ...
-
- if (attributeCount == attributeSpecified.length) { // grow array?
- boolean temp [] = new boolean [attributeSpecified.length + 5];
- System.arraycopy (attributeSpecified, 0, temp, 0, attributeCount);
- attributeSpecified = temp;
- }
- attributeSpecified [attributeCount] = isSpecified;
-
- attributeCount++;
- attributeNames.addElement (qname);
- // attribute type comes from querying parser's DTD records
- attributeValues.addElement (value);
-
- // ... patching {lname, uri} later, if needed
- attributeNamespaces.addElement ("");
- attributeLocalNames.addElement ("");
- }
-
- void startElement (String elname)
- throws SAXException
- {
- ContentHandler handler = contentHandler;
-
- //
- // NOTE: this implementation of namespace support adds something
- // like six percent to parsing CPU time, in a large (~50 MB)
- // document that doesn't use namespaces at all. (Measured by PC
- // sampling, with a bug where endElement processing was omitted.)
- // [Measurement referred to older implementation, older JVM ...]
- //
- // It ought to become notably faster in such cases. Most
- // costs are the prefix stack calling Hashtable.get() (2%),
- // String.hashCode() (1.5%) and about 1.3% each for pushing
- // the context, and two chunks of name processing.
- //
-
- if (!attributes) {
- if (namespaces)
- prefixStack.pushContext ();
- } else if (namespaces) {
-
- // now we can patch up namespace refs; we saw all the
- // declarations, so now we'll do the Right Thing
- for (int i = 0; i < attributeCount; i++) {
- String qname = (String) attributeNames.elementAt (i);
- int index;
-
- // default NS declaration?
- if ("xmlns" == qname)
- continue;
-
- index = qname.indexOf (':');
-
- // NS prefix declaration?
- if (index == 5 && qname.startsWith ("xmlns"))
- continue;
-
- // it's not a NS decl; patch namespace info items
- if (prefixStack.processName (qname, nsTemp, true) == null)
- verror ("undeclared attribute prefix in: " + qname);
- else {
- attributeNamespaces.setElementAt (nsTemp [0], i);
- attributeLocalNames.setElementAt (nsTemp [1], i);
- }
- }
- }
-
- // save element name so attribute callbacks work
- elementName = elname;
- if (namespaces) {
- if (prefixStack.processName (elname, nsTemp, false) == null) {
- verror ("undeclared element prefix in: " + elname);
- nsTemp [0] = nsTemp [1] = "";
- }
- handler.startElement (nsTemp [0], nsTemp [1], elname, this);
- } else
- handler.startElement ("", "", elname, this);
- // elementName = null;
-
- // elements with no attributes are pretty common!
- if (attributes) {
- attributeNames.removeAllElements ();
- attributeNamespaces.removeAllElements ();
- attributeLocalNames.removeAllElements ();
- attributeValues.removeAllElements ();
- attributeCount = 0;
- attributes = false;
- }
- }
-
- void endElement (String elname)
- throws SAXException
- {
- ContentHandler handler = contentHandler;
-
- if (!namespaces) {
- handler.endElement ("", "", elname);
- return;
- }
- prefixStack.processName (elname, nsTemp, false);
- handler.endElement (nsTemp [0], nsTemp [1], elname);
-
- Enumeration prefixes = prefixStack.getDeclaredPrefixes ();
-
- while (prefixes.hasMoreElements ())
- handler.endPrefixMapping ((String) prefixes.nextElement ());
- prefixStack.popContext ();
- }
-
- void startCDATA ()
- throws SAXException
- {
- lexicalHandler.startCDATA ();
- }
-
- void charData (char ch[], int start, int length)
- throws SAXException
- {
- contentHandler.characters (ch, start, length);
- }
-
- void endCDATA ()
- throws SAXException
- {
- lexicalHandler.endCDATA ();
- }
-
- void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- contentHandler.ignorableWhitespace (ch, start, length);
- }
-
- void processingInstruction (String target, String data)
- throws SAXException
- {
- contentHandler.processingInstruction (target, data);
- }
-
- void comment (char ch[], int start, int length)
- throws SAXException
- {
- if (lexicalHandler != base)
- lexicalHandler.comment (ch, start, length);
- }
-
- void fatal (String message)
- throws SAXException
- {
- SAXParseException fatal;
-
- fatal = new SAXParseException (message, this);
- errorHandler.fatalError (fatal);
-
- // Even if the application can continue ... we can't!
- throw fatal;
- }
-
- // We can safely report a few validity errors that
- // make layered SAX2 DTD validation more conformant
- void verror (String message)
- throws SAXException
- {
- SAXParseException err;
-
- err = new SAXParseException (message, this);
- errorHandler.error (err);
- }
-
- void warn (String message)
- throws SAXException
- {
- SAXParseException err;
-
- err = new SAXParseException (message, this);
- errorHandler.warning (err);
- }
-
-
- //
- // Implementation of org.xml.sax.Attributes.
- //
-
- /**
- * <b>SAX1 AttributeList, SAX2 Attributes</b> method
- * (don't invoke on parser);
- */
- public int getLength ()
- {
- return attributeNames.size ();
- }
-
- /**
- * <b>SAX2 Attributes</b> method (don't invoke on parser);
- */
- public String getURI (int index)
- {
- return (String) (attributeNamespaces.elementAt (index));
- }
-
- /**
- * <b>SAX2 Attributes</b> method (don't invoke on parser);
- */
- public String getLocalName (int index)
- {
- return (String) (attributeLocalNames.elementAt (index));
- }
-
- /**
- * <b>SAX2 Attributes</b> method (don't invoke on parser);
- */
- public String getQName (int i)
- {
- return (String) (attributeNames.elementAt (i));
- }
-
- /**
- * <b>SAX1 AttributeList</b> method (don't invoke on parser);
- */
- public String getName (int i)
- {
- return (String) (attributeNames.elementAt (i));
- }
-
- /**
- * <b>SAX1 AttributeList, SAX2 Attributes</b> method
- * (don't invoke on parser);
- */
- public String getType (int i)
- {
- String type = parser.getAttributeType (elementName, getQName (i));
- if (type == null)
- return "CDATA";
- // ... use DeclHandler.attributeDecl to see enumerations
- if (type == "ENUMERATION")
- return "NMTOKEN";
- return type;
- }
-
-
- /**
- * <b>SAX1 AttributeList, SAX2 Attributes</b> method
- * (don't invoke on parser);
- */
- public String getValue (int i)
- {
- return (String) (attributeValues.elementAt (i));
- }
-
-
- /**
- * <b>SAX2 Attributes</b> method (don't invoke on parser);
- */
- public int getIndex (String uri, String local)
- {
- int length = getLength ();
-
- for (int i = 0; i < length; i++) {
- if (!getURI (i).equals (uri))
- continue;
- if (getLocalName (i).equals (local))
- return i;
- }
- return -1;
- }
-
-
- /**
- * <b>SAX2 Attributes</b> method (don't invoke on parser);
- */
- public int getIndex (String xmlName)
- {
- int length = getLength ();
-
- for (int i = 0; i < length; i++) {
- if (getQName (i).equals (xmlName))
- return i;
- }
- return -1;
- }
-
-
- /**
- * <b>SAX2 Attributes</b> method (don't invoke on parser);
- */
- public String getType (String uri, String local)
- {
- int index = getIndex (uri, local);
-
- if (index < 0)
- return null;
- return getType (index);
- }
-
-
- /**
- * <b>SAX1 AttributeList, SAX2 Attributes</b> method
- * (don't invoke on parser);
- */
- public String getType (String xmlName)
- {
- int index = getIndex (xmlName);
-
- if (index < 0)
- return null;
- return getType (index);
- }
-
-
- /**
- * <b>SAX Attributes</b> method (don't invoke on parser);
- */
- public String getValue (String uri, String local)
- {
- int index = getIndex (uri, local);
-
- if (index < 0)
- return null;
- return getValue (index);
- }
-
-
- /**
- * <b>SAX1 AttributeList, SAX2 Attributes</b> method
- * (don't invoke on parser);
- */
- public String getValue (String xmlName)
- {
- int index = getIndex (xmlName);
-
- if (index < 0)
- return null;
- return getValue (index);
- }
-
-
- //
- // Implementation of org.xml.sax.ext.Attributes2
- //
-
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.ArrayIndexOutOfBoundsException
- * When the supplied index does not identify an attribute.
- */
- public boolean isDeclared (int index)
- {
- if (index < 0 || index >= attributeCount)
- throw new ArrayIndexOutOfBoundsException ();
- return attributeDeclared [index];
- }
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared (java.lang.String qName)
- {
- int index = getIndex (qName);
- if (index < 0)
- throw new IllegalArgumentException ();
- return attributeDeclared [index];
- }
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared (java.lang.String uri, java.lang.String localName)
- {
- int index = getIndex (uri, localName);
- if (index < 0)
- throw new IllegalArgumentException ();
- return attributeDeclared [index];
- }
-
-
- /**
- * <b>SAX-ext Attributes2</b> method (don't invoke on parser);
- */
- public boolean isSpecified (int index)
- {
- if (index < 0 || index >= attributeCount)
- throw new ArrayIndexOutOfBoundsException ();
- return attributeSpecified [index];
- }
-
- /**
- * <b>SAX-ext Attributes2</b> method (don't invoke on parser);
- */
- public boolean isSpecified (String uri, String local)
- {
- int index = getIndex (uri, local);
-
- if (index < 0)
- throw new IllegalArgumentException ();
- return attributeSpecified [index];
- }
-
- /**
- * <b>SAX-ext Attributes2</b> method (don't invoke on parser);
- */
- public boolean isSpecified (String xmlName)
- {
- int index = getIndex (xmlName);
-
- if (index < 0)
- throw new IllegalArgumentException ();
- return attributeSpecified [index];
- }
-
-
- //
- // Implementation of org.xml.sax.Locator.
- //
-
- /**
- * <b>SAX Locator</b> method (don't invoke on parser);
- */
- public String getPublicId ()
- {
- return null; // FIXME track public IDs too
- }
-
- /**
- * <b>SAX Locator</b> method (don't invoke on parser);
- */
- public String getSystemId ()
- {
- if (entityStack.empty ())
- return null;
- else
- return (String) entityStack.peek ();
- }
-
- /**
- * <b>SAX Locator</b> method (don't invoke on parser);
- */
- public int getLineNumber ()
- {
- return parser.getLineNumber ();
- }
-
- /**
- * <b>SAX Locator</b> method (don't invoke on parser);
- */
- public int getColumnNumber ()
- {
- return parser.getColumnNumber ();
- }
-
- // adapter between SAX2 content handler and SAX1 document handler callbacks
- private static class Adapter implements ContentHandler
- {
- private DocumentHandler docHandler;
-
- Adapter (DocumentHandler dh)
- { docHandler = dh; }
-
-
- public void setDocumentLocator (Locator l)
- { docHandler.setDocumentLocator (l); }
-
- public void startDocument () throws SAXException
- { docHandler.startDocument (); }
-
- public void processingInstruction (String target, String data)
- throws SAXException
- { docHandler.processingInstruction (target, data); }
-
- public void startPrefixMapping (String prefix, String uri)
- { /* ignored */ }
-
- public void startElement (
- String namespace,
- String local,
- String name,
- Attributes attrs
- ) throws SAXException
- { docHandler.startElement (name, (AttributeList) attrs); }
-
- public void characters (char buf [], int offset, int len)
- throws SAXException
- { docHandler.characters (buf, offset, len); }
-
- public void ignorableWhitespace (char buf [], int offset, int len)
- throws SAXException
- { docHandler.ignorableWhitespace (buf, offset, len); }
-
- public void skippedEntity (String name)
- { /* ignored */ }
-
- public void endElement (String u, String l, String name)
- throws SAXException
- { docHandler.endElement (name); }
-
- public void endPrefixMapping (String prefix)
- { /* ignored */ }
-
- public void endDocument () throws SAXException
- { docHandler.endDocument (); }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/aelfred2/XmlParser.java b/external/jaxp/source/gnu/xml/aelfred2/XmlParser.java
deleted file mode 100644
index b0a6864f4..000000000
--- a/external/jaxp/source/gnu/xml/aelfred2/XmlParser.java
+++ /dev/null
@@ -1,4761 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-//
-// Copyright (c) 1997, 1998 by Microstar Software Ltd.
-// From Microstar's README (the entire original license):
-//
-// Separate statements also said it's in the public domain.
-// All modifications are distributed under the license
-// above (GPL with library exception).
-//
-// AElfred is free for both commercial and non-commercial use and
-// redistribution, provided that Microstar's copyright and disclaimer are
-// retained intact. You are free to modify AElfred for your own use and
-// to redistribute AElfred with your modifications, provided that the
-// modifications are clearly documented.
-//
-// This program is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// merchantability or fitness for a particular purpose. Please use it AT
-// YOUR OWN RISK.
-//
-
-
-package gnu.xml.aelfred2;
-
-import java.io.BufferedInputStream;
-import java.io.CharConversionException;
-import java.io.EOFException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.net.URL;
-import java.net.URLConnection;
-
-// maintaining 1.1 compatibility for now ...
-// Iterator and Hashmap ought to be faster
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Stack;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * Parse XML documents and return parse events through call-backs.
- * Use the <code>SAXDriver</code> class as your entry point, as all
- * internal parser interfaces are subject to change.
- *
- * @author Written by David Megginson &lt;dmeggins@microstar.com&gt;
- * (version 1.2a with bugfixes)
- * @author Updated by David Brownell &lt;dbrownell@users.sourceforge.net&gt;
- * @see SAXDriver
- */
-final class XmlParser
-{
- // avoid slow per-character readCh()
- private final static boolean USE_CHEATS = true;
-
-
- //////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct a new parser with no associated handler.
- * @see #setHandler
- * @see #parse
- */
- // package private
- XmlParser ()
- {
- }
-
-
- /**
- * Set the handler that will receive parsing events.
- * @param handler The handler to receive callback events.
- * @see #parse
- */
- // package private
- void setHandler (SAXDriver handler)
- {
- this.handler = handler;
- }
-
-
- /**
- * Parse an XML document from the character stream, byte stream, or URI
- * that you provide (in that order of preference). Any URI that you
- * supply will become the base URI for resolving relative URI, and may
- * be used to acquire a reader or byte stream.
- *
- * <p> Only one thread at a time may use this parser; since it is
- * private to this package, post-parse cleanup is done by the caller,
- * which MUST NOT REUSE the parser (just null it).
- *
- * @param systemId Absolute URI of the document; should never be null,
- * but may be so iff a reader <em>or</em> a stream is provided.
- * @param publicId The public identifier of the document, or null.
- * @param reader A character stream; must be null if stream isn't.
- * @param stream A byte input stream; must be null if reader isn't.
- * @param encoding The suggested encoding, or null if unknown.
- * @exception java.lang.Exception Basically SAXException or IOException
- */
- // package private
- void doParse (
- String systemId,
- String publicId,
- Reader reader,
- InputStream stream,
- String encoding
- ) throws Exception
- {
- if (handler == null)
- throw new IllegalStateException ("no callback handler");
-
- initializeVariables ();
-
- // predeclare the built-in entities here (replacement texts)
- // we don't need to intern(), since we're guaranteed literals
- // are always (globally) interned.
- setInternalEntity ("amp", "&#38;");
- setInternalEntity ("lt", "&#60;");
- setInternalEntity ("gt", "&#62;");
- setInternalEntity ("apos", "&#39;");
- setInternalEntity ("quot", "&#34;");
-
- try {
- // pushURL first to ensure locator is correct in startDocument
- // ... it might report an IO or encoding exception.
- // FIXME that could call endDocument without startDocument!
- pushURL (false, "[document]",
- // default baseURI: null
- new String [] { publicId, systemId, null},
- reader, stream, encoding, false);
-
- handler.startDocument ();
- parseDocument ();
- } finally {
- if (reader != null)
- try { reader.close ();
- } catch (IOException e) { /* ignore */ }
- if (stream != null)
- try { stream.close ();
- } catch (IOException e) { /* ignore */ }
- if (is != null)
- try { is.close ();
- } catch (IOException e) { /* ignore */ }
- if (reader != null)
- try {
- reader.close ();
- } catch (IOException e) { /* ignore */
- }
- scratch = null;
- }
- }
-
-
- ////////////////////////////////////////////////////////////////////////
- // Constants.
- ////////////////////////////////////////////////////////////////////////
-
- //
- // Constants for element content type.
- //
-
- /**
- * Constant: an element has not been declared.
- * @see #getElementContentType
- */
- public final static int CONTENT_UNDECLARED = 0;
-
- /**
- * Constant: the element has a content model of ANY.
- * @see #getElementContentType
- */
- public final static int CONTENT_ANY = 1;
-
- /**
- * Constant: the element has declared content of EMPTY.
- * @see #getElementContentType
- */
- public final static int CONTENT_EMPTY = 2;
-
- /**
- * Constant: the element has mixed content.
- * @see #getElementContentType
- */
- public final static int CONTENT_MIXED = 3;
-
- /**
- * Constant: the element has element content.
- * @see #getElementContentType
- */
- public final static int CONTENT_ELEMENTS = 4;
-
-
- //
- // Constants for the entity type.
- //
-
- /**
- * Constant: the entity has not been declared.
- * @see #getEntityType
- */
- public final static int ENTITY_UNDECLARED = 0;
-
- /**
- * Constant: the entity is internal.
- * @see #getEntityType
- */
- public final static int ENTITY_INTERNAL = 1;
-
- /**
- * Constant: the entity is external, non-parsable data.
- * @see #getEntityType
- */
- public final static int ENTITY_NDATA = 2;
-
- /**
- * Constant: the entity is external XML data.
- * @see #getEntityType
- */
- public final static int ENTITY_TEXT = 3;
-
-
- //
- // Attribute type constants are interned literal strings.
- //
-
- //
- // Constants for supported encodings. "external" is just a flag.
- //
- private final static int ENCODING_EXTERNAL = 0;
- private final static int ENCODING_UTF_8 = 1;
- private final static int ENCODING_ISO_8859_1 = 2;
- private final static int ENCODING_UCS_2_12 = 3;
- private final static int ENCODING_UCS_2_21 = 4;
- private final static int ENCODING_UCS_4_1234 = 5;
- private final static int ENCODING_UCS_4_4321 = 6;
- private final static int ENCODING_UCS_4_2143 = 7;
- private final static int ENCODING_UCS_4_3412 = 8;
- private final static int ENCODING_ASCII = 9;
-
-
- //
- // Constants for attribute default value.
- //
-
- /**
- * Constant: the attribute is not declared.
- * @see #getAttributeDefaultValueType
- */
- public final static int ATTRIBUTE_DEFAULT_UNDECLARED = 30;
-
- /**
- * Constant: the attribute has a literal default value specified.
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- */
- public final static int ATTRIBUTE_DEFAULT_SPECIFIED = 31;
-
- /**
- * Constant: the attribute was declared #IMPLIED.
- * @see #getAttributeDefaultValueType
- */
- public final static int ATTRIBUTE_DEFAULT_IMPLIED = 32;
-
- /**
- * Constant: the attribute was declared #REQUIRED.
- * @see #getAttributeDefaultValueType
- */
- public final static int ATTRIBUTE_DEFAULT_REQUIRED = 33;
-
- /**
- * Constant: the attribute was declared #FIXED.
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- */
- public final static int ATTRIBUTE_DEFAULT_FIXED = 34;
-
-
- //
- // Constants for input.
- //
- private final static int INPUT_NONE = 0;
- private final static int INPUT_INTERNAL = 1;
- private final static int INPUT_STREAM = 3;
- private final static int INPUT_READER = 5;
-
-
- //
- // Flags for reading literals.
- //
- // expand general entity refs (attribute values in dtd and content)
- private final static int LIT_ENTITY_REF = 2;
- // normalize this value (space chars) (attributes, public ids)
- private final static int LIT_NORMALIZE = 4;
- // literal is an attribute value
- private final static int LIT_ATTRIBUTE = 8;
- // don't expand parameter entities
- private final static int LIT_DISABLE_PE = 16;
- // don't expand [or parse] character refs
- private final static int LIT_DISABLE_CREF = 32;
- // don't parse general entity refs
- private final static int LIT_DISABLE_EREF = 64;
- // literal is a public ID value
- private final static int LIT_PUBID = 256;
-
-
- //
- // Flags affecting PE handling in DTDs (if expandPE is true).
- // PEs expand with space padding, except inside literals.
- //
- private final static int CONTEXT_NORMAL = 0;
- private final static int CONTEXT_LITERAL = 1;
-
-
- //////////////////////////////////////////////////////////////////////
- // Error reporting.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Report an error.
- * @param message The error message.
- * @param textFound The text that caused the error (or null).
- * @see SAXDriver#error
- * @see #line
- */
- private void error (String message, String textFound, String textExpected)
- throws SAXException
- {
- if (textFound != null) {
- message = message + " (found \"" + textFound + "\")";
- }
- if (textExpected != null) {
- message = message + " (expected \"" + textExpected + "\")";
- }
- handler.fatal (message);
-
- // "can't happen"
- throw new SAXException (message);
- }
-
-
- /**
- * Report a serious error.
- * @param message The error message.
- * @param textFound The text that caused the error (or null).
- */
- private void error (String message, char textFound, String textExpected)
- throws SAXException
- {
- error (message, new Character (textFound).toString (), textExpected);
- }
-
- /** Report typical case fatal errors. */
- private void error (String message)
- throws SAXException
- {
- handler.fatal (message);
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // Major syntactic productions.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Parse an XML document.
- * <pre>
- * [1] document ::= prolog element Misc*
- * </pre>
- * <p>This is the top-level parsing function for a single XML
- * document. As a minimum, a well-formed document must have
- * a document element, and a valid document must have a prolog
- * (one with doctype) as well.
- */
- private void parseDocument ()
- throws Exception
- {
- try { // added by MHK
- boolean sawDTD = parseProlog ();
- require ('<');
- parseElement (!sawDTD);
- } catch (EOFException ee) { // added by MHK
- error("premature end of file", "[EOF]", null);
- }
-
- try {
- parseMisc (); //skip all white, PIs, and comments
- char c = readCh (); //if this doesn't throw an exception...
- error ("unexpected characters after document end", c, null);
- } catch (EOFException e) {
- return;
- }
- }
-
- static final char startDelimComment [] = { '<', '!', '-', '-' };
- static final char endDelimComment [] = { '-', '-' };
-
- /**
- * Skip a comment.
- * <pre>
- * [15] Comment ::= '&lt;!--' ((Char - '-') | ('-' (Char - '-')))* "-->"
- * </pre>
- * <p> (The <code>&lt;!--</code> has already been read.)
- */
- private void parseComment ()
- throws Exception
- {
- char c;
- boolean saved = expandPE;
-
- expandPE = false;
- parseUntil (endDelimComment);
- require ('>');
- expandPE = saved;
- handler.comment (dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
-
- static final char startDelimPI [] = { '<', '?' };
- static final char endDelimPI [] = { '?', '>' };
-
- /**
- * Parse a processing instruction and do a call-back.
- * <pre>
- * [16] PI ::= '&lt;?' PITarget
- * (S (Char* - (Char* '?&gt;' Char*)))?
- * '?&gt;'
- * [17] PITarget ::= Name - ( ('X'|'x') ('M'|m') ('L'|l') )
- * </pre>
- * <p> (The <code>&lt;?</code> has already been read.)
- */
- private void parsePI ()
- throws SAXException, IOException
- {
- String name;
- boolean saved = expandPE;
-
- expandPE = false;
- name = readNmtoken (true);
- if ("xml".equalsIgnoreCase (name))
- error ("Illegal processing instruction target", name, null);
- if (!tryRead (endDelimPI)) {
- requireWhitespace ();
- parseUntil (endDelimPI);
- }
- expandPE = saved;
- handler.processingInstruction (name, dataBufferToString ());
- }
-
-
- static final char endDelimCDATA [] = { ']', ']', '>' };
-
- /**
- * Parse a CDATA section.
- * <pre>
- * [18] CDSect ::= CDStart CData CDEnd
- * [19] CDStart ::= '&lt;![CDATA['
- * [20] CData ::= (Char* - (Char* ']]&gt;' Char*))
- * [21] CDEnd ::= ']]&gt;'
- * </pre>
- * <p> (The '&lt;![CDATA[' has already been read.)
- */
- private void parseCDSect ()
- throws Exception
- {
- parseUntil (endDelimCDATA);
- dataBufferFlush ();
- }
-
-
- /**
- * Parse the prolog of an XML document.
- * <pre>
- * [22] prolog ::= XMLDecl? Misc* (Doctypedecl Misc*)?
- * </pre>
- * <p>We do not look for the XML declaration here, because it was
- * handled by pushURL ().
- * @see pushURL
- * @return true if a DTD was read.
- */
- private boolean parseProlog ()
- throws Exception
- {
- parseMisc ();
-
- if (tryRead ("<!DOCTYPE")) {
- parseDoctypedecl ();
- parseMisc ();
- return true;
- }
- return false;
- }
-
- private void checkLegalVersion (String version)
- throws SAXException
- {
- int len = version.length ();
- for (int i = 0; i < len; i++) {
- char c = version.charAt (i);
- if ('0' <= c && c <= '9')
- continue;
- if (c == '_' || c == '.' || c == ':' || c == '-')
- continue;
- if ('a' <= c && c <= 'z')
- continue;
- if ('A' <= c && c <= 'Z')
- continue;
- error ("illegal character in version", version, "1.0");
- }
- }
-
-
- /**
- * Parse the XML declaration.
- * <pre>
- * [23] XMLDecl ::= '&lt;?xml' VersionInfo EncodingDecl? SDDecl? S? '?&gt;'
- * [24] VersionInfo ::= S 'version' Eq
- * ("'" VersionNum "'" | '"' VersionNum '"' )
- * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')*
- * [32] SDDecl ::= S 'standalone' Eq
- * ( "'"" ('yes' | 'no') "'"" | '"' ("yes" | "no") '"' )
- * [80] EncodingDecl ::= S 'encoding' Eq
- * ( "'" EncName "'" | "'" EncName "'" )
- * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
- * </pre>
- * <p> (The <code>&lt;?xml</code> and whitespace have already been read.)
- * @return the encoding in the declaration, uppercased; or null
- * @see #parseTextDecl
- * @see #setupDecoding
- */
- private String parseXMLDecl (boolean ignoreEncoding)
- throws SAXException, IOException
- {
- String version;
- String encodingName = null;
- String standalone = null;
- int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
- // Read the version.
- require ("version");
- parseEq ();
- checkLegalVersion (version = readLiteral (flags));
- if (!version.equals ("1.0"))
- handler.warn ("expected XML version 1.0, not: " + version);
-
- // Try reading an encoding declaration.
- boolean white = tryWhitespace ();
-
- if (tryRead ("encoding")) {
- if (!white)
- error ("whitespace required before 'encoding='");
- parseEq ();
- encodingName = readLiteral (flags);
- if (!ignoreEncoding)
- setupDecoding (encodingName);
- }
-
- // Try reading a standalone declaration
- if (encodingName != null)
- white = tryWhitespace ();
- if (tryRead ("standalone")) {
- if (!white)
- error ("whitespace required before 'standalone='");
- parseEq ();
- standalone = readLiteral (flags);
- if ("yes".equals (standalone))
- docIsStandalone = true;
- else if (!"no".equals (standalone))
- error ("standalone flag must be 'yes' or 'no'");
- }
-
- skipWhitespace ();
- require ("?>");
-
- return encodingName;
- }
-
-
- /**
- * Parse a text declaration.
- * <pre>
- * [79] TextDecl ::= '&lt;?xml' VersionInfo? EncodingDecl S? '?&gt;'
- * [80] EncodingDecl ::= S 'encoding' Eq
- * ( '"' EncName '"' | "'" EncName "'" )
- * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')*
- * </pre>
- * <p> (The <code>&lt;?xml</code>' and whitespace have already been read.)
- * @return the encoding in the declaration, uppercased; or null
- * @see #parseXMLDecl
- * @see #setupDecoding
- */
- private String parseTextDecl (boolean ignoreEncoding)
- throws SAXException, IOException
- {
- String encodingName = null;
- int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
- // Read an optional version.
- if (tryRead ("version")) {
- String version;
- parseEq ();
- checkLegalVersion (version = readLiteral (flags));
- if (!version.equals ("1.0"))
- handler.warn ("expected XML version 1.0, not: " + version);
- requireWhitespace ();
- }
-
-
- // Read the encoding.
- require ("encoding");
- parseEq ();
- encodingName = readLiteral (flags);
- if (!ignoreEncoding)
- setupDecoding (encodingName);
-
- skipWhitespace ();
- require ("?>");
-
- return encodingName;
- }
-
-
- /**
- * Sets up internal state so that we can decode an entity using the
- * specified encoding. This is used when we start to read an entity
- * and we have been given knowledge of its encoding before we start to
- * read any data (e.g. from a SAX input source or from a MIME type).
- *
- * <p> It is also used after autodetection, at which point only very
- * limited adjustments to the encoding may be used (switching between
- * related builtin decoders).
- *
- * @param encodingName The name of the encoding specified by the user.
- * @exception IOException if the encoding isn't supported either
- * internally to this parser, or by the hosting JVM.
- * @see #parseXMLDecl
- * @see #parseTextDecl
- */
- private void setupDecoding (String encodingName)
- throws SAXException, IOException
- {
- encodingName = encodingName.toUpperCase ();
-
- // ENCODING_EXTERNAL indicates an encoding that wasn't
- // autodetected ... we can use builtin decoders, or
- // ones from the JVM (InputStreamReader).
-
- // Otherwise we can only tweak what was autodetected, and
- // only for single byte (ASCII derived) builtin encodings.
-
- // ASCII-derived encodings
- if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL) {
- if (encodingName.equals ("ISO-8859-1")
- || encodingName.equals ("8859_1")
- || encodingName.equals ("ISO8859_1")
- ) {
- encoding = ENCODING_ISO_8859_1;
- return;
- } else if (encodingName.equals ("US-ASCII")
- || encodingName.equals ("ASCII")) {
- encoding = ENCODING_ASCII;
- return;
- } else if (encodingName.equals ("UTF-8")
- || encodingName.equals ("UTF8")) {
- encoding = ENCODING_UTF_8;
- return;
- } else if (encoding != ENCODING_EXTERNAL) {
- // used to start with a new reader ...
- throw new UnsupportedEncodingException (encodingName);
- }
- // else fallthrough ...
- // it's ASCII-ish and something other than a builtin
- }
-
- // Unicode and such
- if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) {
- if (!(encodingName.equals ("ISO-10646-UCS-2")
- || encodingName.equals ("UTF-16")
- || encodingName.equals ("UTF-16BE")
- || encodingName.equals ("UTF-16LE")))
- error ("unsupported Unicode encoding",
- encodingName,
- "UTF-16");
- return;
- }
-
- // four byte encodings
- if (encoding == ENCODING_UCS_4_1234
- || encoding == ENCODING_UCS_4_4321
- || encoding == ENCODING_UCS_4_2143
- || encoding == ENCODING_UCS_4_3412) {
- // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists
- if (!encodingName.equals ("ISO-10646-UCS-4"))
- error ("unsupported 32-bit encoding",
- encodingName,
- "ISO-10646-UCS-4");
- return;
- }
-
- // assert encoding == ENCODING_EXTERNAL
- // if (encoding != ENCODING_EXTERNAL)
- // throw new RuntimeException ("encoding = " + encoding);
-
- if (encodingName.equals ("UTF-16BE")) {
- encoding = ENCODING_UCS_2_12;
- return;
- }
- if (encodingName.equals ("UTF-16LE")) {
- encoding = ENCODING_UCS_2_21;
- return;
- }
-
- // We couldn't use the builtin decoders at all. But we can try to
- // create a reader, since we haven't messed up buffering. Tweak
- // the encoding name if necessary.
-
- if (encodingName.equals ("UTF-16")
- || encodingName.equals ("ISO-10646-UCS-2"))
- encodingName = "Unicode";
- // Ignoring all the EBCDIC aliases here
-
- reader = new InputStreamReader (is, encodingName);
- sourceType = INPUT_READER;
- }
-
-
- /**
- * Parse miscellaneous markup outside the document element and DOCTYPE
- * declaration.
- * <pre>
- * [27] Misc ::= Comment | PI | S
- * </pre>
- */
- private void parseMisc ()
- throws Exception
- {
- while (true) {
- skipWhitespace ();
- if (tryRead (startDelimPI)) {
- parsePI ();
- } else if (tryRead (startDelimComment)) {
- parseComment ();
- } else {
- return;
- }
- }
- }
-
-
- /**
- * Parse a document type declaration.
- * <pre>
- * [28] doctypedecl ::= '&lt;!DOCTYPE' S Name (S ExternalID)? S?
- * ('[' (markupdecl | PEReference | S)* ']' S?)? '&gt;'
- * </pre>
- * <p> (The <code>&lt;!DOCTYPE</code> has already been read.)
- */
- private void parseDoctypedecl ()
- throws Exception
- {
- String rootName, ids[];
-
- // Read the document type name.
- requireWhitespace ();
- rootName = readNmtoken (true);
-
- // Read the External subset's IDs
- skipWhitespace ();
- ids = readExternalIds (false, true);
-
- // report (a) declaration of name, (b) lexical info (ids)
- handler.doctypeDecl (rootName, ids [0], ids [1]);
-
- // Internal subset is parsed first, if present
- skipWhitespace ();
- if (tryRead ('[')) {
-
- // loop until the subset ends
- while (true) {
- doReport = expandPE = true;
- skipWhitespace ();
- doReport = expandPE = false;
- if (tryRead (']')) {
- break; // end of subset
- } else {
- // WFC, PEs in internal subset (only between decls)
- peIsError = expandPE = true;
- parseMarkupdecl ();
- peIsError = expandPE = false;
- }
- }
- }
- skipWhitespace ();
- require ('>');
-
- // Read the external subset, if any
- InputSource subset;
-
- if (ids [1] == null)
- subset = handler.getExternalSubset (rootName,
- handler.getSystemId ());
- else
- subset = null;
- if (ids [1] != null || subset != null) {
- pushString (null, ">");
-
- // NOTE: [dtd] is so we say what SAX2 expects,
- // though it's misleading (subset, not entire dtd)
- if (ids [1] != null)
- pushURL (true, "[dtd]", ids, null, null, null, true);
- else {
- handler.warn ("modifying document by adding external subset");
- pushURL (true, "[dtd]",
- new String [] { subset.getPublicId (),
- subset.getSystemId (), null },
- subset.getCharacterStream (),
- subset.getByteStream (),
- subset.getEncoding (),
- false);
- }
-
- // Loop until we end up back at '>'
- while (true) {
- doReport = expandPE = true;
- skipWhitespace ();
- doReport = expandPE = false;
- if (tryRead ('>')) {
- break;
- } else {
- expandPE = true;
- parseMarkupdecl ();
- expandPE = false;
- }
- }
-
- // the ">" string isn't popped yet
- if (inputStack.size () != 1)
- error ("external subset has unmatched '>'");
- }
-
- // done dtd
- handler.endDoctype ();
- expandPE = false;
- doReport = true;
- }
-
-
- /**
- * Parse a markup declaration in the internal or external DTD subset.
- * <pre>
- * [29] markupdecl ::= elementdecl | Attlistdecl | EntityDecl
- * | NotationDecl | PI | Comment
- * [30] extSubsetDecl ::= (markupdecl | conditionalSect
- * | PEReference | S) *
- * </pre>
- * <p> Reading toplevel PE references is handled as a lexical issue
- * by the caller, as is whitespace.
- */
- private void parseMarkupdecl ()
- throws Exception
- {
- char saved [] = null;
- boolean savedPE = expandPE;
-
- // prevent "<%foo;" and ensures saved entity is right
- require ('<');
- unread ('<');
- expandPE = false;
-
- if (tryRead ("<!ELEMENT")) {
- saved = readBuffer;
- expandPE = savedPE;
- parseElementDecl ();
- } else if (tryRead ("<!ATTLIST")) {
- saved = readBuffer;
- expandPE = savedPE;
- parseAttlistDecl ();
- } else if (tryRead ("<!ENTITY")) {
- saved = readBuffer;
- expandPE = savedPE;
- parseEntityDecl ();
- } else if (tryRead ("<!NOTATION")) {
- saved = readBuffer;
- expandPE = savedPE;
- parseNotationDecl ();
- } else if (tryRead (startDelimPI)) {
- saved = readBuffer;
- expandPE = savedPE;
- parsePI ();
- } else if (tryRead (startDelimComment)) {
- saved = readBuffer;
- expandPE = savedPE;
- parseComment ();
- } else if (tryRead ("<![")) {
- saved = readBuffer;
- expandPE = savedPE;
- if (inputStack.size () > 0)
- parseConditionalSect (saved);
- else
- error ("conditional sections illegal in internal subset");
- } else {
- error ("expected markup declaration");
- }
-
- // VC: Proper Decl/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Declaration/PE nesting");
- }
-
-
- /**
- * Parse an element, with its tags.
- * <pre>
- * [39] element ::= EmptyElementTag | STag content ETag
- * [40] STag ::= '&lt;' Name (S Attribute)* S? '&gt;'
- * [44] EmptyElementTag ::= '&lt;' Name (S Attribute)* S? '/&gt;'
- * </pre>
- * <p> (The '&lt;' has already been read.)
- * <p>NOTE: this method actually chains onto parseContent (), if necessary,
- * and parseContent () will take care of calling parseETag ().
- */
- private void parseElement (boolean maybeGetSubset)
- throws Exception
- {
- String gi;
- char c;
- int oldElementContent = currentElementContent;
- String oldElement = currentElement;
- Object element [];
-
- // This is the (global) counter for the
- // array of specified attributes.
- tagAttributePos = 0;
-
- // Read the element type name.
- gi = readNmtoken (true);
-
- // If we saw no DTD, and this is the document root element,
- // let the application modify the input stream by providing one.
- if (maybeGetSubset) {
- InputSource subset = handler.getExternalSubset (gi,
- handler.getSystemId ());
- if (subset != null) {
- String publicId = subset.getPublicId ();
- String systemId = subset.getSystemId ();
-
- handler.warn ("modifying document by adding DTD");
- handler.doctypeDecl (gi, publicId, systemId);
- pushString (null, ">");
-
- // NOTE: [dtd] is so we say what SAX2 expects,
- // though it's misleading (subset, not entire dtd)
- pushURL (true, "[dtd]",
- new String [] { publicId, systemId, null },
- subset.getCharacterStream (),
- subset.getByteStream (),
- subset.getEncoding (),
- false);
-
- // Loop until we end up back at '>'
- while (true) {
- doReport = expandPE = true;
- skipWhitespace ();
- doReport = expandPE = false;
- if (tryRead ('>')) {
- break;
- } else {
- expandPE = true;
- parseMarkupdecl ();
- expandPE = false;
- }
- }
-
- // the ">" string isn't popped yet
- if (inputStack.size () != 1)
- error ("external subset has unmatched '>'");
-
- handler.endDoctype ();
- }
- }
-
- // Determine the current content type.
- currentElement = gi;
- element = (Object []) elementInfo.get (gi);
- currentElementContent = getContentType (element, CONTENT_ANY);
-
- // Read the attributes, if any.
- // After this loop, "c" is the closing delimiter.
- boolean white = tryWhitespace ();
- c = readCh ();
- while (c != '/' && c != '>') {
- unread (c);
- if (!white)
- error ("need whitespace between attributes");
- parseAttribute (gi);
- white = tryWhitespace ();
- c = readCh ();
- }
-
- // Supply any defaulted attributes.
- Enumeration atts = declaredAttributes (element);
- if (atts != null) {
- String aname;
-loop:
- while (atts.hasMoreElements ()) {
- aname = (String) atts.nextElement ();
- // See if it was specified.
- for (int i = 0; i < tagAttributePos; i++) {
- if (tagAttributes [i] == aname) {
- continue loop;
- }
- }
- // ... or has a default
- String value = getAttributeDefaultValue (gi, aname);
-
- if (value == null)
- continue;
- handler.attribute (aname, value, false);
- }
- }
-
- // Figure out if this is a start tag
- // or an empty element, and dispatch an
- // event accordingly.
- switch (c) {
- case '>':
- handler.startElement (gi);
- parseContent ();
- break;
- case '/':
- require ('>');
- handler.startElement (gi);
- handler.endElement (gi);
- break;
- }
-
- // Restore the previous state.
- currentElement = oldElement;
- currentElementContent = oldElementContent;
- }
-
-
- /**
- * Parse an attribute assignment.
- * <pre>
- * [41] Attribute ::= Name Eq AttValue
- * </pre>
- * @param name The name of the attribute's element.
- * @see SAXDriver#attribute
- */
- private void parseAttribute (String name)
- throws Exception
- {
- String aname;
- String type;
- String value;
- int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF;
-
- // Read the attribute name.
- aname = readNmtoken (true);
- type = getAttributeType (name, aname);
-
- // Parse '='
- parseEq ();
-
- // Read the value, normalizing whitespace
- // unless it is CDATA.
- if (type == "CDATA" || type == null) {
- value = readLiteral (flags);
- } else {
- value = readLiteral (flags | LIT_NORMALIZE);
- }
-
- // WFC: no duplicate attributes
- for (int i = 0; i < tagAttributePos; i++)
- if (aname.equals (tagAttributes [i]))
- error ("duplicate attribute", aname, null);
-
- // Inform the handler about the
- // attribute.
- handler.attribute (aname, value, true);
- dataBufferPos = 0;
-
- // Note that the attribute has been
- // specified.
- if (tagAttributePos == tagAttributes.length) {
- String newAttrib[] = new String [tagAttributes.length * 2];
- System.arraycopy (tagAttributes, 0, newAttrib, 0, tagAttributePos);
- tagAttributes = newAttrib;
- }
- tagAttributes [tagAttributePos++] = aname;
- }
-
-
- /**
- * Parse an equals sign surrounded by optional whitespace.
- * <pre>
- * [25] Eq ::= S? '=' S?
- * </pre>
- */
- private void parseEq ()
- throws SAXException, IOException
- {
- skipWhitespace ();
- require ('=');
- skipWhitespace ();
- }
-
-
- /**
- * Parse an end tag.
- * <pre>
- * [42] ETag ::= '</' Name S? '>'
- * </pre>
- * <p>NOTE: parseContent () chains to here, we already read the
- * "&lt;/".
- */
- private void parseETag ()
- throws Exception
- {
- require (currentElement);
- skipWhitespace ();
- require ('>');
- handler.endElement (currentElement);
- // not re-reporting any SAXException re bogus end tags,
- // even though that diagnostic might be clearer ...
- }
-
-
- /**
- * Parse the content of an element.
- * <pre>
- * [43] content ::= (element | CharData | Reference
- * | CDSect | PI | Comment)*
- * [67] Reference ::= EntityRef | CharRef
- * </pre>
- * <p> NOTE: consumes ETtag.
- */
- private void parseContent ()
- throws Exception
- {
- char c;
-
- while (true) {
- // consume characters (or ignorable whitspace) until delimiter
- parseCharData ();
-
- // Handle delimiters
- c = readCh ();
- switch (c) {
-
- case '&': // Found "&"
- c = readCh ();
- if (c == '#') {
- parseCharRef ();
- } else {
- unread (c);
- parseEntityRef (true);
- }
- break;
-
- case '<': // Found "<"
- dataBufferFlush ();
- c = readCh ();
- switch (c) {
- case '!': // Found "<!"
- c = readCh ();
- switch (c) {
- case '-': // Found "<!-"
- require ('-');
- parseComment ();
- break;
- case '[': // Found "<!["
- require ("CDATA[");
- handler.startCDATA ();
- inCDATA = true;
- parseCDSect ();
- inCDATA = false;
- handler.endCDATA ();
- break;
- default:
- error ("expected comment or CDATA section", c, null);
- break;
- }
- break;
-
- case '?': // Found "<?"
- parsePI ();
- break;
-
- case '/': // Found "</"
- parseETag ();
- return;
-
- default: // Found "<" followed by something else
- unread (c);
- parseElement (false);
- break;
- }
- }
- }
- }
-
-
- /**
- * Parse an element type declaration.
- * <pre>
- * [45] elementdecl ::= '&lt;!ELEMENT' S Name S contentspec S? '&gt;'
- * </pre>
- * <p> NOTE: the '&lt;!ELEMENT' has already been read.
- */
- private void parseElementDecl ()
- throws Exception
- {
- String name;
-
- requireWhitespace ();
- // Read the element type name.
- name = readNmtoken (true);
-
- requireWhitespace ();
- // Read the content model.
- parseContentspec (name);
-
- skipWhitespace ();
- require ('>');
- }
-
-
- /**
- * Content specification.
- * <pre>
- * [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | elements
- * </pre>
- */
- private void parseContentspec (String name)
- throws Exception
- {
-// FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ...
- if (tryRead ("EMPTY")) {
- setElement (name, CONTENT_EMPTY, null, null);
- if (!skippedPE)
- handler.getDeclHandler ().elementDecl (name, "EMPTY");
- return;
- } else if (tryRead ("ANY")) {
- setElement (name, CONTENT_ANY, null, null);
- if (!skippedPE)
- handler.getDeclHandler ().elementDecl (name, "ANY");
- return;
- } else {
- String model;
- char saved [];
-
- require ('(');
- saved = readBuffer;
- dataBufferAppend ('(');
- skipWhitespace ();
- if (tryRead ("#PCDATA")) {
- dataBufferAppend ("#PCDATA");
- parseMixed (saved);
- model = dataBufferToString ();
- setElement (name, CONTENT_MIXED, model, null);
- } else {
- parseElements (saved);
- model = dataBufferToString ();
- setElement (name, CONTENT_ELEMENTS, model, null);
- }
- if (!skippedPE)
- handler.getDeclHandler ().elementDecl (name, model);
- }
- }
-
- /**
- * Parse an element-content model.
- * <pre>
- * [47] elements ::= (choice | seq) ('?' | '*' | '+')?
- * [49] choice ::= '(' S? cp (S? '|' S? cp)+ S? ')'
- * [50] seq ::= '(' S? cp (S? ',' S? cp)* S? ')'
- * </pre>
- *
- * <p> NOTE: the opening '(' and S have already been read.
- *
- * @param saved Buffer for entity that should have the terminal ')'
- */
- private void parseElements (char saved [])
- throws Exception
- {
- char c;
- char sep;
-
- // Parse the first content particle
- skipWhitespace ();
- parseCp ();
-
- // Check for end or for a separator.
- skipWhitespace ();
- c = readCh ();
- switch (c) {
- case ')':
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Group/PE nesting");
-
- dataBufferAppend (')');
- c = readCh ();
- switch (c) {
- case '*':
- case '+':
- case '?':
- dataBufferAppend (c);
- break;
- default:
- unread (c);
- }
- return;
- case ',': // Register the separator.
- case '|':
- sep = c;
- dataBufferAppend (c);
- break;
- default:
- error ("bad separator in content model", c, null);
- return;
- }
-
- // Parse the rest of the content model.
- while (true) {
- skipWhitespace ();
- parseCp ();
- skipWhitespace ();
- c = readCh ();
- if (c == ')') {
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Group/PE nesting");
-
- dataBufferAppend (')');
- break;
- } else if (c != sep) {
- error ("bad separator in content model", c, null);
- return;
- } else {
- dataBufferAppend (c);
- }
- }
-
- // Check for the occurrence indicator.
- c = readCh ();
- switch (c) {
- case '?':
- case '*':
- case '+':
- dataBufferAppend (c);
- return;
- default:
- unread (c);
- return;
- }
- }
-
-
- /**
- * Parse a content particle.
- * <pre>
- * [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')?
- * </pre>
- */
- private void parseCp ()
- throws Exception
- {
- if (tryRead ('(')) {
- dataBufferAppend ('(');
- parseElements (readBuffer);
- } else {
- dataBufferAppend (readNmtoken (true));
- char c = readCh ();
- switch (c) {
- case '?':
- case '*':
- case '+':
- dataBufferAppend (c);
- break;
- default:
- unread (c);
- break;
- }
- }
- }
-
-
- /**
- * Parse mixed content.
- * <pre>
- * [51] Mixed ::= '(' S? ( '#PCDATA' (S? '|' S? Name)*) S? ')*'
- * | '(' S? ('#PCDATA') S? ')'
- * </pre>
- *
- * @param saved Buffer for entity that should have the terminal ')'
- */
- private void parseMixed (char saved [])
- throws Exception
- {
- // Check for PCDATA alone.
- skipWhitespace ();
- if (tryRead (')')) {
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Group/PE nesting");
-
- dataBufferAppend (")*");
- tryRead ('*');
- return;
- }
-
- // Parse mixed content.
- skipWhitespace ();
- while (!tryRead (")")) {
- require ('|');
- dataBufferAppend ('|');
- skipWhitespace ();
- dataBufferAppend (readNmtoken (true));
- skipWhitespace ();
- }
-
- // VC: Proper Group/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Group/PE nesting");
-
- require ('*');
- dataBufferAppend (")*");
- }
-
-
- /**
- * Parse an attribute list declaration.
- * <pre>
- * [52] AttlistDecl ::= '&lt;!ATTLIST' S Name AttDef* S? '&gt;'
- * </pre>
- * <p>NOTE: the '&lt;!ATTLIST' has already been read.
- */
- private void parseAttlistDecl ()
- throws Exception
- {
- String elementName;
-
- requireWhitespace ();
- elementName = readNmtoken (true);
- boolean white = tryWhitespace ();
- while (!tryRead ('>')) {
- if (!white)
- error ("whitespace required before attribute definition");
- parseAttDef (elementName);
- white = tryWhitespace ();
- }
- }
-
-
- /**
- * Parse a single attribute definition.
- * <pre>
- * [53] AttDef ::= S Name S AttType S DefaultDecl
- * </pre>
- */
- private void parseAttDef (String elementName)
- throws Exception
- {
- String name;
- String type;
- String enum_val = null;
-
- // Read the attribute name.
- name = readNmtoken (true);
-
- // Read the attribute type.
- requireWhitespace ();
- type = readAttType ();
-
- // Get the string of enumerated values if necessary.
- if ("ENUMERATION" == type || "NOTATION" == type)
- enum_val = dataBufferToString ();
-
- // Read the default value.
- requireWhitespace ();
- parseDefault (elementName, name, type, enum_val);
- }
-
-
- /**
- * Parse the attribute type.
- * <pre>
- * [54] AttType ::= StringType | TokenizedType | EnumeratedType
- * [55] StringType ::= 'CDATA'
- * [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY'
- * | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS'
- * [57] EnumeratedType ::= NotationType | Enumeration
- * </pre>
- */
- private String readAttType ()
- throws Exception
- {
- if (tryRead ('(')) {
- parseEnumeration (false);
- return "ENUMERATION";
- } else {
- String typeString = readNmtoken (true);
- if ("NOTATION" == typeString) {
- parseNotationType ();
- return typeString;
- } else if ("CDATA" == typeString
- || "ID" == typeString
- || "IDREF" == typeString
- || "IDREFS" == typeString
- || "ENTITY" == typeString
- || "ENTITIES" == typeString
- || "NMTOKEN" == typeString
- || "NMTOKENS" == typeString)
- return typeString;
- error ("illegal attribute type", typeString, null);
- return null;
- }
- }
-
-
- /**
- * Parse an enumeration.
- * <pre>
- * [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')'
- * </pre>
- * <p>NOTE: the '(' has already been read.
- */
- private void parseEnumeration (boolean isNames)
- throws Exception
- {
- dataBufferAppend ('(');
-
- // Read the first token.
- skipWhitespace ();
- dataBufferAppend (readNmtoken (isNames));
- // Read the remaining tokens.
- skipWhitespace ();
- while (!tryRead (')')) {
- require ('|');
- dataBufferAppend ('|');
- skipWhitespace ();
- dataBufferAppend (readNmtoken (isNames));
- skipWhitespace ();
- }
- dataBufferAppend (')');
- }
-
-
- /**
- * Parse a notation type for an attribute.
- * <pre>
- * [58] NotationType ::= 'NOTATION' S '(' S? NameNtoks
- * (S? '|' S? name)* S? ')'
- * </pre>
- * <p>NOTE: the 'NOTATION' has already been read
- */
- private void parseNotationType ()
- throws Exception
- {
- requireWhitespace ();
- require ('(');
-
- parseEnumeration (true);
- }
-
-
- /**
- * Parse the default value for an attribute.
- * <pre>
- * [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED'
- * | (('#FIXED' S)? AttValue)
- * </pre>
- */
- private void parseDefault (
- String elementName,
- String name,
- String type,
- String enum_val
- ) throws Exception
- {
- int valueType = ATTRIBUTE_DEFAULT_SPECIFIED;
- String value = null;
- int flags = LIT_ATTRIBUTE;
- boolean saved = expandPE;
- String defaultType = null;
-
- // LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace
- // chars to spaces (doesn't matter when that's done if it doesn't
- // interfere with char refs expanding to whitespace).
-
- if (!skippedPE) {
- flags |= LIT_ENTITY_REF;
- if ("CDATA" != type)
- flags |= LIT_NORMALIZE;
- }
-
- expandPE = false;
- if (tryRead ('#')) {
- if (tryRead ("FIXED")) {
- defaultType = "#FIXED";
- valueType = ATTRIBUTE_DEFAULT_FIXED;
- requireWhitespace ();
- value = readLiteral (flags);
- } else if (tryRead ("REQUIRED")) {
- defaultType = "#REQUIRED";
- valueType = ATTRIBUTE_DEFAULT_REQUIRED;
- } else if (tryRead ("IMPLIED")) {
- defaultType = "#IMPLIED";
- valueType = ATTRIBUTE_DEFAULT_IMPLIED;
- } else {
- error ("illegal keyword for attribute default value");
- }
- } else
- value = readLiteral (flags);
- expandPE = saved;
- setAttribute (elementName, name, type, enum_val, value, valueType);
- if ("ENUMERATION" == type)
- type = enum_val;
- else if ("NOTATION" == type)
- type = "NOTATION " + enum_val;
- if (!skippedPE) handler.getDeclHandler ()
- .attributeDecl (elementName, name, type, defaultType, value);
- }
-
-
- /**
- * Parse a conditional section.
- * <pre>
- * [61] conditionalSect ::= includeSect || ignoreSect
- * [62] includeSect ::= '&lt;![' S? 'INCLUDE' S? '['
- * extSubsetDecl ']]&gt;'
- * [63] ignoreSect ::= '&lt;![' S? 'IGNORE' S? '['
- * ignoreSectContents* ']]&gt;'
- * [64] ignoreSectContents ::= Ignore
- * ('&lt;![' ignoreSectContents* ']]&gt;' Ignore )*
- * [65] Ignore ::= Char* - (Char* ( '&lt;![' | ']]&gt;') Char* )
- * </pre>
- * <p> NOTE: the '&gt;![' has already been read.
- */
- private void parseConditionalSect (char saved [])
- throws Exception
- {
- skipWhitespace ();
- if (tryRead ("INCLUDE")) {
- skipWhitespace ();
- require ('[');
- // VC: Proper Conditional Section/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Conditional Section/PE nesting");
- skipWhitespace ();
- while (!tryRead ("]]>")) {
- parseMarkupdecl ();
- skipWhitespace ();
- }
- } else if (tryRead ("IGNORE")) {
- skipWhitespace ();
- require ('[');
- // VC: Proper Conditional Section/PE Nesting
- if (readBuffer != saved)
- handler.verror ("Illegal Conditional Section/PE nesting");
- int nesting = 1;
- char c;
- expandPE = false;
- for (int nest = 1; nest > 0;) {
- c = readCh ();
- switch (c) {
- case '<':
- if (tryRead ("![")) {
- nest++;
- }
- case ']':
- if (tryRead ("]>")) {
- nest--;
- }
- }
- }
- expandPE = true;
- } else {
- error ("conditional section must begin with INCLUDE or IGNORE");
- }
- }
-
- private void parseCharRef ()
- throws SAXException, IOException
- {
- parseCharRef (true /* do flushDataBuffer by default */);
- }
-
- /**
- * Read and interpret a character reference.
- * <pre>
- * [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';'
- * </pre>
- * <p>NOTE: the '&#' has already been read.
- */
- private void parseCharRef (boolean doFlush)
- throws SAXException, IOException
- {
- int value = 0;
- char c;
-
- if (tryRead ('x')) {
-loop1:
- while (true) {
- c = readCh ();
- int n;
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- n = c - '0';
- break;
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- n = (c - 'a') + 10;
- break;
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- n = (c - 'A') + 10;
- break;
- case ';':
- break loop1;
- default:
- error ("illegal character in character reference", c, null);
- break loop1;
- }
- value *= 16;
- value += n;
- }
- } else {
-loop2:
- while (true) {
- c = readCh ();
- switch (c) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- value *= 10;
- value += c - '0';
- break;
- case ';':
- break loop2;
- default:
- error ("illegal character in character reference", c, null);
- break loop2;
- }
- }
- }
-
- // check for character refs being legal XML
- if ((value < 0x0020
- && ! (value == '\n' || value == '\t' || value == '\r'))
- || (value >= 0xD800 && value <= 0xDFFF)
- || value == 0xFFFE || value == 0xFFFF
- || value > 0x0010ffff)
- error ("illegal XML character reference U+"
- + Integer.toHexString (value));
-
- // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz
- // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz:
- if (value <= 0x0000ffff) {
- // no surrogates needed
- dataBufferAppend ((char) value);
- } else if (value <= 0x0010ffff) {
- value -= 0x10000;
- // > 16 bits, surrogate needed
- dataBufferAppend ((char) (0xd800 | (value >> 10)));
- dataBufferAppend ((char) (0xdc00 | (value & 0x0003ff)));
- } else {
- // too big for surrogate
- error ("character reference " + value + " is too large for UTF-16",
- new Integer (value).toString (), null);
- }
- if (doFlush) dataBufferFlush ();
- }
-
-
- /**
- * Parse and expand an entity reference.
- * <pre>
- * [68] EntityRef ::= '&' Name ';'
- * </pre>
- * <p>NOTE: the '&amp;' has already been read.
- * @param externalAllowed External entities are allowed here.
- */
- private void parseEntityRef (boolean externalAllowed)
- throws SAXException, IOException
- {
- String name;
-
- name = readNmtoken (true);
- require (';');
- switch (getEntityType (name)) {
- case ENTITY_UNDECLARED:
- // NOTE: XML REC describes amazingly convoluted handling for
- // this case. Nothing as meaningful as being a WFness error
- // unless the processor might _legitimately_ not have seen a
- // declaration ... which is what this implements.
- String message;
-
- message = "reference to undeclared general entity " + name;
- if (skippedPE && !docIsStandalone) {
- handler.verror (message);
- // we don't know this entity, and it might be external...
- if (externalAllowed)
- handler.skippedEntity (name);
- } else
- error (message);
- break;
- case ENTITY_INTERNAL:
- pushString (name, getEntityValue (name));
- break;
- case ENTITY_TEXT:
- if (externalAllowed) {
- pushURL (false, name, getEntityIds (name),
- null, null, null, true);
- } else {
- error ("reference to external entity in attribute value.",
- name, null);
- }
- break;
- case ENTITY_NDATA:
- if (externalAllowed) {
- error ("unparsed entity reference in content", name, null);
- } else {
- error ("reference to external entity in attribute value.",
- name, null);
- }
- break;
- default:
- throw new RuntimeException ();
- }
- }
-
-
- /**
- * Parse and expand a parameter entity reference.
- * <pre>
- * [69] PEReference ::= '%' Name ';'
- * </pre>
- * <p>NOTE: the '%' has already been read.
- */
- private void parsePEReference ()
- throws SAXException, IOException
- {
- String name;
-
- name = "%" + readNmtoken (true);
- require (';');
- switch (getEntityType (name)) {
- case ENTITY_UNDECLARED:
- // VC: Entity Declared
- handler.verror ("reference to undeclared parameter entity " + name);
-
- // we should disable handling of all subsequent declarations
- // unless this is a standalone document (info discarded)
- break;
- case ENTITY_INTERNAL:
- if (inLiteral)
- pushString (name, getEntityValue (name));
- else
- pushString (name, ' ' + getEntityValue (name) + ' ');
- break;
- case ENTITY_TEXT:
- if (!inLiteral)
- pushString (null, " ");
- pushURL (true, name, getEntityIds (name), null, null, null, true);
- if (!inLiteral)
- pushString (null, " ");
- break;
- }
- }
-
- /**
- * Parse an entity declaration.
- * <pre>
- * [70] EntityDecl ::= GEDecl | PEDecl
- * [71] GEDecl ::= '&lt;!ENTITY' S Name S EntityDef S? '&gt;'
- * [72] PEDecl ::= '&lt;!ENTITY' S '%' S Name S PEDef S? '&gt;'
- * [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)
- * [74] PEDef ::= EntityValue | ExternalID
- * [75] ExternalID ::= 'SYSTEM' S SystemLiteral
- * | 'PUBLIC' S PubidLiteral S SystemLiteral
- * [76] NDataDecl ::= S 'NDATA' S Name
- * </pre>
- * <p>NOTE: the '&lt;!ENTITY' has already been read.
- */
- private void parseEntityDecl ()
- throws Exception
- {
- boolean peFlag = false;
- int flags = LIT_DISABLE_CREF;
-
- // Check for a parameter entity.
- expandPE = false;
- requireWhitespace ();
- if (tryRead ('%')) {
- peFlag = true;
- requireWhitespace ();
- }
- expandPE = true;
-
- // Read the entity name, and prepend
- // '%' if necessary.
- String name = readNmtoken (true);
- if (peFlag) {
- name = "%" + name;
- }
-
- // Read the entity value.
- requireWhitespace ();
- char c = readCh ();
- unread (c);
- if (c == '"' || c == '\'') {
- // Internal entity ... replacement text has expanded refs
- // to characters and PEs, but not to general entities
- String value = readLiteral (flags);
- setInternalEntity (name, value);
- } else {
- // Read the external IDs
- String ids [] = readExternalIds (false, false);
-
- // Check for NDATA declaration.
- boolean white = tryWhitespace ();
- if (!peFlag && tryRead ("NDATA")) {
- if (!white)
- error ("whitespace required before NDATA");
- requireWhitespace ();
- String notationName = readNmtoken (true);
- if (!skippedPE) {
- setExternalEntity (name, ENTITY_NDATA, ids, notationName);
- handler.unparsedEntityDecl (name, ids, notationName);
- }
- } else if (!skippedPE) {
- setExternalEntity (name, ENTITY_TEXT, ids, null);
- handler.getDeclHandler ()
- .externalEntityDecl (name, ids [0],
- handler.resolveURIs ()
- // FIXME: ASSUMES not skipped
- // "false" forces error on bad URI
- ? handler.absolutize (ids [2], ids [1], false)
- : ids [1]);
- }
- }
-
- // Finish the declaration.
- skipWhitespace ();
- require ('>');
- }
-
-
- /**
- * Parse a notation declaration.
- * <pre>
- * [82] NotationDecl ::= '&lt;!NOTATION' S Name S
- * (ExternalID | PublicID) S? '&gt;'
- * [83] PublicID ::= 'PUBLIC' S PubidLiteral
- * </pre>
- * <P>NOTE: the '&lt;!NOTATION' has already been read.
- */
- private void parseNotationDecl ()
- throws Exception
- {
- String nname, ids[];
-
-
- requireWhitespace ();
- nname = readNmtoken (true);
-
- requireWhitespace ();
-
- // Read the external identifiers.
- ids = readExternalIds (true, false);
-
- // Register the notation.
- setNotation (nname, ids);
-
- skipWhitespace ();
- require ('>');
- }
-
-
- /**
- * Parse character data.
- * <pre>
- * [14] CharData ::= [^&lt;&amp;]* - ([^&lt;&amp;]* ']]&gt;' [^&lt;&amp;]*)
- * </pre>
- */
- private void parseCharData ()
- throws Exception
- {
- char c;
- int state = 0;
- boolean pureWhite = false;
-
- // assert (dataBufferPos == 0);
-
- // are we expecting pure whitespace? it might be dirty...
- if (currentElementContent == CONTENT_ELEMENTS);
- pureWhite = true;
-
- // always report right out of readBuffer
- // to minimize (pointless) buffer copies
- while (true) {
- int lineAugment = 0;
- int columnAugment = 0;
- int i;
-
-loop:
- for (i = readBufferPos; i < readBufferLength; i++) {
- switch (c = readBuffer [i]) {
- case '\n':
- lineAugment++;
- columnAugment = 0;
- // pureWhite unmodified
- break;
- case '\r': // should not happen!!
- case '\t':
- case ' ':
- // pureWhite unmodified
- columnAugment++;
- break;
- case '&':
- case '<':
- columnAugment++;
- // pureWhite unmodified
- // CLEAN end of text sequence
- state = 1;
- break loop;
- case ']':
- // that's not a whitespace char, and
- // can not terminate pure whitespace either
- pureWhite = false;
- if ((i + 2) < readBufferLength) {
- if (readBuffer [i + 1] == ']'
- && readBuffer [i + 2] == '>') {
- // ERROR end of text sequence
- state = 2;
- break loop;
- }
- } else {
- // FIXME missing two end-of-buffer cases
- }
- columnAugment++;
- break;
- default:
- if (c < 0x0020 || c > 0xFFFD)
- error ("illegal XML character U+"
- + Integer.toHexString (c));
- // that's not a whitespace char
- pureWhite = false;
- columnAugment++;
- }
- }
-
- // report text thus far
- if (lineAugment > 0) {
- line += lineAugment;
- column = columnAugment;
- } else {
- column += columnAugment;
- }
-
- // report characters/whitspace
- int length = i - readBufferPos;
-
- if (length != 0) {
- if (pureWhite)
- handler.ignorableWhitespace (readBuffer,
- readBufferPos, length);
- else
- handler.charData (readBuffer, readBufferPos, length);
- readBufferPos = i;
- }
-
- if (state != 0)
- break;
-
- // fill next buffer from this entity, or
- // pop stack and continue with previous entity
- unread (readCh ());
- }
-
- // finish, maybe with error
- if (state != 1) // finish, no error
- error ("character data may not contain ']]>'");
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // High-level reading and scanning methods.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Require whitespace characters.
- */
- private void requireWhitespace ()
- throws SAXException, IOException
- {
- char c = readCh ();
- if (isWhitespace (c)) {
- skipWhitespace ();
- } else {
- error ("whitespace required", c, null);
- }
- }
-
-
- /**
- * Skip whitespace characters.
- * <pre>
- * [3] S ::= (#x20 | #x9 | #xd | #xa)+
- * </pre>
- */
- private void skipWhitespace ()
- throws SAXException, IOException
- {
- // Start with a little cheat. Most of
- // the time, the white space will fall
- // within the current read buffer; if
- // not, then fall through.
- if (USE_CHEATS) {
- int lineAugment = 0;
- int columnAugment = 0;
-
-loop:
- for (int i = readBufferPos; i < readBufferLength; i++) {
- switch (readBuffer [i]) {
- case ' ':
- case '\t':
- case '\r':
- columnAugment++;
- break;
- case '\n':
- lineAugment++;
- columnAugment = 0;
- break;
- case '%':
- if (expandPE)
- break loop;
- // else fall through...
- default:
- readBufferPos = i;
- if (lineAugment > 0) {
- line += lineAugment;
- column = columnAugment;
- } else {
- column += columnAugment;
- }
- return;
- }
- }
- }
-
- // OK, do it the slow way.
- char c = readCh ();
- while (isWhitespace (c)) {
- c = readCh ();
- }
- unread (c);
- }
-
-
- /**
- * Read a name or (when parsing an enumeration) name token.
- * <pre>
- * [5] Name ::= (Letter | '_' | ':') (NameChar)*
- * [7] Nmtoken ::= (NameChar)+
- * </pre>
- */
- private String readNmtoken (boolean isName)
- throws SAXException, IOException
- {
- char c;
-
- if (USE_CHEATS) {
-loop:
- for (int i = readBufferPos; i < readBufferLength; i++) {
- c = readBuffer [i];
- switch (c) {
- case '%':
- if (expandPE)
- break loop;
- // else fall through...
-
- // What may legitimately come AFTER a name/nmtoken?
- case '<': case '>': case '&':
- case ',': case '|': case '*': case '+': case '?':
- case ')':
- case '=':
- case '\'': case '"':
- case '[':
- case ' ': case '\t': case '\r': case '\n':
- case ';':
- case '/':
- int start = readBufferPos;
- if (i == start)
- error ("name expected", readBuffer [i], null);
- readBufferPos = i;
- return intern (readBuffer, start, i - start);
-
- default:
-// FIXME ... per IBM's OASIS test submission, these:
-// ? U+06dd
-// REJECT
-// BaseChar U+0132 U+0133 U+013F U+0140 U+0149 U+017F U+01C4 U+01CC
-// U+01F1 U+01F3 U+0E46 U+1011 U+1104 U+1108 U+110A U+110D
-// U+113B U+113F U+1141 U+114D U+114F U+1151 U+1156 U+1162
-// U+1164 U+1166 U+116B U+116F U+1174 U+119F U+11AC U+11B6
-// U+11B9 U+11BB U+11C3 U+11F1 U+212F U+0587
-// Combining U+309B
-
- // punt on exact tests from Appendix A; approximate
- // them using the Unicode ID start/part rules
- if (i == readBufferPos && isName) {
- if (!Character.isUnicodeIdentifierStart (c)
- && c != ':' && c != '_')
- error ("Not a name start character, U+"
- + Integer.toHexString (c));
- } else if (!Character.isUnicodeIdentifierPart (c)
- && c != '-' && c != ':' && c != '_' && c != '.'
- && !isExtender (c))
- error ("Not a name character, U+"
- + Integer.toHexString (c));
- }
- }
- }
-
- nameBufferPos = 0;
-
- // Read the first character.
-loop:
- while (true) {
- c = readCh ();
- switch (c) {
- case '%':
- case '<': case '>': case '&':
- case ',': case '|': case '*': case '+': case '?':
- case ')':
- case '=':
- case '\'': case '"':
- case '[':
- case ' ': case '\t': case '\n': case '\r':
- case ';':
- case '/':
- unread (c);
- if (nameBufferPos == 0) {
- error ("name expected");
- }
- // punt on exact tests from Appendix A, but approximate them
- if (isName
- && !Character.isUnicodeIdentifierStart (
- nameBuffer [0])
- && ":_".indexOf (nameBuffer [0]) == -1)
- error ("Not a name start character, U+"
- + Integer.toHexString (nameBuffer [0]));
- String s = intern (nameBuffer, 0, nameBufferPos);
- nameBufferPos = 0;
- return s;
- default:
- // punt on exact tests from Appendix A, but approximate them
-
- if ((nameBufferPos != 0 || !isName)
- && !Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- error ("Not a name character, U+"
- + Integer.toHexString (c));
- if (nameBufferPos >= nameBuffer.length)
- nameBuffer =
- (char[]) extendArray (nameBuffer,
- nameBuffer.length, nameBufferPos);
- nameBuffer [nameBufferPos++] = c;
- }
- }
- }
-
- private static boolean isExtender (char c)
- {
- // [88] Extender ::= ...
- return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
- || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309d && c <= 0x309e)
- || (c >= 0x30fc && c <= 0x30fe);
- }
-
-
- /**
- * Read a literal. With matching single or double quotes as
- * delimiters (and not embedded!) this is used to parse:
- * <pre>
- * [9] EntityValue ::= ... ([^%&amp;] | PEReference | Reference)* ...
- * [10] AttValue ::= ... ([^<&] | Reference)* ...
- * [11] SystemLiteral ::= ... (URLchar - "'")* ...
- * [12] PubidLiteral ::= ... (PubidChar - "'")* ...
- * </pre>
- * as well as the quoted strings in XML and text declarations
- * (for version, encoding, and standalone) which have their
- * own constraints.
- */
- private String readLiteral (int flags)
- throws SAXException, IOException
- {
- char delim, c;
- int startLine = line;
- boolean saved = expandPE;
- boolean savedReport = doReport;
-
- // Find the first delimiter.
- delim = readCh ();
- if (delim != '"' && delim != '\'') {
- error ("expected '\"' or \"'\"", delim, null);
- return null;
- }
- inLiteral = true;
- if ((flags & LIT_DISABLE_PE) != 0)
- expandPE = false;
- doReport = false;
-
- // Each level of input source has its own buffer; remember
- // ours, so we won't read the ending delimiter from any
- // other input source, regardless of entity processing.
- char ourBuf [] = readBuffer;
-
- // Read the literal.
- try {
- c = readCh ();
-loop:
- while (! (c == delim && readBuffer == ourBuf)) {
- switch (c) {
- // attributes and public ids are normalized
- // in almost the same ways
- case '\n':
- case '\r':
- if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0)
- c = ' ';
- break;
- case '\t':
- if ((flags & LIT_ATTRIBUTE) != 0)
- c = ' ';
- break;
- case '&':
- c = readCh ();
- // Char refs are expanded immediately, except for
- // all the cases where it's deferred.
- if (c == '#') {
- if ((flags & LIT_DISABLE_CREF) != 0) {
- dataBufferAppend ('&');
- break;
- }
- parseCharRef (false /* Do not do flushDataBuffer */);
-
- // exotic WFness risk: this is an entity literal,
- // dataBuffer [dataBufferPos - 1] == '&', and
- // following chars are a _partial_ entity/char ref
-
- // It looks like an entity ref ...
- } else {
- unread (c);
- // Expand it?
- if ((flags & LIT_ENTITY_REF) > 0) {
- parseEntityRef (false);
-
- // Is it just data?
- } else if ((flags & LIT_DISABLE_EREF) != 0) {
- dataBufferAppend ('&');
-
- // OK, it will be an entity ref -- expanded later.
- } else {
- String name = readNmtoken (true);
- require (';');
- dataBufferAppend ('&');
- dataBufferAppend (name);
- dataBufferAppend (';');
- }
- }
- c = readCh ();
- continue loop;
-
- case '<':
- // and why? Perhaps so "&foo;" expands the same
- // inside and outside an attribute?
- if ((flags & LIT_ATTRIBUTE) != 0)
- error ("attribute values may not contain '<'");
- break;
-
- // We don't worry about case '%' and PE refs, readCh does.
-
- default:
- break;
- }
- dataBufferAppend (c);
- c = readCh ();
- }
- } catch (EOFException e) {
- error ("end of input while looking for delimiter (started on line "
- + startLine + ')', null, new Character (delim).toString ());
- }
- inLiteral = false;
- expandPE = saved;
- doReport = savedReport;
-
- // Normalise whitespace if necessary.
- if ((flags & LIT_NORMALIZE) > 0) {
- dataBufferNormalize ();
- }
-
- // Return the value.
- return dataBufferToString ();
- }
-
-
- /**
- * Try reading external identifiers.
- * A system identifier is not required for notations.
- * @param inNotation Are we parsing a notation decl?
- * @param isSubset Parsing external subset decl (may be omitted)?
- * @return A three-member String array containing the identifiers,
- * or nulls. Order: public, system, baseURI.
- */
- private String[] readExternalIds (boolean inNotation, boolean isSubset)
- throws Exception
- {
- char c;
- String ids[] = new String [3];
- int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF;
-
- if (tryRead ("PUBLIC")) {
- requireWhitespace ();
- ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags);
- if (inNotation) {
- skipWhitespace ();
- c = readCh ();
- unread (c);
- if (c == '"' || c == '\'') {
- ids [1] = readLiteral (flags);
- }
- } else {
- requireWhitespace ();
- ids [1] = readLiteral (flags);
- }
-
- for (int i = 0; i < ids [0].length (); i++) {
- c = ids [0].charAt (i);
- if (c >= 'a' && c <= 'z')
- continue;
- if (c >= 'A' && c <= 'Z')
- continue;
- if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1)
- continue;
- error ("illegal PUBLIC id character U+"
- + Integer.toHexString (c));
- }
- } else if (tryRead ("SYSTEM")) {
- requireWhitespace ();
- ids [1] = readLiteral (flags);
- } else if (!isSubset)
- error ("missing SYSTEM or PUBLIC keyword");
-
- if (ids [1] != null) {
- if (ids [1].indexOf ('#') != -1)
- handler.verror ("SYSTEM id has a URI fragment: " + ids [1]);
- ids [2] = handler.getSystemId ();
- if (ids [2] == null)
- handler.warn ("No base URI; hope URI is absolute: "
- + ids [1]);
- }
-
- return ids;
- }
-
-
- /**
- * Test if a character is whitespace.
- * <pre>
- * [3] S ::= (#x20 | #x9 | #xd | #xa)+
- * </pre>
- * @param c The character to test.
- * @return true if the character is whitespace.
- */
- private final boolean isWhitespace (char c)
- {
- if (c > 0x20)
- return false;
- if (c == 0x20 || c == 0x0a || c == 0x09 || c == 0x0d)
- return true;
- return false; // illegal ...
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // Utility routines.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Add a character to the data buffer.
- */
- private void dataBufferAppend (char c)
- {
- // Expand buffer if necessary.
- if (dataBufferPos >= dataBuffer.length)
- dataBuffer =
- (char[]) extendArray (dataBuffer,
- dataBuffer.length, dataBufferPos);
- dataBuffer [dataBufferPos++] = c;
- }
-
-
- /**
- * Add a string to the data buffer.
- */
- private void dataBufferAppend (String s)
- {
- dataBufferAppend (s.toCharArray (), 0, s.length ());
- }
-
-
- /**
- * Append (part of) a character array to the data buffer.
- */
- private void dataBufferAppend (char ch[], int start, int length)
- {
- dataBuffer = (char[])
- extendArray (dataBuffer, dataBuffer.length,
- dataBufferPos + length);
-
- System.arraycopy (ch, start, dataBuffer, dataBufferPos, length);
- dataBufferPos += length;
- }
-
-
- /**
- * Normalise space characters in the data buffer.
- */
- private void dataBufferNormalize ()
- {
- int i = 0;
- int j = 0;
- int end = dataBufferPos;
-
- // Skip spaces at the start.
- while (j < end && dataBuffer [j] == ' ') {
- j++;
- }
-
- // Skip whitespace at the end.
- while (end > j && dataBuffer [end - 1] == ' ') {
- end --;
- }
-
- // Start copying to the left.
- while (j < end) {
-
- char c = dataBuffer [j++];
-
- // Normalise all other spaces to
- // a single space.
- if (c == ' ') {
- while (j < end && dataBuffer [j++] == ' ')
- continue;
- dataBuffer [i++] = ' ';
- dataBuffer [i++] = dataBuffer [j - 1];
- } else {
- dataBuffer [i++] = c;
- }
- }
-
- // The new length is <= the old one.
- dataBufferPos = i;
- }
-
-
- /**
- * Convert the data buffer to a string.
- */
- private String dataBufferToString ()
- {
- String s = new String (dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- return s;
- }
-
-
- /**
- * Flush the contents of the data buffer to the handler, as
- * appropriate, and reset the buffer for new input.
- */
- private void dataBufferFlush ()
- throws SAXException
- {
- if (currentElementContent == CONTENT_ELEMENTS
- && dataBufferPos > 0
- && !inCDATA
- ) {
- // We can't just trust the buffer to be whitespace, there
- // are (error) cases when it isn't
- for (int i = 0; i < dataBufferPos; i++) {
- if (!isWhitespace (dataBuffer [i])) {
- handler.charData (dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
- }
- if (dataBufferPos > 0) {
- handler.ignorableWhitespace (dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
- } else if (dataBufferPos > 0) {
- handler.charData (dataBuffer, 0, dataBufferPos);
- dataBufferPos = 0;
- }
- }
-
-
- /**
- * Require a string to appear, or throw an exception.
- * <p><em>Precondition:</em> Entity expansion is not required.
- * <p><em>Precondition:</em> data buffer has no characters that
- * will get sent to the application.
- */
- private void require (String delim)
- throws SAXException, IOException
- {
- int length = delim.length ();
- char ch [];
-
- if (length < dataBuffer.length) {
- ch = dataBuffer;
- delim.getChars (0, length, ch, 0);
- } else
- ch = delim.toCharArray ();
-
- if (USE_CHEATS
- && length <= (readBufferLength - readBufferPos)) {
- int offset = readBufferPos;
-
- for (int i = 0; i < length; i++, offset++)
- if (ch [i] != readBuffer [offset])
- error ("required string", null, delim);
- readBufferPos = offset;
-
- } else {
- for (int i = 0; i < length; i++)
- require (ch [i]);
- }
- }
-
-
- /**
- * Require a character to appear, or throw an exception.
- */
- private void require (char delim)
- throws SAXException, IOException
- {
- char c = readCh ();
-
- if (c != delim) {
- error ("required character", c, new Character (delim).toString ());
- }
- }
-
-
- /**
- * Create an interned string from a character array.
- * &AElig;lfred uses this method to create an interned version
- * of all names and name tokens, so that it can test equality
- * with <code>==</code> instead of <code>String.equals ()</code>.
- *
- * <p>This is much more efficient than constructing a non-interned
- * string first, and then interning it.
- *
- * @param ch an array of characters for building the string.
- * @param start the starting position in the array.
- * @param length the number of characters to place in the string.
- * @return an interned string.
- * @see #intern (String)
- * @see java.lang.String#intern
- */
- public String intern (char ch[], int start, int length)
- {
- int index = 0;
- int hash = 0;
- Object bucket [];
-
- // Generate a hash code. This is a widely used string hash,
- // often attributed to Brian Kernighan.
- for (int i = start; i < start + length; i++)
- hash = 31 * hash + ch [i];
- hash = (hash & 0x7fffffff) % SYMBOL_TABLE_LENGTH;
-
- // Get the bucket -- consists of {array,String} pairs
- if ((bucket = symbolTable [hash]) == null) {
- // first string in this bucket
- bucket = new Object [8];
-
- // Search for a matching tuple, and
- // return the string if we find one.
- } else {
- while (index < bucket.length) {
- char chFound [] = (char []) bucket [index];
-
- // Stop when we hit an empty entry.
- if (chFound == null)
- break;
-
- // If they're the same length, check for a match.
- if (chFound.length == length) {
- for (int i = 0; i < chFound.length; i++) {
- // continue search on failure
- if (ch [start + i] != chFound [i]) {
- break;
- } else if (i == length - 1) {
- // That's it, we have a match!
- return (String) bucket [index + 1];
- }
- }
- }
- index += 2;
- }
- // Not found -- we'll have to add it.
-
- // Do we have to grow the bucket?
- bucket = (Object []) extendArray (bucket, bucket.length, index);
- }
- symbolTable [hash] = bucket;
-
- // OK, add it to the end of the bucket -- "local" interning.
- // Intern "globally" to let applications share interning benefits.
- // That is, "!=" and "==" work on our strings, not just equals().
- String s = new String (ch, start, length).intern ();
- bucket [index] = s.toCharArray ();
- bucket [index + 1] = s;
- return s;
- }
-
- /**
- * Ensure the capacity of an array, allocating a new one if
- * necessary. Usually extends only for name hash collisions.
- */
- private Object extendArray (Object array, int currentSize, int requiredSize)
- {
- if (requiredSize < currentSize) {
- return array;
- } else {
- Object newArray = null;
- int newSize = currentSize * 2;
-
- if (newSize <= requiredSize)
- newSize = requiredSize + 1;
-
- if (array instanceof char[])
- newArray = new char [newSize];
- else if (array instanceof Object[])
- newArray = new Object [newSize];
- else
- throw new RuntimeException ();
-
- System.arraycopy (array, 0, newArray, 0, currentSize);
- return newArray;
- }
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // XML query routines.
- //////////////////////////////////////////////////////////////////////
-
-
- boolean isStandalone () { return docIsStandalone; }
-
-
- //
- // Elements
- //
-
- private int getContentType (Object element [], int defaultType)
- {
- int retval;
-
- if (element == null)
- return defaultType;
- retval = ((Integer) element [0]).intValue ();
- if (retval == CONTENT_UNDECLARED)
- retval = defaultType;
- return retval;
- }
-
-
- /**
- * Look up the content type of an element.
- * @param name The element type name.
- * @return An integer constant representing the content type.
- * @see #CONTENT_UNDECLARED
- * @see #CONTENT_ANY
- * @see #CONTENT_EMPTY
- * @see #CONTENT_MIXED
- * @see #CONTENT_ELEMENTS
- */
- public int getElementContentType (String name)
- {
- Object element [] = (Object []) elementInfo.get (name);
- return getContentType (element, CONTENT_UNDECLARED);
- }
-
-
- /**
- * Register an element.
- * Array format:
- * [0] element type name
- * [1] content model (mixed, elements only)
- * [2] attribute hash table
- */
- private void setElement (
- String name,
- int contentType,
- String contentModel,
- Hashtable attributes
- ) throws SAXException
- {
- if (skippedPE)
- return;
-
- Object element [] = (Object []) elementInfo.get (name);
-
- // first <!ELEMENT ...> or <!ATTLIST ...> for this type?
- if (element == null) {
- element = new Object [3];
- element [0] = new Integer (contentType);
- element [1] = contentModel;
- element [2] = attributes;
- elementInfo.put (name, element);
- return;
- }
-
- // <!ELEMENT ...> declaration?
- if (contentType != CONTENT_UNDECLARED) {
- // ... following an associated <!ATTLIST ...>
- if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) {
- element [0] = new Integer (contentType);
- element [1] = contentModel;
- } else
- // VC: Unique Element Type Declaration
- handler.verror ("multiple declarations for element type: "
- + name);
- }
-
- // first <!ATTLIST ...>, before <!ELEMENT ...> ?
- else if (attributes != null)
- element [2] = attributes;
- }
-
-
- /**
- * Look up the attribute hash table for an element.
- * The hash table is the second item in the element array.
- */
- private Hashtable getElementAttributes (String name)
- {
- Object element[] = (Object[]) elementInfo.get (name);
- if (element == null)
- return null;
- else
- return (Hashtable) element [2];
- }
-
-
-
- //
- // Attributes
- //
-
- /**
- * Get the declared attributes for an element type.
- * @param elname The name of the element type.
- * @return An Enumeration of all the attributes declared for
- * a specific element type. The results will be valid only
- * after the DTD (if any) has been parsed.
- * @see #getAttributeType
- * @see #getAttributeEnumeration
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- * @see #getAttributeExpandedValue
- */
- private Enumeration declaredAttributes (Object element [])
- {
- Hashtable attlist;
-
- if (element == null)
- return null;
- if ((attlist = (Hashtable) element [2]) == null)
- return null;
- return attlist.keys ();
- }
-
- /**
- * Get the declared attributes for an element type.
- * @param elname The name of the element type.
- * @return An Enumeration of all the attributes declared for
- * a specific element type. The results will be valid only
- * after the DTD (if any) has been parsed.
- * @see #getAttributeType
- * @see #getAttributeEnumeration
- * @see #getAttributeDefaultValueType
- * @see #getAttributeDefaultValue
- * @see #getAttributeExpandedValue
- */
- public Enumeration declaredAttributes (String elname)
- {
- return declaredAttributes ((Object []) elementInfo.get (elname));
- }
-
-
- /**
- * Retrieve the declared type of an attribute.
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return An interend string denoting the type, or null
- * indicating an undeclared attribute.
- */
- public String getAttributeType (String name, String aname)
- {
- Object attribute[] = getAttribute (name, aname);
- if (attribute == null) {
- return null;
- } else {
- return (String) attribute [0];
- }
- }
-
-
- /**
- * Retrieve the allowed values for an enumerated attribute type.
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return A string containing the token list.
- */
- public String getAttributeEnumeration (String name, String aname)
- {
- Object attribute[] = getAttribute (name, aname);
- if (attribute == null) {
- return null;
- } else {
- // assert: attribute [0] is "ENUMERATION" or "NOTATION"
- return (String) attribute [3];
- }
- }
-
-
- /**
- * Retrieve the default value of a declared attribute.
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return The default value, or null if the attribute was
- * #IMPLIED or simply undeclared and unspecified.
- * @see #getAttributeExpandedValue
- */
- public String getAttributeDefaultValue (String name, String aname)
- {
- Object attribute[] = getAttribute (name, aname);
- if (attribute == null) {
- return null;
- } else {
- return (String) attribute [1];
- }
- }
-
- /*
-
-// FIXME: Leaving this in, until W3C finally resolves the confusion
-// between parts of the XML 2nd REC about when entity declararations
-// are guaranteed to be known. Current code matches what section 5.1
-// (conformance) describes, but some readings of the self-contradicting
-// text in 4.1 (the "Entity Declared" WFC and VC) seem to expect that
-// attribute expansion/normalization must be deferred in some cases
-// (just TRY to identify them!).
-
- * Retrieve the expanded value of a declared attribute.
- * <p>General entities (and char refs) will be expanded (once).
- * @param name The name of the associated element.
- * @param aname The name of the attribute.
- * @return The expanded default value, or null if the attribute was
- * #IMPLIED or simply undeclared
- * @see #getAttributeDefaultValue
- public String getAttributeExpandedValue (String name, String aname)
- throws Exception
- {
- Object attribute[] = getAttribute (name, aname);
-
- if (attribute == null) {
- return null;
- } else if (attribute [4] == null && attribute [1] != null) {
- // we MUST use the same buf for both quotes else the literal
- // can't be properly terminated
- char buf [] = new char [1];
- int flags = LIT_ENTITY_REF | LIT_ATTRIBUTE;
- String type = getAttributeType (name, aname);
-
- if (type != "CDATA" && type != null)
- flags |= LIT_NORMALIZE;
- buf [0] = '"';
- pushCharArray (null, buf, 0, 1);
- pushString (null, (String) attribute [1]);
- pushCharArray (null, buf, 0, 1);
- attribute [4] = readLiteral (flags);
- }
- return (String) attribute [4];
- }
- */
-
- /**
- * Retrieve the default value mode of a declared attribute.
- * @see #ATTRIBUTE_DEFAULT_SPECIFIED
- * @see #ATTRIBUTE_DEFAULT_IMPLIED
- * @see #ATTRIBUTE_DEFAULT_REQUIRED
- * @see #ATTRIBUTE_DEFAULT_FIXED
- */
- public int getAttributeDefaultValueType (String name, String aname)
- {
- Object attribute[] = getAttribute (name, aname);
- if (attribute == null) {
- return ATTRIBUTE_DEFAULT_UNDECLARED;
- } else {
- return ((Integer) attribute [2]).intValue ();
- }
- }
-
-
- /**
- * Register an attribute declaration for later retrieval.
- * Format:
- * - String type
- * - String default value
- * - int value type
- * - enumeration
- * - processed default value
- */
- private void setAttribute (String elName, String name, String type,
- String enumeration,
- String value, int valueType)
- throws Exception
- {
- Hashtable attlist;
-
- if (skippedPE)
- return;
-
- // Create a new hashtable if necessary.
- attlist = getElementAttributes (elName);
- if (attlist == null)
- attlist = new Hashtable ();
-
- // ignore multiple attribute declarations!
- if (attlist.get (name) != null) {
- // warn ...
- return;
- } else {
- Object attribute [] = new Object [5];
- attribute [0] = type;
- attribute [1] = value;
- attribute [2] = new Integer (valueType);
- attribute [3] = enumeration;
- attribute [4] = null;
- attlist.put (name, attribute);
-
- // save; but don't overwrite any existing <!ELEMENT ...>
- setElement (elName, CONTENT_UNDECLARED, null, attlist);
- }
- }
-
-
- /**
- * Retrieve the array representing an attribute declaration.
- */
- private Object[] getAttribute (String elName, String name)
- {
- Hashtable attlist;
-
- attlist = getElementAttributes (elName);
- if (attlist == null)
- return null;
- return (Object[]) attlist.get (name);
- }
-
-
- //
- // Entities
- //
-
- /**
- * Find the type of an entity.
- * @returns An integer constant representing the entity type.
- * @see #ENTITY_UNDECLARED
- * @see #ENTITY_INTERNAL
- * @see #ENTITY_NDATA
- * @see #ENTITY_TEXT
- */
- public int getEntityType (String ename)
- {
- Object entity[] = (Object[]) entityInfo.get (ename);
- if (entity == null) {
- return ENTITY_UNDECLARED;
- } else {
- return ((Integer) entity [0]).intValue ();
- }
- }
-
-
- /**
- * Return an external entity's identifier array.
- * @param ename The name of the external entity.
- * @return Three element array containing (in order) the entity's
- * public identifier, system identifier, and base URI. Null if
- * the entity was not declared as an external entity.
- * @see #getEntityType
- */
- public String [] getEntityIds (String ename)
- {
- Object entity[] = (Object[]) entityInfo.get (ename);
- if (entity == null) {
- return null;
- } else {
- return (String []) entity [1];
- }
- }
-
-
- /**
- * Return an internal entity's replacement text.
- * @param ename The name of the internal entity.
- * @return The entity's replacement text, or null if
- * the entity was not declared as an internal entity.
- * @see #getEntityType
- */
- public String getEntityValue (String ename)
- {
- Object entity[] = (Object[]) entityInfo.get (ename);
- if (entity == null) {
- return null;
- } else {
- return (String) entity [3];
- }
- }
-
-
- /**
- * Register an entity declaration for later retrieval.
- */
- private void setInternalEntity (String eName, String value)
- throws SAXException
- {
- if (skippedPE)
- return;
-
- if (entityInfo.get (eName) == null) {
- Object entity[] = new Object [5];
- entity [0] = new Integer (ENTITY_INTERNAL);
-// FIXME: shrink!! [2] useless
- entity [3] = value;
- entityInfo.put (eName, entity);
- }
- if ("lt" == eName || "gt" == eName || "quot" == eName
- || "apos" == eName || "amp" == eName)
- return;
- handler.getDeclHandler ()
- .internalEntityDecl (eName, value);
- }
-
-
- /**
- * Register an external entity declaration for later retrieval.
- */
- private void setExternalEntity (String eName, int eClass,
- String ids [], String nName)
- {
- if (entityInfo.get (eName) == null) {
- Object entity[] = new Object [5];
- entity [0] = new Integer (eClass);
- entity [1] = ids;
-// FIXME: shrink!! [2] no longer used, [4] irrelevant given [0]
- entity [4] = nName;
- entityInfo.put (eName, entity);
- }
- }
-
-
- //
- // Notations.
- //
-
- /**
- * Report a notation declaration, checking for duplicates.
- */
- private void setNotation (String nname, String ids [])
- throws SAXException
- {
- if (skippedPE)
- return;
-
- handler.notationDecl (nname, ids);
- if (notationInfo.get (nname) == null)
- notationInfo.put (nname, nname);
- else
- // VC: Unique Notation Name
- handler.verror ("Duplicate notation name decl: " + nname);
- }
-
-
- //
- // Location.
- //
-
-
- /**
- * Return the current line number.
- */
- public int getLineNumber ()
- {
- return line;
- }
-
-
- /**
- * Return the current column number.
- */
- public int getColumnNumber ()
- {
- return column;
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // High-level I/O.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Read a single character from the readBuffer.
- * <p>The readDataChunk () method maintains the buffer.
- * <p>If we hit the end of an entity, try to pop the stack and
- * keep going.
- * <p> (This approach doesn't really enforce XML's rules about
- * entity boundaries, but this is not currently a validating
- * parser).
- * <p>This routine also attempts to keep track of the current
- * position in external entities, but it's not entirely accurate.
- * @return The next available input character.
- * @see #unread (char)
- * @see #readDataChunk
- * @see #readBuffer
- * @see #line
- * @return The next character from the current input source.
- */
- private char readCh ()
- throws SAXException, IOException
- {
- // As long as there's nothing in the
- // read buffer, try reading more data
- // (for an external entity) or popping
- // the entity stack (for either).
- while (readBufferPos >= readBufferLength) {
- switch (sourceType) {
- case INPUT_READER:
- case INPUT_STREAM:
- readDataChunk ();
- while (readBufferLength < 1) {
- popInput ();
- if (readBufferLength < 1) {
- readDataChunk ();
- }
- }
- break;
-
- default:
-
- popInput ();
- break;
- }
- }
-
- char c = readBuffer [readBufferPos++];
-
- if (c == '\n') {
- line++;
- column = 0;
- } else {
- if (c == '<') {
- /* the most common return to parseContent () ... NOP */
- } else if ((c < 0x0020 && (c != '\t') && (c != '\r')) || c > 0xFFFD)
- error ("illegal XML character U+"
- + Integer.toHexString (c));
-
- // If we're in the DTD and in a context where PEs get expanded,
- // do so ... 1/14/2000 errata identify those contexts. There
- // are also spots in the internal subset where PE refs are fatal
- // errors, hence yet another flag.
- else if (c == '%' && expandPE) {
- if (peIsError)
- error ("PE reference within decl in internal subset.");
- parsePEReference ();
- return readCh ();
- }
- column++;
- }
-
- return c;
- }
-
-
- /**
- * Push a single character back onto the current input stream.
- * <p>This method usually pushes the character back onto
- * the readBuffer.
- * <p>I don't think that this would ever be called with
- * readBufferPos = 0, because the methods always reads a character
- * before unreading it, but just in case, I've added a boundary
- * condition.
- * @param c The character to push back.
- * @see #readCh
- * @see #unread (char[])
- * @see #readBuffer
- */
- private void unread (char c)
- throws SAXException
- {
- // Normal condition.
- if (c == '\n') {
- line--;
- column = -1;
- }
- if (readBufferPos > 0) {
- readBuffer [--readBufferPos] = c;
- } else {
- pushString (null, new Character (c).toString ());
- }
- }
-
-
- /**
- * Push a char array back onto the current input stream.
- * <p>NOTE: you must <em>never</em> push back characters that you
- * haven't actually read: use pushString () instead.
- * @see #readCh
- * @see #unread (char)
- * @see #readBuffer
- * @see #pushString
- */
- private void unread (char ch[], int length)
- throws SAXException
- {
- for (int i = 0; i < length; i++) {
- if (ch [i] == '\n') {
- line--;
- column = -1;
- }
- }
- if (length < readBufferPos) {
- readBufferPos -= length;
- } else {
- pushCharArray (null, ch, 0, length);
- }
- }
-
-
- /**
- * Push, or skip, a new external input source.
- * The source will be some kind of parsed entity, such as a PE
- * (including the external DTD subset) or content for the body.
- *
- * @param url The java.net.URL object for the entity.
- * @see SAXDriver#resolveEntity
- * @see #pushString
- * @see #sourceType
- * @see #pushInput
- * @see #detectEncoding
- * @see #sourceType
- * @see #readBuffer
- */
- private void pushURL (
- boolean isPE,
- String ename,
- String ids [], // public, system, baseURI
- Reader reader,
- InputStream stream,
- String encoding,
- boolean doResolve
- ) throws SAXException, IOException
- {
- boolean ignoreEncoding;
- String systemId;
- InputSource source;
-
- if (!isPE)
- dataBufferFlush ();
-
- scratch.setPublicId (ids [0]);
- scratch.setSystemId (ids [1]);
-
- // See if we should skip or substitute the entity.
- // If we're not skipping, resolving reports startEntity()
- // and updates the (handler's) stack of URIs.
- if (doResolve) {
- // assert (stream == null && reader == null && encoding == null)
- source = handler.resolveEntity (isPE, ename, scratch, ids [2]);
- if (source == null) {
- handler.warn ("skipping entity: " + ename);
- handler.skippedEntity (ename);
- if (isPE)
- skippedPE = true;
- return;
- }
-
- // we might be using alternate IDs/encoding
- systemId = source.getSystemId ();
- // The following warning and setting systemId was deleted bcause
- // the application has the option of not setting systemId
- // provided that it has set the characte/byte stream.
- /*
- if (systemId == null) {
- handler.warn ("missing system ID, using " + ids [1]);
- systemId = ids [1];
- }
- */
- } else {
- // "[document]", or "[dtd]" via getExternalSubset()
- scratch.setCharacterStream (reader);
- scratch.setByteStream (stream);
- scratch.setEncoding (encoding);
- source = scratch;
- systemId = ids [1];
- handler.startExternalEntity (ename, systemId,
- "[document]" == ename);
- }
-
- // we may have been given I/O streams directly
- if (source.getCharacterStream () != null) {
- if (source.getByteStream () != null)
- error ("InputSource has two streams!");
- reader = source.getCharacterStream ();
- } else if (source.getByteStream () != null) {
- encoding = source.getEncoding ();
- if (encoding == null)
- stream = source.getByteStream ();
- else try {
- reader = new InputStreamReader (
- source.getByteStream (),
- encoding);
- } catch (IOException e) {
- stream = source.getByteStream ();
- }
- } else if (systemId == null)
- error ("InputSource has no URI!");
- scratch.setCharacterStream (null);
- scratch.setByteStream (null);
- scratch.setEncoding (null);
-
- // Push the existing status.
- pushInput (ename);
-
- // Create a new read buffer.
- // (Note the four-character margin)
- readBuffer = new char [READ_BUFFER_MAX + 4];
- readBufferPos = 0;
- readBufferLength = 0;
- readBufferOverflow = -1;
- is = null;
- line = 1;
- column = 0;
- currentByteCount = 0;
-
- // If there's an explicit character stream, just
- // ignore encoding declarations.
- if (reader != null) {
- sourceType = INPUT_READER;
- this.reader = reader;
- tryEncodingDecl (true);
- return;
- }
-
- // Else we handle the conversion, and need to ensure
- // it's done right.
- sourceType = INPUT_STREAM;
- if (stream != null) {
- is = stream;
- } else {
- // We have to open our own stream to the URL.
- URL url = new URL (systemId);
-
- externalEntity = url.openConnection ();
- externalEntity.connect ();
- is = externalEntity.getInputStream ();
- }
-
- // If we get to here, there must be
- // an InputStream available.
- if (!is.markSupported ()) {
- is = new BufferedInputStream (is);
- }
-
- // Get any external encoding label.
- if (encoding == null && externalEntity != null) {
- // External labels can be untrustworthy; filesystems in
- // particular often have the wrong default for content
- // that wasn't locally originated. Those we autodetect.
- if (!"file".equals (externalEntity.getURL ().getProtocol ())) {
- int temp;
-
- // application/xml;charset=something;otherAttr=...
- // ... with many variants on 'something'
- encoding = externalEntity.getContentType ();
-
- // MHK code (fix for Saxon 5.5.1/007):
- // protect against encoding==null
- if (encoding==null) {
- temp = -1;
- } else {
- temp = encoding.indexOf ("charset");
- }
-
- // RFC 2376 sez MIME text defaults to ASCII, but since the
- // JDK will create a MIME type out of thin air, we always
- // autodetect when there's no explicit charset attribute.
- if (temp < 0)
- encoding = null; // autodetect
- else {
- // only this one attribute
- if ((temp = encoding.indexOf (';')) > 0)
- encoding = encoding.substring (0, temp);
-
- if ((temp = encoding.indexOf ('=', temp + 7)) > 0) {
- encoding = encoding.substring (temp + 1);
-
- // attributes can have comment fields (RFC 822)
- if ((temp = encoding.indexOf ('(')) > 0)
- encoding = encoding.substring (0, temp);
- // ... and values may be quoted
- if ((temp = encoding.indexOf ('"')) > 0)
- encoding = encoding.substring (temp + 1,
- encoding.indexOf ('"', temp + 2));
- encoding.trim ();
- } else {
- handler.warn ("ignoring illegal MIME attribute: "
- + encoding);
- encoding = null;
- }
- }
- }
- }
-
- // if we got an external encoding label, use it ...
- if (encoding != null) {
- this.encoding = ENCODING_EXTERNAL;
- setupDecoding (encoding);
- ignoreEncoding = true;
-
- // ... else autodetect from first bytes.
- } else {
- detectEncoding ();
- ignoreEncoding = false;
- }
-
- // Read any XML or text declaration.
- // If we autodetected, it may tell us the "real" encoding.
- try {
- tryEncodingDecl (ignoreEncoding);
- } catch (UnsupportedEncodingException x) {
- encoding = x.getMessage ();
-
- // if we don't handle the declared encoding,
- // try letting a JVM InputStreamReader do it
- try {
- if (sourceType != INPUT_STREAM)
- throw x;
-
- is.reset ();
- readBufferPos = 0;
- readBufferLength = 0;
- readBufferOverflow = -1;
- line = 1;
- currentByteCount = column = 0;
-
- sourceType = INPUT_READER;
- this.reader = new InputStreamReader (is, encoding);
- is = null;
-
- tryEncodingDecl (true);
-
- } catch (IOException e) {
- error ("unsupported text encoding",
- encoding,
- null);
- }
- }
- }
-
-
- /**
- * Check for an encoding declaration. This is the second part of the
- * XML encoding autodetection algorithm, relying on detectEncoding to
- * get to the point that this part can read any encoding declaration
- * in the document (using only US-ASCII characters).
- *
- * <p> Because this part starts to fill parser buffers with this data,
- * it's tricky to setup a reader so that Java's built-in decoders can be
- * used for the character encodings that aren't built in to this parser
- * (such as EUC-JP, KOI8-R, Big5, etc).
- *
- * @return any encoding in the declaration, uppercased; or null
- * @see detectEncoding
- */
- private String tryEncodingDecl (boolean ignoreEncoding)
- throws SAXException, IOException
- {
- // Read the XML/text declaration.
- if (tryRead ("<?xml")) {
- if (tryWhitespace ()) {
- if (inputStack.size () > 0) {
- return parseTextDecl (ignoreEncoding);
- } else {
- return parseXMLDecl (ignoreEncoding);
- }
- } else {
- // <?xml-stylesheet ...?> or similar
- unread ('l');
- unread ('m');
- unread ('x');
- unread ('?');
- unread ('<');
- }
- }
- return null;
- }
-
-
- /**
- * Attempt to detect the encoding of an entity.
- * <p>The trick here (as suggested in the XML standard) is that
- * any entity not in UTF-8, or in UCS-2 with a byte-order mark,
- * <b>must</b> begin with an XML declaration or an encoding
- * declaration; we simply have to look for "&lt;?xml" in various
- * encodings.
- * <p>This method has no way to distinguish among 8-bit encodings.
- * Instead, it sets up for UTF-8, then (possibly) revises its assumption
- * later in setupDecoding (). Any ASCII-derived 8-bit encoding
- * should work, but most will be rejected later by setupDecoding ().
- * @see #tryEncoding (byte[], byte, byte, byte, byte)
- * @see #tryEncoding (byte[], byte, byte)
- * @see #setupDecoding
- */
- private void detectEncoding ()
- throws SAXException, IOException
- {
- byte signature[] = new byte [4];
-
- // Read the first four bytes for
- // autodetection.
- is.mark (4);
- is.read (signature);
- is.reset ();
-
- //
- // FIRST: four byte encodings (who uses these?)
- //
- if (tryEncoding (signature, (byte) 0x00, (byte) 0x00,
- (byte) 0x00, (byte) 0x3c)) {
- // UCS-4 must begin with "<?xml"
- // 0x00 0x00 0x00 0x3c: UCS-4, big-endian (1234)
- // "UTF-32BE"
- encoding = ENCODING_UCS_4_1234;
-
- } else if (tryEncoding (signature, (byte) 0x3c, (byte) 0x00,
- (byte) 0x00, (byte) 0x00)) {
- // 0x3c 0x00 0x00 0x00: UCS-4, little-endian (4321)
- // "UTF-32LE"
- encoding = ENCODING_UCS_4_4321;
-
- } else if (tryEncoding (signature, (byte) 0x00, (byte) 0x00,
- (byte) 0x3c, (byte) 0x00)) {
- // 0x00 0x00 0x3c 0x00: UCS-4, unusual (2143)
- encoding = ENCODING_UCS_4_2143;
-
- } else if (tryEncoding (signature, (byte) 0x00, (byte) 0x3c,
- (byte) 0x00, (byte) 0x00)) {
- // 0x00 0x3c 0x00 0x00: UCS-4, unusual (3421)
- encoding = ENCODING_UCS_4_3412;
-
- // 00 00 fe ff UCS_4_1234 (with BOM)
- // ff fe 00 00 UCS_4_4321 (with BOM)
- }
-
- //
- // SECOND: two byte encodings
- // note ... with 1/14/2000 errata the XML spec identifies some
- // more "broken UTF-16" autodetection cases, with no XML decl,
- // which we don't handle here (that's legal too).
- //
- else if (tryEncoding (signature, (byte) 0xfe, (byte) 0xff)) {
- // UCS-2 with a byte-order marker. (UTF-16)
- // 0xfe 0xff: UCS-2, big-endian (12)
- encoding = ENCODING_UCS_2_12;
- is.read (); is.read ();
-
- } else if (tryEncoding (signature, (byte) 0xff, (byte) 0xfe)) {
- // UCS-2 with a byte-order marker. (UTF-16)
- // 0xff 0xfe: UCS-2, little-endian (21)
- encoding = ENCODING_UCS_2_21;
- is.read (); is.read ();
-
- } else if (tryEncoding (signature, (byte) 0x00, (byte) 0x3c,
- (byte) 0x00, (byte) 0x3f)) {
- // UTF-16BE (otherwise, malformed UTF-16)
- // 0x00 0x3c 0x00 0x3f: UCS-2, big-endian, no byte-order mark
- encoding = ENCODING_UCS_2_12;
- error ("no byte-order mark for UCS-2 entity");
-
- } else if (tryEncoding (signature, (byte) 0x3c, (byte) 0x00,
- (byte) 0x3f, (byte) 0x00)) {
- // UTF-16LE (otherwise, malformed UTF-16)
- // 0x3c 0x00 0x3f 0x00: UCS-2, little-endian, no byte-order mark
- encoding = ENCODING_UCS_2_21;
- error ("no byte-order mark for UCS-2 entity");
- }
-
- //
- // THIRD: ASCII-derived encodings, fixed and variable lengths
- //
- else if (tryEncoding (signature, (byte) 0x3c, (byte) 0x3f,
- (byte) 0x78, (byte) 0x6d)) {
- // ASCII derived
- // 0x3c 0x3f 0x78 0x6d: UTF-8 or other 8-bit markup (read ENCODING)
- encoding = ENCODING_UTF_8;
- prefetchASCIIEncodingDecl ();
-
- } else if (signature [0] == (byte) 0xef
- && signature [1] == (byte) 0xbb
- && signature [2] == (byte) 0xbf) {
- // 0xef 0xbb 0xbf: UTF-8 BOM (not part of document text)
- // this un-needed notion slipped into XML 2nd ed through a
- // "non-normative" erratum; now required by MSFT and UDDI,
- // and E22 made it normative.
- encoding = ENCODING_UTF_8;
- is.read (); is.read (); is.read ();
-
- } else {
- // 4c 6f a7 94 ... we don't understand EBCDIC flavors
- // ... but we COULD at least kick in some fixed code page
-
- // (default) UTF-8 without encoding/XML declaration
- encoding = ENCODING_UTF_8;
- }
- }
-
-
- /**
- * Check for a four-byte signature.
- * <p>Utility routine for detectEncoding ().
- * <p>Always looks for some part of "<?XML" in a specific encoding.
- * @param sig The first four bytes read.
- * @param b1 The first byte of the signature
- * @param b2 The second byte of the signature
- * @param b3 The third byte of the signature
- * @param b4 The fourth byte of the signature
- * @see #detectEncoding
- */
- private static boolean tryEncoding (
- byte sig[], byte b1, byte b2, byte b3, byte b4)
- {
- return (sig [0] == b1 && sig [1] == b2
- && sig [2] == b3 && sig [3] == b4);
- }
-
-
- /**
- * Check for a two-byte signature.
- * <p>Looks for a UCS-2 byte-order mark.
- * <p>Utility routine for detectEncoding ().
- * @param sig The first four bytes read.
- * @param b1 The first byte of the signature
- * @param b2 The second byte of the signature
- * @see #detectEncoding
- */
- private static boolean tryEncoding (byte sig[], byte b1, byte b2)
- {
- return ((sig [0] == b1) && (sig [1] == b2));
- }
-
-
- /**
- * This method pushes a string back onto input.
- * <p>It is useful either as the expansion of an internal entity,
- * or for backtracking during the parse.
- * <p>Call pushCharArray () to do the actual work.
- * @param s The string to push back onto input.
- * @see #pushCharArray
- */
- private void pushString (String ename, String s)
- throws SAXException
- {
- char ch[] = s.toCharArray ();
- pushCharArray (ename, ch, 0, ch.length);
- }
-
-
- /**
- * Push a new internal input source.
- * <p>This method is useful for expanding an internal entity,
- * or for unreading a string of characters. It creates a new
- * readBuffer containing the characters in the array, instead
- * of characters converted from an input byte stream.
- * @param ch The char array to push.
- * @see #pushString
- * @see #pushURL
- * @see #readBuffer
- * @see #sourceType
- * @see #pushInput
- */
- private void pushCharArray (String ename, char ch[], int start, int length)
- throws SAXException
- {
- // Push the existing status
- pushInput (ename);
- if (ename != null && doReport) {
- dataBufferFlush ();
- handler.startInternalEntity (ename);
- }
- sourceType = INPUT_INTERNAL;
- readBuffer = ch;
- readBufferPos = start;
- readBufferLength = length;
- readBufferOverflow = -1;
- }
-
-
- /**
- * Save the current input source onto the stack.
- * <p>This method saves all of the global variables associated with
- * the current input source, so that they can be restored when a new
- * input source has finished. It also tests for entity recursion.
- * <p>The method saves the following global variables onto a stack
- * using a fixed-length array:
- * <ol>
- * <li>sourceType
- * <li>externalEntity
- * <li>readBuffer
- * <li>readBufferPos
- * <li>readBufferLength
- * <li>line
- * <li>encoding
- * </ol>
- * @param ename The name of the entity (if any) causing the new input.
- * @see #popInput
- * @see #sourceType
- * @see #externalEntity
- * @see #readBuffer
- * @see #readBufferPos
- * @see #readBufferLength
- * @see #line
- * @see #encoding
- */
- private void pushInput (String ename)
- throws SAXException
- {
- // Check for entity recursion.
- if (ename != null) {
- Enumeration entities = entityStack.elements ();
- while (entities.hasMoreElements ()) {
- String e = (String) entities.nextElement ();
- if (e != null && e == ename) {
- error ("recursive reference to entity", ename, null);
- }
- }
- }
- entityStack.push (ename);
-
- // Don't bother if there is no current input.
- if (sourceType == INPUT_NONE) {
- return;
- }
-
- // Set up a snapshot of the current
- // input source.
- Object input[] = new Object [12];
-
- input [0] = new Integer (sourceType);
- input [1] = externalEntity;
- input [2] = readBuffer;
- input [3] = new Integer (readBufferPos);
- input [4] = new Integer (readBufferLength);
- input [5] = new Integer (line);
- input [6] = new Integer (encoding);
- input [7] = new Integer (readBufferOverflow);
- input [8] = is;
- input [9] = new Integer (currentByteCount);
- input [10] = new Integer (column);
- input [11] = reader;
-
- // Push it onto the stack.
- inputStack.push (input);
- }
-
-
- /**
- * Restore a previous input source.
- * <p>This method restores all of the global variables associated with
- * the current input source.
- * @exception java.io.EOFException
- * If there are no more entries on the input stack.
- * @see #pushInput
- * @see #sourceType
- * @see #externalEntity
- * @see #readBuffer
- * @see #readBufferPos
- * @see #readBufferLength
- * @see #line
- * @see #encoding
- */
- private void popInput ()
- throws SAXException, IOException
- {
- String ename = (String) entityStack.pop ();
-
- if (ename != null && doReport)
- dataBufferFlush ();
- switch (sourceType) {
- case INPUT_STREAM:
- handler.endExternalEntity (ename);
- is.close ();
- break;
- case INPUT_READER:
- handler.endExternalEntity (ename);
- reader.close ();
- break;
- case INPUT_INTERNAL:
- if (ename != null && doReport)
- handler.endInternalEntity (ename);
- break;
- }
-
- // Throw an EOFException if there
- // is nothing else to pop.
- if (inputStack.isEmpty ()) {
- throw new EOFException ("no more input");
- }
-
- Object input [] = (Object[]) inputStack.pop ();
-
- sourceType = ((Integer) input [0]).intValue ();
- externalEntity = (URLConnection) input [1];
- readBuffer = (char[]) input [2];
- readBufferPos = ((Integer) input [3]).intValue ();
- readBufferLength = ((Integer) input [4]).intValue ();
- line = ((Integer) input [5]).intValue ();
- encoding = ((Integer) input [6]).intValue ();
- readBufferOverflow = ((Integer) input [7]).intValue ();
- is = (InputStream) input [8];
- currentByteCount = ((Integer) input [9]).intValue ();
- column = ((Integer) input [10]).intValue ();
- reader = (Reader) input [11];
- }
-
-
- /**
- * Return true if we can read the expected character.
- * <p>Note that the character will be removed from the input stream
- * on success, but will be put back on failure. Do not attempt to
- * read the character again if the method succeeds.
- * @param delim The character that should appear next. For a
- * insensitive match, you must supply this in upper-case.
- * @return true if the character was successfully read, or false if
- * it was not.
- * @see #tryRead (String)
- */
- private boolean tryRead (char delim)
- throws SAXException, IOException
- {
- char c;
-
- // Read the character
- c = readCh ();
-
- // Test for a match, and push the character
- // back if the match fails.
- if (c == delim) {
- return true;
- } else {
- unread (c);
- return false;
- }
- }
-
-
- /**
- * Return true if we can read the expected string.
- * <p>This is simply a convenience method.
- * <p>Note that the string will be removed from the input stream
- * on success, but will be put back on failure. Do not attempt to
- * read the string again if the method succeeds.
- * <p>This method will push back a character rather than an
- * array whenever possible (probably the majority of cases).
- * @param delim The string that should appear next.
- * @return true if the string was successfully read, or false if
- * it was not.
- * @see #tryRead (char)
- */
- private boolean tryRead (String delim)
- throws SAXException, IOException
- {
- return tryRead (delim.toCharArray ());
- }
-
- private boolean tryRead (char ch [])
- throws SAXException, IOException
- {
- char c;
-
- // Compare the input, character-
- // by character.
-
- for (int i = 0; i < ch.length; i++) {
- c = readCh ();
- if (c != ch [i]) {
- unread (c);
- if (i != 0) {
- unread (ch, i);
- }
- return false;
- }
- }
- return true;
- }
-
-
-
- /**
- * Return true if we can read some whitespace.
- * <p>This is simply a convenience method.
- * <p>This method will push back a character rather than an
- * array whenever possible (probably the majority of cases).
- * @return true if whitespace was found.
- */
- private boolean tryWhitespace ()
- throws SAXException, IOException
- {
- char c;
- c = readCh ();
- if (isWhitespace (c)) {
- skipWhitespace ();
- return true;
- } else {
- unread (c);
- return false;
- }
- }
-
-
- /**
- * Read all data until we find the specified string.
- * This is useful for scanning CDATA sections and PIs.
- * <p>This is inefficient right now, since it calls tryRead ()
- * for every character.
- * @param delim The string delimiter
- * @see #tryRead (String, boolean)
- * @see #readCh
- */
- private void parseUntil (String delim)
- throws SAXException, IOException
- {
- parseUntil (delim.toCharArray ());
- }
-
- private void parseUntil (char delim [])
- throws SAXException, IOException
- {
- char c;
- int startLine = line;
-
- try {
- while (!tryRead (delim)) {
- c = readCh ();
- dataBufferAppend (c);
- }
- } catch (EOFException e) {
- error ("end of input while looking for delimiter "
- + "(started on line " + startLine
- + ')', null, new String (delim));
- }
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // Low-level I/O.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Prefetch US-ASCII XML/text decl from input stream into read buffer.
- * Doesn't buffer more than absolutely needed, so that when an encoding
- * decl says we need to create an InputStreamReader, we can discard our
- * buffer and reset(). Caller knows the first chars of the decl exist
- * in the input stream.
- */
- private void prefetchASCIIEncodingDecl ()
- throws SAXException, IOException
- {
- int ch;
- readBufferPos = readBufferLength = 0;
-
- is.mark (readBuffer.length);
- while (true) {
- ch = is.read ();
- readBuffer [readBufferLength++] = (char) ch;
- switch (ch) {
- case (int) '>':
- return;
- case -1:
- error ("file ends before end of XML or encoding declaration.",
- null, "?>");
- }
- if (readBuffer.length == readBufferLength)
- error ("unfinished XML or encoding declaration");
- }
- }
-
- /**
- * Read a chunk of data from an external input source.
- * <p>This is simply a front-end that fills the rawReadBuffer
- * with bytes, then calls the appropriate encoding handler.
- * @see #encoding
- * @see #rawReadBuffer
- * @see #readBuffer
- * @see #filterCR
- * @see #copyUtf8ReadBuffer
- * @see #copyIso8859_1ReadBuffer
- * @see #copyUcs_2ReadBuffer
- * @see #copyUcs_4ReadBuffer
- */
- private void readDataChunk ()
- throws SAXException, IOException
- {
- int count;
-
- // See if we have any overflow (filterCR sets for CR at end)
- if (readBufferOverflow > -1) {
- readBuffer [0] = (char) readBufferOverflow;
- readBufferOverflow = -1;
- readBufferPos = 1;
- sawCR = true;
- } else {
- readBufferPos = 0;
- sawCR = false;
- }
-
- // input from a character stream.
- if (sourceType == INPUT_READER) {
- count = reader.read (readBuffer,
- readBufferPos, READ_BUFFER_MAX - readBufferPos);
- if (count < 0)
- readBufferLength = readBufferPos;
- else
- readBufferLength = readBufferPos + count;
- if (readBufferLength > 0)
- filterCR (count >= 0);
- sawCR = false;
- return;
- }
-
- // Read as many bytes as possible into the raw buffer.
- count = is.read (rawReadBuffer, 0, READ_BUFFER_MAX);
-
- // Dispatch to an encoding-specific reader method to populate
- // the readBuffer. In most parser speed profiles, these routines
- // show up at the top of the CPU usage chart.
- if (count > 0) {
- switch (encoding) {
- // one byte builtins
- case ENCODING_ASCII:
- copyIso8859_1ReadBuffer (count, (char) 0x0080);
- break;
- case ENCODING_UTF_8:
- copyUtf8ReadBuffer (count);
- break;
- case ENCODING_ISO_8859_1:
- copyIso8859_1ReadBuffer (count, (char) 0);
- break;
-
- // two byte builtins
- case ENCODING_UCS_2_12:
- copyUcs2ReadBuffer (count, 8, 0);
- break;
- case ENCODING_UCS_2_21:
- copyUcs2ReadBuffer (count, 0, 8);
- break;
-
- // four byte builtins
- case ENCODING_UCS_4_1234:
- copyUcs4ReadBuffer (count, 24, 16, 8, 0);
- break;
- case ENCODING_UCS_4_4321:
- copyUcs4ReadBuffer (count, 0, 8, 16, 24);
- break;
- case ENCODING_UCS_4_2143:
- copyUcs4ReadBuffer (count, 16, 24, 0, 8);
- break;
- case ENCODING_UCS_4_3412:
- copyUcs4ReadBuffer (count, 8, 0, 24, 16);
- break;
- }
- } else
- readBufferLength = readBufferPos;
-
- readBufferPos = 0;
-
- // Filter out all carriage returns if we've seen any
- // (including any saved from a previous read)
- if (sawCR) {
- filterCR (count >= 0);
- sawCR = false;
-
- // must actively report EOF, lest some CRs get lost.
- if (readBufferLength == 0 && count >= 0)
- readDataChunk ();
- }
-
- if (count > 0)
- currentByteCount += count;
- }
-
-
- /**
- * Filter carriage returns in the read buffer.
- * CRLF becomes LF; CR becomes LF.
- * @param moreData true iff more data might come from the same source
- * @see #readDataChunk
- * @see #readBuffer
- * @see #readBufferOverflow
- */
- private void filterCR (boolean moreData)
- {
- int i, j;
-
- readBufferOverflow = -1;
-
-loop:
- for (i = j = readBufferPos; j < readBufferLength; i++, j++) {
- switch (readBuffer [j]) {
- case '\r':
- if (j == readBufferLength - 1) {
- if (moreData) {
- readBufferOverflow = '\r';
- readBufferLength--;
- } else // CR at end of buffer
- readBuffer [i++] = '\n';
- break loop;
- } else if (readBuffer [j + 1] == '\n') {
- j++;
- }
- readBuffer [i] = '\n';
- break;
-
- case '\n':
- default:
- readBuffer [i] = readBuffer [j];
- break;
- }
- }
- readBufferLength = i;
- }
-
- /**
- * Convert a buffer of UTF-8-encoded bytes into UTF-16 characters.
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- * <p>Note that as of Unicode 3.1, good practice became a requirement,
- * so that each Unicode character has exactly one UTF-8 representation.
- * @param count The number of bytes to convert.
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- * @see #getNextUtf8Byte
- */
- private void copyUtf8ReadBuffer (int count)
- throws SAXException, IOException
- {
- int i = 0;
- int j = readBufferPos;
- int b1;
- char c = 0;
-
- /*
- // check once, so the runtime won't (if it's smart enough)
- if (count < 0 || count > rawReadBuffer.length)
- throw new ArrayIndexOutOfBoundsException (Integer.toString (count));
- */
-
- while (i < count) {
- b1 = rawReadBuffer [i++];
-
- // Determine whether we are dealing
- // with a one-, two-, three-, or four-
- // byte sequence.
- if (b1 < 0) {
- if ((b1 & 0xe0) == 0xc0) {
- // 2-byte sequence: 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx
- c = (char) (((b1 & 0x1f) << 6)
- | getNextUtf8Byte (i++, count));
- if (c < 0x0080)
- encodingError ("Illegal two byte UTF-8 sequence",
- c, 0);
- } else if ((b1 & 0xf0) == 0xe0) {
- // 3-byte sequence:
- // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx
- // most CJKV characters
- c = (char) (((b1 & 0x0f) << 12) |
- (getNextUtf8Byte (i++, count) << 6) |
- getNextUtf8Byte (i++, count));
- if (c < 0x0800 || (c >= 0xd800 && c <= 0xdfff))
- encodingError ("Illegal three byte UTF-8 sequence",
- c, 0);
- } else if ((b1 & 0xf8) == 0xf0) {
- // 4-byte sequence: 11101110wwwwzzzzyy + 110111yyyyxxxxxx
- // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx
- // (uuuuu = wwww + 1)
- // "Surrogate Pairs" ... from the "Astral Planes"
- // Unicode 3.1 assigned the first characters there
- int iso646 = b1 & 07;
- iso646 = (iso646 << 6) + getNextUtf8Byte (i++, count);
- iso646 = (iso646 << 6) + getNextUtf8Byte (i++, count);
- iso646 = (iso646 << 6) + getNextUtf8Byte (i++, count);
-
- if (iso646 <= 0xffff) {
- encodingError ("Illegal four byte UTF-8 sequence",
- iso646, 0);
- } else {
- if (iso646 > 0x0010ffff)
- encodingError (
- "UTF-8 value out of range for Unicode",
- iso646, 0);
- iso646 -= 0x010000;
- readBuffer [j++] = (char) (0xd800 | (iso646 >> 10));
- readBuffer [j++] = (char) (0xdc00 | (iso646 & 0x03ff));
- continue;
- }
- } else {
- // The five and six byte encodings aren't supported;
- // they exceed the Unicode (and XML) range.
- encodingError (
- "unsupported five or six byte UTF-8 sequence",
- 0xff & b1, i);
- // NOTREACHED
- c = 0;
- }
- } else {
- // 1-byte sequence: 000000000xxxxxxx = 0xxxxxxx
- // (US-ASCII character, "common" case, one branch to here)
- c = (char) b1;
- }
- readBuffer [j++] = c;
- if (c == '\r')
- sawCR = true;
- }
- // How many characters have we read?
- readBufferLength = j;
- }
-
-
- /**
- * Return the next byte value in a UTF-8 sequence.
- * If it is not possible to get a byte from the current
- * entity, throw an exception.
- * @param pos The current position in the rawReadBuffer.
- * @param count The number of bytes in the rawReadBuffer
- * @return The significant six bits of a non-initial byte in
- * a UTF-8 sequence.
- * @exception EOFException If the sequence is incomplete.
- */
- private int getNextUtf8Byte (int pos, int count)
- throws SAXException, IOException
- {
- int val;
-
- // Take a character from the buffer
- // or from the actual input stream.
- if (pos < count) {
- val = rawReadBuffer [pos];
- } else {
- val = is.read ();
- if (val == -1) {
- encodingError ("unfinished multi-byte UTF-8 sequence at EOF",
- -1, pos);
- }
- }
-
- // Check for the correct bits at the start.
- if ((val & 0xc0) != 0x80) {
- encodingError ("bad continuation of multi-byte UTF-8 sequence",
- val, pos + 1);
- }
-
- // Return the significant bits.
- return (val & 0x3f);
- }
-
-
- /**
- * Convert a buffer of US-ASCII or ISO-8859-1-encoded bytes into
- * UTF-16 characters.
- *
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- *
- * @param count The number of bytes to convert.
- * @param mask For ASCII conversion, 0x7f; else, 0xff.
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- */
- private void copyIso8859_1ReadBuffer (int count, char mask)
- throws IOException
- {
- int i, j;
- for (i = 0, j = readBufferPos; i < count; i++, j++) {
- char c = (char) (rawReadBuffer [i] & 0xff);
- if ((c & mask) != 0)
- throw new CharConversionException ("non-ASCII character U+"
- + Integer.toHexString (c));
- readBuffer [j] = c;
- if (c == '\r') {
- sawCR = true;
- }
- }
- readBufferLength = j;
- }
-
-
- /**
- * Convert a buffer of UCS-2-encoded bytes into UTF-16 characters
- * (as used in Java string manipulation).
- *
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- * @param count The number of bytes to convert.
- * @param shift1 The number of bits to shift byte 1.
- * @param shift2 The number of bits to shift byte 2
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- */
- private void copyUcs2ReadBuffer (int count, int shift1, int shift2)
- throws SAXException
- {
- int j = readBufferPos;
-
- if (count > 0 && (count % 2) != 0) {
- encodingError ("odd number of bytes in UCS-2 encoding", -1, count);
- }
- // The loops are faster with less internal brancing; hence two
- if (shift1 == 0) { // "UTF-16-LE"
- for (int i = 0; i < count; i += 2) {
- char c = (char) (rawReadBuffer [i + 1] << 8);
- c |= 0xff & rawReadBuffer [i];
- readBuffer [j++] = c;
- if (c == '\r')
- sawCR = true;
- }
- } else { // "UTF-16-BE"
- for (int i = 0; i < count; i += 2) {
- char c = (char) (rawReadBuffer [i] << 8);
- c |= 0xff & rawReadBuffer [i + 1];
- readBuffer [j++] = c;
- if (c == '\r')
- sawCR = true;
- }
- }
- readBufferLength = j;
- }
-
-
- /**
- * Convert a buffer of UCS-4-encoded bytes into UTF-16 characters.
- *
- * <p>When readDataChunk () calls this method, the raw bytes are in
- * rawReadBuffer, and the final characters will appear in
- * readBuffer.
- * <p>Java has Unicode chars, and this routine uses surrogate pairs
- * for ISO-10646 values between 0x00010000 and 0x000fffff. An
- * exception is thrown if the ISO-10646 character has no Unicode
- * representation.
- *
- * @param count The number of bytes to convert.
- * @param shift1 The number of bits to shift byte 1.
- * @param shift2 The number of bits to shift byte 2
- * @param shift3 The number of bits to shift byte 2
- * @param shift4 The number of bits to shift byte 2
- * @see #readDataChunk
- * @see #rawReadBuffer
- * @see #readBuffer
- */
- private void copyUcs4ReadBuffer (int count, int shift1, int shift2,
- int shift3, int shift4)
- throws SAXException
- {
- int j = readBufferPos;
-
- if (count > 0 && (count % 4) != 0) {
- encodingError (
- "number of bytes in UCS-4 encoding not divisible by 4",
- -1, count);
- }
- for (int i = 0; i < count; i += 4) {
- int value = (((rawReadBuffer [i] & 0xff) << shift1) |
- ((rawReadBuffer [i + 1] & 0xff) << shift2) |
- ((rawReadBuffer [i + 2] & 0xff) << shift3) |
- ((rawReadBuffer [i + 3] & 0xff) << shift4));
- if (value < 0x0000ffff) {
- readBuffer [j++] = (char) value;
- if (value == (int) '\r') {
- sawCR = true;
- }
- } else if (value < 0x0010ffff) {
- value -= 0x010000;
- readBuffer [j++] = (char) (0xd8 | ((value >> 10) & 0x03ff));
- readBuffer [j++] = (char) (0xdc | (value & 0x03ff));
- } else {
- encodingError ("UCS-4 value out of range for Unicode",
- value, i);
- }
- }
- readBufferLength = j;
- }
-
-
- /**
- * Report a character encoding error.
- */
- private void encodingError (String message, int value, int offset)
- throws SAXException
- {
- if (value != -1)
- message = message + " (character code: 0x" +
- Integer.toHexString (value) + ')';
- error (message);
- }
-
-
- //////////////////////////////////////////////////////////////////////
- // Local Variables.
- //////////////////////////////////////////////////////////////////////
-
- /**
- * Re-initialize the variables for each parse.
- */
- private void initializeVariables ()
- {
- // First line
- line = 1;
- column = 0;
-
- // Set up the buffers for data and names
- dataBufferPos = 0;
- dataBuffer = new char [DATA_BUFFER_INITIAL];
- nameBufferPos = 0;
- nameBuffer = new char [NAME_BUFFER_INITIAL];
-
- // Set up the DTD hash tables
- elementInfo = new Hashtable ();
- entityInfo = new Hashtable ();
- notationInfo = new Hashtable ();
- skippedPE = false;
-
- // Set up the variables for the current
- // element context.
- currentElement = null;
- currentElementContent = CONTENT_UNDECLARED;
-
- // Set up the input variables
- sourceType = INPUT_NONE;
- inputStack = new Stack ();
- entityStack = new Stack ();
- externalEntity = null;
- tagAttributePos = 0;
- tagAttributes = new String [100];
- rawReadBuffer = new byte [READ_BUFFER_MAX];
- readBufferOverflow = -1;
-
- scratch = new InputSource ();
-
- inLiteral = false;
- expandPE = false;
- peIsError = false;
-
- doReport = false;
-
- inCDATA = false;
-
- symbolTable = new Object [SYMBOL_TABLE_LENGTH][];
- }
-
-
- //
- // The current XML handler interface.
- //
- private SAXDriver handler;
-
- //
- // I/O information.
- //
- private Reader reader; // current reader
- private InputStream is; // current input stream
- private int line; // current line number
- private int column; // current column number
- private int sourceType; // type of input source
- private Stack inputStack; // stack of input soruces
- private URLConnection externalEntity; // current external entity
- private int encoding; // current character encoding
- private int currentByteCount; // bytes read from current source
- private InputSource scratch; // temporary
-
- //
- // Buffers for decoded but unparsed character input.
- //
- private char readBuffer [];
- private int readBufferPos;
- private int readBufferLength;
- private int readBufferOverflow; // overflow from last data chunk.
-
-
- //
- // Buffer for undecoded raw byte input.
- //
- private final static int READ_BUFFER_MAX = 16384;
- private byte rawReadBuffer [];
-
-
- //
- // Buffer for attribute values, char refs, DTD stuff.
- //
- private static int DATA_BUFFER_INITIAL = 4096;
- private char dataBuffer [];
- private int dataBufferPos;
-
- //
- // Buffer for parsed names.
- //
- private static int NAME_BUFFER_INITIAL = 1024;
- private char nameBuffer [];
- private int nameBufferPos;
-
- //
- // Save any standalone flag
- //
- private boolean docIsStandalone;
-
- //
- // Hashtables for DTD information on elements, entities, and notations.
- // Populated until we start ignoring decls (because of skipping a PE)
- //
- private Hashtable elementInfo;
- private Hashtable entityInfo;
- private Hashtable notationInfo;
- private boolean skippedPE;
-
-
- //
- // Element type currently in force.
- //
- private String currentElement;
- private int currentElementContent;
-
- //
- // Stack of entity names, to detect recursion.
- //
- private Stack entityStack;
-
- //
- // PE expansion is enabled in most chunks of the DTD, not all.
- // When it's enabled, literals are treated differently.
- //
- private boolean inLiteral;
- private boolean expandPE;
- private boolean peIsError;
-
- //
- // can't report entity expansion inside two constructs:
- // - attribute expansions (internal entities only)
- // - markup declarations (parameter entities only)
- //
- private boolean doReport;
-
- //
- // Symbol table, for caching interned names.
- //
- // These show up wherever XML names or nmtokens are used: naming elements,
- // attributes, PIs, notations, entities, and enumerated attribute values.
- //
- // NOTE: This hashtable doesn't grow. The default size is intended to be
- // rather large for most documents. Example: one snapshot of the DocBook
- // XML 4.1 DTD used only about 350 such names. As a rule, only pathological
- // documents (ones that don't reuse names) should ever see much collision.
- //
- // Be sure that SYMBOL_TABLE_LENGTH always stays prime, for best hashing.
- // "2039" keeps the hash table size at about two memory pages on typical
- // 32 bit hardware.
- //
- private final static int SYMBOL_TABLE_LENGTH = 2039;
-
- private Object symbolTable [][];
-
- //
- // Hash table of attributes found in current start tag.
- //
- private String tagAttributes [];
- private int tagAttributePos;
-
- //
- // Utility flag: have we noticed a CR while reading the last
- // data chunk? If so, we will have to go back and normalise
- // CR or CR/LF line ends.
- //
- private boolean sawCR;
-
- //
- // Utility flag: are we in CDATA? If so, whitespace isn't ignorable.
- //
- private boolean inCDATA;
-}
diff --git a/external/jaxp/source/gnu/xml/aelfred2/XmlReader.java b/external/jaxp/source/gnu/xml/aelfred2/XmlReader.java
deleted file mode 100644
index 01a936933..000000000
--- a/external/jaxp/source/gnu/xml/aelfred2/XmlReader.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.aelfred2;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-
-import gnu.xml.pipeline.EventFilter;
-import gnu.xml.pipeline.ValidationConsumer;
-
-
-/**
- * This SAX2 parser optionally layers a validator over the &AElig;lfred2
- * SAX2 parser. While this will not evaluate every XML validity constraint,
- * it does support all the validity constraints that are of any real utility
- * outside the strict SGML-compatible world. See the documentation for the
- * SAXDriver class for information about the SAX2 features and properties
- * that are supported, and documentation for the ValidationConsumer for
- * information about what validity constraints may not be supported.
- * (&AElig;lfred2 tests some of those, even in non-validating mode, to
- * achieve better conformance.)
- *
- * <p> Note that due to its internal construction, you can't change most
- * handlers until parse() returns. This diverges slightly from SAX, which
- * expects later binding to be supported. Early binding involves less
- * runtime overhead, which is an issue for event pipelines as used inside
- * this parser. Rather than relying on the parser to handle late binding
- * to your own handlers, do it yourself.
- *
- * @see SAXDriver
- * @see gnu.xml.pipeline.ValidationConsumer
- *
- * @author David Brownell
- */
-public final class XmlReader implements XMLReader
-{
- private SAXDriver aelfred2 = new SAXDriver ();
- private EventFilter filter = new EventFilter ();
- private boolean isValidating;
- private boolean active;
-
-
- /** Constructs a SAX Parser. */
- public XmlReader ()
- { }
-
- /**
- * Constructs a SAX Parser, optionally treating validity errors
- * as if they were fatal errors.
- */
- public XmlReader (boolean invalidIsFatal)
- {
- if (invalidIsFatal)
- setErrorHandler (new DefaultHandler2 () {
- public void error (SAXParseException e)
- throws SAXException
- { throw e; }
- });
- }
-
- /**
- * <b>SAX2</b>: Returns the object used to report the logical
- * content of an XML document.
- */
- public ContentHandler getContentHandler ()
- { return filter.getContentHandler (); }
-
- /**
- * <b>SAX2</b>: Assigns the object used to report the logical
- * content of an XML document.
- * @exception IllegalStateException if called mid-parse
- */
- public void setContentHandler (ContentHandler handler)
- {
- if (active)
- throw new IllegalStateException ("already parsing");
- filter.setContentHandler (handler);
- }
-
- /**
- * <b>SAX2</b>: Returns the object used to process declarations related
- * to notations and unparsed entities.
- */
- public DTDHandler getDTDHandler ()
- { return filter.getDTDHandler (); }
-
- /**
- * <b>SAX1</b> Assigns DTD handler
- * @exception IllegalStateException if called mid-parse
- */
- public void setDTDHandler (DTDHandler handler)
- {
- if (active)
- throw new IllegalStateException ("already parsing");
- filter.setDTDHandler (handler);
- }
-
- /**
- * <b>SAX2</b>: Returns the object used when resolving external
- * entities during parsing (both general and parameter entities).
- */
- public EntityResolver getEntityResolver ()
- { return aelfred2.getEntityResolver (); }
-
- /** <b>SAX1</b> Assigns parser's entity resolver */
- public void setEntityResolver (EntityResolver handler)
- { aelfred2.setEntityResolver (handler); }
-
- /**
- * <b>SAX2</b>: Returns the object used to receive callbacks for XML
- * errors of all levels (fatal, nonfatal, warning); this is never null;
- */
- public ErrorHandler getErrorHandler ()
- { return aelfred2.getErrorHandler (); }
-
- /**
- * <b>SAX1</b> Assigns error handler
- * @exception IllegalStateException if called mid-parse
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- if (active)
- throw new IllegalStateException ("already parsing");
- aelfred2.setErrorHandler (handler);
- }
-
- /**
- * <b>SAX2</b>: Assigns the specified property.
- * @exception IllegalStateException if called mid-parse
- */
- public void setProperty (String propertyId, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (active)
- throw new IllegalStateException ("already parsing");
- if (getProperty (propertyId) != value)
- filter.setProperty (propertyId, value);
- }
-
- /**
- * <b>SAX2</b>: Returns the specified property.
- */
- public Object getProperty (String propertyId)
- throws SAXNotRecognizedException
- {
- if ((SAXDriver.PROPERTY + "declaration-handler")
- .equals (propertyId)
- || (SAXDriver.PROPERTY + "lexical-handler")
- .equals (propertyId))
- return filter.getProperty (propertyId);
- throw new SAXNotRecognizedException (propertyId);
- }
-
- private void forceValidating ()
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- aelfred2.setFeature (
- SAXDriver.FEATURE + "namespace-prefixes",
- true);
- aelfred2.setFeature (
- SAXDriver.FEATURE + "external-general-entities",
- true);
- aelfred2.setFeature (
- SAXDriver.FEATURE + "external-parameter-entities",
- true);
- }
-
- /**
- * <b>SAX2</b>: Sets the state of features supported in this parser.
- * Note that this parser requires reporting of namespace prefixes when
- * validating.
- */
- public void setFeature (String featureId, boolean state)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- boolean value = getFeature (featureId);
-
- if (state == value)
- return;
-
- if ((SAXDriver.FEATURE + "validation").equals (featureId)) {
- if (active)
- throw new SAXNotSupportedException ("already parsing");
- if (state)
- forceValidating ();
- isValidating = state;
- } else
- aelfred2.setFeature (featureId, state);
- }
-
- /**
- * <b>SAX2</b>: Tells whether this parser supports the specified feature.
- * At this time, this directly parallels the underlying SAXDriver,
- * except that validation is optionally supported.
- *
- * @see SAXDriver
- */
- public boolean getFeature (String featureId)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if ((SAXDriver.FEATURE + "validation").equals (featureId))
- return isValidating;
-
- return aelfred2.getFeature (featureId);
- }
-
- /**
- * <b>SAX1</b>: Sets the locale used for diagnostics; currently,
- * only locales using the English language are supported.
- * @param locale The locale for which diagnostics will be generated
- */
- public void setLocale (Locale locale)
- throws SAXException
- { aelfred2.setLocale (locale); }
-
- /**
- * <b>SAX1</b>: Preferred API to parse an XML document, using a
- * system identifier (URI).
- */
- public void parse (String systemId)
- throws SAXException, IOException
- {
- parse (new InputSource (systemId));
- }
-
- /**
- * <b>SAX1</b>: Underlying API to parse an XML document, used
- * directly when no URI is available. When this is invoked,
- * and the parser is set to validate, some features will be
- * automatically reset to appropriate values: for reporting
- * namespace prefixes, and incorporating external entities.
- *
- * @param source The XML input source.
- *
- * @exception IllegalStateException if called mid-parse
- * @exception SAXException The handlers may throw any SAXException,
- * and the parser normally throws SAXParseException objects.
- * @exception IOException IOExceptions are normally through through
- * the parser if there are problems reading the source document.
- */
- public void parse (InputSource source)
- throws SAXException, IOException
- {
- EventFilter next;
- boolean nsdecls;
-
- synchronized (aelfred2) {
- if (active)
- throw new IllegalStateException ("already parsing");
- active = true;
- }
-
- // set up the output pipeline
- if (isValidating) {
- forceValidating ();
- next = new ValidationConsumer (filter);
- } else
- next = filter;
-
- // connect pipeline and error handler
- // don't let _this_ call to bind() affect xmlns* attributes
- nsdecls = aelfred2.getFeature (
- SAXDriver.FEATURE + "namespace-prefixes");
- EventFilter.bind (aelfred2, next);
- if (!nsdecls)
- aelfred2.setFeature (
- SAXDriver.FEATURE + "namespace-prefixes",
- false);
-
- // parse, clean up
- try {
- aelfred2.parse (source);
- } finally {
- active = false;
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/aelfred2/package.html b/external/jaxp/source/gnu/xml/aelfred2/package.html
deleted file mode 100644
index e5afa1ed3..000000000
--- a/external/jaxp/source/gnu/xml/aelfred2/package.html
+++ /dev/null
@@ -1,477 +0,0 @@
-<!DOCTYPE html PUBLIC
- '-//W3C//DTD XHTML 1.0 Transitional//EN'
- 'http://www.w3.org/TR/xhtml1/DTD/transitional.dtd'>
-
-<html><head>
- <title>package overview</title>
-<!--
-/*
- * Copyright (c) 1999-2001 by David Brownell.
- * This file is distributed under the GPL.
- *
- * $Id: package.html,v 1.2 2004-05-01 16:18:49 mark Exp $
- */
--->
-</head><body>
-
-<p> This package contains &AElig;lfred2, which includes an
-enhanced SAX2-compatible version of the &AElig;lfred
-non-validating XML parser, a modular (and hence optional)
-DTD validating parser, and modular (and hence optional)
-JAXP glue to those.
-Use these like any other SAX2 parsers. </p>
-
-<ul>
- <li><a href="#about">About &AElig;lfred</a><ul>
- <li><a href="#principles">Design Principles</a></li>
- <li><a href="#name">About the Name &AElig;lfred</a></li>
- <li><a href="#encodings">Character Encodings</a></li>
- <li><a href="#violations">Known Conformance Violations</a></li>
- <li><a href="#license">Licensing</a></li>
- </ul></li>
-
- <li><a href="#changes">Changes Since the Last Microstar Release</a><ul>
- <li><a href="#sax2">SAX2 Support</a></li>
- <li><a href="#validation">Validation</a></li>
- <li><a href="#smaller">You Want Smaller?</a></li>
- <li><a href="#bugfixes">Bugs Fixed</a></li>
- </ul></li>
-
-</ul>
-
-<p> Some of the documentation below was modified from the original
-&AElig;lfred README.txt file. All of it has been updated. </p>
-
-
-<h2><a name="about">About &AElig;lfred</a></h2>
-
-<p>&AElig;lfred is a Java-based XML parser originally from
-Microstar Software Limited (no longer in existence) and
-more or less placed into the public domain.
-
-
-<h3><a name="principles">Design Principles</a></h3>
-
-<p>In most Java applets and applications, XML should not be the central
-feature; instead, XML is the means to another end, such as loading
-configuration information, reading meta-data, or parsing transactions.</p>
-
-<p> When an XML parser is only a single component of a much larger
-program, it cannot be large, slow, or resource-intensive. With Java
-applets, in particular, code size is a significant issue. The standard
-modem is still not operating at 56 Kbaud, or sometimes even with data
-compression. Assuming an uncompressed 28.8 Kbaud modem, only about
-3 KBytes can be downloaded in one second; compression often doubles
-that speed, but a V.90 modem may not provide another doubling. When
-used with embedded processors, similar size concerns apply. </p>
-
-<p> &AElig;lfred is designed for easy and efficient use over the Internet,
-based on the following principles: </p> <ol>
-
-<li> &AElig;lfred must be as small as possible, so that it doesn't add too
- much to an applet's download time. </li>
-
-<li> &AElig;lfred must use as few class files as possible, to minimize the
- number of HTTP connections necessary. (The use of JAR files has made this
- be less of a concern.) </li>
-
-<li> &AElig;lfred must be compatible with most or all Java implementations
- and platforms. (Write once, run anywhere.) </li>
-
-<li> &AElig;lfred must use as little memory as possible, so that it does
- not take away resources from the rest of your program. (It doesn't force
- you to use DOM or a similar costly data structure API.)</li>
-
-<li> &AElig;lfred must run as fast as possible, so that it does not slow down
- the rest of your program. </li>
-
-<li> &AElig;lfred must produce correct output for well-formed and valid
- documents, but need not reject every document that is not valid or
- not well-formed. (In &AElig;lfred2, correctness was a bigger concern
- than in the original version; and a validation option is available.) </li>
-
-<li> &AElig;lfred must provide full internationalization from the first
- release. (&AElig;lfred2 now automatically handles all encodings
- supported by the underlying JVM; previous versions handled only
- UTF-8, UTF_16, ASCII, and ISO-8859-1.)</li>
-
-</ol>
-
-<p>As you can see from this list, &AElig;lfred is designed for production
-use, but neither validation nor perfect conformance was a requirement.
-Good validating parsers exist, including one in this package,
-and you should use them as appropriate. (See conformance reviews
-available at <a href="http://www.xml.com/">http://www.xml.com</a>)
-</p>
-
-<p> One of the main goals of &AElig;lfred2 was to significantly improve
-conformance, while not significantly affecting the other goals stated above.
-Since the only use of this parser is with SAX, some classes could be
-removed, and so the overall size of &AElig;lfred was actually reduced.
-Subsequent performance work produced a notable speedup (over twenty
-percent on larger files). That is, the tradeoffs between speed, size, and
-conformance were re-targeted towards conformance and support of newer APIs
-(SAX2), with a a positive performance impact. </p>
-
-<p> The role anticipated for this version of &AElig;lfred is as a
-lightweight Free Software SAX parser that can be used in essentially every
-Java program where the handful of conformance violations (noted below)
-are acceptable.
-That certainly includes applets, and
-nowadays one must also mention embedded systems as being even more
-size-critical.
-At this writing, all parsers that are more conformant are
-significantly larger, even when counting the optional
-validation support in this version of &AElig;lfred. </p>
-
-
-<h3><a name="name">About the Name <em>&AElig;lfred</em></a></h3>
-
-<p>&AElig;lfred the Great (AElfred in ASCII) was King of Wessex, and
-some say of King of England, at the time of his death in 899 AD.
-&AElig;lfred introduced a wide-spread literacy program in the hope that
-his people would learn to read English, at least, if Latin was too
-difficult for them. This &AElig;lfred hopes to bring another sort of
-literacy to Java, using XML, at least, if full SGML is too difficult.</p>
-
-<p>The initial &AElig; ligature ("AE)" is also a reminder that XML is
-not limited to ASCII.</p>
-
-
-<h3><a name="encodings">Character Encodings</a></h3>
-
-<p> The &AElig;lfred parser currently builds in support for a handful
-of input encodings. Of course these include UTF-8 and UTF-16, which
-all XML parsers are required to support:</p> <ul>
-
- <li> UTF-8 ... the standard eight bit encoding, used unless
- you provide an encoding declaration or a MIME charset tag.</li>
-
- <li> US-ASCII ... an extremely common seven bit encoding,
- which happens to be a subset of UTF-8 and ISO-8859-1 as well
- as many other encodings. XHTML web pages using US-ASCII
- (without an encoding declaration) are probably more
- widely interoperable than those in any other encoding. </li>
-
- <li> ISO-8859-1 ... includes accented characters used in
- much of western Europe (but excluding the Euro currency
- symbol).</li>
-
- <li> UTF-16 ... with several variants, this encodes each
- sixteen bit Unicode character in sixteen bits of output.
- Variants include UTF-16BE (big endian, no byte order mark),
- UTF-16LE (little endian, no byte order mark), and
- ISO-10646-UCS-2 (an older and less used encoding, using a
- version of Unicode without surrogate pairs). This is
- essentially the native encoding used by Java. </li>
-
- <li> ISO-10646-UCS-4 ... a seldom-used four byte encoding,
- also known as UTF-32BE. Four byte order variants are supported,
- including one known as UTF-32LE. Some operating systems
- standardized on UCS-4 despite its significant size penalty,
- in anticipation that Unicode (even with surrogate pairs)
- would eventually become limiting. UCS-4 permits encoding
- of non-Unicode characters, which Java can't represent (and
- XML doesn't allow).
- </li>
-
- </ul>
-
-<p> If you use any encoding other than UTF-8 or UTF-16 you should
-make sure to label your data appropriately: </p>
-
-<blockquote>
-&lt;?xml version="1.0" encoding="<b>ISO-8859-15</b>"?&gt;
-</blockquote>
-
-<p> Encodings accessed through <code>java.io.InputStreamReader</code>
-are now fully supported for both external labels (such as MIME types)
-and internal types (as shown above).
-There is one limitation in the support for internal labels:
-the encodings must be derived from the US-ASCII encoding,
-the EBCDIC family of encodings is not recognized.
-Note that Java defines its
-own encoding names, which don't always correspond to the standard
-Internet encoding names defined by the IETF/IANA, and that Java
-may even <em>require</em> use of nonstandard encoding names.
-Please report
-such problems; some of them can be worked around in this parser,
-and many can be worked around by using external labels.
-</p>
-
-<p>Note that if you are using the Euro symbol with an fixed length
-eight bit encoding, you should probably be using the encoding label
-<em>iso-8859-15</em> or, with a Microsoft OS, <em>cp-1252</em>.
-Of course, UTF-8 and UTF-16 handle the Euro symbol directly.
-</p>
-
-
-<h3><a name="violations">Known Conformance Violations</a></h3>
-
-<p>Known conformance issues should be of negligible importance for
-most applications, and include: </p><ul>
-
- <li> Rather than following the voluminous "Appendix B" rules about
- what characters may appear in names (and name tokens), the Unicode
- rules embedded in <em>java.lang.Character</em> are used.
- This means mostly that some names are inappropriately accepted,
- though a few are inappropriately rejected. (It's much simpler
- to avoid that much special case code. Recent OASIS/NIST test
- cases may have these rules be realistically testable.) </li>
-
- <li> Text containing "]]&gt;" is not rejected unless it fully resides
- in an internal buffer ... which is, thankfully, the typical case. This
- text is illegal, but sometimes appears in illegal attempts to
- nest CDATA sections. (Not catching that boundary condition
- substantially simplifies parsing text.) </li>
-
- <li> Surrogate characters that aren't correctly paired are ignored
- rather than rejected, unless they were encoded using UTF-8. (This
- simplifies parsing text.) Unicode 3.1 assigned the first characters
- to those character codes, in early 2001, so few documents (or tools)
- use such characters in any case. </li>
-
- <li> Declarations following references to an undefined parameter
- entity reference are not ignored. (Not maintaining and using state
- about this validity error simplifies declaration handling; few
- XML parsers address this constraint in any case.) </li>
-
- <li> Well formedness constraints for general entity references
- are not enforced. (The code to handle the "content" production
- is merged with the element parsing code, making it hard to reuse
- for this additional situation.) </li>
-
-</ul>
-
-<p> When tested against the July 12, 1999 version of the OASIS
-XML Conformance test suite, an earlier version passed 1057 of 1067 tests.
-That contrasts with the original version, which passed 867. The
-current parser is top-ranked in terms of conformance, as is its
-validating sibling (which has some additional conformance violations
-imposed on it by SAX2 API deficiencies as well as some of the more
-curious SGML layering artifacts found in the XML specification). </p>
-
-<p> The XML 1.0 specification itself was not without problems,
-and after some delays the W3C has come out with a revised
-"second edition" specification. While that doesn't resolve all
-the problems identified the XML specification, many of the most
-egregious problems have been resolved. (You still need to drink
-magic Kool-Aid before some DTD-related issues make sense.)
-To the extent possible, this parser conforms to that second
-edition specification, and does well against corrected versions
-of the OASIS/NIST XML conformance test cases. See <a href=
-"http://xmlconf.sourceforge.net">http://xmlconf.sourceforge.net</a>
-for more information about SAX2/XML conformance testing. </p>
-
-
-<h3><a name="licensing">Licensing</a></h3>
-
-<p> As noted above, the original distribution was more or less
-public domain. The license had the constraint that modifications
-be clearly documented, as has been done here. </p>
-
-<p> This version is Copyright (c) 1999-2001 by David Brownell,
-and all the modifications are distributed under the GNU General
-Public License (GPL). It is subject to the "Library Exception",
-supporting use in some environments (such as embedded systems where
-dynamic linking may not be available) by proprietary code without
-necessarily requiring all code to be licencsed under the GPL.
-</p>
-
-
-<h2><a name="changes">Changes Since the last Microstar Release</a></h2>
-
-<p> As noted above, Microstar has not updated this parser since
-the summer of 1998, when it released version 1.2a on its web site.
-This release is intended to benefit the developer community by
-refocusing the API on SAX2, and improving conformance to the extent
-that most developers should not need to use another XML parser. </p>
-
-<p> The code has been cleaned up (referring to the XML 1.0 spec in
-all the production numbers in
-comments, rather than some preliminary draft, for one example) and
-has been sped up a bit as well.
-JAXP support has been added, although developers are still
-strongly encouraged to use the SAX2 APIs directly. </p>
-
-
-<h3><a name="sax2">SAX2 Support</a></h3>
-
-<p> The original version of &AElig;lfred did not support the
-SAX2 APIs. </p>
-
-<p> This version supports the SAX2 APIs, exposing the standard
-boolean feature descriptors. It supports the "DeclHandler" property
-to provide access to all DTD declarations not already exposed
-through the SAX1 API. The "LexicalHandler" property is supported,
-exposing entity boundaries (including the unnamed external subset) and
-things like comments and CDATA boundaries. SAX1 compatibility is
-currently provided.</p>
-
-
-<h3><a name="validation">Validation</a></h3>
-
-<p> In the 'pipeline' package in this same software distribution is an
-<a href="../pipeline/ValidationConsumer.html">XML Validation component</a>
-using any full SAX2 event stream (including all document type declarations)
-to validate. There is now a <a href="XmlReader.html">XmlReader</a> class
-which combines that class and this enhanced &AElig;lfred parser, creating
-an optionally validating SAX2 parser. </p>
-
-<p> As noted in the documentation for that validating component, certain
-validity constraints can't reliably be tested by a layered validator.
-These include all constraints relying on
-layering violations (exposing XML at the level of tokens or below,
-required since XML isn't a context-free grammar), some that
-SAX2 doesn't support, and a few others. The resulting validating
-parser is conformant enough for most applications that aren't doing
-strange SGML tricks with DTDs.
-Moreover, that validating filter can be used without
-a parser ... any application component that emits SAX event streams
-can DTD-validate its output on demand. </p>
-
-<h3><a name="smaller">You want Smaller?</a></h3>
-
-<p> You'll have noticed that the original version of &AElig;lfred
-had small size as a top goal. &AElig;lfred2 normally includes a
-DTD validation layer, but you can package without that.
-Similarly, JAXP factory support is available but optional.
-Then the main added cost due to this revision are for
-supporting the SAX2 API itself; DTD validation is as
-cleanly layered as allowed by SAX2.</p>
-
-<h3><a name="bugfixes">Bugs Fixed</a></h3>
-
-<p> Bugs fixed in &AElig;lfred2 include: </p>
-
-<ol>
- <li> Originally &AElig;lfred didn't close file descriptors, which
- led to file descriptor leakage on programs which ran for any
- length of time. </li>
-
- <li> NOTATION declarations without system identifiers are
- now handled correctly. </li>
-
- <li> DTD events are now reported for all invocations of a
- given parser, not just the first one. </li>
-
- <li> More correct character handling: <ul>
-
- <li> Rejects out-of-range characters, both in text and in
- character references. </li>
-
- <li> Correctly handles character references that expand to
- surrogate pairs. </li>
-
- <li> Correctly handles UTF-8 encodings of surrogate pairs. </li>
-
- <li> Correctly handles Unicode 3.1 rules about illegal UTF-8
- encodings: there is only one legal encoding per character. </li>
-
- <li> PUBLIC identifiers are now rejected if they have illegal
- characters. </li>
-
- <li> The parser is more correct about what characters are allowed
- in names and name tokens. Uses Unicode rules (built in to Java)
- rather than the voluminous XML rules, although some extensions
- have been made to match XML rules more closely.</li>
-
- <li> Line ends are now normalized to newlines in all known
- cases. </li>
-
- </ul></li>
-
- <li> Certain validity errors were previously treated as well
- formedness violations. <ul>
-
- <li> Repeated declarations of an element type are no
- longer fatal errors. </li>
-
- <li> Undeclared parameter entity references are no longer
- fatal errors. </li>
-
- </ul></li>
-
- <li> Attribute handling is improved: <ul>
-
- <li> Whitespace must exist between attributes. </li>
-
- <li> Only one value for a given attribute is permitted. </li>
-
- <li> ATTLIST declarations don't need to declare attributes. </li>
-
- <li> Attribute values are normalized when required. </li>
-
- <li> Tabs in attribute values are normalized to spaces. </li>
-
- <li> Attribute values containing a literal "&lt;" are rejected. </li>
-
- </ul></li>
-
- <li> More correct entity handling: <ul>
-
- <li> Whitespace must precede NDATA when declaring unparsed
- entities.</li>
-
- <li> Parameter entity declarations may not have NDATA annotations. </li>
-
- <li> The XML specification has a bug in that it doesn't specify
- that certain contexts exist within which parameter entity
- expansion must not be performed. Lacking an offical erratum,
- this parser now disables such expansion inside comments,
- processing instructions, ignored sections, public identifiers,
- and parts of entity declarations. </li>
-
- <li> Entity expansions that include quote characters no longer
- confuse parsing of strings using such expansions. </li>
-
- <li> Whitespace in the values of internal entities is not mapped
- to space characters. </li>
-
- <li> General Entity references in attribute defaults within the
- DTD now cause fatal errors when the entity is not defined at the
- time it is referenced. </li>
-
- <li> Malformed general entity references in entity declarations are
- now detected. </li>
-
- </ul></li>
-
- <li> Neither conditional sections
- nor parameter entity references within markup declarations
- are permitted in the internal subset. </li>
-
- <li> Processing instructions whose target names are "XML"
- (ignoring case) are now rejected. </li>
-
- <li> Comments may not include "--".</li>
-
- <li> Most "]]&gt;" sequences in text are rejected. </li>
-
- <li> Correct syntax for standalone declarations is enforced. </li>
-
- <li> Setting a locale for diagnostics only produces an exception
- if the language of that locale isn't English. </li>
-
- <li> Some more encoding names are recognized. These include the
- Unicode 3.0 variants of UTF-16 (UTF-16BE, UTF-16LE) as well as
- US-ASCII and a few commonly seen synonyms. </li>
-
- <li> Text (from character content, PIs, or comments) large enough
- not to fit into internal buffers is now handled correctly even in
- some cases which were originally handled incorrectly.</li>
-
- <li> Content is now reported for element types for which attributes
- have been declared, but no content model is known. (Such documents
- are invalid, but may still be well formed.) </li>
-
-</ol>
-
-<p> Other bugs may also have been fixed. </p>
-
-<p> For better overall validation support, some of the validity
-constraints that can't be verified using the SAX2 event stream
-are now reported directly by &AElig;lfred2. </p>
-
-</body></html>
-
diff --git a/external/jaxp/source/gnu/xml/dom/Consumer.java b/external/jaxp/source/gnu/xml/dom/Consumer.java
deleted file mode 100644
index b4e85a94f..000000000
--- a/external/jaxp/source/gnu/xml/dom/Consumer.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-
-package gnu.xml.dom;
-
-import java.io.IOException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.Attributes2;
-
-import gnu.xml.pipeline.DomConsumer;
-import gnu.xml.pipeline.EventConsumer;
-
-
-/**
- * Event consumer which constructs DOM documents using the implementation
- * in this package, using SAX2 events. This packages various backdoors
- * into this DOM implementation, as needed to address DOM requirements
- * that can't be met by strictly conforming implementations of DOM.
- *
- * <p> These requirements all relate to {@link DocumentType} nodes and
- * features of that node type. These features are normally not used,
- * because that interface only exposes a subset of the information found
- * in DTDs. More, that subset does not include the most important typing
- * information. For example, it excludes element content models and
- * attribute typing. It does expose some entity management issues,
- * although entity management doesn't relate to document typing.
- *
- * <p> Note that SAX2 does not expose the literal text of the DTD's
- * internal subset, so it will not be present in DOM trees constructed
- * using this API. (Though with a good SAX2 implementation, it could
- * be partially recreated...)
- *
- * @author David Brownell
- */
-public class Consumer extends DomConsumer
-{
- /**
- * Constructs an unconfigured event consumer,
- * as a terminus in a SAX event pipeline.
- */
- // used by PipelineFactory [terminus]
- public Consumer ()
- throws SAXException
- {
- super (DomDocument.class);
- setHandler (new Backdoor (this));
- }
-
- /**
- * Constructs an unconfigured event consumer,
- * as a stage in a SAX event pipeline.
- */
- // used by PipelineFactory [filter]
- public Consumer (EventConsumer next)
- throws SAXException
- {
- super (DomDocument.class, next);
- setHandler (new Backdoor (this));
- }
-
- /**
- * Implements the backdoors needed by DOM.
- * All methods in this class use implementation-specific APIs that are
- * implied by the DOM specification (needed to implement testable
- * behavior) but which are excluded from the DOM specification.
- */
- public static class Backdoor extends DomConsumer.Handler
- {
- /**
- * Constructor.
- * @param consumer must have been initialized to use the
- * {@link DomDocument} class (or a subclass) for
- * constructing DOM trees
- */
- protected Backdoor (DomConsumer consumer)
- throws SAXException
- { super (consumer); }
-
- // helper routine
- private DomDoctype getDoctype ()
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
- DocumentType dt = doc.getDoctype ();
-
- if (dt == null)
- throw new SAXException ("doctype missing!");
- return (DomDoctype) dt;
- }
-
- // SAX2 "lexical" event
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
-
- super.startDTD (name, publicId, systemId);
- // DOM L2 doctype creation model is bizarre
- doc.appendChild (new DomDoctype (doc, name, publicId, systemId));
- }
-
- // SAX2 "lexical" event
- public void endDTD ()
- throws SAXException
- {
- super.endDTD ();
- // DOM L2 has no way to make things readonly
- getDoctype ().makeReadonly ();
- }
-
- // SAX1 DTD event
- public void notationDecl (
- String name,
- String publicId, String systemId
- ) throws SAXException
- {
- // DOM L2 can't create/save notation nodes
- getDoctype ().declareNotation (name, publicId, systemId);
- }
-
- // SAX1 DTD event
- public void unparsedEntityDecl (
- String name,
- String publicId, String systemId,
- String notationName
- ) throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- getDoctype ().declareEntity (name, publicId, systemId,
- notationName);
- }
-
- // SAX2 declaration event
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- // NOTE: this doesn't save the value as a child of this
- // node, though it could realistically do so.
- getDoctype ().declareEntity (name, null, null, null);
- }
-
- // SAX2 declaration event
- public void externalEntityDecl (
- String name,
- String publicId,
- String systemId
- ) throws SAXException
- {
- // DOM L2 can't create/save entity nodes
- // NOTE: DOM allows for these to have children, if
- // they don't have unbound namespace references.
- getDoctype ().declareEntity (name, publicId, systemId, null);
- }
-
- // SAX2 element
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- Node top;
-
- super.startElement (uri, localName, qName, atts);
-
- // might there be more work?
- top = getTop ();
- if (!top.hasAttributes () || !(atts instanceof Attributes2))
- return;
-
- // remember any attributes that got defaulted
- DomNamedNodeMap map = (DomNamedNodeMap) top.getAttributes ();
- Attributes2 attrs = (Attributes2) atts;
- int length = atts.getLength ();
-
- map.compact ();
- for (int i = 0; i < length; i++) {
- if (attrs.isSpecified (i))
- continue;
-
- // value was defaulted.
- String temp = attrs.getQName (i);
- DomAttr attr;
-
- if ("".equals (temp))
- attr = (DomAttr) map.getNamedItemNS (attrs.getURI (i),
- atts.getLocalName (i));
- else
- attr = (DomAttr) map.getNamedItem (temp);
-
- // DOM L2 can't write this flag, only read it
- attr.setSpecified (false);
- }
- }
-
- public void endElement (
- String uri,
- String localName,
- String qName
- ) throws SAXException
- {
- DomNode top = (DomNode) getTop ();
- top.compact ();
- super.endElement (uri, localName, qName);
- }
-
- protected Text createText (
- boolean isCDATA,
- char buf [],
- int off,
- int len
- ) {
- DomDocument doc = (DomDocument) getDocument ();
-
- if (isCDATA)
- return doc.createCDATASection (buf, off, len);
- else
- return doc.createTextNode (buf, off, len);
- }
-
-
- public void attributeDecl (
- String ename,
- String aname,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
- if (value == null && !"ID".equals (type))
- return;
-
- DomDoctype.ElementInfo info;
-
- info = getDoctype ().getElementInfo (ename);
- if (value != null)
- info.setAttrDefault (aname, value);
- if ("ID".equals (type))
- info.setIdAttr (aname);
- }
-
- // force duplicate name checking off while we're
- // using parser output (don't duplicate the work)
- public void startDocument () throws SAXException
- {
- DomDocument doc;
-
- super.startDocument ();
- ((DomDocument) getDocument ()).setCheckingCharacters (false);
- }
-
- public void endDocument ()
- throws SAXException
- {
- DomDocument doc = (DomDocument) getDocument ();
- doc.setCheckingCharacters (true);
- doc.compact ();
- super.endDocument ();
- }
-
- // these three methods collaborate to populate entity
- // refs, marking contents readonly on end-of-entity
-
- public boolean canPopulateEntityRefs ()
- { return true; }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- super.startEntity (name);
-
- DomNode top = (DomNode) getTop ();
-
- if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE)
- top.readonly = false;
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- DomNode top = (DomNode) getTop ();
-
- if (top.getNodeType () == Node.ENTITY_REFERENCE_NODE) {
- top.compact ();
- top.makeReadonly ();
- }
- super.endEntity (name);
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomAttr.java b/external/jaxp/source/gnu/xml/dom/DomAttr.java
deleted file mode 100644
index 83361f982..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomAttr.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.MutationEvent;
-
-
-/**
- * <p> "Attr" implementation. In DOM, attributes cost quite a lot of
- * memory because their values are complex structures rather than just
- * simple strings. To reduce your costs, avoid having more than one
- * child of an attribute; stick to a single Text node child, and ignore
- * even that by using the attribute's "nodeValue" property.</p>
- *
- * <p> As a bit of general advice, only look at attribute modification
- * events through the DOMAttrModified event (sent to the associated
- * element). Implementations are not guaranteed to report other events
- * in the same order, so you're very likely to write nonportable code if
- * you monitor events at the "children of Attr" level.</p>
- *
- * <p> At this writing, not all attribute modifications will cause the
- * DOMAttrModified event to be triggered ... only the ones using the string
- * methods (setNodeValue, setValue, and Element.setAttribute) to modify
- * those values. That is, if you manipulate those children directly,
- * elements won't get notified that attribute values have changed.
- * The natural fix for that will report other modifications, but won't
- * be able to expose "previous" attribute value; it'll need to be cached
- * or something (at which point why bother using child nodes). </p>
- *
- * <p><em>You are strongly advised not to use "children" of any attribute
- * nodes you work with.</em> </p>
- *
- * @author David Brownell
- */
-public class DomAttr extends DomNsNode implements Attr
-{
- private boolean specified;
-
- // NOTE: it could be possible to rework this code a bit so that
- // this extra field isn't needed; "parent" might do double duty,
- // with appropriate safeguards. Using less space is healthy!
- private DomElement element;
-
-
- /**
- * Constructs an Attr node associated with the specified document.
- * The "specified" flag is initialized to true, since this DOM has
- * no current "back door" mechanisms to manage default values so
- * that every value must effectively be "specified".
- *
- * <p>This constructor should only be invoked by a Document as part of
- * its createAttribute functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this node is associated
- * @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of attribute
- * @param name Name of this attribute, which may include a prefix
- */
- protected DomAttr (Document owner, String namespaceURI, String name)
- {
- super (owner, namespaceURI, name);
- specified = true;
-
- // XXX register self to get insertion/removal events
- // and character data change events and when they happen,
- // report self-mutation
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the attribute name (same as getNodeName)
- */
- final public String getName ()
- {
- return getNodeName ();
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant ATTRIBUTE_NODE.
- */
- final public short getNodeType ()
- { return ATTRIBUTE_NODE; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns true if a parser reported this was in the source text.
- */
- final public boolean getSpecified ()
- {
- return specified;
- }
-
-
- /**
- * Records whether this attribute was in the source text.
- */
- final public void setSpecified (boolean value)
- {
- specified = value;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the attribute value, with character and entity
- * references substituted.
- * <em>NOTE: entity refs as children aren't currently handled.</em>
- */
- public String getNodeValue ()
- {
- int length = getLength ();
- String retval = null;
-
- for (int i = 0; i < length; i++) {
- Node n = item (i);
-
- if (n.getNodeType () == TEXT_NODE) {
- if (retval == null)
- retval = n.getNodeValue ();
- else
- retval += n.getNodeValue ();
- continue;
- }
-
- // XXX entity ref child of attribute
- // contents exclude comments, PIs, elements
- throw new DomEx (DomEx.NOT_SUPPORTED_ERR);
- }
- if (retval == null)
- retval = "";
- return retval;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Assigns the value of the attribute; it will have one child,
- * which is a text node with the specified value (same as
- * setNodeValue).
- */
- final public void setValue (String value)
- {
- setNodeValue (value);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the value of the attribute as a non-null string; same
- * as getNodeValue.
- * <em>NOTE: entity refs as children aren't currently handled.</em>
- */
- final public String getValue ()
- {
- return getNodeValue ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Assigns the attribute value; using this API, no entity or
- * character references will exist.
- * Causes a DOMAttrModified mutation event to be sent.
- */
- public void setNodeValue (String value)
- {
- int len = getLength ();
- String oldValue;
-
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
-
- oldValue = getValue ();
- for (int i = 0; i < len; i++)
- removeChild (getLastChild ());
- appendChild (getOwnerDocument ().createTextNode (value));
- specified = true;
-
- mutating (oldValue, value, MutationEvent.MODIFICATION);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the element with which this attribute is associated.
- */
- final public Element getOwnerElement ()
- {
- return element;
- }
-
-
- /**
- * Records the element with which this attribute is associated.
- */
- final public void setOwnerElement (Element e)
- {
- if (element != null)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR);
- if (!(e instanceof DomElement))
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR);
- element = (DomElement) e;
- }
-
-
- /**
- * Shallow clone of the attribute, breaking all ties with any
- * elements.
- */
- public Object clone ()
- {
- DomAttr retval = (DomAttr) super.clone ();
-
- retval.element = null;
- retval.specified = false;
- return retval;
- }
-
- private void mutating (String oldValue, String newValue, short why)
- {
- if (!reportMutations || element == null)
- return;
-
- // EVENT: DOMAttrModified, target = element,
- // prev/new values provided, also attr name
- MutationEvent event;
-
- event = (MutationEvent) createEvent ("MutationEvents");
- event.initMutationEvent ("DOMAttrModified",
- true /* bubbles */, false /* nocancel */,
- null, oldValue, newValue, getNodeName (), why);
- element.dispatchEvent (event);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomCDATA.java b/external/jaxp/source/gnu/xml/dom/DomCDATA.java
deleted file mode 100644
index 078f49412..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomCDATA.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "CDATASection" implementation.
- * This is a non-core DOM class, supporting the "XML" feature.
- * CDATA sections are just ways to represent text using different
- * delimeters. </p>
- *
- * <p> <em>You are strongly advised not to use CDATASection nodes.</em>
- * The advantage of having slightly prettier ways to print text that may
- * have lots of embedded XML delimiters, such as "&amp;" and "&lt;",
- * can be dwarfed by the cost of dealing with multiple kinds of text
- * nodes in all your algorithms. </p>
- *
- * @author David Brownell
- */
-public class DomCDATA extends DomText implements CDATASection
-{
- /**
- * Constructs a CDATA section node associated with the specified
- * document and holding the specified data.
- *
- * <p>This constructor should only be invoked by a Document as part of
- * its createCDATASection functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- */
- protected DomCDATA (Document owner, String value)
- {
- super (owner, value);
- }
-
- protected DomCDATA (Document owner, char buf [], int off, int len)
- {
- super (owner, buf, off, len);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the string "#cdata-section".
- */
- final public String getNodeName ()
- {
- return "#cdata-section";
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the constant CDATA_SECTION_NODE.
- */
- final public short getNodeType ()
- { return CDATA_SECTION_NODE; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomCharacterData.java b/external/jaxp/source/gnu/xml/dom/DomCharacterData.java
deleted file mode 100644
index 08c691ec1..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomCharacterData.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.MutationEvent;
-
-
-/**
- * <p> Abstract "CharacterData" implementation. This
- * facilitates reusing code in classes implementing subtypes of that DOM
- * interface (Text, Comment, CDATASection). </p>
- *
- * @author David Brownell
- */
-public abstract class DomCharacterData extends DomNode
- implements CharacterData
-{
- private char raw [];
-
- // package private
- DomCharacterData (Document doc, String value)
- {
- super (doc);
- if (value != null)
- raw = value.toCharArray ();
- else
- raw = new char [0];
- }
-
- // package private
- DomCharacterData (Document doc, char buf [], int offset, int length)
- {
- super (doc);
- if (buf == null)
- raw = new char [0];
- else {
- raw = new char [length];
- System.arraycopy (buf, offset, raw, 0, length);
- }
- }
-
- /**
- * <b>DOM L1</b>
- * Appends the specified data to the value of this node.
- * Causes a DOMCharacterDataModified mutation event to be reported.
- */
- public void appendData (String arg)
- {
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
-
- char tmp [] = arg.toCharArray ();
- char buf [] = new char [raw.length + tmp.length];
-
- System.arraycopy (raw, 0, buf, 0, raw.length);
- System.arraycopy (tmp, 0, buf, raw.length, tmp.length);
- mutating (new String (buf));
- raw = buf;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Modifies the value of this node.
- * Causes a DOMCharacterDataModified mutation event to be reported.
- */
- public void deleteData (int offset, int count)
- {
- char buf [];
-
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- if (offset < 0 || count < 0 || offset > raw.length)
- throw new DomEx (DomEx.INDEX_SIZE_ERR);
- if ((offset + count) > raw.length)
- count = raw.length - offset;
- if (count == 0)
- return;
- buf = new char [raw.length - count];
- System.arraycopy (raw, 0, buf, 0, offset);
- System.arraycopy (raw, offset + count, buf, offset,
- raw.length - (offset + count));
- mutating (new String (buf));
- raw = buf;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the value of this node.
- */
- public String getNodeValue ()
- {
- return new String (raw);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the value of this node; same as getNodeValue.
- */
- final public String getData ()
- {
- return getNodeValue ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the length of the data.
- */
- public int getLength ()
- {
- return raw.length;
- }
-
-
- static final class EmptyNodeList implements NodeList
- {
- public int getLength () { return 0; }
- public Node item (int i) { return null; }
- }
-
- static final EmptyNodeList theEmptyNodeList = new EmptyNodeList ();
-
-
- /**
- * <b>DOM L1</b>
- * Returns an empty list of children.
- */
- final public NodeList getChildNodes ()
- {
- return theEmptyNodeList;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Modifies the value of this node.
- */
- public void insertData (int offset, String arg)
- {
- char tmp [] = arg.toCharArray ();
- char buf [] = new char [raw.length + tmp.length];
-
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- try {
- System.arraycopy (raw, 0, buf, 0, offset);
- System.arraycopy (tmp, 0, buf, offset,
- tmp.length);
- System.arraycopy (raw, offset, buf, offset + tmp.length,
- raw.length - offset);
- mutating (new String (buf));
- raw = buf;
- } catch (IndexOutOfBoundsException x) {
- throw new DomEx (DomEx.INDEX_SIZE_ERR);
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Modifies the value of this node. Causes DOMCharacterDataModified
- * mutation events to be reported (at least one).
- */
- public void replaceData (int offset, int count, String arg)
- {
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
-
- // this could be rewritten to be faster,
- // and to report only one mutation event
- deleteData (offset, count);
- insertData (offset, arg);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Assigns the value of this node.
- * Causes a DOMCharacterDataModified mutation event to be reported.
- */
- public void setNodeValue (String value)
- {
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- if (value == null)
- value = "";
- mutating (value);
- raw = value.toCharArray ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Assigns the value of this node; same as setNodeValue.
- */
- final public void setData (String data)
- {
- setNodeValue (data);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the specified substring.
- */
- public String substringData (int offset, int count)
- {
- try {
- return new String (raw, offset, count);
- } catch (IndexOutOfBoundsException e) {
- if (offset >= 0 && count >= 0) {
- int len = raw.length;
- if (offset < len && (offset + count) > len)
- return new String (raw, offset, len - offset);
- }
- throw new DomEx (DomEx.INDEX_SIZE_ERR);
- }
- }
-
- private void mutating (String newValue)
- {
- if (!reportMutations)
- return;
-
- // EVENT: DOMCharacterDataModified, target = this,
- // prev/new values provided
- MutationEvent event;
-
- event = (MutationEvent) createEvent ("MutationEvents");
- event.initMutationEvent ("DOMCharacterDataModified",
- true /* bubbles */, false /* nocancel */,
- null, new String (raw), newValue, null, (short) 0);
- dispatchEvent (event);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomComment.java b/external/jaxp/source/gnu/xml/dom/DomComment.java
deleted file mode 100644
index 0596cc63b..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomComment.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "Comment" implementation.
- * Comments hold data intended for direct consumption by people;
- * programs should only use ProcessingInstruction nodes. Note that
- * since SAX makes comment reporting optional, XML systems that
- * rely on comments (such as by using this class) will often lose
- * those comments at some point in the processing pipeline. </p>
- *
- * @author David Brownell
- */
-public class DomComment extends DomCharacterData implements Comment
-{
- /**
- * Constructs a comment node associated with the specified
- * document and holding the specified data.
- *
- * <p>This constructor should only be invoked by a Document as part of
- * its createComment functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- */
- protected DomComment (Document owner, String value)
- {
- super (owner, value);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the string "#comment".
- */
- final public String getNodeName ()
- {
- return "#comment";
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant COMMENT_NODE.
- */
- final public short getNodeType ()
- { return COMMENT_NODE; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomDoctype.java b/external/jaxp/source/gnu/xml/dom/DomDoctype.java
deleted file mode 100644
index de8a476df..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomDoctype.java
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-import java.util.Hashtable;
-
-
-/**
- * <p> "DocumentType" implementation (with no extensions for supporting
- * any document typing information). This is a non-core DOM class,
- * supporting the "XML" feature. </p>
- *
- * <p> <em>Few XML applications will actually care about this partial
- * DTD support</em>, since it doesn't expose any (!) of the data typing
- * facilities which can motivate applications to use DTDs. It does not
- * expose element content models, or information about attribute typing
- * rules. Plus the information it exposes isn't very useful; as one example,
- * DOM exposes information about unparsed ENTITY objects, which is only used
- * with certain element attributes, but does not expose the information about
- * those attributes which is needed to apply that data! </p>
- *
- * <p> Also, note that there are no nonportable ways to associate even the
- * notation and entity information exposed by DOM with a DocumentType. While
- * there is a DOM L2 method to construct a DocumentType, it only gives access
- * to the textual content of the &lt;!DOCTYPE ...&gt; declaration. </p>
- *
- * <p> In short, <em>you are strongly advised not to rely on this incomplete
- * DTD functionality</em> in your application code.</p>
- *
- * @see DomEntity
- * @see DomEntityReference
- * @see DomNotation
- *
- * @author David Brownell
- */
-public class DomDoctype extends DomExtern implements DocumentType
-{
- private DomNamedNodeMap notations;
- private DomNamedNodeMap entities;
- private DOMImplementation implementation;
- private String subset;
-
- private Hashtable elements = new Hashtable ();
- private boolean ids;
-
-
- /**
- * Constructs a DocumentType node associated with the specified
- * implementation, with the specified name.
- *
- * <p>This constructor should only be invoked by a DOMImplementation as
- * part of its createDocumentType functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
- *
- * <p> Note that at this time there is no standard SAX API granting
- * access to the internal subset text, so that relying on that value
- * is not currently portable.
- *
- * @param impl The implementation with which this object is associated
- * @param name Name of this root element
- * @param publicId If non-null, provides the external subset's
- * PUBLIC identifier
- * @param systemId If non-null, provides the external subset's
- * SYSTEM identifier
- * @param internalSubset Provides the literal value (unparsed, no
- * entities expanded) of the DTD's internal subset.
- */
- protected DomDoctype (
- DOMImplementation impl,
- String name,
- String publicId,
- String systemId,
- String internalSubset
- )
- {
- super (null, name, publicId, systemId);
- implementation = impl;
- subset = internalSubset;
- }
-
- // package private
- // for JAXP-style builder backdoors
- DomDoctype (
- DomDocument doc,
- String name,
- String publicId,
- String systemId
- )
- {
- super (doc, name, publicId, systemId);
- implementation = doc.getImplementation ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the root element's name (just like getNodeName).
- */
- final public String getName () { return getNodeName (); }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant DOCUMENT_TYPE_NODE.
- */
- final public short getNodeType ()
- { return DOCUMENT_TYPE_NODE; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns information about any general entities declared
- * in the DTD.
- *
- * <p><em>Note: DOM L1 doesn't throw a DOMException here, but
- * then it doesn't have the strange construction rules of L2.</em>
- *
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public NamedNodeMap getEntities ()
- {
- if (entities == null) {
- if (getOwnerDocument () == null)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR);
- entities = new DomNamedNodeMap (getOwnerDocument ());
- }
- return entities;
- }
-
-
- /**
- * Records the declaration of a general entity in this DocumentType.
- *
- * @param name Name of the entity
- * @param publicId If non-null, provides the entity's PUBLIC identifier
- * @param systemId Provides the entity's SYSTEM identifier
- * @param notation If non-null, provides the entity's notation
- * (indicating an unparsed entity)
- * @return The Entity that was declared, or null if the entity wasn't
- * recorded (because it's a parameter entity or because an entity with
- * this name was already declared).
- *
- * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
- * DocumentType is no longer writable.
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public Entity declareEntity (
- String name,
- String publicId,
- String systemId,
- String notation
- )
- {
- DomEntity entity;
-
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return null;
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- getEntities ();
-
- DomDocument.verifyXmlName (name);
- if (entities.getNamedItem (name) != null)
- return null;
-
- entity = new DomEntity (getOwnerDocument (),
- name, publicId, systemId, notation);
- entities.setNamedItem (entity);
- return entity;
- }
-
- /**
- * <b>DOM L1</b>
- * Returns information about any notations declared in the DTD.
- *
- * <p><em>Note: DOM L1 doesn't throw a DOMException here, but
- * then it doesn't have the strange construction rules of L2.</em>
- *
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public NamedNodeMap getNotations ()
- {
- if (notations == null) {
- if (getOwnerDocument () == null)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR);
- notations = new DomNamedNodeMap (getOwnerDocument ());
- }
- return notations;
- }
-
-
- /**
- * Records the declaration of a notation in this DocumentType.
- *
- * @param name Name of the notation
- * @param publicId If non-null, provides the notation's PUBLIC identifier
- * @param systemId If non-null, provides the notation's SYSTEM identifier
- * @return The notation that was declared.
- *
- * @exception DOMException NO_MODIFICATION_ALLOWED_ERR if the
- * DocumentType is no longer writable.
- * @exception DOMException HIERARCHY_REQUEST_ERR if the DocumentType
- * is not associated with a document.
- */
- public Notation declareNotation (
- String name,
- String publicId,
- String systemId
- )
- {
- DomNotation notation;
-
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- getNotations ();
-
- DomDocument.verifyXmlName (name);
-
- notation = new DomNotation (getOwnerDocument (),
- name, publicId, systemId);
- notations.setNamedItem (notation);
- return notation;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the internal subset of the document, as a string of unparsed
- * XML declarations (and comments, PIs, whitespace); or returns null if
- * there is no such subset. There is no vendor-independent expectation
- * that this attribute be set, or that declarations found in it be
- * reflected in the <em>entities</em> or <em>notations</em> attributes
- * of this Document "Type" object.
- *
- * <p> Some application-specific XML profiles require that documents
- * only use specific PUBLIC identifiers, without an internal subset
- * to modify the interperetation of the declarations associated with
- * that PUBLIC identifier through some standard.
- */
- public String getInternalSubset ()
- {
- return subset;
- }
-
-
- /**
- * Sets the internal "readonly" flag so the node and its associated
- * data (only lists of entities and notations, no type information
- * at the moment) can't be changed.
- */
- public void makeReadonly ()
- {
- super.makeReadonly ();
- if (entities != null)
- entities.makeReadonly ();
- if (notations != null)
- notations.makeReadonly ();
- }
-
-
- /**
- * <b>DOM L2</b>
- * Consults the DOM implementation to determine if the requested
- * feature is supported.
- */
- final public boolean supports (String feature, String version)
- {
- return implementation.hasFeature (feature, version);
- }
-
-
- /**
- * Returns the implementation associated with this document type.
- */
- final public DOMImplementation getImplementation ()
- {
- return implementation;
- }
-
-
- // Yeech. Package-private hooks, I don't like this.
- // For all that it's better than making this stuff a
- // public API...
-
-
- // package private
- ElementInfo getElementInfo (String element)
- {
- ElementInfo info = (ElementInfo) elements.get (element);
-
- if (info != null)
- return info;
- info = new ElementInfo (this);
- elements.put (element, info);
- return info;
- }
-
- void setHasIds () { ids = true; }
- boolean hasIds () { return ids; }
-
- // package private
- static class ElementInfo extends Hashtable
- {
- private String idAttrName;
- private DomDoctype doctype;
-
- // is-a vs has-a ... just to minimize number of objects.
- // keys in table are attribute names, values are defaults.
-
- ElementInfo (DomDoctype dt) { super (5, 5); doctype = dt; }
-
- void setAttrDefault (String attName, String value)
- {
- if (getAttrDefault (attName) == null)
- put (attName, value);
- }
- String getAttrDefault (String attName)
- { return (String) get (attName); }
-
- void setIdAttr (String attName)
- {
- if (idAttrName == null)
- idAttrName = attName;
- doctype.setHasIds ();
- }
- String getIdAttr ()
- { return idAttrName; }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomDocument.java b/external/jaxp/source/gnu/xml/dom/DomDocument.java
deleted file mode 100644
index 5b7a1eeed..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomDocument.java
+++ /dev/null
@@ -1,789 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import java.util.Enumeration;
-
-import org.w3c.dom.*;
-import org.w3c.dom.traversal.*;
-
-
-/**
- * <p> "Document" and "DocumentTraversal" implementation.
- *
- * <p> Note that when this checks names for legality, it uses an
- * approximation of the XML rules, not the real ones. Specifically,
- * it uses Unicode rules, with sufficient tweaks to pass a majority
- * of basic XML conformance tests. (The huge XML character tables are
- * hairy to implement.)
- *
- * @author David Brownell
- */
-public class DomDocument extends DomNode
- implements Document, DocumentTraversal
-{
- private final DOMImplementation implementation;
- private boolean checkingCharacters = true;
-
- // package private
- final static String xmlNamespace =
- "http://www.w3.org/XML/1998/namespace";
- final static String xmlnsURI =
- "http://www.w3.org/2000/xmlns/";
-
-
- /**
- * Constructs a Document node, associating it with an instance
- * of the DomImpl class.
- *
- * <p> Note that this constructor disables character checking.
- * It is normally used when connecting a DOM to an XML parser,
- * and duplicating such checks is undesirable. When used for
- * purposes other than connecting to a parser, you should
- * re-enable that checking.
- *
- * @see #setCheckingCharacters
- */
- public DomDocument ()
- {
- super (null);
- implementation = new DomImpl ();
- }
-
-
- /**
- * Constructs a Document node, associating it with the specified
- * implementation. This should only be used in conjunction with
- * a specialized implementation; it will normally be called by
- * that implementation.
- *
- * @see DomImpl
- * @see #setCheckingCharacters
- */
- protected DomDocument (DOMImplementation impl)
- {
- super (null);
- implementation = impl;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the constant "#document".
- */
- final public String getNodeName ()
- {
- return "#document";
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant DOCUMENT_NODE.
- */
- final public short getNodeType ()
- { return DOCUMENT_NODE; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the document's root element, or null.
- */
- final public Element getDocumentElement ()
- {
- for (int i = 0; i < getLength (); i++) {
- Node n = item (i);
- if (n.getNodeType () == ELEMENT_NODE)
- return (Element) n;
- }
- return null;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the document's DocumentType, or null.
- */
- final public DocumentType getDoctype ()
- {
- for (int i = 0; i < getLength (); i++) {
- Node n = item (i);
- if (n.getNodeType () == DOCUMENT_TYPE_NODE)
- return (DocumentType) n;
- }
- return null;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the document's DOMImplementation.
- */
- final public DOMImplementation getImplementation ()
- {
- return implementation;
- }
-
-
- /**
- * <b>DOM L1 (relocated in DOM L2)</b>
- * Returns the element with the specified "ID" attribute, or null.
- *
- * <p>Returns null unless {@link Consumer} was used to populate internal
- * DTD declaration information, using package-private APIs. If that
- * internal DTD information is available, the document may be searched for
- * the element with that ID.
- */
- public Element getElementById (String id)
- {
- DomDoctype doctype = (DomDoctype) getDoctype ();
-
- if (doctype == null || !doctype.hasIds ()
- || id == null || id.length () == 0)
- return null;
-
- // yes, this is linear in size of document.
- // it'd be easy enough to maintain a hashtable.
- Node current = getDocumentElement ();
- Node temp;
-
- if (current == null)
- return null;
- while (current != this) {
- // done?
- if (current.getNodeType () == ELEMENT_NODE) {
- Element element = (Element) current;
- DomDoctype.ElementInfo info;
-
- info = doctype.getElementInfo (current.getNodeName ());
- if (id.equals (element.getAttribute (info.getIdAttr ())))
- return element;
- }
-
- // descend?
- if (current.hasChildNodes ()) {
- current = current.getFirstChild ();
- continue;
- }
-
- // lateral?
- temp = current.getNextSibling ();
- if (temp != null) {
- current = temp;
- continue;
- }
-
- // back up ...
- do {
- temp = current.getParentNode ();
- if (temp == null)
- return null;
- current = temp;
- temp = current.getNextSibling ();
- } while (temp == null);
- current = temp;
- }
- return null;
- }
-
-
- private void checkNewChild (Node newChild)
- {
- if (newChild.getNodeType () == ELEMENT_NODE
- && getDocumentElement () != null)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, null, newChild, 0);
- if (newChild.getNodeType () == DOCUMENT_TYPE_NODE
- && getDoctype () != null)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, null, newChild, 0);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Appends the specified node to this node's list of children,
- * enforcing the constraints that there be only one root element
- * and one document type child.
- */
- public Node appendChild (Node newChild)
- {
- checkNewChild (newChild);
- return super.appendChild (newChild);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Inserts the specified node in this node's list of children,
- * enforcing the constraints that there be only one root element
- * and one document type child.
- */
- public Node insertBefore (Node newChild, Node refChild)
- {
- checkNewChild (newChild);
- return super.insertBefore (newChild, refChild);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Replaces the specified node in this node's list of children,
- * enforcing the constraints that there be only one root element
- * and one document type child.
- */
- public Node replaceChild (Node newChild, Node refChild)
- {
- if (!(newChild.getNodeType () == ELEMENT_NODE
- && refChild.getNodeType () != ELEMENT_NODE)
- && !(newChild.getNodeType () == DOCUMENT_TYPE_NODE
- && refChild.getNodeType () != ELEMENT_NODE))
- checkNewChild (newChild);
- return super.replaceChild (newChild, refChild);
- }
-
-
- // NOTE: DOM can't really tell when the name of an entity,
- // notation, or PI must follow the namespace rules (excluding
- // colons) instead of the XML rules (which allow them without
- // much restriction). That's an API issue. verifyXmlName
- // aims to enforce the XML rules, not the namespace rules.
-
- /**
- * Throws a DOM exception if the specified name is not a legal XML 1.0
- * name. Actually this uses a very similar set of rules, closer to
- * Unicode rules than to the rules encoded in the large table at the
- * end of the XML 1.0 specification.
- *
- * @exception DomException INVALID_CHARACTER_ERR if the name isn't
- * legal as an XML name.
- */
- static public void verifyXmlName (String name)
- {
- char c;
- int len = name.length ();
-
- if (len == 0)
- throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0);
-
- // NOTE: these aren't really the XML rules, but they're
- // a close approximation that's simple to implement.
- c = name.charAt (0);
- if (!Character.isUnicodeIdentifierStart (c)
- && c != ':' && c != '_')
- throw new DomEx (DomEx.INVALID_CHARACTER_ERR,
- name, null, c);
- for (int i = 1; i < len; i++) {
- c = name.charAt (i);
- if (!Character.isUnicodeIdentifierPart (c)
- && c != ':'&& c != '_' && c != '.' && c != '-'
- && !isExtender (c))
- throw new DomEx (DomEx.INVALID_CHARACTER_ERR,
- name, null, c);
- }
- }
-
- static private boolean isExtender (char c)
- {
- // [88] Extender ::= ...
- return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
- || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309d && c <= 0x309e)
- || (c >= 0x30fc && c <= 0x30fe);
- }
-
- // package private
- static void verifyNamespaceName (String name)
- {
- int index = name.indexOf (':');
-
- if (index < 0) {
- verifyXmlName (name);
- return;
- }
- if (name.lastIndexOf (':') != index)
- throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0);
- verifyXmlName (name.substring (0, index));
- verifyXmlName (name.substring (index + 1));
- }
-
- // package private
- static void verifyXmlCharacters (String value)
- {
- int len = value.length ();
-
- for (int i = 0; i < len; i++) {
- char c = value.charAt (i);
-
- // assume surrogate pairing checks out OK, for simplicity
- if (c >= 0x0020 && c <= 0xFFFD)
- continue;
- if (c == '\n' || c == '\t' || c == '\r')
- continue;
-
- throw new DomEx (DomEx.INVALID_CHARACTER_ERR, value, null, c);
- }
- }
-
- // package private
- static void verifyXmlCharacters (char buf [], int off, int len)
- {
- for (int i = 0; i < len; i++) {
- char c = buf [off + i];
-
- // assume surrogate pairing checks out OK, for simplicity
- if (c >= 0x0020 && c <= 0xFFFD)
- continue;
- if (c == '\n' || c == '\t' || c == '\r')
- continue;
-
- throw new DomEx (DomEx.INVALID_CHARACTER_ERR,
- new String (buf, off, len), null, c);
- }
- }
-
-
- /**
- * Controls whether certain expensive checks, duplicating those that
- * conformant XML parsers must perform, are made.
- */
- final public void setCheckingCharacters (boolean value)
- {
- checkingCharacters = value;
- }
-
-
- /**
- * Returns true if certain expensive checks are performed.
- * Those checks are intended to reject illegal names, and characters
- * that are illegal as XML characters.
- */
- final public boolean isCheckingCharacters ()
- {
- return checkingCharacters;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created element with the specified name.
- */
- public Element createElement (String name)
- {
- Element element;
-
- if (checkingCharacters)
- verifyXmlName (name);
- if (name.startsWith ("xml:"))
- element = createElementNS (null, name);
- else
- element = new DomElement (this, null, name);
- defaultAttributes (element, name);
- return element;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns a newly created element with the specified name
- * and namespace information.
- */
- public Element createElementNS (String namespaceURI, String name)
- {
- if (checkingCharacters)
- verifyNamespaceName (name);
-
- if ("".equals (namespaceURI))
- namespaceURI = null;
- if (name.startsWith ("xml:")) {
- if (namespaceURI != null
- && !xmlNamespace.equals (namespaceURI))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xml namespace is always " + xmlNamespace, this, 0);
- namespaceURI = xmlNamespace;
- } else if (name.startsWith ("xmlns:"))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xmlns is reserved", this, 0);
- else if (namespaceURI == null && name.indexOf (':') != -1)
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "prefixed name needs a URI", this, 0);
-
- Element element = new DomElement (this, namespaceURI, name);
- defaultAttributes (element, name);
- return element;
- }
-
- private void defaultAttributes (Element element, String name)
- {
- DomDoctype doctype = (DomDoctype) getDoctype ();
- DomDoctype.ElementInfo info;
-
- if (doctype == null)
- return;
-
- // default any attributes that need it
- info = doctype.getElementInfo (name);
- for (Enumeration e = info.keys (); e.hasMoreElements (); /* NOP */) {
- String attr = (String) e.nextElement ();
- DomAttr node = (DomAttr) createAttribute (attr);
-
- node.setValue ((String) info.get (attr));
- node.setSpecified (false);
- element.setAttributeNode (node);
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created document fragment.
- */
- public DocumentFragment createDocumentFragment ()
- {
- return new DomFragment (this);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created text node with the specified value.
- */
- public Text createTextNode (String value)
- {
- if (checkingCharacters)
- verifyXmlCharacters (value);
- return new DomText (this, value);
- }
-
- /**
- * Returns a newly created text node with the specified value.
- */
- public Text createTextNode (char buf [], int off, int len)
- {
- if (checkingCharacters)
- verifyXmlCharacters (buf, off, len);
- return new DomText (this, buf, off, len);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created comment node with the specified value.
- */
- public Comment createComment (String value)
- {
- if (checkingCharacters)
- verifyXmlCharacters (value);
- return new DomComment (this, value);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created CDATA section node with the specified value.
- */
- public CDATASection createCDATASection (String value)
- {
- if (checkingCharacters)
- verifyXmlCharacters (value);
- return new DomCDATA (this, value);
- }
-
-
- /**
- * Returns a newly created CDATA section node with the specified value.
- */
- public CDATASection createCDATASection (char buf [], int off, int len)
- {
- if (checkingCharacters)
- verifyXmlCharacters (buf, off, len);
- return new DomCDATA (this, buf, off, len);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created processing instruction.
- */
- public ProcessingInstruction createProcessingInstruction (
- String target,
- String data
- )
- {
- if (checkingCharacters) {
- verifyXmlName (target);
- verifyXmlCharacters (data);
- if ("xml".equalsIgnoreCase (target))
- throw new DomEx (DomEx.SYNTAX_ERR,
- "illegal PI target name", this, 0);
- }
- return new DomPI (this, target, data);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created attribute with the specified name.
- */
- public Attr createAttribute (String name)
- {
- if (checkingCharacters)
- verifyXmlName (name);
- if (name.startsWith ("xml:") || name.startsWith ("xmlns:"))
- return createAttributeNS (null, name);
- else
- return new DomAttr (this, null, name);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns a newly created attribute with the specified name
- * and namespace information.
- */
- public Attr createAttributeNS (String namespaceURI, String name)
- {
- if (checkingCharacters)
- verifyNamespaceName (name);
-
- if ("".equals (namespaceURI))
- namespaceURI = null;
- if (name.startsWith ("xml:")) {
- if (namespaceURI == null)
- namespaceURI = xmlNamespace;
- else if (!xmlNamespace.equals (namespaceURI))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xml namespace is always " + xmlNamespace, this, 0);
- namespaceURI = xmlNamespace;
-
- } else if (name.startsWith ("xmlns:") || name.equals ("xmlns")) {
- if (!xmlnsURI.equals (namespaceURI))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xmlns is reserved", this, 0);
- namespaceURI = xmlnsURI;
-
- } else if (namespaceURI == null && name.indexOf (':') != -1)
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "prefixed name needs a URI: " + name, this, 0);
-
- return new DomAttr (this, namespaceURI, name);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a newly created reference to the specified entity.
- * The caller should populate this with the appropriate children
- * and then mark it as readonly.
- *
- * @see DomNode#makeReadonly
- */
- public EntityReference createEntityReference (String name)
- {
- DomEntityReference retval;
-
- if (checkingCharacters)
- verifyXmlName (name);
- retval = new DomEntityReference (this, name);
- //
- // If we have such an entity, it's allowed that one arrange that
- // the children of this reference be "the same as" (in an undefined
- // sense of "same", clearly not identity) the children of the entity.
- // That can be immediate or deferred. It's also allowed that nothing
- // be done -- we take that option here.
- //
- retval.makeReadonly ();
- return retval;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Makes a copy of the specified node, with all nodes "owned" by
- * this document and with children optionally copied. This type
- * of standard utility has become, well, a standard utility.
- *
- * <p> Note that EntityReference nodes created through this method (either
- * directly, or recursively) never have children, and that there is no
- * portable way to associate them with such children.
- *
- * <p> Note also that there is no requirement that the specified node
- * be associated with a different document. This differs from the
- * <em>cloneNode</em> operation in that the node itself is not given
- * an opportunity to participate, so that any information managed
- * by node subclasses will be lost.
- */
- public Node importNode (Node copiedNode, boolean deep)
- {
- switch (copiedNode.getNodeType ()) {
- case TEXT_NODE:
- return createTextNode (copiedNode.getNodeValue ());
- case CDATA_SECTION_NODE:
- return createCDATASection (copiedNode.getNodeValue ());
- case COMMENT_NODE:
- return createComment (copiedNode.getNodeValue ());
- case PROCESSING_INSTRUCTION_NODE:
- return createProcessingInstruction (
- copiedNode.getNodeName (),
- copiedNode.getNodeValue ());
- case NOTATION_NODE:
- {
- // NOTE: There's no standard way to create
- // these, or add them to a doctype. Useless.
- Notation node = (Notation) copiedNode;
- return new DomNotation (this, node.getNodeName (),
- node.getPublicId (), node.getSystemId ());
- }
- case ENTITY_NODE:
- {
- // NOTE: There's no standard way to create
- // these, or add them to a doctype. Useless.
- Entity node = (Entity) copiedNode;
-
- // FIXME if "deep", can/should copy children!
-
- return new DomEntity (this, node.getNodeName (),
- node.getPublicId (), node.getSystemId (),
- node.getNotationName ());
- }
- case ENTITY_REFERENCE_NODE:
- return createEntityReference (copiedNode.getNodeName ());
- case DOCUMENT_FRAGMENT_NODE:
- {
- DocumentFragment node = createDocumentFragment ();
- if (deep) {
- NodeList kids = copiedNode.getChildNodes ();
- int len = kids.getLength ();
- for (int i = 0; i < len; i++)
- node.appendChild (
- importNode (kids.item (i), deep));
- }
- return node;
- }
- case ATTRIBUTE_NODE:
- {
- DomAttr retval;
- String name = copiedNode.getNodeName ();
- String ns = copiedNode.getNamespaceURI ();
- NodeList kids = copiedNode.getChildNodes ();
- int len = kids.getLength ();
-
- if (ns != null)
- retval = (DomAttr) createAttributeNS (ns, name);
- else
- retval = (DomAttr) createAttribute (name);
-
- // this is _always_ done regardless of "deep" setting
- for (int i = 0; i < len; i++)
- retval.appendChild (importNode (kids.item (i), false));
- return retval;
- }
- case ELEMENT_NODE:
- {
- DomElement retval;
- String name = copiedNode.getNodeName ();
- String ns = copiedNode.getNamespaceURI ();
- NamedNodeMap attrs = copiedNode.getAttributes ();
- int len = attrs.getLength ();
-
- if (ns != null)
- retval = (DomElement) createElementNS (ns, name);
- else
- retval = (DomElement) createElement (name);
- for (int i = 0; i < len; i++) {
- Attr attr = (Attr) attrs.item (i);
- Attr dflt;
-
- // maybe update defaulted attributes
- dflt = retval.getAttributeNode (attr.getNodeName ());
- if (dflt != null) {
- String newval = attr.getNodeValue ();
- if (!dflt.getNodeValue ().equals (newval)
- || attr.getSpecified () == true)
- dflt.setNodeValue (newval);
- continue;
- }
-
- retval.setAttributeNode ((Attr)
- importNode (attr, false));
- }
-
- if (!deep)
- return retval;
-
- NodeList kids = copiedNode.getChildNodes ();
-
- len = kids.getLength ();
- for (int i = 0; i < len; i++)
- retval.appendChild (importNode (kids.item (i), true));
-
- return retval;
- }
-
- // can't import document or doctype nodes
- case DOCUMENT_NODE:
- case DOCUMENT_TYPE_NODE:
- // FALLTHROUGH
-
- // can't import unrecognized or nonstandard nodes
- default:
- throw new DomEx (DomEx.NOT_SUPPORTED_ERR, null, copiedNode, 0);
- }
-
- // FIXME cleanup a bit -- for deep copies, copy those
- // children in one place, here (code sharing is healthy)
- }
-
-
- /**
- * <b>DOM L2 (Traversal)</b>
- * Returns a newly created node iterator. Don't forget to detach
- * this iterator when you're done using it!
- *
- * @see DomIterator
- */
- public NodeIterator createNodeIterator (
- Node root,
- int whatToShow,
- NodeFilter filter,
- boolean expandEntities
- )
- {
- return new DomIterator (root, whatToShow, filter, expandEntities);
- }
-
-
-
- public TreeWalker createTreeWalker (
- Node root,
- int whatToShow,
- NodeFilter filter,
- boolean entityReferenceExpansion
- )
- {
-nyi (); // FIXME createTreeWalker
- return null;
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomElement.java b/external/jaxp/source/gnu/xml/dom/DomElement.java
deleted file mode 100644
index 61f442132..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomElement.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "Element" implementation.
- *
- * @author David Brownell
- */
-public class DomElement extends DomNsNode implements Element
-{
- // Attributes are VERY expensive in DOM, and not just for
- // this implementation. Avoid creating them.
- private DomNamedNodeMap attributes;
-
-
- /**
- * Constructs an Element node associated with the specified document.
- *
- * <p>This constructor should only be invoked by a Document as part
- * of its createElement functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this node is associated
- * @param namespaceURI Combined with the local part of the name,
- * this is used to uniquely identify a type of element
- * @param name Name of this element, which may include a prefix
- */
- protected DomElement (Document owner, String namespaceURI, String name)
- {
- super (owner, namespaceURI, name);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the element's attributes
- */
- public NamedNodeMap getAttributes ()
- {
- if (attributes == null)
- attributes = new DomNamedNodeMap (getOwnerDocument (), this);
- return attributes;
- }
-
-
- /**
- * <b>DOM L2></b>
- * Returns true iff this is an element node with attributes.
- */
- public boolean hasAttributes ()
- { return attributes != null && attributes.getLength () != 0; }
-
-
- /**
- * Shallow clone of the element, except that associated
- * attributes are (deep) cloned.
- */
- public Object clone ()
- {
- DomElement retval = (DomElement) super.clone ();
- DomNamedNodeMap atts;
-
- if (attributes == null)
- return retval;
-
- atts = new DomNamedNodeMap (getOwnerDocument (), retval);
- retval.attributes = atts;
- for (int i = 0; i < attributes.getLength (); i++) {
- Node temp = attributes.item (i);
-
- temp = temp.cloneNode (true);
- atts.setNamedItem (temp);
- }
- return retval;
- }
-
-
- /**
- * Marks this element, its children, and its associated attributes as
- * readonly.
- */
- public void makeReadonly ()
- {
- super.makeReadonly ();
- if (attributes != null)
- attributes.makeReadonly ();
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the element name (same as getNodeName).
- */
- final public String getTagName ()
- {
- return getNodeName ();
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant ELEMENT_NODE.
- */
- final public short getNodeType ()
- { return ELEMENT_NODE; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the value of the specified attribute, or an
- * empty string.
- */
- public String getAttribute (String name)
- {
- Attr attr = getAttributeNode (name);
-
- if (attr == null)
- return "";
- else
- return attr.getValue ();
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns true if the element has an attribute with the
- * specified name (specified or DTD defaulted).
- */
- public boolean hasAttribute (String name)
- {
- return getAttributeNode (name) != null;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns true if the element has an attribute with the
- * specified name (specified or DTD defaulted).
- */
- public boolean hasAttributeNS (String namespaceURI, String local)
- {
- return getAttributeNodeNS (namespaceURI, local) != null;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the value of the specified attribute, or an
- * empty string.
- */
- public String getAttributeNS (String namespaceURI, String local)
- {
- Attr attr = getAttributeNodeNS (namespaceURI, local);
-
- if (attr == null)
- return "";
- else
- return attr.getValue ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the appropriate attribute node; the name is the
- * nodeName property of the attribute.
- */
- public Attr getAttributeNode (String name)
- {
- if (attributes == null)
- return null;
-
- return (Attr) attributes.getNamedItem (name);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the appropriate attribute node; the name combines
- * the namespace name and the local part.
- */
- public Attr getAttributeNodeNS (String namespace, String localPart)
- {
- if (attributes == null)
- return null;
-
- return (Attr) attributes.getNamedItemNS (namespace, localPart);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Modifies an existing attribute to have the specified value,
- * or creates a new one with that value. The name used is the
- * nodeName value.
- */
- public void setAttribute (String name, String value)
- {
- Attr attr = getAttributeNode (name);
-
- if (attr != null) {
- attr.setNodeValue (value);
- return;
- }
- attr = getOwnerDocument ().createAttribute (name);
- attr.setNodeValue (value);
- setAttributeNode (attr);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Modifies an existing attribute to have the specified value,
- * or creates a new one with that value.
- */
- public void setAttributeNS (String uri, String aname, String value)
- {
- if (("xmlns".equals (aname) || aname.startsWith ("xmlns:"))
- && !DomDocument.xmlnsURI.equals (uri))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "setting xmlns attribute to illegal value", this, 0);
-
- Attr attr = getAttributeNodeNS (uri, aname);
-
- if (attr != null) {
- attr.setNodeValue (value);
- return;
- }
- attr = getOwnerDocument ().createAttributeNS (uri, aname);
- attr.setNodeValue (value);
- setAttributeNodeNS (attr);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Stores the specified attribute, optionally overwriting any
- * existing one with that name.
- */
- public Attr setAttributeNode (Attr attr)
- {
- return (Attr) getAttributes ().setNamedItem (attr);
- }
-
- /**
- * <b>DOM L2</b>
- * Stores the specified attribute, optionally overwriting any
- * existing one with that name.
- */
- public Attr setAttributeNodeNS (Attr attr)
- {
- return (Attr) getAttributes ().setNamedItemNS (attr);
- }
-
- /**
- * <b>DOM L1</b>
- * Removes the appropriate attribute node.
- * If there is no such node, this is (bizarrely enough) a NOP so you
- * won't see exceptions if your code deletes non-existent attributes.
- *
- * <p>Note that since there is no portable way for DOM to record
- * DTD information, default values for attributes will never be
- * provided automatically.
- */
- public void removeAttribute (String name)
- {
- if (attributes == null)
- return;
- // throw new DomEx (DomEx.NOT_FOUND_ERR, name, null, 0);
-
- try {
- attributes.removeNamedItem (name);
- } catch (DomEx e) {
- if (e.code == DomEx.NOT_FOUND_ERR)
- return;
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Removes the appropriate attribute node; the name is the
- * nodeName property of the attribute.
- *
- * <p>Note that since there is no portable way for DOM to record
- * DTD information, default values for attributes will never be
- * provided automatically.
- */
- public Attr removeAttributeNode (Attr node)
- {
- if (attributes == null)
- throw new DomEx (DomEx.NOT_FOUND_ERR, null, node, 0);
-
- return (Attr) attributes.removeNamedItem (node.getNodeName ());
- }
-
-
- /**
- * <b>DOM L2</b>
- * Removes the appropriate attribute node; the name combines
- * the namespace name and the local part.
- *
- * <p>Note that since there is no portable way for DOM to record
- * DTD information, default values for attributes will never be
- * provided automatically.
- */
- public void removeAttributeNS (String namespace, String localPart)
- {
- if (attributes == null)
- throw new DomEx (DomEx.NOT_FOUND_ERR, localPart, null, 0);
-
- attributes.removeNamedItemNS (namespace, localPart);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomEntity.java b/external/jaxp/source/gnu/xml/dom/DomEntity.java
deleted file mode 100644
index 38ebfab02..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomEntity.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "Entity" implementation. This is a non-core DOM class, supporting the
- * "XML" feature. There are two types of entities, neither of which works
- * particularly well in this API:</p><dl>
- *
- * <dt><em>Unparsed Entities</em></dt>
- * <dd>Since ENTITY/ENTITIES attributes, the only legal use of unparsed
- * entities in XML, can't be detected with DOM, there isn't much point in
- * trying to use unparsed entities in DOM applications. (XML Linking is
- * working to provide a better version of this functionality.) </dd>
- *
- * <dt><em>Parsed Entities</em></dt>
- * <dd> While the DOM specification permits nodes for parsed entities
- * to have a readonly set of children, this is not required and there
- * is no portable way to provide such children. <em>This implementation
- * currently does not permit children to be added to Entities.</em>
- * There are related issues with the use of EntityReference nodes. </dd>
- *
- * </dl>
- *
- * <p> In short, <em>avoid using this DOM functionality</em>.
- *
- * @see DomDoctype
- * @see DomEntityReference
- * @see DomNotation
- *
- * @author David Brownell
- */
-public class DomEntity extends DomExtern implements Entity
-{
- private String notation;
-
-
- /**
- * Constructs an Entity node associated with the specified document,
- * with the specified descriptive data.
- *
- * <p>This constructor should only be invoked by a DomDoctype as part
- * of its declareEntity functionality, or through a subclass which is
- * similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this entity is associated
- * @param name Name of this entity
- * @param publicId If non-null, provides the entity's PUBLIC identifier
- * @param systemId Provides the entity's SYSTEM identifier (URI)
- * @param notation If non-null, provides the unparsed entity's notation.
- */
- protected DomEntity (
- Document owner,
- String name,
- String publicId,
- String systemId,
- String notation
- )
- {
- super (owner, name, publicId, systemId);
- this.notation = notation;
-
- // NOTE: if notation == null, this is a parsed entity
- // which could reasonably be given child nodes ...
- makeReadonly ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the NOTATION identifier associated with this entity, if any.
- */
- final public String getNotationName ()
- {
- return notation;
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant ENTITY_NODE.
- */
- final public short getNodeType ()
- { return ENTITY_NODE; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomEntityReference.java b/external/jaxp/source/gnu/xml/dom/DomEntityReference.java
deleted file mode 100644
index 6868f9976..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomEntityReference.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "EntityReference" implementation (reference to parsed entity).
- * This is a non-core DOM class, supporting the "XML" feature.
- * It does not represent builtin entities (such as "&amp;amp;")
- * or character references, which are always directly expanded in
- * DOM trees.</p>
- *
- * <p> Note that while the DOM specification permits these nodes to have
- * a readonly set of children, this is not required. Similarly, it does
- * not require a DOM to couple EntityReference nodes with any Entity nodes
- * that have the same entity name (and equivalent children). It also
- * effectively guarantees that references created directly or indirectly
- * through the <em>Document.ImportNode</em> method will not have children.
- * The level of functionality you may get is extremely variable.
- *
- * <p> Also significant is that even at their most functional level, the fact
- * that EntityReference children must be readonly has caused significant
- * problems when modifying work products held in DOM trees. Other problems
- * include issues related to undeclared namespace prefixes (and references
- * to the current default namespace) that may be found in the text of such
- * parsed entities nodes. These must be contextually bound as part of DOM
- * tree construction. When such nodes are moved, the namespace associated
- * with a given prefix (or default) may change to be in conflict with the
- * namespace bound to the node at creation time.
- *
- * <p> In short, <em>avoid using this DOM functionality</em>.
- *
- * @see DomDoctype
- * @see DomEntity
- *
- * @author David Brownell
- */
-public class DomEntityReference extends DomNode implements EntityReference
-{
- private String name;
-
-
- /**
- * Constructs an EntityReference node associated with the specified
- * document. The creator should populate this with whatever contents
- * are appropriate, and then mark it as readonly.
- *
- * <p>This constructor should only be invoked by a Document as part of
- * its createEntityReference functionality, or through a subclass which
- * is similarly used in a "Sub-DOM" style layer.
- *
- * @see DomNode#makeReadonly
- */
- protected DomEntityReference (Document owner, String name)
- {
- super (owner);
- this.name = name;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the name of the referenced entity.
- */
- final public String getNodeName ()
- {
- return name;
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant ENTITY_REFERENCE_NODE.
- */
- final public short getNodeType ()
- { return ENTITY_REFERENCE_NODE; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomEvent.java b/external/jaxp/source/gnu/xml/dom/DomEvent.java
deleted file mode 100644
index 2902363f9..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomEvent.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.*;
-import org.w3c.dom.views.AbstractView; // used by UIEvent
-
-
-/**
- * "Event" implementation. Events are
- * created (through DocumentEvent interface methods on the document object),
- * and are sent to any target node in the document.
- *
- * <p> Applications may define application specific event subclasses, but
- * should otherwise use the <em>DocumentTraversal</em> interface to acquire
- * event objects.
- *
- * @author David Brownell
- */
-public class DomEvent implements Event
-{
- String type; // init
- EventTarget target;
- EventTarget currentNode;
- short eventPhase;
- boolean bubbles; // init
- boolean cancelable; // init
- long timeStamp; // ?
-
- /** Returns the event's type (name) as initialized */
- final public String getType () { return type; }
-
- /**
- * Returns event's target; delivery of an event is initiated
- * by a <em>target.dispatchEvent(event)</em> invocation.
- */
- final public EventTarget getTarget () { return target; }
-
- /**
- * Returns the target to which events are currently being
- * delivered. When capturing or bubbling, this will not
- * be what <em>getTarget</em> returns.
- */
- final public EventTarget getCurrentTarget () { return currentNode; }
-
- /**
- * Returns CAPTURING_PHASE, AT_TARGET, or BUBBLING;
- * only meaningful within EventListener.handleEvent
- */
- final public short getEventPhase () { return eventPhase; }
-
- /**
- * Returns true if the news of the event bubbles to tree tops
- * (as specified during initialization).
- */
- final public boolean getBubbles () { return bubbles; }
-
- /**
- * Returns true if the default handling may be canceled
- * (as specified during initialization).
- */
- final public boolean getCancelable () { return cancelable; }
-
- /**
- * Returns the event's timestamp.
- */
- final public long getTimeStamp () { return timeStamp; }
-
- boolean stop;
- boolean doDefault;
-
-
- /**
- * Requests the event no longer be captured or bubbled; only
- * listeners on the event target will see the event, if they
- * haven't yet been notified.
- *
- * <p> <em> Avoid using this </em> except for application-specific
- * events, for which you the protocol explicitly "blesses" the use
- * of this with some event types. Otherwise, you are likely to break
- * algorithms which depend on event notification either directly or
- * through bubbling or capturing. </p>
- *
- * <p> Note that this method is not final, specifically to enable
- * enforcing of policies about events always propagating. </p>
- */
- public void stopPropagation () { stop = true; }
-
-
- /**
- * Requests that whoever dispatched the event not perform their
- * default processing when event delivery completes. Initializes
- * event timestamp.
- */
- final public void preventDefault () { doDefault = false; }
-
- /** Initializes basic event state. */
- public void initEvent (
- String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg
- ) {
- eventPhase = 0;
- type = typeArg;
- bubbles = canBubbleArg;
- cancelable = cancelableArg;
- timeStamp = System.currentTimeMillis ();
- }
-
- /** Constructs, but does not initialize, an event. */
- public DomEvent (String type) { this.type = type; }
-
- /**
- * Returns a basic printable description of the event's type,
- * state, and delivery conditions
- */
- public String toString ()
- {
- StringBuffer buf = new StringBuffer ("[Event ");
- buf.append (type);
- switch (eventPhase) {
- case CAPTURING_PHASE: buf.append (", CAPTURING"); break;
- case AT_TARGET: buf.append (", AT TARGET"); break;
- case BUBBLING_PHASE: buf.append (", BUBBLING"); break;
- default: buf.append (", (inactive)"); break;
- }
- if (bubbles && eventPhase != BUBBLING_PHASE)
- buf.append (", bubbles");
- if (cancelable)
- buf.append (", can cancel");
- // were we to provide subclass info, this's where it'd live
- buf.append ("]");
- return buf.toString ();
- }
-
-
- /**
- * "MutationEvent" implementation.
- */
- public static final class DomMutationEvent extends DomEvent
- implements MutationEvent
- {
- // package private
- Node relatedNode; // init
-
- private String prevValue; // init
- private String newValue; // init
-
- private String attrName; // init
- private short attrChange; // init
-
- /** Returns any "related" node provided by this type of event */
- final public Node getRelatedNode () { return relatedNode; }
- /** Returns any "previous value" provided by this type of event */
- final public String getPrevValue () { return prevValue; }
- /** Returns any "new value" provided by this type of event */
- final public String getNewValue () { return newValue; }
-
- /** For attribute change events, returns the attribute's name */
- final public String getAttrName () { return attrName; }
- /** For attribute change events, returns how the attribuet changed */
- final public short getAttrChange () { return attrChange; }
-
- /** Initializes a mutation event */
- public final void initMutationEvent (
- String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- Node relatedNodeArg,
- String prevValueArg,
- String newValueArg,
- String attrNameArg,
- short attrChangeArg
- ) {
- // super.initEvent is inlined here for speed
- // (mutation events are issued on all DOM changes)
- eventPhase = 0;
- type = typeArg;
- bubbles = canBubbleArg;
- cancelable = cancelableArg;
- timeStamp = System.currentTimeMillis ();
-
- relatedNode = relatedNodeArg;
- prevValue = prevValueArg;
- newValue = newValueArg;
- attrName = attrNameArg;
- attrChange = attrChangeArg;
- }
-
- // clear everything that should be GC-able
- void clear ()
- {
- type = null;
- target = null;
- relatedNode = null;
- currentNode = null;
- prevValue = newValue = attrName = null;
- }
-
- /** Constructs an uninitialized mutation event. */
- public DomMutationEvent (String type) { super (type); }
- }
-
-
- /**
- * "UIEvent" implementation.
- */
- public static class DomUIEvent extends DomEvent
- implements UIEvent
- {
- private AbstractView view; // init
- private int detail; // init
-
- /** Constructs an uninitialized User Interface (UI) event */
- public DomUIEvent (String type) { super (type); }
-
- final public AbstractView getView () { return view; }
- final public int getDetail () { return detail; }
-
- /** Initializes a UI event */
- final public void initUIEvent (
- String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg
- ) {
- super.initEvent (typeArg, canBubbleArg, cancelableArg);
- view = viewArg;
- detail = detailArg;
- }
- }
-
-
- /*
-
- static final class DomMouseEvent extends DomUIEvent
- implements MouseEvent
- {
- // another half dozen state variables/accessors
- }
-
- */
-
-}
-
diff --git a/external/jaxp/source/gnu/xml/dom/DomEx.java b/external/jaxp/source/gnu/xml/dom/DomEx.java
deleted file mode 100644
index 121f23c4f..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomEx.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> DOMException implementation. The version that
- * is provided by the W3C is abstract, so it can't be instantiated.
- *
- * <p> This also provides a bit more information about the error
- * that is being reported, in terms of the relevant DOM structures
- * and data.
- *
- * @author David Brownell
- */
-public class DomEx extends DOMException
-{
- /** @serial Data that caused an error to be reported */
- private String data;
-
- /** @serial Node associated with the error. */
- private Node node;
-
- /** @serial Data associated with the error. */
- private int value;
-
- /**
- * Constructs an exception, with the diagnostic message
- * corresponding to the specified code.
- */
- public DomEx (short code)
- {
- super (code, diagnostic (code));
- }
-
- /**
- * Constructs an exception, with the diagnostic message
- * corresponding to the specified code and additional
- * information as provided.
- */
- public DomEx (short code, String data, Node node, int value)
- {
- super (code, diagnostic (code));
- this.data = data;
- this.node = node;
- this.value = value;
- }
-
- /** Returns the node to which the diagnotic applies, or null. */
- final public Node getNode () { return node; }
-
- /** Returns data to which the diagnotic applies, or null. */
- final public String getData () { return data; }
-
- /** Returns data to which the diagnotic applies, or null. */
- final public int getValue () { return value; }
-
-
- /**
- * Returns a diagnostic message that may be slightly more useful
- * than the generic one, where possible.
- */
- public String getMessage ()
- {
- String retval = super.getMessage ();
-
- if (data != null)
- retval += "\nMore Information: " + data;
- if (value != 0)
- retval += "\nNumber: " + value;
- if (node != null)
- retval += "\nNode Name: " + node.getNodeName ();
- return retval;
- }
-
-
- // these strings should be localizable.
-
- private static String diagnostic (short code)
- {
- switch (code) {
-
- // DOM L1:
- case INDEX_SIZE_ERR:
- return "An index or size is out of range.";
- case DOMSTRING_SIZE_ERR:
- return "A string is too big.";
- case HIERARCHY_REQUEST_ERR:
- return "The node doesn't belong here.";
- case WRONG_DOCUMENT_ERR:
- return "The node belongs in another document.";
- case INVALID_CHARACTER_ERR:
- return "That character is not permitted.";
- case NO_DATA_ALLOWED_ERR:
- return "This node does not permit data.";
- case NO_MODIFICATION_ALLOWED_ERR:
- return "No changes are allowed.";
- case NOT_FOUND_ERR:
- return "The node was not found in that context.";
- case NOT_SUPPORTED_ERR:
- return "That object is not supported.";
- case INUSE_ATTRIBUTE_ERR:
- return "The attribute belongs to a different element.";
-
- // DOM L2:
- case INVALID_STATE_ERR:
- return "The object is not usable.";
- case SYNTAX_ERR:
- return "An illegal string was provided.";
- case INVALID_MODIFICATION_ERR:
- return "An object's type may not be changed.";
- case NAMESPACE_ERR:
- return "The operation violates XML Namespaces.";
- case INVALID_ACCESS_ERR:
- return "Parameter or operation isn't supported by this node.";
- }
- return "Reserved exception number: " + code;
- }
-
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomExtern.java b/external/jaxp/source/gnu/xml/dom/DomExtern.java
deleted file mode 100644
index 273905f40..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomExtern.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> Abstract implemention of nodes describing external DTD-related
- * objects. This facilitates reusing code for Entity, Notation, and
- * DocumentType (really, external subset) nodes. Such support is not
- * part of the core DOM; it's for the "XML" feature. </p>
- *
- * <p> Note that you are strongly advised to avoid using the DOM
- * features that take advantage of this class, since (as of L2) none
- * of them is defined fully enough to permit full use of the
- * XML feature they partially expose. </p>
- *
- * @author David Brownell
- */
-public abstract class DomExtern extends DomNode
-{
- private String name;
- private String publicId;
- private String systemId;
-
-
- /**
- * Constructs a node associated with the specified document,
- * with the specified descriptive data.
- *
- * @param owner The document with which this object is associated
- * @param name Name of this object
- * @param publicId If non-null, provides the entity's PUBLIC identifier
- * @param systemId If non-null, provides the entity's SYSTEM identifier
- */
- // package private
- DomExtern (
- Document owner,
- String name,
- String publicId,
- String systemId
- )
- {
- super (owner);
- this.name = name;
- this.publicId = publicId;
- this.systemId = systemId;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the SYSTEM identifier associated with this object, if any.
- */
- final public String getSystemId ()
- {
- return systemId;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the PUBLIC identifier associated with this object, if any.
- */
- final public String getPublicId ()
- {
- return publicId;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the object's name.
- */
- final public String getNodeName ()
- {
- return name;
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomFragment.java b/external/jaxp/source/gnu/xml/dom/DomFragment.java
deleted file mode 100644
index 32c28d0ea..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomFragment.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "DocumentFragment" implementation. </p>
- *
- * @author David Brownell
- */
-public class DomFragment extends DomNode implements DocumentFragment
-{
- /**
- * Constructs a DocumentFragment node associated with the
- * specified document.
- *
- * <p>This constructor should only be invoked by a Document as part of
- * its createDocumentFragment functionality, or through a subclass which
- * is similarly used in a "Sub-DOM" style layer.
- */
- protected DomFragment (Document owner)
- {
- super (owner);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the string "#document-fragment".
- */
- final public String getNodeName ()
- {
- return "#document-fragment";
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant DOCUMENT_FRAGMENT_NODE.
- */
- final public short getNodeType ()
- { return DOCUMENT_FRAGMENT_NODE; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomImpl.java b/external/jaxp/source/gnu/xml/dom/DomImpl.java
deleted file mode 100644
index 1e7ec6af8..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import java.util.Vector;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "DOMImplementation" implementation. </p>
- *
- * <p> At this writing, the following features are supported: "XML" (L1, L2),
- * "Events" (L2), "MutationEvents" (L2), "USER-Events" (a conformant extension),
- * "HTMLEvents" (L2), "UIEvents" (L2), "Traversal" (L2). It is possible to
- * compile the package so it doesn't support some of these features (notably,
- * Traversal).
- *
- * @author David Brownell
- */
-public class DomImpl implements DOMImplementation
-{
- /**
- * Constructs a DOMImplementation object which supports
- * "XML" and other DOM Level 2 features.
- */
- public DomImpl () {}
-
- /**
- * <b>DOM L1</b>
- * Returns true if the specified feature and version are
- * supported. Note that the case of the feature name is ignored.
- */
- public boolean hasFeature (String name, String version)
- {
- name = name.toLowerCase ();
-
- if ("xml".equals (name) || "core".equals (name)) {
- if (version == null || version.equals (""))
- return true;
- if ("1.0".equals (version))
- return true;
- if ("2.0".equals (version))
- return true;
-
- } else if ("events".equals (name)
- || "mutationevents".equals (name)
- || "uievents".equals (name)
- // || "mouseevents".equals (name)
- || "htmlevents".equals (name)
- ) {
- if (version == null || version.equals (""))
- return true;
- if ("2.0".equals (version))
- return true;
-
- // Extension: "USER-" prefix event types can
- // be created and passed through the DOM.
-
- } else if ("user-events".equals (name)) {
- if (version == null || version.equals (""))
- return true;
- if ("0.1".equals (version))
- return true;
-
- // NOTE: "hasFeature" for events is here interpreted to
- // mean the DOM can manufacture those sorts of events,
- // since actually choosing to report the events is more
- // often part of the environment or application. It's
- // only really an issue for mutation events.
-
- } else if (DomNode.reportMutations
- && "traversal".equals (name)) {
-
- // Note: nyet tree walker support ...
-
- if (version == null || version.equals (""))
- return true;
- if ("2.0".equals (version))
- return true;
- }
-
- // views
- // stylesheets
- // css, css2
- // range
-
- return false;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Creates and returns a DocumentType, associated with this
- * implementation. This DocumentType can have no associated
- * objects (notations, entities) until the DocumentType is
- * first associated with a document.
- *
- * <p> Note that there is no implication that this DTD will
- * be parsed by the DOM, or ever have contents. Moreover, the
- * DocumentType created here can only be added to a document by
- * the createDocument method (below). <em>That means that the only
- * portable way to create a Document object is to start parsing,
- * queue comment and processing instruction (PI) nodes, and then only
- * create a DOM Document after <b>(a)</b> it's known if a DocumentType
- * object is needed, and <b>(b) the name and namespace of the root
- * element is known. Queued comment and PI nodes would then be
- * inserted appropriately in the document prologue, both before and
- * after the DTD node, and additional attributes assigned to the
- * root element.</em>
- * (One hopes that the final DOM REC fixes this serious botch.)
- */
- public DocumentType createDocumentType (
- String rootName,
- String publicId,
- String systemId
- // CR2 deleted internal subset, ensuring DocumentType
- // is 100% useless instead of just 90% so.
- ) {
- DomDocument.verifyNamespaceName (rootName);
- return new DomDoctype (this, rootName, publicId, systemId, null);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Creates and returns a Document, populated only with a root element and
- * optionally a document type (if that was provided).
- */
- public Document createDocument (
- String namespaceURI,
- String rootName,
- DocumentType doctype
- ) {
- Document doc = new DomDocument (this);
- Element root;
-
- root = doc.createElementNS (namespaceURI, rootName);
- if (rootName.startsWith ("xmlns:"))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xmlns is reserved", null, 0);
- // Bleech -- L2 seemingly _requires_ omission of xmlns attributes.
- if (doctype != null)
- doc.appendChild (doctype); // handles WRONG_DOCUMENT error
- doc.appendChild (root);
- return doc;
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomIterator.java b/external/jaxp/source/gnu/xml/dom/DomIterator.java
deleted file mode 100644
index 76b200b57..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomIterator.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import java.util.Vector;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.*;
-import org.w3c.dom.traversal.*;
-
-
-/**
- * <p> "NodeIterator" implementation, usable with any L2 DOM which
- * supports MutationEvents. </p>
- *
- * @author David Brownell
- */
-final public class DomIterator implements NodeIterator, EventListener
-{
- private Node reference;
- private boolean right;
- private boolean done;
-
- private final Node root;
- private final int whatToShow;
- private final NodeFilter filter;
- private final boolean expandEntityReferences;
-
-
- /**
- * Constructs and initializes an iterator.
- */
- protected DomIterator (
- Node root,
- int whatToShow,
- NodeFilter filter,
- boolean entityReferenceExpansion
- ) {
- if (!root.isSupported ("MutationEvents", "2.0"))
- throw new DomEx (DomEx.NOT_SUPPORTED_ERR,
- "Iterator needs mutation events", root, 0);
-
- this.root = root;
- this.whatToShow = whatToShow;
- this.filter = filter;
- this.expandEntityReferences = entityReferenceExpansion;
-
- // start condition: going right, seen nothing yet.
- reference = null;
- right = true;
-
- EventTarget target = (EventTarget) root;
- target.addEventListener ("DOMNodeRemoved", this, false);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Flags the iterator as done, unregistering its event listener so
- * that the iterator can be garbage collected without relying on weak
- * references (a "Java 2" feature) in the event subsystem.
- */
- public void detach ()
- {
- EventTarget target = (EventTarget) root;
- target.removeEventListener ("DOMNodeRemoved", this, false);
- done = true;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the flag controlling whether iteration descends
- * through entity references.
- */
- public boolean getExpandEntityReferences ()
- {
- return expandEntityReferences;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the filter provided during construction.
- */
- public NodeFilter getFilter ()
- {
- return filter;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the root of the tree this is iterating through.
- */
- public Node getRoot ()
- {
- return root;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the mask of flags provided during construction.
- */
- public int getWhatToShow ()
- {
- return whatToShow;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the next node in a forward iteration, masked and filtered.
- * Note that the node may be read-only due to entity expansions.
- * A null return indicates the iteration is complete, but may still
- * be processed backwards.
- */
- public Node nextNode ()
- {
- if (done)
- throw new DomEx (DomEx.INVALID_STATE_ERR);
- right = true;
- return walk (true);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the next node in a backward iteration, masked and filtered.
- * Note that the node may be read-only due to entity expansions.
- * A null return indicates the iteration is complete, but may still
- * be processed forwards.
- */
- public Node previousNode ()
- {
- if (done)
- throw new DomEx (DomEx.INVALID_STATE_ERR);
- Node previous = reference;
- right = false;
- walk (false);
- return previous;
- }
-
- private boolean shouldShow (Node node)
- // raises Runtime exceptions indirectly, via acceptNode()
- {
- if ((whatToShow & (1 << (node.getNodeType () - 1))) == 0)
- return false;
- if (filter == null)
- return true;
- return filter.acceptNode (node) == NodeFilter.FILTER_ACCEPT;
- }
-
- //
- // scenario: root = 1, sequence = 1 2 ... 3 4
- // forward walk: 1 2 ... 3 4 null
- // then backward: 4 3 ... 2 1 null
- //
- // At the leftmost end, "previous" == null
- // At the rightmost end, "previous" == 4
- //
- // The current draft spec really seem to make no sense re the
- // role of the reference node, so what it says is ignored here.
- //
- private Node walk (boolean forward)
- {
- Node here = reference;
-
- while ((here = successor (here, forward)) != null
- && !shouldShow (here))
- continue;
- if (here != null || !forward)
- reference = here;
- return here;
- }
-
- private boolean isLeaf (Node here)
- {
- boolean leaf = !here.hasChildNodes ();
- if (!leaf && !expandEntityReferences)
- leaf = (here.getNodeType () == Node.ENTITY_REFERENCE_NODE);
- return leaf;
- }
-
- //
- // Returns the immediate successor in a forward (or backward)
- // document order walk, sans filtering ... except that it knows
- // how to stop, returning null when done. This is a depth first
- // preorder traversal when run in the forward direction.
- //
- private Node successor (Node here, boolean forward)
- {
- Node next;
-
- // the "leftmost" end is funky
- if (here == null)
- return forward ? root : null;
-
- //
- // Forward, this is preorder: children before siblings.
- // Backward, it's postorder: we saw the children already.
- //
- if (forward && !isLeaf (here))
- return here.getFirstChild ();
-
- //
- // Siblings ... if forward, we visit them, if backwards
- // we visit their children first.
- //
- if (forward) {
- if ((next = here.getNextSibling ()) != null)
- return next;
- } else if ((next = here.getPreviousSibling ()) != null) {
- if (isLeaf (next))
- return next;
- next = next.getLastChild ();
- while (!isLeaf (next))
- next = next.getLastChild ();
- return next;
- }
-
- //
- // We can't go down or lateral -- it's up, then. The logic is
- // the converse of what's above: backwards is easy (the parent
- // is next), forwards isn't.
- //
- next = here.getParentNode ();
- if (!forward)
- return next;
-
- Node temp = null;
- while (next != null
- && next != root
- && (temp = next.getNextSibling ()) == null)
- next = next.getParentNode ();
- if (next == root)
- return null;
- return temp;
- }
-
-
- /**
- * Not for public use. This lets the iterator know when its
- * reference node will be removed from the tree, so that a new
- * one may be selected.
- *
- * <p> This version works by watching removal events as they
- * bubble up. So, don't prevent them from bubbling.
- */
- public void handleEvent (Event e)
- {
- MutationEvent event;
- Node ancestor, removed;
-
- if (reference == null
- || !"DOMNodeRemoved".equals (e.getType ())
- || e.getEventPhase () != Event.BUBBLING_PHASE)
- return;
-
- event = (MutationEvent) e;
- removed = (Node) event.getTarget ();
-
- // See if the removal will cause trouble for this iterator
- // by being the reference node or an ancestor of it.
- for (ancestor = reference;
- ancestor != null && ancestor != root;
- ancestor = ancestor.getParentNode ()) {
- if (ancestor == removed)
- break;
- }
- if (ancestor != removed)
- return;
-
- // OK, it'll cause trouble. We want to make the "next"
- // node in our current traversal direction seem right.
- // So we pick the nearest node that's not getting removed,
- // but go in the _opposite_ direction from our current
- // traversal ... so the "next" doesn't skip anything.
- Node candidate;
-
-search:
- while ((candidate = walk (!right)) != null) {
- for (ancestor = candidate;
- ancestor != null && ancestor != root;
- ancestor = ancestor.getParentNode ()) {
- if (ancestor == removed)
- continue search;
- }
- return;
- }
-
- // The current DOM WD talks about a special case here;
- // I've not yet seen it.
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomNamedNodeMap.java b/external/jaxp/source/gnu/xml/dom/DomNamedNodeMap.java
deleted file mode 100644
index e46d57947..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomNamedNodeMap.java
+++ /dev/null
@@ -1,342 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import java.util.Vector;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "NamedNodeMap" implementation. </p>
- * Used mostly to hold element attributes, but sometimes also
- * to list notations or entities.
- *
- * @author David Brownell
- */
-public class DomNamedNodeMap implements NamedNodeMap
-{
- private final Document owner;
-
- private DomNode contents [] = new DomNode [1];
- private int length;
- private boolean readonly;
- private final Element element;
-
- private static final int DELTA = 5;
-
-
- /**
- * Constructs an empty map associated with the specified document.
- */
- public DomNamedNodeMap (Document owner)
- {
- this.owner = owner;
- this.element = null;
- }
-
- // package private
- DomNamedNodeMap (Document owner, Element element)
- {
- this.owner = owner;
- this.element = element;
- }
-
- /**
- * Reduces space utilization for this object.
- */
- public void compact ()
- {
- if (contents.length != length)
- setCapacity (length);
- }
-
- private void setCapacity (int len)
- {
- DomNode newContents [] = new DomNode [len];
-
- System.arraycopy (contents, 0, newContents, 0, length);
- contents = newContents;
- }
-
- /**
- * Exposes the internal "readonly" flag. In DOM, all NamedNodeMap
- * objects found in a DocumentType object are read-only (after
- * they are fully constructed), and those holding attributes of
- * a readonly element will also be readonly.
- */
- final public boolean isReadonly ()
- {
- return readonly;
- }
-
-
- /**
- * Sets the internal "readonly" flag so the node and its
- * children can't be changed.
- */
- public void makeReadonly ()
- {
- readonly = true;
- for (int i = 0; i < length; i++)
- contents [i].makeReadonly ();
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the named item from the map, or null; names are just
- * the nodeName property.
- */
- public Node getNamedItem (String name)
- {
- for (int i = 0; i < length; i++) {
- if (contents [i].getNodeName ().equals (name))
- return contents [i];
- }
- return null;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the named item from the map, or null; names are the
- * localName and namespaceURI properties, ignoring any prefix.
- */
- public Node getNamedItemNS (String namespaceURI, String localName)
- {
- for (int i = 0; i < length; i++) {
- DomNode temp = contents [i];
- String tempName = temp.getLocalName ();
- String ns;
-
- if (tempName != null && tempName.equals (localName)) {
- ns = temp.getNamespaceURI ();
- if ((ns == null && namespaceURI == null)
- || ns.equals (namespaceURI)) {
- return temp;
- }
- }
- }
- return null;
- }
-
-
- private void checkAttr (Attr arg)
- {
- if (element == null)
- return;
-
- Element argOwner = arg.getOwnerElement ();
-
- if (argOwner != null) {
- if (argOwner != element)
- throw new DomEx (DomEx.INUSE_ATTRIBUTE_ERR);
- return;
- }
-
- // We can't escape implementation dependencies here; we let
- // the Java runtime deal with error reporting
- ((DomAttr)arg).setOwnerElement (element);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Stores the named item into the map, optionally overwriting
- * any existing node with that name. The name used is just
- * the nodeName attribute.
- */
- public Node setNamedItem (Node arg)
- {
- if (readonly)
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- if (arg.getOwnerDocument () != owner)
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR);
- if (arg instanceof Attr)
- checkAttr ((Attr) arg);
-
- String name = arg.getNodeName ();
-
-// maybe attribute ADDITION events (?)
-
- for (int i = 0; i < length; i++) {
- Node temp = contents [i];
- if (temp.getNodeName ().equals (name)) {
- contents [i] = (DomNode) arg;
- return temp;
- }
- }
- if (length == contents.length)
- setCapacity (length + DELTA);
- contents [length++] = (DomNode) arg;
- return null;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Stores the named item into the map, optionally overwriting
- * any existing node with that fully qualified name. The name
- * used incorporates the localName and namespaceURI properties,
- * and ignores any prefix.
- */
- public Node setNamedItemNS (Node arg)
- {
- if (readonly)
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- if (arg.getOwnerDocument () != owner)
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR);
- if (arg instanceof Attr)
- checkAttr ((Attr) arg);
-
- String localName = arg.getLocalName ();
- String namespaceURI = arg.getNamespaceURI ();
-
- if (localName == null)
- throw new DomEx (DomEx.INVALID_ACCESS_ERR);
-
- for (int i = 0; i < length; i++) {
- DomNode temp = contents [i];
- String tempName = temp.getLocalName ();
- String ns;
-
- if (tempName != null && tempName.equals (localName)) {
- ns = temp.getNamespaceURI ();
- if ((ns == null && namespaceURI == null)
- || ns.equals (namespaceURI)) {
- contents [i] = (DomNode) arg;
- return temp;
- }
- }
- }
- if (length == contents.length)
- setCapacity (length + DELTA);
- contents [length++] = (DomNode) arg;
- return null;
- }
-
- private void maybeRestoreDefault (String uri, String name)
- {
- DomDoctype doctype = (DomDoctype)owner.getDoctype ();
- DomDoctype.ElementInfo info;
- String value;
- DomAttr attr;
-
- if (doctype == null)
- return;
- if ((info = doctype.getElementInfo (element.getNodeName ())) == null)
- return;
- if ((value = info.getAttrDefault (name)) == null)
- return;
- if (uri == null)
- attr = (DomAttr) owner.createAttribute (name);
- else
- attr = (DomAttr) owner.createAttributeNS (uri, name);
- attr.setNodeValue (value);
- attr.setSpecified (false);
- setNamedItem (attr);
- }
-
- /**
- * <b>DOM L1</b>
- * Removes the named item from the map, or reports an exception;
- * names are just the nodeName property.
- */
- public Node removeNamedItem (String name)
- {
- if (readonly)
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
-
-// report attribute REMOVAL event?
-
- for (int i = 0; i < length; i++) {
- DomNode temp = contents [i];
- if (temp.getNodeName ().equals (name)) {
- System.arraycopy (contents, i+1, contents, i,
- length - (i + 1));
- contents [--length] = null;
- if (element != null)
- maybeRestoreDefault (temp.getNamespaceURI (), name);
- return temp;
- }
- }
- throw new DomEx (DomEx.NOT_FOUND_ERR);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Removes the named item from the map, or reports an exception;
- * names are the localName and namespaceURI properties.
- */
- public Node removeNamedItemNS (String namespaceURI, String localName)
- {
- if (readonly)
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
-
- for (int i = 0; i < length; i++) {
- DomNode temp = contents [i];
- String tempName = temp.getLocalName ();
- String ns;
-
- if (tempName != null && tempName.equals (localName)) {
- ns = temp.getNamespaceURI ();
- if ((ns == null && namespaceURI == null)
- || ns.equals (namespaceURI)) {
- System.arraycopy (contents, i+1, contents, i,
- length - (i + 1));
- contents [--length] = null;
- if (element != null)
- maybeRestoreDefault (ns, temp.getNodeName ());
- return temp;
- }
- }
- }
- throw new DomEx (DomEx.NOT_FOUND_ERR);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the indexed item from the map, or null.
- */
- public Node item (int index)
- {
- if (index < 0 || index >= length)
- return null;
- return contents [index];
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the length of the map.
- */
- public int getLength ()
- { return length; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomNode.java b/external/jaxp/source/gnu/xml/dom/DomNode.java
deleted file mode 100644
index dd8e2d764..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomNode.java
+++ /dev/null
@@ -1,1567 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-import org.w3c.dom.events.*;
-import org.w3c.dom.traversal.*;
-
-
-/**
- * <p> "Node", "EventTarget", and "DocumentEvent" implementation.
- * This provides most of the core DOM functionality; only more
- * specialized features are provided by subclasses. Those subclasses may
- * have some particular constraints they must implement, by overriding
- * methods defined here. Such constraints are noted here in the method
- * documentation. </p>
- *
- * <p> Note that you can create events with type names prefixed with "USER-",
- * and pass them through this DOM. This lets you use the DOM event scheme
- * for application specific purposes, although you must use a predefined event
- * structure (such as MutationEvent) to pass data along with those events.
- * Test for existence of this feature with the "USER-Events" DOM feature
- * name.</p>
- *
- * <p> Other kinds of events you can send include the "html" events,
- * like "load", "unload", "abort", "error", and "blur"; and the mutation
- * events. If this DOM has been compiled with mutation event support
- * enabled, it will send mutation events when you change parts of the
- * tree; otherwise you may create and send such events yourself, but
- * they won't be generated by the DOM itself. </p>
- *
- * <p> Note that there is a namespace-aware name comparison method,
- * <em>nameAndTypeEquals</em>, which compares the names (and types) of
- * two nodes in conformance with the "Namespaces in XML" specification.
- * While mostly intended for use with elements and attributes, this should
- * also be helpful for ProcessingInstruction nodes and some others which
- * do not have namespace URIs.
- *
- * @author David Brownell
- */
-public abstract class DomNode
- implements Node, NodeList, EventTarget, DocumentEvent, Cloneable
-{
- //
- // CLASS DATA
- //
-
- // tunable
- // NKIDS_* affects arrays of children (which grow)
- // (currently) fixed size:
- // ANCESTORS_* is for event capture/bubbling, # ancestors
- // NOTIFICATIONS_* is for per-node event delivery, # events
- private static final int NKIDS_INIT = 5;
- private static final int NKIDS_DELTA = 8;
- private static final int ANCESTORS_INIT = 20;
- private static final int NOTIFICATIONS_INIT = 10;
-
- // tunable: enable mutation events or not? Enabling it costs about
- // 10-15% in DOM construction time, last time it was measured.
-
- // package private !!!
- static final boolean reportMutations = true;
-
- // locking protocol changeable only within this class
- private static final Object lockNode = new Object ();
-
- // optimize space to share what we can
- private static final DomNode noKids [] = new DomNode [0];
-
-
- // NON-FINAL class data
-
- // Optimize event dispatch by not allocating memory each time
- private static boolean dispatchDataLock;
- private static DomNode ancestors []
- = new DomNode [ANCESTORS_INIT];
- private static ListenerRecord notificationSet []
- = new ListenerRecord [NOTIFICATIONS_INIT];
-
- // Ditto for the (most common) event object itself!
- private static boolean eventDataLock;
- private static DomEvent.DomMutationEvent mutationEvent
- = new DomEvent.DomMutationEvent (null);
-
- //
- // PER-INSTANCE DATA
- //
-
- private Document owner;
- private DomNode parent;
-
- // Bleech ... "package private" so a builder can populate entity refs.
- // writable during construction. DOM spec is nasty.
- boolean readonly;
-
- // children
- private DomNode children [];
- private int length;
-
- // event registrations
- private ListenerRecord listeners [];
- private int nListeners;
-
- // Optimize access to siblings by caching indices.
- private transient int parentIndex;
-
- //
- // Some of the methods here are declared 'final' because
- // knowledge about their implementation is built into this
- // class -- for both integrity and performance.
- //
-
- // package private
- void nyi ()
- {
- throw new DomEx (DomEx.NOT_SUPPORTED_ERR,
- "feature not yet implemented", this, 0);
- }
-
- /**
- * Reduces space utilization for this node.
- */
- public void compact ()
- {
- if (children != null && children != noKids) {
- if (length == 0)
- children = noKids;
- // allow a bit of fuzz (max NKIDS_DELTA).
- // the JVM won't always use less memory for smaller arrays...
- else if ((children.length - length) > 1) {
- DomNode newKids [] = new DomNode [length];
- System.arraycopy (children, 0, newKids, 0, length);
- children = newKids;
- }
- }
- if (listeners != null && listeners.length != nListeners) {
- if (nListeners == 0)
- listeners = null;
- else {
- ListenerRecord l [] = new ListenerRecord [nListeners];
- System.arraycopy (listeners, 0, l, 0, nListeners);
- listeners = l;
- }
- }
- }
-
- /**
- * Constructs a node and associates it with its owner. Only
- * Document and DocumentType nodes may be created with no owner,
- * and DocumentType nodes get an owner as soon as they are
- * associated with a document.
- */
- protected DomNode (Document owner)
- {
- short type = getNodeType ();
-
- if (owner == null) {
- // DOM calls never go down this path
- if (type != DOCUMENT_NODE && type != DOCUMENT_TYPE_NODE)
- throw new IllegalArgumentException ("no owner!");
- }
- this.owner = owner;
-
- switch (type) {
- case DOCUMENT_NODE:
- case DOCUMENT_FRAGMENT_NODE:
- case ENTITY_REFERENCE_NODE:
- case ELEMENT_NODE:
- children = new DomNode [NKIDS_INIT];
- break;
- // no sane app wants the attributes-with-children model
- case ATTRIBUTE_NODE:
- children = new DomNode [1];
- break;
- // we don't currently build children with entities
- case ENTITY_NODE:
- children = noKids;
-
- // no other kinds of nodes may have children; so for
- // such nodes, length stays zero, children stays null
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns null; Element subclasses must override this method.
- */
- public NamedNodeMap getAttributes ()
- { return null; }
-
- /**
- * <b>DOM L2></b>
- * Returns true iff this is an element node with attributes.
- */
- public boolean hasAttributes ()
- { return false; }
-
- /**
- * <b>DOM L1</b>
- * Returns a list, possibly empty, of the children of this node.
- * In this implementation, to conserve memory, nodes are the same
- * as their list of children. This can have ramifications for
- * subclasses, which may need to provide their own getLength method
- * for reasons unrelated to the NodeList method of the same name.
- */
- public NodeList getChildNodes ()
- { return this; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the first child of this node, or null if there are none.
- */
- final public Node getFirstChild ()
- { return item (0); }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the last child of this node, or null if there are none.
- */
- final public Node getLastChild ()
- { return item (length - 1); }
-
-
- /**
- * <b>DOM L1</b>
- * Returns true if this node has children.
- */
- final public boolean hasChildNodes ()
- { return length > 0; }
-
-
- /**
- * Exposes the internal "readonly" flag. In DOM, children of
- * entities and entity references are readonly, as are the
- * objects associated with DocumentType objets.
- */
- final public boolean isReadonly ()
- {
- return readonly;
- }
-
-
- /**
- * Sets the internal "readonly" flag so this subtree can't be changed.
- * Subclasses need to override this method for any associated content
- * that's not a child node, such as an element's attributes or the
- * (few) declarations associated with a DocumentType.
- */
- public void makeReadonly ()
- {
- readonly = true;
-
- for (int i = 0; i < length; i++)
- children [i].makeReadonly ();
- }
-
-
- // we need to have at least N more kids
- private void ensureEnough (int n)
- {
- if ((children.length - length) > n)
- return;
-
- // don't grow in micro-chunks
- if (n < NKIDS_DELTA)
- n = NKIDS_DELTA;
- n += children.length;
-
- DomNode newKids [] = new DomNode [n];
-
- for (int i = 0; i < length; i++)
- newKids [i] = children [i];
- children = newKids;
- }
-
- // just checks the node for inclusion -- may be called many
- // times (docfrag) before anything is allowed to change
- private void checkMisc (DomNode child)
- {
- if (readonly)
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR,
- null, this, 0);
- if (children == null)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR,
- null, this, 0);
- if (parent != null && child.length > 0) {
- for (Node temp = parent;
- temp != null;
- temp = temp.getParentNode ()) {
- if (child == parent)
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR,
- "can't make ancestor into a child", this, 0);
- }
- }
-
- Node myOwner = owner;
- Node newOwner = child.owner;
- short nodeType = getNodeType ();
- short newType = child.getNodeType ();
-
- if (nodeType == DOCUMENT_NODE)
- myOwner = this;
-
- if (newOwner != myOwner) {
- // new in DOM L2, this case -- patch it up later, in reparent()
- if (!(newType == DOCUMENT_TYPE_NODE && newOwner == null))
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR,
- null, child, 0);
- }
-
- // Test code.
- // System.out.println("DOMNode node type = " + nodeType
- // + " new type: " + newType);
-
- // if (newType == 3)
- // System.out.println("child content = " + child.getNodeValue());
-
- // enforce various structural constraints
- switch (nodeType) {
- case DOCUMENT_NODE:
- if (newType == ELEMENT_NODE
- || newType == PROCESSING_INSTRUCTION_NODE
- || newType == COMMENT_NODE
- || newType == DOCUMENT_TYPE_NODE)
- return;
- break;
-
- case ATTRIBUTE_NODE:
- if (newType == TEXT_NODE || newType == ENTITY_REFERENCE_NODE)
- return;
- break;
-
- case DOCUMENT_FRAGMENT_NODE:
- case ENTITY_REFERENCE_NODE:
- case ELEMENT_NODE:
- case ENTITY_NODE:
- if (newType == ELEMENT_NODE
- || newType == TEXT_NODE
- || newType == COMMENT_NODE
- || newType == PROCESSING_INSTRUCTION_NODE
- || newType == CDATA_SECTION_NODE
- || newType == ENTITY_REFERENCE_NODE)
- return;
- }
- throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR,
- "this node can't have that type of child", this, 0);
- }
-
- //
- // NOTE: after this method, the new child knows its parent,
- // but the parent doesn't know the child. Don't let that
- // intermediate state be seen by the application.
- //
- // XXX prefer to pass in a mutation event object, making removeChild reuse
- // it appropriately. That'll shorten critical paths, and remove the
- // guarantee that the three-message replaceChild case will hit the heap.
- //
- private void reparent (DomNode newChild)
- {
- short childType = newChild.getNodeType ();
-
- if (getNodeType () == DOCUMENT_NODE
- && childType == DOCUMENT_TYPE_NODE) {
- DomDoctype doctype = (DomDoctype) newChild;
-
- if (doctype.getImplementation ()
- != ((Document)this).getImplementation ())
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR,
- "implementation mismatch", newChild, 0);
- newChild.owner = (Document) this;
- }
-
- // get rid of old parent
- Node oldParent = newChild.parent;
-
- if (oldParent != null)
- oldParent.removeChild (newChild);
-
- if (childType != ATTRIBUTE_NODE)
- newChild.parent = this;
- }
-
-
- // Here's hoping a good optimizer will detect the case when the
- // next several methods are never called, and won't allocate
- // object code space of any kind. (Case: not reporting any
- // mutation events. We can also remove some static variables
- // listed above.)
-
-
- private void insertionEvent (
- DomEvent.DomMutationEvent event,
- DomNode target
- ) {
- boolean doFree = false;
-
- if (event == null) {
- event = getMutationEvent ();
- if (event != null)
- doFree = true;
- else
- event = new DomEvent.DomMutationEvent (null);
- }
- event.initMutationEvent ("DOMNodeInserted",
- true /* bubbles */, false /* nocancel */,
- this /* related */, null, null, null, (short) 0);
- target.dispatchEvent (event);
-
- // XXX should really visit every descendant of 'target'
- // and sent a DOMNodeInsertedIntoDocument event to it...
- // bleech, there's no way to keep that acceptably fast.
-
- if (doFree) {
- event.target = null;
- event.relatedNode = null;
- event.currentNode = null;
- eventDataLock = false;
- } // else we created work for the GC
- }
-
-
- private void removalEvent (
- DomEvent.DomMutationEvent event,
- DomNode target
- ) {
- boolean doFree = false;
-
- if (event == null) {
- event = getMutationEvent ();
- if (event != null)
- doFree = true;
- else
- event = new DomEvent.DomMutationEvent (null);
- }
- event.initMutationEvent ("DOMNodeRemoved",
- true /* bubbles */, false /* nocancel */,
- this /* related */, null, null, null, (short) 0);
- target.dispatchEvent (event);
-
- // XXX should really visit every descendant of 'target'
- // and sent a DOMNodeRemovedFromDocument event to it...
- // bleech, there's no way to keep that acceptably fast.
-
- event.target = null;
- event.relatedNode = null;
- event.currentNode = null;
- if (doFree)
- eventDataLock = false;
- // else we created more work for the GC
- }
-
- //
- // Avoid creating lots of memory management work, by using a simple
- // allocation strategy for the mutation event objects that get used
- // at least once per tree modification. We can't use stack allocation,
- // so we do the next simplest thing -- more or less, static allocation.
- // Concurrent notifications should be rare, anyway.
- //
- // Returns the preallocated object, which needs to be carefully freed,
- // or null to indicate the caller needs to allocate their own.
- //
- static private DomEvent.DomMutationEvent getMutationEvent ()
- {
- synchronized (lockNode) {
- if (eventDataLock)
- return null;
- eventDataLock = true;
- return mutationEvent;
- }
- }
-
- // NOTE: this is manually inlined in the insertion
- // and removal event methods above; change in sync.
- static private void freeMutationEvent ()
- {
- // clear fields to enable GC
- mutationEvent.clear ();
- eventDataLock = false;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Appends the specified node to this node's list of children.
- * Document subclasses must override this to enforce the restrictions
- * that there be only one element and document type child.
- *
- * <p> Causes a DOMNodeInserted mutation event to be reported.
- * Will first cause a DOMNodeRemoved event to be reported if the
- * parameter already has a parent. If the new child is a document
- * fragment node, both events will be reported for each child of
- * the fragment; the order in which children are removed and
- * inserted is implementation-specific.
- *
- * <p> If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node appendChild (Node newChild)
- {
- try {
- DomNode child = (DomNode) newChild;
-
- if (newChild.getNodeType () != DOCUMENT_FRAGMENT_NODE) {
- checkMisc (child);
- if (!(length < children.length))
- ensureEnough (1);
- reparent (child);
- children [length++] = child;
- if (reportMutations)
- insertionEvent (null, child);
- } else {
- // See if we can append all the nodes in the fragment
- for (int i = 0; i < child.length; i++)
- checkMisc (child.children [i]);
-
- // yep -- do so!
- ensureEnough (child.length);
- for (int i = 0; i <= child.length; i++)
- appendChild (child.children [0]);
- }
- return child;
-
- } catch (ClassCastException e) {
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR,
- null, newChild, 0);
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Inserts the specified node in this node's list of children.
- * Document subclasses must override this to enforce the restrictions
- * that there be only one element and document type child.
- *
- * <p> Causes a DOMNodeInserted mutation event to be reported. Will
- * first cause a DOMNodeRemoved event to be reported if the newChild
- * parameter already has a parent. If the new child is a document
- * fragment node, both events will be reported for each child of
- * the fragment; the order in which children are removed and inserted
- * is implementation-specific.
- *
- * <p> If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node insertBefore (Node newChild, Node refChild)
- {
- if (refChild == null)
- return appendChild (newChild);
-
- try {
- DomNode child = (DomNode) newChild;
-
- if (newChild.getNodeType () != DOCUMENT_FRAGMENT_NODE) {
- checkMisc (child);
- for (int i = 0; i < length; i++) {
- if (children [i] != refChild)
- continue;
-
- ensureEnough (1);
- reparent (child);
- if (children [i] != refChild)
- i--;
- for (int j = ++length; j > i; j--)
- children [j] = children [j - 1];
- children [i] = child;
- if (reportMutations)
- insertionEvent (null, child);
-
- return newChild;
- }
- throw new DomEx (DomEx.NOT_FOUND_ERR,
- "that's no child of mine", refChild, 0);
-
- } else {
- // See if we can insert all the nodes in the fragment
- for (int i = 0; i < child.length; i++)
- checkMisc (child.children [i]);
-
- // yep -- do so!
- ensureEnough (child.length);
- for (int i = 0; i <= child.length; i++)
- insertBefore (child.children [0], refChild);
- return newChild;
- }
- } catch (ClassCastException e) {
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR,
- null, newChild, 0);
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Replaces the specified node in this node's list of children.
- * Document subclasses must override this to test the restrictions
- * that there be only one element and document type child.
- *
- * <p> Causes DOMNodeRemoved and DOMNodeInserted mutation event to be
- * reported. Will cause another DOMNodeRemoved event to be reported if
- * the newChild parameter already has a parent. These events may be
- * delivered in any order, except that the event reporting removal
- * from such an existing parent will always be delivered before the
- * event reporting its re-insertion as a child of some other node.
- * The order in which children are removed and inserted is implementation
- * specific.
- *
- * <p> If your application needs to depend on the in which those removal
- * and insertion events are delivered, don't use this API. Instead,
- * invoke the removeChild and insertBefore methods directly, to guarantee
- * a specific delivery order. Similarly, don't use document fragments,
- * Otherwise your application code may not work on a DOM which implements
- * this method differently.
- *
- * <p> If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node replaceChild (Node newChild, Node refChild)
- {
- try {
- DomNode child = (DomNode) newChild;
-
- if (newChild.getNodeType () != DOCUMENT_FRAGMENT_NODE) {
- checkMisc (child);
- for (int i = 0; i < length; i++) {
- if (children [i] != refChild)
- continue;
-
- DomNode rmchild = (DomNode) refChild;
- DomEvent.DomMutationEvent event;
- boolean doFree;
-
- event = getMutationEvent ();
- if (event != null)
- doFree = true;
- else
- doFree = false;
- if (reportMutations)
- removalEvent (event, rmchild);
- reparent (child);
- if (children [i] != refChild)
- i--;
- children [i] = child;
- rmchild.parent = null;
- if (reportMutations)
- insertionEvent (event, child);
- if (doFree)
- freeMutationEvent ();
-
- return refChild;
- }
- throw new DomEx (DomEx.NOT_FOUND_ERR,
- "that's no child of mine", newChild, 0);
- } else {
-// XXX implement me
- throw new DomEx (DomEx.NOT_SUPPORTED_ERR,
- "replacing with fragment, NYI", null, 0);
- }
- } catch (ClassCastException e) {
- throw new DomEx (DomEx.WRONG_DOCUMENT_ERR,
- null, newChild, 0);
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Removes the specified child from this node's list of children,
- * or else reports an exception.
- *
- * <p> Causes a DOMNodeRemoved mutation event to be reported.
- *
- * <p> If this DOM has been compiled without mutation event support,
- * these events will not be reported.
- */
- public Node removeChild (Node refChild)
- {
- if (readonly)
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR,
- null, this, 0);
- for (int i = 0; i < length; i++) {
- if (children [i] != refChild)
- continue;
-
- DomNode child = (DomNode) refChild;
-
- if (reportMutations)
- removalEvent (null, child);
- for (int j = i + 1; j < length; j++, i++)
- children [i] = children [j];
- children [i] = null;
- child.parent = null;
- length--;
-
- return refChild;
- }
- throw new DomEx (DomEx.NOT_FOUND_ERR,
- "that's no child of mine", refChild, 0);
- }
-
-
- /**
- * <b>DOM L1 (NodeList)</b>
- * Returns the item with the specified index in this NodeList,
- * else null.
- */
- final public Node item (int index)
- {
- try {
- if (index < length)
- return children [index];
- } catch (RuntimeException e) {
- // children == null or index < 0 ... bad parameter
- // FALLTHROUGh
- }
- return null;
- }
-
-
- /**
- * <b>DOM L1 (NodeList)</b>
- * Returns the number of elements in this NodeList.
- * (Note that many interfaces have a "Length" property, not just
- * NodeList, and if a node subtype must implement one of those,
- * it will also need to override getChildNodes.)
- */
- public int getLength ()
- { return length; }
-
-
- /**
- * Minimize extra space consumed by this node to hold children and event
- * listeners.
- */
- public void trimToSize ()
- {
- if (children != null && children.length != length) {
- DomNode newKids [] = new DomNode [length];
-
- for (int i = 0; i < length; i++)
- newKids [i] = children [i];
- children = newKids;
- }
-
- if (listeners != null && listeners.length != nListeners) {
- ListenerRecord newKids [] = new ListenerRecord [length];
-
- for (int i = 0; i < nListeners; i++)
- newKids [i] = listeners [i];
- listeners = newKids;
- }
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the previous sibling, if one is known.
- */
- final public Node getNextSibling ()
- {
- if (parent == null || getNodeType() == ATTRIBUTE_NODE)
- return null;
-
- // we know parent.getChildNodes () returns itself
- // ... and that we're somewhere in parent.children[]
- int index;
-
- if (parentIndex < parent.length
- && parent.children [parentIndex] == this) {
- index = parentIndex + 1;
- if (index < parent.length)
- return parent.children [index];
- else
- return null;
- }
-
- for (index = 0; index < parent.length; index++) {
- if (parent.children [index] == this) {
- parentIndex = index++;
- if (index < parent.length)
- return parent.children [index];
- else
- break;
- }
- }
- return null;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the previous sibling, if one is known.
- */
- final public Node getPreviousSibling ()
- {
- if (parent == null || getNodeType () == ATTRIBUTE_NODE)
- return null;
-
- NodeList siblings = parent.getChildNodes ();
- int len = siblings.getLength ();
-
- if (siblings.item (parentIndex) == this)
- return siblings.item (parentIndex - 1);
-
- for (int i = 0; i < len; i++)
- if (siblings.item (i) == this) {
- parentIndex = i;
- return siblings.item (--i);
- }
- return null;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the parent node, if one is known.
- */
- final public Node getParentNode ()
- { return parent; }
-
- // parent node is only set in reparent() after sanity chex
-
-
- /**
- * <b>DOM L2</b>
- * Consults the DOM implementation to determine if the requested
- * feature is supported. DocumentType subclasses must override
- * this method, and associate themselves directly with the
- * DOMImplementation node used. (This method relies on being able
- * to access the DOMImplementation from the owner document, but
- * DocumentType nodes can be created without an owner.)
- */
- public boolean isSupported (String feature, String version)
- {
- Document doc = owner;
- DOMImplementation impl = null;
-
- if (doc == null && getNodeType () == DOCUMENT_NODE)
- doc = (Document) this;
-
- if (doc == null)
- // possible for DocumentType
- throw new IllegalStateException ("unbound ownerDocument");
-
- impl = doc.getImplementation ();
- return impl.hasFeature (feature, version);
- }
-
-
- /**
- * <b>DOM L1 (modified in L2)</b>
- * Returns the owner document. This is only null for Document nodes,
- * and (new in L2) for DocumentType nodes which have not yet been
- * associated with the rest of their document.
- */
- final public Document getOwnerDocument ()
- { return owner; }
-
-
- /**
- * <b>DOM L1</b>
- * Does nothing; this must be overridden (along with the
- * getNodeValue method) for nodes with a non-null defined value.
- */
- public void setNodeValue (String value)
- { }
-
-
- /**
- * <b>DOM L1</b>
- * Returns null; this must be overridden for nodes types with
- * a defined value, along with the setNodeValue method.
- */
- public String getNodeValue ()
- { return null; }
-
-
- /** This forces GCJ compatibility.
- * Without this method GCJ is unable to compile to byte code.
- */
- public abstract short getNodeType ();
-
- /** This forces GCJ compatibility.
- * Without this method GCJ seems unable to natively compile GNUJAXP.
- */
- public abstract String getNodeName ();
-
- /**
- * <b>DOM L2</b>
- * Does nothing; this must be overridden (along with the
- * getPrefix method) for element and attribute nodes.
- */
- public void setPrefix (String prefix)
- { }
-
-
- /**
- * <b>DOM L2</b>
- * Returns null; this must be overridden for element and
- * attribute nodes.
- */
- public String getPrefix ()
- { return null; }
-
-
- /**
- * <b>DOM L2</b>
- * Returns null; this must be overridden for element and
- * attribute nodes.
- */
- public String getNamespaceURI ()
- { return null; }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the node name; this must be overridden for element and
- * attribute nodes.
- */
- public String getLocalName ()
- { return null; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns a clone of this node which optionally includes cloned
- * versions of child nodes. Clones are always mutable, except for
- * entity reference nodes.
- */
- public Node cloneNode (boolean deep)
- {
- DomNode retval = (DomNode) clone ();
-
- if (deep && children != null) {
- DomNode newKids [] = retval.children;
-
- if (newKids.length < length)
- newKids = new DomNode [length];
- for (int i = 0; i < length; i++)
- newKids [i] = (DomNode) children [i].cloneNode (true);
- retval.children = newKids;
- retval.length = length;
-
- if (getNodeType () == ENTITY_REFERENCE_NODE)
- retval.makeReadonly ();
- }
- return retval;
- }
-
- /**
- * Clones this node; roughly equivalent to cloneNode(false).
- * Element subclasses must provide a new implementation which
- * invokes this method to handle the basics, and then arranges
- * to clone any element attributes directly. Attribute subclasses
- * must make similar arrangements, ensuring that existing ties to
- * elements are broken by cloning.
- */
- public Object clone ()
- {
- try {
- DomNode retval = (DomNode) super.clone ();
-
- retval.parent = null;
- retval.readonly = false;
- if (retval.children != null) {
- retval.children = noKids;
- retval.length = 0;
- }
- retval.listeners = null;
- retval.nListeners = 0;
- return retval;
-
- } catch (CloneNotSupportedException x) {
- throw new Error ("clone didn't work");
- }
- }
-
-
- // the elements-by-tagname stuff is needed for both
- // elements and documents ... this is in lieu of a
- // common base class between Node and NodeNS.
-
- /**
- * <b>DOM L1</b>
- * Creates a NodeList giving array-style access to elements with
- * the specified name. Access is fastest if indices change by
- * small values, and the DOM is not modified.
- */
- public NodeList getElementsByTagName (String tag)
- {
- return new ShadowList (null, tag);
- }
-
- /**
- * <b>DOM L2</b>
- * Creates a NodeList giving array-style access to elements with
- * the specified namespace and local name. Access is fastest if
- * indices change by small values, and the DOM is not modified.
- */
- public NodeList getElementsByTagNameNS (String namespace, String local)
- {
- return new ShadowList (namespace, local);
- }
-
-
- //
- // This shadow class is GC-able even when the live list it shadows
- // can't be, because of event registration hookups. Its finalizer
- // makes that live list become GC-able.
- //
- final class ShadowList implements NodeList
- {
- private LiveNodeList liveList;
-
- ShadowList (String ns, String local)
- { liveList = new LiveNodeList (ns, local); }
-
- public void finalize ()
- {
- liveList.detach ();
- liveList = null;
- }
-
- public Node item (int index)
- { return liveList.item (index); }
-
- public int getLength ()
- { return liveList.getLength (); }
- }
-
-
- final class LiveNodeList implements NodeList, EventListener, NodeFilter
- {
- private String elementURI;
- private String elementName;
-
- private DomIterator current;
- private int lastIndex;
-
-
- LiveNodeList (String uri, String name)
- {
- elementURI = uri;
- elementName = name;
- DomNode.this.addEventListener ("DOMNodeInserted", this, true);
- DomNode.this.addEventListener ("DOMNodeRemoved", this, true);
- }
-
- void detach ()
- {
- current.detach ();
- current = null;
- DomNode.this.removeEventListener ("DOMNodeInserted", this, true);
- DomNode.this.removeEventListener ("DOMNodeRemoved", this, true);
- }
-
- public short acceptNode (Node element)
- {
- if (element == DomNode.this)
- return FILTER_SKIP;
-
- // use namespace-aware matching ...
- if (elementURI != null) {
- if (!("*".equals (elementURI)
- || elementURI.equals (element.getNamespaceURI ())))
- return FILTER_SKIP;
- if (!("*".equals (elementName)
- || elementName.equals (element.getLocalName ())))
- return FILTER_SKIP;
-
- // ... or qName-based kind.
- } else {
- if (!("*".equals (elementName)
- || elementName.equals (element.getNodeName ())))
- return FILTER_SKIP;
- }
- return FILTER_ACCEPT;
- }
-
- private DomIterator createIterator ()
- {
- return new DomIterator (DomNode.this,
- NodeFilter.SHOW_ELEMENT,
- this, /* filter */
- true /* expand entity refs */
- );
- }
-
- public void handleEvent (Event e)
- {
- MutationEvent mutation = (MutationEvent) e;
- Node related = mutation.getRelatedNode ();
-
- // XXX if it's got children ... check all kids too, they
- // will invalidate our saved index
-
- if (related.getNodeType () != Node.ELEMENT_NODE)
- return;
- if (related.getNodeName () != elementName)
- return;
- if (related.getNamespaceURI () != elementURI)
- return;
-
- current = null;
- }
-
- public Node item (int index)
- {
- if (current == null) {
- current = createIterator ();
- lastIndex = -1;
- }
-
- // last node or before? go backwards
- if (index <= lastIndex) {
- while (index != lastIndex) {
- current.previousNode ();
- lastIndex--;
- }
- return current.previousNode ();
- }
-
- // somewhere after last node
- while (++lastIndex != index)
- current.nextNode ();
- return current.nextNode ();
- }
-
- public int getLength ()
- {
- int retval = 0;
- NodeIterator iter = createIterator ();
-
- while (iter.nextNode () != null)
- retval++;
- return retval;
- }
- }
-
- //
- // EventTarget support
- //
- static final class ListenerRecord {
- String type;
- EventListener listener;
- boolean useCapture;
-
- // XXX use JDK 1.2 java.lang.ref.WeakReference to listener,
- // and we can both get rid of "shadow" classes and remove
- // the need for applications to apply similar trix ... but
- // JDK 1.2 support isn't generally available yet
-
- ListenerRecord (
- String type,
- EventListener listener,
- boolean useCapture
- ) {
- this.type = type.intern ();
- this.listener = listener;
- this.useCapture = useCapture;
- }
-
- boolean equals (ListenerRecord rec)
- {
- return listener == rec.listener
- && useCapture == rec.useCapture
- && type == rec.type;
- }
- }
-
- /**
- * <b>DOM L2 (Events)</b>
- * Returns an instance of the specified type of event object.
- * Understands about DOM Mutation, HTML, and UI events.
- *
- * <p>If the name of the event type begins with "USER-", then an object
- * implementing the "Event" class will be returned; this provides a
- * limited facility for application-defined events to use the DOM event
- * infrastructure. Alternatively, use one of the standard DOM event
- * classes and initialize it using use such a "USER-" event type name;
- * or defin, instantiate, and initialize an application-specific subclass
- * of DomEvent and pass that to dispatchEvent().
- *
- * @param eventType Identifies the particular DOM feature module
- * defining the type of event, such as "MutationEvents".
- * <em>The event "name" is a different kind of "type".</em>
- */
- public Event createEvent (String eventType)
- {
- eventType = eventType.toLowerCase ();
-
- if ("mutationevents".equals (eventType))
- return new DomEvent.DomMutationEvent (null);
-
- if ("htmlevents".equals (eventType)
- || "events".equals (eventType)
- || "user-events".equals (eventType))
- return new DomEvent (null);
-
- if ("uievents".equals (eventType))
- return new DomEvent.DomUIEvent (null);
-
- // mouse events
-
- throw new DomEx (DomEx.NOT_SUPPORTED_ERR,
- eventType, null, 0);
- }
-
-
- /**
- * <b>DOM L2 (Events)</b>
- * Registers an event listener's interest in a class of events.
- */
- final public void addEventListener (
- String type,
- EventListener listener,
- boolean useCapture
- ) {
- if (listeners == null)
- listeners = new ListenerRecord [1];
- else if (nListeners == listeners.length) {
- ListenerRecord newListeners [];
- newListeners =
- new ListenerRecord [listeners.length + NKIDS_DELTA];
- for (int i = 0; i < nListeners; i++)
- newListeners [i] = listeners [i];
- listeners = newListeners;
- }
-
- // prune duplicates
- ListenerRecord record;
-
- record = new ListenerRecord (type, listener, useCapture);
- for (int i = 0; i < nListeners; i++) {
- if (record.equals (listeners [i]))
- return;
- }
- listeners [nListeners++] = record;
- }
-
-
- // XXX this exception should be discarded from DOM
-
- // this class can be instantiated, unlike the one in the spec
- final static class DomEventException extends EventException {
- DomEventException ()
- { super (UNSPECIFIED_EVENT_TYPE_ERR, "unspecified event type"); }
- }
-
-
- /**
- * <b>DOM L2 (Events)</b>
- * Delivers an event to all relevant listeners, returning true if the
- * caller should perform their default action. Note that the event
- * must have been provided by the createEvent() method on this
- * class, else it can't be dispatched.
- *
- * @see #createEvent
- *
- * @exception NullPointerException When a null event is passed.
- * @exception ClassCastException When the event wasn't provided by
- * the createEvent method, or otherwise isn't a DomEvent.
- * @exception EventException If the event type wasn't specified
- */
- final public boolean dispatchEvent (Event event)
- throws EventException
- {
- DomEvent e = (DomEvent) event;
- DomNode ancestors [] = null;
- int ancestorMax = 0;
- boolean haveDispatchDataLock = false;
-
- if (e.type == null)
- throw new DomEventException ();
-
- e.doDefault = true;
- e.target = this;
-
- //
- // Typical case: one nonrecursive dispatchEvent call at a time
- // for this class. If that's our case, we can avoid allocating
- // garbage, which is overall a big win. Even with advanced GCs
- // that deal well with short-lived garbage, and wayfast allocators,
- // it still helps.
- //
- // Remember -- EVERY mutation goes though here at least once.
- //
- // When populating a DOM tree, trying to send mutation events is
- // the primary cost; this dominates the critical path.
- //
- try {
- DomNode current;
- int index;
- boolean haveAncestorRegistrations = false;
- ListenerRecord notificationSet [];
- int ancestorLen;
-
- synchronized (lockNode) {
- if (!dispatchDataLock) {
- haveDispatchDataLock = dispatchDataLock = true;
- notificationSet = DomNode.notificationSet;
- ancestors = DomNode.ancestors;
- } else {
- notificationSet = new ListenerRecord [NOTIFICATIONS_INIT];
- ancestors = new DomNode [ANCESTORS_INIT];
- }
- ancestorLen = ancestors.length;
- }
-
- // XXX autogrow ancestors ... based on statistics
-
- // Climb to the top of this subtree and handle capture, letting
- // each node (from the top down) capture until one stops it or
- // until we get to this one.
-
- for (index = 0, current = parent;
- current != null && index < ancestorLen;
- index++, current = current.parent) {
- if (current.nListeners != 0)
- haveAncestorRegistrations = true;
- ancestors [index] = current;
- }
- if (current != null)
- throw new RuntimeException ("dispatchEvent capture stack size");
-
- ancestorMax = index;
- e.stop = false;
-
- if (haveAncestorRegistrations) {
- e.eventPhase = Event.CAPTURING_PHASE;
- while (!e.stop && index-- > 0) {
- current = ancestors [index];
- if (current.nListeners != 0)
- notifyNode (e, current, true, notificationSet);
- }
- }
-
- // Always deliver events to the target node (this)
- // unless stopPropagation was called. If we saw
- // no registrations yet (typical!), we never will.
- if (!e.stop && nListeners != 0) {
- e.eventPhase = Event.AT_TARGET;
- notifyNode (e, this, false, notificationSet);
- } else if (!haveAncestorRegistrations)
- e.stop = true;
-
- // If the event bubbles and propagation wasn't halted,
- // walk back up the ancestor list. Stop bubbling when
- // any bubbled event handler stops it.
-
- if (!e.stop && e.bubbles) {
- e.eventPhase = Event.BUBBLING_PHASE;
- for (index = 0;
- !e.stop
- && index < ancestorMax
- && (current = ancestors [index]) != null;
- index++) {
- if (current.nListeners != 0)
- notifyNode (e, current, false, notificationSet);
- }
- }
- e.eventPhase = 0;
-
- // Caller chooses whether to perform the default
- // action based on return from this method.
- return e.doDefault;
-
- } finally {
- if (haveDispatchDataLock) {
- // synchronize to force write ordering
- synchronized (lockNode) {
- // null out refs to ensure they'll be GC'd
- for (int i = 0; i < ancestorMax; i++)
- ancestors [i] = null;
- // notificationSet handled by notifyNode
-
- dispatchDataLock = false;
- }
- }
- }
- }
-
-
- private void notifyNode (
- DomEvent e,
- DomNode current,
- boolean capture,
- ListenerRecord notificationSet []
- ) {
- int count = 0;
-
- // do any of this set of listeners get notified?
- for (int i = 0; i < current.nListeners; i++) {
- ListenerRecord rec = current.listeners [i];
-
- if (rec.useCapture != capture)
- continue;
- if (!e.type.equals (rec.type))
- continue;
- if (count < notificationSet.length)
- notificationSet [count++] = rec;
- else
- // XXX fire up some cheap growth algorithm
- throw new RuntimeException (
- "Event notification set size exceeded");
- }
-
- // Notify just those listeners
- e.currentNode = current;
- for (int i = 0; i < count; i++) {
- try {
- // Late in the DOM CR process (3rd or 4th CR?) the
- // removeEventListener spec became asymmetric with respect
- // to addEventListener ... effect is now immediate.
- for (int j = 0; j < current.nListeners; j++) {
- if (current.listeners [j].equals (notificationSet [i])) {
- notificationSet [i].listener.handleEvent (e);
- break;
- }
- }
-
- } catch (Exception x) {
- // ignore all exceptions
- }
- notificationSet [i] = null; // free for GC
- }
- }
-
- /**
- * <b>DOM L2 (Events)</b>
- * Unregisters an event listener.
- */
- final public void removeEventListener (
- String type,
- EventListener listener,
- boolean useCapture
- ) {
- for (int i = 0; i < nListeners; i++) {
- if (listeners [i].listener != listener)
- continue;
- if (listeners [i].useCapture != useCapture)
- continue;
- if (!listeners [i].type.equals (type))
- continue;
-
- if (nListeners == 1) {
- listeners = null;
- nListeners = 0;
- } else {
- for (int j = i + 1; j < nListeners; j++)
- listeners [i++] = listeners [j++];
- listeners [--nListeners] = null;
- }
- break;
- }
- // no exceptions reported
- }
-
-
- /**
- * <b>DOM L1 (relocated in DOM L2)</b>
- * In this node and all contained nodes (including attributes if
- * relevant) merge adjacent text nodes. This is done while ignoring
- * text which happens to use CDATA delimiters).
- */
- public void normalize ()
- {
- int index = 0;
- Node child, next;
- Text temp;
- NamedNodeMap attributes;
-
- while ((child = item (index)) != null) {
- switch (child.getNodeType ()) {
- case TEXT_NODE:
- next = item (index + 1);
- if (next == null || next.getNodeType () != TEXT_NODE)
- break;
- temp = (Text) child;
- temp.appendData (next.getNodeValue ());
- removeChild (next);
- // don't increment index ... we do extra fetches
- // of the current node, affecting only speed.
- continue;
-
- case ELEMENT_NODE:
- child.normalize ();
- attributes = child.getAttributes ();
- for (int i = 0; i < attributes.getLength (); i++)
- attributes.item (i).normalize ();
- // FALLTHROUGH
- }
- index++;
- continue;
- }
- }
-
-
- /**
- * Returns true iff node types match, and either (a) both nodes have no
- * namespace and their getNodeName() values are the same, or (b) both
- * nodes have the same getNamespaceURI() and same getLocalName() values.
- *
- * <p>Note that notion of a "Per-Element-Type" attribute name scope, as
- * found in a non-normative appendix of the XML Namespaces specification,
- * is not supported here. Your application must implement that notion,
- * typically by not bothering to check nameAndTypeEquals for attributes
- * without namespace URIs unless you already know their elements are
- * nameAndTypeEquals.
- */
- public boolean nameAndTypeEquals (Node other)
- {
- // node types must match
- if (getNodeType () != other.getNodeType ())
- return false;
-
- // if both have namespaces, do a "full" comparision
- // this is a "global" partition
- String ns1 = this.getNamespaceURI ();
- String ns2 = other.getNamespaceURI ();
-
- if (ns1 != null && ns2 != null)
- return ns1.equals (ns2)
- && getLocalName ().equals (other.getLocalName ());
-
- // if neither has a namespace, this is a "no-namespace" name.
- if (ns1 == null && ns2 == null) {
- if (getNodeName().equals (other.getNodeName ()) == false)
- return false;
- // can test the non-normative "per-element-type" scope here.
- // if this is an attribute node and both nodes have been bound
- // to elements (!!), then return the nameAndTypeEquals()
- // comparison of those elements.
- return true;
- }
-
- // otherwise they're unequal: one scoped, one not.
- return false;
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomNotation.java b/external/jaxp/source/gnu/xml/dom/DomNotation.java
deleted file mode 100644
index a64969a2d..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomNotation.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "Notation" implementation. This is a non-core DOM class, supporting
- * the "XML" feature. </p>
- *
- * <p> Although unparsed entities using this notation can be detected using
- * DOM, neither NOTATIONS nor ENTITY/ENTITIES attributes can be so detected.
- * More, there is no portable way to construct a Notation node, so there's
- * no way that vendor-neutral DOM construction APIs could even report a
- * NOTATION used to identify the intended meaning of a ProcessingInstruction.
- * </p>
- *
- * <p> In short, <em>avoid using this DOM functionality</em>.
- *
- * @see DomDoctype
- * @see DomEntity
- * @see DomPI
- *
- * @author David Brownell
- */
-public class DomNotation extends DomExtern implements Notation
-{
- /**
- * Constructs a Notation node associated with the specified document,
- * with the specified descriptive data. Note that at least one of
- * the PUBLIC and SYSTEM identifiers must be provided; unlike other
- * external objects in XML, notations may have only a PUBLIC identifier.
- *
- * <p>This constructor should only be invoked by a DomDoctype object
- * as part of its declareNotation functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
- *
- * @param owner The document with which this notation is associated
- * @param name Name of this notation
- * @param publicId If non-null, provides the notation's PUBLIC identifier
- * @param systemId If non-null, rovides the notation's SYSTEM identifier
- */
- protected DomNotation (
- Document owner,
- String name,
- String publicId,
- String systemId
- )
- {
- super (owner, name, publicId, systemId);
- makeReadonly ();
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant NOTATION_NODE.
- */
- final public short getNodeType ()
- { return NOTATION_NODE; }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomNsNode.java b/external/jaxp/source/gnu/xml/dom/DomNsNode.java
deleted file mode 100644
index 9dd23be1d..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomNsNode.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> Abstract implemention of namespace support. This facilitates
- * sharing code for attribute and element nodes.
- *
- * @author David Brownell
- */
-public abstract class DomNsNode extends DomNode
-{
- private String name; // changed by setPrefix
- private final String namespace;
-
-
- /**
- * Constructs a node associated with the specified document, and
- * with the specified namespace information.
- *
- * @param owner The document with which this entity is associated
- * @param namespaceURI Combined with the local part of the name,
- * this identifies a type of element or attribute; may be null.
- * If this is the empty string, it is reassigned as null so that
- * applications only need to test that case.
- * @param name Name of this node, which may include a prefix
- */
- // package private
- DomNsNode (Document owner, String namespaceURI, String name)
- {
- super (owner);
- this.name = name;
- if ("".equals (namespaceURI))
- namespaceURI = null;
- this.namespace = namespaceURI;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the node's name, including any namespace prefix.
- */
- final public String getNodeName ()
- {
- return name;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the node's namespace URI
- * <em>or null</em> if the node name is not namespace scoped.
- */
- final public String getNamespaceURI ()
- {
- return namespace;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns any prefix part of the node's name (before any colon).
- */
- public String getPrefix ()
- {
- if (namespace == null)
- return null;
-
- int index = name.indexOf (':');
- if (index < 0)
- return null;
- else
- return name.substring (0, index);
- }
-
-
- /**
- * <b>DOM L2</b>
- * Assigns the prefix part of the node's name (before any colon).
- */
- public void setPrefix (String prefix)
- {
- String local = getLocalName ();
-
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
-
- if (prefix == null) {
- name = local;
- return;
- } else if (namespace == null)
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "can't set prefix, node has no namespace URI", this, 0);
-
- DomDocument.verifyXmlName (prefix);
- if (prefix.indexOf (':') != -1)
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "illegal prefix " + prefix, this, 0);
-
- if ("xml".equals (prefix)
- && !DomDocument.xmlNamespace.equals (namespace))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xml namespace is always " + DomDocument.xmlNamespace, this, 0);
-
- if ("xmlns".equals (prefix)) {
- if (namespace != null || getNodeType () != ATTRIBUTE_NODE)
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "xmlns attribute prefix is reserved", this, 0);
- } else if (getNodeType () == ATTRIBUTE_NODE
- && ("xmlns".equals (name) || name.startsWith ("xmlns:")))
- throw new DomEx (DomEx.NAMESPACE_ERR,
- "namespace declarations can't change names", this, 0);
-
- name = prefix + ':' + local;
- }
-
-
- /**
- * <b>DOM L2</b>
- * Returns the local part of the node's name (after any colon),
- * <em>or null</em> if the node name is not namespace scoped.
- */
- public String getLocalName ()
- {
- if (namespace == null)
- return null;
-
- int index = name.indexOf (':');
- if (index < 0)
- return name;
- else
- return name.substring (index + 1);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomPI.java b/external/jaxp/source/gnu/xml/dom/DomPI.java
deleted file mode 100644
index 28c12fe40..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomPI.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "ProcessingInstruction" (PI) implementation.
- * This is a non-core DOM class, supporting the "XML" feature. </p>
- *
- * <p> Unlike other DOM APIs in the "XML" feature, this one fully
- * exposes the functionality it describes. So there is no reason
- * inherent in DOM to avoid using this API, unless you want to rely
- * on NOTATION declarations to associate meaning with your PIs;
- * there is no vendor-neutal way to record those notations in DOM.</p>
- *
- * <p> Also of note is that PI support is part of SAX, so that XML
- * systems using PIs can choose among multiple APIs. </p>
- *
- * @see DomNotation
- *
- * @author David Brownell
- */
-public class DomPI extends DomNode implements ProcessingInstruction
-{
- private String target;
- private String data;
-
-
- /**
- * Constructs a ProcessingInstruction node associated with the
- * specified document, with the specified data.
- *
- * <p>This constructor should only be invoked by a Document object as
- * part of its createProcessingInstruction functionality, or through
- * a subclass which is similarly used in a "Sub-DOM" style layer.
- */
- protected DomPI (Document owner, String target, String data)
- {
- super (owner);
- this.target = target;
- this.data = data;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the target of the processing instruction.
- */
- final public String getTarget ()
- {
- return target;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the target of the processing instruction
- * (same as getTarget).
- */
- final public String getNodeName ()
- {
- return target;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the constant PROCESSING_INSTRUCTION_NODE.
- */
- final public short getNodeType ()
- { return PROCESSING_INSTRUCTION_NODE; }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the data associated with the processing instruction.
- */
- final public String getData ()
- {
- return data;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the data associated with the processing instruction
- * (same as getData).
- */
- final public String getNodeValue ()
- {
- return data;
- }
-
-
- /**
- * <b>DOM L1</b>
- * Assigns the data associated with the processing instruction;
- * same as setNodeValue.
- */
- final public void setData (String data)
- {
- setNodeValue (data);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Assigns the data associated with the processing instruction.
- */
- final public void setNodeValue (String data)
- {
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- this.data = data;
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/DomText.java b/external/jaxp/source/gnu/xml/dom/DomText.java
deleted file mode 100644
index 0c4ef1c15..000000000
--- a/external/jaxp/source/gnu/xml/dom/DomText.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.dom;
-
-import org.w3c.dom.*;
-
-
-/**
- * <p> "Text" implementation. </p>
- *
- * @author David Brownell
- */
-public class DomText extends DomCharacterData implements Text
-{
- // NOTE: deleted unused per-instance "isIgnorable"
- // support to reclaim its space.
-
- /**
- * Constructs a text node associated with the specified
- * document and holding the specified data.
- *
- * <p>This constructor should only be invoked by a Document object
- * as part of its createTextNode functionality, or through a subclass
- * which is similarly used in a "Sub-DOM" style layer.
- */
- protected DomText (Document owner, String value)
- {
- super (owner, value);
- }
-
- protected DomText (Document owner, char buf [], int off, int len)
- {
- super (owner, buf, off, len);
- }
-
-
- /**
- * <b>DOM L1</b>
- * Returns the string "#text".
- */
- // can't be 'final' with CDATA subclassing
- public String getNodeName ()
- {
- return "#text";
- }
-
- /**
- * <b>DOM L1</b>
- * Returns the constant TEXT_NODE.
- */
- // would be final except DomCDATA subclasses this ...
- public short getNodeType ()
- { return TEXT_NODE; }
-
-
- /**
- * <b>DOM L1</b>
- * Splits this text node in two parts at the offset, returning
- * the new text node (the sibling with the second part).
- */
- public Text splitText (int offset)
- {
- if (isReadonly ())
- throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR);
- try {
- String before = getNodeValue ().substring (0, offset);
- String after = getNodeValue ().substring (offset);
- Text next;
-
- if (getNodeType () == TEXT_NODE)
- next = getOwnerDocument ().createTextNode (after);
- else // CDATA_SECTION_NODE
- next = getOwnerDocument ().createCDATASection (after);
-
- getParentNode ().insertBefore (next, getNextSibling ());
- setNodeValue (before);
- return next;
-
- } catch (IndexOutOfBoundsException x) {
- throw new DomEx (DomEx.INDEX_SIZE_ERR);
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/JAXPFactory.java b/external/jaxp/source/gnu/xml/dom/JAXPFactory.java
deleted file mode 100644
index fcf3fd333..000000000
--- a/external/jaxp/source/gnu/xml/dom/JAXPFactory.java
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-
-package gnu.xml.dom;
-
-import java.io.IOException;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.DocumentType;
-import org.w3c.dom.DOMImplementation;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.parsers.SAXParserFactory;
-
-
-/**
- * DOM bootstrapping API, for use with JAXP.
- *
- * @see Consumer
- *
- * @author David Brownell
- */
-public final class JAXPFactory extends DocumentBuilderFactory
-{
- private static final String PROPERTY = "http://xml.org/sax/properties/";
- private static final String FEATURE = "http://xml.org/sax/features/";
-
- private SAXParserFactory pf;
-
- /**
- * Default constructor.
- */
- public JAXPFactory () { }
-
- /**
- * Constructs a JAXP document builder which uses the default
- * JAXP SAX2 parser and the DOM implementation in this package.
- */
- public DocumentBuilder newDocumentBuilder ()
- throws ParserConfigurationException
- {
- if (pf == null) {
- // Force use of AElfred2 since not all JAXP parsers
- // conform very well to the SAX2 API spec ...
- pf = new gnu.xml.aelfred2.JAXPFactory ();
- // pf = SAXParserFactory.newInstance ();
- }
-
- // JAXP default: false
- pf.setValidating (isValidating ());
-
- // FIXME: this namespace setup may cause errors in some
- // conformant SAX2 parsers, which we CAN patch up by
- // splicing a "NSFilter" stage up front ...
-
- // JAXP default: false
- pf.setNamespaceAware (isNamespaceAware ());
-
- try {
- // undo rude "namespace-prefixes=false" default
- pf.setFeature (FEATURE + "namespace-prefixes", true);
-
- return new JAXPBuilder (pf.newSAXParser ().getXMLReader (), this);
- } catch (SAXException e) {
- throw new ParserConfigurationException (
- "can't create JAXP DocumentBuilder: " + e.getMessage ());
- }
- }
-
- /** There seems to be no useful specification for attribute names */
- public void setAttribute (String name, Object value)
- throws IllegalArgumentException
- {
- throw new IllegalArgumentException (name);
- }
-
- /** There seems to be no useful specification for attribute names */
- public Object getAttribute (String name)
- throws IllegalArgumentException
- {
- throw new IllegalArgumentException (name);
- }
-
- static final class JAXPBuilder extends DocumentBuilder
- implements ErrorHandler
- {
- private Consumer consumer;
- private XMLReader producer;
- private DomImpl impl;
-
- JAXPBuilder (XMLReader parser, JAXPFactory factory)
- throws ParserConfigurationException
- {
- impl = new DomImpl ();
-
- // set up consumer side
- try {
- consumer = new Consumer ();
- } catch (SAXException e) {
- throw new ParserConfigurationException (e.getMessage ());
- }
-
- // JAXP defaults: true, noise nodes are good (bleech)
- consumer.setHidingReferences (
- factory.isExpandEntityReferences ());
- consumer.setHidingComments (
- factory.isIgnoringComments ());
- consumer.setHidingWhitespace (
- factory.isIgnoringElementContentWhitespace ());
- consumer.setHidingCDATA (
- factory.isCoalescing ());
-
- // set up producer side
- producer = parser;
- producer.setContentHandler (consumer.getContentHandler ());
- producer.setDTDHandler (consumer.getDTDHandler ());
-
- try {
- String id;
-
- // if validating, report validity errors, and default
- // to treating them as fatal
- if (factory.isValidating ()) {
- producer.setFeature (FEATURE + "validation",
- true);
- producer.setErrorHandler (this);
- }
-
- // always save prefix info, maybe do namespace processing
- producer.setFeature (FEATURE + "namespace-prefixes",
- true);
- producer.setFeature (FEATURE + "namespaces",
- factory.isNamespaceAware ());
-
- // set important handlers
- id = PROPERTY + "lexical-handler";
- producer.setProperty (id, consumer.getProperty (id));
-
- id = PROPERTY + "declaration-handler";
- producer.setProperty (id, consumer.getProperty (id));
-
- } catch (SAXException e) {
- throw new ParserConfigurationException (e.getMessage ());
- }
- }
-
-
- public Document parse (InputSource source)
- throws SAXException, IOException
- {
- producer.parse (source);
- return consumer.getDocument ();
- }
-
- public boolean isNamespaceAware ()
- {
- try {
- return producer.getFeature (FEATURE + "namespaces");
- } catch (SAXException e) {
- // "can't happen"
- throw new RuntimeException (e.getMessage ());
- }
- }
-
- public boolean isValidating ()
- {
- try {
- return producer.getFeature (FEATURE + "validation");
- } catch (SAXException e) {
- // "can't happen"
- throw new RuntimeException (e.getMessage ());
- }
- }
-
- public void setEntityResolver (EntityResolver resolver)
- { producer.setEntityResolver (resolver); }
-
- public void setErrorHandler (ErrorHandler handler)
- {
- producer.setErrorHandler (handler);
- consumer.setErrorHandler (handler);
- }
-
- public DOMImplementation getDOMImplementation ()
- { return impl; }
-
- public Document newDocument ()
- { return new DomDocument (); }
-
- // implementation of error handler that's used when validating
- public void fatalError (SAXParseException e) throws SAXException
- { throw e; }
- public void error (SAXParseException e) throws SAXException
- { throw e; }
- public void warning (SAXParseException e) throws SAXException
- { /* ignore */ }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/dom/package.html b/external/jaxp/source/gnu/xml/dom/package.html
deleted file mode 100644
index d65e85da3..000000000
--- a/external/jaxp/source/gnu/xml/dom/package.html
+++ /dev/null
@@ -1,270 +0,0 @@
-<html><head>
-<!-- $Id: package.html,v 1.2 2004-05-01 16:18:50 mark Exp $ -->
-<title>foo</title>
-</head><body>
-
-<p> This is a Free Software
-DOM Level 2 implementation, supporting these features:
-"XML",
-"Events", "MutationEvents",
-"HTMLEvents" (won't generate them though),
-"UIEvents" (also won't generate them),
-"USER-Events" (a conformant extension),
-and
-"Traversal" (optional; no TreeWalker yet).
-It includes JAXP bootstrapping support, addressing the issue that
-DOM (Levels 1 and 2) doesn't include bootstrapping APIs.
-It is intended to be a reasonable base both for
-experimentation and supporting additional DOM modules as clean layers.
-</p>
-
-<p>Note that while DOM does not specify its behavior in the
-face of concurrent access, this implementation does.
-Specifically:
-if only one thread at a time accesses a Document,
-of if several threads cooperate for read-only access,
-then no concurrency conflicts will occur.
-If several threads mutate a given document
-(or send events using it) at the same time,
-there is currently no guarantee that
-they won't interfere with each other.
-</p>
-
-<h3> Design Goals </h3>
-
-<p> A number of DOM implementations are available in Java, including
-commercial ones from Sun, IBM, Oracle, and DataChannel as well as
-noncommercial ones from Docuverse, OpenXML, and Silfide. Why have
-another? Some of the goals of this version: </p> <ul>
-
- <li> DOM Level 2 support. This was the first generally available
- implementation of DOM Level 2 in Java. </li>
-
- <li> Free Software. This one is distributed under the GPL (with
- "library exception") so it can be used with a different class of
- application. </li>
-
- <li> Second implementation syndrome. I can do it simpler this time
- around ... and heck, writing it only takes a bit over a day once you
- know your way around. (Debugging is of course a different story,
- since W3C hasn't provided any conformance test suite and publicly
- available suites have poor coverage.) </li>
-
- <li> Sanity check the then-current Last Call DOM draft. Best to find
- bugs early, when they're relatively fixable. Yes, bugs were found.
- </li>
-
- <li> Modularity. Most of the implementations mentioned above are part
- of huge packages; take all (including bugs, of which some have far
- too many), or take nothing. I prefer a menu approach, when possible.
- This code is standalone, not beholden to any particular parser or XSL
- or XPath code. </li>
-
- <li> OK, I'm a hacker, I like to write code. </li>
-
- </ul>
-
-<p> This also works with the Gnu Compiler for Java (GCJ). GCJ promises
-to be quite the environment for programming Java, both directly and from
-C++ using the new CNI interfaces (which really use C++, unlike JNI). </p>
-
-
-<h3> Open Issues </h3>
-
-<p> At this writing: </p> <ul>
-
- <li> An approximation of XML rules for legal names is used (Unicode
- rules with minor tweaks) rather than the huge character tables in the
- XML appendix. </li>
-
- <li> See below for some restrictions on the mutation event
- support ... some events aren't reported (and likely won't be). </li>
-
- <li> There's no implementation (yet)
- for the TreeWalker traversal API.</li>
-
- <li> More testing and conformance work is needed. </li>
-
- </ul>
-
-<p> I ran a profiler a few times and remove some of the performance hotspots,
-but it's not tuned. Reporting mutation events, in particular, is
-rather costly -- it started at about a 40% penalty for appendNode calls,
-I've got it down around 12%, but it'll be hard to shrink it much further.
-The overall code size is relatively small, though you may want to be rid of
-many of the unused DOM interface classes (HTML, CSS, and so on).</p>
-
-
-<h2><a name="features">Features of this Package</a></h2>
-
-<p> Starting with DOM Level 2, you can really see that DOM is constructed
-as a bunch of optional modules around a core of either XML or HTML
-functionality. Different implementations will support different optional
-modules. This implementation provides a set of features that should be
-useful if you're not depending on the HTML functionality (lots of convenience
-functions that mostly don't buy much except API surface area) and user
-interface support. That is, browsers will want more -- but what they
-need should be cleanly layered over what's already here. </p>
-
-<h3> Core Feature Set: "XML" </h3>
-
-<p> This DOM implementation supports the "XML" feature set, which basically
-gets you four things over the bare core (which you're officially not supposed
-to implement except in conjunction with the "XML" or "HTML" feature). In
-order of decreasing utility, those four things are: </p> <ol>
-
- <li> ProcessingInstruction nodes. These are probably the most
- valuable thing. Handy little buggers, in part because all the APIs
- you need to use them are provided, and they're designed to let you
- escape XML document structure rules in controlled ways.</li>
-
- <li> CDATASection nodes. These are of of limited utility since CDATA
- is just text that prints funny. These are of use to some sorts of
- applications, though I encourage folk to not use them. </li>
-
- <li> DocumentType nodes, and associated Notation and Entity nodes.
- These appear to be useless. Briefly, these "Type" nodes expose no
- typing information. They're only really usable to expose some lexical
- structure that almost every application needs to ignore. (XML editors
- might like to see them, but they need true typing information much more.)
- I strongly encourage people not to use these. </li>
-
- <li> EntityReference nodes can show up. These are actively annoying,
- since they add an extra level of hierarchy, are the cause of most of
- the complexity in attribute values, and their contents are immutable.
- Avoid these.</li>
-
- </ol>
-
-<h3> Optional Feature Sets: "Events", and friends </h3>
-
-<p> Events may be one of the more interesting new features in Level 2.
-This package provides the core feature set and exposes mutation events.
-No gooey events though; if you want that, write a layered implementation! </p>
-
-<p> Three mutation events aren't currently generated:</p> <ul>
-
- <li> <em>DOMSubtreeModified</em> is poorly specified. Think of this
- as generating one such event around the time of finalization, which
- is a fully conformant implementation. This implementation is exactly
- as useful as that one. </li>
-
- <li> <em>DOMNodeRemovedFromDocument</em> and
- <em>DOMNodeInsertedIntoDocument</em> are supposed to get sent to
- every node in a subtree that gets removed or inserted (respectively).
- This can be <em>extremely costly</em>, and the removal and insertion
- processing is already significantly slower due to event reporting.
- It's much easier, and more efficient, to have a listener higher in the
- tree watch removal and insertion events through the bubbling or capture
- mechanisms, than it is to watch for these two events.</li>
-
- </ul>
-
-<p> In addition, certain kinds of attribute modification aren't reported.
-A fix is known, but it couldn't report the previous value of the attribute.
-More work could fix all of this (as well as reduce the generally high cost
-of childful attributes), but that's not been done yet. </p>
-
-<p> Also, note that it is a <em>Bad Thing&#153;</em> to have the listener
-for a mutation event change the ancestry for the target of that event.
-Or to prevent mutation events from bubbling to where they're needed.
-Just don't do those, OK? </p>
-
-<p> As an experimental feature (named "USER-Events"), you can provide
-your own "user" events. Just name them anything starting with "USER-"
-and you're set. Dispatch them through, bubbling, capturing, or what
-ever takes your fancy. One important thing you can't currently do is
-pass any data (like an object) with those events. Maybe later there
-will be a "UserEvent" interface letting you get some substantial use
-out of this mechanism even if you're not "inside" of a DOM package.</p>
-
-<p> You can create and send HTML events. Ditto UIEvents. Since DOM
-doesn't require a UI, it's the UI's job to send them; perhaps that's
-part of your application. </p>
-
-<p><em>This package may be built without the ability to report mutation
-events, gaining a significant speedup in DOM construction time. However,
-if that is done then certain other features -- notably node iterators
-and getElementsByTagname -- will not be available.</em>
-
-
-<h3> Optional Feature: "Traversal" </h3>
-
-<p> Each DOM node has all you need to walk to everything connected
-to that node. Lightweight, efficient utilities are easily layered on
-top of just the core APIs. </p>
-
-<p> Traversal APIs are an optional part of DOM Level 2, providing
-a not-so-lightweight way to walk over DOM trees, if your application
-didn't already have such utilities for use with data represented via
-DOM. Implementing this helped debug the (optional) event and mutation
-event subsystems, so it's provided here. </p>
-
-<p> At this writing, the "TreeWalker" interface isn't implemented. </p>
-
-
-
-<h2><a name='avoid'>DOM Functionality to Avoid</a></h2>
-
-<p> For what appear to be a combination of historical and "committee
-logic" reasons, DOM has a number of <em>features which I strongly advise
-you to avoid using</em> in your library and application code. These
-include the following types of DOM nodes; see the documentation for the
-implementation class for more information: <ul>
-
- <li> CDATASection
- (<a href='DomCDATA.html'>DomCDATA</a> class)
- ... use normal Text nodes instead, so you don't have to make
- every algorithm recognize multiple types of character data
-
- <li> DocumentType
- (<a href='DomDoctype.html'>DomDocType</a> class)
- ... if this held actual typing information, it might be useful
-
- <li> Entity
- (<a href='DomEntity.html'>DomEntity</a> class)
- ... neither parsed nor unparsed entities work well in DOM; it
- won't even tell you which attributes identify unparsed entities
-
- <li> EntityReference
- (<a href='DomEntityReference.html'>DomEntityReference</a> class)
- ... permitted implementation variances are extreme, all children
- are readonly, and these can interact poorly with namespaces
-
- <li> Notation
- (<a href='DomNotation.html'>DomNotation</a> class)
- ... only really usable with unparsed entities (which aren't well
- supported; see above) or perhaps with PIs after the DTD, not with
- NOTATION attributes
-
- </ul>
-
-<p> If you really need to use unparsed entities or notations, use SAX;
-it offers better support for all DTD-related functionality.
-It also exposes actual
-document typing information (such as element content models).</p>
-
-<p> Also, when accessing attribute values, use methods that provide their
-values as single strings, rather than those which expose value substructure
-(Text and EntityReference nodes). (See the <a href='DomAttr.html'>DomAttr</a>
-documentation for more information.) </p>
-
-<p> Note that many of these features were provided as partial support for
-editor functionality (including the incomplete DTD access). Full editor
-functionality requires access to potentially malformed lexical structure,
-at the level of unparsed tokens and below. Access at such levels is so
-complex that using it in non-editor applications sacrifices all the
-benefits of XML; editor aplications need extremely specialized APIs. </p>
-
-<p> (This isn't a slam against DTDs, note; only against the broken support
-for them in DOM. Even despite inclusion of some dubious SGML legacy features
-such as notations and unparsed entities,
-and the ongoing proliferation of alternative schema and validation tools,
-DTDs are still the most widely adopted tool
-to constrain XML document structure.
-Alternative schemes generally focus on data transfer style
-applications; open document architectures comparable to
-DocBook 4.0 don't yet exist in the schema world.
-Feel free to use DTDs; just don't expect DOM to help you.) </p>
-
-</body></html>
diff --git a/external/jaxp/source/gnu/xml/pipeline/CallFilter.java b/external/jaxp/source/gnu/xml/pipeline/CallFilter.java
deleted file mode 100644
index 2d8d4180b..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/CallFilter.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.*;
-import java.net.*;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import gnu.xml.util.Resolver;
-import gnu.xml.util.XMLWriter;
-
-
-/**
- * Input is sent as an XML request to given URI, and the output of this
- * filter is the parsed response to that request.
- * A connection is opened to the remote URI when the startDocument call is
- * issued through this filter, and the request is finished when the
- * endDocument call is issued. Events should be written quickly enough to
- * prevent the remote HTTP server from aborting the connection due to
- * inactivity; you may want to buffer text in an earlier pipeline stage.
- * If your application requires validity checking of such
- * outputs, have the output pipeline include a validation stage.
- *
- * <p>In effect, this makes a remote procedure call to the URI, with the
- * request and response document syntax as chosen by the application.
- * <em>Note that all the input events must be seen, and sent to the URI,
- * before the first output event can be seen. </em> Clients are delayed
- * at least by waiting for the server to respond, constraining concurrency.
- * Services can thus be used to synchronize concurrent activities, and
- * even to prioritize service among different clients.
- *
- * <p> You are advised to avoid restricting yourself to an "RPC" model
- * for distributed computation. With a World Wide Web, network latencies
- * and failures (e.g. non-availability)
- * are significant; adopting a "procedure" model, rather than a workflow
- * model where bulk requests are sent and worked on asynchronously, is not
- * generally an optimal system-wide architecture. When the messages may
- * need authentication, such as with an OpenPGP signature, or when server
- * loads don't argue in favor of immediate responses, non-RPC models can
- * be advantageous. (So-called "peer to peer" computing models are one
- * additional type of model, though too often that term is applied to
- * systems that still have a centralized control structure.)
- *
- * <p> <em>Be strict in what you send, liberal in what you accept,</em> as
- * the Internet tradition goes. Strictly conformant data should never cause
- * problems to its receiver; make your request pipeline be very strict, and
- * don't compromise on that. Make your response pipeline strict as well,
- * but be ready to tolerate specific mild, temporary, and well-documented
- * variations from specific communications peers.
- *
- * @see XmlServlet
- *
- * @author David Brownell
- */
-final public class CallFilter implements EventConsumer
-{
- private Requestor req;
- private EventConsumer next;
- private URL target;
- private URLConnection conn;
- private ErrorHandler errHandler;
-
-
- /**
- * Initializes a call filter so that its inputs are sent to the
- * specified URI, and its outputs are sent to the next consumer
- * provided.
- *
- * @exception IOException if the URI isn't accepted as a URL
- */
- // constructor used by PipelineFactory
- public CallFilter (String uri, EventConsumer next)
- throws IOException
- {
- this.next = next;
- req = new Requestor ();
- setCallTarget (uri);
- }
-
- /**
- * Assigns the URI of the call target to be used.
- * Does not affect calls currently being made.
- */
- final public void setCallTarget (String uri)
- throws IOException
- {
- target = new URL (uri);
- }
-
- /**
- * Assigns the error handler to be used to present most fatal
- * errors.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- req.setErrorHandler (handler);
- }
-
-
- /**
- * Returns the call target's URI.
- */
- final public String getCallTarget ()
- {
- return target.toString ();
- }
-
- /** Returns the content handler currently in use. */
- final public org.xml.sax.ContentHandler getContentHandler ()
- {
- return req;
- }
-
- /** Returns the DTD handler currently in use. */
- final public DTDHandler getDTDHandler ()
- {
- return req;
- }
-
-
- /**
- * Returns the declaration or lexical handler currently in
- * use, or throws an exception for other properties.
- */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- if (EventFilter.DECL_HANDLER.equals (id))
- return req;
- if (EventFilter.LEXICAL_HANDLER.equals (id))
- return req;
- throw new SAXNotRecognizedException (id);
- }
-
-
- // JDK 1.1 seems to need it to be done this way, sigh
- ErrorHandler getErrorHandler () { return errHandler; }
-
- //
- // Takes input and echoes to server as POST input.
- // Then sends the POST reply to the next pipeline element.
- //
- final class Requestor extends XMLWriter
- {
- Requestor ()
- {
- super ((Writer)null);
- }
-
- public synchronized void startDocument () throws SAXException
- {
- // Connect to remote object and set up to send it XML text
- try {
- if (conn != null)
- throw new IllegalStateException ("call is being made");
-
- conn = target.openConnection ();
- conn.setDoOutput (true);
- conn.setRequestProperty ("Content-Type",
- "application/xml;charset=UTF-8");
-
- setWriter (new OutputStreamWriter (
- conn.getOutputStream (),
- "UTF8"), "UTF-8");
-
- } catch (IOException e) {
- fatal ("can't write (POST) to URI: " + target, e);
- }
-
- // NOW base class can safely write that text!
- super.startDocument ();
- }
-
- public void endDocument () throws SAXException
- {
- //
- // Finish writing the request (for HTTP, a POST);
- // this closes the output stream.
- //
- super.endDocument ();
-
- //
- // Receive the response.
- // Produce events for the next stage.
- //
- InputSource source;
- XMLReader producer;
- String encoding;
-
- try {
-
- source = new InputSource (conn.getInputStream ());
-
-// FIXME if status is anything but success, report it!! It'd be good to
-// save the request data just in case we need to deal with a forward.
-
- encoding = Resolver.getEncoding (conn.getContentType ());
- if (encoding != null)
- source.setEncoding (encoding);
-
- producer = XMLReaderFactory.createXMLReader ();
- producer.setErrorHandler (getErrorHandler ());
- EventFilter.bind (producer, next);
- producer.parse (source);
- conn = null;
-
- } catch (IOException e) {
- fatal ("I/O Exception reading response, " + e.getMessage (), e);
- }
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/DomConsumer.java b/external/jaxp/source/gnu/xml/pipeline/DomConsumer.java
deleted file mode 100755
index 76ea7d37b..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/DomConsumer.java
+++ /dev/null
@@ -1,943 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.util.Hashtable;
-
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.LexicalHandler;
-import org.xml.sax.helpers.AttributesImpl;
-
-import gnu.xml.util.DomParser;
-
-
-/**
- * This consumer builds a DOM Document from its input, acting either as a
- * pipeline terminus or as an intermediate buffer. When a document's worth
- * of events has been delivered to this consumer, that document is read with
- * a {@link DomParser} and sent to the next consumer. It is also available
- * as a read-once property.
- *
- * <p>The DOM tree is constructed as faithfully as possible. There are some
- * complications since a DOM should expose behaviors that can't be implemented
- * without API backdoors into that DOM, and because some SAX parsers don't
- * report all the information that DOM permits to be exposed. The general
- * problem areas involve information from the Document Type Declaration (DTD).
- * DOM only represents a limited subset, but has some behaviors that depend
- * on much deeper knowledge of a document's DTD. You shouldn't have much to
- * worry about unless you change handling of "noise" nodes from its default
- * setting (which ignores them all); note if you use JAXP to populate your
- * DOM trees, it wants to save "noise" nodes by default. (Such nodes include
- * ignorable whitespace, comments, entity references and CDATA boundaries.)
- * Otherwise, your
- * main worry will be if you use a SAX parser that doesn't flag ignorable
- * whitespace unless it's validating (few don't).
- *
- * <p> The SAX2 events used as input must contain XML Names for elements
- * and attributes, with original prefixes. In SAX2,
- * this is optional unless the "namespace-prefixes" parser feature is set.
- * Moreover, many application components won't provide completely correct
- * structures anyway. <em>Before you convert a DOM to an output document,
- * you should plan to postprocess it to create or repair such namespace
- * information.</em> The {@link NSFilter} pipeline stage does such work.
- *
- * <p> <em>Note: changes late in DOM L2 process made it impractical to
- * attempt to create the DocumentType node in any implementation-neutral way,
- * much less to populate it (L1 didn't support even creating such nodes).
- * To create and populate such a node, subclass the inner
- * {@link DomConsumer.Handler} class and teach it about the backdoors into
- * whatever DOM implementation you want. It's possible that some revised
- * DOM API (L3?) will make this problem solvable again. </em>
- *
- * @see DomParser
- *
- * @author David Brownell
- */
-public class DomConsumer implements EventConsumer
-{
- private Class domImpl;
-
- private boolean hidingCDATA = true;
- private boolean hidingComments = true;
- private boolean hidingWhitespace = true;
- private boolean hidingReferences = true;
-
- private Handler handler;
- private ErrorHandler errHandler;
-
- private EventConsumer next;
-
- // FIXME: this can't be a generic pipeline stage just now,
- // since its input became a Class not a String (to be turned
- // into a class, using the right class loader)
-
-
- /**
- * Configures this pipeline terminus to use the specified implementation
- * of DOM when constructing its result value.
- *
- * @param impl class implementing {@link org.w3c.dom.Document Document}
- * which publicly exposes a default constructor
- *
- * @exception SAXException when there is a problem creating an
- * empty DOM document using the specified implementation
- */
- public DomConsumer (Class impl)
- throws SAXException
- {
- domImpl = impl;
- handler = new Handler (this);
- }
-
- /**
- * This is the hook through which a subclass provides a handler
- * which knows how to access DOM extensions, specific to some
- * implementation, to record additional data in a DOM.
- * Treat this as part of construction; don't call it except
- * before (or between) parses.
- */
- protected void setHandler (Handler h)
- {
- handler = h;
- }
-
-
- private Document emptyDocument ()
- throws SAXException
- {
- try {
- return (Document) domImpl.newInstance ();
- } catch (IllegalAccessException e) {
- throw new SAXException ("can't access constructor: "
- + e.getMessage ());
- } catch (InstantiationException e) {
- throw new SAXException ("can't instantiate Document: "
- + e.getMessage ());
- }
- }
-
-
- /**
- * Configures this consumer as a buffer/filter, using the specified
- * DOM implementation when constructing its result value.
- *
- * <p> This event consumer acts as a buffer and filter, in that it
- * builds a DOM tree and then writes it out when <em>endDocument</em>
- * is invoked. Because of the limitations of DOM, much information
- * will as a rule not be seen in that replay. To get a full fidelity
- * copy of the input event stream, use a {@link TeeConsumer}.
- *
- * @param impl class implementing {@link org.w3c.dom.Document Document}
- * which publicly exposes a default constructor
- * @param next receives a "replayed" sequence of parse events when
- * the <em>endDocument</em> method is invoked.
- *
- * @exception SAXException when there is a problem creating an
- * empty DOM document using the specified DOM implementation
- */
- public DomConsumer (Class impl, EventConsumer n)
- throws SAXException
- {
- this (impl);
- next = n;
- }
-
-
- /**
- * Returns the document constructed from the preceding
- * sequence of events. This method should not be
- * used again until another sequence of events has been
- * given to this EventConsumer.
- */
- final public Document getDocument ()
- {
- return handler.clearDocument ();
- }
-
- public void setErrorHandler (ErrorHandler handler)
- {
- errHandler = handler;
- }
-
-
- /**
- * Returns true if the consumer is hiding entity references nodes
- * (the default), and false if EntityReference nodes should
- * instead be created. Such EntityReference nodes will normally be
- * empty, unless an implementation arranges to populate them and then
- * turn them back into readonly objects.
- *
- * @see #setHidingReferences
- */
- final public boolean isHidingReferences ()
- { return hidingReferences; }
-
- /**
- * Controls whether the consumer will hide entity expansions,
- * or will instead mark them with entity reference nodes.
- *
- * @see #isHidingReferences
- * @param flag False if entity reference nodes will appear
- */
- final public void setHidingReferences (boolean flag)
- { hidingReferences = flag; }
-
-
- /**
- * Returns true if the consumer is hiding comments (the default),
- * and false if they should be placed into the output document.
- *
- * @see #setHidingComments
- */
- public final boolean isHidingComments ()
- { return hidingComments; }
-
- /**
- * Controls whether the consumer is hiding comments.
- *
- * @see #isHidingComments
- */
- public final void setHidingComments (boolean flag)
- { hidingComments = flag; }
-
-
- /**
- * Returns true if the consumer is hiding ignorable whitespace
- * (the default), and false if such whitespace should be placed
- * into the output document as children of element nodes.
- *
- * @see #setHidingWhitespace
- */
- public final boolean isHidingWhitespace ()
- { return hidingWhitespace; }
-
- /**
- * Controls whether the consumer hides ignorable whitespace
- *
- * @see #isHidingComments
- */
- public final void setHidingWhitespace (boolean flag)
- { hidingWhitespace = flag; }
-
-
- /**
- * Returns true if the consumer is saving CDATA boundaries, or
- * false (the default) otherwise.
- *
- * @see #setHidingCDATA
- */
- final public boolean isHidingCDATA ()
- { return hidingCDATA; }
-
- /**
- * Controls whether the consumer will save CDATA boundaries.
- *
- * @see #isHidingCDATA
- * @param flag True to treat CDATA text differently from other
- * text nodes
- */
- final public void setHidingCDATA (boolean flag)
- { hidingCDATA = flag; }
-
-
-
- /** Returns the document handler being used. */
- final public ContentHandler getContentHandler ()
- { return handler; }
-
- /** Returns the DTD handler being used. */
- final public DTDHandler getDTDHandler ()
- { return handler; }
-
- /**
- * Returns the lexical handler being used.
- * (DOM construction can't really use declaration handlers.)
- */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- if ("http://xml.org/sax/properties/lexical-handler".equals (id))
- return handler;
- if ("http://xml.org/sax/properties/declaration-handler".equals (id))
- return handler;
- throw new SAXNotRecognizedException (id);
- }
-
- EventConsumer getNext () { return next; }
-
- ErrorHandler getErrorHandler () { return errHandler; }
-
- /**
- * Class used to intercept various parsing events and use them to
- * populate a DOM document. Subclasses would typically know and use
- * backdoors into specific DOM implementations, used to implement
- * DTD-related functionality.
- *
- * <p> Note that if this ever throws a DOMException (runtime exception)
- * that will indicate a bug in the DOM (e.g. doesn't support something
- * per specification) or the parser (e.g. emitted an illegal name, or
- * accepted illegal input data). </p>
- */
- public static class Handler
- implements ContentHandler, LexicalHandler,
- DTDHandler, DeclHandler
- {
- protected DomConsumer consumer;
-
- private DOMImplementation impl;
- private Document document;
- private boolean isL2;
-
- private Locator locator;
- private Node top;
- private boolean inCDATA;
- private boolean mergeCDATA;
- private boolean inDTD;
- private String currentEntity;
-
- private boolean recreatedAttrs;
- private AttributesImpl attributes = new AttributesImpl ();
-
- /**
- * Subclasses may use SAX2 events to provide additional
- * behaviors in the resulting DOM.
- */
- protected Handler (DomConsumer consumer)
- throws SAXException
- {
- this.consumer = consumer;
- document = consumer.emptyDocument ();
- impl = document.getImplementation ();
- isL2 = impl.hasFeature ("XML", "2.0");
- }
-
- private void fatal (String message, Exception x)
- throws SAXException
- {
- SAXParseException e;
- ErrorHandler errHandler = consumer.getErrorHandler ();;
-
- if (locator == null)
- e = new SAXParseException (message, null, null, -1, -1, x);
- else
- e = new SAXParseException (message, locator, x);
- if (errHandler != null)
- errHandler.fatalError (e);
- throw e;
- }
-
- /**
- * Returns and forgets the document produced. If the handler is
- * reused, a new document may be created.
- */
- Document clearDocument ()
- {
- Document retval = document;
- document = null;
- locator = null;
- return retval;
- }
-
- /**
- * Returns the document under construction.
- */
- protected Document getDocument ()
- { return document; }
-
- /**
- * Returns the current node being populated. This is usually
- * an Element or Document, but it might be an EntityReference
- * node if some implementation-specific code knows how to put
- * those into the result tree and later mark them as readonly.
- */
- protected Node getTop ()
- { return top; }
-
-
- // SAX1
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- }
-
- // SAX1
- public void startDocument ()
- throws SAXException
- {
- if (document == null)
- try {
- if (isL2) {
- // couple to original implementation
- document = impl.createDocument (null, "foo", null);
- document.removeChild (document.getFirstChild ());
- } else {
- document = consumer.emptyDocument ();
- }
- } catch (Exception e) {
- fatal ("DOM create document", e);
- }
- top = document;
- }
-
- // SAX1
- public void endDocument ()
- throws SAXException
- {
- try {
- if (consumer.getNext () != null && document != null) {
- DomParser parser = new DomParser (document);
-
- EventFilter.bind (parser, consumer.getNext ());
- parser.parse ("ignored");
- }
- } finally {
- top = null;
- }
- }
-
- // SAX1
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (currentEntity != null)
- return;
-
- ProcessingInstruction pi;
-
- if (isL2
- // && consumer.isUsingNamespaces ()
- && target.indexOf (':') != -1)
- namespaceError (
- "PI target name is namespace nonconformant: "
- + target);
- if (inDTD)
- return;
- pi = document.createProcessingInstruction (target, data);
- top.appendChild (pi);
- }
-
- /**
- * Subclasses may overrride this method to provide a more efficient
- * way to construct text nodes.
- * Typically, copying the text into a single character array will
- * be more efficient than doing that as well as allocating other
- * needed for a String, including an internal StringBuffer.
- * Those additional memory and CPU costs can be incurred later,
- * if ever needed.
- * Unfortunately the standard DOM factory APIs encourage those costs
- * to be incurred early.
- */
- protected Text createText (
- boolean isCDATA,
- char ch [],
- int start,
- int length
- ) {
- String value = new String (ch, start, length);
-
- if (isCDATA)
- return document.createCDATASection (value);
- else
- return document.createTextNode (value);
- }
-
- // SAX1
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly
- // at creation time)
- if (currentEntity != null)
- return;
-
- Node lastChild = top.getLastChild ();
-
- // merge consecutive text or CDATA nodes if appropriate.
- if (lastChild instanceof Text) {
- if (consumer.isHidingCDATA ()
- // consecutive Text content ... always merge
- || (!inCDATA
- && !(lastChild instanceof CDATASection))
- // consecutive CDATASection content ... don't
- // merge between sections, only within them
- || (inCDATA && mergeCDATA
- && lastChild instanceof CDATASection)
- ) {
- CharacterData last = (CharacterData) lastChild;
- String value = new String (ch, start, length);
-
- last.appendData (value);
- return;
- }
- }
- if (inCDATA && !consumer.isHidingCDATA ()) {
- top.appendChild (createText (true, ch, start, length));
- mergeCDATA = true;
- } else
- top.appendChild (createText (false, ch, start, length));
- }
-
- // SAX2
- public void skippedEntity (String name)
- throws SAXException
- {
- // this callback is useless except to report errors, since
- // we can't know if the ref was in content, within an
- // attribute, within a declaration ... only one of those
- // cases supports more intelligent action than a panic.
- fatal ("skipped entity: " + name, null);
- }
-
- // SAX2
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- // reconstruct "xmlns" attributes deleted by all
- // SAX2 parsers without "namespace-prefixes" = true
- if ("".equals (prefix))
- attributes.addAttribute ("", "", "xmlns",
- "CDATA", uri);
- else
- attributes.addAttribute ("", "", "xmlns:" + prefix,
- "CDATA", uri);
- recreatedAttrs = true;
- }
-
- // SAX2
- public void endPrefixMapping (String prefix)
- throws SAXException
- { }
-
- // SAX2
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (currentEntity != null)
- return;
-
- // parser discarded basic information; DOM tree isn't writable
- // without massaging to assign prefixes to all nodes.
- // the "NSFilter" class does that massaging.
- if (qName.length () == 0)
- qName = localName;
-
-
- Element element;
- int length = atts.getLength ();
-
- if (!isL2) {
- element = document.createElement (qName);
-
- // first the explicit attributes ...
- length = atts.getLength ();
- for (int i = 0; i < length; i++)
- element.setAttribute (atts.getQName (i),
- atts.getValue (i));
- // ... then any recreated ones (DOM deletes duplicates)
- if (recreatedAttrs) {
- recreatedAttrs = false;
- length = attributes.getLength ();
- for (int i = 0; i < length; i++)
- element.setAttribute (attributes.getQName (i),
- attributes.getValue (i));
- attributes.clear ();
- }
-
- top.appendChild (element);
- top = element;
- return;
- }
-
- // For an L2 DOM when namespace use is enabled, use
- // createElementNS/createAttributeNS except when
- // (a) it's an element in the default namespace, or
- // (b) it's an attribute with no prefix
- String namespace;
-
- if (localName.length () != 0)
- namespace = (uri.length () == 0) ? null : uri;
- else
- namespace = getNamespace (getPrefix (qName), atts);
-
- if (namespace == null)
- element = document.createElement (qName);
- else
- element = document.createElementNS (namespace, qName);
-
- populateAttributes (element, atts);
- if (recreatedAttrs) {
- recreatedAttrs = false;
- // ... DOM deletes any duplicates
- populateAttributes (element, attributes);
- attributes.clear ();
- }
-
- top.appendChild (element);
- top = element;
- }
-
- final static String xmlnsURI = "http://www.w3.org/2000/xmlns/";
-
- private void populateAttributes (Element element, Attributes attrs)
- throws SAXParseException
- {
- int length = attrs.getLength ();
-
- for (int i = 0; i < length; i++) {
- String type = attrs.getType (i);
- String value = attrs.getValue (i);
- String name = attrs.getQName (i);
- String local = attrs.getLocalName (i);
- String uri = attrs.getURI (i);
-
- // parser discarded basic information, DOM tree isn't writable
- if (name.length () == 0)
- name = local;
-
- // all attribute types other than these three may not
- // contain scoped names... enumerated attributes get
- // reported as NMTOKEN, except for NOTATION values
- if (!("CDATA".equals (type)
- || "NMTOKEN".equals (type)
- || "NMTOKENS".equals (type))) {
- if (value.indexOf (':') != -1) {
- namespaceError (
- "namespace nonconformant attribute value: "
- + "<" + element.getNodeName ()
- + " " + name + "='" + value + "' ...>");
- }
- }
-
- // xmlns="" is legal (undoes default NS)
- // xmlns:foo="" is illegal
- String prefix = getPrefix (name);
- String namespace;
-
- if ("xmlns".equals (prefix)) {
- if ("".equals (value))
- namespaceError ("illegal null namespace decl, " + name);
- namespace = xmlnsURI;
- } else if ("xmlns".equals (name))
- namespace = xmlnsURI;
-
- else if (prefix == null)
- namespace = null;
- else if (uri != "" && uri.length () != 0)
- namespace = uri;
- else
- namespace = getNamespace (prefix, attrs);
-
- if (namespace == null)
- element.setAttribute (name, value);
- else
- element.setAttributeNS (namespace, name, value);
- }
- }
-
- private String getPrefix (String name)
- {
- int temp;
-
- if ((temp = name.indexOf (':')) > 0)
- return name.substring (0, temp);
- return null;
- }
-
- // used with SAX1-level parser output
- private String getNamespace (String prefix, Attributes attrs)
- throws SAXParseException
- {
- String namespace;
- String decl;
-
- // defaulting
- if (prefix == null) {
- decl = "xmlns";
- namespace = attrs.getValue (decl);
- if ("".equals (namespace))
- return null;
- else if (namespace != null)
- return namespace;
-
- // "xmlns" is like a keyword
- // ... according to the Namespace REC, but DOM L2 CR2+
- // and Infoset violate that by assigning a namespace.
- // that conflict is resolved elsewhere.
- } else if ("xmlns".equals (prefix))
- return null;
-
- // "xml" prefix is fixed
- else if ("xml".equals (prefix))
- return "http://www.w3.org/XML/1998/namespace";
-
- // otherwise, expect a declaration
- else {
- decl = "xmlns:" + prefix;
- namespace = attrs.getValue (decl);
- }
-
- // if we found a local declaration, great
- if (namespace != null)
- return namespace;
-
-
- // ELSE ... search up the tree we've been building
- for (Node n = top;
- n != null && n.getNodeType () != Node.DOCUMENT_NODE;
- n = (Node) n.getParentNode ()) {
- if (n.getNodeType () == Node.ENTITY_REFERENCE_NODE)
- continue;
- Element e = (Element) n;
- Attr attr = e.getAttributeNode (decl);
- if (attr != null)
- return attr.getNodeValue ();
- }
- // see above re "xmlns" as keyword
- if ("xmlns".equals (decl))
- return null;
-
- namespaceError ("Undeclared namespace prefix: " + prefix);
- return null;
- }
-
- // SAX2
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (currentEntity != null)
- return;
-
- top = top.getParentNode ();
- }
-
- // SAX1 (mandatory reporting if validating)
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (consumer.isHidingWhitespace ())
- return;
- characters (ch, start, length);
- }
-
- // SAX2 lexical event
- public void startCDATA ()
- throws SAXException
- {
- inCDATA = true;
- // true except for the first fragment of a cdata section
- mergeCDATA = false;
- }
-
- // SAX2 lexical event
- public void endCDATA ()
- throws SAXException
- {
- inCDATA = false;
- }
-
- // SAX2 lexical event
- //
- // this SAX2 callback merges two unrelated things:
- // - Declaration of the root element type ... belongs with
- // the other DTD declaration methods, NOT HERE.
- // - IDs for the optional external subset ... belongs here
- // with other lexical information.
- //
- // ...and it doesn't include the internal DTD subset, desired
- // both to support DOM L2 and to enable "pass through" processing
- //
- public void startDTD (String name, String publicId, String SystemId)
- throws SAXException
- {
- // need to filter out comments and PIs within the DTD
- inDTD = true;
- }
-
- // SAX2 lexical event
- public void endDTD ()
- throws SAXException
- {
- inDTD = false;
- }
-
- // SAX2 lexical event
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- Node comment;
-
- // we can't create populated entity ref nodes using
- // only public DOM APIs (they've got to be readonly)
- if (consumer.isHidingComments ()
- || inDTD
- || currentEntity != null)
- return;
- comment = document.createComment (new String (ch, start, length));
- top.appendChild (comment);
- }
-
- /**
- * May be overridden by subclasses to return true, indicating
- * that entity reference nodes can be populated and then made
- * read-only.
- */
- public boolean canPopulateEntityRefs ()
- { return false; }
-
- // SAX2 lexical event
- public void startEntity (String name)
- throws SAXException
- {
- // are we ignoring what would be contents of an
- // entity ref, since we can't populate it?
- if (currentEntity != null)
- return;
-
- // Are we hiding all entity boundaries?
- if (consumer.isHidingReferences ())
- return;
-
- // SAX2 shows parameter entities; DOM hides them
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
-
- // Since we can't create a populated entity ref node in any
- // standard way, we create an unpopulated one.
- EntityReference ref = document.createEntityReference (name);
- top.appendChild (ref);
- top = ref;
-
- // ... allowing subclasses to populate them
- if (!canPopulateEntityRefs ())
- currentEntity = name;
- }
-
- // SAX2 lexical event
- public void endEntity (String name)
- throws SAXException
- {
- if (name.charAt (0) == '%' || "[dtd]".equals (name))
- return;
- if (name.equals (currentEntity))
- currentEntity = null;
- if (!consumer.isHidingReferences ())
- top = top.getParentNode ();
- }
-
-
- // SAX1 DTD event
- public void notationDecl (
- String name,
- String publicId, String SystemId
- ) throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- // SAX1 DTD event
- public void unparsedEntityDecl (
- String name,
- String publicId, String SystemId,
- String notationName
- ) throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- // SAX2 declaration event
- public void elementDecl (String name, String model)
- throws SAXException
- {
- /* IGNORE -- no content model support in DOM L2 */
- }
-
- // SAX2 declaration event
- public void attributeDecl (
- String eName,
- String aName,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
- /* IGNORE -- no attribute model support in DOM L2 */
- }
-
- // SAX2 declaration event
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- // SAX2 declaration event
- public void externalEntityDecl (
- String name,
- String publicId,
- String SystemId
- ) throws SAXException
- {
- /* IGNORE -- no public DOM API lets us store these
- * into the doctype node
- */
- }
-
- //
- // These really should offer the option of nonfatal handling,
- // like other validity errors, though that would cause major
- // chaos in the DOM data structures. DOM is already spec'd
- // to treat many of these as fatal, so this is consistent.
- //
- private void namespaceError (String description)
- throws SAXParseException
- {
- SAXParseException err;
-
- err = new SAXParseException (description, locator);
- throw err;
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/EventConsumer.java b/external/jaxp/source/gnu/xml/pipeline/EventConsumer.java
deleted file mode 100755
index 8d2844d64..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/EventConsumer.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import org.xml.sax.*;
-
-
-/**
- * Collects the event consumption apparatus of a SAX pipeline stage.
- * Consumers which permit some handlers or other characteristics to be
- * configured will provide methods to support that configuration.
- *
- * <p> Two important categories of consumers include <em>filters</em>, which
- * process events and pass them on to other consumers, and <em>terminus</em>
- * (or <em>terminal</em>) stages, which don't pass events on. Filters are not
- * necessarily derived from the {@link EventFilter} class, although that
- * class can substantially simplify their construction by automating the
- * most common activities.
- *
- * <p> Event consumers which follow certain conventions for the signatures
- * of their constructors can be automatically assembled into pipelines
- * by the {@link PipelineFactory} class.
- *
- * @author David Brownell
- */
-public interface EventConsumer
-{
- /** Most stages process these core SAX callbacks. */
- public ContentHandler getContentHandler ();
-
- /** Few stages will use unparsed entities. */
- public DTDHandler getDTDHandler ();
-
- /**
- * This method works like the SAX2 XMLReader method of the same name,
- * and is used to retrieve the optional lexical and declaration handlers
- * in a pipeline.
- *
- * @param id This is a URI identifying the type of property desired.
- * @return The value of that property, if it is defined.
- *
- * @exception SAXNotRecognizedException Thrown if the particular
- * pipeline stage does not understand the specified identifier.
- */
- public Object getProperty (String id)
- throws SAXNotRecognizedException;
-
- /**
- * This method provides a filter stage with a handler that abstracts
- * presentation of warnings and both recoverable and fatal errors.
- * Most pipeline stages should share a single policy and mechanism
- * for such reports, since application components require consistency
- * in such activities. Accordingly, typical responses to this method
- * invocation involve saving the handler for use; filters will pass
- * it on to any other consumers they use.
- *
- * @param handler encapsulates error handling policy for this stage
- */
- public void setErrorHandler (ErrorHandler handler);
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/EventFilter.java b/external/jaxp/source/gnu/xml/pipeline/EventFilter.java
deleted file mode 100755
index 1292914fd..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/EventFilter.java
+++ /dev/null
@@ -1,786 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.XMLFilterImpl;
-
-
-/**
- * A customizable event consumer, used to assemble various kinds of filters
- * using SAX handlers and an optional second consumer. It can be constructed
- * in two ways: <ul>
- *
- * <li> To serve as a passthrough, sending all events to a second consumer.
- * The second consumer may be identified through {@link #getNext}.
- *
- * <li> To serve as a dead end, with all handlers null;
- * {@link #getNext} returns null.
- *
- * </ul>
- *
- * <p> Additionally, SAX handlers may be assigned, which completely replace
- * the "upstream" view (through {@link EventConsumer}) of handlers, initially
- * null or the "next" consumer provided to the constructor. To make
- * it easier to build specialized filter classes, this class implements
- * all the standard SAX consumer handlers, and those implementations
- * delegate "downstream" to the consumer accessed by {@link #getNext}.
- *
- * <p> The simplest way to create a custom a filter class is to create a
- * subclass which overrides one or more handler interface methods. The
- * constructor for that subclass then registers itself as a handler for
- * those interfaces using a call such as <em>setContentHandler(this)</em>,
- * so the "upstream" view of event delivery is modified from the state
- * established in the base class constructor. That way,
- * the overridden methods intercept those event callbacks
- * as they go "downstream", and
- * all other event callbacks will pass events to any next consumer.
- * Overridden methods may invoke superclass methods (perhaps after modifying
- * parameters) if they wish to delegate such calls. Such subclasses
- * should use {@link #getErrorHandler} to report errors using the
- * common error reporting mechanism.
- *
- * <p> Another important technique is to construct a filter consisting
- * of only a few specific types of handler. For example, one could easily
- * prune out lexical events or various declarations by providing handlers
- * which don't pass those events downstream, or by providing null handlers.
- *
- * <hr />
- *
- * <p> This may be viewed as the consumer oriented analogue of the SAX2
- * {@link org.xml.sax.helpers.XMLFilterImpl XMLFilterImpl} class.
- * Key differences include: <ul>
- *
- * <li> This fully separates consumer and producer roles: it
- * does not implement the producer side <em>XMLReader</em> or
- * <em>EntityResolver</em> interfaces, so it can only be used
- * in "push" mode (it has no <em>parse()</em> methods).
- *
- * <li> "Extension" handlers are fully supported, enabling a
- * richer set of application requirements.
- * And it implements {@link EventConsumer}, which groups related
- * consumer methods together, rather than leaving them separated.
- *
- * <li> The chaining which is visible is "downstream" to the next
- * consumer, not "upstream" to the preceding producer.
- * It supports "fan-in", where
- * a consumer can be fed by several producers. (For "fan-out",
- * see the {@link TeeConsumer} class.)
- *
- * <li> Event chaining is set up differently. It is intended to
- * work "upstream" from terminus towards producer, during filter
- * construction, as described above.
- * This is part of an early binding model:
- * events don't need to pass through stages which ignore them.
- *
- * <li> ErrorHandler support is separated, on the grounds that
- * pipeline stages need to share the same error handling policy.
- * For the same reason, error handler setup goes "downstream":
- * when error handlers get set, they are passed to subsequent
- * consumers.
- *
- * </ul>
- *
- * <p> The {@link #chainTo chainTo()} convenience routine supports chaining to
- * an XMLFilterImpl, in its role as a limited functionality event
- * consumer. Its event producer role ({@link XMLFilter}) is ignored.
- *
- * <hr />
- *
- * <p> The {@link #bind bind()} routine may be used associate event pipelines
- * with any kind of {@link XMLReader} that will produce the events.
- * Such pipelines don't necessarily need to have any members which are
- * implemented using this class. That routine has some intelligence
- * which supports automatic changes to parser feature flags, letting
- * event piplines become largely independent of the particular feature
- * sets of parsers.
- *
- * @author David Brownell
- */
-public class EventFilter
- implements EventConsumer, ContentHandler, DTDHandler,
- LexicalHandler, DeclHandler
-{
- // SAX handlers
- private ContentHandler docHandler, docNext;
- private DTDHandler dtdHandler, dtdNext;
- private LexicalHandler lexHandler, lexNext;
- private DeclHandler declHandler, declNext;
- // and ideally, one more for the stuff SAX2 doesn't show
-
- private Locator locator;
- private EventConsumer next;
- private ErrorHandler errHandler;
-
-
- /** SAX2 URI prefix for standard feature flags. */
- public static final String FEATURE_URI
- = "http://xml.org/sax/features/";
- /** SAX2 URI prefix for standard properties (mostly for handlers). */
- public static final String PROPERTY_URI
- = "http://xml.org/sax/properties/";
-
- /** SAX2 property identifier for {@link DeclHandler} events */
- public static final String DECL_HANDLER
- = PROPERTY_URI + "declaration-handler";
- /** SAX2 property identifier for {@link LexicalHandler} events */
- public static final String LEXICAL_HANDLER
- = PROPERTY_URI + "lexical-handler";
-
- //
- // These class objects will be null if the relevant class isn't linked.
- // Small configurations (pJava and some kinds of embedded systems) need
- // to facilitate smaller executables. So "instanceof" is undesirable
- // when bind() sees if it can remove some stages.
- //
- // SECURITY NOTE: assuming all these classes are part of the same sealed
- // package, there's no problem saving these in the instance of this class
- // that's associated with "this" class loader. But that wouldn't be true
- // for classes in another package.
- //
- private static boolean loaded;
- private static Class nsClass;
- private static Class validClass;
- private static Class wfClass;
- private static Class xincClass;
-
- static ClassLoader getClassLoader ()
- {
- Method m = null;
-
- try {
- m = Thread.class.getMethod("getContextClassLoader", null);
- } catch (NoSuchMethodException e) {
- // Assume that we are running JDK 1.1, use the current ClassLoader
- return EventFilter.class.getClassLoader();
- }
-
- try {
- return (ClassLoader) m.invoke(Thread.currentThread(), null);
- } catch (IllegalAccessException e) {
- // assert(false)
- throw new UnknownError(e.getMessage());
- } catch (InvocationTargetException e) {
- // assert(e.getTargetException() instanceof SecurityException)
- throw new UnknownError(e.getMessage());
- }
- }
-
- static Class loadClass (ClassLoader classLoader, String className)
- {
- try {
- if (classLoader == null)
- return Class.forName(className);
- else
- return classLoader.loadClass(className);
- } catch (Exception e) {
- return null;
- }
- }
-
- static private void loadClasses ()
- {
- ClassLoader loader = getClassLoader ();
-
- nsClass = loadClass (loader, "gnu.xml.pipeline.NSFilter");
- validClass = loadClass (loader, "gnu.xml.pipeline.ValidationConsumer");
- wfClass = loadClass (loader, "gnu.xml.pipeline.WellFormednessFilter");
- xincClass = loadClass (loader, "gnu.xml.pipeline.XIncludeFilter");
- loaded = true;
- }
-
-
- /**
- * Binds the standard SAX2 handlers from the specified consumer
- * pipeline to the specified producer. These handlers include the core
- * {@link ContentHandler} and {@link DTDHandler}, plus the extension
- * {@link DeclHandler} and {@link LexicalHandler}. Any additional
- * application-specific handlers need to be bound separately.
- * The {@link ErrorHandler} is handled differently: the producer's
- * error handler is passed through to the consumer pipeline.
- * The producer is told to include namespace prefix information if it
- * can, since many pipeline stages need that Infoset information to
- * work well.
- *
- * <p> At the head of the pipeline, certain standard event filters are
- * recognized and handled specially. This facilitates construction
- * of processing pipelines that work regardless of the capabilities
- * of the XMLReader implementation in use; for example, it permits
- * validating output of a {@link gnu.xml.util.DomParser}. <ul>
- *
- * <li> {@link NSFilter} will be removed if the producer can be
- * told not to discard namespace data, using the "namespace-prefixes"
- * feature flag.
- *
- * <li> {@link ValidationConsumer} will be removed if the producer
- * can be told to validate, using the "validation" feature flag.
- *
- * <li> {@link WellFormednessFilter} is always removed, on the
- * grounds that no XMLReader is permitted to producee malformed
- * event streams and this would just be processing overhead.
- *
- * <li> {@link XIncludeFilter} stops the special handling, except
- * that it's told about the "namespace-prefixes" feature of the
- * event producer so that the event stream is internally consistent.
- *
- * <li> The first consumer which is not one of those classes stops
- * such special handling. This means that if you want to force
- * one of those filters to be used, you could just precede it with
- * an instance of {@link EventFilter} configured as a pass-through.
- * You might need to do that if you are using an {@link NSFilter}
- * subclass to fix names found in attributes or character data.
- *
- * </ul>
- *
- * <p> Other than that, this method works with any kind of event consumer,
- * not just event filters. Note that in all cases, the standard handlers
- * are assigned; any previous handler assignments for the handler will
- * be overridden.
- *
- * @param producer will deliver events to the specified consumer
- * @param consumer pipeline supplying event handlers to be associated
- * with the producer (may not be null)
- */
- public static void bind (XMLReader producer, EventConsumer consumer)
- {
- Class klass = null;
- boolean prefixes;
-
- if (!loaded)
- loadClasses ();
-
- // DOM building, printing, layered validation, and other
- // things don't work well when prefix info is discarded.
- // Include it by default, whenever possible.
- try {
- producer.setFeature (FEATURE_URI + "namespace-prefixes",
- true);
- prefixes = true;
- } catch (SAXException e) {
- prefixes = false;
- }
-
- // NOTE: This loop doesn't use "instanceof", since that
- // would prevent compiling/linking without those classes
- // being present.
- while (consumer != null) {
- klass = consumer.getClass ();
-
- // we might have already changed this problematic SAX2 default.
- if (nsClass != null && nsClass.isAssignableFrom (klass)) {
- if (!prefixes)
- break;
- consumer = ((EventFilter)consumer).getNext ();
-
- // the parser _might_ do DTD validation by default ...
- // if not, maybe we can change this setting.
- } else if (validClass != null
- && validClass.isAssignableFrom (klass)) {
- try {
- producer.setFeature (FEATURE_URI + "validation",
- true);
- consumer = ((ValidationConsumer)consumer).getNext ();
- } catch (SAXException e) {
- break;
- }
-
- // parsers are required not to have such bugs
- } else if (wfClass != null && wfClass.isAssignableFrom (klass)) {
- consumer = ((WellFormednessFilter)consumer).getNext ();
-
- // stop on the first pipeline stage we can't remove
- } else
- break;
-
- if (consumer == null)
- klass = null;
- }
-
- // the actual setting here doesn't matter as much
- // as that producer and consumer agree
- if (xincClass != null && klass != null
- && xincClass.isAssignableFrom (klass))
- ((XIncludeFilter)consumer).setSavingPrefixes (prefixes);
-
- // Some SAX parsers can't handle null handlers -- bleech
- DefaultHandler2 h = new DefaultHandler2 ();
-
- if (consumer != null && consumer.getContentHandler () != null)
- producer.setContentHandler (consumer.getContentHandler ());
- else
- producer.setContentHandler (h);
- if (consumer != null && consumer.getDTDHandler () != null)
- producer.setDTDHandler (consumer.getDTDHandler ());
- else
- producer.setDTDHandler (h);
-
- try {
- Object dh;
-
- if (consumer != null)
- dh = consumer.getProperty (DECL_HANDLER);
- else
- dh = null;
- if (dh == null)
- dh = h;
- producer.setProperty (DECL_HANDLER, dh);
- } catch (Exception e) { /* ignore */ }
- try {
- Object lh;
-
- if (consumer != null)
- lh = consumer.getProperty (LEXICAL_HANDLER);
- else
- lh = null;
- if (lh == null)
- lh = h;
- producer.setProperty (LEXICAL_HANDLER, lh);
- } catch (Exception e) { /* ignore */ }
-
- // this binding goes the other way around
- if (producer.getErrorHandler () == null)
- producer.setErrorHandler (h);
- if (consumer != null)
- consumer.setErrorHandler (producer.getErrorHandler ());
- }
-
- /**
- * Initializes all handlers to null.
- */
- // constructor used by PipelineFactory
- public EventFilter () { }
-
-
- /**
- * Handlers that are not otherwise set will default to those from
- * the specified consumer, making it easy to pass events through.
- * If the consumer is null, all handlers are initialzed to null.
- */
- // constructor used by PipelineFactory
- public EventFilter (EventConsumer consumer)
- {
- if (consumer == null)
- return;
-
- next = consumer;
-
- // We delegate through the "xxNext" handlers, and
- // report the "xxHandler" ones on our input side.
-
- // Normally a subclass would both override handler
- // methods and register itself as the "xxHandler".
-
- docHandler = docNext = consumer.getContentHandler ();
- dtdHandler = dtdNext = consumer.getDTDHandler ();
- try {
- declHandler = declNext = (DeclHandler)
- consumer.getProperty (DECL_HANDLER);
- } catch (SAXException e) { /* leave value null */ }
- try {
- lexHandler = lexNext = (LexicalHandler)
- consumer.getProperty (LEXICAL_HANDLER);
- } catch (SAXException e) { /* leave value null */ }
- }
-
- /**
- * Treats the XMLFilterImpl as a limited functionality event consumer,
- * by arranging to deliver events to it; this lets such classes be
- * "wrapped" as pipeline stages.
- *
- * <p> <em>Upstream Event Setup:</em>
- * If no handlers have been assigned to this EventFilter, then the
- * handlers from specified XMLFilterImpl are returned from this
- * {@link EventConsumer}: the XMLFilterImpl is just "wrapped".
- * Otherwise the specified handlers will be returned.
- *
- * <p> <em>Downstream Event Setup:</em>
- * Subclasses may chain event delivery to the specified XMLFilterImpl
- * by invoking the appropiate superclass methods,
- * as if their constructor passed a "next" EventConsumer to the
- * constructor for this class.
- * If this EventFilter has an ErrorHandler, it is assigned as
- * the error handler for the XMLFilterImpl, just as would be
- * done for a next stage implementing {@link EventConsumer}.
- *
- * @param next the next downstream component of the pipeline.
- * @exception IllegalStateException if the "next" consumer has
- * already been set through the constructor.
- */
- public void chainTo (XMLFilterImpl next)
- {
- if (this.next != null)
- throw new IllegalStateException ();
-
- docNext = next.getContentHandler ();
- if (docHandler == null)
- docHandler = docNext;
- dtdNext = next.getDTDHandler ();
- if (dtdHandler == null)
- dtdHandler = dtdNext;
-
- try {
- declNext = (DeclHandler) next.getProperty (DECL_HANDLER);
- if (declHandler == null)
- declHandler = declNext;
- } catch (SAXException e) { /* leave value null */ }
- try {
- lexNext = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
- if (lexHandler == null)
- lexHandler = lexNext;
- } catch (SAXException e) { /* leave value null */ }
-
- if (errHandler != null)
- next.setErrorHandler (errHandler);
- }
-
- /**
- * Records the error handler that should be used by this stage, and
- * passes it "downstream" to any subsequent stage.
- */
- final public void setErrorHandler (ErrorHandler handler)
- {
- errHandler = handler;
- if (next != null)
- next.setErrorHandler (handler);
- }
-
- /**
- * Returns the error handler assigned this filter stage, or null
- * if no such assigment has been made.
- */
- final public ErrorHandler getErrorHandler ()
- {
- return errHandler;
- }
-
-
- /**
- * Returns the next event consumer in sequence; or null if there
- * is no such handler.
- */
- final public EventConsumer getNext ()
- { return next; }
-
-
- /**
- * Assigns the content handler to use; a null handler indicates
- * that these events will not be forwarded.
- * This overrides the previous settting for this handler, which was
- * probably pointed to the next consumer by the base class constructor.
- */
- final public void setContentHandler (ContentHandler h)
- {
- docHandler = h;
- }
-
- /** Returns the content handler being used. */
- final public ContentHandler getContentHandler ()
- {
- return docHandler;
- }
-
- /**
- * Assigns the DTD handler to use; a null handler indicates
- * that these events will not be forwarded.
- * This overrides the previous settting for this handler, which was
- * probably pointed to the next consumer by the base class constructor.
- */
- final public void setDTDHandler (DTDHandler h)
- { dtdHandler = h; }
-
- /** Returns the dtd handler being used. */
- final public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
- /**
- * Stores the property, normally a handler; a null handler indicates
- * that these events will not be forwarded.
- * This overrides the previous handler settting, which was probably
- * pointed to the next consumer by the base class constructor.
- */
- final public void setProperty (String id, Object o)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- try {
- Object value = getProperty (id);
-
- if (value == o)
- return;
- if (DECL_HANDLER.equals (id)) {
- declHandler = (DeclHandler) o;
- return;
- }
- if (LEXICAL_HANDLER.equals (id)) {
- lexHandler = (LexicalHandler) o;
- return;
- }
- throw new SAXNotSupportedException (id);
-
- } catch (ClassCastException e) {
- throw new SAXNotSupportedException (id);
- }
- }
-
- /** Retrieves a property of unknown intent (usually a handler) */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- if (DECL_HANDLER.equals (id))
- return declHandler;
- if (LEXICAL_HANDLER.equals (id))
- return lexHandler;
-
- throw new SAXNotRecognizedException (id);
- }
-
- /**
- * Returns any locator provided to the next consumer, if this class
- * (or a subclass) is handling {@link ContentHandler } events.
- */
- public Locator getDocumentLocator ()
- { return locator; }
-
-
- // CONTENT HANDLER DELEGATIONS
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- if (docNext != null)
- docNext.setDocumentLocator (locator);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void startDocument () throws SAXException
- {
- if (docNext != null)
- docNext.startDocument ();
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void skippedEntity (String name) throws SAXException
- {
- if (docNext != null)
- docNext.skippedEntity (name);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (docNext != null)
- docNext.processingInstruction (target, data);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- if (docNext != null)
- docNext.characters (ch, start, length);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (docNext != null)
- docNext.ignorableWhitespace (ch, start, length);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (docNext != null)
- docNext.startPrefixMapping (prefix, uri);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void startElement (
- String uri, String localName,
- String qName, Attributes atts
- ) throws SAXException
- {
- if (docNext != null)
- docNext.startElement (uri, localName, qName, atts);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (docNext != null)
- docNext.endElement (uri, localName, qName);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void endPrefixMapping (String prefix) throws SAXException
- {
- if (docNext != null)
- docNext.endPrefixMapping (prefix);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void endDocument () throws SAXException
- {
- if (docNext != null)
- docNext.endDocument ();
- locator = null;
- }
-
-
- // DTD HANDLER DELEGATIONS
-
- /** <b>SAX1:</b> passes this callback to the next consumer, if any */
- public void unparsedEntityDecl (
- String name,
- String publicId,
- String systemId,
- String notationName
- ) throws SAXException
- {
- if (dtdNext != null)
- dtdNext.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
- /** <b>SAX1:</b> passes this callback to the next consumer, if any */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- if (dtdNext != null)
- dtdNext.notationDecl (name, publicId, systemId);
- }
-
-
- // LEXICAL HANDLER DELEGATIONS
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.startDTD (name, publicId, systemId);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void endDTD ()
- throws SAXException
- {
- if (lexNext != null)
- lexNext.endDTD ();
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.comment (ch, start, length);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void startCDATA ()
- throws SAXException
- {
- if (lexNext != null)
- lexNext.startCDATA ();
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void endCDATA ()
- throws SAXException
- {
- if (lexNext != null)
- lexNext.endCDATA ();
- }
-
- /**
- * <b>SAX2:</b> passes this callback to the next consumer, if any.
- */
- public void startEntity (String name)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.startEntity (name);
- }
-
- /**
- * <b>SAX2:</b> passes this callback to the next consumer, if any.
- */
- public void endEntity (String name)
- throws SAXException
- {
- if (lexNext != null)
- lexNext.endEntity (name);
- }
-
-
- // DECLARATION HANDLER DELEGATIONS
-
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void elementDecl (String name, String model)
- throws SAXException
- {
- if (declNext != null)
- declNext.elementDecl (name, model);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
- throws SAXException
- {
- if (declNext != null)
- declNext.attributeDecl (eName, aName, type, mode, value);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (declNext != null)
- declNext.externalEntityDecl (name, publicId, systemId);
- }
-
- /** <b>SAX2:</b> passes this callback to the next consumer, if any */
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- if (declNext != null)
- declNext.internalEntityDecl (name, value);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/LinkFilter.java b/external/jaxp/source/gnu/xml/pipeline/LinkFilter.java
deleted file mode 100644
index 811fc0300..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/LinkFilter.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-
-
-/**
- * Pipeline filter to remember XHTML links found in a document,
- * so they can later be crawled. Fragments are not counted, and duplicates
- * are ignored. Callers are responsible for filtering out URLs they aren't
- * interested in. Events are passed through unmodified.
- *
- * <p> Input MUST include a setDocumentLocator() call, as it's used to
- * resolve relative links in the absence of a "base" element. Input MUST
- * also include namespace identifiers, since it is the XHTML namespace
- * identifier which is used to identify the relevant elements.
- *
- * <p><em>FIXME:</em> handle xml:base attribute ... in association with
- * a stack of base URIs. Similarly, recognize/support XLink data.
- *
- * @author David Brownell
- */
-public class LinkFilter extends EventFilter
-{
- // for storing URIs
- private Vector vector = new Vector ();
-
- // struct for "full" link record (tbd)
- // these for troubleshooting original source:
- // original uri
- // uri as resolved (base, relative, etc)
- // URI of originating doc
- // line #
- // original element + attrs (img src, desc, etc)
-
- // XLink model of the link ... for inter-site pairups ?
-
- private String baseURI;
-
- private boolean siteRestricted = false;
-
- //
- // XXX leverage blacklist info (like robots.txt)
- //
- // XXX constructor w/param ... pipeline for sending link data
- // probably XHTML --> XLink, providing info as sketched above
- //
-
-
- /**
- * Constructs a new event filter, which collects links in private data
- * structure for later enumeration.
- */
- // constructor used by PipelineFactory
- public LinkFilter ()
- {
- super.setContentHandler (this);
- }
-
-
- /**
- * Constructs a new event filter, which collects links in private data
- * structure for later enumeration and passes all events, unmodified,
- * to the next consumer.
- */
- // constructor used by PipelineFactory
- public LinkFilter (EventConsumer next)
- {
- super (next);
- super.setContentHandler (this);
- }
-
-
- /**
- * Returns an enumeration of the links found since the filter
- * was constructed, or since removeAllLinks() was called.
- *
- * @return enumeration of strings.
- */
- public Enumeration getLinks ()
- {
- return vector.elements ();
- }
-
- /**
- * Removes records about all links reported to the event
- * stream, as if the filter were newly created.
- */
- public void removeAllLinks ()
- {
- vector = new Vector ();
- }
-
-
- /**
- * Collects URIs for (X)HTML content from elements which hold them.
- */
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- String link;
-
- // Recognize XHTML links.
- if ("http://www.w3.org/1999/xhtml".equals (uri)) {
-
- if ("a".equals (localName) || "base".equals (localName)
- || "area".equals (localName))
- link = atts.getValue ("href");
- else if ("iframe".equals (localName) || "frame".equals (localName))
- link = atts.getValue ("src");
- else if ("blockquote".equals (localName) || "q".equals (localName)
- || "ins".equals (localName) || "del".equals (localName))
- link = atts.getValue ("cite");
- else
- link = null;
- link = maybeAddLink (link);
-
- // "base" modifies designated baseURI
- if ("base".equals (localName) && link != null)
- baseURI = link;
-
- if ("iframe".equals (localName) || "img".equals (localName))
- maybeAddLink (atts.getValue ("longdesc"));
- }
-
- super.startElement (uri, localName, qName, atts);
- }
-
- private String maybeAddLink (String link)
- {
- int index;
-
- // ignore empty links and fragments inside docs
- if (link == null)
- return null;
- if ((index = link.indexOf ("#")) >= 0)
- link = link.substring (0, index);
- if (link.equals (""))
- return null;
-
- try {
- // get the real URI
- URL base = new URL ((baseURI != null)
- ? baseURI
- : getDocumentLocator ().getSystemId ());
- URL url = new URL (base, link);
-
- link = url.toString ();
-
- // ignore duplicates
- if (vector.contains (link))
- return link;
-
- // other than what "base" does, stick to original site:
- if (siteRestricted) {
- // don't switch protocols
- if (!base.getProtocol ().equals (url.getProtocol ()))
- return link;
- // don't switch servers
- if (base.getHost () != null
- && !base.getHost ().equals (url.getHost ()))
- return link;
- }
-
- vector.addElement (link);
-
- return link;
-
- } catch (IOException e) {
- // bad URLs we don't want
- }
- return null;
- }
-
- /**
- * Reports an error if no Locator has been made available.
- */
- public void startDocument ()
- throws SAXException
- {
- if (getDocumentLocator () == null)
- throw new SAXException ("no Locator!");
- }
-
- /**
- * Forgets about any base URI information that may be recorded.
- * Applications will often want to call removeAllLinks(), likely
- * after examining the links which were reported.
- */
- public void endDocument ()
- throws SAXException
- {
- baseURI = null;
- super.endDocument ();
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/NSFilter.java b/external/jaxp/source/gnu/xml/pipeline/NSFilter.java
deleted file mode 100644
index a93ab43e0..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/NSFilter.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.util.EmptyStackException;
-import java.util.Enumeration;
-import java.util.Stack;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.NamespaceSupport;
-
-
-/**
- * This filter ensures that element and attribute names are properly prefixed,
- * and that such prefixes are declared. Such data is critical for operations
- * like writing XML text, and validating against DTDs: names or their prefixes
- * may have been discarded, although they are essential to the exchange of
- * information using XML. There are various common ways that such data
- * gets discarded: <ul>
- *
- * <li> By default, SAX2 parsers must discard the "xmlns*"
- * attributes, and may also choose not to report properly prefixed
- * names for elements or attributes. (Some parsers may support
- * changing the <em>namespace-prefixes</em> value from the default
- * to <em>true</em>, effectively eliminating the need to use this
- * filter on their output.)
- *
- * <li> When event streams are generated from a DOM tree, they may
- * have never have had prefixes or declarations for namespaces; or
- * the existing prefixes or declarations may have been invalidated
- * by structural modifications to that DOM tree.
- *
- * <li> Other software writing SAX event streams won't necessarily
- * be worrying about prefix management, and so they will need to
- * have a transparent solution for managing them.
- *
- * </ul>
- *
- * <p> This filter uses a heuristic to choose the prefix to assign to any
- * particular name which wasn't already corectly prefixed. The associated
- * namespace will be correct, and the prefix will be declared. Original
- * structures facilitating text editing, such as conventions about use of
- * mnemonic prefix names or the scoping of prefixes, can't always be
- * reconstructed after they are discarded, as strongly encouraged by the
- * current SAX2 defaults.
- *
- * <p> Note that this can't possibly know whether values inside attribute
- * value or document content involve prefixed names. If your application
- * requires using prefixed names in such locations you'll need to add some
- * appropriate logic (perhaps adding additional heuristics in a subclass).
- *
- * @author David Brownell
- */
-public class NSFilter extends EventFilter
-{
- private NamespaceSupport nsStack = new NamespaceSupport ();
- private Stack elementStack = new Stack ();
-
- private boolean pushedContext;
- private String nsTemp [] = new String [3];
- private AttributesImpl attributes = new AttributesImpl ();
- private boolean usedDefault;
-
- // gensymmed prefixes use this root name
- private static final String prefixRoot = "prefix-";
-
-
- /**
- * Passes events through to the specified consumer, after first
- * processing them.
- *
- * @param next the next event consumer to receive events.
- */
- // constructor used by PipelineFactory
- public NSFilter (EventConsumer next)
- {
- super (next);
-
- setContentHandler (this);
- }
-
- private void fatalError (String message)
- throws SAXException
- {
- SAXParseException e;
- ErrorHandler handler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
-
- if (locator == null)
- e = new SAXParseException (message, null, null, -1, -1);
- else
- e = new SAXParseException (message, locator);
- if (handler != null)
- handler.fatalError (e);
- throw e;
- }
-
-
- public void startDocument () throws SAXException
- {
- elementStack.removeAllElements ();
- nsStack.reset ();
- pushedContext = false;
- super.startDocument ();
- }
-
- /**
- * This call is not passed to the next consumer in the chain.
- * Prefix declarations and scopes are only exposed in the form
- * of attributes; this callback just records a declaration that
- * will be exposed as an attribute.
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (pushedContext == false) {
- nsStack.pushContext ();
- pushedContext = true;
- }
-
- // this check is awkward, but the paranoia prevents big trouble
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */ ) {
- String declared = (String) e.nextElement ();
-
- if (!declared.equals (prefix))
- continue;
- if (uri.equals (nsStack.getURI (prefix)))
- return;
- fatalError ("inconsistent binding for prefix '" + prefix
- + "' ... " + uri + " (was " + nsStack.getURI (prefix) + ")");
- }
-
- if (!nsStack.declarePrefix (prefix, uri))
- fatalError ("illegal prefix declared: " + prefix);
- }
-
- private String fixName (String ns, String l, String name, boolean isAttr)
- throws SAXException
- {
- if ("".equals (name) || name == null) {
- name = l;
- if ("".equals (name) || name == null)
- fatalError ("empty/null name");
- }
-
- // can we correctly process the name as-is?
- // handles "element scope" attribute names here.
- if (nsStack.processName (name, nsTemp, isAttr) != null
- && nsTemp [0].equals (ns)
- ) {
- return nsTemp [2];
- }
-
- // nope, gotta modify the name or declare a default mapping
- int temp;
-
- // get rid of any current prefix
- if ((temp = name.indexOf (':')) >= 0) {
- name = name.substring (temp + 1);
-
- // ... maybe that's enough (use/prefer default namespace) ...
- if (!isAttr && nsStack.processName (name, nsTemp, false) != null
- && nsTemp [0].equals (ns)
- ) {
- return nsTemp [2];
- }
- }
-
- // must we define and use the default/undefined prefix?
- if ("".equals (ns)) {
- if (isAttr)
- fatalError ("processName bug");
- if (attributes.getIndex ("xmlns") != -1)
- fatalError ("need to undefine default NS, but it's bound: "
- + attributes.getValue ("xmlns"));
-
- nsStack.declarePrefix ("", "");
- attributes.addAttribute ("", "", "xmlns", "CDATA", "");
- return name;
- }
-
- // is there at least one non-null prefix we can use?
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
- String uri = nsStack.getURI (prefix);
-
- if (uri == null || !uri.equals (ns))
- continue;
- return prefix + ":" + name;
- }
-
- // no such luck. create a prefix name, declare it, use it.
- for (temp = 0; temp >= 0; temp++) {
- String prefix = prefixRoot + temp;
-
- if (nsStack.getURI (prefix) == null) {
- nsStack.declarePrefix (prefix, ns);
- attributes.addAttribute ("", "", "xmlns:" + prefix,
- "CDATA", ns);
- return prefix + ":" + name;
- }
- }
- fatalError ("too many prefixes genned");
- // NOTREACHED
- return null;
- }
-
- public void startElement (
- String uri, String localName,
- String qName, Attributes atts
- ) throws SAXException
- {
- if (!pushedContext)
- nsStack.pushContext ();
- pushedContext = false;
-
- // make sure we have all NS declarations handy before we start
- int length = atts.getLength ();
-
- for (int i = 0; i < length; i++) {
- String aName = atts.getQName (i);
-
- if (!aName.startsWith ("xmlns"))
- continue;
-
- String prefix;
-
- if ("xmlns".equals (aName))
- prefix = "";
- else if (aName.indexOf (':') == 5)
- prefix = aName.substring (6);
- else // "xmlnsfoo" etc.
- continue;
- startPrefixMapping (prefix, atts.getValue (i));
- }
-
- // put namespace decls at the start of our regenned attlist
- attributes.clear ();
- for (Enumeration e = nsStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
-
- attributes.addAttribute ("", "",
- ("".equals (prefix)
- ? "xmlns"
- : "xmlns:" + prefix),
- "CDATA",
- nsStack.getURI (prefix));
- }
-
- // name fixups: element, then attributes.
- // fixName may declare a new prefix or, for the element,
- // redeclare the default (if element name needs it).
- qName = fixName (uri, localName, qName, false);
-
- for (int i = 0; i < length; i++) {
- String aName = atts.getQName (i);
- String aNS = atts.getURI (i);
- String aLocal = atts.getLocalName (i);
- String aType = atts.getType (i);
- String aValue = atts.getValue (i);
-
- if (aName.startsWith ("xmlns"))
- continue;
- aName = fixName (aNS, aLocal, aName, true);
- attributes.addAttribute (aNS, aLocal, aName, aType, aValue);
- }
-
- elementStack.push (qName);
-
- // pass event along, with cleaned-up names and decls.
- super.startElement (uri, localName, qName, attributes);
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- nsStack.popContext ();
- qName = (String) elementStack.pop ();
- super.endElement (uri, localName, qName);
- }
-
- /**
- * This call is not passed to the next consumer in the chain.
- * Prefix declarations and scopes are only exposed in their
- * attribute form.
- */
- public void endPrefixMapping (String prefix)
- throws SAXException
- { }
-
- public void endDocument () throws SAXException
- {
- elementStack.removeAllElements ();
- nsStack.reset ();
- super.endDocument ();
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/PipelineFactory.java b/external/jaxp/source/gnu/xml/pipeline/PipelineFactory.java
deleted file mode 100644
index 27c25df62..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/PipelineFactory.java
+++ /dev/null
@@ -1,712 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.lang.reflect.Constructor;
-import java.util.StringTokenizer;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-
-
-/**
- * This provides static factory methods for creating simple event pipelines.
- * These pipelines are specified by strings, suitable for passing on
- * command lines or embedding in element attributes. For example, one way
- * to write a pipeline that restores namespace syntax, validates (stopping
- * the pipeline on validity errors) and then writes valid data to standard
- * output is this: <pre>
- * nsfix | validate | write ( stdout )</pre>
- *
- * <p> In this syntax, the tokens are always separated by whitespace, and each
- * stage of the pipeline may optionally have a parameter (which can be a
- * pipeline) in parentheses. Interior stages are called filters, and the
- * rightmost end of a pipeline is called a terminus.
- *
- * <p> Stages are usually implemented by a single class, which may not be
- * able to act as both a filter and a terminus; but any terminus can be
- * automatically turned into a filter, through use of a {@link TeeConsumer}.
- * The stage identifiers are either class names, or are one of the following
- * short identifiers built into this class. (Most of these identifiers are
- * no more than aliases for classes.) The built-in identifiers include:</p>
-
- <table border="1" cellpadding="3" cellspacing="0">
- <tr bgcolor="#ccccff" class="TableHeadingColor">
- <th align="center" width="5%">Stage</th>
- <th align="center" width="9%">Parameter</th>
- <th align="center" width="1%">Terminus</th>
- <th align="center">Description</th>
- </tr>
-
- <tr valign="top" align="center">
- <td><a href="../dom/Consumer.html">dom</a></td>
- <td><em>none</em></td>
- <td> yes </td>
- <td align="left"> Applications code can access a DOM Document built
- from the input event stream. When used as a filter, this buffers
- data up to an <em>endDocument</em> call, and then uses a DOM parser
- to report everything that has been recorded (which can easily be
- less than what was reported to it). </td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="NSFilter.html">nsfix</a></td>
- <td><em>none</em></td>
- <td>no</td>
- <td align="left">This stage ensures that the XML element and attribute
- names in its output use namespace prefixes and declarations correctly.
- That is, so that they match the "Namespace plus LocalName" naming data
- with which each XML element and attribute is already associated. </td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="EventFilter.html">null</a></td>
- <td><em>none</em></td>
- <td>yes</td>
- <td align="left">This stage ignores all input event data.</td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="CallFilter.html">server</a></td>
- <td><em>required</em><br> server URL </td>
- <td>no</td>
- <td align="left">Sends its input as XML request to a remote server,
- normally a web application server using the HTTP or HTTPS protocols.
- The output of this stage is the parsed response from that server.</td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="TeeConsumer.html">tee</a></td>
- <td><em>required</em><br> first pipeline</td>
- <td>no</td>
- <td align="left">This sends its events down two paths; its parameter
- is a pipeline descriptor for the first path, and the second path
- is the output of this stage.</td>
- </tr>
-
- <tr valign="top" align="center">
- <td><a href="ValidationConsumer.html">validate</a></td>
- <td><em>none</em></td>
- <td>yes</td>
- <td align="left">This checks for validity errors, and reports them
- through its error handler. The input must include declaration events
- and some lexical events. </td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="WellFormednessFilter.html">wf</a></td>
- <td><em>none</em></td>
- <td>yes</td>
- <td align="left"> This class provides some basic "well formedness"
- tests on the input event stream, and reports a fatal error if any
- of them fail. One example: start/end calls for elements must match.
- No SAX parser is permitted to produce malformed output, but other
- components can easily do so.</td>
- </tr>
- <tr valign="top" align="center">
- <td>write</td>
- <td><em>required</em><br> "stdout", "stderr", or filename</td>
- <td>yes</td>
- <td align="left"> Writes its input to the specified output, as pretty
- printed XML text encoded using UTF-8. Input events must be well
- formed and "namespace fixed", else the output won't be XML (or possibly
- namespace) conformant. The symbolic names represent
- <em>System.out</em> and <em>System.err</em> respectively; names must
- correspond to files which don't yet exist.</td>
- </tr>
- <tr valign="top" align="center">
- <td>xhtml</td>
- <td><em>required</em><br> "stdout", "stderr", or filename</td>
- <td>yes</td>
- <td align="left"> Like <em>write</em> (above), except that XHTML rules
- are followed. The XHTML 1.0 Transitional document type is declared,
- and only ASCII characters are written (for interoperability). Other
- characters are written as entity or character references; the text is
- pretty printed.</td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="XIncludeFilter.html">xinclude</a></td>
- <td><em>none</em></td>
- <td>no</td>
- <td align="left">This stage handles XInclude processing.
- This is like entity inclusion, except that the included content
- is declared in-line rather than in the DTD at the beginning of
- a document.
- </td>
- </tr>
- <tr valign="top" align="center">
- <td><a href="XsltFilter.html">xslt</a></td>
- <td><em>required</em><br> XSLT stylesheet URI</td>
- <td>no</td>
- <td align="left">This stage handles XSLT transformation
- according to a stylesheet.
- The implementation of the transformation may not actually
- stream data, although if such an XSLT engine is in use
- then that can happen.
- </td>
- </tr>
-
- </table>
-
- * <p> Note that {@link EventFilter#bind} can automatically eliminate
- * some filters by setting SAX2 parser features appropriately. This means
- * that you can routinely put filters like "nsfix", "validate", or "wf" at the
- * front of a pipeline (for components that need inputs conditioned to match
- * that level of correctness), and know that it won't actually be used unless
- * it's absolutely necessary.
- *
- * @author David Brownell
- */
-public class PipelineFactory
-{
- /**
- * Creates a simple pipeline according to the description string passed in.
- */
- public static EventConsumer createPipeline (String description)
- throws IOException
- {
- return createPipeline (description, null);
- }
-
- /**
- * Extends an existing pipeline by prepending the filter pipeline to the
- * specified consumer. Some pipelines need more customization than can
- * be done through this simplified syntax. When they are set up with
- * direct API calls, use this method to merge more complex pipeline
- * segments with easily configured ones.
- */
- public static EventConsumer createPipeline (
- String description,
- EventConsumer next
- ) throws IOException
- {
- // tokens are (for now) what's separated by whitespace;
- // very easy to parse, but IDs never have spaces.
-
- StringTokenizer tokenizer;
- String tokens [];
-
- tokenizer = new StringTokenizer (description);
- tokens = new String [tokenizer.countTokens ()];
- for (int i = 0; i < tokens.length; i++)
- tokens [i] = tokenizer.nextToken ();
-
- PipelineFactory factory = new PipelineFactory ();
- Pipeline pipeline = factory.parsePipeline (tokens, next);
-
- return pipeline.createPipeline ();
- }
-
-
- private PipelineFactory () { /* NYET */ }
-
-
- /**
- * Extends an existing pipeline by prepending a pre-tokenized filter
- * pipeline to the specified consumer. Tokens are class names (or the
- * predefined aliases) left and right parenthesis, and the vertical bar.
- */
- public static EventConsumer createPipeline (
- String tokens [],
- EventConsumer next
- ) throws IOException
- {
- PipelineFactory factory = new PipelineFactory ();
- Pipeline pipeline = factory.parsePipeline (tokens, next);
-
- return pipeline.createPipeline ();
- }
-
-
- private String tokens [];
- private int index;
-
- private Pipeline parsePipeline (String toks [], EventConsumer next)
- {
- tokens = toks;
- index = 0;
-
- Pipeline retval = parsePipeline (next);
-
- if (index != toks.length)
- throw new ArrayIndexOutOfBoundsException (
- "extra token: " + tokens [index]);
- return retval;
- }
-
- // pipeline ::= stage | stage '|' pipeline
- private Pipeline parsePipeline (EventConsumer next)
- {
- Pipeline retval = new Pipeline (parseStage ());
-
- // minimal pipelines: "stage" and "... | id"
- if (index > (tokens.length - 2)
- || !"|".equals (tokens [index])
- ) {
- retval.next = next;
- return retval;
- }
- index++;
- retval.rest = parsePipeline (next);
- return retval;
- }
-
- // stage ::= id | id '(' pipeline ')'
- private Stage parseStage ()
- {
- Stage retval = new Stage (tokens [index++]);
-
- // minimal stages: "id" and "id ( id )"
- if (index > (tokens.length - 2)
- || !"(".equals (tokens [index]) /*)*/
- )
- return retval;
-
- index++;
- retval.param = parsePipeline (null);
- if (index >= tokens.length)
- throw new ArrayIndexOutOfBoundsException (
- "missing right paren");
- if (/*(*/ !")".equals (tokens [index++]))
- throw new ArrayIndexOutOfBoundsException (
- "required right paren, not: " + tokens [index - 1]);
- return retval;
- }
-
-
- //
- // these classes obey the conventions for constructors, so they're
- // only built in to this table of shortnames
- //
- // - filter (one or two types of arglist)
- // * last constructor is 'next' element
- // * optional (first) string parameter
- //
- // - terminus (one or types of arglist)
- // * optional (only) string parameter
- //
- // terminus stages are transformed into filters if needed, by
- // creating a "tee". filter stages aren't turned to terminus
- // stages though; either eliminate such stages, or add some
- // terminus explicitly.
- //
- private static final String builtinStages [][] = {
- { "dom", "gnu.xml.dom.Consumer" },
- { "nsfix", "gnu.xml.pipeline.NSFilter" },
- { "null", "gnu.xml.pipeline.EventFilter" },
- { "server", "gnu.xml.pipeline.CallFilter" },
- { "tee", "gnu.xml.pipeline.TeeConsumer" },
- { "validate", "gnu.xml.pipeline.ValidationConsumer" },
- { "wf", "gnu.xml.pipeline.WellFormednessFilter" },
- { "xinclude", "gnu.xml.pipeline.XIncludeFilter" },
- { "xslt", "gnu.xml.pipeline.XsltFilter" },
-
-// XXX want: option for validate, to preload external part of a DTD
-
- // xhtml, write ... nyet generic-ready
- };
-
- private static class Stage
- {
- String id;
- Pipeline param;
-
- Stage (String name)
- { id = name; }
-
- public String toString ()
- {
- if (param == null)
- return id;
- return id + " ( " + param + " )";
- }
-
- private void fail (String message)
- throws IOException
- {
- throw new IOException ("in '" + id
- + "' stage of pipeline, " + message);
- }
-
- EventConsumer createStage (EventConsumer next)
- throws IOException
- {
- String name = id;
-
- // most builtins are just class aliases
- for (int i = 0; i < builtinStages.length; i++) {
- if (id.equals (builtinStages [i][0])) {
- name = builtinStages [i][1];
- break;
- }
- }
-
- // Save output as XML or XHTML text
- if ("write".equals (name) || "xhtml".equals (name)) {
- String filename;
- boolean isXhtml = "xhtml".equals (name);
- OutputStream out = null;
- TextConsumer consumer;
-
- if (param == null)
- fail ("parameter is required");
-
- filename = param.toString ();
- if ("stdout".equals (filename))
- out = System.out;
- else if ("stderr".equals (filename))
- out = System.err;
- else {
- File f = new File (filename);
-
-/*
- if (!f.isAbsolute ())
- fail ("require absolute file paths");
- */
- if (f.exists ())
- fail ("file already exists: " + f.getName ());
-
-// XXX this races against the existence test
- out = new FileOutputStream (f);
- }
-
- if (!isXhtml)
- consumer = new TextConsumer (out);
- else
- consumer = new TextConsumer (
- new OutputStreamWriter (out, "8859_1"),
- true);
-
- consumer.setPrettyPrinting (true);
- if (next == null)
- return consumer;
- return new TeeConsumer (consumer, next);
-
- } else {
- //
- // Here go all the builtins that are just aliases for
- // classes, and all stage IDs that started out as such
- // class names. The following logic relies on several
- // documented conventions for constructor invocation.
- //
- String msg = null;
-
- try {
- Class klass = Class.forName (name);
- Class argTypes [] = null;
- Constructor constructor = null;
- boolean filter = false;
- Object params [] = null;
- Object obj = null;
-
- // do we need a filter stage?
- if (next != null) {
- // "next" consumer is always passed, with
- // or without the optional string param
- if (param == null) {
- argTypes = new Class [1];
- argTypes [0] = EventConsumer.class;
-
- params = new Object [1];
- params [0] = next;
-
- msg = "no-param filter";
- } else {
- argTypes = new Class [2];
- argTypes [0] = String.class;
- argTypes [1] = EventConsumer.class;
-
- params = new Object [2];
- params [0] = param.toString ();
- params [1] = next;
-
- msg = "one-param filter";
- }
-
-
- try {
- constructor = klass.getConstructor (argTypes);
- } catch (NoSuchMethodException e) {
- // try creating a filter from a
- // terminus and a tee
- filter = true;
- msg += " built from ";
- }
- }
-
- // build from a terminus stage, with or
- // without the optional string param
- if (constructor == null) {
- String tmp;
-
- if (param == null) {
- argTypes = new Class [0];
- params = new Object [0];
-
- tmp = "no-param terminus";
- } else {
- argTypes = new Class [1];
- argTypes [0] = String.class;
-
- params = new Object [1];
- params [0] = param.toString ();
-
- tmp = "one-param terminus";
- }
- if (msg == null)
- msg = tmp;
- else
- msg += tmp;
- constructor = klass.getConstructor (argTypes);
- // NOT creating terminus by dead-ending
- // filters ... users should think about
- // that one, something's likely wrong
- }
-
- obj = constructor.newInstance (params);
-
- // return EventConsumers directly, perhaps after
- // turning them into a filter
- if (obj instanceof EventConsumer) {
- if (filter)
- return new TeeConsumer ((EventConsumer) obj, next);
- return (EventConsumer) obj;
- }
-
- // if it's not a handler, it's an error
- // we can wrap handlers in a filter
- EventFilter retval = new EventFilter ();
- boolean updated = false;
-
- if (obj instanceof ContentHandler) {
- retval.setContentHandler ((ContentHandler) obj);
- updated = true;
- }
- if (obj instanceof DTDHandler) {
- retval.setDTDHandler ((DTDHandler) obj);
- updated = true;
- }
- if (obj instanceof LexicalHandler) {
- retval.setProperty (
- EventFilter.PROPERTY_URI + "lexical-handler",
- obj);
- updated = true;
- }
- if (obj instanceof DeclHandler) {
- retval.setProperty (
- EventFilter.PROPERTY_URI + "declaration-handler",
- obj);
- updated = true;
- }
-
- if (!updated)
- fail ("class is neither Consumer nor Handler");
-
- if (filter)
- return new TeeConsumer (retval, next);
- return retval;
-
- } catch (IOException e) {
- throw e;
-
- } catch (NoSuchMethodException e) {
- fail (name + " constructor missing -- " + msg);
-
- } catch (ClassNotFoundException e) {
- fail (name + " class not found");
-
- } catch (Exception e) {
- // e.printStackTrace ();
- fail ("stage not available: " + e.getMessage ());
- }
- }
- // NOTREACHED
- return null;
- }
- }
-
- private static class Pipeline
- {
- Stage stage;
-
- // rest may be null
- Pipeline rest;
- EventConsumer next;
-
- Pipeline (Stage s)
- { stage = s; }
-
- public String toString ()
- {
- if (rest == null && next == null)
- return stage.toString ();
- if (rest != null)
- return stage + " | " + rest;
- throw new IllegalArgumentException ("next");
- }
-
- EventConsumer createPipeline ()
- throws IOException
- {
- if (next == null) {
- if (rest == null)
- next = stage.createStage (null);
- else
- next = stage.createStage (rest.createPipeline ());
- }
- return next;
- }
- }
-
-/*
- public static void main (String argv [])
- {
- try {
- // three basic terminus cases
- createPipeline ("null");
- createPipeline ("validate");
- createPipeline ("write ( stdout )");
-
- // four basic filters
- createPipeline ("nsfix | write ( stderr )");
- createPipeline ("wf | null");
- createPipeline ("null | null");
- createPipeline (
-"call ( http://www.example.com/services/xml-1a ) | xhtml ( stdout )");
-
- // tee junctions
- createPipeline ("tee ( validate ) | write ( stdout )");
- createPipeline ("tee ( nsfix | write ( stdout ) ) | validate");
-
- // longer pipeline
- createPipeline ("nsfix | tee ( validate ) | write ( stdout )");
- createPipeline (
- "null | wf | nsfix | tee ( validate ) | write ( stdout )");
-
- // try some parsing error cases
- try {
- createPipeline ("null ("); // extra token '('
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("nsfix |"); // extra token '|'
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("xhtml ( foo"); // missing right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("xhtml ( foo bar"); // required right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- try {
- createPipeline ("tee ( nsfix | validate");// missing right paren
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- // try some construction error cases
-
- try {
- createPipeline ("call"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("call ( foobar )"); // broken param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("nsfix ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("null ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("wf ( foobar )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("xhtml ( foobar.html )");
- new File ("foobar.html").delete ();
- // now supported
- } catch (Exception e) {
- System.err.println ("** err: " + e.getMessage ()); }
- try {
- createPipeline ("xhtml"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("write ( stdout ) | null"); // nonterminal
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("validate | null");
- // now supported
- } catch (Exception e) {
- System.err.println ("** err: " + e.getMessage ()); }
- try {
- createPipeline ("validate ( foo )"); // illegal param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- createPipeline ("tee"); // missing param
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
- try {
- // only builtins so far
- createPipeline ("com.example.xml.FilterClass");
- System.err.println ("** didn't report error");
- } catch (Exception e) {
- System.err.println ("== err: " + e.getMessage ()); }
-
- } catch (Exception e) {
- e.printStackTrace ();
- }
- }
-/**/
-
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/TeeConsumer.java b/external/jaxp/source/gnu/xml/pipeline/TeeConsumer.java
deleted file mode 100644
index 1ed689393..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/TeeConsumer.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-//import gnu.xml.util;
-
-
-/**
- * Fans its events out to two other consumers, a "tee" filter stage in an
- * event pipeline. Networks can be assembled with multiple output points.
- *
- * <p> Error handling should be simple if you remember that exceptions
- * you throw will cancel later stages in that callback's pipeline, and
- * generally the producer will stop if it sees such an exception. You
- * may want to protect your pipeline against such backflows, making a
- * kind of reverse filter (or valve?) so that certain exceptions thrown by
- * your pipeline will caught and handled before the producer sees them.
- * Just use a "try/catch" block, rememebering that really important
- * cleanup tasks should be in "finally" clauses.
- *
- * <p> That issue isn't unique to "tee" consumers, but tee consumers have
- * the additional twist that exceptions thrown by the first consumer
- * will cause the second consumer not to see the callback (except for
- * the endDocument callback, which signals state cleanup).
- *
- * @author David Brownell
- */
-final public class TeeConsumer
- implements EventConsumer,
- ContentHandler, DTDHandler,
- LexicalHandler,DeclHandler
-{
- private EventConsumer first, rest;
-
- // cached to minimize time overhead
- private ContentHandler docFirst, docRest;
- private DeclHandler declFirst, declRest;
- private LexicalHandler lexFirst, lexRest;
-
-
- /**
- * Constructs a consumer which sends all its events to the first
- * consumer, and then the second one. If the first consumer throws
- * an exception, the second one will not see the event which
- * caused that exception to be reported.
- *
- * @param car The first consumer to get the events
- * @param cdr The second consumer to get the events
- */
- public TeeConsumer (EventConsumer car, EventConsumer cdr)
- {
- if (car == null || cdr == null)
- throw new NullPointerException ();
- first = car;
- rest = cdr;
-
- //
- // Cache the handlers.
- //
- docFirst = first.getContentHandler ();
- docRest = rest.getContentHandler ();
- // DTD handler isn't cached (rarely needed)
-
- try {
- declFirst = null;
- declFirst = (DeclHandler) first.getProperty (
- EventFilter.DECL_HANDLER);
- } catch (SAXException e) {}
- try {
- declRest = null;
- declRest = (DeclHandler) rest.getProperty (
- EventFilter.DECL_HANDLER);
- } catch (SAXException e) {}
-
- try {
- lexFirst = null;
- lexFirst = (LexicalHandler) first.getProperty (
- EventFilter.LEXICAL_HANDLER);
- } catch (SAXException e) {}
- try {
- lexRest = null;
- lexRest = (LexicalHandler) rest.getProperty (
- EventFilter.LEXICAL_HANDLER);
- } catch (SAXException e) {}
- }
-
-/* FIXME
- /**
- * Constructs a pipeline, and is otherwise a shorthand for the
- * two-consumer constructor for this class.
- *
- * @param first Description of the first pipeline to get events,
- * which will be passed to {@link PipelineFactory#createPipeline}
- * @param rest The second pipeline to get the events
- * /
- // constructor used by PipelineFactory
- public TeeConsumer (String first, EventConsumer rest)
- throws IOException
- {
- this (PipelineFactory.createPipeline (first), rest);
- }
-*/
-
- /** Returns the first pipeline to get event calls. */
- public EventConsumer getFirst ()
- { return first; }
-
- /** Returns the second pipeline to get event calls. */
- public EventConsumer getRest ()
- { return rest; }
-
- /** Returns the content handler being used. */
- final public ContentHandler getContentHandler ()
- {
- if (docRest == null)
- return docFirst;
- if (docFirst == null)
- return docRest;
- return this;
- }
-
- /** Returns the dtd handler being used. */
- final public DTDHandler getDTDHandler ()
- {
- // not cached (hardly used)
- if (rest.getDTDHandler () == null)
- return first.getDTDHandler ();
- if (first.getDTDHandler () == null)
- return rest.getDTDHandler ();
- return this;
- }
-
- /** Returns the declaration or lexical handler being used. */
- final public Object getProperty (String id)
- throws SAXNotRecognizedException
- {
- //
- // in degenerate cases, we have no work to do.
- //
- Object firstProp = null, restProp = null;
-
- try { firstProp = first.getProperty (id); }
- catch (SAXNotRecognizedException e) { /* ignore */ }
- try { restProp = rest.getProperty (id); }
- catch (SAXNotRecognizedException e) { /* ignore */ }
-
- if (restProp == null)
- return firstProp;
- if (firstProp == null)
- return restProp;
-
- //
- // we've got work to do; handle two builtin cases.
- //
- if (EventFilter.DECL_HANDLER.equals (id))
- return this;
- if (EventFilter.LEXICAL_HANDLER.equals (id))
- return this;
-
- //
- // non-degenerate, handled by both consumers, but we don't know
- // how to handle this.
- //
- throw new SAXNotRecognizedException ("can't tee: " + id);
- }
-
- /**
- * Provides the error handler to both subsequent nodes of
- * this filter stage.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- first.setErrorHandler (handler);
- rest.setErrorHandler (handler);
- }
-
-
- //
- // ContentHandler
- //
- public void setDocumentLocator (Locator locator)
- {
- // this call is not made by all parsers
- docFirst.setDocumentLocator (locator);
- docRest.setDocumentLocator (locator);
- }
-
- public void startDocument ()
- throws SAXException
- {
- docFirst.startDocument ();
- docRest.startDocument ();
- }
-
- public void endDocument ()
- throws SAXException
- {
- try {
- docFirst.endDocument ();
- } finally {
- docRest.endDocument ();
- }
- }
-
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- docFirst.startPrefixMapping (prefix, uri);
- docRest.startPrefixMapping (prefix, uri);
- }
-
- public void endPrefixMapping (String prefix)
- throws SAXException
- {
- docFirst.endPrefixMapping (prefix);
- docRest.endPrefixMapping (prefix);
- }
-
- public void skippedEntity (String name)
- throws SAXException
- {
- docFirst.skippedEntity (name);
- docRest.skippedEntity (name);
- }
-
- public void startElement (String uri, String localName,
- String qName, Attributes atts)
- throws SAXException
- {
- docFirst.startElement (uri, localName, qName, atts);
- docRest.startElement (uri, localName, qName, atts);
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- docFirst.endElement (uri, localName, qName);
- docRest.endElement (uri, localName, qName);
- }
-
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- docFirst.processingInstruction (target, data);
- docRest.processingInstruction (target, data);
- }
-
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- docFirst.characters (ch, start, length);
- docRest.characters (ch, start, length);
- }
-
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- docFirst.ignorableWhitespace (ch, start, length);
- docRest.ignorableWhitespace (ch, start, length);
- }
-
-
- //
- // DTDHandler
- //
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- DTDHandler l1 = first.getDTDHandler ();
- DTDHandler l2 = rest.getDTDHandler ();
-
- l1.notationDecl (name, publicId, systemId);
- l2.notationDecl (name, publicId, systemId);
- }
-
- public void unparsedEntityDecl (String name,
- String publicId, String systemId,
- String notationName
- ) throws SAXException
- {
- DTDHandler l1 = first.getDTDHandler ();
- DTDHandler l2 = rest.getDTDHandler ();
-
- l1.unparsedEntityDecl (name, publicId, systemId, notationName);
- l2.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
-
- //
- // DeclHandler
- //
- public void attributeDecl (String eName, String aName,
- String type,
- String mode, String value)
- throws SAXException
- {
- declFirst.attributeDecl (eName, aName, type, mode, value);
- declRest.attributeDecl (eName, aName, type, mode, value);
- }
-
- public void elementDecl (String name, String model)
- throws SAXException
- {
- declFirst.elementDecl (name, model);
- declRest.elementDecl (name, model);
- }
-
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- declFirst.externalEntityDecl (name, publicId, systemId);
- declRest.externalEntityDecl (name, publicId, systemId);
- }
-
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- declFirst.internalEntityDecl (name, value);
- declRest.internalEntityDecl (name, value);
- }
-
-
- //
- // LexicalHandler
- //
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- lexFirst.comment (ch, start, length);
- lexRest.comment (ch, start, length);
- }
-
- public void startCDATA ()
- throws SAXException
- {
- lexFirst.startCDATA ();
- lexRest.startCDATA ();
- }
-
- public void endCDATA ()
- throws SAXException
- {
- lexFirst.endCDATA ();
- lexRest.endCDATA ();
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- lexFirst.startEntity (name);
- lexRest.startEntity (name);
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- lexFirst.endEntity (name);
- lexRest.endEntity (name);
- }
-
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- lexFirst.startDTD (name, publicId, systemId);
- lexRest.startDTD (name, publicId, systemId);
- }
-
- public void endDTD ()
- throws SAXException
- {
- lexFirst.endDTD ();
- lexRest.endDTD ();
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/TextConsumer.java b/external/jaxp/source/gnu/xml/pipeline/TextConsumer.java
deleted file mode 100644
index 43d47e36a..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/TextConsumer.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.*;
-
-import org.xml.sax.*;
-
-import gnu.xml.util.XMLWriter;
-
-
-/**
- * Terminates a pipeline, consuming events to print them as well formed
- * XML (or XHTML) text.
- *
- * <p> Input must be well formed, and must include XML names (e.g. the
- * prefixes and prefix declarations must be present), or the output of
- * this class is undefined.
- *
- * @see NSFilter
- * @see WellFormednessFilter
- *
- * @author David Brownell
- */
-public class TextConsumer extends XMLWriter implements EventConsumer
-{
- /**
- * Constructs an event consumer which echoes its input as text,
- * optionally adhering to some basic XHTML formatting options
- * which increase interoperability with old (v3) browsers.
- *
- * <p> For the best interoperability, when writing as XHTML only
- * ASCII characters are emitted; other characters are turned to
- * entity or character references as needed, and no XML declaration
- * is provided in the document.
- */
- public TextConsumer (Writer w, boolean isXhtml)
- throws IOException
- {
- super (w, isXhtml ? "US-ASCII" : null);
- setXhtml (isXhtml);
- }
-
- /**
- * Constructs a consumer that writes its input as XML text.
- * XHTML rules are not followed.
- */
- public TextConsumer (Writer w)
- throws IOException
- {
- this (w, false);
- }
-
- /**
- * Constructs a consumer that writes its input as XML text,
- * encoded in UTF-8. XHTML rules are not followed.
- */
- public TextConsumer (OutputStream out)
- throws IOException
- {
- this (new OutputStreamWriter (out, "UTF8"), false);
- }
-
- /** <b>EventConsumer</b> Returns the document handler being used. */
- public ContentHandler getContentHandler ()
- { return this; }
-
- /** <b>EventConsumer</b> Returns the dtd handler being used. */
- public DTDHandler getDTDHandler ()
- { return this; }
-
- /** <b>XMLReader</b>Retrieves a property (lexical and decl handlers) */
- public Object getProperty (String propertyId)
- throws SAXNotRecognizedException
- {
- if (EventFilter.LEXICAL_HANDLER.equals (propertyId))
- return this;
- if (EventFilter.DECL_HANDLER.equals (propertyId))
- return this;
- throw new SAXNotRecognizedException (propertyId);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/ValidationConsumer.java b/external/jaxp/source/gnu/xml/pipeline/ValidationConsumer.java
deleted file mode 100644
index 65b962edd..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/ValidationConsumer.java
+++ /dev/null
@@ -1,1911 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.*;
-
-import java.util.EmptyStackException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-
-/**
- * This class checks SAX2 events to report validity errors; it works as
- * both a filter and a terminus on an event pipeline. It relies on the
- * producer of SAX events to: </p> <ol>
- *
- * <li> Conform to the specification of a non-validating XML parser that
- * reads all external entities, reported using SAX2 events. </li>
- *
- * <li> Report ignorable whitespace as such (through the ContentHandler
- * interface). This is, strictly speaking, optional for nonvalidating
- * XML processors. </li>
- *
- * <li> Make SAX2 DeclHandler callbacks, with default
- * attribute values already normalized (and without "&lt;").</li>
- *
- * <li> Make SAX2 LexicalHandler startDTD() and endDTD ()
- * callbacks. </li>
- *
- * <li> Act as if the <em>(URI)/namespace-prefixes</em> property were
- * set to true, by providing XML 1.0 names and all <code>xmlns*</code>
- * attributes (rather than omitting either or both). </li>
- *
- * </ol>
- *
- * <p> At this writing, the major SAX2 parsers (such as &AElig;lfred2,
- * Crimson, and Xerces) meet these requirements, and this validation
- * module is used by the optional &AElig;lfred2 validation support.
- * </p>
- *
- * <p> Note that because this is a layered validator, it has to duplicate some
- * work that the parser is doing; there are also other cost to layering.
- * However, <em>because of layering it doesn't need a parser</em> in order
- * to work! You can use it with anything that generates SAX events, such
- * as an application component that wants to detect invalid content in
- * a changed area without validating an entire document, or which wants to
- * ensure that it doesn't write invalid data to a communications partner.</p>
- *
- * <p> Also, note that because this is a layered validator, the line numbers
- * reported for some errors may seem strange. For example, if an element does
- * not permit character content, the validator
- * will use the locator provided to it.
- * That might reflect the last character of a <em>characters</em> event
- * callback, rather than the first non-whitespace character. </p>
- *
- * <hr />
- *
- * <!--
- * <p> Of interest is the fact that unlike most currently known XML validators,
- * this one can report some cases of non-determinism in element content models.
- * It is a compile-time option, enabled by default. This will only report
- * such XML errors if they relate to content actually appearing in a document;
- * content models aren't aggressively scanned for non-deterministic structure.
- * Documents which trigger such non-deterministic transitions may be handled
- * differently by different validating parsers, without losing conformance
- * to the XML specification. </p>
- * -->
- *
- * <p> Current limitations of the validation performed are in roughly three
- * categories. </p>
- *
- * <p> The first category represents constraints which demand violations
- * of software layering: exposing lexical details, one of the first things
- * that <em>application</em> programming interfaces (APIs) hide. These
- * invariably relate to XML entity handling, and to historical oddities
- * of the XML validation semantics. Curiously,
- * recent (Autumn 1999) conformance testing showed that these constraints are
- * among those handled worst by existing XML validating parsers. Arguments
- * have been made that each of these VCs should be turned into WFCs (most
- * of them) or discarded (popular for the standalone declaration); in short,
- * that these are bugs in the XML specification (not all via SGML): </p><ul>
- *
- * <li> The <em>Proper Declaration/PE Nesting</em> and
- * <em>Proper Group/PE Nesting</em> VCs can't be tested because they
- * require access to particularly low level lexical level information.
- * In essence, the reason XML isn't a simple thing to parse is that
- * it's not a context free grammar, and these constraints elevate that
- * SGML-derived context sensitivity to the level of a semantic rule.
- *
- * <li> The <em>Standalone Document Declaration</em> VC can't be
- * tested. This is for two reasons. First, this flag isn't made
- * available through SAX2. Second, it also requires breaking that
- * lexical layering boundary. (If you ever wondered why classes
- * in compiler construction or language design barely mention the
- * existence of context-sensitive grammars, it's because of messy
- * issues like these.)
- *
- * <li> The <em>Entity Declared</em> VC can't be tested, because it
- * also requires breaking that lexical layering boundary! There's also
- * another issue: the VC wording (and seemingly intent) is ambiguous.
- * (This is still true in the "Second edition" XML spec.)
- * Since there is a WFC of the same name, everyone's life would be
- * easier if references to undeclared parsed entities were always well
- * formedness errors, regardless of whether they're parameter entities
- * or not. (Note that nonvalidating parsers are not required
- * to report all such well formedness errors if they don't read external
- * parameter entities, although currently most XML parsers read them
- * in an attempt to avoid problems from inconsistent parser behavior.)
- *
- * </ul>
- *
- * <p> The second category of limitations on this validation represent
- * constraints associated with information that is not guaranteed to be
- * available (or in one case, <em>is guaranteed not to be available</em>,
- * through the SAX2 API: </p><ul>
- *
- * <li> The <em>Unique Element Type Declaration</em> VC may not be
- * reportable, if the underlying parser happens not to expose
- * multiple declarations. (&AElig;lfred2 reports these validity
- * errors directly.)</li>
- *
- * <li> Similarly, the <em>Unique Notation Name</em> VC, added in the
- * 14-January-2000 XML spec errata to restrict typing models used by
- * elements, may not be reportable. (&AElig;lfred reports these
- * validity errors directly.) </li>
- *
- * </ul>
- *
- * <p> A third category relates to ease of implementation. (Think of this
- * as "bugs".) The most notable issue here is character handling. Rather
- * than attempting to implement the voluminous character tables in the XML
- * specification (Appendix B), Unicode rules are used directly from
- * the java.lang.Character class. Recent JVMs have begun to diverge from
- * the original specification for that class (Unicode 2.0), meaning that
- * different JVMs may handle that aspect of conformance differently.
- * </p>
- *
- * <p> Note that for some of the validity errors that SAX2 does not
- * expose, a nonvalidating parser is permitted (by the XML specification)
- * to report validity errors. When used with a parser that does so for
- * the validity constraints mentioned above (or any other SAX2 event
- * stream producer that does the same thing), overall conformance is
- * substantially improved.
- *
- * @see gnu.xml.aelfred2.SAXDriver
- * @see gnu.xml.aelfred2.XmlReader
- *
- * @author David Brownell
- */
-public final class ValidationConsumer extends EventFilter
-{
- // report error if we happen to notice a non-deterministic choice?
- // we won't report buggy content models; just buggy instances
- private static final boolean warnNonDeterministic = false;
-
- // for tracking active content models
- private String rootName;
- private Stack contentStack = new Stack ();
-
- // flags for "saved DTD" processing
- private boolean disableDeclarations;
- private boolean disableReset;
-
- //
- // most VCs get tested when we see element start tags. the per-element
- // info (including attributes) recorded here duplicates that found inside
- // many nonvalidating parsers, hence dual lookups etc ... that's why a
- // layered validator isn't going to be as fast as a non-layered one.
- //
-
- // key = element name; value = ElementInfo
- private Hashtable elements = new Hashtable ();
-
- // some VCs relate to ID/IDREF/IDREFS attributes
- // key = id; value = boolean true (defd) or false (refd)
- private Hashtable ids = new Hashtable ();
-
- // we just record declared notation and unparsed entity names.
- // the implementation here is simple/slow; these features
- // are seldom used, one hopes they'll wither away soon
- private Vector notations = new Vector (5, 5);
- private Vector nDeferred = new Vector (5, 5);
- private Vector unparsed = new Vector (5, 5);
- private Vector uDeferred = new Vector (5, 5);
-
- // note: DocBk 3.1.7 XML defines over 2 dozen notations,
- // used when defining unparsed entities for graphics
- // (and maybe in other places)
-
-
-
- /**
- * Creates a pipeline terminus which consumes all events passed to
- * it; this will report validity errors as if they were fatal errors,
- * unless an error handler is assigned.
- *
- * @see #setErrorHandler
- */
- // constructor used by PipelineFactory
- // ... and want one taking system ID of an external subset
- public ValidationConsumer ()
- {
- this (null);
- }
-
- /**
- * Creates a pipeline filter which reports validity errors and then
- * passes events on to the next consumer if they were not fatal.
- *
- * @see #setErrorHandler
- */
- // constructor used by PipelineFactory
- // ... and want one taking system ID of an external subset
- // (which won't send declaration events)
- public ValidationConsumer (EventConsumer next)
- {
- super (next);
-
- setContentHandler (this);
- setDTDHandler (this);
- try { setProperty (DECL_HANDLER, this); }
- catch (Exception e) { /* "can't happen" */ }
- try { setProperty (LEXICAL_HANDLER, this); }
- catch (Exception e) { /* "can't happen" */ }
- }
-
-
- private static final String fakeRootName
- = ":Nobody:in:their_Right.Mind_would:use:this-name:1x:";
-
- /**
- * Creates a validation consumer which is preloaded with the DTD provided.
- * It does this by constructing a document with that DTD, then parsing
- * that document and recording its DTD declarations. Then it arranges
- * not to modify that information.
- *
- * <p> The resulting validation consumer will only validate against
- * the specified DTD, regardless of whether some other DTD is found
- * in a document being parsed.
- *
- * @param rootName The name of the required root element; if this is
- * null, any root element name will be accepted.
- * @param publicId If non-null and there is a non-null systemId, this
- * identifier provides an alternate access identifier for the DTD's
- * external subset.
- * @param systemId If non-null, this is a URI (normally URL) that
- * may be used to access the DTD's external subset.
- * @param internalSubset If non-null, holds literal markup declarations
- * comprising the DTD's internal subset.
- * @param resolver If non-null, this will be provided to the parser for
- * use when resolving parameter entities (including any external subset).
- * @param resolver If non-null, this will be provided to the parser for
- * use when resolving parameter entities (including any external subset).
- * @param minimalElement If non-null, a minimal valid document.
- *
- * @exception SAXNotSupportedException If the default SAX parser does
- * not support the standard lexical or declaration handlers.
- * @exception SAXParseException If the specified DTD has either
- * well-formedness or validity errors
- * @exception IOException If the specified DTD can't be read for
- * some reason
- */
- public ValidationConsumer (
- String rootName,
- String publicId,
- String systemId,
- String internalSubset,
- EntityResolver resolver,
- String minimalDocument
- ) throws SAXException, IOException
- {
- this (null);
-
- disableReset = true;
- if (rootName == null)
- rootName = fakeRootName;
-
- //
- // Synthesize document with that DTD; is it possible to do
- // better for the declaration of the root element?
- //
- // NOTE: can't use SAX2 to write internal subsets.
- //
- StringWriter writer = new StringWriter ();
-
- writer.write ("<!DOCTYPE ");
- writer.write (rootName);
- if (systemId != null) {
- writer.write ("\n ");
- if (publicId != null) {
- writer.write ("PUBLIC '");
- writer.write (publicId);
- writer.write ("'\n\t'");
- } else
- writer.write ("SYSTEM '");
- writer.write (systemId);
- writer.write ("'");
- }
- writer.write (" [ ");
- if (rootName == fakeRootName) {
- writer.write ("\n<!ELEMENT ");
- writer.write (rootName);
- writer.write (" EMPTY>");
- }
- if (internalSubset != null)
- writer.write (internalSubset);
- writer.write ("\n ]>");
-
- if (minimalDocument != null) {
- writer.write ("\n");
- writer.write (minimalDocument);
- writer.write ("\n");
- } else {
- writer.write (" <");
- writer.write (rootName);
- writer.write ("/>\n");
- }
- minimalDocument = writer.toString ();
-
- //
- // OK, load it
- //
- XMLReader producer;
-
- producer = XMLReaderFactory.createXMLReader ();
- bind (producer, this);
-
- if (resolver != null)
- producer.setEntityResolver (resolver);
-
- InputSource in;
-
- in = new InputSource (new StringReader (minimalDocument));
- producer.parse (in);
-
- disableDeclarations = true;
- if (rootName == fakeRootName)
- this.rootName = null;
- }
-
- private void resetState ()
- {
- if (!disableReset) {
- rootName = null;
- contentStack.removeAllElements ();
- elements.clear ();
- ids.clear ();
-
- notations.removeAllElements ();
- nDeferred.removeAllElements ();
- unparsed.removeAllElements ();
- uDeferred.removeAllElements ();
- }
- }
-
-
- private void warning (String description)
- throws SAXException
- {
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (errHandler == null)
- return;
-
- if (locator == null)
- err = new SAXParseException (description, null, null, -1, -1);
- else
- err = new SAXParseException (description, locator);
- errHandler.warning (err);
- }
-
- // package private (for ChildrenRecognizer)
- private void error (String description)
- throws SAXException
- {
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (locator == null)
- err = new SAXParseException (description, null, null, -1, -1);
- else
- err = new SAXParseException (description, locator);
- if (errHandler != null)
- errHandler.error (err);
- else // else we always treat it as fatal!
- throw err;
- }
-
- private void fatalError (String description)
- throws SAXException
- {
- ErrorHandler errHandler = getErrorHandler ();
- Locator locator = getDocumentLocator ();
- SAXParseException err;
-
- if (locator != null)
- err = new SAXParseException (description, locator);
- else
- err = new SAXParseException (description, null, null, -1, -1);
- if (errHandler != null)
- errHandler.fatalError (err);
- // we always treat this as fatal, regardless of the handler
- throw err;
- }
-
-
- private static boolean isExtender (char c)
- {
- // [88] Extender ::= ...
- return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387
- || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005
- || (c >= 0x3031 && c <= 0x3035)
- || (c >= 0x309d && c <= 0x309e)
- || (c >= 0x30fc && c <= 0x30fe);
- }
-
-
- // use augmented Unicode rules, not full XML rules
- private boolean isName (String name, String context, String id)
- throws SAXException
- {
- char buf [] = name.toCharArray ();
- boolean pass = true;
-
- if (!Character.isUnicodeIdentifierStart (buf [0])
- && ":_".indexOf (buf [0]) == -1)
- pass = false;
- else {
- int max = buf.length;
- for (int i = 1; pass && i < max; i++) {
- char c = buf [i];
- if (!Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- pass = false;
- }
- }
-
- if (!pass)
- error ("In " + context + " for " + id
- + ", '" + name + "' is not a name");
- return pass; // true == OK
- }
-
- // use augmented Unicode rules, not full XML rules
- private boolean isNmtoken (String nmtoken, String context, String id)
- throws SAXException
- {
- char buf [] = nmtoken.toCharArray ();
- boolean pass = true;
- int max = buf.length;
-
- // XXX make this share code with isName
-
- for (int i = 0; pass && i < max; i++) {
- char c = buf [i];
- if (!Character.isUnicodeIdentifierPart (c)
- && ":-_.".indexOf (c) == -1
- && !isExtender (c))
- pass = false;
- }
-
- if (!pass)
- error ("In " + context + " for " + id
- + ", '" + nmtoken + "' is not a name token");
- return pass; // true == OK
- }
-
- private void checkEnumeration (String value, String type, String name)
- throws SAXException
- {
- if (!hasMatch (value, type))
- // VC: Enumeration
- error ("Value '" + value
- + "' for attribute '" + name
- + "' is not permitted: " + type);
- }
-
- // used to test enumerated attributes and mixed content models
- // package private
- static boolean hasMatch (String value, String orList)
- {
- int len = value.length ();
- int max = orList.length () - len;
-
- for (int start = 0;
- (start = orList.indexOf (value, start)) != -1;
- start++) {
- char c;
-
- if (start > max)
- break;
- c = orList.charAt (start - 1);
- if (c != '|' && c != '('/*)*/)
- continue;
- c = orList.charAt (start + len);
- if (c != '|' && /*(*/ c != ')')
- continue;
- return true;
- }
- return false;
- }
-
- /**
- * <b>LexicalHandler</b> Records the declaration of the root
- * element, so it can be verified later.
- * Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- rootName = name;
- super.startDTD (name, publicId, systemId);
- }
-
- /**
- * <b>LexicalHandler</b> Verifies that all referenced notations
- * and unparsed entities have been declared.
- * Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void endDTD ()
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- // this is a convenient hook for end-of-dtd checks, but we
- // could also trigger it in the first startElement call.
- // locator info is more appropriate here though.
-
- // VC: Notation Declared (NDATA can refer to them before decls,
- // as can NOTATION attribute enumerations and defaults)
- int length = nDeferred.size ();
- for (int i = 0; i < length; i++) {
- String notation = (String) nDeferred.elementAt (i);
- if (!notations.contains (notation)) {
- error ("A declaration referred to notation '" + notation
- + "' which was never declared");
- }
- }
- nDeferred.removeAllElements ();
-
- // VC: Entity Name (attribute values can refer to them
- // before they're declared); VC Attribute Default Legal
- length = uDeferred.size ();
- for (int i = 0; i < length; i++) {
- String entity = (String) uDeferred.elementAt (i);
- if (!unparsed.contains (entity)) {
- error ("An attribute default referred to entity '" + entity
- + "' which was never declared");
- }
- }
- uDeferred.removeAllElements ();
- super.endDTD ();
- }
-
-
- // These are interned, so we can rely on "==" to find the type of
- // all attributes except enumerations ...
- // "(this|or|that|...)" and "NOTATION (this|or|that|...)"
- static final String types [] = {
- "CDATA",
- "ID", "IDREF", "IDREFS",
- "NMTOKEN", "NMTOKENS",
- "ENTITY", "ENTITIES"
- };
-
-
- /**
- * <b>DecllHandler</b> Records attribute declaration for later use
- * in validating document content, and checks validity constraints
- * that are applicable to attribute declarations.
- * Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void attributeDecl (
- String eName,
- String aName,
- String type,
- String mode,
- String value
- ) throws SAXException
- {
- if (disableDeclarations)
- return;
-
- ElementInfo info = (ElementInfo) elements.get (eName);
- AttributeInfo ainfo = new AttributeInfo ();
- boolean checkOne = false;
- boolean interned = false;
-
- // cheap interning of type names and #FIXED, #REQUIRED
- // for faster startElement (we can use "==")
- for (int i = 0; i < types.length; i++) {
- if (types [i].equals (type)) {
- type = types [i];
- interned = true;
- break;
- }
- }
- if ("#FIXED".equals (mode))
- mode = "#FIXED";
- else if ("#REQUIRED".equals (mode))
- mode = "#REQUIRED";
-
- ainfo.type = type;
- ainfo.mode = mode;
- ainfo.value = value;
-
- // we might not have seen the content model yet
- if (info == null) {
- info = new ElementInfo (eName);
- elements.put (eName, info);
- }
- if ("ID" == type) {
- checkOne = true;
- if (!("#REQUIRED" == mode || "#IMPLIED".equals (mode))) {
- // VC: ID Attribute Default
- error ("ID attribute '" + aName
- + "' must be #IMPLIED or #REQUIRED");
- }
-
- } else if (!interned && type.startsWith ("NOTATION ")) {
- checkOne = true;
-
- // VC: Notation Attributes (notations must be declared)
- StringTokenizer tokens = new StringTokenizer (
- type.substring (10, type.lastIndexOf (')')),
- "|");
- while (tokens.hasMoreTokens ()) {
- String token = tokens.nextToken ();
- if (!notations.contains (token))
- nDeferred.addElement (token);
- }
- }
- if (checkOne) {
- for (Enumeration e = info.attributes.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String name;
- AttributeInfo ainfo2;
-
- name = (String) e.nextElement ();
- ainfo2 = (AttributeInfo) info.attributes.get (name);
- if (type == ainfo2.type || !interned /* NOTATION */) {
- // VC: One ID per Element Type
- // VC: One Notation per Element TYpe
- error ("Element '" + eName
- + "' already has an attribute of type "
- + (interned ? "NOTATION" : type)
- + " ('" + name
- + "') so '" + aName
- + "' is a validity error");
- }
- }
- }
-
- // VC: Attribute Default Legal
- if (value != null) {
-
- if ("CDATA" == type) {
- // event source rejected '<'
-
- } else if ("NMTOKEN" == type) {
- // VC: Name Token (is a nmtoken)
- isNmtoken (value, "attribute default", aName);
-
- } else if ("NMTOKENS" == type) {
- // VC: Name Token (is a nmtoken; at least one value)
- StringTokenizer tokens = new StringTokenizer (value);
- if (!tokens.hasMoreTokens ())
- error ("Default for attribute '" + aName
- + "' must have at least one name token.");
- else do {
- String token = tokens.nextToken ();
- isNmtoken (token, "attribute default", aName);
- } while (tokens.hasMoreTokens ());
-
- } else if ("IDREF" == type || "ENTITY" == type) {
- // VC: Entity Name (is a name)
- // VC: IDREF (is a name) (is declared)
- isName (value, "attribute default", aName);
- if ("ENTITY" == type && !unparsed.contains (value))
- uDeferred.addElement (value);
-
- } else if ("IDREFS" == type || "ENTITIES" == type) {
- // VC: Entity Name (is a name; at least one value)
- // VC: IDREF (is a name; at least one value)
- StringTokenizer names = new StringTokenizer (value);
- if (!names.hasMoreTokens ())
- error ("Default for attribute '" + aName
- + "' must have at least one name.");
- else do {
- String name = names.nextToken ();
- isName (name, "attribute default", aName);
- if ("ENTITIES" == type && !unparsed.contains (name))
- uDeferred.addElement (value);
- } while (names.hasMoreTokens ());
-
- } else if (type.charAt (0) == '(' /*)*/ ) {
- // VC: Enumeration (must match)
- checkEnumeration (value, type, aName);
-
- } else if (!interned && checkOne) { /* NOTATION */
- // VC: Notation attributes (must be names)
- isName (value, "attribute default", aName);
-
- // VC: Notation attributes (must be declared)
- if (!notations.contains (value))
- nDeferred.addElement (value);
-
- // VC: Enumeration (must match)
- checkEnumeration (value, type, aName);
-
- } else if ("ID" != type)
- throw new RuntimeException ("illegal attribute type: " + type);
- }
-
- if (info.attributes.get (aName) == null)
- info.attributes.put (aName, ainfo);
- /*
- else
- warning ("Element '" + eName
- + "' already has an attribute named '" + aName + "'");
- */
-
- if ("xml:space".equals (aName)) {
- if (!("(default|preserve)".equals (type)
- || "(preserve|default)".equals (type)
- // these next two are arguable; XHTML's DTD doesn't
- // deserve errors. After all, it's not like any
- // illegal _value_ could pass ...
- || "(preserve)".equals (type)
- || "(default)".equals (type)
- ))
- error (
- "xml:space attribute type must be like '(default|preserve)'"
- + " not '" + type + "'"
- );
-
- }
- super.attributeDecl (eName, aName, type, mode, value);
- }
-
- /**
- * <b>DecllHandler</b> Records the element declaration for later use
- * when checking document content, and checks validity constraints that
- * apply to element declarations. Passed to the next consumer, unless
- * this one was preloaded with a particular DTD.
- */
- public void elementDecl (String name, String model)
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- ElementInfo info = (ElementInfo) elements.get (name);
-
- // we might have seen an attribute decl already
- if (info == null) {
- info = new ElementInfo (name);
- elements.put (name, info);
- }
- if (info.model != null) {
- // NOTE: not all parsers can report such duplicates.
- // VC: Unique Element Type Declaration
- error ("Element type '" + name
- + "' was already declared.");
- } else {
- info.model = model;
-
- // VC: No Duplicate Types (in mixed content models)
- if (model.charAt (1) == '#') // (#PCDATA...
- info.getRecognizer (this);
- }
- super.elementDecl (name, model);
- }
-
- /**
- * <b>DecllHandler</b> passed to the next consumer, unless this
- * one was preloaded with a particular DTD
- */
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- if (!disableDeclarations)
- super.internalEntityDecl (name, value);
- }
-
- /**
- * <b>DecllHandler</b> passed to the next consumer, unless this
- * one was preloaded with a particular DTD
- */
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (!disableDeclarations)
- super.externalEntityDecl (name, publicId, systemId);
- }
-
-
- /**
- * <b>DTDHandler</b> Records the notation name, for checking
- * NOTATIONS attribute values and declararations of unparsed
- * entities. Passed to the next consumer, unless this one was
- * preloaded with a particular DTD.
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- if (disableDeclarations)
- return;
-
- notations.addElement (name);
- super.notationDecl (name, publicId, systemId);
- }
-
- /**
- * <b>DTDHandler</b> Records the entity name, for checking
- * ENTITY and ENTITIES attribute values; records the notation
- * name if it hasn't yet been declared. Passed to the next consumer,
- * unless this one was preloaded with a particular DTD.
- */
- public void unparsedEntityDecl (
- String name,
- String publicId,
- String systemId,
- String notationName
- ) throws SAXException
- {
- if (disableDeclarations)
- return;
-
- unparsed.addElement (name);
- if (!notations.contains (notationName))
- nDeferred.addElement (notationName);
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
-
- /**
- * <b>ContentHandler</b> Ensures that state from any previous parse
- * has been deleted.
- * Passed to the next consumer.
- */
- public void startDocument ()
- throws SAXException
- {
- resetState ();
- super.startDocument ();
- }
-
-
- private static boolean isAsciiLetter (char c)
- {
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
- }
-
-
- /**
- * <b>ContentHandler</b> Reports a fatal exception. Validating
- * XML processors may not skip any entities.
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- fatalError ("may not skip entities");
- }
-
- /*
- * SAX2 doesn't expand non-PE refs in attribute defaults...
- */
- private String expandDefaultRefs (String s)
- throws SAXException
- {
- if (s.indexOf ('&') < 0)
- return s;
-
-// FIXME: handle &#nn; &#xnn; &name;
- String message = "Can't expand refs in attribute default: " + s;
- warning (message);
-
- return s;
- }
-
- /**
- * <b>ContentHandler</b> Performs validity checks against element
- * (and document) content models, and attribute values.
- * Passed to the next consumer.
- */
- public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- //
- // First check content model for the enclosing scope.
- //
- if (contentStack.isEmpty ()) {
- // VC: Root Element Type
- if (!qName.equals (rootName)) {
- if (rootName == null)
- warning ("This document has no DTD, can't be valid");
- else
- error ("Root element type '" + qName
- + "' was declared to be '" + rootName + "'");
- }
- } else {
- Recognizer state = (Recognizer) contentStack.peek ();
-
- if (state != null) {
- Recognizer newstate = state.acceptElement (qName);
-
- if (newstate == null)
- error ("Element type '" + qName
- + "' in element '" + state.type.name
- + "' violates content model " + state.type.model
- );
- if (newstate != state) {
- contentStack.pop ();
- contentStack.push (newstate);
- }
- }
- }
-
- //
- // Then check that this element was declared, and push the
- // object used to validate its content model onto our stack.
- //
- // This is where the recognizer gets created, if needed; if
- // it's a "children" (elements) content model, an NDFA is
- // created. (One recognizer is used per content type, no
- // matter how complex that recognizer is.)
- //
- ElementInfo info;
-
- info = (ElementInfo) elements.get (qName);
- if (info == null || info.model == null) {
- // VC: Element Valid (base clause)
- error ("Element type '" + qName + "' was not declared");
- contentStack.push (null);
-
- // for less diagnostic noise, fake a declaration.
- elementDecl (qName, "ANY");
- } else
- contentStack.push (info.getRecognizer (this));
-
- //
- // Then check each attribute present
- //
- int len;
- String aname;
- AttributeInfo ainfo;
-
- if (atts != null)
- len = atts.getLength ();
- else
- len = 0;
-
- for (int i = 0; i < len; i++) {
- aname = atts.getQName (i);
-
- if (info == null
- || (ainfo = (AttributeInfo) info.attributes.get (aname))
- == null) {
- // VC: Attribute Value Type
- error ("Attribute '" + aname
- + "' was not declared for element type " + qName);
- continue;
- }
-
- String value = atts.getValue (i);
-
- // note that "==" for type names and "#FIXED" is correct
- // (and fast) since we've interned those literals.
-
- if ("#FIXED" == ainfo.mode) {
- String expanded = expandDefaultRefs (ainfo.value);
-
- // VC: Fixed Attribute Default
- if (!value.equals (expanded)) {
- error ("Attribute '" + aname
- + "' must match " + expanded
- );
- continue;
- }
- }
-
- if ("CDATA" == ainfo.type)
- continue;
-
- //
- // For all other attribute types, there are various
- // rules to follow.
- //
-
- if ("ID" == ainfo.type) {
- // VC: ID (must be a name)
- if (isName (value, "ID attribute", aname)) {
- if (Boolean.TRUE == ids.get (value))
- // VC: ID (appears once)
- error ("ID attribute " + aname
- + " uses an ID value '" + value
- + "' which was already declared.");
- else
- // any forward refs are no longer problems
- ids.put (value, Boolean.TRUE);
- }
- continue;
- }
-
- if ("IDREF" == ainfo.type) {
- // VC: IDREF (value must be a name)
- if (isName (value, "IDREF attribute", aname)) {
- // VC: IDREF (must match some ID attribute)
- if (ids.get (value) == null)
- // new -- assume it's a forward ref
- ids.put (value, Boolean.FALSE);
- }
- continue;
- }
-
- if ("IDREFS" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: IDREF (one or more values)
- error ("IDREFS attribute " + aname
- + " must have at least one ID ref");
- } else do {
- String id = tokens.nextToken ();
-
- // VC: IDREF (value must be a name)
- if (isName (id, "IDREFS attribute", aname)) {
- // VC: IDREF (must match some ID attribute)
- if (ids.get (id) == null)
- // new -- assume it's a forward ref
- ids.put (id, Boolean.FALSE);
- }
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- if ("NMTOKEN" == ainfo.type) {
- // VC: Name Token (is a name token)
- isNmtoken (value, "NMTOKEN attribute", aname);
- continue;
- }
-
- if ("NMTOKENS" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: Name Token (one or more values)
- error ("NMTOKENS attribute " + aname
- + " must have at least one name token");
- } else do {
- String token = tokens.nextToken ();
-
- // VC: Name Token (is a name token)
- isNmtoken (token, "NMTOKENS attribute", aname);
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- if ("ENTITY" == ainfo.type) {
- if (!unparsed.contains (value))
- // VC: Entity Name
- error ("Value of attribute '" + aname
- + "' refers to unparsed entity '" + value
- + "' which was not declared.");
- continue;
- }
-
- if ("ENTITIES" == ainfo.type) {
- StringTokenizer tokens = new StringTokenizer (value, " ");
-
- if (!tokens.hasMoreTokens ()) {
- // VC: Entity Name (one or more values)
- error ("ENTITIES attribute " + aname
- + " must have at least one name token");
- } else do {
- String entity = tokens.nextToken ();
-
- if (!unparsed.contains (entity))
- // VC: Entity Name
- error ("Value of attribute '" + aname
- + "' refers to unparsed entity '" + entity
- + "' which was not declared.");
- } while (tokens.hasMoreTokens ());
- continue;
- }
-
- //
- // check for enumerations last; more expensive
- //
- if (ainfo.type.charAt (0) == '(' /*)*/
- || ainfo.type.startsWith ("NOTATION ")
- ) {
- // VC: Enumeration (value must be defined)
- checkEnumeration (value, ainfo.type, aname);
- continue;
- }
- }
-
- //
- // Last, check that all #REQUIRED attributes were provided
- //
- if (info != null) {
- Hashtable table = info.attributes;
-
- if (table.size () != 0) {
- Enumeration e = table.keys ();
-
- // XXX table.keys uses the heap, bleech -- slows things
-
- while (e.hasMoreElements ()) {
- aname = (String) e.nextElement ();
- ainfo = (AttributeInfo) table.get (aname);
-
- // "#REQUIRED" mode was interned in attributeDecl
- if ("#REQUIRED" == ainfo.mode
- && atts.getValue (aname) == null) {
- // VC: Required Attribute
- error ("Attribute '" + aname + "' must be specified "
- + "for element type " + qName);
- }
- }
- }
- }
- super.startElement (uri, localName, qName, atts);
- }
-
- /**
- * <b>ContentHandler</b> Reports a validity error if the element's content
- * model does not permit character data.
- * Passed to the next consumer.
- */
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- Recognizer state;
-
- if (contentStack.empty ())
- state = null;
- else
- state = (Recognizer) contentStack.peek ();
-
- // NOTE: if this ever supports with SAX parsers that don't
- // report ignorable whitespace as such (only XP?), this class
- // needs to morph it into ignorableWhitespace() as needed ...
-
- if (state != null && !state.acceptCharacters ())
- // VC: Element Valid (clauses three, four -- see recognizer)
- error ("Character content not allowed in element "
- + state.type.name);
-
- super.characters (ch, start, length);
- }
-
-
- /**
- * <b>ContentHandler</b> Reports a validity error if the element's content
- * model does not permit end-of-element yet, or a well formedness error
- * if there was no matching startElement call.
- * Passed to the next consumer.
- */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- try {
- Recognizer state = (Recognizer) contentStack.pop ();
-
- if (state != null && !state.completed ())
- // VC: Element valid (clauses two, three, four; see Recognizer)
- error ("Premature end for element '"
- + state.type.name
- + "', content model "
- + state.type.model);
-
- // could insist on match of start element, but that's
- // something the input stream must to guarantee.
-
- } catch (EmptyStackException e) {
- fatalError ("endElement without startElement: " + qName
- + ((uri == null)
- ? ""
- : ( " { '" + uri + "', " + localName + " }")));
- }
- super.endElement (uri, localName, qName);
- }
-
- /**
- * <b>ContentHandler</b> Checks whether all ID values that were
- * referenced have been declared, and releases all resources.
- * Passed to the next consumer.
- *
- * @see #setDocumentLocator
- */
- public void endDocument ()
- throws SAXException
- {
- for (Enumeration idNames = ids.keys ();
- idNames.hasMoreElements ();
- /* NOP */) {
- String id = (String) idNames.nextElement ();
-
- if (Boolean.FALSE == ids.get (id)) {
- // VC: IDREF (must match ID)
- error ("Undeclared ID value '" + id
- + "' was referred to by an IDREF/IDREFS attribute");
- }
- }
-
- resetState ();
- super.endDocument ();
- }
-
-
- /** Holds per-element declarations */
- static private final class ElementInfo
- {
- String name;
- String model;
-
- // key = attribute name; value = AttributeInfo
- Hashtable attributes = new Hashtable (11);
-
- ElementInfo (String n) { name = n; }
-
- private Recognizer recognizer;
-
- // for validating content models: one per type, shared,
- // and constructed only on demand ... so unused elements do
- // not need to consume resources.
- Recognizer getRecognizer (ValidationConsumer consumer)
- throws SAXException
- {
- if (recognizer == null) {
- if ("ANY".equals (model))
- recognizer = ANY;
- else if ("EMPTY".equals (model))
- recognizer = new EmptyRecognizer (this);
- else if ('#' == model.charAt (1))
- // n.b. this constructor does a validity check
- recognizer = new MixedRecognizer (this, consumer);
- else
- recognizer = new ChildrenRecognizer (this, consumer);
- }
- return recognizer;
- }
- }
-
- /** Holds per-attribute declarations */
- static private final class AttributeInfo
- {
- String type;
- String mode; // #REQUIRED, etc (or null)
- String value; // or null
- }
-
-
- //
- // Content model validation
- //
-
- static private final Recognizer ANY = new Recognizer (null);
-
-
- // Base class defines the calls used to validate content,
- // and supports the "ANY" content model
- static private class Recognizer
- {
- final ElementInfo type;
-
- Recognizer (ElementInfo t) { type = t; }
-
- // return true iff character data is legal here
- boolean acceptCharacters ()
- throws SAXException
- // VC: Element Valid (third and fourth clauses)
- { return true; }
-
- // null return = failure
- // otherwise, next state (like an FSM)
- // prerequisite: tested that name was declared
- Recognizer acceptElement (String name)
- throws SAXException
- // VC: Element Valid (fourth clause)
- { return this; }
-
- // return true iff model is completed, can finish
- boolean completed ()
- throws SAXException
- // VC: Element Valid (fourth clause)
- { return true; }
-
- public String toString ()
- // n.b. "children" is the interesting case!
- { return (type == null) ? "ANY" : type.model; }
- }
-
- // "EMPTY" content model -- no characters or elements
- private static final class EmptyRecognizer extends Recognizer
- {
- public EmptyRecognizer (ElementInfo type)
- { super (type); }
-
- // VC: Element Valid (first clause)
- boolean acceptCharacters ()
- { return false; }
-
- // VC: Element Valid (first clause)
- Recognizer acceptElement (String name)
- { return null; }
- }
-
- // "Mixed" content model -- ANY, but restricts elements
- private static final class MixedRecognizer extends Recognizer
- {
- private String permitted [];
-
- // N.B. constructor tests for duplicated element names (VC)
- public MixedRecognizer (ElementInfo t, ValidationConsumer v)
- throws SAXException
- {
- super (t);
-
- // (#PCDATA...)* or (#PCDATA) ==> ... or empty
- // with the "..." being "|elname|..."
- StringTokenizer tokens = new StringTokenizer (
- t.model.substring (8, t.model.lastIndexOf (')')),
- "|");
- Vector vec = new Vector ();
-
- while (tokens.hasMoreTokens ()) {
- String token = tokens.nextToken ();
-
- if (vec.contains (token))
- v.error ("element " + token
- + " is repeated in mixed content model: "
- + t.model);
- else
- vec.addElement (token.intern ());
- }
- permitted = new String [vec.size ()];
- for (int i = 0; i < permitted.length; i++)
- permitted [i] = (String) vec.elementAt (i);
-
- // in one large machine-derived DTD sample, most of about
- // 250 mixed content models were empty, and 25 had ten or
- // more entries. 2 had over a hundred elements. Linear
- // search isn't obviously wrong.
- }
-
- // VC: Element Valid (third clause)
- Recognizer acceptElement (String name)
- {
- int length = permitted.length;
-
- // first pass -- optimistic w.r.t. event source interning
- // (and document validity)
- for (int i = 0; i < length; i++)
- if (permitted [i] == name)
- return this;
- // second pass -- pessimistic w.r.t. event source interning
- for (int i = 0; i < length; i++)
- if (permitted [i].equals (name))
- return this;
- return null;
- }
- }
-
-
- // recognizer loop flags, see later
- private static final int F_LOOPHEAD = 0x01;
- private static final int F_LOOPNEXT = 0x02;
-
- // for debugging -- used to label/count nodes in toString()
- private static int nodeCount;
-
- /**
- * "Children" content model -- these are nodes in NDFA state graphs.
- * They work in fixed space. Note that these graphs commonly have
- * cycles, handling features such as zero-or-more and one-or-more.
- *
- * <p>It's readonly, so only one copy is ever needed. The content model
- * stack may have any number of pointers into each graph, when a model
- * happens to be needed more than once due to element nesting. Since
- * traversing the graph just moves to another node, and never changes
- * it, traversals never interfere with each other.
- *
- * <p>There is an option to report non-deterministic models. These are
- * always XML errors, but ones which are not often reported despite the
- * fact that they can lead to different validating parsers giving
- * different results for the same input. (The XML spec doesn't require
- * them to be reported.)
- *
- * <p><b>FIXME</b> There's currently at least one known bug here, in that
- * it's not actually detecting the non-determinism it tries to detect.
- * (Of the "optional.xml" test, the once-or-twice-2* tests are all non-D;
- * maybe some others.) This may relate to the issue flagged below as
- * "should not" happen (but it was), which showed up when patching the
- * graph to have one exit node (or more EMPTY nodes).
- */
- private static final class ChildrenRecognizer extends Recognizer
- implements Cloneable
- {
- // for reporting non-deterministic content models
- // ... a waste of space if we're not reporting those!
- // ... along with the 'model' member (in base class)
- private ValidationConsumer consumer;
-
- // for CHOICE nodes -- each component is an arc that
- // accepts a different NAME (or is EMPTY indicating
- // NDFA termination).
- private Recognizer components [];
-
- // for NAME/SEQUENCE nodes -- accepts that NAME and
- // then goes to the next node (CHOICE, NAME, EMPTY).
- private String name;
- private Recognizer next;
-
- // loops always point back to a CHOICE node. we mark such choice
- // nodes (F_LOOPHEAD) for diagnostics and faster deep cloning.
- // We also mark nodes before back pointers (F_LOOPNEXT), to ensure
- // termination when we patch sequences and loops.
- private int flags;
-
-
- // prevent a needless indirection between 'this' and 'node'
- private void copyIn (ChildrenRecognizer node)
- {
- // model & consumer are already set
- components = node.components;
- name = node.name;
- next = node.next;
- flags = node.flags;
- }
-
- // used to construct top level "children" content models,
- public ChildrenRecognizer (ElementInfo type, ValidationConsumer vc)
- {
- this (vc, type);
- populate (type.model.toCharArray (), 0);
- patchNext (new EmptyRecognizer (type), null);
- }
-
- // used internally; populating is separate
- private ChildrenRecognizer (ValidationConsumer vc, ElementInfo type)
- {
- super (type);
- consumer = vc;
- }
-
-
- //
- // When rewriting some graph nodes we need deep clones in one case;
- // mostly shallow clones (what the JVM handles for us) are fine.
- //
- private ChildrenRecognizer shallowClone ()
- {
- try {
- return (ChildrenRecognizer) clone ();
- } catch (CloneNotSupportedException e) {
- throw new Error ("clone");
- }
- }
-
- private ChildrenRecognizer deepClone ()
- {
- return deepClone (new Hashtable (37));
- }
-
- private ChildrenRecognizer deepClone (Hashtable table)
- {
- ChildrenRecognizer retval;
-
- if ((flags & F_LOOPHEAD) != 0) {
- retval = (ChildrenRecognizer) table.get (this);
- if (retval != null)
- return this;
-
- retval = shallowClone ();
- table.put (this, retval);
- } else
- retval = shallowClone ();
-
- if (next != null) {
- if (next instanceof ChildrenRecognizer)
- retval.next = ((ChildrenRecognizer)next)
- .deepClone (table);
- else if (!(next instanceof EmptyRecognizer))
- throw new RuntimeException ("deepClone");
- }
-
- if (components != null) {
- retval.components = new Recognizer [components.length];
- for (int i = 0; i < components.length; i++) {
- Recognizer temp = components [i];
-
- if (temp == null)
- retval.components [i] = null;
- else if (temp instanceof ChildrenRecognizer)
- retval.components [i] = ((ChildrenRecognizer)temp)
- .deepClone (table);
- else if (!(temp instanceof EmptyRecognizer))
- throw new RuntimeException ("deepClone");
- }
- }
-
- return retval;
- }
-
- // connect subgraphs, first to next (sequencing)
- private void patchNext (Recognizer theNext, Hashtable table)
- {
- // backpointers must not be repatched or followed
- if ((flags & F_LOOPNEXT) != 0)
- return;
-
- // XXX this table "shouldn't" be needed, right?
- // but some choice nodes looped if it isn't there.
- if (table != null && table.get (this) != null)
- return;
- if (table == null)
- table = new Hashtable ();
-
- // NAME/SEQUENCE
- if (name != null) {
- if (next == null)
- next = theNext;
- else if (next instanceof ChildrenRecognizer) {
- ((ChildrenRecognizer)next).patchNext (theNext, table);
- } else if (!(next instanceof EmptyRecognizer))
- throw new RuntimeException ("patchNext");
- return;
- }
-
- // CHOICE
- for (int i = 0; i < components.length; i++) {
- if (components [i] == null)
- components [i] = theNext;
- else if (components [i] instanceof ChildrenRecognizer) {
- ((ChildrenRecognizer)components [i])
- .patchNext (theNext, table);
- } else if (!(components [i] instanceof EmptyRecognizer))
- throw new RuntimeException ("patchNext");
- }
-
- if (table != null && (flags | F_LOOPHEAD) != 0)
- table.put (this, this);
- }
-
- /**
- * Parses a 'children' spec (or recursively 'cp') and makes this
- * become a regular graph node.
- *
- * @return index after this particle
- */
- private int populate (char parseBuf [], int startPos)
- {
- int nextPos = startPos + 1;
- char c;
-
- if (nextPos < 0 || nextPos >= parseBuf.length)
- throw new IndexOutOfBoundsException ();
-
- // Grammar of the string is from the XML spec, but
- // with whitespace removed by the SAX parser.
-
- // children ::= (choice | seq) ('?' | '*' | '+')?
- // cp ::= (Name | choice | seq) ('?' | '*' | '+')?
- // choice ::= '(' cp ('|' choice)* ')'
- // seq ::= '(' cp (',' choice)* ')'
-
- // interior nodes only
- // cp ::= name ...
- if (parseBuf [startPos] != '('/*)*/) {
- boolean done = false;
- do {
- switch (c = parseBuf [nextPos]) {
- case '?': case '*': case '+':
- case '|': case ',':
- case /*(*/ ')':
- done = true;
- continue;
- default:
- nextPos++;
- continue;
- }
- } while (!done);
- name = new String (parseBuf, startPos, nextPos - startPos);
-
- // interior OR toplevel nodes
- // cp ::= choice ..
- // cp ::= seq ..
- } else {
- // collect everything as a separate list, and merge it
- // into "this" later if we can (SEQUENCE or singleton)
- ChildrenRecognizer first;
-
- first = new ChildrenRecognizer (consumer, type);
- nextPos = first.populate (parseBuf, nextPos);
- c = parseBuf [nextPos++];
-
- if (c == ',' || c == '|') {
- ChildrenRecognizer current = first;
- char separator = c;
- Vector v = null;
-
- if (separator == '|') {
- v = new Vector ();
- v.addElement (first);
- }
-
- do {
- ChildrenRecognizer link;
-
- link = new ChildrenRecognizer (consumer, type);
- nextPos = link.populate (parseBuf, nextPos);
-
- if (separator == ',') {
- current.patchNext (link, null);
- current = link;
- } else
- v.addElement (link);
-
- c = parseBuf [nextPos++];
- } while (c == separator);
-
- // choice ... collect everything into one array.
- if (separator == '|') {
- // assert v.size() > 1
- components = new Recognizer [v.size ()];
- for (int i = 0; i < components.length; i++) {
- components [i] = (Recognizer)
- v.elementAt (i);
- }
- // assert flags == 0
-
- // sequence ... merge into "this" to be smaller.
- } else
- copyIn (first);
-
- // treat singletons like one-node sequences.
- } else
- copyIn (first);
-
- if (c != /*(*/ ')')
- throw new RuntimeException ("corrupt content model");
- }
-
- //
- // Arity is optional, and the root of all fun. We keep the
- // FSM state graph simple by only having NAME/SEQUENCE and
- // CHOICE nodes (or EMPTY to terminate a model), easily
- // evaluated. So we rewrite each node that has arity, using
- // those primitives. We create loops here, if needed.
- //
- if (nextPos < parseBuf.length) {
- c = parseBuf [nextPos];
- if (c == '?' || c == '*' || c == '+') {
- nextPos++;
-
- // Rewrite 'zero-or-one' "?" arity to a CHOICE:
- // - SEQUENCE (clone, what's next)
- // - or, what's next
- // Size cost: N --> N + 1
- if (c == '?') {
- Recognizer once = shallowClone ();
-
- components = new Recognizer [2];
- components [0] = once;
- // components [1] initted to null
- name = null;
- next = null;
- flags = 0;
-
-
- // Rewrite 'zero-or-more' "*" arity to a CHOICE.
- // - LOOP (clone, back to this CHOICE)
- // - or, what's next
- // Size cost: N --> N + 1
- } else if (c == '*') {
- ChildrenRecognizer loop = shallowClone ();
-
- loop.patchNext (this, null);
- loop.flags |= F_LOOPNEXT;
- flags = F_LOOPHEAD;
-
- components = new Recognizer [2];
- components [0] = loop;
- // components [1] initted to null
- name = null;
- next = null;
-
-
- // Rewrite 'one-or-more' "+" arity to a SEQUENCE.
- // Basically (a)+ --> ((a),(a)*).
- // - this
- // - CHOICE
- // * LOOP (clone, back to the CHOICE)
- // * or, whatever's next
- // Size cost: N --> 2N + 1
- } else if (c == '+') {
- ChildrenRecognizer loop = deepClone ();
- ChildrenRecognizer choice;
-
- choice = new ChildrenRecognizer (consumer, type);
- loop.patchNext (choice, null);
- loop.flags |= F_LOOPNEXT;
- choice.flags = F_LOOPHEAD;
-
- choice.components = new Recognizer [2];
- choice.components [0] = loop;
- // choice.components [1] initted to null
- // choice.name, choice.next initted to null
-
- patchNext (choice, null);
- }
- }
- }
-
- return nextPos;
- }
-
- // VC: Element Valid (second clause)
- boolean acceptCharacters ()
- { return false; }
-
- // VC: Element Valid (second clause)
- Recognizer acceptElement (String type)
- throws SAXException
- {
- // NAME/SEQUENCE
- if (name != null) {
- if (name.equals (type))
- return next;
- return null;
- }
-
- // CHOICE ... optionally reporting nondeterminism we
- // run across. we won't check out every transition
- // for nondeterminism; only the ones we follow.
- Recognizer retval = null;
-
- for (int i = 0; i < components.length; i++) {
- Recognizer temp = components [i].acceptElement (type);
-
- if (temp == null)
- continue;
- else if (!warnNonDeterministic)
- return temp;
- else if (retval == null)
- retval = temp;
- else if (retval != temp)
- consumer.error ("Content model " + this.type.model
- + " is non-deterministic for " + type);
- }
- return retval;
- }
-
- // VC: Element Valid (second clause)
- boolean completed ()
- throws SAXException
- {
- // expecting a specific element
- if (name != null)
- return false;
-
- // choice, some sequences
- for (int i = 0; i < components.length; i++) {
- if (components [i].completed ())
- return true;
- }
-
- return false;
- }
-
-/** /
- // FOR DEBUGGING ... flattens the graph for printing.
-
- public String toString ()
- {
- StringBuffer buf = new StringBuffer ();
-
- // only one set of loop labels can be generated
- // at a time...
- synchronized (ANY) {
- nodeCount = 0;
-
- toString (buf, new Hashtable ());
- return buf.toString ();
- }
- }
-
- private void toString (StringBuffer buf, Hashtable table)
- {
- // When we visit a node, label and count it.
- // Nodes are never visited/counted more than once.
- // For small models labels waste space, but if arity
- // mappings were used the savings are substantial.
- // (Plus, the output can be more readily understood.)
- String temp = (String) table.get (this);
-
- if (temp != null) {
- buf.append ('{');
- buf.append (temp);
- buf.append ('}');
- return;
- } else {
- StringBuffer scratch = new StringBuffer (15);
-
- if ((flags & F_LOOPHEAD) != 0)
- scratch.append ("loop");
- else
- scratch.append ("node");
- scratch.append ('-');
- scratch.append (++nodeCount);
- temp = scratch.toString ();
-
- table.put (this, temp);
- buf.append ('[');
- buf.append (temp);
- buf.append (']');
- buf.append (':');
- }
-
- // NAME/SEQUENCE
- if (name != null) {
- // n.b. some output encodings turn some name chars into '?'
- // e.g. with Japanese names and ASCII output
- buf.append (name);
- if (components != null) // bug!
- buf.append ('$');
- if (next == null)
- buf.append (",*");
- else if (next instanceof EmptyRecognizer) // patch-to-next
- buf.append (",{}");
- else if (next instanceof ChildrenRecognizer) {
- buf.append (',');
- ((ChildrenRecognizer)next).toString (buf, table);
- } else // bug!
- buf.append (",+");
- return;
- }
-
- // CHOICE
- buf.append ("<");
- for (int i = 0; i < components.length; i++) {
- if (i != 0)
- buf.append ("|");
- if (components [i] instanceof EmptyRecognizer) {
- buf.append ("{}");
- } else if (components [i] == null) { // patch-to-next
- buf.append ('*');
- } else {
- ChildrenRecognizer r;
-
- r = (ChildrenRecognizer) components [i];
- r.toString (buf, table);
- }
- }
- buf.append (">");
- }
-/**/
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/WellFormednessFilter.java b/external/jaxp/source/gnu/xml/pipeline/WellFormednessFilter.java
deleted file mode 100644
index c3c8ec129..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/WellFormednessFilter.java
+++ /dev/null
@@ -1,350 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.util.EmptyStackException;
-import java.util.Stack;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-
-
-/**
- * This filter reports fatal exceptions in the case of event streams that
- * are not well formed. The rules currently tested include: <ul>
- *
- * <li>setDocumentLocator ... may be called only before startDocument
- *
- * <li>startDocument/endDocument ... must be paired, and all other
- * calls (except setDocumentLocator) must be nested within these.
- *
- * <li>startElement/endElement ... must be correctly paired, and
- * may never appear within CDATA sections.
- *
- * <li>comment ... can't contain "--"
- *
- * <li>character data ... can't contain "]]&gt;"
- *
- * <li>whitespace ... can't contain CR
- *
- * <li>whitespace and character data must be within an element
- *
- * <li>processing instruction ... can't contain "?&gt;" or CR
- *
- * <li>startCDATA/endCDATA ... must be correctly paired.
- *
- * </ul>
- *
- * <p> Other checks for event stream correctness may be provided in
- * the future. For example, insisting that
- * entity boundaries nest correctly,
- * namespace scopes nest correctly,
- * namespace values never contain relative URIs,
- * attributes don't have "&lt;" characters;
- * and more.
- *
- * @author David Brownell
- */
-public final class WellFormednessFilter extends EventFilter
-{
- private boolean startedDoc;
- private Stack elementStack = new Stack ();
- private boolean startedCDATA;
- private String dtdState = "before";
-
-
- /**
- * Swallows all events after performing well formedness checks.
- */
- // constructor used by PipelineFactory
- public WellFormednessFilter ()
- { this (null); }
-
-
- /**
- * Passes events through to the specified consumer, after first
- * processing them.
- */
- // constructor used by PipelineFactory
- public WellFormednessFilter (EventConsumer consumer)
- {
- super (consumer);
-
- setContentHandler (this);
- setDTDHandler (this);
-
- try {
- setProperty (LEXICAL_HANDLER, this);
- } catch (SAXException e) { /* can't happen */ }
- }
-
- /**
- * Resets state as if any preceding event stream was well formed.
- * Particularly useful if it ended through some sort of error,
- * and the endDocument call wasn't made.
- */
- public void reset ()
- {
- startedDoc = false;
- startedCDATA = false;
- elementStack.removeAllElements ();
- }
-
-
- private SAXParseException getException (String message)
- {
- SAXParseException e;
- Locator locator = getDocumentLocator ();
-
- if (locator == null)
- return new SAXParseException (message, null, null, -1, -1);
- else
- return new SAXParseException (message, locator);
- }
-
- private void fatalError (String message)
- throws SAXException
- {
- SAXParseException e = getException (message);
- ErrorHandler handler = getErrorHandler ();
-
- if (handler != null)
- handler.fatalError (e);
- throw e;
- }
-
- /**
- * Throws an exception when called after startDocument.
- *
- * @param locator the locator, to be used in error reporting or relative
- * URI resolution.
- *
- * @exception IllegalStateException when called after the document
- * has already been started
- */
- public void setDocumentLocator (Locator locator)
- {
- if (startedDoc)
- throw new IllegalStateException (
- "setDocumentLocator called after startDocument");
- super.setDocumentLocator (locator);
- }
-
- public void startDocument () throws SAXException
- {
- if (startedDoc)
- fatalError ("startDocument called more than once");
- startedDoc = true;
- startedCDATA = false;
- elementStack.removeAllElements ();
- super.startDocument ();
- }
-
- public void startElement (
- String uri, String localName,
- String qName, Attributes atts
- ) throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("inside".equals (dtdState))
- fatalError ("element inside DTD?");
- else
- dtdState = "after";
- if (startedCDATA)
- fatalError ("element inside CDATA section");
- if (qName == null || "".equals (qName))
- fatalError ("startElement name missing");
- elementStack.push (qName);
- super.startElement (uri, localName, qName, atts);
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("element inside CDATA section");
- if (qName == null || "".equals (qName))
- fatalError ("endElement name missing");
-
- try {
- String top = (String) elementStack.pop ();
-
- if (!qName.equals (top))
- fatalError ("<" + top + " ...>...</" + qName + ">");
- // XXX could record/test namespace info
- } catch (EmptyStackException e) {
- fatalError ("endElement without startElement: </" + qName + ">");
- }
- super.endElement (uri, localName, qName);
- }
-
- public void endDocument () throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- dtdState = "before";
- startedDoc = false;
- super.endDocument ();
- }
-
-
- public void startDTD (String root, String publicId, String systemId)
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("before" != dtdState)
- fatalError ("two DTDs?");
- if (!elementStack.empty ())
- fatalError ("DTD must precede root element");
- dtdState = "inside";
- super.startDTD (root, publicId, systemId);
- }
-
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
-// FIXME: not all parsers will report startDTD() ...
-// we'd rather insist we're "inside".
- if ("after" == dtdState)
- fatalError ("not inside DTD");
- super.notationDecl (name, publicId, systemId);
- }
-
- public void unparsedEntityDecl (String name,
- String publicId, String systemId, String notationName)
- throws SAXException
- {
-// FIXME: not all parsers will report startDTD() ...
-// we'd rather insist we're "inside".
- if ("after" == dtdState)
- fatalError ("not inside DTD");
- super.unparsedEntityDecl (name, publicId, systemId, notationName);
- }
-
- // FIXME: add the four DeclHandler calls too
-
- public void endDTD ()
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if ("inside" != dtdState)
- fatalError ("DTD ends without start?");
- dtdState = "after";
- super.endDTD ();
- }
-
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- int here = start, end = start + length;
- if (elementStack.empty ())
- fatalError ("characters must be in an element");
- while (here < end) {
- if (ch [here++] != ']')
- continue;
- if (here == end) // potential problem ...
- continue;
- if (ch [here++] != ']')
- continue;
- if (here == end) // potential problem ...
- continue;
- if (ch [here++] == '>')
- fatalError ("character data can't contain \"]]>\"");
- }
- super.characters (ch, start, length);
- }
-
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- int here = start, end = start + length;
- if (elementStack.empty ())
- fatalError ("characters must be in an element");
- while (here < end) {
- if (ch [here++] == '\r')
- fatalError ("whitespace can't contain CR");
- }
- super.ignorableWhitespace (ch, start, length);
- }
-
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (data.indexOf ('\r') > 0)
- fatalError ("PIs can't contain CR");
- if (data.indexOf ("?>") > 0)
- fatalError ("PIs can't contain \"?>\"");
- }
-
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("comments can't nest in CDATA");
- int here = start, end = start + length;
- while (here < end) {
- if (ch [here] == '\r')
- fatalError ("comments can't contain CR");
- if (ch [here++] != '-')
- continue;
- if (here == end)
- fatalError ("comments can't end with \"--->\"");
- if (ch [here++] == '-')
- fatalError ("comments can't contain \"--\"");
- }
- super.comment (ch, start, length);
- }
-
- public void startCDATA ()
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (startedCDATA)
- fatalError ("CDATA starts can't nest");
- startedCDATA = true;
- super.startCDATA ();
- }
-
- public void endCDATA ()
- throws SAXException
- {
- if (!startedDoc)
- fatalError ("callback outside of document?");
- if (!startedCDATA)
- fatalError ("CDATA end without start?");
- startedCDATA = false;
- super.endCDATA ();
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/XIncludeFilter.java b/external/jaxp/source/gnu/xml/pipeline/XIncludeFilter.java
deleted file mode 100644
index a914f153e..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/XIncludeFilter.java
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- * Copyright (C) 2001-2002 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-import org.xml.sax.helpers.XMLReaderFactory;
-
-import gnu.xml.util.Resolver;
-
-
-
-/**
- * Filter to process an XPointer-free subset of
- * <a href="http://www.w3.org/TR/xinclude">XInclude</a>, supporting its
- * use as a kind of replacement for parsed general entities.
- * XInclude works much like the <code>#include</code> of C/C++ but
- * works for XML documents as well as unparsed text files.
- * Restrictions from the 17-Sept-2002 CR draft of XInclude are as follows:
- *
- * <ul>
- *
- * <li> URIs must not include fragment identifiers.
- * The CR specifies support for XPointer <em>element()</em> fragment IDs,
- * which is not currently implemented here.
- *
- * <li> <em>xi:fallback</em> handling of resource errors is not
- * currently supported.
- *
- * <li> DTDs are not supported in included files, since the SAX DTD events
- * must have completely preceded any included file.
- * The CR explicitly allows the DTD related portions of the infoset to
- * grow as an effect of including XML documents.
- *
- * <li> <em>xml:base</em> fixup isn't done.
- *
- * </ul>
- *
- * <p> XML documents that are included will normally be processed using
- * the default SAX namespace rules, meaning that prefix information may
- * be discarded. This may be changed with {@link #setSavingPrefixes
- * setSavingPrefixes()}. <em>You are strongly advised to do this.</em>
- *
- * <p> Note that XInclude allows highly incompatible implementations, which
- * are specialized to handle application-specific infoset extensions. Some
- * such implementations can be implemented by subclassing this one, but
- * they may only be substituted in applications at "user option".
- *
- * <p>TBD: "IURI" handling.
- *
- * @author David Brownell
- */
-public class XIncludeFilter extends EventFilter implements Locator
-{
- private Hashtable extEntities = new Hashtable (5, 5);
- private int ignoreCount;
- private Stack uris = new Stack ();
- private Locator locator;
- private Vector inclusions = new Vector (5, 5);
- private boolean savingPrefixes;
-
- /**
- */
- public XIncludeFilter (EventConsumer next)
- throws SAXException
- {
- super (next);
- setContentHandler (this);
- // DTDHandler callbacks pass straight through
- setProperty (DECL_HANDLER, this);
- setProperty (LEXICAL_HANDLER, this);
- }
-
- private void fatal (SAXParseException e) throws SAXException
- {
- ErrorHandler eh;
-
- eh = getErrorHandler ();
- if (eh != null)
- eh.fatalError (e);
- throw e;
- }
-
- /**
- * Passes "this" down the filter chain as a proxy locator.
- */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- super.setDocumentLocator (this);
- }
-
- /** Used for proxy locator; do not call directly. */
- public String getSystemId ()
- { return (locator == null) ? null : locator.getSystemId (); }
- /** Used for proxy locator; do not call directly. */
- public String getPublicId ()
- { return (locator == null) ? null : locator.getPublicId (); }
- /** Used for proxy locator; do not call directly. */
- public int getLineNumber ()
- { return (locator == null) ? -1 : locator.getLineNumber (); }
- /** Used for proxy locator; do not call directly. */
- public int getColumnNumber ()
- { return (locator == null) ? -1 : locator.getColumnNumber (); }
-
- /**
- * Assigns the flag controlling the setting of the SAX2
- * <em>namespace-prefixes</em> flag.
- */
- public void setSavingPrefixes (boolean flag)
- { savingPrefixes = flag; }
-
- /**
- * Returns the flag controlling the setting of the SAX2
- * <em>namespace-prefixes</em> flag when parsing included documents.
- * The default value is the SAX2 default (false), which discards
- * information that can be useful.
- */
- public boolean isSavingPrefixes ()
- { return savingPrefixes; }
-
- //
- // Two mechanisms are interacting here.
- //
- // - XML Base implies a stack of base URIs, updated both by
- // "real entity" boundaries and element boundaries.
- //
- // - Active "Real Entities" (for document and general entities,
- // and by xincluded files) are tracked to prevent circular
- // inclusions.
- //
- private String addMarker (String uri)
- throws SAXException
- {
- if (locator != null && locator.getSystemId () != null)
- uri = locator.getSystemId ();
-
- // guard against InputSource objects without system IDs
- if (uri == null)
- fatal (new SAXParseException ("Entity URI is unknown", locator));
-
- try {
- URL url = new URL (uri);
-
- uri = url.toString ();
- if (inclusions.contains (uri))
- fatal (new SAXParseException (
- "XInclude, circular inclusion", locator));
- inclusions.addElement (uri);
- uris.push (url);
- } catch (IOException e) {
- // guard against illegal relative URIs (Xerces)
- fatal (new SAXParseException ("parser bug: relative URI",
- locator, e));
- }
- return uri;
- }
-
- private void pop (String uri)
- {
- inclusions.removeElement (uri);
- uris.pop ();
- }
-
- //
- // Document entity boundaries get both treatments.
- //
- public void startDocument () throws SAXException
- {
- ignoreCount = 0;
- addMarker (null);
- super.startDocument ();
- }
-
- public void endDocument () throws SAXException
- {
- inclusions.setSize (0);
- extEntities.clear ();
- uris.setSize (0);
- super.endDocument ();
- }
-
- //
- // External general entity boundaries get both treatments.
- //
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (name.charAt (0) == '%')
- return;
- try {
- URL url = new URL (locator.getSystemId ());
- systemId = new URL (url, systemId).toString ();
- } catch (IOException e) {
- // what could we do?
- }
- extEntities.put (name, systemId);
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (ignoreCount != 0) {
- ignoreCount++;
- return;
- }
-
- String uri = (String) extEntities.get (name);
- if (uri != null)
- addMarker (uri);
- super.startEntity (name);
- }
-
- public void endEntity (String name)
- throws SAXException
- {
- if (ignoreCount != 0) {
- if (--ignoreCount != 0)
- return;
- }
-
- String uri = (String) extEntities.get (name);
-
- if (uri != null)
- pop (uri);
- super.endEntity (name);
- }
-
- //
- // element boundaries only affect the base URI stack,
- // unless they're XInclude elements.
- //
- public void
- startElement (String uri, String localName, String qName, Attributes atts)
- throws SAXException
- {
- if (ignoreCount != 0) {
- ignoreCount++;
- return;
- }
-
- URL baseURI = (URL) uris.peek ();
- String base;
-
- base = atts.getValue ("http://www.w3.org/XML/1998/namespace", "base");
- if (base == null)
- uris.push (baseURI);
- else {
- URL url;
-
- if (base.indexOf ('#') != -1)
- fatal (new SAXParseException (
- "xml:base with fragment: " + base,
- locator));
-
- try {
- baseURI = new URL (baseURI, base);
- uris.push (baseURI);
- } catch (Exception e) {
- fatal (new SAXParseException (
- "xml:base with illegal uri: " + base,
- locator, e));
- }
- }
-
- if (!"http://www.w3.org/2001/XInclude".equals (uri)) {
- super.startElement (uri, localName, qName, atts);
- return;
- }
-
- if ("include".equals (localName)) {
- String href = atts.getValue ("href");
- String parse = atts.getValue ("parse");
- String encoding = atts.getValue ("encoding");
- URL url = (URL) uris.peek ();
- SAXParseException x = null;
-
- if (href == null)
- fatal (new SAXParseException (
- "XInclude missing href",
- locator));
- if (href.indexOf ('#') != -1)
- fatal (new SAXParseException (
- "XInclude with fragment: " + href,
- locator));
-
- if (parse == null || "xml".equals (parse))
- x = xinclude (url, href);
- else if ("text".equals (parse))
- x = readText (url, href, encoding);
- else
- fatal (new SAXParseException (
- "unknown XInclude parsing mode: " + parse,
- locator));
- if (x == null) {
- // strip out all child content
- ignoreCount++;
- return;
- }
-
- // FIXME the 17-Sept-2002 CR of XInclude says we "must"
- // use xi:fallback elements to handle resource errors,
- // if they exist.
- fatal (x);
-
- } else if ("fallback".equals (localName)) {
- fatal (new SAXParseException (
- "illegal top level XInclude 'fallback' element",
- locator));
- } else {
- ErrorHandler eh = getErrorHandler ();
-
- // CR doesn't say this is an error
- if (eh != null)
- eh.warning (new SAXParseException (
- "unrecognized toplevel XInclude element: " + localName,
- locator));
- super.startElement (uri, localName, qName, atts);
- }
- }
-
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (ignoreCount != 0) {
- if (--ignoreCount != 0)
- return;
- }
-
- uris.pop ();
- if (!("http://www.w3.org/2001/XInclude".equals (uri)
- && "include".equals (localName)))
- super.endElement (uri, localName, qName);
- }
-
- //
- // ignore all content within non-empty xi:include elements
- //
- public void characters (char ch [], int start, int length)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.characters (ch, start, length);
- }
-
- public void processingInstruction (String target, String value)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.processingInstruction (target, value);
- }
-
- public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.ignorableWhitespace (ch, start, length);
- }
-
- public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.comment (ch, start, length);
- }
-
- public void startCDATA () throws SAXException
- {
- if (ignoreCount == 0)
- super.startCDATA ();
- }
-
- public void endCDATA () throws SAXException
- {
- if (ignoreCount == 0)
- super.endCDATA ();
- }
-
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (ignoreCount == 0)
- super.startPrefixMapping (prefix, uri);
- }
-
- public void endPrefixMapping (String prefix) throws SAXException
- {
- if (ignoreCount == 0)
- super.endPrefixMapping (prefix);
- }
-
- public void skippedEntity (String name) throws SAXException
- {
- if (ignoreCount == 0)
- super.skippedEntity (name);
- }
-
- // JDK 1.1 seems to need it to be done this way, sigh
- void setLocator (Locator l) { locator = l; }
- Locator getLocator () { return locator; }
-
-
- //
- // for XIncluded entities, manage the current locator and
- // filter out events that would be incorrect to report
- //
- private class Scrubber extends EventFilter
- {
- Scrubber (EventFilter f)
- throws SAXException
- {
- // delegation passes to next in chain
- super (f);
-
- // process all content events
- super.setContentHandler (this);
- super.setProperty (LEXICAL_HANDLER, this);
-
- // drop all DTD events
- super.setDTDHandler (null);
- super.setProperty (DECL_HANDLER, null);
- }
-
- // maintain proxy locator
- // only one startDocument()/endDocument() pair per event stream
- public void setDocumentLocator (Locator l)
- { setLocator (l); }
- public void startDocument ()
- { }
- public void endDocument ()
- { }
-
- private void reject (String message) throws SAXException
- { fatal (new SAXParseException (message, getLocator ())); }
-
- // only the DTD from the "base document" gets reported
- public void startDTD (String root, String publicId, String systemId)
- throws SAXException
- { reject ("XIncluded DTD: " + systemId); }
- public void endDTD ()
- throws SAXException
- { reject ("XIncluded DTD"); }
- // ... so this should never happen
- public void skippedEntity (String name) throws SAXException
- { reject ("XInclude skipped entity: " + name); }
-
- // since we rejected DTDs, only builtin entities can be reported
- }
-
- // <xi:include parse='xml' ...>
- // relative to the base URI passed
- private SAXParseException xinclude (URL url, String href)
- throws SAXException
- {
- XMLReader helper;
- Scrubber scrubber;
- Locator savedLocator = locator;
-
- // start with a parser acting just like our input
- // modulo DTD-ish stuff (validation flag, entity resolver)
- helper = XMLReaderFactory.createXMLReader ();
- helper.setErrorHandler (getErrorHandler ());
- helper.setFeature (FEATURE_URI + "namespace-prefixes", true);
-
- // Set up the proxy locator and event filter.
- scrubber = new Scrubber (this);
- locator = null;
- bind (helper, scrubber);
-
- // Merge the included document, except its DTD
- try {
- url = new URL (url, href);
- href = url.toString ();
-
- if (inclusions.contains (href))
- fatal (new SAXParseException (
- "XInclude, circular inclusion", locator));
-
- inclusions.addElement (href);
- uris.push (url);
- helper.parse (new InputSource (href));
- return null;
- } catch (java.io.IOException e) {
- return new SAXParseException (href, locator, e);
- } finally {
- pop (href);
- locator = savedLocator;
- }
- }
-
- // <xi:include parse='text' ...>
- // relative to the base URI passed
- private SAXParseException readText (URL url, String href, String encoding)
- throws SAXException
- {
- InputStream in = null;
-
- try {
- URLConnection conn;
- InputStreamReader reader;
- char buf [] = new char [4096];
- int count;
-
- url = new URL (url, href);
- conn = url.openConnection ();
- in = conn.getInputStream ();
- if (encoding == null)
- encoding = Resolver.getEncoding (conn.getContentType ());
- if (encoding == null) {
- ErrorHandler eh = getErrorHandler ();
- if (eh != null)
- eh.warning (new SAXParseException (
- "guessing text encoding for URL: " + url,
- locator));
- reader = new InputStreamReader (in);
- } else
- reader = new InputStreamReader (in, encoding);
-
- while ((count = reader.read (buf, 0, buf.length)) != -1)
- super.characters (buf, 0, count);
- in.close ();
- return null;
- } catch (IOException e) {
- return new SAXParseException (
- "can't XInclude text",
- locator, e);
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/XsltFilter.java b/external/jaxp/source/gnu/xml/pipeline/XsltFilter.java
deleted file mode 100644
index 3310d734e..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/XsltFilter.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.pipeline;
-
-import java.io.IOException;
-
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.sax.*;
-import javax.xml.transform.stream.StreamSource;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.ext.LexicalHandler;
-
-
-/**
- * Packages an XSLT transform as a pipeline component.
- * Note that all DTD events (callbacks to DeclHandler and DTDHandler
- * interfaces) are discarded, although XSLT transforms may be set up to
- * use the LexicalHandler to write DTDs with only an external subset.
- * Not every XSLT engine will necessarily be usable with this filter,
- * but current versions of
- * <a href="http://saxon.sourceforge.net">SAXON</a> and
- * <a href="http://xml.apache.org/xalan-j">Xalan</a> should work well.
- *
- * @see TransformerFactory
- *
- * @author David Brownell
- */
-final public class XsltFilter extends EventFilter
-{
- /**
- * Creates a filter that performs the specified transform.
- * Uses the JAXP 1.1 interfaces to access the default XSLT
- * engine configured for in the current execution context,
- * and parses the stylesheet without custom EntityResolver
- * or ErrorHandler support.
- *
- * @param stylesheet URI for the stylesheet specifying the
- * XSLT transform
- * @param next provides the ContentHandler and LexicalHandler
- * to receive XSLT output.
- * @exception SAXException if the stylesheet can't be parsed
- * @exception IOException if there are difficulties
- * bootstrapping the XSLT engine, such as it not supporting
- * SAX well enough to use this way.
- */
- public XsltFilter (String stylesheet, EventConsumer next)
- throws SAXException, IOException
- {
- // First, get a transformer with the stylesheet preloaded
- TransformerFactory tf = null;
- TransformerHandler th;
-
- try {
- SAXTransformerFactory stf;
-
- tf = TransformerFactory.newInstance ();
- if (!tf.getFeature (SAXTransformerFactory.FEATURE) // sax inputs
- || !tf.getFeature (SAXResult.FEATURE) // sax outputs
- || !tf.getFeature (StreamSource.FEATURE) // stylesheet
- )
- throw new IOException ("XSLT factory ("
- + tf.getClass ().getName ()
- + ") does not support SAX");
- stf = (SAXTransformerFactory) tf;
- th = stf.newTransformerHandler (new StreamSource (stylesheet));
- } catch (TransformerConfigurationException e) {
- throw new IOException ("XSLT factory ("
- + (tf == null
- ? "none available"
- : tf.getClass ().getName ())
- + ") configuration error, "
- + e.getMessage ()
- );
- }
-
- // Hook its outputs up to the pipeline ...
- SAXResult out = new SAXResult ();
-
- out.setHandler (next.getContentHandler ());
- try {
- LexicalHandler lh;
- lh = (LexicalHandler) next.getProperty (LEXICAL_HANDLER);
- out.setLexicalHandler (lh);
- } catch (Exception e) {
- // ignore
- }
- th.setResult (out);
-
- // ... and make sure its inputs look like ours.
- setContentHandler (th);
- setProperty (LEXICAL_HANDLER, th);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/pipeline/package.html b/external/jaxp/source/gnu/xml/pipeline/package.html
deleted file mode 100644
index 91ba3b927..000000000
--- a/external/jaxp/source/gnu/xml/pipeline/package.html
+++ /dev/null
@@ -1,257 +0,0 @@
-<html><head><title>
-blah
-<!--
-/*
- * Copyright (c) 1999-2001 by David Brownell. All Rights Reserved.
- *
- * $Id: package.html,v 1.2 2004-05-01 16:18:51 mark Exp $
- */
--->
-</title></head><body>
-
-<p>This package exposes a kind of XML processing pipeline, based on sending
-SAX events, which can be used as components of application architectures.
-Pipelines are used to convey streams of processing events from a producer
-to one or more consumers, and to let each consumer control the data seen by
-later consumers.
-
-<p> There is a <a href="PipelineFactory.html">PipelineFactory</a> class which
-accepts a syntax describing how to construct some simple pipelines. Strings
-describing such pipelines can be used in command line tools (see the
-<a href="../util/DoParse.html">DoParse</a> class)
-and in other places that it is
-useful to let processing be easily reconfigured. Pipelines can of course
-be constructed programmatically, providing access to options that the
-factory won't.
-
-<p> Web applications are supported by making it easy for servlets (or
-non-Java web application components) to be part of a pipeline. They can
-originate XML (or XHTML) data through an <em>InputSource</em> or in
-response to XML messages sent from clients using <em>CallFilter</em>
-pipeline stages. Such facilities are available using the simple syntax
-for pipeline construction.
-
-
-<h2> Programming Models </h2>
-
-<p> Pipelines should be simple to understand.
-
-<ul>
- <li> XML content, typically entire documents,
- is pushed through consumers by producers.
-
- <li> Pipelines are basically about consuming SAX2 callback events,
- where the events encapsulate XML infoset-level data.<ul>
-
- <li> Pipelines are constructed by taking one or more consumer
- stages and combining them to produce a composite consumer.
-
- <li> A pipeline is presumed to have pending tasks and state from
- the beginning of its ContentHandler.startDocument() callback until
- it's returned from its ContentHandler.doneDocument() callback.
-
- <li> Pipelines may have multiple output stages ("fan-out")
- or multiple input stages ("fan-in") when appropriate.
-
- <li> Pipelines may be long-lived, but need not be.
-
- </ul>
-
- <li> There is flexibility about event production. <ul>
-
- <li> SAX2 XMLReader objects are producers, which
- provide a high level "pull" model: documents (text or DOM) are parsed,
- and the parser pushes individual events through the pipeline.
-
- <li> Events can be pushed directly to event consumer components
- by application modules, if they invoke SAX2 callbacks directly.
- That is, application modules use the XML Infoset as exposed
- through SAX2 event callbacks.
-
- </ul>
-
- <li> Multiple producer threads may concurrently access a pipeline,
- if they coordinate appropriately.
-
- <li> Pipeline processing is not the only framework applications
- will use.
-
- </ul>
-
-
-<h3> Producers: XMLReader or Custom </h3>
-
-<p> Many producers will be SAX2 XMLReader objects, and
-will read (pull) data which is then written (pushed) as events.
-Typically these will parse XML text (acquired from
-<code>org.xml.sax.helpers.XMLReaderFactory</code>) or a DOM tree
-(using a <code><a href="../util/DomParser.html">DomParser</a></code>)
-These may be bound to event consumer using a convenience routine,
-<em><a href="EventFilter.html">EventFilter</a>.bind()</em>.
-Once bound, these producers may be given additional documents to
-sent through its pipeline.
-
-<p> In other cases, you will write producers yourself. For example, some
-data structures might know how to write themselves out using one or
-more XML models, expressed as sequences of SAX2 event callbacks.
-An application module might
-itself be a producer, issuing startDocument and endDocument events
-and then asking those data structures to write themselves out to a
-given EventConsumer, or walking data structures (such as JDBC query
-results) and applying its own conversion rules. WAP format XML
-(WBMXL) can be directly converted to producer output.
-
-<p> SAX2 introduced an "XMLFilter" interface, which is a kind of XMLReader.
-It is most useful in conjunction with its XMLFilterImpl helper class;
-see the <em><a href="EventFilter.html">EventFilter</a></em> javadoc
-for information contrasting that XMLFilterImpl approach with the
-relevant parts of this pipeline framework. Briefly, such XMLFilterImpl
-children can be either producers or consumers, and are more limited in
-configuration flexibility. In this framework, the focus of filters is
-on the EventConsumer side; see the section on
-<a href="#fitting">pipe fitting</a> below.
-
-
-<h3> Consume to Standard or Custom Data Representations </h3>
-
-<p> Many consumers will be used to create standard representations of XML
-data. The <a href="TextConsumer.html">TextConsumer</a> takes its events
-and writes them as text for a single XML document,
-using an internal <a href="../util/XMLWriter.html">XMLWriter</a>.
-The <a href="DomConsumer.html">DomConsumer</a> takes its events and uses
-them to create and populate a DOM Document.
-
-<p> In other cases, you will write consumers yourself. For example,
-you might use a particular unmarshaling filter to produce objects
-that fit your application's requirements, instead of using DOM.
-Such consumers work at the level of XML data models, rather than with
-specific representations such as XML text or a DOM tree. You could
-convert your output directly to WAP format data (WBXML).
-
-
-<h3><a name="fitting">Pipe Fitting</a></h3>
-
-<p> Pipelines are composite event consumers, with each stage having
-the opportunity to transform the data before delivering it to any
-subsequent stages.
-
-<p> The <a href="PipelineFactory.html">PipelineFactory</a> class
-provides access to much of this functionality through a simple syntax.
-See the table in that class's javadoc describing a number of standard
-components. Direct API calls are still needed for many of the most
-interesting pipeline configurations, including ones leveraging actual
-or logical concurrency.
-
-<p> Four basic types of pipe fitting are directly supported. These may
-be used to construct complex pipeline networks. <ul>
-
- <li> <a href="TeeConsumer.html">TeeConsumer</a> objects split event
- flow so it goes to two two different consumers, one before the other.
- This is a basic form of event fan-out; you can use this class to
- copy events to any number of output pipelines.
-
- <li> Clients can call remote components through HTTP or HTTPS using
- the <a href="CallFilter.html">CallFilter</a> component, and Servlets
- can implement such components by extending the
- <a href="XmlServlet.html">XmlServlet</a> component. Java is not
- required on either end, and transport protocols other than HTTP may
- also be used.
-
- <li> <a href="EventFilter.html">EventFilter</a> objects selectively
- provide handling for callbacks, and can pass unhandled ones to a
- subsequent stage. They are often subclassed, since much of the
- basic filtering machinery is already in place in the base class.
-
- <li> Applications can merge two event flows by just using the same
- consumer in each one. If multiple threads are in use, synchronization
- needs to be addressed by the appropriate application level policy.
-
- </ul>
-
-<p> Note that filters can be as complex as
-<a href="XsltFilter.html">XSLT transforms</a>
-available) on input data, or as simple as removing simple syntax data
-such as ignorable whitespace, comments, and CDATA delimiters.
-Some simple "built-in" filters are part of this package.
-
-
-<h3> Coding Conventions: Filter and Terminus Stages</h3>
-
-<p> If you follow these coding conventions, your classes may be used
-directly (give the full class name) in pipeline descriptions as understood
-by the PipelineFactory. There are four constructors the factory may
-try to use; in order of decreasing numbers of parameters, these are: <ul>
-
- <li> Filters that need a single String setup parameter should have
- a public constructor with two parameters: that string, then the
- EventConsumer holding the "next" consumer to get events.
-
- <li> Filters that don't need setup parameters should have a public
- constructor that accepts a single EventConsumer holding the "next"
- consumer to get events when they are done.
-
- <li> Terminus stages may have a public constructor taking a single
- paramter: the string value of that parameter.
-
- <li> Terminus stages may have a public no-parameters constructor.
-
- </ul>
-
-<p> Of course, classes may support more than one such usage convention;
-if they do, they can automatically be used in multiple modes. If you
-try to use a terminus class as a filter, and that terminus has a constructor
-with the appropriate number of arguments, it is automatically wrapped in
-a "tee" filter.
-
-
-<h2> Debugging Tip: "Tee" Joints can Snapshot Data</h2>
-
-<p> It can sometimes be hard to see what's happening, when something
-goes wrong. Easily fixed: just snapshot the data. Then you can find
-out where things start to go wrong.
-
-<p> If you're using pipeline descriptors so that they're easily
-administered, just stick a <em>write&nbsp;(&nbsp;filename&nbsp;)</em>
-filter into the pipeline at an appropriate point.
-
-<p> Inside your programs, you can do the same thing directly: perhaps
-by saving a Writer (perhaps a StringWriter) in a variable, using that
-to create a TextConsumer, and making that the first part of a tee --
-splicing that into your pipeline at a convenient location.
-
-<p> You can also use a DomConsumer to buffer the data, but remember
-that DOM doesn't save all the information that XML provides, so that DOM
-snapshots are relatively low fidelity. They also are substantially more
-expensive in terms of memory than a StringWriter holding similar data.
-
-<h2> Debugging Tip: Non-XML Producers</h2>
-
-<p> Producers in pipelines don't need to start from XML
-data structures, such as text in XML syntax (likely coming
-from some <em>XMLReader</em> that parses XML) or a
-DOM representation (perhaps with a
-<a href="../util/DomParser.html">DomParser</a>).
-
-<p> One common type of event producer will instead make
-direct calls to SAX event handlers returned from an
-<a href="EventConsumer.html">EventConsumer</a>.
-For example, making <em>ContentHandler.startElement</em>
-calls and matching <em>ContentHandler.endElement</em> calls.
-
-<p> Applications making such calls can catch certain
-common "syntax errors" by using a
-<a href="WellFormednessFilter.html">WellFormednessFilter</a>.
-That filter will detect (and report) erroneous input data
-such as mismatched document, element, or CDATA start/end calls.
-Use such a filter near the head of the pipeline that your
-producer feeds, at least while debugging, to help ensure that
-you're providing legal XML Infoset data.
-
-<p> You can also arrange to validate data on the fly.
-For DTD validation, you can configure a
-<a href="ValidationConsumer.html">ValidationConsumer</a>
-to work as a filter, using any DTD you choose.
-Other validation schemes can be handled with other
-validation filters.
-
-</body></html>
diff --git a/external/jaxp/source/gnu/xml/util/DoParse.java b/external/jaxp/source/gnu/xml/util/DoParse.java
deleted file mode 100644
index 821604d10..000000000
--- a/external/jaxp/source/gnu/xml/util/DoParse.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.util;
-
-import java.io.*;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.XMLReaderFactory;
-import org.xml.sax.ext.*;
-
-// import gnu.xml.pipeline.*;
-// Added imports directly to fix a GCJ problem.
-import gnu.xml.pipeline.CallFilter;
-import gnu.xml.pipeline.DomConsumer;
-import gnu.xml.pipeline.EventConsumer;
-import gnu.xml.pipeline.EventFilter;
-import gnu.xml.pipeline.LinkFilter;
-import gnu.xml.pipeline.NSFilter;
-import gnu.xml.pipeline.PipelineFactory;
-import gnu.xml.pipeline.TeeConsumer;
-import gnu.xml.pipeline.TextConsumer;
-import gnu.xml.pipeline.ValidationConsumer;
-import gnu.xml.pipeline.WellFormednessFilter;
-import gnu.xml.pipeline.XIncludeFilter;
-import gnu.xml.pipeline.XsltFilter;
-
-
-/**
- * This class provides a driver which may be invoked from the command line
- * to process a document using a SAX2 parser and a specified XML processing
- * pipeline.
- * This facilitates some common types of command line tools, such as parsing an
- * XML document in order test it for well formedness or validity.
- *
- * <p>The SAX2 XMLReaderFactory should return a SAX2 XML parser which
- * supports both of the standardized extension handlers (for declaration
- * and lexical events). That parser will be used to produce events.
- *
- * <p>The first parameter to the command gives the name of the document that
- * will be given to that processor. If it is a file name, it is converted
- * to a URL first.
- *
- * <p>The second parameter describes a simple processing pipeline, and will
- * be used as input to {@link gnu.xml.pipeline.PipelineFactory}
- * methods which identify the processing to be done. Examples of such a
- * pipeline include <pre>
- *
- * nsfix | validate <em>to validate the input document </em>
- * nsfix | write ( stdout ) <em>to echo the file as XML text</em>
- * dom | nsfix | write ( stdout ) <em>parse into DOM, print the result</em>
- * </pre>
- *
- * <p> Relatively complex pipelines can be described on the command line, but
- * not all interesting ones will require as little configuration as can be done
- * in that way. Put filters like "nsfix", perhaps followed by "validate",
- * at the front of the pipeline so they can be optimized out if a parser
- * supports those modes natively.
- *
- * <p> If the parsing is aborted for any reason, the JVM will exit with a
- * failure code. If a validating parse was done then both validation and
- * well formedness errors will cause a failure. A non-validating parse
- * will report failure on well formedness errors.
- *
- * @see gnu.xml.pipeline.PipelineFactory
- *
- * @author David Brownell
- */
-final public class DoParse
-{
- private DoParse () { /* no instances allowed */ }
-
- // first reported nonrecoverable error
- private static SAXParseException fatal;
-
- // error categories
- private static int errorCount;
- private static int fatalCount;
-
- /**
- * Command line invoker for this class; pass a filename or URL
- * as the first argument, and a pipeline description as the second.
- * Make sure to use filters to condition the input to stages that
- * require it; an <em>nsfix</em> filter will be a common requirement,
- * to restore syntax that SAX2 parsers delete by default. Some
- * conditioning filters may be eliminated by setting parser options.
- * (For example, "nsfix" can set the "namespace-prefixes" feature to
- * a non-default value of "true". In the same way, "validate" can set
- * the "validation" feature to "true".)
- */
- public static void main (String argv [])
- throws IOException
- {
- int exitStatus = 1;
-
- if (argv.length != 2) {
- System.err.println ("Usage: DoParse [filename|URL] pipeline-spec");
- System.err.println ("Example pipeline specs:");
- System.err.println (" 'nsfix | validate'");
- System.err.println (
- " ... restore namespace syntax, validate");
- System.err.println (" 'nsfix | write ( stdout )'");
- System.err.println (
- " ... restore namespace syntax, write to stdout as XML"
- );
- System.exit (1);
- }
-
- try {
- //
- // Get input source for specified document (or try ;-)
- //
- argv [0] = Resolver.getURL (argv [0]);
- InputSource input = new InputSource (argv [0]);
-
- //
- // Get the producer, using the system default parser (which
- // can be overridden for this particular invocation).
- //
- // And the pipeline, using commandline options.
- //
- XMLReader producer;
- EventConsumer consumer;
-
- producer = XMLReaderFactory.createXMLReader ();
-
- //
- // XXX pipeline factory now has a pre-tokenized input
- // method, use it ... that way at least some params
- // can be written using quotes (have spaces, ...)
- //
- consumer = PipelineFactory.createPipeline (argv [1]);
-
- //
- // XXX want commandline option for tweaking error handler.
- // Want to be able to present warnings.
- //
- producer.setErrorHandler (new MyErrorHandler ());
-
- // XXX need facility enabling resolving to local DTDs
-
- //
- // Parse. The pipeline may get optimized a bit, so we
- // can't always fail cleanly for validation without taking
- // a look at the filter stages.
- //
- EventFilter.bind (producer, consumer);
- producer.parse (input);
-
- try {
- if (producer.getFeature (
- "http://org.xml/sax/features/validation"))
- exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
- else if (fatalCount == 0)
- exitStatus = 0;
- } catch (SAXException e) {
- if (hasValidator (consumer))
- exitStatus = ((errorCount + fatalCount) > 0) ? 1 : 0;
- else if (fatalCount == 0)
- exitStatus = 0;
- }
-
- } catch (java.net.MalformedURLException e) {
- System.err.println ("** Malformed URL: " + e.getMessage ());
- System.err.println ("Is '" + argv [0] + "' a non-existent file?");
- e.printStackTrace ();
- // e.g. FNF
-
- } catch (SAXParseException e) {
- if (e != fatal) {
- System.err.print (printParseException ("Parsing Aborted", e));
- e.printStackTrace ();
- if (e.getException () != null) {
- System.err.println ("++ Wrapped exception:");
- e.getException ().printStackTrace ();
- }
- }
-
- } catch (SAXException e) {
- Exception x = e;
- if (e.getException () != null)
- x = e.getException ();
- x.printStackTrace ();
-
- } catch (Throwable t) {
- t.printStackTrace ();
- }
-
- System.exit (exitStatus);
- }
-
- // returns true if saw a validator (before end or unrecognized node)
- // false otherwise
- private static boolean hasValidator (EventConsumer e)
- {
- if (e == null)
- return false;
- if (e instanceof ValidationConsumer)
- return true;
- if (e instanceof TeeConsumer) {
- TeeConsumer t = (TeeConsumer) e;
- return hasValidator (t.getFirst ())
- || hasValidator (t.getRest ());
- }
- if (e instanceof WellFormednessFilter
- || e instanceof NSFilter
- )
- return hasValidator (((EventFilter)e).getNext ());
-
- // else ... gee, we can't know. Assume not.
-
- return false;
- }
-
- static class MyErrorHandler implements ErrorHandler
- {
- // dump validation errors, but continue
- public void error (SAXParseException e)
- throws SAXParseException
- {
- errorCount++;
- System.err.print (printParseException ("Error", e));
- }
-
- public void warning (SAXParseException e)
- throws SAXParseException
- {
- // System.err.print (printParseException ("Warning", e));
- }
-
- // try to continue fatal errors, in case a parser reports more
- public void fatalError (SAXParseException e)
- throws SAXParseException
- {
- fatalCount++;
- if (fatal == null)
- fatal = e;
- System.err.print (printParseException ("Nonrecoverable Error", e));
- }
- }
-
- static private String printParseException (
- String label,
- SAXParseException e
- ) {
- StringBuffer buf = new StringBuffer ();
- int temp;
-
- buf.append ("** ");
- buf.append (label);
- buf.append (": ");
- buf.append (e.getMessage ());
- buf.append ('\n');
- if (e.getSystemId () != null) {
- buf.append (" URI: ");
- buf.append (e.getSystemId ());
- buf.append ('\n');
- }
- if ((temp = e.getLineNumber ()) != -1) {
- buf.append (" line: ");
- buf.append (temp);
- buf.append ('\n');
- }
- if ((temp = e.getColumnNumber ()) != -1) {
- buf.append (" char: ");
- buf.append (temp);
- buf.append ('\n');
- }
-
- return buf.toString ();
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/DomParser.java b/external/jaxp/source/gnu/xml/util/DomParser.java
deleted file mode 100644
index e240336bf..000000000
--- a/external/jaxp/source/gnu/xml/util/DomParser.java
+++ /dev/null
@@ -1,793 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.util;
-
-import java.util.Enumeration;
-import java.util.Locale;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.AttributesImpl;
-import org.xml.sax.helpers.NamespaceSupport;
-import org.xml.sax.ext.DeclHandler;
-import org.xml.sax.ext.DefaultHandler2;
-import org.xml.sax.ext.LexicalHandler;
-
-import org.w3c.dom.*;
-
-
-/**
- * This parser emits SAX2 parsing events as it traverses a DOM tree, using
- * any conformant implementation of DOM. It exposes all SAX1 features,
- * and the following SAX2 features and properties (as
- * identified by standard URIs which are not fully provided here). Note
- * that if a Level 1 DOM implementation is given, then this behaves as if
- * namespaces were disabled, and namespace prefixes were enabled. </p>
- *
- * <table border="1" width='100%' cellpadding='3' cellspacing='0'>
- * <tr bgcolor='#ccccff'>
- * <th><font size='+1'>Name</font></th>
- * <th><font size='+1'>Notes</font></th></tr>
- *
- * <tr><td colspan=2><center><em>Features ... URL prefix is
- * <b>http://xml.org/sax/features/</b></em></center></td></tr>
- *
- * <tr><td>(URL)/external-general-entities</td>
- * <td>false (does no parsing)</td></tr>
- * <tr><td>(URL)/external-parameter-entities</td>
- * <td>false (does no parsing)</td></tr>
- * <tr><td>(URL)/namespaces</td>
- * <td>Value is fixed at <em>true</em></td></tr>
- * <tr><td>(URL)/namespace-prefixes</td>
- * <td>Value is settable, defaulting to <em>false</em>
- * (<code>xmlns</code> attributes hidden, and names aren't prefixed)
- * </td></tr>
- * <tr><td>(URL)/string-interning</td>
- * <td>Value is fixed at <em>false</em> (DOM provides no
- * guarantees as to interning)</td></tr>
- * <tr><td>(URL)/validation</td>
- * <td>false (does no parsing)</td></tr>
- * <tr><td>(URL)/lexical-handler/parameter-entities</td>
- * <td>false (DOM doesn't do parameter entities)</td></tr>
- *
- * <tr><td colspan=2><center><em>Properties ... URL prefix is
- * <b>http://xml.org/sax/properties/</b></em></center></td></tr>
- *
- *
- * <tr><td>(URL)/dom-node</td>
- * <td>This property may be set before parsing to hold a DOM
- * <em>Document</em> node; any arguments given to <em>parse</em>
- * methods are ignored. When retrieved
- * during a parse, this value contains the "current" DOM node.
- * </td></tr>
- * <tr><td>(URL)/declaration-handler</td>
- * <td>A declaration handler may be provided. Declaration of external
- * general entities is exposed, but not parameter entities; none of the
- * entity names reported here will begin with "%". </td></tr>
- * <tr><td>(URL)/lexical-handler</td>
- * <td>A lexical handler may be provided. While the start and end of
- * any external subset are reported, expansion of other parameter
- * entities (e.g. inside attribute list declarations) is not exposed.
- * Expansion of general entities within attributes is also not exposed
- * (see below).</td></tr>
- * </table>
- *
- * <P> The consequences of modifying a DOM document tree as it is being walked
- * by this "parser" are unspecified; don't do it! </P>
- *
- * @author David Brownell
- */
-final public class DomParser implements XMLReader
-{
- // Stuff used internally to route events correctly
- private DefaultHandler2 defaultHandler = new DefaultHandler2 ();
-
- // per-parse SAX stuff
- private ContentHandler contentHandler = defaultHandler;
- private DTDHandler dtdHandler = defaultHandler;
- private DeclHandler declHandler = defaultHandler;
- private LexicalHandler lexicalHandler = defaultHandler;
-
- // shared context
- private ErrorHandler errHandler = defaultHandler;
- private EntityResolver resolver = defaultHandler;
- private Locale locale = Locale.getDefault ();
-
- // parser state
- private Node start;
- private Node current;
- private boolean isL2;
- private boolean showNamespaces = true;
- private boolean showXML1_0 = false;
- private NamespaceSupport prefixStack = new NamespaceSupport ();
- private boolean isDocument;
-
-
- /**
- * Constructs an unitialized <b>SAX2</b> parser.
- */
- public DomParser () {
- }
-
- /**
- * Constructs an <b>SAX2</b> parser initialized to traverse the specified
- * DOM tree. If the node is a document, the startDocument() and
- * endDocument() calls bracket the calls exposing children.
- */
- public DomParser (Node node) {
- setStart (node);
- }
-
-
- // stuff that most components in an application should be sharing:
- // resolver and error locale.
-
- /**
- * <b>SAX2</b>: Returns the object used when resolving external
- * entities during parsing (both general and parameter entities).
- */
- public EntityResolver getEntityResolver ()
- {
- return resolver;
- }
-
- /**
- * <b>SAX1</b>: Provides an object which may be used when resolving external
- * entities during parsing (both general and parameter entities).
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- if (resolver == null)
- resolver = defaultHandler;
- this.resolver = resolver;
- }
-
- /**
- * <b>SAX1</b>: Identifies the locale which the parser should use for the
- * diagnostics it provides.
- *
- * @exception SAXException as defined in the specification for
- * <em>org.xml.sax.Parser.setLocale()</em>
- */
- public void setLocale (Locale locale)
- throws SAXException
- {
- if (locale == null)
- locale = Locale.getDefault ();
- this.locale = locale;
- }
-
-
- // different modules will tend to handle error handling the same,
- // but it may not be the same through the whole app
-
- /**
- * <b>SAX2</b>: Returns the object used to receive callbacks for XML
- * errors of all levels (fatal, nonfatal, warning).
- */
- public ErrorHandler getErrorHandler ()
- {
- return errHandler;
- }
-
- /**
- * <b>SAX1</b>: Provides an object which receives callbacks for XML errors
- * of all levels (fatal, nonfatal, warning).
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- if (handler == null)
- handler = defaultHandler;
- errHandler = handler;
- }
-
-
- // stuff different parts of a module will handle differently
-
- /**
- * <b>SAX2</b>: Returns the object used to report the logical
- * content of an XML document.
- */
- public ContentHandler getContentHandler ()
- {
- return contentHandler;
- }
-
- /**
- * <b>SAX2</b>: Assigns the object used to report the logical
- * content of an XML document.
- */
- public void setContentHandler (ContentHandler handler)
- {
- if (handler == null)
- handler = defaultHandler;
- contentHandler = handler;
- }
-
- /**
- * <b>SAX2</b>: Returns the object used to process declarations related
- * to notations and unparsed entities.
- */
- public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
- /**
- * <b>SAX1</b>: Provides an object which may be used to intercept
- * declarations related to notations and unparsed entities.
- */
- public void setDTDHandler (DTDHandler handler)
- {
- if (handler == null)
- handler = defaultHandler;
- dtdHandler = handler;
- }
-
-
- /**
- * <b>SAX1</b>: Parses the previously provided DOM document (the
- * input parameter is ignored). When this returns, that same
- * document may be parsed again without needing a "reset".
- *
- * @param uri ignored (pass an empty string)
- * @exception SAXException as defined in the specification for
- * <em>org.xml.sax.Parser.parse()</em>
- */
- public void parse (String uri) throws SAXException
- {
- parse ();
- }
-
- /**
- * <b>SAX1</b>: Parses the previously provided DOM document (the
- * input parameter is ignored). When this returns, that same
- * document may be parsed again without needing a "reset".
- *
- * @param input ignored
- * @exception SAXException as defined in the specification for
- * <em>org.xml.sax.Parser.parse()</em>
- */
- public void parse (InputSource input) throws SAXException
- {
- parse ();
- }
-
- private void parse () throws SAXException
- {
- try {
- walk ();
- } finally {
- if (isDocument)
- contentHandler.endDocument ();
- current = null;
- prefixStack.reset ();
- }
- }
-
- private boolean getIsL2 (Node node)
- {
- DOMImplementation impl;
- Document doc;
-
- if (node instanceof Document)
- doc = (Document) node;
- else
- doc = node.getOwnerDocument ();
- if (doc == null)
- throw new RuntimeException ("? unowned node - L2 DTD ?");
- impl = doc.getImplementation ();
- return impl.hasFeature ("XML", "2.0");
- }
-
-
- private static final String FEATURES = "http://xml.org/sax/features/";
- private static final String HANDLERS = "http://xml.org/sax/properties/";
-
- /**
- * <b>SAX2</b>: Tells whether this parser supports the specified feature.
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- // basically, none are relevant -- they relate more to
- // parsing than to walking a "parse tree".
-
- // FIXME: DOM feature to expose interning?
-
- if ((FEATURES + "validation").equals (name)
- || (FEATURES + "external-general-entities")
- .equals (name)
- || (FEATURES + "external-parameter-entities")
- .equals (name)
- || (FEATURES + "string-interning").equals (name)
- )
- return false;
-
- if ((FEATURES + "namespaces").equals (name))
- return showNamespaces;
- if ((FEATURES + "namespace-prefixes").equals (name))
- return showXML1_0;
-
- throw new SAXNotRecognizedException (name);
- }
-
- /**
- * <b>SAX2</b>: Returns the specified property. At this time only
- * the declaration and lexical handlers, and current the "DOM" node,
- * are supported.
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if ((HANDLERS + "declaration-handler").equals (name))
- return declHandler == defaultHandler ? null : declHandler;
- if ((HANDLERS + "lexical-handler").equals (name))
- return lexicalHandler == defaultHandler ? null : lexicalHandler;
-
- if ((HANDLERS + "dom-node").equals (name))
- return current;
-
- // unknown properties
- throw new SAXNotRecognizedException (name);
- }
-
- /**
- * <b>SAX2</b>: Sets the state of features supported in this parser.
- * Only the namespace support features are mutable.
- */
- public void setFeature (String name, boolean state)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (current != null)
- throw new IllegalStateException ("feature change midparse");
-
- boolean value = getFeature (name);
-
- if (value == state)
- return;
-
- if ((FEATURES + "namespaces").equals (name)) {
- if (!showXML1_0 && state == false)
- throw new SAXNotSupportedException ("Illegal namespace "
- + "processing configuration");
- showNamespaces = state;
- return;
- }
- if ((FEATURES + "namespace-prefixes").equals (name)) {
- if (!showNamespaces && state == false)
- throw new SAXNotSupportedException ("Illegal namespace "
- + "processing configuration");
- showXML1_0 = state;
- return;
- }
-
- throw new SAXNotSupportedException (name);
- }
-
- /**
- * <b>SAX2</b>: Assigns the specified property. At this time only
- * declaration and lexical handlers, and the initial DOM document, are
- * supported. These must not be changed to values of the wrong type.
- * Like SAX1 handlers, these handlers may be changed at any time.
- * Like SAX1 input source or document URI, the initial DOM document
- * may not be changed during a parse.
- */
- public void setProperty (String name, Object state)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if ((HANDLERS + "declaration-handler").equals (name)) {
- if (!(state instanceof DeclHandler || state == null))
- throw new SAXNotSupportedException (name);
- declHandler = (DeclHandler) state;
- return;
- }
-
- if ((HANDLERS + "lexical-handler").equals (name)) {
- if (!(state instanceof LexicalHandler || state == null))
- throw new SAXNotSupportedException (name);
- lexicalHandler = (LexicalHandler) state;
- return;
- }
-
- if ((HANDLERS + "dom-node").equals (name)) {
- if (state == null || state instanceof Node) {
- if (current != null)
- throw new SAXNotSupportedException (
- "property is readonly during parse: " + name);
- setStart ((Node) state);
- return;
- }
- throw new SAXNotSupportedException ("not a DOM Node");
- }
-
- // unknown properties
- throw new SAXNotRecognizedException (name);
- }
-
- private void setStart (Node property)
- {
- start = property;
- if (start != null) {
- isL2 = getIsL2 (start);
- isDocument = (start instanceof Document);
- }
- }
-
- //
- // Non-recursive walk, using DOM state when backtracking is needed
- //
- private void walk ()
- throws SAXException
- {
- int type;
- NamedNodeMap nodes;
- int length;
- AttributesImpl attrs = new AttributesImpl ();
- char chars [];
- String ns, local;
-
- synchronized (this) {
- if (current != null)
- throw new IllegalStateException ("already walking tree");
-
- // JVM guarantees assignments are atomic; so no other
- // thread could get this far till this walk's done.
- current = start;
- }
-
- for (;;) {
- type = current.getNodeType ();
-
- //
- // First, visit the current node, including any "start" calls
- //
- switch (type) {
-
- case Node.DOCUMENT_NODE:
- contentHandler.startDocument ();
- break;
-
- case Node.ELEMENT_NODE:
- nodes = current.getAttributes ();
- length = nodes.getLength ();
- prefixStack.pushContext ();
- for (int i = 0; i < length; i++) {
- Attr attr = (Attr) nodes.item (i);
- String name = attr.getNodeName ();
-
- if (showNamespaces && name.startsWith ("xmlns")) {
- String prefix;
- String uri;
-
- // NOTE: DOM L2 (CR2+ and REC) violate the
- // Namespaces REC, treat "xmlns" like a strange
- // attribute instead of a magic token
- if ("xmlns".equals (name))
- prefix = "";
- else
- prefix = name.substring (6);
- uri = attr.getNodeValue ();
-
- prefixStack.declarePrefix (prefix, uri);
- contentHandler.startPrefixMapping (prefix, uri);
-
- if (!showXML1_0)
- continue;
- }
-
- //
- // NOTE: DOM doesn't record the attribute type info
- // which SAX exposes; so this always reports CDATA.
- //
- // NOTE: SAX doesn't expose the isSpecified info which
- // DOM exposes; that's discarded here. Similarly with
- // the information DOM hides inside itself about what
- // the default values for an attribute are.
- //
- if (showNamespaces) {
- if (isL2) {
- if ((ns = attr.getNamespaceURI ()) == null)
- ns = "";
- // Note: SAX2 and DOM handle "local" names
- // differently
- if ((local = attr.getLocalName ()) == null)
- local = name;
- } else {
-// XXX
- throw new RuntimeException (
- "NYI, ns lookup when parsing L1 DOM");
- }
- } else
- ns = local = "";
- attrs.addAttribute (ns, local, name,
- "CDATA", attr.getNodeValue ());
- }
- if (showNamespaces) {
- if (isL2) {
- if ((ns = current.getNamespaceURI ()) == null)
- ns = "";
- // Note: SAX2 and DOM handle "local" names differently
- if ((local = current.getLocalName ()) == null)
- local = current.getNodeName ();
- } else {
-// XXX
- throw new RuntimeException (
- "NYI, ns lookup when parsing L1 DOM");
- }
- } else
- ns = local = "";
- contentHandler.startElement (ns, local,
- current.getNodeName (), attrs);
- if (length != 0)
- attrs.clear ();
- break;
-
- case Node.CDATA_SECTION_NODE:
- lexicalHandler.startCDATA ();
- chars = current.getNodeValue ().toCharArray ();
- contentHandler.characters (chars, 0, chars.length);
- lexicalHandler.endCDATA ();
- break;
-
- case Node.COMMENT_NODE:
- chars = current.getNodeValue ().toCharArray ();
- lexicalHandler.comment (chars, 0, chars.length);
- break;
-
- case Node.DOCUMENT_TYPE_NODE:
- {
- DocumentType doctype = (DocumentType) current;
-
- //
- // Only DOM L2 supports recreating even some DTDs in full.
- //
- if (isL2) {
- lexicalHandler.startDTD (doctype.getName (),
- doctype.getPublicId (),
- doctype.getSystemId ());
- } else
- lexicalHandler.startDTD (doctype.getName (),
- null, null);
-
- //
- // The only sure way to recreate is to provide both the
- // internal and external subsets. Otherwise, only part
- // of the job can be done ... because from the DTD, DOM
- // discards both the critical data, like the attribute and
- // element declarations, as well as the PIs and comments
- // that are used to hold their documentation.
- //
- // Even the entity and notation declarations that it can
- // expose can't be recorded without proprietary extensions.
- //
- // We construct a comment to tell what we know about how
- // (in)complete this particular really DTD is.
- //
- {
- String message;
- char buf [];
-
- //
- // Though DOM L2 lets the whole doctype be recreated,
- // SAX2 can't represent it (input or output).
- // So this will be the typical case.
- //
- if (isL2 && doctype.getInternalSubset () != null)
- message =
- " Full DTD known; can't be shown using SAX2. ";
-
- //
- // Otherwise, we'll concoct a partial DTD. If there's
- // any more data here at all, it was provided using a
- // (proprietary) extension to DOM.
- //
- else
- message =
- " This DTD was was recreated using incomplete DOM L2 records. ";
-
- buf = message.toCharArray ();
- lexicalHandler.comment (buf, 0, buf.length);
- }
-
- // report notations first
- nodes = doctype.getNotations ();
- length = nodes.getLength ();
- for (int i = 0; i < length; i++) {
- Notation notation = (Notation) nodes.item (i);
- dtdHandler.notationDecl (
- notation.getNodeName (),
- notation.getPublicId (),
- notation.getSystemId ());
- }
-
- // then parsed and unparsed external general entities
- nodes = doctype.getEntities ();
- length = nodes.getLength ();
- for (int i = 0; i < length; i++) {
- Entity entity = (Entity) nodes.item (i);
- String notation = entity.getNotationName ();
-
- if (notation != null)
- dtdHandler.unparsedEntityDecl (
- entity.getNodeName (),
- entity.getPublicId (),
- entity.getSystemId (),
- notation);
- else if (entity.getSystemId () != null)
- declHandler.externalEntityDecl (
- entity.getNodeName (),
- entity.getPublicId (),
- entity.getSystemId ());
-
- //
- // NOTE: DOM doesn't clearly provide internal
- // entity support; but in case someone tries to
- // fudge such support, we defend ourselves above.
- //
- // NOTE: DOM doesn't expose parameter entities
- // (thank you thank you thank you thank you)
- //
- }
-
- //
- // NOTE: DOM (levels 1 and 2) doesn't expose real
- // typing information (element or attribute decls),
- // as exposed by SAX2 declaration handlers.
- //
- lexicalHandler.endDTD ();
- }
- break;
-
- case Node.ENTITY_REFERENCE_NODE:
- // this isn't done except (a) in content, and
- // (b) not within a start tag (att value)
- lexicalHandler.startEntity (current.getNodeName ());
- break;
-
- case Node.PROCESSING_INSTRUCTION_NODE:
- contentHandler.processingInstruction (
- current.getNodeName (), current.getNodeValue ());
- break;
-
- case Node.TEXT_NODE:
- chars = current.getNodeValue ().toCharArray ();
- contentHandler.characters (chars, 0, chars.length);
- break;
-
- default:
- // e.g. fragments, entities, notations, attributes
- throw new SAXException ("Illegal DOM Node type in Document: "
- + current.getNodeType ());
- }
-
- //
- // Then, pick the next node to visit. If the next node isn't
- // a child, an "end" call may be needed before moving on.
- // If there's no next node, we're done.
- //
- Node next;
-
- switch (type) {
- case Node.DOCUMENT_NODE:
- case Node.ELEMENT_NODE:
- case Node.ENTITY_REFERENCE_NODE:
- //
- // For elements that can have children, visit those
- // children before any siblings (i.e. depth first)
- // and after visiting this node (i.e. preorder)
- //
- next = current.getFirstChild ();
- if (next != null) {
- current = next;
- break;
- }
- //
- // Else treat this like other childless nodes, but
- // handle this node's "end" immediately.
- //
- callEnd (current);
-
- // FALLTHROUGH
-
- case Node.CDATA_SECTION_NODE:
- case Node.COMMENT_NODE:
- case Node.DOCUMENT_TYPE_NODE:
- case Node.ENTITY_NODE:
- case Node.PROCESSING_INSTRUCTION_NODE:
- case Node.TEXT_NODE:
- //
- // Use next sibling, if there is one.
- // Else, climb up a level (calling "end")
- // until we find an ancestral sibling
- // or until we we climb off the top (FINISH)
- //
- for (;;) {
- if ((next = current.getNextSibling ()) != null)
- break;
- current = current.getParentNode ();
- if (current == null || current == start)
- return;
- callEnd (current);
- }
- current = next;
- break;
-
- default:
- throw new SAXException (
- "Illegal DOM Node type found: " + current.getNodeType ());
- }
- }
- }
-
- private void callEnd (Node node) throws SAXException
- {
- switch (node.getNodeType ()) {
- // only these three container types may ever be found
- // directly inside a Document.
- case Node.DOCUMENT_NODE:
- // for SAX conformance, endDocument must always
- // be called ... it's done in a "finally" clause)
- return;
-
- case Node.ELEMENT_NODE:
- if (showNamespaces) {
- if (isL2)
- contentHandler.endElement (
- node.getNamespaceURI (),
- node.getLocalName (),
- node.getNodeName ());
- else
-// XXX
- throw new RuntimeException (
- "NYI, ns lookup when parsing L1 DOM");
- for (Enumeration e = prefixStack.getDeclaredPrefixes ();
- e.hasMoreElements ();
- ) {
- contentHandler.endPrefixMapping ((String) e.nextElement ());
- }
- } else
- contentHandler.endElement ("", "", node.getNodeName ());
- prefixStack.popContext ();
- return;
-
- case Node.ENTITY_REFERENCE_NODE:
- // see above -- in content, outside start tags.
- lexicalHandler.endEntity (node.getNodeName ());
- return;
-
- // these can be given at the top level
- case Node.DOCUMENT_FRAGMENT_NODE:
- case Node.ATTRIBUTE_NODE:
- return;
-
- default:
- throw new SAXException (
- "Illegal DOM container type found: "
- + current.getNodeType ());
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/Resolver.java b/external/jaxp/source/gnu/xml/util/Resolver.java
deleted file mode 100644
index 4433e600e..000000000
--- a/external/jaxp/source/gnu/xml/util/Resolver.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.util;
-
-import java.io.*;
-
-import java.util.Dictionary;
-import java.util.Hashtable;
-
-import org.xml.sax.*;
-
-
-/**
- * Utility implementation of a SAX resolver, which can be used to improve
- * network utilization of SAX based XML components. It does this by
- * supporting local caches of external entities.
- * SAX parsers <em>should</em> use such local caches when possible.
- *
- * @see XCat
- */
-public class Resolver implements EntityResolver, Cloneable
-{
- /**
- * Updates a dictionary used to map PUBLIC identifiers to file names,
- * so that it uses the mappings in a specified directory.
- *
- * @param mappings Array of string pairs, where the first member
- * of each pair is a PUBLIC identifier and the second is the
- * name of a file, relative to the specified directory.
- * @param directory File holding the specified files.
- */
- public static void addDirectoryMapping (
- Dictionary table,
- String mappings [][],
- File directory
- ) throws IOException
- {
- for (int i = 0; i < mappings.length; i++) {
- File file = new File (directory, mappings [i][1]);
- String temp;
-
- if (!file.exists ()) // ?? log a warning ??
- continue;
-
- temp = fileToURL (file);
- table.put (mappings [i][0], temp);
- }
- }
-
- // FIXME: these *URL routines don't quite belong here, except
- // that they're all in the same spirit of making it easy to
- // use local filesystem URIs with XML parsers.
-
- /**
- * Provides the URL for a named file, without relying on the JDK 1.2
- * {@link java.io.File#toURL File.toURL}() utility method.
- *
- * @param filename the file name to convert. Relative file names
- * are resolved the way the JVM resolves them (current to the
- * process-global current working directory).
- *
- * @exception IOException if the file does not exist
- */
- public static String fileNameToURL (String filename)
- throws IOException
- {
- return fileToURL (new File (filename));
- }
-
- /**
- * Provides the URL for a file, without relying on the JDK 1.2
- * {@link java.io.File#toURL File.toURL}() utility method.
- *
- * @param f the file to convert. Relative file names
- * are resolved the way the JVM resolves them (current to the
- * process-global current working directory).
- *
- * @exception IOException if the file does not exist
- */
- public static String fileToURL (File f)
- throws IOException
- {
- String temp;
-
- // NOTE: the javax.xml.parsers.DocumentBuilder and
- // javax.xml.transform.stream.StreamSource versions
- // of this don't have this test. Some JVM versions
- // don't report this error sanely through URL code.
- if (!f.exists ())
- throw new IOException ("no such file: " + f.getName ());
-
- // FIXME: getAbsolutePath() seems buggy; I'm seeing components
- // like "/foo/../" which are clearly not "absolute"
- // and should have been resolved with the filesystem.
-
- // Substituting "/" would be wrong, "foo" may have been
- // symlinked ... the URL code will make that change
- // later, so that things can get _really_ broken!
-
- temp = f.getAbsolutePath ();
-
- if (File.separatorChar != '/')
- temp = temp.replace (File.separatorChar, '/');
- if (!temp.startsWith ("/"))
- temp = "/" + temp;
- if (!temp.endsWith ("/") && f.isDirectory ())
- temp = temp + "/";
- return "file:" + temp;
- }
-
-
- /**
- * Returns a URL string. Note that if a malformed URL is provided, or
- * the parameter names a nonexistent file, the resulting URL may be
- * malformed.
- *
- * @param fileOrURL If this is the name of a file which exists,
- * then its URL is returned. Otherwise the argument is returned.
- */
- public static String getURL (String fileOrURL)
- {
- try {
- return fileNameToURL (fileOrURL);
- } catch (Exception e) {
- return fileOrURL;
- }
- }
-
-
-
- // note: cloneable, this is just copied; unguarded against mods
- private Dictionary pubidMapping;
-
- /**
- * Constructs a resolver which understands how to map PUBLIC identifiers
- * to other URIs, typically for local copies of standard DTD components.
- *
- * @param dictionary maps PUBLIC identifiers to URIs. This is not
- * copied; subsequent modifications will be reported through the
- * resolution operations.
- */
- public Resolver (Dictionary dict)
- { pubidMapping = dict; }
-
-
- // FIXME: want notion of a "system default" resolver, presumably
- // loaded with all sorts of useful stuff. At the same time need
- // a notion of resolver chaining (failure --> next) so that subsystems
- // can set up things that won't interfere with other ones.
-
- /**
- * This parses most MIME content type strings that have <em>charset=...</em>
- * encoding declarations to and returns the specified encoding. This
- * conforms to RFC 3023, and is useful when constructing InputSource
- * objects from URLConnection objects or other objects using MIME
- * content typing.
- *
- * @param contentType the MIME content type that will be parsed; must
- * not be null.
- * @return the appropriate encoding, or null if the content type is
- * not text and there's no <code>charset=...</code> attribute
- */
- static public String getEncoding (String contentType)
- {
- // currently a dumb parsing algorithm that works "mostly" and handles
- // ..anything...charset=ABC
- // ..anything...charset=ABC;otherAttr=DEF
- // ..anything...charset=ABC (comment);otherAttr=DEF
- // ..anything...charset= "ABC" (comment);otherAttr=DEF
-
- int temp;
- String encoding;
- String defValue = null;
-
- if (contentType.startsWith ("text/"))
- defValue = contentType.startsWith ("text/html")
- ? "ISO-8859-1" : "US-ASCII";
-
- // Assumes 'charset' is only an attribute name, not part
- // of a value, comment, or other attribute name
- // ALSO assumes no escaped values like "\;" or "\)"
- if ((temp = contentType.indexOf ("charset")) != -1) {
- // strip out everything up to '=' ...
- temp = contentType.indexOf ('=', temp);
- if (temp == -1)
- return defValue;
- encoding = contentType.substring (temp + 1);
- // ... and any subsequent attributes
- if ((temp = encoding.indexOf (';')) != -1)
- encoding = encoding.substring (0, temp);
- // ... and any comments after value
- if ((temp = encoding.indexOf ('(')) != -1)
- encoding = encoding.substring (0, temp);
- // ... then whitespace, and any (double) quotes
- encoding = encoding.trim ();
- if (encoding.charAt (0) == '"')
- encoding = encoding.substring (1, encoding.length () - 1);
- } else
- encoding = defValue;
- return encoding;
- }
-
-
- /**
- * Uses a local dictionary of public identifiers to resolve URIs,
- * normally with the goal of minimizing network traffic or latencies.
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws IOException, SAXException
- {
- InputSource retval = null;
- String uri;
-
- if (publicId != null
- && ((uri = (String) pubidMapping.get (publicId)) != null)) {
- retval = new InputSource (uri);
- retval.setPublicId (publicId);
- }
-
- // Could do URN resolution here
-
- // URL resolution always done by parser
-
- // FIXME: chain to "next" resolver
-
- return retval;
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/SAXNullTransformerFactory.java b/external/jaxp/source/gnu/xml/util/SAXNullTransformerFactory.java
deleted file mode 100644
index a862a0118..000000000
--- a/external/jaxp/source/gnu/xml/util/SAXNullTransformerFactory.java
+++ /dev/null
@@ -1,539 +0,0 @@
-/*
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.util;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-import java.util.Hashtable;
-import java.util.Properties;
-
-import gnu.xml.dom.Consumer;
-import gnu.xml.dom.DomDocument;
-import gnu.xml.pipeline.DomConsumer;
-import gnu.xml.pipeline.EventFilter;
-
-import javax.xml.transform.*;
-import javax.xml.transform.dom.*;
-import javax.xml.transform.sax.*;
-import javax.xml.transform.stream.*;
-
-import org.xml.sax.*;
-import org.xml.sax.helpers.XMLReaderFactory;
-import org.xml.sax.helpers.LocatorImpl;
-
-
-/**
- * Implements null transforms. XSLT stylesheets are not supported.
- * This class provides a way to translate three representations of
- * XML data (SAX event stream, DOM tree, and XML text) into each other.
- * In essence it's a thinnish wrapper around basic SAX event
- * <a href="../pipeline/package-summary.html">pipeline</a> facilities, which
- * exposes only limited functionality. The <em>javax.xml.transform</em>
- * functionality is implemented as follows: <ul>
- *
- * <li>The {@link javax.xml.transform.sax.SAXSource SAXSource} class
- * just wraps an {@link XMLReader} and {@link InputSource}, while the
- * {@link javax.xml.transform.sax.SAXResult SAXResult} class is less
- * functional than a {@link gnu.xml.pipeline.EventConsumer EventConsumer}.
- * (Notably, it drops all but one declaration from any DTD.)</li>
- *
- * <li>The {@link javax.xml.transform.dom.DOMSource DOMSource} class
- * corresponds to special SAX parsers like {@link DomParser}, and the
- * {@link javax.xml.transform.dom.DOMResult DOMResult} class corresponds
- * to a {@link gnu.xml.pipeline.DomConsumer DomConsumer}.</li>
- *
- * <li>The {@link javax.xml.transform.stream.StreamSource StreamSource}
- * class corresponds to a SAX {@link InputSource}, and the
- * {@link javax.xml.transform.stream.StreamResult StreamResult} class
- * corresponds to a {@link gnu.xml.pipeline.TextConsumer TextConsumer}.</li>
- *
- * </ul>
- *
- * <p><em>This implementation is preliminary.</em>
- *
- * @see gnu.xml.pipeline.XsltFilter
- *
- * @author David Brownell
- */
-public class SAXNullTransformerFactory extends SAXTransformerFactory
-{
- private ErrorListener errListener;
- private URIResolver uriResolver;
-
- /** Default constructor */
- public SAXNullTransformerFactory () { }
-
- //
- // only has stuff that makes sense with null transforms
- //
-
- /**
- * Returns true if the requested feature is supported.
- * All three kinds of input and output are accepted:
- * XML text, SAX events, and DOM nodes.
- */
- public boolean getFeature (String feature)
- {
- return SAXTransformerFactory.FEATURE.equals (feature)
- || SAXResult.FEATURE.equals (feature)
- || SAXSource.FEATURE.equals (feature)
- || DOMResult.FEATURE.equals (feature)
- || DOMSource.FEATURE.equals (feature)
- || StreamResult.FEATURE.equals (feature)
- || StreamSource.FEATURE.equals (feature)
- ;
- }
-
- /** Throws an exception (no implementation attributes are supported) */
- public void setAttribute (String key, Object value)
- {
- throw new IllegalArgumentException ();
- }
-
- /** Throws an exception (no implementation attributes are supported) */
- public Object getAttribute (String key)
- {
- throw new IllegalArgumentException ();
- }
-
- /** (not yet implemented) */
- public Source getAssociatedStylesheet (Source source,
- String media, String title, String charset)
- throws TransformerConfigurationException
- {
-// parse, and find the appropriate xsl-stylesheet PI contents
-throw new IllegalArgumentException ();
- }
-
- public Transformer newTransformer ()
- throws TransformerConfigurationException
- {
- return new NullTransformer ();
- }
-
- /**
- * Returns a TransformerHandler that knows how to generate output
- * in all three standard formats. Output text is generated using
- * {@link XMLWriter}, and the GNU implementation of
- * {@link DomDocument DOM} is used.
- *
- * @see SAXResult
- * @see StreamResult
- * @see DOMResult
- */
- public TransformerHandler newTransformerHandler ()
- throws TransformerConfigurationException
- {
- NullTransformer transformer = new NullTransformer ();
- return transformer.handler;
- }
-
- //
- // Stuff that depends on XSLT support, which we don't provide
- //
- private static final String noXSLT = "No XSLT support";
-
- /** Throws an exception (XSLT is not supported). */
- public Transformer newTransformer (Source stylesheet)
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Throws an exception (XSLT is not supported). */
- public Templates newTemplates (Source stylesheet)
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Throws an exception (XSLT is not supported). */
- public TemplatesHandler newTemplatesHandler ()
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Throws an exception (XSLT is not supported). */
- public TransformerHandler newTransformerHandler (Source stylesheet)
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Throws an exception (XSLT is not supported). */
- public TransformerHandler newTransformerHandler (Templates stylesheet)
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Throws an exception (XSLT is not supported). */
- public XMLFilter newXMLFilter (Source stylesheet)
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Throws an exception (XSLT is not supported). */
- public XMLFilter newXMLFilter (Templates stylesheet)
- throws TransformerConfigurationException
- { throw new TransformerConfigurationException (noXSLT); }
-
- /** Returns the value assigned by {@link #setErrorListener}. */
- public ErrorListener getErrorListener ()
- { return errListener; }
-
- /** Assigns a value that would be used when parsing stylesheets */
- public void setErrorListener (ErrorListener e)
- { errListener = e; }
-
- /** Returns the value assigned by {@link #setURIResolver}. */
- public URIResolver getURIResolver ()
- { return uriResolver; }
-
- /** Assigns a value that would be used when parsing stylesheets */
- public void setURIResolver (URIResolver u)
- { uriResolver = u; }
-
-
- //
- // Helper classes. These might in theory be subclassed
- // by an XSLT implementation, if they were exported.
- //
-
- static class DomTerminus extends DomConsumer
- {
- DomTerminus (DOMResult result) throws SAXException
- {
- // won't really throw SAXException
- super (DomDocument.class);
- setHandler (new DomHandler (this, result));
- }
- }
-
- static class DomHandler extends Consumer.Backdoor
- {
- private DOMResult result;
-
- DomHandler (DomConsumer c, DOMResult r) throws SAXException
- {
- // won't really throw SAXException
- super (c);
- result = r;
- }
-
- public void endDocument () throws SAXException
- {
- super.endDocument ();
- result.setNode (getDocument ());
- }
- }
-
- private static OutputStream getOutputStream (String uri)
- throws IOException
- {
- // JDK stupidity: file "protocol does not support output" ...
- if (uri.startsWith ("file:"))
- return new FileOutputStream (uri.substring (5));
-
- // Otherwise ...
- URL url = new URL (uri);
- URLConnection conn = url.openConnection ();
-
- conn.setDoOutput (true);
- return conn.getOutputStream ();
- }
-
-
- static class NullHandler extends EventFilter implements TransformerHandler
- {
- private String systemId;
- private Transformer transformer;
-
- NullHandler (Transformer t)
- { transformer = t; }
-
- public Transformer getTransformer ()
- { return transformer; }
-
- public String getSystemId ()
- { return systemId; }
-
- public void setSystemId (String id)
- { systemId = id; }
-
- public void setResult (Result result)
- {
- if (result.getSystemId () != null)
- systemId = result.getSystemId ();
-
- try {
-
- // output to partial SAX event stream?
- if (result instanceof SAXResult) {
- SAXResult r = (SAXResult) result;
-
- setContentHandler (r.getHandler ());
- setProperty (LEXICAL_HANDLER, r.getLexicalHandler ());
- // DTD info is filtered out by javax.transform
-
- // output to DOM tree?
- } else if (result instanceof DOMResult) {
- DomTerminus out = new DomTerminus ((DOMResult) result);
-
- setContentHandler (out.getContentHandler ());
- setProperty (LEXICAL_HANDLER,
- out.getProperty (LEXICAL_HANDLER));
- // save DTD-derived info, if any.
- setDTDHandler (out.getDTDHandler ());
- setProperty (DECL_HANDLER,
- out.getProperty (DECL_HANDLER));
-
- // node is saved into result on endDocument()
-
- // output to (XML) text?
- } else if (result instanceof StreamResult) {
- StreamResult r = (StreamResult) result;
- XMLWriter out;
-
-// FIXME: when do output properties take effect?
-// encoding, standalone decl, xml/xhtml/... ...
-
-// FIXME: maybe put nsfix filter up front
-
- try {
- if (r.getWriter () != null)
- out = new XMLWriter (r.getWriter ());
- else if (r.getOutputStream () != null)
- out = new XMLWriter (r.getOutputStream ());
- else if (r.getSystemId () != null)
- out = new XMLWriter (
- getOutputStream (r.getSystemId ()));
- else
- throw new IllegalArgumentException (
- "bad StreamResult");
- } catch (IOException e) {
-e.printStackTrace ();
- // on jdk 1.4, pass the root cause ...
- throw new IllegalArgumentException (e.getMessage ());
- }
-
-// out.setExpandingEntities (true);
-// out.setPrettyPrinting (true);
-// out.setXhtml (true);
-
- setContentHandler (out);
- setProperty (LEXICAL_HANDLER, out);
- // save DTD info, if any; why not?
- setDTDHandler (out);
- setProperty (DECL_HANDLER, out);
- }
-
- } catch (SAXException e) {
- // SAXNotSupportedException or SAXNotRecognizedException:
- // "can't happen" ... but SAXException for DOM build probs
- // could happen, so ...
- // on jdk 1.4, pass the root cause ...
- throw new IllegalArgumentException (e.getMessage ());
- }
- }
- }
-
- // an interface that adds no value
- static class LocatorAdapter extends LocatorImpl implements SourceLocator
- {
- LocatorAdapter (SAXParseException e)
- {
- setSystemId (e.getSystemId ());
- setPublicId (e.getPublicId ());
- setLineNumber (e.getLineNumber ());
- setColumnNumber (e.getColumnNumber ());
- }
- }
-
- // another interface that adds no value
- static class ListenerAdapter implements ErrorHandler
- {
- NullTransformer transformer;
-
- ListenerAdapter (NullTransformer t)
- { transformer = t; }
-
- private TransformerException map (SAXParseException e)
- {
- return new TransformerException (
- e.getMessage (),
- new LocatorAdapter (e),
- e);
- }
-
- public void error (SAXParseException e)
- throws SAXParseException
- {
- try {
- if (transformer.errListener != null)
- transformer.errListener.error (map (e));
- } catch (TransformerException ex) {
- transformer.ex = ex;
- throw e;
- }
- }
-
- public void fatalError (SAXParseException e)
- throws SAXParseException
- {
- try {
- if (transformer.errListener != null)
- transformer.errListener.fatalError (map (e));
- else
- throw map (e);
- } catch (TransformerException ex) {
- transformer.ex = ex;
- throw e;
- }
- }
-
- public void warning (SAXParseException e)
- throws SAXParseException
- {
- try {
- if (transformer.errListener != null)
- transformer.errListener.warning (map (e));
- } catch (TransformerException ex) {
- transformer.ex = ex;
- throw e;
- }
- }
- }
-
- static class NullTransformer extends Transformer
- {
- private URIResolver uriResolver;
- private Properties props = new Properties ();
- private Hashtable params = new Hashtable (7);
-
- ErrorListener errListener = null;
- TransformerException ex = null;
- NullHandler handler;
-
- NullTransformer ()
- {
- super ();
- handler = new NullHandler (this);
- }
-
- public ErrorListener getErrorListener ()
- { return errListener; }
- public void setErrorListener (ErrorListener e)
- { errListener = e; }
-
- public URIResolver getURIResolver ()
- { return uriResolver; }
- public void setURIResolver (URIResolver u)
- { uriResolver = u; }
-
-
- public void setOutputProperties (Properties p)
- { props = (Properties) p.clone (); }
- public Properties getOutputProperties ()
- { return (Properties) props.clone (); }
-
- public void setOutputProperty (String name, String value)
- { props.setProperty (name, value); }
- public String getOutputProperty (String name)
- { return props.getProperty (name); }
-
- public void clearParameters ()
- { params.clear (); }
- public void setParameter (String name, Object value)
- { props.put (name, value); }
- public Object getParameter (String name)
- { return props.get (name); }
-
- public void transform (Source in, Result out)
- throws TransformerException
- {
- try {
- XMLReader producer;
- InputSource input;
-
- // Input from DOM?
- if (in instanceof DOMSource) {
- DOMSource source = (DOMSource) in;
-
- if (source.getNode () == null)
- throw new IllegalArgumentException ("no DOM node");
- producer = new DomParser (source.getNode ());
- input = null;
-
- // Input from SAX?
- } else if (in instanceof SAXSource) {
- SAXSource source = (SAXSource) in;
-
- producer = source.getXMLReader ();
- if (producer == null)
- producer = XMLReaderFactory.createXMLReader ();
-
- input = source.getInputSource ();
- if (input == null) {
- if (source.getSystemId () != null)
- input = new InputSource (source.getSystemId ());
- else
- throw new IllegalArgumentException (
- "missing SAX input");
- }
-
- // Input from a stream or something?
- } else {
- producer = XMLReaderFactory.createXMLReader ();
- input = SAXSource.sourceToInputSource (in);
- if (input == null)
- throw new IllegalArgumentException ("missing input");
- }
-
- // preserve original namespace prefixes
- try { producer.setFeature (
- handler.FEATURE_URI + "namespace-prefixes", true);
- } catch (Exception e) {
- /* ignore */
-// FIXME if we couldn't, "NsFix" stage before the output ..
- }
-
- // arrange the output
- handler.setResult (out);
- handler.bind (producer, handler);
-
- // then parse ... single element pipeline
- producer.parse (input);
-
- } catch (IOException e) {
- throw new TransformerException ("transform failed", e);
-
- } catch (SAXException e) {
- if (ex == null && ex.getCause () == e)
- throw ex;
- else
- throw new TransformerException ("transform failed", e);
-
- } finally {
- ex = null;
- }
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/XCat.java b/external/jaxp/source/gnu/xml/util/XCat.java
deleted file mode 100644
index ad77d6db7..000000000
--- a/external/jaxp/source/gnu/xml/util/XCat.java
+++ /dev/null
@@ -1,1598 +0,0 @@
-/*
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-
-package gnu.xml.util;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.StringTokenizer;
-import java.util.Stack;
-import java.util.Vector;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.XMLReader;
-
-import org.xml.sax.ext.DefaultHandler2;
-import org.xml.sax.ext.EntityResolver2;
-
-import org.xml.sax.helpers.XMLReaderFactory;
-
-/**
- * Packages <a href=
- "http://www.oasis-open.org/committees/entity/spec-2001-08-06.html"
- >OASIS XML Catalogs</a>,
- * primarily for entity resolution by parsers.
- * That specification defines an XML syntax for mappings between
- * identifiers declared in DTDs (particularly PUBLIC identifiers) and
- * locations. SAX has always supported such mappings, but conventions for
- * an XML file syntax to maintain them have previously been lacking.
- *
- * <p> This has three main operational modes. The primary intended mode is
- * to create a resolver, then preloading it with one or more site-standard
- * catalogs before using it with one or more SAX parsers: <pre>
- * XCat catalog = new XCat ();
- * catalog.setErrorHandler (diagnosticErrorHandler);
- * catalog.loadCatalog ("file:/local/catalogs/catalog.cat");
- * catalog.loadCatalog ("http://shared/catalog.cat");
- * ...
- * catalog.disableLoading ();
- * parser1.setEntityResolver (catalog);
- * parser2.setEntityResolver (catalog);
- * ...</pre>
- *
- * <p>A second mode is to arrange that your application uses instances of
- * this class as its entity resolver, and automatically loads catalogs
- * referenced by <em>&lt;?oasis-xml-catalog...?&gt;</em> processing
- * instructions found before the DTD in documents it parses.
- * It would then discard the resolver after each parse.
- *
- * <p> A third mode applies catalogs in contexts other than entity
- * resolution for parsers.
- * The {@link #resolveURI resolveURI()} method supports resolving URIs
- * stored in XML application data, rather than inside DTDs.
- * Catalogs would be loaded as shown above, and the catalog could
- * be used concurrently for parser entity resolution and for
- * application URI resolution.
- * </p>
- *
- * <center><hr width='70%'></center>
- *
- * <p>Errors in catalogs implicitly loaded (during resolution) are ignored
- * beyond being reported through any <em>ErrorHandler</em> assigned using
- * {@link #setErrorHandler setErrorHandler()}. SAX exceptions
- * thrown from such a handler won't abort resolution, although throwing a
- * <em>RuntimeException</em> or <em>Error</em> will normally abort both
- * resolution and parsing. Useful diagnostic information is available to
- * any <em>ErrorHandler</em> used to report problems, or from any exception
- * thrown from an explicit {@link #loadCatalog loadCatalog()} invocation.
- * Applications can use that information as troubleshooting aids.
- *
- * <p>While this class requires <em>SAX2 Extensions 1.1</em> classes in
- * its class path, basic functionality does not require using a SAX2
- * parser that supports the extended entity resolution functionality.
- * See the original SAX1
- * {@link #resolveEntity(java.lang.String,java.lang.String) resolveEntity()}
- * method for a list of restrictions which apply when it is used with
- * older SAX parsers.
- *
- * @see EntityResolver2
- *
- * @author David Brownell
- */
-public class XCat implements EntityResolver2
-{
- private Catalog catalogs [];
- private boolean usingPublic = true;
- private boolean loadingPermitted = true;
- private boolean unified = true;
- private String parserClass;
- private ErrorHandler errorHandler;
-
- // private EntityResolver next; // chain to next if we fail...
-
- //
- // NOTE: This is a straightforward implementation, and if
- // there are lots of "nextCatalog" or "delegate*" entries
- // in use, two tweaks would be worth considering:
- //
- // - Centralize some sort of cache (key by URI) for individual
- // resolvers. That'd avoid multiple copies of a given catalog.
- //
- // - Have resolution track what catalogs (+modes) have been
- // searched. This would support loop detection.
- //
-
-
- /**
- * Initializes without preloading a catalog.
- * This API is convenient when you may want to arrange that catalogs
- * are automatically loaded when explicitly referenced in documents,
- * using the <em>oasis-xml-catalog</em> processing instruction.
- * In such cases you won't usually be able to preload catalogs.
- */
- public XCat () { }
-
- /**
- * Initializes, and preloads a catalog using the default SAX parser.
- * This API is convenient when you operate with one or more standard
- * catalogs.
- *
- * <p> This just delegates to {@link #loadCatalog loadCatalog()};
- * see it for exception information.
- *
- * @param uri absolute URI for the catalog file.
- */
- public XCat (String uri)
- throws SAXException, IOException
- { loadCatalog (uri); }
-
-
- /**
- * Loads an OASIS XML Catalog.
- * It is appended to the list of currently active catalogs, or
- * reloaded if a catalog with the same URI was already loaded.
- * Callers have control over what parser is used, how catalog parsing
- * errors are reported, and whether URIs will be resolved consistently.
- *
- * <p> The OASIS specification says that errors detected when loading
- * catalogs "must recover by ignoring the catalog entry file that
- * failed, and proceeding." In this API, that action can be the
- * responsibility of applications, when they explicitly load any
- * catalog using this method.
- *
- * <p>Note that catalogs referenced by this one will not be loaded
- * at this time. Catalogs referenced through <em>nextCatalog</em>
- * or <em>delegate*</em> elements are normally loaded only if needed.
- *
- * @see #setErrorHandler
- * @see #setParserClass
- * @see #setUnified
- *
- * @param uri absolute URI for the catalog file.
- *
- * @exception IOException As thrown by the parser, typically to
- * indicate problems reading data from that URI.
- * @exception SAXException As thrown by the parser, typically to
- * indicate problems parsing data from that URI. It may also
- * be thrown if the parser doesn't support necessary handlers.
- * @exception IllegalStateException When attempting to load a
- * catalog after loading has been {@link #disableLoading disabled},
- * such as after any entity or URI lookup has been performed.
- */
- public synchronized void loadCatalog (String uri)
- throws SAXException, IOException
- {
- Catalog catalog;
- int index = -1;
-
- if (!loadingPermitted)
- throw new IllegalStateException ();
-
- uri = normalizeURI (uri);
- if (catalogs != null) {
- // maybe just reload
- for (index = 0; index < catalogs.length; index++)
- if (uri.equals (catalogs [index].catalogURI))
- break;
- }
- catalog = loadCatalog (parserClass, errorHandler, uri, unified);
-
- // add to list of catalogs
- if (catalogs == null) {
- index = 0;
- catalogs = new Catalog [1];
- } else if (index == catalogs.length) {
- Catalog tmp [];
-
- tmp = new Catalog [index + 1];
- System.arraycopy (catalogs, 0, tmp, 0, index);
- catalogs = tmp;
- }
- catalogs [index] = catalog;
- }
-
-
- /**
- * "New Style" external entity resolution for parsers.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * <p>This supports the full core catalog functionality for locating
- * (and relocating) parsed entities that have been declared in a
- * document's DTD.
- *
- * @param name Entity name, such as "dudley", "%nell", or "[dtd]".
- * @param publicId Either a normalized public ID, or null.
- * @param baseURI Absolute base URI associated with systemId.
- * @param systemId URI found in entity declaration (may be
- * relative to baseURI).
- *
- * @return Input source for accessing the external entity, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- *
- * @see #getExternalSubset
- */
- public InputSource resolveEntity (
- String name, // UNUSED ... systemId is always non-null
- String publicId,
- String baseURI, // UNUSED ... it just lets sysId be relative
- String systemId
- ) throws SAXException, IOException
- {
- if (loadingPermitted)
- disableLoading ();
-
- try {
- // steps as found in OASIS XML catalog spec 7.1.2
- // steps 1, 8 involve looping over the list of catalogs
- for (int i = 0; i < catalogs.length; i++) {
- InputSource retval;
- retval = catalogs [i].resolve (usingPublic, publicId, systemId);
- if (retval != null)
- return retval;;
- }
- } catch (DoneDelegation x) {
- // done!
- }
- // step 9 involves returning "no match"
- return null;
- }
-
-
- /**
- * "New Style" parser callback to add an external subset.
- * For documents that don't include an external subset, this may
- * return one according to <em>doctype</em> catalog entries.
- * (This functionality is not a core part of the OASIS XML Catalog
- * specification, though it's presented in an appendix.)
- * If no such entry is defined, this returns null to indicate that
- * this document will not be modified to include such a subset.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * <p><em>Warning:</em> That catalog functionality can be dangerous.
- * It can provide definitions of general entities, and thereby mask
- * certain well formedess errors.
- *
- * @param name Name of the document element, either as declared in
- * a DOCTYPE declaration or as observed in the text.
- * @param baseURI Document's base URI (absolute).
- *
- * @return Input source for accessing the external subset, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- */
- public InputSource getExternalSubset (String name, String baseURI)
- throws SAXException, IOException
- {
- if (loadingPermitted)
- disableLoading ();
- try {
- for (int i = 0; i < catalogs.length; i++) {
- InputSource retval = catalogs [i].getExternalSubset (name);
- if (retval != null)
- return retval;
- }
- } catch (DoneDelegation x) {
- // done!
- }
- return null;
- }
-
-
- /**
- * "Old Style" external entity resolution for parsers.
- * This API provides only core functionality.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * <p>The functional limitations of this interface include:</p><ul>
- *
- * <li>Since system IDs will be absolutized before the resolver
- * sees them, matching against relative URIs won't work.
- * This may affect <em>system</em>, <em>rewriteSystem</em>,
- * and <em>delegateSystem</em> catalog entries.
- *
- * <li>Because of that absolutization, documents declaring entities
- * with system IDs using URI schemes that the JVM does not recognize
- * may be unparsable. URI schemes such as <em>file:/</em>,
- * <em>http://</em>, <em>https://</em>, and <em>ftp://</em>
- * will usually work reliably.
- *
- * <li>Because missing external subsets can't be provided, the
- * <em>doctype</em> catalog entries will be ignored.
- * (The {@link #getExternalSubset getExternalSubset()} method is
- * a "New Style" resolution option.)
- *
- * </ul>
- *
- * <p>Applications can tell whether this limited functionality will be
- * used: if the feature flag associated with the {@link EntityResolver2}
- * interface is not <em>true</em>, the limitations apply. Applications
- * can't usually know whether a given document and catalog will trigger
- * those limitations. The issue can only be bypassed by operational
- * procedures such as not using catalogs or documents which involve
- * those features.
- *
- * @param publicId Either a normalized public ID, or null
- * @param systemId Always an absolute URI.
- *
- * @return Input source for accessing the external entity, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- */
- final public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException, IOException
- {
- return resolveEntity (null, publicId, null, systemId);
- }
-
-
- /**
- * Resolves a URI reference that's not defined to the DTD.
- * This is intended for use with URIs found in document text, such as
- * <em>xml-stylesheet</em> processing instructions and in attribute
- * values, where they are not recognized as URIs by XML parsers.
- * Calls to this method prevent explicit loading of additional catalogs
- * using {@link #loadCatalog loadCatalog()}.
- *
- * <p>This functionality is supported by the OASIS XML Catalog
- * specification, but will never be invoked by an XML parser.
- * It corresponds closely to functionality for mapping system
- * identifiers for entities declared in DTDs; closely enough that
- * this implementation's default behavior is that they be
- * identical, to minimize potential confusion.
- *
- * <p>This method could be useful when implementing the
- * {@link javax.xml.transform.URIResolver} interface, wrapping the
- * input source in a {@link javax.xml.transform.sax.SAXSource}.
- *
- * @see #isUnified
- * @see #setUnified
- *
- * @param baseURI The relevant base URI as specified by the XML Base
- * specification. This recognizes <em>xml:base</em> attributes
- * as overriding the actual (physical) base URI.
- * @param uri Either an absolute URI, or one relative to baseURI
- *
- * @return Input source for accessing the mapped URI, or null
- * if no mapping was found. The input source may have opened
- * the stream, and will have a fully resolved URI.
- */
- public InputSource resolveURI (String baseURI, String uri)
- throws SAXException, IOException
- {
- if (loadingPermitted)
- disableLoading ();
-
- // NOTE: baseURI isn't used here, but caller MUST have it,
- // and heuristics _might_ use it in the future ... plus,
- // it's symmetric with resolveEntity ().
-
- // steps 1, 6 involve looping
- try {
- for (int i = 0; i < catalogs.length; i++) {
- InputSource tmp = catalogs [i].resolveURI (uri);
- if (tmp != null)
- return tmp;
- }
- } catch (DoneDelegation x) {
- // done
- }
- // step 7 reports no match
- return null;
- }
-
-
- /**
- * Records that catalog loading is no longer permitted.
- * Loading is automatically disabled when lookups are performed,
- * and should be manually disabled when <em>startDTD()</em> (or
- * any other DTD declaration callback) is invoked, or at the latest
- * when the document root element is seen.
- */
- public synchronized void disableLoading ()
- {
- // NOTE: this method and loadCatalog() are synchronized
- // so that it's impossible to load (top level) catalogs
- // after lookups start. Likewise, deferred loading is also
- // synchronized (for "next" and delegated catalogs) to
- // ensure that parsers can share resolvers.
- loadingPermitted = false;
- }
-
-
- /**
- * Returns the error handler used to report catalog errors.
- * Null is returned if the parser's default error handling
- * will be used.
- *
- * @see #setErrorHandler
- */
- public ErrorHandler getErrorHandler ()
- { return errorHandler; }
-
- /**
- * Assigns the error handler used to report catalog errors.
- * These errors may come either from the SAX2 parser or
- * from the catalog parsing code driven by the parser.
- *
- * <p> If you're sharing the resolver between parsers, don't
- * change this once lookups have begun.
- *
- * @see #getErrorHandler
- *
- * @param parser The error handler, or null saying to use the default
- * (no diagnostics, and only fatal errors terminate loading).
- */
- public void setErrorHandler (ErrorHandler handler)
- { errorHandler = handler; }
-
-
- /**
- * Returns the name of the SAX2 parser class used to parse catalogs.
- * Null is returned if the system default is used.
- * @see #setParserClass
- */
- public String getParserClass ()
- { return parserClass; }
-
- /**
- * Names the SAX2 parser class used to parse catalogs.
- *
- * <p> If you're sharing the resolver between parsers, don't change
- * this once lookups have begun.
- *
- * <p> Note that in order to properly support the <em>xml:base</em>
- * attribute and relative URI resolution, the SAX parser used to parse
- * the catalog must provide a {@link Locator} and support the optional
- * declaration and lexical handlers.
- *
- * @see #getParserClass
- *
- * @param parser The parser class name, or null saying to use the
- * system default SAX2 parser.
- */
- public void setParserClass (String parser)
- { parserClass = parser; }
-
-
- /**
- * Returns true (the default) if all methods resolve
- * a given URI in the same way.
- * Returns false if calls resolving URIs as entities (such as
- * {@link #resolveEntity resolveEntity()}) use different catalog entries
- * than those resolving them as URIs ({@link #resolveURI resolveURI()}),
- * which will generally produce different results.
- *
- * <p>The OASIS XML Catalog specification defines two related schemes
- * to map URIs "as URIs" or "as system IDs".
- * URIs use <em>uri</em>, <em>rewriteURI</em>, and <em>delegateURI</em>
- * elements. System IDs do the same things with <em>systemId</em>,
- * <em>rewriteSystemId</em>, and <em>delegateSystemId</em>.
- * It's confusing and error prone to maintain two parallel copies of
- * such data. Accordingly, this class makes that behavior optional.
- * The <em>unified</em> interpretation of URI mappings is preferred,
- * since it prevents surprises where one URI gets mapped to different
- * contents depending on whether the reference happens to have come
- * from a DTD (or not).
- *
- * @see #setUnified
- */
- public boolean isUnified ()
- { return unified; }
-
- /**
- * Assigns the value of the flag returned by {@link #isUnified}.
- * Set it to false to be strictly conformant with the OASIS XML Catalog
- * specification. Set it to true to make all mappings for a given URI
- * give the same result, regardless of the reason for the mapping.
- *
- * <p>Don't change this once you've loaded the first catalog.
- *
- * @param value new flag setting
- */
- public void setUnified (boolean value)
- { unified = value; }
-
-
- /**
- * Returns true (the default) if a catalog's public identifier
- * mappings will be used.
- * When false is returned, such mappings are ignored except when
- * system IDs are discarded, such as for
- * entities using the <em>urn:publicid:</em> URI scheme in their
- * system identifiers. (See RFC 3151 for information about that
- * URI scheme. Using it in system identifiers may not work well
- * with many SAX parsers unless the <em>resolve-dtd-uris</em>
- * feature flag is set to false.)
- * @see #setUsingPublic
- */
- public boolean isUsingPublic ()
- { return usingPublic; }
-
- /**
- * Specifies which catalog search mode is used.
- * By default, public identifier mappings are able to override system
- * identifiers when both are available.
- * Applications may choose to ignore public
- * identifier mappings in such cases, so that system identifiers
- * declared in DTDs will only be overridden by an explicit catalog
- * match for that system ID.
- *
- * <p> If you're sharing the resolver between parsers, don't
- * change this once lookups have begun.
- * @see #isUsingPublic
- *
- * @param value true to always use public identifier mappings,
- * false to only use them for system ids using the <em>urn:publicid:</em>
- * URI scheme.
- */
- public void setUsingPublic (boolean value)
- { usingPublic = value; }
-
-
-
- // hmm, what's this do? :)
- private static Catalog loadCatalog (
- String parserClass,
- ErrorHandler eh,
- String uri,
- boolean unified
- ) throws SAXException, IOException
- {
- XMLReader parser;
- Loader loader;
- boolean doesIntern = false;
-
- if (parserClass == null)
- parser = XMLReaderFactory.createXMLReader ();
- else
- parser = XMLReaderFactory.createXMLReader (parserClass);
- if (eh != null)
- parser.setErrorHandler (eh);
- // resolve-dtd-entities is at default value (unrecognized == true)
-
- try {
- doesIntern = parser.getFeature (
- "http://xml.org/sax/features/string-interning");
- } catch (SAXNotRecognizedException e) { }
-
- loader = new Loader (doesIntern, eh, unified);
- loader.cat.parserClass = parserClass;
- loader.cat.catalogURI = uri;
-
- parser.setContentHandler (loader);
- parser.setProperty (
- "http://xml.org/sax/properties/declaration-handler",
- loader);
- parser.setProperty (
- "http://xml.org/sax/properties/lexical-handler",
- loader);
- parser.parse (uri);
-
- return loader.cat;
- }
-
- // perform one or both the normalizations for public ids
- private static String normalizePublicId (boolean full, String publicId)
- {
- if (publicId.startsWith ("urn:publicid:")) {
- StringBuffer buf = new StringBuffer ();
- char chars [] = publicId.toCharArray ();
-boolean hasbug = false;
-
- for (int i = 13; i < chars.length; i++) {
- switch (chars [i]) {
- case '+': buf.append (' '); continue;
- case ':': buf.append ("//"); continue;
- case ';': buf.append ("::"); continue;
- case '%':
-// FIXME unhex that char! meanwhile, warn and fallthrough ...
- hasbug = true;
- default: buf.append (chars [i]); continue;
- }
- }
- publicId = buf.toString ();
-if (hasbug)
-System.err.println ("nyet unhexing public id: " + publicId);
- full = true;
- }
-
- // SAX parsers do everything except that URN mapping, but
- // we can't trust other sources to normalize correctly
- if (full) {
- StringTokenizer tokens;
- String token;
-
- tokens = new StringTokenizer (publicId, " \r\n");
- publicId = null;
- while (tokens.hasMoreTokens ()) {
- if (publicId == null)
- publicId = tokens.nextToken ();
- else
- publicId += " " + tokens.nextToken ();
- }
- }
- return publicId;
- }
-
- private static boolean isUriExcluded (int c)
- { return c <= 0x20 || c >= 0x7f || "\"<>^`{|}".indexOf (c) != -1; }
-
- private static int hexNibble (int c)
- {
- if (c < 10)
- return c + '0';
- return ('a' - 10) + c;
- }
-
- // handles URIs with "excluded" characters
- private static String normalizeURI (String systemId)
- {
- int length = systemId.length ();
-
- for (int i = 0; i < length; i++) {
- char c = systemId.charAt (i);
-
- // escape non-ASCII plus "excluded" characters
- if (isUriExcluded (c)) {
- byte buf [];
- ByteArrayOutputStream out;
- int b;
-
- // a JVM that doesn't know UTF8 and 8859_1 is unusable!
- try {
- buf = systemId.getBytes ("UTF8");
- out = new ByteArrayOutputStream (buf.length + 10);
-
- for (i = 0; i < buf.length; i++) {
- b = buf [i] & 0x0ff;
- if (isUriExcluded (b)) {
- out.write ((int) '%');
- out.write (hexNibble (b >> 4));
- out.write (hexNibble (b & 0x0f));
- } else
- out.write (b);
- }
- return out.toString ("8859_1");
- } catch (IOException e) {
- throw new RuntimeException (
- "can't normalize URI: " + e.getMessage ());
- }
- }
- }
- return systemId;
- }
-
- // thrown to mark authoritative end of a search
- private static class DoneDelegation extends SAXException
- {
- DoneDelegation () { }
- }
-
-
- /**
- * Represents a OASIS XML Catalog, and encapsulates much of
- * the catalog functionality.
- */
- private static class Catalog
- {
- // loading infrastructure
- String catalogURI;
- ErrorHandler eh;
- boolean unified;
- String parserClass;
-
- // catalog data
- boolean hasPreference;
- boolean usingPublic;
-
- Hashtable publicIds;
- Hashtable publicDelegations;
-
- Hashtable systemIds;
- Hashtable systemRewrites;
- Hashtable systemDelegations;
-
- Hashtable uris;
- Hashtable uriRewrites;
- Hashtable uriDelegations;
-
- Hashtable doctypes;
-
- Vector next;
-
- // nonpublic!
- Catalog () { }
-
-
- // steps as found in OASIS XML catalog spec 7.1.2
- private InputSource locatePublicId (String publicId)
- throws SAXException, IOException
- {
- // 5. return (first) 'public' entry
- if (publicIds != null) {
- String retval = (String) publicIds.get (publicId);
- if (retval != null) {
- // IF the URI is accessible ...
- return new InputSource (retval);
- }
- }
-
- // 6. return delegatePublic catalog match [complex]
- if (publicDelegations != null)
- return checkDelegations (publicDelegations, publicId,
- publicId, null);
-
- return null;
- }
-
- // steps as found in OASIS XML catalog spec 7.1.2 or 7.2.2
- private InputSource mapURI (
- String uri,
- Hashtable ids,
- Hashtable rewrites,
- Hashtable delegations
- ) throws SAXException, IOException
- {
- // 7.1.2: 2. return (first) 'system' entry
- // 7.2.2: 2. return (first) 'uri' entry
- if (ids != null) {
- String retval = (String) ids.get (uri);
- if (retval != null) {
- // IF the URI is accessible ...
- return new InputSource (retval);
- }
- }
-
- // 7.1.2: 3. return 'rewriteSystem' entries
- // 7.2.2: 3. return 'rewriteURI' entries
- if (rewrites != null) {
- String prefix = null;
- String replace = null;
- int prefixLen = -1;
-
- for (Enumeration e = rewrites.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String temp = (String) e.nextElement ();
- int len = -1;
-
- if (!uri.startsWith (temp))
- continue;
- if (prefix != null
- && (len = temp.length ()) < prefixLen)
- continue;
- prefix = temp;
- prefixLen = len;
- replace = (String) rewrites.get (temp);
- }
- if (prefix != null) {
- StringBuffer buf = new StringBuffer (replace);
- buf.append (uri.substring (prefixLen));
- // IF the URI is accessible ...
- return new InputSource (buf.toString ());
- }
- }
-
- // 7.1.2: 4. return 'delegateSystem' catalog match [complex]
- // 7.2.2: 4. return 'delegateURI' catalog match [complex]
- if (delegations != null)
- return checkDelegations (delegations, uri, null, uri);
-
- return null;
- }
-
-
- /**
- * Returns a URI for an external entity.
- */
- public InputSource resolve (
- boolean usingPublic,
- String publicId,
- String systemId
- ) throws SAXException, IOException
- {
- boolean preferSystem;
- InputSource retval;
-
- if (hasPreference)
- preferSystem = !this.usingPublic;
- else
- preferSystem = !usingPublic;
-
- if (publicId != null)
- publicId = normalizePublicId (false, publicId);
-
- // behavior here matches section 7.1.1 of the oasis spec
- if (systemId != null) {
- if (systemId.startsWith ("urn:publicid:")) {
- String temp = normalizePublicId (true, systemId);
- if (publicId == null) {
- publicId = temp;
- systemId = null;
- } else if (!publicId.equals (temp)) {
- // error; ok to recover by:
- systemId = null;
- }
- } else
- systemId = normalizeURI (systemId);
- }
-
- if (systemId == null && publicId == null)
- return null;
-
- if (systemId != null) {
- retval = mapURI (systemId, systemIds, systemRewrites,
- systemDelegations);
- if (retval != null) {
- retval.setPublicId (publicId);
- return retval;
- }
- }
-
- if (publicId != null
- && !(systemId != null && preferSystem)) {
- retval = locatePublicId (publicId);
- if (retval != null) {
- retval.setPublicId (publicId);
- return retval;
- }
- }
-
- // 7. apply nextCatalog entries
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- retval = n.resolve (usingPublic, publicId, systemId);
- if (retval != null)
- return retval;
- }
- }
-
- return null;
- }
-
- /**
- * Maps one URI into another, for resources that are not defined
- * using XML external entity or notation syntax.
- */
- public InputSource resolveURI (String uri)
- throws SAXException, IOException
- {
- if (uri.startsWith ("urn:publicid:"))
- return resolve (true, normalizePublicId (true, uri), null);
-
- InputSource retval;
-
- uri = normalizeURI (uri);
-
- // 7.2.2 steps 2-4
- retval = mapURI (uri, uris, uriRewrites, uriDelegations);
- if (retval != null)
- return retval;
-
- // 7.2.2 step 5. apply nextCatalog entries
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- retval = n.resolveURI (uri);
- if (retval != null)
- return retval;
- }
- }
-
- return null;
- }
-
-
- /**
- * Finds the external subset associated with a given root element.
- */
- public InputSource getExternalSubset (String name)
- throws SAXException, IOException
- {
- if (doctypes != null) {
- String value = (String) doctypes.get (name);
- if (value != null) {
- // IF the URI is accessible ...
- return new InputSource (value);
- }
- }
- if (next != null) {
- int length = next.size ();
- for (int i = 0; i < length; i++) {
- Catalog n = getNext (i);
- if (n == null)
- continue;
- InputSource retval = n.getExternalSubset (name);
- if (retval != null)
- return retval;
- }
- }
- return null;
- }
-
- private synchronized Catalog getNext (int i)
- throws SAXException, IOException
- {
- Object obj;
-
- if (next == null || i < 0 || i >= next.size ())
- return null;
- obj = next.elementAt (i);
- if (obj instanceof Catalog)
- return (Catalog) obj;
-
- // ok, we deferred reading that catalog till now.
- // load and cache it.
- Catalog cat = null;
-
- try {
- cat = loadCatalog (parserClass, eh, (String) obj, unified);
- next.setElementAt (cat, i);
- } catch (SAXException e) {
- // must fail quietly, says the OASIS spec
- } catch (IOException e) {
- // same applies here
- }
- return cat;
- }
-
- private InputSource checkDelegations (
- Hashtable delegations,
- String id,
- String publicId, // only one of public/system
- String systemId // will be non-null...
- ) throws SAXException, IOException
- {
- Vector matches = null;
- int length = 0;
-
- // first, see if any prefixes match.
- for (Enumeration e = delegations.keys ();
- e.hasMoreElements ();
- /* NOP */) {
- String prefix = (String) e.nextElement ();
-
- if (!id.startsWith (prefix))
- continue;
- if (matches == null)
- matches = new Vector ();
-
- // maintain in longer->shorter sorted order
- // NOTE: assumes not many matches will fire!
- int index;
-
- for (index = 0; index < length; index++) {
- String temp = (String) matches.elementAt (index);
- if (prefix.length () > temp.length ()) {
- matches.insertElementAt (prefix, index);
- break;
- }
- }
- if (index == length)
- matches.addElement (prefix);
- length++;
- }
- if (matches == null)
- return null;
-
- // now we know the list of catalogs to replace our "top level"
- // list ... we use it here, rather than somehow going back and
- // restarting, since this helps avoid reading most catalogs.
- // this assumes stackspace won't be a problem.
- for (int i = 0; i < length; i++) {
- Catalog catalog = null;
- InputSource result;
-
- // get this catalog. we may not have read it yet.
- synchronized (delegations) {
- Object prefix = matches.elementAt (i);
- Object cat = delegations.get (prefix);
-
- if (cat instanceof Catalog)
- catalog = (Catalog) cat;
- else {
- try {
- // load and cache that catalog
- catalog = loadCatalog (parserClass, eh,
- (String) cat, unified);
- delegations.put (prefix, catalog);
- } catch (SAXException e) {
- // must ignore, says the OASIS spec
- } catch (IOException e) {
- // same applies here
- }
- }
- }
-
- // ignore failed loads, and proceed
- if (catalog == null)
- continue;
-
- // we have a catalog ... resolve!
- // usingPublic value can't matter, there's no choice
- result = catalog.resolve (true, publicId, systemId);
- if (result != null)
- return result;
- }
-
- // if there were no successes, the entire
- // lookup failed (all the way to top level)
- throw new DoneDelegation ();
- }
- }
-
-
- /** This is the namespace URI used for OASIS XML Catalogs. */
- private static final String catalogNamespace =
- "urn:oasis:names:tc:entity:xmlns:xml:catalog";
-
-
- /**
- * Loads/unmarshals one catalog.
- */
- private static class Loader extends DefaultHandler2
- {
- private boolean preInterned;
- private ErrorHandler handler;
- private boolean unified;
- private int ignoreDepth;
- private Locator locator;
- private boolean started;
- private Hashtable externals;
- private Stack bases;
-
- Catalog cat = new Catalog ();
-
-
- /**
- * Constructor.
- * @param flag true iff the parser already interns strings.
- * @param eh Errors and warnings are delegated to this.
- * @param unified true keeps one table for URI mappings;
- * false matches OASIS spec, storing mappings
- * for URIs and SYSTEM ids in parallel tables.
- */
- Loader (boolean flag, ErrorHandler eh, boolean unified)
- {
- preInterned = flag;
- handler = eh;
- this.unified = unified;
- cat.unified = unified;
- cat.eh = eh;
- }
-
-
- // strips out fragments
- private String nofrag (String uri)
- throws SAXException
- {
- if (uri.indexOf ('#') != -1) {
- warn ("URI with fragment: " + uri);
- uri = uri.substring (0, uri.indexOf ('#'));
- }
- return uri;
- }
-
- // absolutizes relative URIs
- private String absolutize (String uri)
- throws SAXException
- {
- // avoid creating URLs if they're already absolutized,
- // or if the URI is already using a known scheme
- if (uri.startsWith ("file:/")
- || uri.startsWith ("http:/")
- || uri.startsWith ("https:/")
- || uri.startsWith ("ftp:/")
- || uri.startsWith ("urn:")
- )
- return uri;
-
- // otherwise, let's hope the JDK handles this URI scheme.
- try {
- URL base = (URL) bases.peek ();
- return new URL (base, uri).toString ();
- } catch (Exception e) {
- fatal ("can't absolutize URI: " + uri);
- return null;
- }
- }
-
- // recoverable error
- private void error (String message)
- throws SAXException
- {
- if (handler == null)
- return;
- handler.error (new SAXParseException (message, locator));
- }
-
- // nonrecoverable error
- private void fatal (String message)
- throws SAXException
- {
- SAXParseException spe;
-
- spe = new SAXParseException (message, locator);
- if (handler != null)
- handler.fatalError (spe);
- throw spe;
- }
-
- // low severity problem
- private void warn (String message)
- throws SAXException
- {
- if (handler == null)
- return;
- handler.warning (new SAXParseException (message, locator));
- }
-
- // callbacks:
-
- public void setDocumentLocator (Locator l)
- { locator = l; }
-
- public void startDocument ()
- throws SAXException
- {
- if (locator == null)
- error ("no locator!");
- bases = new Stack ();
- String uri = locator.getSystemId ();
- try {
- bases.push (new URL (uri));
- } catch (IOException e) {
- fatal ("bad document base URI: " + uri);
- }
- }
-
- public void endDocument ()
- throws SAXException
- {
- try {
- if (!started)
- error ("not a catalog!");
- } finally {
- locator = null;
- handler = null;
- externals = null;
- bases = null;
- }
- }
-
- // XML Base support for external entities.
-
- // NOTE: expects parser is in default "resolve-dtd-uris" mode.
- public void externalEntityDecl (String name, String pub, String sys)
- throws SAXException
- {
- if (externals == null)
- externals = new Hashtable ();
- if (externals.get (name) == null)
- externals.put (name, pub);
- }
-
- public void startEntity (String name)
- throws SAXException
- {
- if (externals == null)
- return;
- String uri = (String) externals.get (name);
-
- // NOTE: breaks if an EntityResolver substitutes these URIs.
- // If toplevel loader supports one, must intercept calls...
- if (uri != null) {
- try {
- bases.push (new URL (uri));
- } catch (IOException e) {
- fatal ("entity '" + name + "', bad URI: " + uri);
- }
- }
- }
-
- public void endEntity (String name)
- {
- if (externals == null)
- return;
- String value = (String) externals.get (name);
-
- if (value != null)
- bases.pop ();
- }
-
- /**
- * Processes catalog elements, saving their data.
- */
- public void startElement (String namespace, String local,
- String qName, Attributes atts)
- throws SAXException
- {
- // must ignore non-catalog elements, and their contents
- if (ignoreDepth != 0 || !catalogNamespace.equals (namespace)) {
- ignoreDepth++;
- return;
- }
-
- // basic sanity checks
- if (!preInterned)
- local = local.intern ();
- if (!started) {
- started = true;
- if ("catalog" != local)
- fatal ("root element not 'catalog': " + local);
- }
-
- // Handle any xml:base attribute
- String xmlbase = atts.getValue ("xml:base");
-
- if (xmlbase != null) {
- URL base = (URL) bases.peek ();
- try {
- base = new URL (base, xmlbase);
- } catch (IOException e) {
- fatal ("can't resolve xml:base attribute: " + xmlbase);
- }
- bases.push (base);
- } else
- bases.push (bases.peek ());
-
- // fetch multi-element attributes, apply standard tweaks
- // values (uri, catalog, rewritePrefix) get normalized too,
- // as a precaution and since we may compare the values
- String catalog = atts.getValue ("catalog");
- if (catalog != null)
- catalog = normalizeURI (absolutize (catalog));
-
- String rewritePrefix = atts.getValue ("rewritePrefix");
- if (rewritePrefix != null)
- rewritePrefix = normalizeURI (absolutize (rewritePrefix));
-
- String systemIdStartString;
- systemIdStartString = atts.getValue ("systemIdStartString");
- if (systemIdStartString != null) {
- systemIdStartString = normalizeURI (systemIdStartString);
- // unmatchable <rewriteSystemId>, <delegateSystemId> elements
- if (systemIdStartString.startsWith ("urn:publicid:")) {
- error ("systemIdStartString is really a publicId!!");
- return;
- }
- }
-
- String uri = atts.getValue ("uri");
- if (uri != null)
- uri = normalizeURI (absolutize (uri));
-
- String uriStartString;
- uriStartString = atts.getValue ("uriStartString");
- if (uriStartString != null) {
- uriStartString = normalizeURI (uriStartString);
- // unmatchable <rewriteURI>, <delegateURI> elements
- if (uriStartString.startsWith ("urn:publicid:")) {
- error ("uriStartString is really a publicId!!");
- return;
- }
- }
-
- // strictly speaking "group" and "catalog" shouldn't nest
- // ... arbitrary restriction, no evident motivation
-
-// FIXME stack "prefer" settings (two elements only!) and use
-// them to populate different public mapping/delegation tables
-
- if ("catalog" == local || "group" == local) {
- String prefer = atts.getValue ("prefer");
-
- if (prefer != null && !"public".equals (prefer)) {
- if (!"system".equals (prefer)) {
- error ("in <" + local + " ... prefer='...'>, "
- + "assuming 'public'");
- prefer = "public";
- }
- }
- if (prefer != null) {
- if ("catalog" == local) {
- cat.hasPreference = true;
- cat.usingPublic = "public".equals (prefer);
- } else {
- if (!cat.hasPreference || cat.usingPublic
- != "public".equals (prefer)) {
-fatal ("<group prefer=...> case not handled");
- }
- }
- } else if ("group" == local && cat.hasPreference) {
-fatal ("<group prefer=...> case not handled");
- }
-
- //
- // PUBLIC ids: cleanly set up for id substitution
- //
- } else if ("public" == local) {
- String publicId = atts.getValue ("publicId");
- String value = null;
-
- if (publicId == null || uri == null) {
- error ("expecting <public publicId=... uri=.../>");
- return;
- }
- publicId = normalizePublicId (true, publicId);
- uri = nofrag (uri);
- if (cat.publicIds == null)
- cat.publicIds = new Hashtable ();
- else
- value = (String) cat.publicIds.get (publicId);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <public...> entry for " + publicId);
- } else
- cat.publicIds.put (publicId, uri);
-
- } else if ("delegatePublic" == local) {
- String publicIdStartString;
- Object value = null;
-
- publicIdStartString = atts.getValue ("publicIdStartString");
- if (publicIdStartString == null || catalog == null) {
- error ("expecting <delegatePublic "
- + "publicIdStartString=... catalog=.../>");
- return;
- }
- publicIdStartString = normalizePublicId (true,
- publicIdStartString);
- if (cat.publicDelegations == null)
- cat.publicDelegations = new Hashtable ();
- else
- value = cat.publicDelegations.get (publicIdStartString);
- if (value != null) {
- if (!value.equals (catalog))
- warn ("ignoring <delegatePublic...> entry for "
- + uriStartString);
- } else
- cat.publicDelegations.put (publicIdStartString, catalog);
-
-
- //
- // SYSTEM ids: need substitution due to operational issues
- //
- } else if ("system" == local) {
- String systemId = atts.getValue ("systemId");
- String value = null;
-
- if (systemId == null || uri == null) {
- error ("expecting <system systemId=... uri=.../>");
- return;
- }
- systemId = normalizeURI (systemId);
- uri = nofrag (uri);
- if (systemId.startsWith ("urn:publicid:")) {
- error ("systemId is really a publicId!!");
- return;
- }
- if (cat.systemIds == null) {
- cat.systemIds = new Hashtable ();
- if (unified)
- cat.uris = cat.systemIds;
- } else
- value = (String) cat.systemIds.get (systemId);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <system...> entry for " + systemId);
- } else
- cat.systemIds.put (systemId, uri);
-
- } else if ("rewriteSystem" == local) {
- String value = null;
-
- if (systemIdStartString == null || rewritePrefix == null
- || systemIdStartString.length () == 0
- || rewritePrefix.length () == 0
- ) {
- error ("expecting <rewriteSystem "
- + "systemIdStartString=... rewritePrefix=.../>");
- return;
- }
- if (cat.systemRewrites == null) {
- cat.systemRewrites = new Hashtable ();
- if (unified)
- cat.uriRewrites = cat.systemRewrites;
- } else
- value = (String) cat.systemRewrites.get (
- systemIdStartString);
- if (value != null) {
- if (!value.equals (rewritePrefix))
- warn ("ignoring <rewriteSystem...> entry for "
- + systemIdStartString);
- } else
- cat.systemRewrites.put (systemIdStartString,
- rewritePrefix);
-
- } else if ("delegateSystem" == local) {
- Object value = null;
-
- if (systemIdStartString == null || catalog == null) {
- error ("expecting <delegateSystem "
- + "systemIdStartString=... catalog=.../>");
- return;
- }
- if (cat.systemDelegations == null) {
- cat.systemDelegations = new Hashtable ();
- if (unified)
- cat.uriDelegations = cat.systemDelegations;
- } else
- value = cat.systemDelegations.get (systemIdStartString);
- if (value != null) {
- if (!value.equals (catalog))
- warn ("ignoring <delegateSystem...> entry for "
- + uriStartString);
- } else
- cat.systemDelegations.put (systemIdStartString, catalog);
-
-
- //
- // URI: just like "system" ID support, except that
- // fragment IDs are disallowed in "system" elements.
- //
- } else if ("uri" == local) {
- String name = atts.getValue ("name");
- String value = null;
-
- if (name == null || uri == null) {
- error ("expecting <uri name=... uri=.../>");
- return;
- }
- if (name.startsWith ("urn:publicid:")) {
- error ("name is really a publicId!!");
- return;
- }
- name = normalizeURI (name);
- if (cat.uris == null) {
- cat.uris = new Hashtable ();
- if (unified)
- cat.systemIds = cat.uris;
- } else
- value = (String) cat.uris.get (name);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <uri...> entry for " + name);
- } else
- cat.uris.put (name, uri);
-
- } else if ("rewriteURI" == local) {
- String value = null;
-
- if (uriStartString == null || rewritePrefix == null
- || uriStartString.length () == 0
- || rewritePrefix.length () == 0
- ) {
- error ("expecting <rewriteURI "
- + "uriStartString=... rewritePrefix=.../>");
- return;
- }
- if (cat.uriRewrites == null) {
- cat.uriRewrites = new Hashtable ();
- if (unified)
- cat.systemRewrites = cat.uriRewrites;
- } else
- value = (String) cat.uriRewrites.get (uriStartString);
- if (value != null) {
- if (!value.equals (rewritePrefix))
- warn ("ignoring <rewriteURI...> entry for "
- + uriStartString);
- } else
- cat.uriRewrites.put (uriStartString, rewritePrefix);
-
- } else if ("delegateURI" == local) {
- Object value = null;
-
- if (uriStartString == null || catalog == null) {
- error ("expecting <delegateURI "
- + "uriStartString=... catalog=.../>");
- return;
- }
- if (cat.uriDelegations == null) {
- cat.uriDelegations = new Hashtable ();
- if (unified)
- cat.systemDelegations = cat.uriDelegations;
- } else
- value = cat.uriDelegations.get (uriStartString);
- if (value != null) {
- if (!value.equals (catalog))
- warn ("ignoring <delegateURI...> entry for "
- + uriStartString);
- } else
- cat.uriDelegations.put (uriStartString, catalog);
-
- //
- // NON-DELEGATING approach to modularity
- //
- } else if ("nextCatalog" == local) {
- if (catalog == null) {
- error ("expecting <nextCatalog catalog=.../>");
- return;
- }
- if (cat.next == null)
- cat.next = new Vector ();
- cat.next.addElement (catalog);
-
- //
- // EXTENSIONS from appendix E
- //
- } else if ("doctype" == local) {
- String name = atts.getValue ("name");
- String value = null;
-
- if (name == null || uri == null) {
- error ("expecting <doctype name=... uri=.../>");
- return;
- }
- name = normalizeURI (name);
- if (cat.doctypes == null)
- cat.doctypes = new Hashtable ();
- else
- value = (String) cat.doctypes.get (name);
- if (value != null) {
- if (!value.equals (uri))
- warn ("ignoring <doctype...> entry for "
- + uriStartString);
- } else
- cat.doctypes.put (name, uri);
-
-
- //
- // RESERVED ... ignore (like reserved attributes) but warn
- //
- } else {
- warn ("ignoring unknown catalog element: " + local);
- ignoreDepth++;
- }
- }
-
- public void endElement (String uri, String local, String qName)
- throws SAXException
- {
- if (ignoreDepth != 0)
- ignoreDepth--;
- else
- bases.pop ();
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/XHTMLWriter.java b/external/jaxp/source/gnu/xml/util/XHTMLWriter.java
deleted file mode 100644
index 826acc3d0..000000000
--- a/external/jaxp/source/gnu/xml/util/XHTMLWriter.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.util;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-
-/**
- * This extends XMLWriter to create a class which defaults to writing
- * XHTML text, preferring the US-ASCII encoding. It adds no unique
- * functionality, only changing the defaults slightly to simplify writing
- * XHTML processing components by providing a bean class whose properties
- * have more convenient defaults. An artifact of using the US-ASCII
- * encoding is that no XML declaration is written, so that HTML tools
- * that can't accept them will not become confused. Components can treat
- * the output as UTF-8, ISO-8859-1, or US-ASCII without incurring any
- * data loss.
- *
- * @author David Brownell
- */
-public class XHTMLWriter extends XMLWriter
-{
- /**
- * Constructs this handler with System.out used to write
- * SAX events using the US-ASCII encoding, as XHTML.
- */
- public XHTMLWriter ()
- throws IOException
- {
- this (System.out);
- }
-
- /**
- * Constructs this handler such that the specified output stream
- * is used to write SAX events in the US-ASCII encoding, as XHTML.
- *
- * @param out Where US-ASCII encoding of the stream of SAX
- * events will be sent.
- */
- public XHTMLWriter (OutputStream out)
- throws IOException
- {
- // not all JVMs understand "ASCII" as an encoding name, so
- // we use 8859_1 (they all seem to handle that one) and
- // make the echo handler filter out non-ASCII characters
- this (new OutputStreamWriter (out, "8859_1"), "US-ASCII");
- }
-
- /**
- * Constructs this handler such that the specified output stream
- * is used to write SAX events as XHTML.
- *
- * @param out Where the stream of SAX events will be written.
- */
- public XHTMLWriter (Writer out)
- {
- this (out, null);
- }
-
- /**
- * Constructs this handler such that the specified output stream
- * is used to write SAX events as XHTML, labeled with the specified
- * encoding.
- *
- * @param out Where the stream of SAX events will be written.
- * @param encoding If non-null, this names the encoding to be
- * placed in the encoding declaration.
- */
- public XHTMLWriter (Writer out, String encoding)
- {
- super (out, encoding);
- setXhtml (true);
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/XMLWriter.java b/external/jaxp/source/gnu/xml/util/XMLWriter.java
deleted file mode 100644
index 897c13991..000000000
--- a/external/jaxp/source/gnu/xml/util/XMLWriter.java
+++ /dev/null
@@ -1,1916 +0,0 @@
-/*
- * Copyright (C) 1999-2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package gnu.xml.util;
-
-import java.io.BufferedWriter;
-import java.io.CharConversionException;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.Stack;
-
-import org.xml.sax.*;
-import org.xml.sax.ext.*;
-import org.xml.sax.helpers.*;
-
-
-/**
- * This class is a SAX handler which writes all its input as a well formed
- * XML or XHTML document. If driven using SAX2 events, this output may
- * include a recreated document type declaration, subject to limitations
- * of SAX (no internal subset exposed) or DOM (the important declarations,
- * with their documentation, are discarded).
- *
- * <p> By default, text is generated "as-is", but some optional modes
- * are supported. Pretty-printing is supported, to make life easier
- * for people reading the output. XHTML (1.0) output has can be made
- * particularly pretty; all the built-in character entities are known.
- * Canonical XML can also be generated, assuming the input is properly
- * formed.
- *
- * <hr>
- *
- * <p> Some of the methods on this class are intended for applications to
- * use directly, rather than as pure SAX2 event callbacks. Some of those
- * methods access the JavaBeans properties (used to tweak output formats,
- * for example canonicalization and pretty printing). Subclasses
- * are expected to add new behaviors, not to modify current behavior, so
- * many such methods are final.</p>
- *
- * <p> The <em>write*()</em> methods may be slightly simpler for some
- * applications to use than direct callbacks. For example, they support
- * a simple policy for encoding data items as the content of a single element.
- *
- * <p> To reuse an XMLWriter you must provide it with a new Writer, since
- * this handler closes the writer it was given as part of its endDocument()
- * handling. (XML documents have an end of input, and the way to encode
- * that on a stream is to close it.) </p>
- *
- * <hr>
- *
- * <p> Note that any relative URIs in the source document, as found in
- * entity and notation declarations, ought to have been fully resolved by
- * the parser providing events to this handler. This means that the
- * output text should only have fully resolved URIs, which may not be
- * the desired behavior in cases where later binding is desired. </p>
- *
- * <p> <em>Note that due to SAX2 defaults, you may need to manually
- * ensure that the input events are XML-conformant with respect to namespace
- * prefixes and declarations. {@link gnu.xml.pipeline.NSFilter} is
- * one solution to this problem, in the context of processing pipelines.</em>
- * Something as simple as connecting this handler to a parser might not
- * generate the correct output. Another workaround is to ensure that the
- * <em>namespace-prefixes</em> feature is always set to true, if you're
- * hooking this directly up to some XMLReader implementation.
- *
- * @see gnu.xml.pipeline.TextConsumer
- *
- * @author David Brownell
- */
-public class XMLWriter
- implements ContentHandler, LexicalHandler, DTDHandler, DeclHandler
-{
- // text prints/escapes differently depending on context
- // CTX_ENTITY ... entity literal value
- // CTX_ATTRIBUTE ... attribute literal value
- // CTX_CONTENT ... content of an element
- // CTX_UNPARSED ... CDATA, comment, PI, names, etc
- // CTX_NAME ... name or nmtoken, no escapes possible
- private static final int CTX_ENTITY = 1;
- private static final int CTX_ATTRIBUTE = 2;
- private static final int CTX_CONTENT = 3;
- private static final int CTX_UNPARSED = 4;
- private static final int CTX_NAME = 5;
-
-// FIXME: names (element, attribute, PI, notation, etc) are not
-// currently written out with range checks (escapeChars).
-// In non-XHTML, some names can't be directly written; panic!
-
- private static String sysEOL;
-
- static {
- try {
- sysEOL = System.getProperty ("line.separator", "\n");
-
- // don't use the system's EOL if it's illegal XML.
- if (!isLineEnd (sysEOL))
- sysEOL = "\n";
-
- } catch (SecurityException e) {
- sysEOL = "\n";
- }
- }
-
- private static boolean isLineEnd (String eol)
- {
- return "\n".equals (eol)
- || "\r".equals (eol)
- || "\r\n".equals (eol);
- }
-
- private Writer out;
- private boolean inCDATA;
- private int elementNestLevel;
- private String eol = sysEOL;
-
- private short dangerMask;
- private StringBuffer stringBuf;
- private Locator locator;
- private ErrorHandler errHandler;
-
- private boolean expandingEntities = false;
- private int entityNestLevel;
- private boolean xhtml;
- private boolean startedDoctype;
- private String encoding;
-
- private boolean canonical;
- private boolean inDoctype;
- private boolean inEpilogue;
-
- // pretty printing controls
- private boolean prettyPrinting;
- private int column;
- private boolean noWrap;
- private Stack space = new Stack ();
-
- // this is not a hard'n'fast rule -- longer lines are OK,
- // but are to be avoided. Here, prettyprinting is more to
- // show structure "cleanly" than to be precise about it.
- // better to have ragged layout than one line 24Kb long.
- private static final int lineLength = 75;
-
-
- /**
- * Constructs this handler with System.out used to write SAX events
- * using the UTF-8 encoding. Avoid using this except when you know
- * it's safe to close System.out at the end of the document.
- */
- public XMLWriter () throws IOException
- { this (System.out); }
-
- /**
- * Constructs a handler which writes all input to the output stream
- * in the UTF-8 encoding, and closes it when endDocument is called.
- * (Yes it's annoying that this throws an exception -- but there's
- * really no way around it, since it's barely possible a JDK may
- * exist somewhere that doesn't know how to emit UTF-8.)
- */
- public XMLWriter (OutputStream out) throws IOException
- {
- this (new OutputStreamWriter (out, "UTF8"));
- }
-
- /**
- * Constructs a handler which writes all input to the writer, and then
- * closes the writer when the document ends. If an XML declaration is
- * written onto the output, and this class can determine the name of
- * the character encoding for this writer, that encoding name will be
- * included in the XML declaration.
- *
- * <P> See the description of the constructor which takes an encoding
- * name for imporant information about selection of encodings.
- *
- * @param writer XML text is written to this writer.
- */
- public XMLWriter (Writer writer)
- {
- this (writer, null);
- }
-
- /**
- * Constructs a handler which writes all input to the writer, and then
- * closes the writer when the document ends. If an XML declaration is
- * written onto the output, this class will use the specified encoding
- * name in that declaration. If no encoding name is specified, no
- * encoding name will be declared unless this class can otherwise
- * determine the name of the character encoding for this writer.
- *
- * <P> At this time, only the UTF-8 ("UTF8") and UTF-16 ("Unicode")
- * output encodings are fully lossless with respect to XML data. If you
- * use any other encoding you risk having your data be silently mangled
- * on output, as the standard Java character encoding subsystem silently
- * maps non-encodable characters to a question mark ("?") and will not
- * report such errors to applications.
- *
- * <p> For a few other encodings the risk can be reduced. If the writer is
- * a java.io.OutputStreamWriter, and uses either the ISO-8859-1 ("8859_1",
- * "ISO8859_1", etc) or US-ASCII ("ASCII") encodings, content which
- * can't be encoded in those encodings will be written safely. Where
- * relevant, the XHTML entity names will be used; otherwise, numeric
- * character references will be emitted.
- *
- * <P> However, there remain a number of cases where substituting such
- * entity or character references is not an option. Such references are
- * not usable within a DTD, comment, PI, or CDATA section. Neither may
- * they be used when element, attribute, entity, or notation names have
- * the problematic characters.
- *
- * @param writer XML text is written to this writer.
- * @param encoding if non-null, and an XML declaration is written,
- * this is the name that will be used for the character encoding.
- */
- public XMLWriter (Writer writer, String encoding)
- {
- setWriter (writer, encoding);
- }
-
- private void setEncoding (String encoding)
- {
- if (encoding == null && out instanceof OutputStreamWriter)
- encoding = ((OutputStreamWriter)out).getEncoding ();
-
- if (encoding != null) {
- encoding = encoding.toUpperCase ();
-
- // Use official encoding names where we know them,
- // avoiding the Java-only names. When using common
- // encodings where we can easily tell if characters
- // are out of range, we'll escape out-of-range
- // characters using character refs for safety.
-
- // I _think_ these are all the main synonyms for these!
- if ("UTF8".equals (encoding)) {
- encoding = "UTF-8";
- } else if ("US-ASCII".equals (encoding)
- || "ASCII".equals (encoding)) {
- dangerMask = (short) 0xff80;
- encoding = "US-ASCII";
- } else if ("ISO-8859-1".equals (encoding)
- || "8859_1".equals (encoding)
- || "ISO8859_1".equals (encoding)) {
- dangerMask = (short) 0xff00;
- encoding = "ISO-8859-1";
- } else if ("UNICODE".equals (encoding)
- || "UNICODE-BIG".equals (encoding)
- || "UNICODE-LITTLE".equals (encoding)) {
- encoding = "UTF-16";
-
- // TODO: UTF-16BE, UTF-16LE ... no BOM; what
- // release of JDK supports those Unicode names?
- }
-
- if (dangerMask != 0)
- stringBuf = new StringBuffer ();
- }
-
- this.encoding = encoding;
- }
-
-
- /**
- * Resets the handler to write a new text document.
- *
- * @param writer XML text is written to this writer.
- * @param encoding if non-null, and an XML declaration is written,
- * this is the name that will be used for the character encoding.
- *
- * @exception IllegalStateException if the current
- * document hasn't yet ended (with {@link #endDocument})
- */
- final public void setWriter (Writer writer, String encoding)
- {
- if (out != null)
- throw new IllegalStateException (
- "can't change stream in mid course");
- out = writer;
- if (out != null)
- setEncoding (encoding);
- if (!(out instanceof BufferedWriter))
- out = new BufferedWriter (out);
- space.push ("default");
- }
-
- /**
- * Assigns the line ending style to be used on output.
- * @param eolString null to use the system default; else
- * "\n", "\r", or "\r\n".
- */
- final public void setEOL (String eolString)
- {
- if (eolString == null)
- eol = sysEOL;
- else if (!isLineEnd (eolString))
- eol = eolString;
- else
- throw new IllegalArgumentException (eolString);
- }
-
- /**
- * Assigns the error handler to be used to present most fatal
- * errors.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- errHandler = handler;
- }
-
- /**
- * Used internally and by subclasses, this encapsulates the logic
- * involved in reporting fatal errors. It uses locator information
- * for good diagnostics, if available, and gives the application's
- * ErrorHandler the opportunity to handle the error before throwing
- * an exception.
- */
- protected void fatal (String message, Exception e)
- throws SAXException
- {
- SAXParseException x;
-
- if (locator == null)
- x = new SAXParseException (message, null, null, -1, -1, e);
- else
- x = new SAXParseException (message, locator, e);
- if (errHandler != null)
- errHandler.fatalError (x);
- throw x;
- }
-
-
- // JavaBeans properties
-
- /**
- * Controls whether the output should attempt to follow the "transitional"
- * XHTML rules so that it meets the "HTML Compatibility Guidelines"
- * appendix in the XHTML specification. A "transitional" Document Type
- * Declaration (DTD) is placed near the beginning of the output document,
- * instead of whatever DTD would otherwise have been placed there, and
- * XHTML empty elements are printed specially. When writing text in
- * US-ASCII or ISO-8859-1 encodings, the predefined XHTML internal
- * entity names are used (in preference to character references) when
- * writing content characters which can't be expressed in those encodings.
- *
- * <p> When this option is enabled, it is the caller's responsibility
- * to ensure that the input is otherwise valid as XHTML. Things to
- * be careful of in all cases, as described in the appendix referenced
- * above, include: <ul>
- *
- * <li> Element and attribute names must be in lower case, both
- * in the document and in any CSS style sheet.
- * <li> All XML constructs must be valid as defined by the XHTML
- * "transitional" DTD (including all familiar constructs,
- * even deprecated ones).
- * <li> The root element must be "html".
- * <li> Elements that must be empty (such as <em>&lt;br&gt;</em>
- * must have no content.
- * <li> Use both <em>lang</em> and <em>xml:lang</em> attributes
- * when specifying language.
- * <li> Similarly, use both <em>id</em> and <em>name</em> attributes
- * when defining elements that may be referred to through
- * URI fragment identifiers ... and make sure that the
- * value is a legal NMTOKEN, since not all such HTML 4.0
- * identifiers are valid in XML.
- * <li> Be careful with character encodings; make sure you provide
- * a <em>&lt;meta http-equiv="Content-type"
- * content="text/xml;charset=..." /&gt;</em> element in
- * the HTML "head" element, naming the same encoding
- * used to create this handler. Also, if that encoding
- * is anything other than US-ASCII, make sure that if
- * the document is given a MIME content type, it has
- * a <em>charset=...</em> attribute with that encoding.
- * </ul>
- *
- * <p> Additionally, some of the oldest browsers have additional
- * quirks, to address with guidelines such as: <ul>
- *
- * <li> Processing instructions may be rendered, so avoid them.
- * (Similarly for an XML declaration.)
- * <li> Embedded style sheets and scripts should not contain XML
- * markup delimiters: &amp;, &lt;, and ]]&gt; are trouble.
- * <li> Attribute values should not have line breaks or multiple
- * consecutive white space characters.
- * <li> Use no more than one of the deprecated (transitional)
- * <em>&lt;isindex&gt;</em> elements.
- * <li> Some boolean attributes (such as <em>compact, checked,
- * disabled, readonly, selected,</em> and more) confuse
- * some browsers, since they only understand minimized
- * versions which are illegal in XML.
- * </ul>
- *
- * <p> Also, some characteristics of the resulting output may be
- * a function of whether the document is later given a MIME
- * content type of <em>text/html</em> rather than one indicating
- * XML (<em>application/xml</em> or <em>text/xml</em>). Worse,
- * some browsers ignore MIME content types and prefer to rely URI
- * name suffixes -- so an "index.xml" could always be XML, never
- * XHTML, no matter its MIME type.
- */
- final public void setXhtml (boolean value)
- {
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- xhtml = value;
- if (xhtml)
- canonical = false;
- }
-
- /**
- * Returns true if the output attempts to echo the input following
- * "transitional" XHTML rules and matching the "HTML Compatibility
- * Guidelines" so that an HTML version 3 browser can read the output
- * as HTML; returns false (the default) othewise.
- */
- final public boolean isXhtml ()
- {
- return xhtml;
- }
-
- /**
- * Controls whether the output text contains references to
- * entities (the default), or instead contains the expanded
- * values of those entities.
- */
- final public void setExpandingEntities (boolean value)
- {
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- expandingEntities = value;
- if (!expandingEntities)
- canonical = false;
- }
-
- /**
- * Returns true if the output will have no entity references;
- * returns false (the default) otherwise.
- */
- final public boolean isExpandingEntities ()
- {
- return expandingEntities;
- }
-
- /**
- * Controls pretty-printing, which by default is not enabled
- * (and currently is most useful for XHTML output).
- * Pretty printing enables structural indentation, sorting of attributes
- * by name, line wrapping, and potentially other mechanisms for making
- * output more or less readable.
- *
- * <p> At this writing, structural indentation and line wrapping are
- * enabled when pretty printing is enabled and the <em>xml:space</em>
- * attribute has the value <em>default</em> (its other legal value is
- * <em>preserve</em>, as defined in the XML specification). The three
- * XHTML element types which use another value are recognized by their
- * names (namespaces are ignored).
- *
- * <p> Also, for the record, the "pretty" aspect of printing here
- * is more to provide basic structure on outputs that would otherwise
- * risk being a single long line of text. For now, expect the
- * structure to be ragged ... unless you'd like to submit a patch
- * to make this be more strictly formatted!
- *
- * @exception IllegalStateException thrown if this method is invoked
- * after output has begun.
- */
- final public void setPrettyPrinting (boolean value)
- {
- if (locator != null)
- throw new IllegalStateException ("started parsing");
- prettyPrinting = value;
- if (prettyPrinting)
- canonical = false;
- }
-
- /**
- * Returns value of flag controlling pretty printing.
- */
- final public boolean isPrettyPrinting ()
- {
- return prettyPrinting;
- }
-
-
- /**
- * Sets the output style to be canonicalized. Input events must
- * meet requirements that are slightly more stringent than the
- * basic well-formedness ones, and include: <ul>
- *
- * <li> Namespace prefixes must not have been changed from those
- * in the original document. (This may only be ensured by setting
- * the SAX2 XMLReader <em>namespace-prefixes</em> feature flag;
- * by default, it is cleared.)
- *
- * <li> Redundant namespace declaration attributes have been
- * removed. (If an ancestor element defines a namespace prefix
- * and that declaration hasn't been overriden, an element must
- * not redeclare it.)
- *
- * <li> If comments are not to be included in the canonical output,
- * they must first be removed from the input event stream; this
- * <em>Canonical XML with comments</em> by default.
- *
- * <li> If the input character encoding was not UCS-based, the
- * character data must have been normalized using Unicode
- * Normalization Form C. (UTF-8 and UTF-16 are UCS-based.)
- *
- * <li> Attribute values must have been normalized, as is done
- * by any conformant XML processor which processes all external
- * parameter entities.
- *
- * <li> Similarly, attribute value defaulting has been performed.
- *
- * </ul>
- *
- * <p> Note that fragments of XML documents, as specified by an XPath
- * node set, may be canonicalized. In such cases, elements may need
- * some fixup (for <em>xml:*</em> attributes and application-specific
- * context).
- *
- * @exception IllegalArgumentException if the output encoding
- * is anything other than UTF-8.
- */
- final public void setCanonical (boolean value)
- {
- if (value && !"UTF-8".equals (encoding))
- throw new IllegalArgumentException ("encoding != UTF-8");
- canonical = value;
- if (canonical) {
- prettyPrinting = xhtml = false;
- expandingEntities = true;
- eol = "\n";
- }
- }
-
-
- /**
- * Returns value of flag controlling canonical output.
- */
- final public boolean isCanonical ()
- {
- return canonical;
- }
-
-
- /**
- * Flushes the output stream. When this handler is used in long lived
- * pipelines, it can be important to flush buffered state, for example
- * so that it can reach the disk as part of a state checkpoint.
- */
- final public void flush ()
- throws IOException
- {
- if (out != null)
- out.flush ();
- }
-
-
- // convenience routines
-
-// FIXME: probably want a subclass that holds a lot of these...
-// and maybe more!
-
- /**
- * Writes the string as if characters() had been called on the contents
- * of the string. This is particularly useful when applications act as
- * producers and write data directly to event consumers.
- */
- final public void write (String data)
- throws SAXException
- {
- char buf [] = data.toCharArray ();
- characters (buf, 0, buf.length);
- }
-
-
- /**
- * Writes an element that has content consisting of a single string.
- * @see #writeEmptyElement
- * @see #startElement
- */
- public void writeElement (
- String uri,
- String localName,
- String qName,
- Attributes atts,
- String content
- ) throws SAXException
- {
- if (content == null || content.length () == 0) {
- writeEmptyElement (uri, localName, qName, atts);
- return;
- }
- startElement (uri, localName, qName, atts);
- char chars [] = content.toCharArray ();
- characters (chars, 0, chars.length);
- endElement (uri, localName, qName);
- }
-
-
- /**
- * Writes an element that has content consisting of a single integer,
- * encoded as a decimal string.
- * @see #writeEmptyElement
- * @see #startElement
- */
- public void writeElement (
- String uri,
- String localName,
- String qName,
- Attributes atts,
- int content
- ) throws SAXException
- {
- writeElement (uri, localName, qName, atts, Integer.toString (content));
- }
-
-
- // SAX1 ContentHandler
- /** <b>SAX1</b>: provides parser status information */
- final public void setDocumentLocator (Locator l)
- {
- locator = l;
- }
-
-
- // URL for dtd that validates against all normal HTML constructs
- private static final String xhtmlFullDTD =
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
-
-
- /**
- * <b>SAX1</b>: indicates the beginning of a document parse.
- * If you're writing (well formed) fragments of XML, neither
- * this nor endDocument should be called.
- */
- // NOT final
- public void startDocument ()
- throws SAXException
- {
- try {
- if (out == null)
- throw new IllegalStateException (
- "null Writer given to XMLWriter");
-
- // Not all parsers provide the locator we want; this also
- // flags whether events are being sent to this object yet.
- // We could only have this one call if we only printed whole
- // documents ... but we also print fragments, so most of the
- // callbacks here replicate this test.
-
- if (locator == null)
- locator = new LocatorImpl ();
-
- // Unless the data is in US-ASCII or we're canonicalizing, write
- // the XML declaration if we know the encoding. US-ASCII won't
- // normally get mangled by web server confusion about the
- // character encodings used. Plus, it's an easy way to
- // ensure we can write ASCII that's unlikely to confuse
- // elderly HTML parsers.
-
- if (!canonical
- && dangerMask != (short) 0xff80
- && encoding != null) {
- rawWrite ("<?xml version='1.0'");
- rawWrite (" encoding='" + encoding + "'");
- rawWrite ("?>");
- newline ();
- }
-
- if (xhtml) {
-
- rawWrite ("<!DOCTYPE html PUBLIC");
- newline ();
- rawWrite (" '-//W3C//DTD XHTML 1.0 Transitional//EN'");
- newline ();
- rawWrite (" '");
- // NOTE: URL (above) matches the REC
- rawWrite (xhtmlFullDTD);
- rawWrite ("'>");
- newline ();
- newline ();
-
- // fake the rest of the handler into ignoring
- // everything until the root element, so any
- // XHTML DTD comments, PIs, etc are ignored
- startedDoctype = true;
- }
-
- entityNestLevel = 0;
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * <b>SAX1</b>: indicates the completion of a parse.
- * Note that all complete SAX event streams make this call, even
- * if an error is reported during a parse.
- */
- // NOT final
- public void endDocument ()
- throws SAXException
- {
- try {
- if (!canonical) {
- newline ();
- newline ();
- }
- out.close ();
- out = null;
- locator = null;
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // XHTML elements declared as EMPTY print differently
- final private static boolean isEmptyElementTag (String tag)
- {
- switch (tag.charAt (0)) {
- case 'a': return "area".equals (tag);
- case 'b': return "base".equals (tag)
- || "basefont".equals (tag)
- || "br".equals (tag);
- case 'c': return "col".equals (tag);
- case 'f': return "frame".equals (tag);
- case 'h': return "hr".equals (tag);
- case 'i': return "img".equals (tag)
- || "input".equals (tag)
- || "isindex".equals (tag);
- case 'l': return "link".equals (tag);
- case 'm': return "meta".equals (tag);
- case 'p': return "param".equals (tag);
- }
- return false;
- }
-
- private static boolean indentBefore (String tag)
- {
- // basically indent before block content
- // and within structure like tables, lists
- switch (tag.charAt (0)) {
- case 'a': return "applet".equals (tag);
- case 'b': return "body".equals (tag)
- || "blockquote".equals (tag);
- case 'c': return "center".equals (tag);
- case 'f': return "frame".equals (tag)
- || "frameset".equals (tag);
- case 'h': return "head".equals (tag);
- case 'm': return "meta".equals (tag);
- case 'o': return "object".equals (tag);
- case 'p': return "param".equals (tag)
- || "pre".equals (tag);
- case 's': return "style".equals (tag);
- case 't': return "title".equals (tag)
- || "td".equals (tag)
- || "th".equals (tag);
- }
- // ... but not inline elements like "em", "b", "font"
- return false;
- }
-
- private static boolean spaceBefore (String tag)
- {
- // blank line AND INDENT before certain structural content
- switch (tag.charAt (0)) {
- case 'h': return "h1".equals (tag)
- || "h2".equals (tag)
- || "h3".equals (tag)
- || "h4".equals (tag)
- || "h5".equals (tag)
- || "h6".equals (tag)
- || "hr".equals (tag);
- case 'l': return "li".equals (tag);
- case 'o': return "ol".equals (tag);
- case 'p': return "p".equals (tag);
- case 't': return "table".equals (tag)
- || "tr".equals (tag);
- case 'u': return "ul".equals (tag);
- }
- return false;
- }
-
- // XHTML DTDs say these three have xml:space="preserve"
- private static boolean spacePreserve (String tag)
- {
- return "pre".equals (tag)
- || "style".equals (tag)
- || "script".equals (tag);
- }
-
- /**
- * <b>SAX2</b>: ignored.
- */
- final public void startPrefixMapping (String prefix, String uri)
- {}
-
- /**
- * <b>SAX2</b>: ignored.
- */
- final public void endPrefixMapping (String prefix)
- {}
-
- private void writeStartTag (
- String name,
- Attributes atts,
- boolean isEmpty
- ) throws SAXException, IOException
- {
- rawWrite ('<');
- rawWrite (name);
-
- // write out attributes ... sorting is particularly useful
- // with output that's been heavily defaulted.
- if (atts != null && atts.getLength () != 0) {
-
- // Set up to write, with optional sorting
- int indices [] = new int [atts.getLength ()];
-
- for (int i= 0; i < indices.length; i++)
- indices [i] = i;
-
- // optionally sort
-
-// FIXME: canon xml demands xmlns nodes go first,
-// and sorting by URI first (empty first) then localname
-// it should maybe use a different sort
-
- if (canonical || prettyPrinting) {
-
- // insertion sort by attribute name
- for (int i = 1; i < indices.length; i++) {
- int n = indices [i], j;
- String s = atts.getQName (n);
-
- for (j = i - 1; j >= 0; j--) {
- if (s.compareTo (atts.getQName (indices [j]))
- >= 0)
- break;
- indices [j + 1] = indices [j];
- }
- indices [j + 1] = n;
- }
- }
-
- // write, sorted or no
- for (int i= 0; i < indices.length; i++) {
- String s = atts.getQName (indices [i]);
-
- if (s == null || "".equals (s))
- throw new IllegalArgumentException ("no XML name");
- rawWrite (" ");
- rawWrite (s);
- rawWrite ("=");
- writeQuotedValue (atts.getValue (indices [i]),
- CTX_ATTRIBUTE);
- }
- }
- if (isEmpty)
- rawWrite (" /");
- rawWrite ('>');
- }
-
- /**
- * <b>SAX2</b>: indicates the start of an element.
- * When XHTML is in use, avoid attribute values with
- * line breaks or multiple whitespace characters, since
- * not all user agents handle them correctly.
- */
- final public void startElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- startedDoctype = false;
-
- if (locator == null)
- locator = new LocatorImpl ();
-
- if (qName == null || "".equals (qName))
- throw new IllegalArgumentException ("no XML name");
-
- try {
- if (entityNestLevel != 0)
- return;
- if (prettyPrinting) {
- String whitespace = null;
-
- if (xhtml && spacePreserve (qName))
- whitespace = "preserve";
- else if (atts != null)
- whitespace = atts.getValue ("xml:space");
- if (whitespace == null)
- whitespace = (String) space.peek ();
- space.push (whitespace);
-
- if ("default".equals (whitespace)) {
- if (xhtml) {
- if (spaceBefore (qName)) {
- newline ();
- doIndent ();
- } else if (indentBefore (qName))
- doIndent ();
- // else it's inlined, modulo line length
- // FIXME: incrementing element nest level
- // for inlined elements causes ugliness
- } else
- doIndent ();
- }
- }
- elementNestLevel++;
- writeStartTag (qName, atts, xhtml && isEmptyElementTag (qName));
-
- if (xhtml) {
-// FIXME: if this is an XHTML "pre" element, turn
-// off automatic wrapping.
- }
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * Writes an empty element.
- * @see #startElement
- */
- public void writeEmptyElement (
- String uri,
- String localName,
- String qName,
- Attributes atts
- ) throws SAXException
- {
- if (canonical) {
- startElement (uri, localName, qName, atts);
- endElement (uri, localName, qName);
- } else {
- try {
- writeStartTag (qName, atts, true);
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
- }
-
-
- /** <b>SAX2</b>: indicates the end of an element */
- final public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (qName == null || "".equals (qName))
- throw new IllegalArgumentException ("no XML name");
-
- try {
- elementNestLevel--;
- if (entityNestLevel != 0)
- return;
- if (xhtml && isEmptyElementTag (qName))
- return;
- rawWrite ("</");
- rawWrite (qName);
- rawWrite ('>');
-
- if (prettyPrinting) {
- if (!space.empty ())
- space.pop ();
- else
- fatal ("stack discipline", null);
- }
- if (elementNestLevel == 0)
- inEpilogue = true;
-
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX1</b>: reports content characters */
- final public void characters (char ch [], int start, int length)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- try {
- if (entityNestLevel != 0)
- return;
- if (inCDATA) {
- escapeChars (ch, start, length, CTX_UNPARSED);
- } else {
- escapeChars (ch, start, length, CTX_CONTENT);
- }
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX1</b>: reports ignorable whitespace */
- final public void ignorableWhitespace (char ch [], int start, int length)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- try {
- if (entityNestLevel != 0)
- return;
- // don't forget to map NL to CRLF, CR, etc
- escapeChars (ch, start, length, CTX_CONTENT);
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * <b>SAX1</b>: reports a PI.
- * This doesn't check for illegal target names, such as "xml" or "XML",
- * or namespace-incompatible ones like "big:dog"; the caller is
- * responsible for ensuring those names are legal.
- */
- final public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- // don't print internal subset for XHTML
- if (xhtml && startedDoctype)
- return;
-
- // ancient HTML browsers might render these ... their loss.
- // to prevent: "if (xhtml) return;".
-
- try {
- if (entityNestLevel != 0)
- return;
- if (canonical && inEpilogue)
- newline ();
- rawWrite ("<?");
- rawWrite (target);
- rawWrite (' ');
- escapeChars (data.toCharArray (), -1, -1, CTX_UNPARSED);
- rawWrite ("?>");
- if (elementNestLevel == 0 && !(canonical && inEpilogue))
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX1</b>: indicates a non-expanded entity reference */
- public void skippedEntity (String name)
- throws SAXException
- {
- try {
- rawWrite ("&");
- rawWrite (name);
- rawWrite (";");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // SAX2 LexicalHandler
-
- /** <b>SAX2</b>: called before parsing CDATA characters */
- final public void startCDATA ()
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- if (canonical)
- return;
-
- try {
- inCDATA = true;
- if (entityNestLevel == 0)
- rawWrite ("<![CDATA[");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX2</b>: called after parsing CDATA characters */
- final public void endCDATA ()
- throws SAXException
- {
- if (canonical)
- return;
-
- try {
- inCDATA = false;
- if (entityNestLevel == 0)
- rawWrite ("]]>");
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * <b>SAX2</b>: called when the doctype is partially parsed
- * Note that this, like other doctype related calls, is ignored
- * when XHTML is in use.
- */
- final public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
- if (xhtml)
- return;
- try {
- inDoctype = startedDoctype = true;
- if (canonical)
- return;
- rawWrite ("<!DOCTYPE ");
- rawWrite (name);
- rawWrite (' ');
-
- if (!expandingEntities) {
- if (publicId != null)
- rawWrite ("PUBLIC '" + publicId + "' '" + systemId + "' ");
- else if (systemId != null)
- rawWrite ("SYSTEM '" + systemId + "' ");
- }
-
- rawWrite ('[');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX2</b>: called after the doctype is parsed */
- final public void endDTD ()
- throws SAXException
- {
- inDoctype = false;
- if (canonical || xhtml)
- return;
- try {
- rawWrite ("]>");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * <b>SAX2</b>: called before parsing a general entity in content
- */
- final public void startEntity (String name)
- throws SAXException
- {
- try {
- boolean writeEOL = true;
-
- // Predefined XHTML entities (for characters) will get
- // mapped back later.
- if (xhtml || expandingEntities)
- return;
-
- entityNestLevel++;
- if (name.equals ("[dtd]"))
- return;
- if (entityNestLevel != 1)
- return;
- if (!name.startsWith ("%")) {
- writeEOL = false;
- rawWrite ('&');
- }
- rawWrite (name);
- rawWrite (';');
- if (writeEOL)
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /**
- * <b>SAX2</b>: called after parsing a general entity in content
- */
- final public void endEntity (String name)
- throws SAXException
- {
- if (xhtml || expandingEntities)
- return;
- entityNestLevel--;
- }
-
- /**
- * <b>SAX2</b>: called when comments are parsed.
- * When XHTML is used, the old HTML tradition of using comments
- * to for inline CSS, or for JavaScript code is discouraged.
- * This is because XML processors are encouraged to discard, on
- * the grounds that comments are for users (and perhaps text
- * editors) not programs. Instead, use external scripts
- */
- final public void comment (char ch [], int start, int length)
- throws SAXException
- {
- if (locator == null)
- locator = new LocatorImpl ();
-
- // don't print internal subset for XHTML
- if (xhtml && startedDoctype)
- return;
- // don't print comment in doctype for canon xml
- if (canonical && inDoctype)
- return;
-
- try {
- boolean indent;
-
- if (prettyPrinting && space.empty ())
- fatal ("stack discipline", null);
- indent = prettyPrinting && "default".equals (space.peek ());
- if (entityNestLevel != 0)
- return;
- if (indent)
- doIndent ();
- if (canonical && inEpilogue)
- newline ();
- rawWrite ("<!--");
- escapeChars (ch, start, length, CTX_UNPARSED);
- rawWrite ("-->");
- if (indent)
- doIndent ();
- if (elementNestLevel == 0 && !(canonical && inEpilogue))
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // SAX1 DTDHandler
-
- /** <b>SAX1</b>: called on notation declarations */
- final public void notationDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
-
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!NOTATION " + name + " ");
- if (publicId != null)
- rawWrite ("PUBLIC \"" + publicId + '"');
- else
- rawWrite ("SYSTEM ");
- if (systemId != null)
- rawWrite ('"' + systemId + '"');
- rawWrite (">");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX1</b>: called on unparsed entity declarations */
- final public void unparsedEntityDecl (String name,
- String publicId, String systemId,
- String notationName)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype) {
- // FIXME: write to temporary buffer, and make the start
- // of the root element write these declarations.
- return;
- }
-
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ENTITY " + name + " ");
- if (publicId != null)
- rawWrite ("PUBLIC \"" + publicId + '"');
- else
- rawWrite ("SYSTEM ");
- rawWrite ('"' + systemId + '"');
- rawWrite (" NDATA " + notationName + ">");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- // SAX2 DeclHandler
-
- /** <b>SAX2</b>: called on attribute declarations */
- final public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ATTLIST " + eName + ' ' + aName + ' ');
- rawWrite (type);
- rawWrite (' ');
- if (mode != null)
- rawWrite (mode + ' ');
- if (value != null)
- writeQuotedValue (value, CTX_ATTRIBUTE);
- rawWrite ('>');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX2</b>: called on element declarations */
- final public void elementDecl (String name, String model)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ELEMENT " + name + ' ' + model + '>');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX2</b>: called on external entity declarations */
- final public void externalEntityDecl (
- String name,
- String publicId,
- String systemId)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ENTITY ");
- if (name.startsWith ("%")) {
- rawWrite ("% ");
- rawWrite (name.substring (1));
- } else
- rawWrite (name);
- if (publicId != null)
- rawWrite (" PUBLIC \"" + publicId + '"');
- else
- rawWrite (" SYSTEM ");
- rawWrite ('"' + systemId + "\">");
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- /** <b>SAX2</b>: called on internal entity declarations */
- final public void internalEntityDecl (String name, String value)
- throws SAXException
- {
- if (xhtml)
- return;
- try {
- // At this time, only SAX2 callbacks start these.
- if (!startedDoctype)
- return;
- if (entityNestLevel != 0)
- return;
- rawWrite ("<!ENTITY ");
- if (name.startsWith ("%")) {
- rawWrite ("% ");
- rawWrite (name.substring (1));
- } else
- rawWrite (name);
- rawWrite (' ');
- writeQuotedValue (value, CTX_ENTITY);
- rawWrite ('>');
- newline ();
- } catch (IOException e) {
- fatal ("can't write", e);
- }
- }
-
- private void writeQuotedValue (String value, int code)
- throws SAXException, IOException
- {
- char buf [] = value.toCharArray ();
- int off = 0, len = buf.length;
-
- // we can't add line breaks to attribute/entity/... values
- noWrap = true;
- rawWrite ('"');
- escapeChars (buf, off, len, code);
- rawWrite ('"');
- noWrap = false;
- }
-
- // From "HTMLlat1x.ent" ... names of entities for ISO-8859-1
- // (Latin/1) characters, all codes: 160-255 (0xA0-0xFF).
- // Codes 128-159 have no assigned values.
- private static final String HTMLlat1x [] = {
- // 160
- "nbsp", "iexcl", "cent", "pound", "curren",
- "yen", "brvbar", "sect", "uml", "copy",
-
- // 170
- "ordf", "laquo", "not", "shy", "reg",
- "macr", "deg", "plusmn", "sup2", "sup3",
-
- // 180
- "acute", "micro", "para", "middot", "cedil",
- "sup1", "ordm", "raquo", "frac14", "frac12",
-
- // 190
- "frac34", "iquest", "Agrave", "Aacute", "Acirc",
- "Atilde", "Auml", "Aring", "AElig", "Ccedil",
-
- // 200
- "Egrave", "Eacute", "Ecirc", "Euml", "Igrave",
- "Iacute", "Icirc", "Iuml", "ETH", "Ntilde",
-
- // 210
- "Ograve", "Oacute", "Ocirc", "Otilde", "Ouml",
- "times", "Oslash", "Ugrave", "Uacute", "Ucirc",
-
- // 220
- "Uuml", "Yacute", "THORN", "szlig", "agrave",
- "aacute", "acirc", "atilde", "auml", "aring",
-
- // 230
- "aelig", "ccedil", "egrave", "eacute", "ecirc",
- "euml", "igrave", "iacute", "icirc", "iuml",
-
- // 240
- "eth", "ntilde", "ograve", "oacute", "ocirc",
- "otilde", "ouml", "divide", "oslash", "ugrave",
-
- // 250
- "uacute", "ucirc", "uuml", "yacute", "thorn",
- "yuml"
- };
-
- // From "HTMLsymbolx.ent" ... some of the symbols that
- // we can conveniently handle. Entities for the Greek.
- // alphabet (upper and lower cases) are compact.
- private static final String HTMLsymbolx_GR [] = {
- // 913
- "Alpha", "Beta", "Gamma", "Delta", "Epsilon",
- "Zeta", "Eta", "Theta", "Iota", "Kappa",
-
- // 923
- "Lambda", "Mu", "Nu", "Xi", "Omicron",
- "Pi", "Rho", null, "Sigma", "Tau",
-
- // 933
- "Upsilon", "Phi", "Chi", "Psi", "Omega"
- };
-
- private static final String HTMLsymbolx_gr [] = {
- // 945
- "alpha", "beta", "gamma", "delta", "epsilon",
- "zeta", "eta", "theta", "iota", "kappa",
-
- // 955
- "lambda", "mu", "nu", "xi", "omicron",
- "pi", "rho", "sigmaf", "sigma", "tau",
-
- // 965
- "upsilon", "phi", "chi", "psi", "omega"
- };
-
-
- // General routine to write text and substitute predefined
- // entities (XML, and a special case for XHTML) as needed.
- private void escapeChars (char buf [], int off, int len, int code)
- throws SAXException, IOException
- {
- int first = 0;
-
- if (off < 0) {
- off = 0;
- len = buf.length;
- }
- for (int i = 0; i < len; i++) {
- String esc;
- char c = buf [off + i];
-
- switch (c) {
- // Note that CTX_ATTRIBUTE isn't explicitly tested here;
- // all syntax delimiters are escaped in CTX_ATTRIBUTE,
- // otherwise it's similar to CTX_CONTENT
-
- // ampersand flags entity references; entity replacement
- // text has unexpanded references, other text doesn't.
- case '&':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "amp";
- break;
-
- // attributes and text may NOT have literal '<', but
- // entities may have markup constructs
- case '<':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "lt";
- break;
-
- // as above re markup constructs; but otherwise
- // except when canonicalizing, this is for consistency
- case '>':
- if (code == CTX_ENTITY || code == CTX_UNPARSED)
- continue;
- esc = "gt";
- break;
- case '\'':
- if (code == CTX_CONTENT || code == CTX_UNPARSED)
- continue;
- if (canonical)
- continue;
- esc = "apos";
- break;
-
- // needed when printing quoted attribute/entity values
- case '"':
- if (code == CTX_CONTENT || code == CTX_UNPARSED)
- continue;
- esc = "quot";
- break;
-
- // make line ends work per host OS convention
- case '\n':
- esc = eol;
- break;
-
- //
- // No other characters NEED special treatment ... except
- // for encoding-specific issues, like whether the character
- // can really be represented in that encoding.
- //
- default:
- //
- // There are characters we can never write safely; getting
- // them is an error.
- //
- // (a) They're never legal in XML ... detected by range
- // checks, and (eventually) by remerging surrogate
- // pairs on output. (Easy error for apps to prevent.)
- //
- // (b) This encoding can't represent them, and we
- // can't make reference substitution (e.g. inside
- // CDATA sections, names, PI data, etc). (Hard for
- // apps to prevent, except by using UTF-8 or UTF-16
- // as their output encoding.)
- //
- // We know a very little bit about what characters
- // the US-ASCII and ISO-8859-1 encodings support. For
- // other encodings we can't detect the second type of
- // error at all. (Never an issue for UTF-8 or UTF-16.)
- //
-
-// FIXME: CR in CDATA is an error; in text, turn to a char ref
-
-// FIXME: CR/LF/TAB in attributes should become char refs
-
- if ((c > 0xfffd)
- || ((c < 0x0020) && !((c == 0x0009)
- || (c == 0x000A) || (c == 0x000D)))
- || (((c & dangerMask) != 0)
- && (code == CTX_UNPARSED))) {
-
- // if case (b) in CDATA, we might end the section,
- // write a reference, then restart ... possible
- // in one DOM L3 draft.
-
- throw new CharConversionException (
- "Illegal or non-writable character: U+"
- + Integer.toHexString (c));
- }
-
- //
- // If the output encoding represents the character
- // directly, let it do so! Else we'll escape it.
- //
- if ((c & dangerMask) == 0)
- continue;
- esc = null;
-
- // Avoid numeric refs where symbolic ones exist, as
- // symbolic ones make more sense to humans reading!
- if (xhtml) {
- // all the HTMLlat1x.ent entities
- // (all the "ISO-8859-1" characters)
- if (c >= 160 && c <= 255)
- esc = HTMLlat1x [c - 160];
-
- // not quite half the HTMLsymbolx.ent entities
- else if (c >= 913 && c <= 937)
- esc = HTMLsymbolx_GR [c - 913];
- else if (c >= 945 && c <= 969)
- esc = HTMLsymbolx_gr [c - 945];
-
- else switch (c) {
- // all of the HTMLspecialx.ent entities
- case 338: esc = "OElig"; break;
- case 339: esc = "oelig"; break;
- case 352: esc = "Scaron"; break;
- case 353: esc = "scaron"; break;
- case 376: esc = "Yuml"; break;
- case 710: esc = "circ"; break;
- case 732: esc = "tilde"; break;
- case 8194: esc = "ensp"; break;
- case 8195: esc = "emsp"; break;
- case 8201: esc = "thinsp"; break;
- case 8204: esc = "zwnj"; break;
- case 8205: esc = "zwj"; break;
- case 8206: esc = "lrm"; break;
- case 8207: esc = "rlm"; break;
- case 8211: esc = "ndash"; break;
- case 8212: esc = "mdash"; break;
- case 8216: esc = "lsquo"; break;
- case 8217: esc = "rsquo"; break;
- case 8218: esc = "sbquo"; break;
- case 8220: esc = "ldquo"; break;
- case 8221: esc = "rdquo"; break;
- case 8222: esc = "bdquo"; break;
- case 8224: esc = "dagger"; break;
- case 8225: esc = "Dagger"; break;
- case 8240: esc = "permil"; break;
- case 8249: esc = "lsaquo"; break;
- case 8250: esc = "rsaquo"; break;
- case 8364: esc = "euro"; break;
-
- // the other HTMLsymbox.ent entities
- case 402: esc = "fnof"; break;
- case 977: esc = "thetasym"; break;
- case 978: esc = "upsih"; break;
- case 982: esc = "piv"; break;
- case 8226: esc = "bull"; break;
- case 8230: esc = "hellip"; break;
- case 8242: esc = "prime"; break;
- case 8243: esc = "Prime"; break;
- case 8254: esc = "oline"; break;
- case 8260: esc = "frasl"; break;
- case 8472: esc = "weierp"; break;
- case 8465: esc = "image"; break;
- case 8476: esc = "real"; break;
- case 8482: esc = "trade"; break;
- case 8501: esc = "alefsym"; break;
- case 8592: esc = "larr"; break;
- case 8593: esc = "uarr"; break;
- case 8594: esc = "rarr"; break;
- case 8595: esc = "darr"; break;
- case 8596: esc = "harr"; break;
- case 8629: esc = "crarr"; break;
- case 8656: esc = "lArr"; break;
- case 8657: esc = "uArr"; break;
- case 8658: esc = "rArr"; break;
- case 8659: esc = "dArr"; break;
- case 8660: esc = "hArr"; break;
- case 8704: esc = "forall"; break;
- case 8706: esc = "part"; break;
- case 8707: esc = "exist"; break;
- case 8709: esc = "empty"; break;
- case 8711: esc = "nabla"; break;
- case 8712: esc = "isin"; break;
- case 8713: esc = "notin"; break;
- case 8715: esc = "ni"; break;
- case 8719: esc = "prod"; break;
- case 8721: esc = "sum"; break;
- case 8722: esc = "minus"; break;
- case 8727: esc = "lowast"; break;
- case 8730: esc = "radic"; break;
- case 8733: esc = "prop"; break;
- case 8734: esc = "infin"; break;
- case 8736: esc = "ang"; break;
- case 8743: esc = "and"; break;
- case 8744: esc = "or"; break;
- case 8745: esc = "cap"; break;
- case 8746: esc = "cup"; break;
- case 8747: esc = "int"; break;
- case 8756: esc = "there4"; break;
- case 8764: esc = "sim"; break;
- case 8773: esc = "cong"; break;
- case 8776: esc = "asymp"; break;
- case 8800: esc = "ne"; break;
- case 8801: esc = "equiv"; break;
- case 8804: esc = "le"; break;
- case 8805: esc = "ge"; break;
- case 8834: esc = "sub"; break;
- case 8835: esc = "sup"; break;
- case 8836: esc = "nsub"; break;
- case 8838: esc = "sube"; break;
- case 8839: esc = "supe"; break;
- case 8853: esc = "oplus"; break;
- case 8855: esc = "otimes"; break;
- case 8869: esc = "perp"; break;
- case 8901: esc = "sdot"; break;
- case 8968: esc = "lceil"; break;
- case 8969: esc = "rceil"; break;
- case 8970: esc = "lfloor"; break;
- case 8971: esc = "rfloor"; break;
- case 9001: esc = "lang"; break;
- case 9002: esc = "rang"; break;
- case 9674: esc = "loz"; break;
- case 9824: esc = "spades"; break;
- case 9827: esc = "clubs"; break;
- case 9829: esc = "hearts"; break;
- case 9830: esc = "diams"; break;
- }
- }
-
- // else escape with numeric char refs
- if (esc == null) {
- stringBuf.setLength (0);
- stringBuf.append ("#x");
- stringBuf.append (Integer.toHexString (c).toUpperCase ());
- esc = stringBuf.toString ();
-
- // FIXME: We don't write surrogate pairs correctly.
- // They should work as one ref per character, since
- // each pair is one character. For reading back into
- // Unicode, it matters beginning in Unicode 3.1 ...
- }
- break;
- }
- if (i != first)
- rawWrite (buf, off + first, i - first);
- first = i + 1;
- if (esc == eol)
- newline ();
- else {
- rawWrite ('&');
- rawWrite (esc);
- rawWrite (';');
- }
- }
- if (first < len)
- rawWrite (buf, off + first, len - first);
- }
-
-
-
- private void newline ()
- throws SAXException, IOException
- {
- out.write (eol);
- column = 0;
- }
-
- private void doIndent ()
- throws SAXException, IOException
- {
- int space = elementNestLevel * 2;
-
- newline ();
- column = space;
- // track tabs only at line starts
- while (space > 8) {
- out.write ("\t");
- space -= 8;
- }
- while (space > 0) {
- out.write (" ");
- space -= 2;
- }
- }
-
- private void rawWrite (char c)
- throws IOException
- {
- out.write (c);
- column++;
- }
-
- private void rawWrite (String s)
- throws SAXException, IOException
- {
- if (prettyPrinting && "default".equals (space.peek ())) {
- char data [] = s.toCharArray ();
- rawWrite (data, 0, data.length);
- } else {
- out.write (s);
- column += s.length ();
- }
- }
-
- // NOTE: if xhtml, the REC gives some rules about whitespace
- // which we could follow ... notably, many places where conformant
- // agents "must" consolidate/normalize whitespace. Line ends can
- // be removed there, etc. This may not be the right place to do
- // such mappings though.
-
- // Line buffering may help clarify algorithms and improve results.
-
- // It's likely xml:space needs more attention.
-
- private void rawWrite (char buf [], int offset, int length)
- throws SAXException, IOException
- {
- boolean wrap;
-
- if (prettyPrinting && space.empty ())
- fatal ("stack discipline", null);
-
- wrap = prettyPrinting && "default".equals (space.peek ());
- if (!wrap) {
- out.write (buf, offset, length);
- column += length;
- return;
- }
-
- // we're pretty printing and want to fill lines out only
- // to the desired line length.
- while (length > 0) {
- int target = lineLength - column;
- boolean wrote = false;
-
- // Do we even have a problem?
- if (target > length || noWrap) {
- out.write (buf, offset, length);
- column += length;
- return;
- }
-
- // break the line at a space character, trying to fill
- // as much of the line as possible.
- char c;
-
- for (int i = target - 1; i >= 0; i--) {
- if ((c = buf [offset + i]) == ' ' || c == '\t') {
- i++;
- out.write (buf, offset, i);
- doIndent ();
- offset += i;
- length -= i;
- wrote = true;
- break;
- }
- }
- if (wrote)
- continue;
-
- // no space character permitting break before target
- // line length is filled. So, take the next one.
- if (target < 0)
- target = 0;
- for (int i = target; i < length; i++)
- if ((c = buf [offset + i]) == ' ' || c == '\t') {
- i++;
- out.write (buf, offset, i);
- doIndent ();
- offset += i;
- length -= i;
- wrote = true;
- break;
- }
- if (wrote)
- continue;
-
- // no such luck.
- out.write (buf, offset, length);
- column += length;
- break;
- }
- }
-}
diff --git a/external/jaxp/source/gnu/xml/util/package.html b/external/jaxp/source/gnu/xml/util/package.html
deleted file mode 100644
index 5c5736bff..000000000
--- a/external/jaxp/source/gnu/xml/util/package.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html PUBLIC
- "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/1999/PR-xhtml1-19991210/DTD/xhtml1-transitional.dtd">
-
-<html><head><title> org.brownell.xml package </title> </head>
-<!--
-/*
- * Copyright (c) 1999-2000 by David Brownell.
- *
- * $Id: package.html,v 1.2 2004-05-01 16:18:51 mark Exp $
- */
--->
-<body>
- <p> This package contains XML utilities, including SAX2 XML writers
- and a parser of DOM trees, plus a command line driver.
- That <a href="DoParse.html">driver</a>
- connects parsers simple processing pipelines.
- It can be handy for command line validation or
- transformation tasks, possibly in batch mode,
- or within Makefiles. </p>
-
-</body></html>
diff --git a/external/jaxp/source/javax/xml/parsers/ClassStuff.java b/external/jaxp/source/javax/xml/parsers/ClassStuff.java
deleted file mode 100644
index 6c8d9dca2..000000000
--- a/external/jaxp/source/javax/xml/parsers/ClassStuff.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * $Id: ClassStuff.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Method;
-import java.util.Properties;
-
-
-// $Id: ClassStuff.java,v 1.2 2004-05-01 16:18:51 mark Exp $
-
-/**
- * Package-private utility methods for sharing
- * magic related to class loading.
- * NOTE: This is cloned in javax.xml.transform,
- * where a different exception is thrown (bleech).
- * Keep changes to the two copies in sync.
- *
- * @author David Brownell
- * @version $Id: ClassStuff.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- */
-final class ClassStuff
-{
- private ClassStuff () { }
-
- /**
- * Get the default factory using the four-stage defaulting
- * mechanism defined by JAXP.
- */
- static Object
- createFactory (String label, String defaultClass)
- throws FactoryConfigurationError
- {
- String name = null;
- ClassLoader loader = null;
-
- // figure out which class loader to use.
- // source compiles on jdk 1.1, but works with jdk 1.2+ security
- try {
- Method m = null;
-
- // Can we use JDK 1.2 APIs? Preferred: security policies apply.
- m = Thread.class.getMethod ("getContextClassLoader", null);
- loader = (ClassLoader) m.invoke (Thread.currentThread(), null);
- } catch (NoSuchMethodException e) {
- // Assume that we are running JDK 1.1; use current ClassLoader
- loader = ClassStuff.class.getClassLoader();
- } catch (NoSuchMethodError e) {
- // evidently IE does this (one of its bugs)
- loader = ClassStuff.class.getClassLoader();
- } catch (Throwable e) {
- // "should not happen"
- throw new UnknownError (e.getMessage());
- }
-
- // 1. Check System Property
- // ... normally fails in applet environments
- try { name = System.getProperty (label);
- } catch (SecurityException e) { /* IGNORE */ }
-
- // 2. Check in $JAVA_HOME/lib/jaxp.properties
- try {
- if (name == null) {
- String javaHome;
- File file;
-
- javaHome = System.getProperty ("java.home");
- file = new File (new File (javaHome, "lib"), "jaxp.properties");
- if (file.exists() == true) {
- FileInputStream in = new FileInputStream (file);
- Properties props = new Properties();
-
- props.load (in);
- name = props.getProperty (label);
- in.close ();
- }
- }
- } catch (Exception e) { /* IGNORE */ }
-
- // 3. Check Services API
- if (name == null) {
- try {
- String service = "META-INF/services/" + label;
- InputStream in;
- BufferedReader reader;
-
- if (loader == null)
- in = ClassLoader.getSystemResourceAsStream (service);
- else
- in = loader.getResourceAsStream (service);
- if (in != null) {
- reader = new BufferedReader (
- new InputStreamReader (in, "UTF8"));
- name = reader.readLine();
- in.close ();
- }
- } catch (Exception e2) { /* IGNORE */ }
- }
-
- // 4. Distro-specific fallback
- if (name == null)
- name = defaultClass;
-
- // Instantiate!
- try {
- Class klass;
-
- if (loader == null)
- klass = Class.forName (name);
- else
- klass = loader.loadClass (name);
- return klass.newInstance ();
-
- } catch (ClassNotFoundException e) {
- throw new FactoryConfigurationError (e,
- "Factory class " + name
- + " not found");
- } catch (IllegalAccessException e) {
- throw new FactoryConfigurationError (e,
- "Factory class " + name
- + " found but cannot be loaded");
- } catch (InstantiationException e) {
- throw new FactoryConfigurationError (e,
- "Factory class " + name
- + " loaded but cannot be instantiated"
- + " ((no default constructor?)");
- }
- }
-}
diff --git a/external/jaxp/source/javax/xml/parsers/DocumentBuilder.java b/external/jaxp/source/javax/xml/parsers/DocumentBuilder.java
deleted file mode 100644
index 0b4665943..000000000
--- a/external/jaxp/source/javax/xml/parsers/DocumentBuilder.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * $Id: DocumentBuilder.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-// Imports
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.IOException;
-// import java.net.*;
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * Uses an XML parser to construct a DOM document.
- * @author Andrew Selkirk, David Brownell
- * @version $Id: DocumentBuilder.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- */
-public abstract class DocumentBuilder
-{
- /** Only subclasses may use the constructor. */
- protected DocumentBuilder() { }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public abstract DOMImplementation getDOMImplementation ();
-
- public abstract boolean isNamespaceAware();
-
- public abstract boolean isValidating();
-
- public abstract Document newDocument();
-
- // we don't demand jdk 1.2 File.toURL() in the runtime
- // keep in sync with gnu.xml.util.Resolver
- // and javax.xml.transform.stream.StreamSource
- static String fileToURL (File f)
- throws IOException
- {
- String temp;
-
- // FIXME: getAbsolutePath() seems buggy; I'm seeing components
- // like "/foo/../" which are clearly not "absolute"
- // and should have been resolved with the filesystem.
-
- // Substituting "/" would be wrong, "foo" may have been
- // symlinked ... the URL code will make that change
- // later, so that things can get _really_ broken!
-
- temp = f.getAbsolutePath ();
-
- if (File.separatorChar != '/')
- temp = temp.replace (File.separatorChar, '/');
- if (!temp.startsWith ("/"))
- temp = "/" + temp;
- if (!temp.endsWith ("/") && f.isDirectory ())
- temp = temp + "/";
- return "file:" + temp;
- }
-
- /**
- * Constructs an InputSource from the file, and invokes parse ().
- * The InputSource includes the URI for the file.
- * @param file the file to parse
- * @return the DOM representation of the xml document
- * @exception IOException
- * @exception SAXException if parse errors occur
- * @exception IllegalArgumentException if the file is null
- */
- public Document parse (File file)
- throws SAXException, IOException
- {
- if (file==null)
- {
- throw new IllegalArgumentException("File si 'null'");
- }
- InputSource source;
-
- source = new InputSource (fileToURL (file));
- source.setByteStream (new FileInputStream(file));
- return parse (source);
- }
-
- /**
- *
- * @exception IllegalArgumentException if InputSource is null
- */
- public abstract Document parse(InputSource source)
- throws SAXException, IOException;
-
- /**
- * Avoid using this call; provide the system ID wherever possible.
- * System IDs are essential when parsers resolve relative URIs,
- * or provide diagnostics.
- * @exception IllegalArgumentException if InputStream is null
- */
- public Document parse(InputStream stream)
- throws SAXException, IOException {
- if (stream==null)
- {
- throw new IllegalArgumentException("InputStream si 'null'");
- }
- return parse(new InputSource(stream));
- } // parse()
-
- /**
- *
- * @exception IllegalArgumentException if InputStream is null
- */
- public Document parse(InputStream stream, String systemID)
- throws SAXException, IOException {
-
- if (stream==null)
- {
- throw new IllegalArgumentException("InputStream si 'null'");
- }
- // Variables
- InputSource source;
-
- // Create Source
- source = new InputSource(stream);
- source.setSystemId(systemID);
-
- // Parse Input Source
- return parse(source);
-
- } // parse()
-
- /**
- *
- * @exception IllegalArgumentException if the URI is null
- */
- public Document parse(String uri)
- throws SAXException, IOException {
- if (uri==null)
- {
- throw new IllegalArgumentException("URI si 'null'");
- }
- return parse(new InputSource(uri));
- } // parse()
-
- public abstract void setEntityResolver(EntityResolver resolver);
-
- public abstract void setErrorHandler(ErrorHandler handler);
-}
diff --git a/external/jaxp/source/javax/xml/parsers/DocumentBuilderFactory.java b/external/jaxp/source/javax/xml/parsers/DocumentBuilderFactory.java
deleted file mode 100644
index f13b02bf0..000000000
--- a/external/jaxp/source/javax/xml/parsers/DocumentBuilderFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * $Id: DocumentBuilderFactory.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-// Imports
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.File;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.Properties;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-/**
- * DocumentBuilderFactory is used to resolve the problem that the
- * W3C DOM APIs don't include portable bootstrapping.
- *
- * @author Andrew Selkirk, David Brownell
- * @version $Id: DocumentBuilderFactory.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- */
-public abstract class DocumentBuilderFactory {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- private static final String defaultPropName =
- "javax.xml.parsers.DocumentBuilderFactory";
-
- private boolean validating = false;
- private boolean namespaceAware = false;
- private boolean whitespace = false;
- private boolean expandEntityRef = false;
- private boolean ignoreComments = false;
- private boolean coalescing = false;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- protected DocumentBuilderFactory() {
- } // DocumentBuilderFactory()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * @exception IllegalArgumentException if implementation doesn't recognize the attribute
- */
- public abstract Object getAttribute(String name)
- throws IllegalArgumentException;
-
- public boolean isCoalescing() {
- return coalescing;
- } // isCoalescing()
-
- public boolean isExpandEntityReferences() {
- return expandEntityRef;
- } // isExpandEntityReferences()
-
- public boolean isIgnoringComments() {
- return ignoreComments;
- } // isIgnoringComments()
-
- public boolean isIgnoringElementContentWhitespace() {
- return whitespace;
- } // isIgnoringElementContentWhitespace()
-
- public boolean isNamespaceAware() {
- return namespaceAware;
- } // isNamespaceAware()
-
- public boolean isValidating() {
- return validating;
- } // isValidating()
-
- public abstract DocumentBuilder newDocumentBuilder()
- throws ParserConfigurationException;
-
- /**
- * @exception FactoryConfigurationError if the implementation is not available
- */
- public static DocumentBuilderFactory newInstance() {
- try {
- return (DocumentBuilderFactory)
- ClassStuff.createFactory (
- defaultPropName,
- "gnu.xml.dom.JAXPFactory");
- } catch (ClassCastException e) {
- throw new FactoryConfigurationError (e,
- "Factory class is the wrong type");
- }
- }
-
- /**
- * @exception IllegalArgumentException if implementation doesn't recognize the attribute
- */
- public abstract void setAttribute(String name, Object value)
- throws IllegalArgumentException;
-
- public void setCoalescing(boolean value) {
- coalescing = value;
- } // setCoalescing()
-
- public void setExpandEntityReferences(boolean value) {
- expandEntityRef = value;
- } // setExpandEntityReferences()
-
- public void setIgnoringComments(boolean value) {
- ignoreComments = value;
- } // setIgnoringComments()
-
- public void setIgnoringElementContentWhitespace(boolean value) {
- whitespace = value;
- } // setIgnoringElementContentWhitespace()
-
- public void setNamespaceAware(boolean value) {
- namespaceAware = value;
- } // setNamespaceAware()
-
- public void setValidating(boolean value) {
- validating = value;
- } // setValidating()
-}
diff --git a/external/jaxp/source/javax/xml/parsers/FactoryConfigurationError.java b/external/jaxp/source/javax/xml/parsers/FactoryConfigurationError.java
deleted file mode 100644
index 4438e19c0..000000000
--- a/external/jaxp/source/javax/xml/parsers/FactoryConfigurationError.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * $Id: FactoryConfigurationError.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-/**
- * FactoryConfigurationError
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class FactoryConfigurationError extends Error {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- private Exception exception = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
- public FactoryConfigurationError() {
- super();
- } // FactoryConfigurationError()
-
- public FactoryConfigurationError(String msg) {
- super(msg);
- } // FactoryConfigurationError()
-
- public FactoryConfigurationError(Exception ex) {
- super();
- exception = ex;
- } // FactoryConfigurationError()
-
- public FactoryConfigurationError(Exception ex, String msg) {
- super(msg);
- exception = ex;
- } // FactoryConfigurationError()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public String getMessage() {
- return super.getMessage();
- } // getMessage()
-
- public Exception getException() {
- return exception;
- } // getException()
-
-
-} // FactoryConfigurationError
-
-
diff --git a/external/jaxp/source/javax/xml/parsers/ParserConfigurationException.java b/external/jaxp/source/javax/xml/parsers/ParserConfigurationException.java
deleted file mode 100644
index e34c03ca7..000000000
--- a/external/jaxp/source/javax/xml/parsers/ParserConfigurationException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * $Id: ParserConfigurationException.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-/**
- * ParserConfigurationException
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class ParserConfigurationException extends Exception {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public ParserConfigurationException() {
- super();
- } // ParserConfigurationException()
-
- public ParserConfigurationException(String message) {
- super(message);
- } // ParserConfigurationException()
-
-
-} // ParserConfigurationException
-
diff --git a/external/jaxp/source/javax/xml/parsers/SAXParser.java b/external/jaxp/source/javax/xml/parsers/SAXParser.java
deleted file mode 100644
index b5b53989b..000000000
--- a/external/jaxp/source/javax/xml/parsers/SAXParser.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * $Id: SAXParser.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-// Imports
-import java.io.*;
-import java.net.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import org.xml.sax.helpers.*;
-
-/**
- * Wraps a SAX2 (or SAX1) parser.
- *
- * <p>Note that parsing with methods on this interface requires use of one
- * of the optional SAX base classes. It's usually preferable to use the
- * SAX parser APIs directly. SAX gives much more flexibility about how
- * application classes are organized, and about how the document entity is
- * packaged for delivery to the parser. And JAXP doesn't otherwise provide
- * access to the SAX2 extension handlers for lexical or declaration events.
- *
- * @author Andrew Selkirk
- * @author David Brownell
- * @version 1.0
- */
-public abstract class SAXParser
-{
- /** Only subclasses may use the constructor. */
- protected SAXParser() { }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public abstract void setProperty (String id, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
- public abstract Object getProperty (String id)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
- /**
- * Parse using (deprecated) SAX1 style handlers,
- * and a byte stream (with no URI).
- * Avoid using this API, since relative URIs in the document need
- * to be resolved against the document entity's URI, and good
- * diagnostics also need that URI.
- * @exception IllegalArgumentException if InputStream is null
- */
- public void parse(InputStream stream, HandlerBase handler)
- throws SAXException, IOException
- { parse (new InputSource (stream), handler); }
-
- /**
- * Parse using (deprecated) SAX1 style handlers,
- * and a byte stream with a specified URI.
- * @exception IllegalArgumentException if InputStream is null
- */
- public void parse (
- InputStream stream,
- HandlerBase handler,
- String systemID
- ) throws SAXException, IOException
- {
- if(stream==null)
- {
- throw new IllegalArgumentException("InputStream is 'null'");
- }
- InputSource source;
-
- // Prepare Source
- source = new InputSource(stream);
- source.setSystemId(systemID);
-
- parse(source, handler);
-
- }
-
- /**
- * Parse using SAX2 style handlers,
- * and a byte stream (with no URI).
- * Avoid using this API, since relative URIs in the document need
- * to be resolved against the document entity's URI, and good
- * diagnostics also need that URI.
- * @exception IllegalArgumentException if InputStream is null
- */
- public void parse(InputStream stream, DefaultHandler def)
- throws SAXException, IOException
- {
- if(stream==null)
- {
- throw new IllegalArgumentException("InputStream is 'null'");
- }
- parse (new InputSource (stream), def);
- }
-
- /**
- * Parse using SAX2 style handlers,
- * and a byte stream with a specified URI.
- * @exception IllegalArgumentException if InputStream is null
- */
- public void parse (
- InputStream stream,
- DefaultHandler def,
- String systemID
- ) throws SAXException, IOException
- {
- if(stream==null)
- {
- throw new IllegalArgumentException("InputStream is 'null'");
- }
- InputSource source;
-
- // Prepare Source
- source = new InputSource(stream);
- source.setSystemId(systemID);
-
- parse(source, def);
-
- }
-
- /**
- * Parse using (deprecated) SAX1 style handlers,
- * and a URI for the document entity.
- * @exception IllegalArgumentException if URI is null
- */
- public void parse(String uri, HandlerBase handler)
- throws SAXException, IOException
- {
- if(uri==null)
- {
- throw new IllegalArgumentException("URI is 'null'");
- }
- parse (new InputSource (uri), handler);
- }
-
- /**
- * Parse using SAX2 style handlers,
- * and a URI for the document entity.
- * @exception IllegalArgumentException if URI is null
- */
- public void parse(String uri, DefaultHandler def)
- throws SAXException, IOException
- {
- if(uri==null)
- {
- throw new IllegalArgumentException("URI is 'null'");
- }
- parse (new InputSource (uri), def);
- }
-
- /**
- * Parse using (deprecated) SAX1 style handlers,
- * turning a file name into the document URI.
- * @exception IllegalArgumentException if file is null
- */
- public void parse(File file, HandlerBase handler)
- throws SAXException, IOException
- {
- if(file==null)
- {
- throw new IllegalArgumentException("The file is 'null'");
- }
- InputSource in;
-
- in = new InputSource (DocumentBuilder.fileToURL (file));
- parse (in, handler);
- }
-
- /**
- * Parse using SAX2 style handlers,
- * turning a file name into the document URI.
- * @exception IllegalArgumentException if file is null
- */
- public void parse(File file, DefaultHandler def)
- throws SAXException, IOException
- {
- if(file==null)
- {
- throw new IllegalArgumentException("The file is 'null'");
- }
- InputSource in;
-
- in = new InputSource (DocumentBuilder.fileToURL (file));
- parse (in, def);
- }
-
- /**
- * Parse using (deprecated) SAX1 style handlers.
- * @exception IllegalArgumentException if InputSource is null
- */
- public void parse(InputSource source, HandlerBase handler)
- throws SAXException, IOException
- {
- if(source==null)
- {
- throw new IllegalArgumentException("The InputSource is 'null'");
- }
- Parser parser;
-
- // Prepare Parser
- parser = getParser();
- parser.setDocumentHandler(handler);
- parser.setDTDHandler(handler);
- parser.setEntityResolver(handler);
- parser.setErrorHandler(handler);
-
- // Parse
- parser.parse(source);
-
- }
-
- /**
- * Parse using SAX2 style handlers.
- * @exception IllegalArgumentException if InputSource is null
- */
- public void parse(InputSource source, DefaultHandler def)
- throws SAXException, IOException
- {
- if(source==null)
- {
- throw new IllegalArgumentException("The InputSource is 'null'");
- }
- XMLReader reader;
-
- // Prepare XML Reader
- reader = getXMLReader();
- reader.setContentHandler(def);
- reader.setDTDHandler(def);
- reader.setEntityResolver(def);
- reader.setErrorHandler(def);
-
- // NOTE: this should NOT understand the
- // extension handlers (lexical, decl).
-
- reader.parse(source);
- }
-
- /**
- * Get a (deprecated) SAX1 driver for the underlying parser.
- */
- public abstract Parser getParser() throws SAXException;
-
- /**
- * Get a SAX2 driver for the underlying parser.
- * @since 1.1
- */
- public abstract XMLReader getXMLReader() throws SAXException;
-
- public abstract boolean isNamespaceAware();
-
- public abstract boolean isValidating();
-}
diff --git a/external/jaxp/source/javax/xml/parsers/SAXParserFactory.java b/external/jaxp/source/javax/xml/parsers/SAXParserFactory.java
deleted file mode 100644
index c6a47bbb8..000000000
--- a/external/jaxp/source/javax/xml/parsers/SAXParserFactory.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * $Id: SAXParserFactory.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.parsers;
-
-// Imports
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.File;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.Properties;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-
-/**
- * SAXParserFactory is used to bootstrap JAXP wrappers for
- * SAX parsers.
- *
- * <para> Note that the JAXP 1.1 spec does not specify how
- * the <em>isValidating()</em> or <em>isNamespaceAware()</em>
- * flags relate to the SAX2 feature flags controlling those
- * same features.
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-
-public abstract class SAXParserFactory {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- private static final String defaultPropName =
- "javax.xml.parsers.SAXParserFactory";
-
- private boolean validating = false;
- private boolean namespaceAware = false;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- protected SAXParserFactory() {
- } // SAXParserFactory()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public static SAXParserFactory newInstance() {
- try {
- return (SAXParserFactory)
- ClassStuff.createFactory (
- defaultPropName,
- "gnu.xml.aelfred2.JAXPFactory");
- } catch (ClassCastException e) {
- throw new FactoryConfigurationError (e,
- "Factory class is the wrong type");
- }
- }
-
- /**
- * Returns a new instance of a SAXParser using the platform
- * default implementation and the currently specified factory
- * feature flag settings.
- *
- * @exception ParserConfigurationException
- * when the parameter combination is not supported
- * @exception SAXNotRecognizedException
- * if one of the specified SAX2 feature flags is not recognized
- * @exception SAXNotSupportedException
- * if one of the specified SAX2 feature flags values can
- * not be set, perhaps because of sequencing requirements
- * (which could be met by using SAX2 directly)
- */
- public abstract SAXParser newSAXParser()
- throws ParserConfigurationException, SAXException;
-
- public void setNamespaceAware(boolean value) {
- namespaceAware = value;
- } // setNamespaceAware()
-
- public void setValidating(boolean value) {
- validating = value;
- } // setValidating()
-
- public boolean isNamespaceAware() {
- return namespaceAware;
- } // isNamespaceAware()
-
- public boolean isValidating() {
- return validating;
- } // isValidating()
-
- /**
- * Establishes a factory parameter corresponding to the
- * specified feature flag.
- *
- * @param name identifies the feature flag
- * @param value specifies the desired flag value
- *
- * @exception SAXNotRecognizedException
- * if the specified SAX2 feature flag is not recognized
- * @exception SAXNotSupportedException
- * if the specified SAX2 feature flag values can not be set,
- * perhaps because of sequencing requirements (which could
- * be met by using SAX2 directly)
- */
- public abstract void setFeature (String name, boolean value)
- throws ParserConfigurationException,
- SAXNotRecognizedException,
- SAXNotSupportedException;
-
- /**
- * Retrieves a current factory feature flag setting.
- *
- * @param name identifies the feature flag
- *
- * @exception SAXNotRecognizedException
- * if the specified SAX2 feature flag is not recognized
- * @exception SAXNotSupportedException
- * if the specified SAX2 feature flag values can not be
- * accessed before parsing begins.
- */
- public abstract boolean getFeature (String name)
- throws ParserConfigurationException,
- SAXNotRecognizedException,
- SAXNotSupportedException;
-
-} // SAXParserFactory
-
diff --git a/external/jaxp/source/javax/xml/parsers/package.html b/external/jaxp/source/javax/xml/parsers/package.html
deleted file mode 100644
index 71739b92c..000000000
--- a/external/jaxp/source/javax/xml/parsers/package.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<html><head>javax.xml.parsers</head><body>
-
-<p>Bootstrapping APIs for JAXP parsers.
-This is the first portable API defined for bootstrapping DOM.
-
-<p>JAXP parsers bootstrap in two stages.
-First is getting a factory, and configuring it.
-Second is asking that factory for a parser.
-
-<p>The SAX bootstrapping support corresponds to functionality
-found in the <em>org.xml.sax.helpers</em> package, except
-that it uses the JAXP two stage bootstrap paradigm and
-that the parser that's bootstrapped is normally wrapping
-a SAX parser rather than exposing it for direct use.
-
-</body></html>
diff --git a/external/jaxp/source/javax/xml/transform/ClassStuff.java b/external/jaxp/source/javax/xml/transform/ClassStuff.java
deleted file mode 100644
index 6be50d772..000000000
--- a/external/jaxp/source/javax/xml/transform/ClassStuff.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * $Id: ClassStuff.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-
-package javax.xml.transform;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.lang.reflect.Method;
-import java.util.Properties;
-
-
-// $Id: ClassStuff.java,v 1.2 2004-05-01 16:18:51 mark Exp $
-
-/**
- * Package-private utility methods for sharing
- * magic related to class loading.
- * NOTE: This is cloned in javax.xml.parsers,
- * where a different exception is thrown (bleech).
- * Keep changes to the two copies in sync.
- *
- * @author David Brownell
- * @version $Id: ClassStuff.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- */
-final class ClassStuff
-{
- private ClassStuff () { }
-
- /**
- * Get the default factory using the four-stage defaulting
- * mechanism defined by JAXP.
- */
- static Object
- createFactory (String label, String defaultClass)
- throws TransformerFactoryConfigurationError
- {
- String name = null;
- ClassLoader loader = null;
-
- // figure out which class loader to use.
- // source compiles on jdk 1.1, but works with jdk 1.2+ security
- try {
- Method m = null;
-
- // Can we use JDK 1.2 APIs? Preferred: security policies apply.
- m = Thread.class.getMethod ("getContextClassLoader", null);
- loader = (ClassLoader) m.invoke (Thread.currentThread(), null);
- } catch (NoSuchMethodException e) {
- // Assume that we are running JDK 1.1; use current ClassLoader
- loader = ClassStuff.class.getClassLoader();
- } catch (Exception e) {
- // "should not happen"
- throw new UnknownError (e.getMessage());
- }
-
- // 1. Check System Property
- // ... normally fails in applet environments
- try { name = System.getProperty (label);
- } catch (SecurityException e) { /* IGNORE */ }
-
- // 2. Check in $JAVA_HOME/lib/jaxp.properties
- try {
- if (name == null) {
- String javaHome;
- File file;
-
- javaHome = System.getProperty ("java.home");
- file = new File (new File (javaHome, "lib"), "jaxp.properties");
- if (file.exists() == true) {
- FileInputStream in = new FileInputStream (file);
- Properties props = new Properties();
-
- props.load (in);
- name = props.getProperty (label);
- in.close ();
- }
- }
- } catch (Exception e) { /* IGNORE */ }
-
- // 3. Check Services API
- if (name == null) {
- try {
- String service = "META-INF/services/" + label;
- InputStream in;
- BufferedReader reader;
-
- if (loader == null)
- in = ClassLoader.getSystemResourceAsStream (service);
- else
- in = loader.getResourceAsStream (service);
- if (in != null) {
- reader = new BufferedReader (
- new InputStreamReader (in, "UTF8"));
- name = reader.readLine();
- in.close ();
- }
- } catch (Exception e2) { /* IGNORE */ }
- }
-
- // 4. Distro-specific fallback
- if (name == null)
- name = defaultClass;
-
- // Instantiate!
- try {
- Class klass;
-
- if (loader == null)
- klass = Class.forName (name);
- else
- klass = loader.loadClass (name);
- return klass.newInstance ();
-
- } catch (ClassNotFoundException e) {
- throw new TransformerFactoryConfigurationError (e,
- "Factory class " + name
- + " not found");
- } catch (IllegalAccessException e) {
- throw new TransformerFactoryConfigurationError (e,
- "Factory class " + name
- + " found but cannot be loaded");
- } catch (InstantiationException e) {
- throw new TransformerFactoryConfigurationError (e,
- "Factory class " + name
- + " loaded but cannot be instantiated"
- + " ((no default constructor?)");
- }
- }
-}
diff --git a/external/jaxp/source/javax/xml/transform/ErrorListener.java b/external/jaxp/source/javax/xml/transform/ErrorListener.java
deleted file mode 100644
index aaf4071dd..000000000
--- a/external/jaxp/source/javax/xml/transform/ErrorListener.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $Id: ErrorListener.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * JAXP/Transform analogue of SAX ErrorHandler, using
- * {@link TransformerException} classes.
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface ErrorListener {
-
- //-------------------------------------------------------------
- // Interface: ErrorListener -----------------------------------
- //-------------------------------------------------------------
-
- public void error(TransformerException exception)
- throws TransformerException;
-
- public void fatalError(TransformerException exception)
- throws TransformerException;
-
- public void warning(TransformerException exception)
- throws TransformerException;
-
-
-} // ErrorListener
-
diff --git a/external/jaxp/source/javax/xml/transform/OutputKeys.java b/external/jaxp/source/javax/xml/transform/OutputKeys.java
deleted file mode 100644
index bfb9619da..000000000
--- a/external/jaxp/source/javax/xml/transform/OutputKeys.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * $Id: OutputKeys.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * Provides names for XSLT output attributes.
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class OutputKeys {
-
- //-------------------------------------------------------------
- // Constants --------------------------------------------------
- //-------------------------------------------------------------
-
- public static final String CDATA_SECTION_ELEMENTS = "cdata-section-elements";
- public static final String DOCTYPE_PUBLIC = "doctype-public";
- public static final String DOCTYPE_SYSTEM = "doctype-system";
- public static final String ENCODING = "encoding";
- public static final String INDENT = "indent";
- public static final String MEDIA_TYPE = "media-type";
- public static final String METHOD = "method";
- public static final String OMIT_XML_DECLARATION = "omit-xml-declaration";
- public static final String STANDALONE = "standalone";
- public static final String VERSION = "version";
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- private OutputKeys() {
- } // OutputKeys()
-
-
-} // OutputKeys
-
diff --git a/external/jaxp/source/javax/xml/transform/Result.java b/external/jaxp/source/javax/xml/transform/Result.java
deleted file mode 100644
index e023f607a..000000000
--- a/external/jaxp/source/javax/xml/transform/Result.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * $Id: Result.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * Result
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface Result {
-
- //-------------------------------------------------------------
- // Constants --------------------------------------------------
- //-------------------------------------------------------------
-
- public static final String PI_DISABLE_OUTPUT_ESCAPING =
- "javax.xml.transform.disable-output-escaping";
-
- public static final String PI_ENABLE_OUTPUT_ESCAPING =
- "javax.xml.transform.disable-output-escaping";
-
-
- //-------------------------------------------------------------
- // Interface: Result ------------------------------------------
- //-------------------------------------------------------------
-
- public String getSystemId();
-
- public void setSystemId(String systemID);
-
-
-} // Result
-
diff --git a/external/jaxp/source/javax/xml/transform/Source.java b/external/jaxp/source/javax/xml/transform/Source.java
deleted file mode 100644
index 50fe85e01..000000000
--- a/external/jaxp/source/javax/xml/transform/Source.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * $Id: Source.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * Identifies the URI for either a transformation (XSLT stylesheet)
- * or an input to a transformation (XML document to be transformed).
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public interface Source {
-
- //-------------------------------------------------------------
- // Interface: Source ------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Returns the URI for this source. Some sources may not need URIs,
- * for example ones provided as an input stream, but such URIs
- * are important for resolving relative URIs and for providing
- * usable diagnostics.
- */
- public String getSystemId();
-
- /**
- * Associates a URI with this source.
- *
- * @param systemID the URI
- */
- public void setSystemId(String systemID);
-
-
-} // Source
-
diff --git a/external/jaxp/source/javax/xml/transform/SourceLocator.java b/external/jaxp/source/javax/xml/transform/SourceLocator.java
deleted file mode 100644
index 978de72c5..000000000
--- a/external/jaxp/source/javax/xml/transform/SourceLocator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $Id: SourceLocator.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * JAXP/transform analogue of SAX Locator.
- * @see org.xml.sax.Locator
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface SourceLocator {
-
- //-------------------------------------------------------------
- // Interface: SourceLocator -----------------------------------
- //-------------------------------------------------------------
-
- public String getPublicId();
-
- public String getSystemId();
-
- public int getLineNumber();
-
- public int getColumnNumber();
-
-
-} // SourceLocator
-
-
diff --git a/external/jaxp/source/javax/xml/transform/Templates.java b/external/jaxp/source/javax/xml/transform/Templates.java
deleted file mode 100644
index eb3fd085f..000000000
--- a/external/jaxp/source/javax/xml/transform/Templates.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * $Id: Templates.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-// Imports
-import java.util.Properties;
-
-/**
- * Encapsulates a pre-parsed (reusable) XSLT transform.
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface Templates {
-
- //-------------------------------------------------------------
- // Interface: Templates ---------------------------------------
- //-------------------------------------------------------------
-
- public Transformer newTransformer()
- throws TransformerConfigurationException;
-
- public Properties getOutputProperties();
-
-
-} // Templates
-
diff --git a/external/jaxp/source/javax/xml/transform/Transformer.java b/external/jaxp/source/javax/xml/transform/Transformer.java
deleted file mode 100644
index cc57ec421..000000000
--- a/external/jaxp/source/javax/xml/transform/Transformer.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * $Id: Transformer.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-// Imports
-import java.util.Properties;
-
-/**
- * Apply a transformation from a source, populating a result.
- * Transformers may be reused, but not concurrently.
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public abstract class Transformer {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /** Default constructor, for use only by subclasses. */
- protected Transformer() {
- } // Transformer()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Clears all parameter settings.
- * @see #setParameter
- */
- public abstract void clearParameters();
-
- /** Returns the error handler used as documents are transformed. */
- public abstract ErrorListener getErrorListener();
-
- /**
- * Returns a copy of the transformer's non-default output properties.
- * That is, properties set in the stylesheet or through
- * methods on this class are not set.
- * @see OutputKeys
- * @see #setOutputProperties
- */
- public abstract Properties getOutputProperties();
-
- /**
- * Returns the value of a property applying to this transform.
- * Values returned by this method are only those that have
- * been set explicitly.
- * @see OutputKeys
- * @see #setOutputProperty
- */
- public abstract String getOutputProperty(String name)
- throws IllegalArgumentException;
-
- /**
- * Returns the value of a parameter passed to this transform.
- * These are primarily for use access within transformations
- * and extensions.
- * @see #setParameter
- */
- public abstract Object getParameter(String name);
-
- /** Returns the resolver applied to documents being transformed. */
- public abstract URIResolver getURIResolver();
-
- /** Assigns the error handler used as documents are transformed. */
- public abstract void setErrorListener(ErrorListener listener)
- throws IllegalArgumentException;
- /**
- * Assigns a set of output properties, as if made by multiple
- * calls to {@link #setOutputProperty}.
- * @see OutputKeys
- * @param outputformat set of properties, or null to reset all
- * properties to their default values
- */
- public abstract void setOutputProperties(Properties outputformat)
- throws IllegalArgumentException;
-
- /**
- * Assigns the value of a transformation property, affecting
- * generation of output (mostly text syntax). Parameters include
- * those defined by the xslt:output element. Default settings may
- * be explicitly overridden.
- * @see OutputKeys
- * @see #getOutputProperty
- * @see #setOutputProperties
- * @param name an XML name, or a namespace-scoped XML name
- * encoded as <em>{uri}localName</em>.
- * @param value associated with the name
- */
- public abstract void setOutputProperty(String name, String value)
- throws IllegalArgumentException;
-
- /**
- * Assigns the value of a parameter passed to this transform.
- * These are primarily for use access within transformations
- * and extensions.
- * @see #getParameter
- * @see #clearParameters
- * @param name an XML name, or a namespace-scoped XML name
- * encoded as <em>{uri}localName</em>.
- * @param value associated with the name
- */
- public abstract void setParameter(String name, Object value);
-
- /** Assigns the resolver applied to documents being transformed. */
- public abstract void setURIResolver(URIResolver resolver);
-
- /** Apply the appropriate transformation */
- public abstract void transform(Source source, Result result)
- throws TransformerException;
-
-} // Transformer
-
diff --git a/external/jaxp/source/javax/xml/transform/TransformerConfigurationException.java b/external/jaxp/source/javax/xml/transform/TransformerConfigurationException.java
deleted file mode 100644
index 7af8ab5f3..000000000
--- a/external/jaxp/source/javax/xml/transform/TransformerConfigurationException.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * $Id: TransformerConfigurationException.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * TransformerConfigurationException
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class TransformerConfigurationException extends TransformerException {
-
- protected SourceLocator locator = null;
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public TransformerConfigurationException() {
- super((String)null);
- } // TransformerConfigurationException()
-
- public TransformerConfigurationException(String msg) {
- super(msg);
- } // TransformerConfigurationException()
-
- public TransformerConfigurationException(Throwable ex) {
- super(ex);
- } // TransformerConfigurationException()
-
- public TransformerConfigurationException(String msg, Throwable ex) {
- super(msg, ex);
- } // TransformerConfigurationException()
-
- public TransformerConfigurationException(String msg, SourceLocator locator) {
- super(msg);
- this.locator = locator;
- }
-
- public TransformerConfigurationException(String msg, SourceLocator locator, Throwable ex) {
- super(msg, ex);
- this.locator = locator;
- }
-
-} // TranformerConfigurationException
-
-
diff --git a/external/jaxp/source/javax/xml/transform/TransformerException.java b/external/jaxp/source/javax/xml/transform/TransformerException.java
deleted file mode 100644
index f2647209f..000000000
--- a/external/jaxp/source/javax/xml/transform/TransformerException.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * $Id: TransformerException.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-// Imports
-import java.io.*;
-
-/**
- * Encapsulates a problem exposed during a transformation.
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public class TransformerException extends Exception {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- private SourceLocator locator = null;
- private Throwable containedException = null;
- private boolean causeKnown;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public TransformerException(String msg) {
- super(msg);
- }
-
- public TransformerException(Throwable cause) {
- super();
- initCause (cause);
- }
-
- public TransformerException(String msg, Throwable cause) {
- super(msg);
- initCause (cause);
- }
-
- public TransformerException(String msg, SourceLocator locator) {
- super(msg);
- setLocator (locator);
- }
-
- public TransformerException(String msg, SourceLocator locator,
- Throwable cause) {
- super(msg);
- setLocator (locator);
- initCause (cause);
- }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Returns the root cause of this exception,
- * or null if none is known.
- */
- public Throwable getCause() {
- return containedException;
- }
-
- /**
- * Synonym for {@link #getCause}.
- */
- public Throwable getException() {
- return containedException;
- }
-
- /**
- * Returns a readable version of the locator info, or null
- * if there is no locator.
- */
- public String getLocationAsString() {
- if (locator == null)
- return null;
-
- StringBuffer retval = new StringBuffer ();
-
- if (locator.getPublicId () != null) {
- retval.append ("public='");
- retval.append (locator.getPublicId ());
- retval.append ("' ");
- }
- if (locator.getSystemId () != null) {
- retval.append ("uri='");
- retval.append (locator.getSystemId ());
- retval.append ("' ");
- }
- if (locator.getLineNumber () != -1) {
- retval.append ("line=");
- retval.append (locator.getLineNumber ());
- retval.append (" ");
- }
- if (locator.getColumnNumber () != -1) {
- retval.append ("column=");
- retval.append (locator.getColumnNumber ());
- //retval.append (" ");
- }
- return retval.toString ();
- }
-
- public SourceLocator getLocator() {
- return locator;
- }
-
- /**
- * Returns this exception's message, with readable location
- * information appended if it is available.
- */
- public String getMessageAndLocation() {
- if (locator == null)
- return getMessage ();
- return getMessage () + ": " + getLocationAsString ();
- }
-
- /**
- * Records the root cause of this exception; may be
- * called only once, normally during initialization.
- */
- public synchronized Throwable initCause(Throwable cause) {
- if (cause == this)
- throw new IllegalArgumentException ();
- if (containedException != null)
- throw new IllegalStateException ();
- containedException = cause;
- causeKnown = true;
-// FIXME: spec implies "this" may be the right value; another bug?
- return cause;
- }
-
-
- public void printStackTrace() {
- printStackTrace(System.out);// shouldn't it be System.err?
- }
-
- public void printStackTrace(PrintStream stream) {
- PrintWriter out = new PrintWriter(
- new OutputStreamWriter(stream));
- printStackTrace(out);
- out.flush ();
- }
-
- public void printStackTrace(PrintWriter writer) {
- if (containedException != null) {
- containedException.printStackTrace(writer);
- }
- super.printStackTrace(writer);
- }
-
- public void setLocator (SourceLocator location) {
- locator = location;
- }
-}
diff --git a/external/jaxp/source/javax/xml/transform/TransformerFactory.java b/external/jaxp/source/javax/xml/transform/TransformerFactory.java
deleted file mode 100644
index 66ce93613..000000000
--- a/external/jaxp/source/javax/xml/transform/TransformerFactory.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * $Id: TransformerFactory.java,v 1.3 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-// Imports
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.File;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.util.Properties;
-
-/**
- * Abstract class extended by implementations.
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public abstract class TransformerFactory {
-
- /** Constructor, for use by subclasses. */
- protected TransformerFactory() {
- }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Returns an object encapsulating the &lt;?xml-stylesheet&nbsp;?&gt;
- * processing instruction from the document that matches the
- * specified criteria.
- */
- public abstract Source getAssociatedStylesheet(Source source,
- String media, String title, String charset)
- throws TransformerConfigurationException;
-
- /** Returns an implementation-specific attribute */
- public abstract Object getAttribute(String name)
- throws IllegalArgumentException;
-
- /** Returns the ErrorListener used when parsing stylesheets. */
- public abstract ErrorListener getErrorListener();
-
- /**
- * Exposes capabilities of the underlying implementation.
- * Examples include SAXSource.FEATURE and DOMResult.FEATURE.
- */
- public abstract boolean getFeature(String name);
-
- /** Returns the URIResolver used when parsing stylesheets. */
- public abstract URIResolver getURIResolver();
-
-
- /**
- * Returns a new TransformerFactory. The name of this class
- * is found by checking, in order:
- * the <em>javax.xml.transform.TransformerFactory</em>
- * system property,
- * <em>$JAVA_HOME/lib/jaxp.properties</em> for the key with
- * that same name,
- * JAR files in the class path with a <em>META-INF/services</em>
- * file with that same name,
- * else the compiled-in platform default.
- */
- public static TransformerFactory newInstance()
- throws TransformerFactoryConfigurationError
- {
- try {
- return (TransformerFactory) ClassStuff.createFactory (
- "javax.xml.transform.TransformerFactory",
- "com.icl.saxon.TransformerFactoryImpl"
- // "gnu.xml.util.SAXNullTransformerFactory"
- // "org.apache.xalan.processor.TransformerFactoryImpl"
- );
- } catch (ClassCastException e) {
- throw new TransformerFactoryConfigurationError(e);
- }
- }
-
-
- /**
- * Returns a pre-compiled stylesheet.
- * @param stylesheet XSLT stylesheet specifying transform
- */
- public abstract Templates newTemplates (Source stylesheet)
- throws TransformerConfigurationException;
-
- /**
- * Returns a transformer that performs the null transform.
- */
- public abstract Transformer newTransformer()
- throws TransformerConfigurationException;
-
- /**
- * Returns a transformer making a specified transform.
- * @param stylesheet XSLT stylesheet specifying transform
- */
- public abstract Transformer newTransformer (Source stylesheet)
- throws TransformerConfigurationException;
-
-
- /** Assigns an implementation-specific attribute */
- public abstract void setAttribute(String name, Object value)
- throws IllegalArgumentException;
-
- /** Assigns the ErrorListener used when parsing stylesheets. */
- public abstract void setErrorListener(ErrorListener listener)
- throws IllegalArgumentException;
-
- /** Assigns the URIResolver used when parsing stylesheets. */
- public abstract void setURIResolver(URIResolver resolver);
-}
diff --git a/external/jaxp/source/javax/xml/transform/TransformerFactoryConfigurationError.java b/external/jaxp/source/javax/xml/transform/TransformerFactoryConfigurationError.java
deleted file mode 100644
index d5a8381ad..000000000
--- a/external/jaxp/source/javax/xml/transform/TransformerFactoryConfigurationError.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * $Id: TransformerFactoryConfigurationError.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * Reports a {@link TransformerFactory} configuration error.
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public class TransformerFactoryConfigurationError extends Error
-{
- private Exception exception = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public TransformerFactoryConfigurationError ()
- { }
-
- public TransformerFactoryConfigurationError (Exception e)
- { exception = e; }
-
- public TransformerFactoryConfigurationError (Exception e, String msg)
- {
- super (msg);
- exception = e;
- }
-
- public TransformerFactoryConfigurationError (String msg)
- { super (msg); }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public String getMessage ()
- {
- if (super.getMessage () == null && exception != null)
- return exception.getMessage ();
- return super.getMessage ();
- }
-
- public Exception getException ()
- { return exception; }
-}
diff --git a/external/jaxp/source/javax/xml/transform/URIResolver.java b/external/jaxp/source/javax/xml/transform/URIResolver.java
deleted file mode 100644
index a827ed040..000000000
--- a/external/jaxp/source/javax/xml/transform/URIResolver.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform;
-
-/**
- * URIResolver
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface URIResolver {
-
- //-------------------------------------------------------------
- // Interface: URIResolver -------------------------------------
- //-------------------------------------------------------------
-
- public Source resolve(String href, String base)
- throws TransformerException;
-
-
-} // URIResolver
-
diff --git a/external/jaxp/source/javax/xml/transform/dom/DOMLocator.java b/external/jaxp/source/javax/xml/transform/dom/DOMLocator.java
deleted file mode 100644
index 1c580fca6..000000000
--- a/external/jaxp/source/javax/xml/transform/dom/DOMLocator.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * $Id: DOMLocator.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.dom;
-
-// Imports
-import org.w3c.dom.Node;
-import javax.xml.transform.SourceLocator;
-
-/**
- * DOM Locator
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface DOMLocator extends SourceLocator {
-
- //-------------------------------------------------------------
- // Interface: DOMLocator --------------------------------------
- //-------------------------------------------------------------
-
- public Node getOriginatingNode();
-
-
-} // DOMLocator
-
-
diff --git a/external/jaxp/source/javax/xml/transform/dom/DOMResult.java b/external/jaxp/source/javax/xml/transform/dom/DOMResult.java
deleted file mode 100644
index ebfc3c9fb..000000000
--- a/external/jaxp/source/javax/xml/transform/dom/DOMResult.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * $Id: DOMResult.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.dom;
-
-// Imports
-import org.w3c.dom.Node;
-import javax.xml.transform.Result;
-
-/**
- * DOM Result
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class DOMResult implements Result {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- public static final String FEATURE =
- "http://javax.xml.transform.dom.DOMResult/feature";
-
- private Node node = null;
- private String systemId = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public DOMResult() {
- } // DOMResult()
-
- public DOMResult(Node node) {
- this.node = node;
- } // DOMResult()
-
- public DOMResult(Node node, String systemID) {
- this.node = node;
- this.systemId = systemID;
- } // DOMResult()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public void setNode(Node node) {
- this.node = node;
- } // setNode()
-
- public Node getNode() {
- return node;
- } // getNode()
-
- public void setSystemId(String systemID) {
- this.systemId = systemID;
- } // systemID()
-
- public String getSystemId() {
- return systemId;
- } // getSystemId()
-
-
-} // DOMResult
-
diff --git a/external/jaxp/source/javax/xml/transform/dom/DOMSource.java b/external/jaxp/source/javax/xml/transform/dom/DOMSource.java
deleted file mode 100644
index 66e61fd38..000000000
--- a/external/jaxp/source/javax/xml/transform/dom/DOMSource.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * $Id: DOMSource.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.dom;
-
-// Imports
-import org.w3c.dom.Node;
-import javax.xml.transform.Source;
-
-/**
- * DOM Source
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class DOMSource implements Source {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- public static final String FEATURE =
- "http://javax.xml.transform.dom.DOMSource/feature";
-
- private Node node = null;
- String baseID = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public DOMSource() {
- } // DOMSource()
-
- public DOMSource(Node node) {
- this.node = node;
- } // DOMSource()
-
- public DOMSource(Node node, String systemID) {
- this.node = node;
- this.baseID = systemID;
- } // DOMSource()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public void setNode(Node node) {
- this.node = node;
- } // setNode()
-
- public Node getNode() {
- return node;
- } // getNode()
-
- public void setSystemId(String systemID) {
- baseID = systemID;
- } // setSystemId()
-
- public String getSystemId() {
- return baseID;
- } // getSystemId()
-
-
-} // DOMSource
-
diff --git a/external/jaxp/source/javax/xml/transform/dom/package.html b/external/jaxp/source/javax/xml/transform/dom/package.html
deleted file mode 100644
index 0600fc724..000000000
--- a/external/jaxp/source/javax/xml/transform/dom/package.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html><head>trax for dom</head><body>
-
-<p>Support for DOM inputs and outputs to transformers.
-
-</body></html>
diff --git a/external/jaxp/source/javax/xml/transform/package.html b/external/jaxp/source/javax/xml/transform/package.html
deleted file mode 100644
index bc67c2b80..000000000
--- a/external/jaxp/source/javax/xml/transform/package.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<html><head>trax </head><body>
-
-<p>Base "TRAX" API for XSLT transformers.
-This API borrows many structural notions from SAX,
-such as the way error handling and external entity
-resolution are handled, although it does not reuse
-the corresponding SAX classes.
-To use XSLT transformers: <ul>
-
-<li>Start with <em>TransformerFactory.newInstance()</em>;
-
-<li>Then you may wish to configure that factory through
-its features and properties. This includes modifying
-the way errors are handled and URIs are resolved.
-
-<li>Then you have several options for how to perform
-the XSLT transformations. One generic option is to ask the
-factory for a <a href="Transformer.html">Transformer</a>
-and then use <em>Transformer.transform()</em> to pull
-input text onto output text.
-
-<li>Alternatively, most factories support flexible integration
-with SAX event streams. You can cast such factories to a
-<a href="sax/SAXTransformerFactory.html">SAXTransformerFactory</a>
-and perform either push or pull mode transformations.
-
-</ul>
-
-<p>The <a href="OutputKeys.html">OutputKeys</a> class
-holds constants that can be used to configure output
-properties used with <em>Result</em> objects, as if
-they were specified in <em>xslt:output</em> attributes
-in the stylesheet specifying the transform.
-
-<p>The <a href="Templates.html">Templates</a> class
-accomodates the notion of "compiled" transforms.
-
-</body></html>
diff --git a/external/jaxp/source/javax/xml/transform/sax/SAXResult.java b/external/jaxp/source/javax/xml/transform/sax/SAXResult.java
deleted file mode 100644
index 66260bca1..000000000
--- a/external/jaxp/source/javax/xml/transform/sax/SAXResult.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * $Id: SAXResult.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.sax;
-
-// Imports
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ext.LexicalHandler;
-import javax.xml.transform.Result;
-
-/**
- * Collects the result of a SAX transform.
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public class SAXResult implements Result
-{
- /**
- * Used with <em>TransformerFactory.getFeature()</em> to determine
- * whether the transformers it produces support SAXResult objects
- * as outputs.
- */
- public static final String FEATURE =
- "http://javax.xml.transform.sax.SAXResult/feature";
-
- private ContentHandler handler = null;
- private LexicalHandler lexhandler = null;
- private String systemId = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public SAXResult() {
- } // SAXResult()
-
- public SAXResult(ContentHandler handler) {
- this.handler = handler;
- } // SAXResult()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public ContentHandler getHandler() {
- return handler;
- }
-
- public String getSystemId() {
- return systemId;
- }
-
- public LexicalHandler getLexicalHandler() {
- return lexhandler;
- }
-
-
- public void setHandler(ContentHandler handler) {
- this.handler = handler;
- }
-
- public void setSystemId(String systemID) {
- this.systemId = systemID;
- }
-
- public void setLexicalHandler(LexicalHandler lexHandler) {
- this.lexhandler = lexHandler;
- }
-}
diff --git a/external/jaxp/source/javax/xml/transform/sax/SAXSource.java b/external/jaxp/source/javax/xml/transform/sax/SAXSource.java
deleted file mode 100644
index cf227eda6..000000000
--- a/external/jaxp/source/javax/xml/transform/sax/SAXSource.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * $Id: SAXSource.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.sax;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.InputSource;
-import javax.xml.transform.Source;
-import javax.xml.transform.stream.StreamSource;
-
-
-/**
- * Acts as a holder for "pull style" inputs to an XSLT transform.
- * SAX based transforms can support a second style of inputs,
- * driving by a {@link TransformerHandler} as output of some
- * other SAX processing pipeline. stage.
- *
- * @see SAXTransformerFactory#newTransformerHandler
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public class SAXSource implements Source
-{
- /**
- * Used with <em>TransformerFactory.getFeature()</em> to determine
- * whether the transformers it produces support SAXSource objects
- * (possibly without URIs) as inputs.
- */
- public static final String FEATURE =
- "http://javax.xml.transform.sax.SAXSource/feature";
-
- private XMLReader reader = null;
- private InputSource inputSource = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public SAXSource() {
- } // SAXSource()
-
- public SAXSource(XMLReader reader, InputSource source) {
- this.reader = reader;
- this.inputSource = source;
- } // SAXSource()
-
- public SAXSource(InputSource source) {
- this.inputSource = source;
- } // SAXSource()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public void setXMLReader(XMLReader reader) {
- this.reader = reader;
- } // setXMLReader()
-
- public XMLReader getXMLReader() {
- return reader;
- } // getXMLReader()
-
- public void setInputSource(InputSource source) {
- this.inputSource = source;
- } // setInputSource()
-
- public InputSource getInputSource() {
- return inputSource;
- } // inputSource()
-
- public void setSystemId(String systemID) {
- if (inputSource != null) {
- inputSource.setSystemId(systemID);
- }
- } // setSystemId()
-
- public String getSystemId() {
- if (inputSource != null) {
- return inputSource.getSystemId();
- } // if
- return null;
- } // getSystemId()
-
- /**
- * Creates a SAX input source from its argument.
- * Understands StreamSource and System ID based input sources,
- * and insists on finding either a system ID (URI) or some kind
- * of input stream (character or byte).
- *
- * @param in TRAX style input source
- * @return SAX input source, or null if one could not be
- * created.
- */
- public static InputSource sourceToInputSource (Source in)
- {
- InputSource retval;
- boolean ok = false;
-
- if (in instanceof SAXSource) {
- return ((SAXSource) in).inputSource;
- }
-
- if (in.getSystemId () != null) {
- retval = new InputSource (in.getSystemId ());
- ok = true;
- } else
- retval = new InputSource ();
-
- if (in instanceof StreamSource) {
- StreamSource ss = (StreamSource) in;
-
- if (ss.getReader () != null) {
- retval.setCharacterStream (ss.getReader ());
- ok = true;
- } else if (ss.getInputStream () != null) {
- retval.setByteStream (ss.getInputStream ());
- ok = true;
- }
- if (ss.getPublicId () != null)
- retval.setPublicId (ss.getPublicId ());
- }
-
- return ok ? retval : null;
- }
-}
diff --git a/external/jaxp/source/javax/xml/transform/sax/SAXTransformerFactory.java b/external/jaxp/source/javax/xml/transform/sax/SAXTransformerFactory.java
deleted file mode 100644
index 8dca4b0f0..000000000
--- a/external/jaxp/source/javax/xml/transform/sax/SAXTransformerFactory.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * $Id: SAXTransformerFactory.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.sax;
-
-// Imports
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLFilter;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.Result;
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.TransformerConfigurationException;
-
-/**
- * A TransformerFactory that supports several separate modes for
- * working with SAX inputs and outputs. Those modes include: <ul>
- *
- * <li> Pipeline Stage, pushing events through {@link TransformerHandler}
- * objects used as SAX handlers, and passing the transformed data
- * through a {@link SAXResult} encapsulating SAX ContentHandler and
- * LexicalHandler objects;
- * <li> Pipeline Termination, like a normal pipeline stage but using some
- * other kind of {@link Result} to store transformed data rather than
- * passing it to another stage;
- * <li> Event producer, an {@link XMLFilter} object taking data from a URI
- * or from a SAX {@link InputSource} input object and delivering it
- * to a SAX ContentHandler;
- * <li> Transformer objects produced by this factory will usually be able
- * to accept {@link SAXSource} objects as inputs, and the XMLReader
- * object in such a source could be an XMLFilter.
- * </ul>
- *
- * <p>Transformer objects produced by this factory will of course be
- * able to perform {@link Transformer#transform Transformer.transform()}
- * operations to map XML text into other text.
- *
- * <p>The factory also supports creating Templates objects.
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public abstract class SAXTransformerFactory extends TransformerFactory
-{
- /**
- * Used with <em>TransformerFactory.getFeature()</em> to determine
- * whether the transformers it produces extend this class.
- */
- public static final String FEATURE =
- "http://javax.xml.transform.sax.SAXTransformerFactory/feature";
-
- /**
- * Used with <em>TransformerFactory.getFeature()</em> to determine
- * whether <em>newXMLFilter()</em> methods are supported.
- */
- public static final String FEATURE_XMLFILTER =
- "http://javax.xml.transform.sax.SAXTransformerFactory/feature/xmlfilter";
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /** Constructor, for use with subclasses */
- protected SAXTransformerFactory() {
- }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Returns a SAX event consumer sending its inputs to some Result
- * after transforming them according to a stylesheet.
- */
- public abstract TransformerHandler
- newTransformerHandler (Source stylesheet)
- throws TransformerConfigurationException;
-
- /**
- * Returns a SAX event consumer sending its inputs to some Result
- * after transforming them according to a pre-parsed stylesheet.
- */
- public abstract TransformerHandler
- newTransformerHandler (Templates stylesheet)
- throws TransformerConfigurationException;
-
- /**
- * Returns a SAX event consumer sending its inputs to some Result
- * without transforming them (null transformation).
- */
- public abstract TransformerHandler newTransformerHandler()
- throws TransformerConfigurationException;
-
- /**
- * Returns a SAX parser that transforms XML data according
- * to a stylesheet before reporting SAX events.
- */
- public abstract XMLFilter newXMLFilter (Source stylesheet)
- throws TransformerConfigurationException;
-
- /**
- * Returns a SAX parser that transforms XML data according
- * to a pre-parsed stylesheet before reporting SAX events.
- */
- public abstract XMLFilter newXMLFilter (Templates stylesheet)
- throws TransformerConfigurationException;
-
- /**
- * Returns a SAX event consumer collecting its inputs into
- * a pre-parsed stylesheet.
- */
- public abstract TemplatesHandler newTemplatesHandler()
- throws TransformerConfigurationException;
-
-}
diff --git a/external/jaxp/source/javax/xml/transform/sax/TemplatesHandler.java b/external/jaxp/source/javax/xml/transform/sax/TemplatesHandler.java
deleted file mode 100644
index 4a813de76..000000000
--- a/external/jaxp/source/javax/xml/transform/sax/TemplatesHandler.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * $Id: TemplatesHandler.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.sax;
-
-// Imports
-import org.xml.sax.ContentHandler;
-import javax.xml.transform.Templates;
-
-/**
- * Handler used to create pre-parsed XSLT transforms.
- * @author Andrew Selkirk
- * @version 1.0
- */
-public interface TemplatesHandler extends ContentHandler {
-
- //-------------------------------------------------------------
- // Interface: TemplatesHandler --------------------------------
- //-------------------------------------------------------------
-
- public Templates getTemplates();
-
- public void setSystemId(String systemID);
-
- public String getSystemId();
-
-
-} // TemplatesHandler
-
diff --git a/external/jaxp/source/javax/xml/transform/sax/TransformerHandler.java b/external/jaxp/source/javax/xml/transform/sax/TransformerHandler.java
deleted file mode 100644
index 5f093fcd6..000000000
--- a/external/jaxp/source/javax/xml/transform/sax/TransformerHandler.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * $Id: TransformerHandler.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.sax;
-
-import org.xml.sax.ContentHandler;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ext.LexicalHandler;
-import javax.xml.transform.Result;
-import javax.xml.transform.Transformer;
-
-
-/**
- * Transforms SAX input events to a Result, according to some
- * stylesheet. Note the expectation that XSLT transforms will
- * discard most DTD declarations (DeclHandler is not supported).
- *
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public interface TransformerHandler
- extends ContentHandler, LexicalHandler, DTDHandler
-{
- /**
- * Assigns the result of the transform.
- */
- public void setResult(Result result)
- throws IllegalArgumentException;
-
- public void setSystemId(String systemID);
-
- public String getSystemId();
-
- /**
- * Returns the associated transformer, for use in setting
- * parameters and output properties.
- */
- public Transformer getTransformer();
-}
diff --git a/external/jaxp/source/javax/xml/transform/sax/package.html b/external/jaxp/source/javax/xml/transform/sax/package.html
deleted file mode 100644
index b2d2978a3..000000000
--- a/external/jaxp/source/javax/xml/transform/sax/package.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html><head>trax for sax</head><body>
-
-<p>Support for SAX2-based XSLT transformers.
-Normally you would cast a TransformerFactory to a
-<a href="SAXTransformerFactory.html">SAXTransformerFactory</a>
-and use that to in any of the various modes supported
-(such as push or pull).
-
-</body></html>
diff --git a/external/jaxp/source/javax/xml/transform/stream/StreamResult.java b/external/jaxp/source/javax/xml/transform/stream/StreamResult.java
deleted file mode 100644
index ac7750bee..000000000
--- a/external/jaxp/source/javax/xml/transform/stream/StreamResult.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * $Id: StreamResult.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.stream;
-
-import java.io.OutputStream;
-import java.io.Writer;
-import java.io.File;
-import java.io.IOException;
-import javax.xml.transform.Result;
-
-
-/**
- * Stream Result
- * @author Andrew Selkirk, David Brownell
- * @version 1.0
- */
-public class StreamResult implements Result {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- public static final String FEATURE =
- "http://javax.xml.transform.stream.StreamResult/feature";
-
- private String systemId = null;
- private OutputStream outputStream = null;
- private Writer writer = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public StreamResult() {
- }
-
- public StreamResult(OutputStream stream) {
- this.outputStream = stream;
- }
-
- public StreamResult(Writer writer) {
- this.writer = writer;
- }
-
- public StreamResult(String systemID) {
- this.systemId = systemID;
- }
-
- public StreamResult(File file) {
- setSystemId (file);
- }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public OutputStream getOutputStream() {
- return outputStream;
- }
-
- public String getSystemId() {
- return systemId;
- }
-
- public Writer getWriter() {
- return writer;
- }
-
- public void setOutputStream(OutputStream stream) {
- this.outputStream = stream;
- }
-
- public void setWriter(Writer writer) {
- this.writer = writer;
- }
-
- public void setSystemId(File file) {
- try {
- this.systemId = StreamSource.fileToURL (file).toString ();
- } catch (IOException e) {
- // can't happen
- throw new RuntimeException (e.getMessage ());
- }
- }
-
- public void setSystemId(String systemID) {
- this.systemId = systemID;
- }
-}
diff --git a/external/jaxp/source/javax/xml/transform/stream/StreamSource.java b/external/jaxp/source/javax/xml/transform/stream/StreamSource.java
deleted file mode 100644
index 22d6a306a..000000000
--- a/external/jaxp/source/javax/xml/transform/stream/StreamSource.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * $Id: StreamSource.java,v 1.2 2004-05-01 16:18:51 mark Exp $
- * Copyright (C) 2001 Andrew Selkirk
- * Copyright (C) 2001 David Brownell
- *
- * This file is part of GNU JAXP, a library.
- *
- * GNU JAXP is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GNU JAXP is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * As a special exception, if you link this library with other files to
- * produce an executable, this library does not by itself cause the
- * resulting executable to be covered by the GNU General Public License.
- * This exception does not however invalidate any other reasons why the
- * executable file might be covered by the GNU General Public License.
- */
-package javax.xml.transform.stream;
-
-import java.io.InputStream;
-import java.io.Reader;
-import java.io.File;
-import java.io.IOException;
-import javax.xml.transform.Source;
-
-
-/**
- * Stream Source
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class StreamSource implements Source {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- public static final String FEATURE =
- "http://javax.xml.transform.stream.StreamSource/feature";
-
- private String publicId = null;
- private String systemId = null;
- private InputStream inputStream = null;
- private Reader reader = null;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- public StreamSource() {
- }
-
- public StreamSource(File file) {
- setSystemId (file);
- }
-
- public StreamSource(InputStream stream) {
- this.inputStream = stream;
- }
-
- public StreamSource(InputStream stream, String systemID) {
- this.inputStream = stream;
- this.systemId = systemID;
- }
-
- public StreamSource(Reader reader) {
- this.reader = reader;
- }
-
- public StreamSource(Reader reader, String systemID) {
- this.reader = reader;
- this.systemId = systemID;
- }
-
- public StreamSource(String systemID) {
- this.systemId = systemID;
- }
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- public InputStream getInputStream() {
- return inputStream;
- }
-
- public String getPublicId() {
- return publicId;
- }
-
- public Reader getReader() {
- return reader;
- }
-
- public String getSystemId() {
- return systemId;
- }
-
-
- public void setInputStream(InputStream stream) {
- this.inputStream = stream;
- }
-
- public void setPublicId(String publicID) {
- this.publicId = publicID;
- }
-
- public void setReader(Reader reader) {
- this.reader = reader;
- }
-
- public void setSystemId(File file) {
- try {
- this.systemId = fileToURL (file).toString ();
- } catch (IOException e) {
- // can't happen
- throw new RuntimeException (e.getMessage ());
- }
- }
-
- public void setSystemId(String systemID) {
- this.systemId = systemID;
- }
-
- // we don't demand jdk 1.2 File.toURL() in the runtime
- // keep in sync with gnu.xml.util.Resolver
- // and javax.xml.parsers.DocumentBuilder
- static String fileToURL (File f)
- throws IOException
- {
- String temp;
-
- // FIXME: getAbsolutePath() seems buggy; I'm seeing components
- // like "/foo/../" which are clearly not "absolute"
- // and should have been resolved with the filesystem.
-
- // Substituting "/" would be wrong, "foo" may have been
- // symlinked ... the URL code will make that change
- // later, so that things can get _really_ broken!
-
- temp = f.getAbsolutePath ();
-
- if (File.separatorChar != '/')
- temp = temp.replace (File.separatorChar, '/');
- if (!temp.startsWith ("/"))
- temp = "/" + temp;
- if (!temp.endsWith ("/") && f.isDirectory ())
- temp = temp + "/";
- return "file:" + temp;
- }
-}
diff --git a/external/jaxp/source/javax/xml/transform/stream/package.html b/external/jaxp/source/javax/xml/transform/stream/package.html
deleted file mode 100644
index f9d052b19..000000000
--- a/external/jaxp/source/javax/xml/transform/stream/package.html
+++ /dev/null
@@ -1,6 +0,0 @@
-<html><head>trax for streams</head><body>
-
-<p>Support for text stream inputs and outputs to transformers.
-
-</body></html>
-
diff --git a/external/jaxp/source/org/w3c/dom/Attr.java b/external/jaxp/source/org/w3c/dom/Attr.java
deleted file mode 100755
index 4ba62e239..000000000
--- a/external/jaxp/source/org/w3c/dom/Attr.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>Attr</code> interface represents an attribute in an
- * <code>Element</code> object. Typically the allowable values for the
- * attribute are defined in a document type definition.
- * <p><code>Attr</code> objects inherit the <code>Node</code> interface, but
- * since they are not actually child nodes of the element they describe, the
- * DOM does not consider them part of the document tree. Thus, the
- * <code>Node</code> attributes <code>parentNode</code>,
- * <code>previousSibling</code>, and <code>nextSibling</code> have a
- * <code>null</code> value for <code>Attr</code> objects. The DOM takes the
- * view that attributes are properties of elements rather than having a
- * separate identity from the elements they are associated with; this should
- * make it more efficient to implement such features as default attributes
- * associated with all elements of a given type. Furthermore,
- * <code>Attr</code> nodes may not be immediate children of a
- * <code>DocumentFragment</code>. However, they can be associated with
- * <code>Element</code> nodes contained within a
- * <code>DocumentFragment</code>. In short, users and implementors of the
- * DOM need to be aware that <code>Attr</code> nodes have some things in
- * common with other objects inheriting the <code>Node</code> interface, but
- * they also are quite distinct.
- * <p>The attribute's effective value is determined as follows: if this
- * attribute has been explicitly assigned any value, that value is the
- * attribute's effective value; otherwise, if there is a declaration for
- * this attribute, and that declaration includes a default value, then that
- * default value is the attribute's effective value; otherwise, the
- * attribute does not exist on this element in the structure model until it
- * has been explicitly added. Note that the <code>nodeValue</code> attribute
- * on the <code>Attr</code> instance can also be used to retrieve the string
- * version of the attribute's value(s).
- * <p>In XML, where the value of an attribute can contain entity references,
- * the child nodes of the <code>Attr</code> node may be either
- * <code>Text</code> or <code>EntityReference</code> nodes (when these are
- * in use; see the description of <code>EntityReference</code> for
- * discussion). Because the DOM Core is not aware of attribute types, it
- * treats all attribute values as simple strings, even if the DTD or schema
- * declares them as having tokenized types.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Attr extends Node {
- /**
- * Returns the name of this attribute.
- */
- public String getName();
-
- /**
- * If this attribute was explicitly given a value in the original
- * document, this is <code>true</code>; otherwise, it is
- * <code>false</code>. Note that the implementation is in charge of this
- * attribute, not the user. If the user changes the value of the
- * attribute (even if it ends up having the same value as the default
- * value) then the <code>specified</code> flag is automatically flipped
- * to <code>true</code>. To re-specify the attribute as the default
- * value from the DTD, the user must delete the attribute. The
- * implementation will then make a new attribute available with
- * <code>specified</code> set to <code>false</code> and the default
- * value (if one exists).
- * <br>In summary: If the attribute has an assigned value in the document
- * then <code>specified</code> is <code>true</code>, and the value is
- * the assigned value.If the attribute has no assigned value in the
- * document and has a default value in the DTD, then
- * <code>specified</code> is <code>false</code>, and the value is the
- * default value in the DTD.If the attribute has no assigned value in
- * the document and has a value of #IMPLIED in the DTD, then the
- * attribute does not appear in the structure model of the document.If
- * the <code>ownerElement</code> attribute is <code>null</code> (i.e.
- * because it was just created or was set to <code>null</code> by the
- * various removal and cloning operations) <code>specified</code> is
- * <code>true</code>.
- */
- public boolean getSpecified();
-
- /**
- * On retrieval, the value of the attribute is returned as a string.
- * Character and general entity references are replaced with their
- * values. See also the method <code>getAttribute</code> on the
- * <code>Element</code> interface.
- * <br>On setting, this creates a <code>Text</code> node with the unparsed
- * contents of the string. I.e. any characters that an XML processor
- * would recognize as markup are instead treated as literal text. See
- * also the method <code>setAttribute</code> on the <code>Element</code>
- * interface.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public String getValue();
- /**
- * On retrieval, the value of the attribute is returned as a string.
- * Character and general entity references are replaced with their
- * values. See also the method <code>getAttribute</code> on the
- * <code>Element</code> interface.
- * <br>On setting, this creates a <code>Text</code> node with the unparsed
- * contents of the string. I.e. any characters that an XML processor
- * would recognize as markup are instead treated as literal text. See
- * also the method <code>setAttribute</code> on the <code>Element</code>
- * interface.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public void setValue(String value)
- throws DOMException;
-
- /**
- * The <code>Element</code> node this attribute is attached to or
- * <code>null</code> if this attribute is not in use.
- * @since DOM Level 2
- */
- public Element getOwnerElement();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/CDATASection.java b/external/jaxp/source/org/w3c/dom/CDATASection.java
deleted file mode 100755
index f3aea8ae8..000000000
--- a/external/jaxp/source/org/w3c/dom/CDATASection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * CDATA sections are used to escape blocks of text containing characters that
- * would otherwise be regarded as markup. The only delimiter that is
- * recognized in a CDATA section is the "]]&gt;" string that ends the CDATA
- * section. CDATA sections cannot be nested. Their primary purpose is for
- * including material such as XML fragments, without needing to escape all
- * the delimiters.
- * <p>The <code>DOMString</code> attribute of the <code>Text</code> node holds
- * the text that is contained by the CDATA section. Note that this may
- * contain characters that need to be escaped outside of CDATA sections and
- * that, depending on the character encoding ("charset") chosen for
- * serialization, it may be impossible to write out some characters as part
- * of a CDATA section.
- * <p>The <code>CDATASection</code> interface inherits from the
- * <code>CharacterData</code> interface through the <code>Text</code>
- * interface. Adjacent <code>CDATASection</code> nodes are not merged by use
- * of the <code>normalize</code> method of the <code>Node</code> interface.
- * Because no markup is recognized within a <code>CDATASection</code>,
- * character numeric references cannot be used as an escape mechanism when
- * serializing. Therefore, action needs to be taken when serializing a
- * <code>CDATASection</code> with a character encoding where some of the
- * contained characters cannot be represented. Failure to do so would not
- * produce well-formed XML.One potential solution in the serialization
- * process is to end the CDATA section before the character, output the
- * character using a character reference or entity reference, and open a new
- * CDATA section for any further characters in the text node. Note, however,
- * that some code conversion libraries at the time of writing do not return
- * an error or exception when a character is missing from the encoding,
- * making the task of ensuring that data is not corrupted on serialization
- * more difficult.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface CDATASection extends Text {
-}
diff --git a/external/jaxp/source/org/w3c/dom/CharacterData.java b/external/jaxp/source/org/w3c/dom/CharacterData.java
deleted file mode 100755
index c067120f6..000000000
--- a/external/jaxp/source/org/w3c/dom/CharacterData.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>CharacterData</code> interface extends Node with a set of
- * attributes and methods for accessing character data in the DOM. For
- * clarity this set is defined here rather than on each object that uses
- * these attributes and methods. No DOM objects correspond directly to
- * <code>CharacterData</code>, though <code>Text</code> and others do
- * inherit the interface from it. All <code>offsets</code> in this interface
- * start from <code>0</code>.
- * <p>As explained in the <code>DOMString</code> interface, text strings in
- * the DOM are represented in UTF-16, i.e. as a sequence of 16-bit units. In
- * the following, the term 16-bit units is used whenever necessary to
- * indicate that indexing on CharacterData is done in 16-bit units.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface CharacterData extends Node {
- /**
- * The character data of the node that implements this interface. The DOM
- * implementation may not put arbitrary limits on the amount of data
- * that may be stored in a <code>CharacterData</code> node. However,
- * implementation limits may mean that the entirety of a node's data may
- * not fit into a single <code>DOMString</code>. In such cases, the user
- * may call <code>substringData</code> to retrieve the data in
- * appropriately sized pieces.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
- * fit in a <code>DOMString</code> variable on the implementation
- * platform.
- */
- public String getData()
- throws DOMException;
- /**
- * The character data of the node that implements this interface. The DOM
- * implementation may not put arbitrary limits on the amount of data
- * that may be stored in a <code>CharacterData</code> node. However,
- * implementation limits may mean that the entirety of a node's data may
- * not fit into a single <code>DOMString</code>. In such cases, the user
- * may call <code>substringData</code> to retrieve the data in
- * appropriately sized pieces.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
- * fit in a <code>DOMString</code> variable on the implementation
- * platform.
- */
- public void setData(String data)
- throws DOMException;
-
- /**
- * The number of 16-bit units that are available through <code>data</code>
- * and the <code>substringData</code> method below. This may have the
- * value zero, i.e., <code>CharacterData</code> nodes may be empty.
- */
- public int getLength();
-
- /**
- * Extracts a range of data from the node.
- * @param offset Start offset of substring to extract.
- * @param count The number of 16-bit units to extract.
- * @return The specified substring. If the sum of <code>offset</code> and
- * <code>count</code> exceeds the <code>length</code>, then all 16-bit
- * units to the end of the data are returned.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
- * negative or greater than the number of 16-bit units in
- * <code>data</code>, or if the specified <code>count</code> is
- * negative.
- * <br>DOMSTRING_SIZE_ERR: Raised if the specified range of text does
- * not fit into a <code>DOMString</code>.
- */
- public String substringData(int offset,
- int count)
- throws DOMException;
-
- /**
- * Append the string to the end of the character data of the node. Upon
- * success, <code>data</code> provides access to the concatenation of
- * <code>data</code> and the <code>DOMString</code> specified.
- * @param arg The <code>DOMString</code> to append.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void appendData(String arg)
- throws DOMException;
-
- /**
- * Insert a string at the specified 16-bit unit offset.
- * @param offset The character offset at which to insert.
- * @param arg The <code>DOMString</code> to insert.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
- * negative or greater than the number of 16-bit units in
- * <code>data</code>.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void insertData(int offset,
- String arg)
- throws DOMException;
-
- /**
- * Remove a range of 16-bit units from the node. Upon success,
- * <code>data</code> and <code>length</code> reflect the change.
- * @param offset The offset from which to start removing.
- * @param count The number of 16-bit units to delete. If the sum of
- * <code>offset</code> and <code>count</code> exceeds
- * <code>length</code> then all 16-bit units from <code>offset</code>
- * to the end of the data are deleted.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
- * negative or greater than the number of 16-bit units in
- * <code>data</code>, or if the specified <code>count</code> is
- * negative.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void deleteData(int offset,
- int count)
- throws DOMException;
-
- /**
- * Replace the characters starting at the specified 16-bit unit offset
- * with the specified string.
- * @param offset The offset from which to start replacing.
- * @param count The number of 16-bit units to replace. If the sum of
- * <code>offset</code> and <code>count</code> exceeds
- * <code>length</code>, then all 16-bit units to the end of the data
- * are replaced; (i.e., the effect is the same as a <code>remove</code>
- * method call with the same range, followed by an <code>append</code>
- * method invocation).
- * @param arg The <code>DOMString</code> with which the range must be
- * replaced.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified <code>offset</code> is
- * negative or greater than the number of 16-bit units in
- * <code>data</code>, or if the specified <code>count</code> is
- * negative.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void replaceData(int offset,
- int count,
- String arg)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Comment.java b/external/jaxp/source/org/w3c/dom/Comment.java
deleted file mode 100755
index 109792190..000000000
--- a/external/jaxp/source/org/w3c/dom/Comment.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * This interface inherits from <code>CharacterData</code> and represents the
- * content of a comment, i.e., all the characters between the starting '
- * <code>&lt;!--</code>' and ending '<code>--&gt;</code>'. Note that this is
- * the definition of a comment in XML, and, in practice, HTML, although some
- * HTML tools may implement the full SGML comment structure.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Comment extends CharacterData {
-}
diff --git a/external/jaxp/source/org/w3c/dom/DOMException.java b/external/jaxp/source/org/w3c/dom/DOMException.java
deleted file mode 100755
index 16866cebc..000000000
--- a/external/jaxp/source/org/w3c/dom/DOMException.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * DOM operations only raise exceptions in "exceptional" circumstances, i.e.,
- * when an operation is impossible to perform (either for logical reasons,
- * because data is lost, or because the implementation has become unstable).
- * In general, DOM methods return specific error values in ordinary
- * processing situations, such as out-of-bound errors when using
- * <code>NodeList</code>.
- * <p>Implementations should raise other exceptions under other circumstances.
- * For example, implementations should raise an implementation-dependent
- * exception if a <code>null</code> argument is passed.
- * <p>Some languages and object systems do not support the concept of
- * exceptions. For such systems, error conditions may be indicated using
- * native error reporting mechanisms. For some bindings, for example,
- * methods may return error codes similar to those listed in the
- * corresponding method descriptions.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public class DOMException extends RuntimeException {
- public DOMException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // ExceptionCode
- /**
- * If index or size is negative, or greater than the allowed value
- */
- public static final short INDEX_SIZE_ERR = 1;
- /**
- * If the specified range of text does not fit into a DOMString
- */
- public static final short DOMSTRING_SIZE_ERR = 2;
- /**
- * If any node is inserted somewhere it doesn't belong
- */
- public static final short HIERARCHY_REQUEST_ERR = 3;
- /**
- * If a node is used in a different document than the one that created it
- * (that doesn't support it)
- */
- public static final short WRONG_DOCUMENT_ERR = 4;
- /**
- * If an invalid or illegal character is specified, such as in a name. See
- * production 2 in the XML specification for the definition of a legal
- * character, and production 5 for the definition of a legal name
- * character.
- */
- public static final short INVALID_CHARACTER_ERR = 5;
- /**
- * If data is specified for a node which does not support data
- */
- public static final short NO_DATA_ALLOWED_ERR = 6;
- /**
- * If an attempt is made to modify an object where modifications are not
- * allowed
- */
- public static final short NO_MODIFICATION_ALLOWED_ERR = 7;
- /**
- * If an attempt is made to reference a node in a context where it does
- * not exist
- */
- public static final short NOT_FOUND_ERR = 8;
- /**
- * If the implementation does not support the requested type of object or
- * operation.
- */
- public static final short NOT_SUPPORTED_ERR = 9;
- /**
- * If an attempt is made to add an attribute that is already in use
- * elsewhere
- */
- public static final short INUSE_ATTRIBUTE_ERR = 10;
- /**
- * If an attempt is made to use an object that is not, or is no longer,
- * usable.
- * @since DOM Level 2
- */
- public static final short INVALID_STATE_ERR = 11;
- /**
- * If an invalid or illegal string is specified.
- * @since DOM Level 2
- */
- public static final short SYNTAX_ERR = 12;
- /**
- * If an attempt is made to modify the type of the underlying object.
- * @since DOM Level 2
- */
- public static final short INVALID_MODIFICATION_ERR = 13;
- /**
- * If an attempt is made to create or change an object in a way which is
- * incorrect with regard to namespaces.
- * @since DOM Level 2
- */
- public static final short NAMESPACE_ERR = 14;
- /**
- * If a parameter or an operation is not supported by the underlying
- * object.
- * @since DOM Level 2
- */
- public static final short INVALID_ACCESS_ERR = 15;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/DOMImplementation.java b/external/jaxp/source/org/w3c/dom/DOMImplementation.java
deleted file mode 100755
index 6e9a55404..000000000
--- a/external/jaxp/source/org/w3c/dom/DOMImplementation.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>DOMImplementation</code> interface provides a number of methods
- * for performing operations that are independent of any particular instance
- * of the document object model.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface DOMImplementation {
- /**
- * Test if the DOM implementation implements a specific feature.
- * @param feature The name of the feature to test (case-insensitive). The
- * values used by DOM features are defined throughout the DOM Level 2
- * specifications and listed in the section. The name must be an XML
- * name. To avoid possible conflicts, as a convention, names referring
- * to features defined outside the DOM specification should be made
- * unique.
- * @param version This is the version number of the feature to test. In
- * Level 2, the string can be either "2.0" or "1.0". If the version is
- * not specified, supporting any version of the feature causes the
- * method to return <code>true</code>.
- * @return <code>true</code> if the feature is implemented in the
- * specified version, <code>false</code> otherwise.
- */
- public boolean hasFeature(String feature,
- String version);
-
- /**
- * Creates an empty <code>DocumentType</code> node. Entity declarations
- * and notations are not made available. Entity reference expansions and
- * default attribute additions do not occur. It is expected that a
- * future version of the DOM will provide a way for populating a
- * <code>DocumentType</code>.
- * @param qualifiedName The qualified name of the document type to be
- * created.
- * @param publicId The external subset public identifier.
- * @param systemId The external subset system identifier.
- * @return A new <code>DocumentType</code> node with
- * <code>Node.ownerDocument</code> set to <code>null</code>.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name
- * contains an illegal character.
- * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
- * malformed.
- * <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
- * not support the <code>"XML"</code> feature, if they choose not to
- * support this method. Other features introduced in the future, by
- * the DOM WG or in extensions defined by other groups, may also
- * demand support for this method; please consult the definition of
- * the feature to see if it requires this method.
- * @since DOM Level 2
- */
- public DocumentType createDocumentType(String qualifiedName,
- String publicId,
- String systemId)
- throws DOMException;
-
- /**
- * Creates a DOM Document object of the specified type with its document
- * element.
- * @param namespaceURI The namespace URI of the document element to
- * create.
- * @param qualifiedName The qualified name of the document element to be
- * created.
- * @param doctype The type of document to be created or <code>null</code>.
- * When <code>doctype</code> is not <code>null</code>, its
- * <code>Node.ownerDocument</code> attribute is set to the document
- * being created.
- * @return A new <code>Document</code> object.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name
- * contains an illegal character.
- * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
- * malformed, if the <code>qualifiedName</code> has a prefix and the
- * <code>namespaceURI</code> is <code>null</code>, or if the
- * <code>qualifiedName</code> has a prefix that is "xml" and the
- * <code>namespaceURI</code> is different from "
- * http://www.w3.org/XML/1998/namespace" , or if the DOM
- * implementation does not support the <code>"XML"</code> feature but
- * a non-null namespace URI was provided, since namespaces were
- * defined by XML.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>doctype</code> has already
- * been used with a different document or was created from a different
- * implementation.
- * <br>NOT_SUPPORTED_ERR: May be raised by DOM implementations which do
- * not support the "XML" feature, if they choose not to support this
- * method. Other features introduced in the future, by the DOM WG or
- * in extensions defined by other groups, may also demand support for
- * this method; please consult the definition of the feature to see if
- * it requires this method.
- * @since DOM Level 2
- */
- public Document createDocument(String namespaceURI,
- String qualifiedName,
- DocumentType doctype)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Document.java b/external/jaxp/source/org/w3c/dom/Document.java
deleted file mode 100755
index 79214e017..000000000
--- a/external/jaxp/source/org/w3c/dom/Document.java
+++ /dev/null
@@ -1,428 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>Document</code> interface represents the entire HTML or XML
- * document. Conceptually, it is the root of the document tree, and provides
- * the primary access to the document's data.
- * <p>Since elements, text nodes, comments, processing instructions, etc.
- * cannot exist outside the context of a <code>Document</code>, the
- * <code>Document</code> interface also contains the factory methods needed
- * to create these objects. The <code>Node</code> objects created have a
- * <code>ownerDocument</code> attribute which associates them with the
- * <code>Document</code> within whose context they were created.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Document extends Node {
- /**
- * The Document Type Declaration (see <code>DocumentType</code>)
- * associated with this document. For HTML documents as well as XML
- * documents without a document type declaration this returns
- * <code>null</code>. The DOM Level 2 does not support editing the
- * Document Type Declaration. <code>docType</code> cannot be altered in
- * any way, including through the use of methods inherited from the
- * <code>Node</code> interface, such as <code>insertNode</code> or
- * <code>removeNode</code>.
- */
- public DocumentType getDoctype();
-
- /**
- * The <code>DOMImplementation</code> object that handles this document. A
- * DOM application may use objects from multiple implementations.
- */
- public DOMImplementation getImplementation();
-
- /**
- * This is a convenience attribute that allows direct access to the child
- * node that is the root element of the document. For HTML documents,
- * this is the element with the tagName "HTML".
- */
- public Element getDocumentElement();
-
- /**
- * Creates an element of the type specified. Note that the instance
- * returned implements the <code>Element</code> interface, so attributes
- * can be specified directly on the returned object.
- * <br>In addition, if there are known attributes with default values,
- * <code>Attr</code> nodes representing them are automatically created
- * and attached to the element.
- * <br>To create an element with a qualified name and namespace URI, use
- * the <code>createElementNS</code> method.
- * @param tagName The name of the element type to instantiate. For XML,
- * this is case-sensitive. For HTML, the <code>tagName</code>
- * parameter may be provided in any case, but it must be mapped to the
- * canonical uppercase form by the DOM implementation.
- * @return A new <code>Element</code> object with the
- * <code>nodeName</code> attribute set to <code>tagName</code>, and
- * <code>localName</code>, <code>prefix</code>, and
- * <code>namespaceURI</code> set to <code>null</code>.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name contains an
- * illegal character.
- */
- public Element createElement(String tagName)
- throws DOMException;
-
- /**
- * Creates an empty <code>DocumentFragment</code> object.
- * @return A new <code>DocumentFragment</code>.
- */
- public DocumentFragment createDocumentFragment();
-
- /**
- * Creates a <code>Text</code> node given the specified string.
- * @param data The data for the node.
- * @return The new <code>Text</code> object.
- */
- public Text createTextNode(String data);
-
- /**
- * Creates a <code>Comment</code> node given the specified string.
- * @param data The data for the node.
- * @return The new <code>Comment</code> object.
- */
- public Comment createComment(String data);
-
- /**
- * Creates a <code>CDATASection</code> node whose value is the specified
- * string.
- * @param data The data for the <code>CDATASection</code> contents.
- * @return The new <code>CDATASection</code> object.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
- */
- public CDATASection createCDATASection(String data)
- throws DOMException;
-
- /**
- * Creates a <code>ProcessingInstruction</code> node given the specified
- * name and data strings.
- * @param target The target part of the processing instruction.
- * @param data The data for the node.
- * @return The new <code>ProcessingInstruction</code> object.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified target contains an
- * illegal character.
- * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
- */
- public ProcessingInstruction createProcessingInstruction(String target,
- String data)
- throws DOMException;
-
- /**
- * Creates an <code>Attr</code> of the given name. Note that the
- * <code>Attr</code> instance can then be set on an <code>Element</code>
- * using the <code>setAttributeNode</code> method.
- * <br>To create an attribute with a qualified name and namespace URI, use
- * the <code>createAttributeNS</code> method.
- * @param name The name of the attribute.
- * @return A new <code>Attr</code> object with the <code>nodeName</code>
- * attribute set to <code>name</code>, and <code>localName</code>,
- * <code>prefix</code>, and <code>namespaceURI</code> set to
- * <code>null</code>. The value of the attribute is the empty string.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name contains an
- * illegal character.
- */
- public Attr createAttribute(String name)
- throws DOMException;
-
- /**
- * Creates an <code>EntityReference</code> object. In addition, if the
- * referenced entity is known, the child list of the
- * <code>EntityReference</code> node is made the same as that of the
- * corresponding <code>Entity</code> node.If any descendant of the
- * <code>Entity</code> node has an unbound namespace prefix, the
- * corresponding descendant of the created <code>EntityReference</code>
- * node is also unbound; (its <code>namespaceURI</code> is
- * <code>null</code>). The DOM Level 2 does not support any mechanism to
- * resolve namespace prefixes.
- * @param name The name of the entity to reference.
- * @return The new <code>EntityReference</code> object.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name contains an
- * illegal character.
- * <br>NOT_SUPPORTED_ERR: Raised if this document is an HTML document.
- */
- public EntityReference createEntityReference(String name)
- throws DOMException;
-
- /**
- * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
- * given tag name in the order in which they are encountered in a
- * preorder traversal of the <code>Document</code> tree.
- * @param tagname The name of the tag to match on. The special value "*"
- * matches all tags.
- * @return A new <code>NodeList</code> object containing all the matched
- * <code>Elements</code>.
- */
- public NodeList getElementsByTagName(String tagname);
-
- /**
- * Imports a node from another document to this document. The returned
- * node has no parent; (<code>parentNode</code> is <code>null</code>).
- * The source node is not altered or removed from the original document;
- * this method creates a new copy of the source node.
- * <br>For all nodes, importing a node creates a node object owned by the
- * importing document, with attribute values identical to the source
- * node's <code>nodeName</code> and <code>nodeType</code>, plus the
- * attributes related to namespaces (<code>prefix</code>,
- * <code>localName</code>, and <code>namespaceURI</code>). As in the
- * <code>cloneNode</code> operation on a <code>Node</code>, the source
- * node is not altered.
- * <br>Additional information is copied as appropriate to the
- * <code>nodeType</code>, attempting to mirror the behavior expected if
- * a fragment of XML or HTML source was copied from one document to
- * another, recognizing that the two documents may have different DTDs
- * in the XML case. The following list describes the specifics for each
- * type of node.
- * <dl>
- * <dt>ATTRIBUTE_NODE</dt>
- * <dd>The <code>ownerElement</code> attribute
- * is set to <code>null</code> and the <code>specified</code> flag is
- * set to <code>true</code> on the generated <code>Attr</code>. The
- * descendants of the source <code>Attr</code> are recursively imported
- * and the resulting nodes reassembled to form the corresponding subtree.
- * Note that the <code>deep</code> parameter has no effect on
- * <code>Attr</code> nodes; they always carry their children with them
- * when imported.</dd>
- * <dt>DOCUMENT_FRAGMENT_NODE</dt>
- * <dd>If the <code>deep</code> option
- * was set to <code>true</code>, the descendants of the source element
- * are recursively imported and the resulting nodes reassembled to form
- * the corresponding subtree. Otherwise, this simply generates an empty
- * <code>DocumentFragment</code>.</dd>
- * <dt>DOCUMENT_NODE</dt>
- * <dd><code>Document</code>
- * nodes cannot be imported.</dd>
- * <dt>DOCUMENT_TYPE_NODE</dt>
- * <dd><code>DocumentType</code>
- * nodes cannot be imported.</dd>
- * <dt>ELEMENT_NODE</dt>
- * <dd>Specified attribute nodes of the
- * source element are imported, and the generated <code>Attr</code>
- * nodes are attached to the generated <code>Element</code>. Default
- * attributes are not copied, though if the document being imported into
- * defines default attributes for this element name, those are assigned.
- * If the <code>importNode</code> <code>deep</code> parameter was set to
- * <code>true</code>, the descendants of the source element are
- * recursively imported and the resulting nodes reassembled to form the
- * corresponding subtree.</dd>
- * <dt>ENTITY_NODE</dt>
- * <dd><code>Entity</code> nodes can be
- * imported, however in the current release of the DOM the
- * <code>DocumentType</code> is readonly. Ability to add these imported
- * nodes to a <code>DocumentType</code> will be considered for addition
- * to a future release of the DOM.On import, the <code>publicId</code>,
- * <code>systemId</code>, and <code>notationName</code> attributes are
- * copied. If a <code>deep</code> import is requested, the descendants
- * of the the source <code>Entity</code> are recursively imported and
- * the resulting nodes reassembled to form the corresponding subtree.</dd>
- * <dt>
- * ENTITY_REFERENCE_NODE</dt>
- * <dd>Only the <code>EntityReference</code> itself is
- * copied, even if a <code>deep</code> import is requested, since the
- * source and destination documents might have defined the entity
- * differently. If the document being imported into provides a
- * definition for this entity name, its value is assigned.</dd>
- * <dt>NOTATION_NODE</dt>
- * <dd>
- * <code>Notation</code> nodes can be imported, however in the current
- * release of the DOM the <code>DocumentType</code> is readonly. Ability
- * to add these imported nodes to a <code>DocumentType</code> will be
- * considered for addition to a future release of the DOM.On import, the
- * <code>publicId</code> and <code>systemId</code> attributes are copied.
- * Note that the <code>deep</code> parameter has no effect on
- * <code>Notation</code> nodes since they never have any children.</dd>
- * <dt>
- * PROCESSING_INSTRUCTION_NODE</dt>
- * <dd>The imported node copies its
- * <code>target</code> and <code>data</code> values from those of the
- * source node.</dd>
- * <dt>TEXT_NODE, CDATA_SECTION_NODE, COMMENT_NODE</dt>
- * <dd>These three
- * types of nodes inheriting from <code>CharacterData</code> copy their
- * <code>data</code> and <code>length</code> attributes from those of
- * the source node.</dd>
- * </dl>
- * @param importedNode The node to import.
- * @param deep If <code>true</code>, recursively import the subtree under
- * the specified node; if <code>false</code>, import only the node
- * itself, as explained above. This has no effect on <code>Attr</code>
- * , <code>EntityReference</code>, and <code>Notation</code> nodes.
- * @return The imported node that belongs to this <code>Document</code>.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the type of node being imported is not
- * supported.
- * @since DOM Level 2
- */
- public Node importNode(Node importedNode,
- boolean deep)
- throws DOMException;
-
- /**
- * Creates an element of the given qualified name and namespace URI.
- * @param namespaceURI The namespace URI of the element to create.
- * @param qualifiedName The qualified name of the element type to
- * instantiate.
- * @return A new <code>Element</code> object with the following
- * attributes:
- * <table border='1'>
- * <tr>
- * <th>Attribute</th>
- * <th>Value</th>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>qualifiedName</code></td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.namespaceURI</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>namespaceURI</code></td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.prefix</code></td>
- * <td valign='top' rowspan='1' colspan='1'>prefix, extracted
- * from <code>qualifiedName</code>, or <code>null</code> if there is
- * no prefix</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
- * <code>qualifiedName</code></td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Element.tagName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>qualifiedName</code></td>
- * </tr>
- * </table>
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name
- * contains an illegal character, per the XML 1.0 specification .
- * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
- * malformed per the Namespaces in XML specification, if the
- * <code>qualifiedName</code> has a prefix and the
- * <code>namespaceURI</code> is <code>null</code>, or if the
- * <code>qualifiedName</code> has a prefix that is "xml" and the
- * <code>namespaceURI</code> is different from "
- * http://www.w3.org/XML/1998/namespace" .
- * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
- * support the <code>"XML"</code> feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public Element createElementNS(String namespaceURI,
- String qualifiedName)
- throws DOMException;
-
- /**
- * Creates an attribute of the given qualified name and namespace URI.
- * @param namespaceURI The namespace URI of the attribute to create.
- * @param qualifiedName The qualified name of the attribute to
- * instantiate.
- * @return A new <code>Attr</code> object with the following attributes:
- * <table border='1'>
- * <tr>
- * <th>
- * Attribute</th>
- * <th>Value</th>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>qualifiedName</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>Node.namespaceURI</code></td>
- * <td valign='top' rowspan='1' colspan='1'><code>namespaceURI</code></td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>Node.prefix</code></td>
- * <td valign='top' rowspan='1' colspan='1'>prefix, extracted from
- * <code>qualifiedName</code>, or <code>null</code> if there is no
- * prefix</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.localName</code></td>
- * <td valign='top' rowspan='1' colspan='1'>local name, extracted from
- * <code>qualifiedName</code></td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Attr.name</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>qualifiedName</code></td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'><code>Node.nodeValue</code></td>
- * <td valign='top' rowspan='1' colspan='1'>the empty
- * string</td>
- * </tr>
- * </table>
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name
- * contains an illegal character, per the XML 1.0 specification .
- * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
- * malformed per the Namespaces in XML specification, if the
- * <code>qualifiedName</code> has a prefix and the
- * <code>namespaceURI</code> is <code>null</code>, if the
- * <code>qualifiedName</code> has a prefix that is "xml" and the
- * <code>namespaceURI</code> is different from "
- * http://www.w3.org/XML/1998/namespace", or if the
- * <code>qualifiedName</code>, or its prefix, is "xmlns" and the
- * <code>namespaceURI</code> is different from "
- * http://www.w3.org/2000/xmlns/".
- * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
- * support the <code>"XML"</code> feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public Attr createAttributeNS(String namespaceURI,
- String qualifiedName)
- throws DOMException;
-
- /**
- * Returns a <code>NodeList</code> of all the <code>Elements</code> with a
- * given local name and namespace URI in the order in which they are
- * encountered in a preorder traversal of the <code>Document</code> tree.
- * @param namespaceURI The namespace URI of the elements to match on. The
- * special value "*" matches all namespaces.
- * @param localName The local name of the elements to match on. The
- * special value "*" matches all local names.
- * @return A new <code>NodeList</code> object containing all the matched
- * <code>Elements</code>.
- * @since DOM Level 2
- */
- public NodeList getElementsByTagNameNS(String namespaceURI,
- String localName);
-
- /**
- * Returns the <code>Element</code> whose <code>ID</code> is given by
- * <code>elementId</code>. If no such element exists, returns
- * <code>null</code>. Behavior is not defined if more than one element
- * has this <code>ID</code>. The DOM implementation must have
- * information that says which attributes are of type ID. Attributes
- * with the name "ID" are not of type ID unless so defined.
- * Implementations that do not know whether attributes are of type ID or
- * not are expected to return <code>null</code>.
- * @param elementId The unique <code>id</code> value for an element.
- * @return The matching element.
- * @since DOM Level 2
- */
- public Element getElementById(String elementId);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/DocumentFragment.java b/external/jaxp/source/org/w3c/dom/DocumentFragment.java
deleted file mode 100755
index 6ade30cc9..000000000
--- a/external/jaxp/source/org/w3c/dom/DocumentFragment.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * <code>DocumentFragment</code> is a "lightweight" or "minimal"
- * <code>Document</code> object. It is very common to want to be able to
- * extract a portion of a document's tree or to create a new fragment of a
- * document. Imagine implementing a user command like cut or rearranging a
- * document by moving fragments around. It is desirable to have an object
- * which can hold such fragments and it is quite natural to use a Node for
- * this purpose. While it is true that a <code>Document</code> object could
- * fulfill this role, a <code>Document</code> object can potentially be a
- * heavyweight object, depending on the underlying implementation. What is
- * really needed for this is a very lightweight object.
- * <code>DocumentFragment</code> is such an object.
- * <p>Furthermore, various operations -- such as inserting nodes as children
- * of another <code>Node</code> -- may take <code>DocumentFragment</code>
- * objects as arguments; this results in all the child nodes of the
- * <code>DocumentFragment</code> being moved to the child list of this node.
- * <p>The children of a <code>DocumentFragment</code> node are zero or more
- * nodes representing the tops of any sub-trees defining the structure of
- * the document. <code>DocumentFragment</code> nodes do not need to be
- * well-formed XML documents (although they do need to follow the rules
- * imposed upon well-formed XML parsed entities, which can have multiple top
- * nodes). For example, a <code>DocumentFragment</code> might have only one
- * child and that child node could be a <code>Text</code> node. Such a
- * structure model represents neither an HTML document nor a well-formed XML
- * document.
- * <p>When a <code>DocumentFragment</code> is inserted into a
- * <code>Document</code> (or indeed any other <code>Node</code> that may
- * take children) the children of the <code>DocumentFragment</code> and not
- * the <code>DocumentFragment</code> itself are inserted into the
- * <code>Node</code>. This makes the <code>DocumentFragment</code> very
- * useful when the user wishes to create nodes that are siblings; the
- * <code>DocumentFragment</code> acts as the parent of these nodes so that
- * the user can use the standard methods from the <code>Node</code>
- * interface, such as <code>insertBefore</code> and <code>appendChild</code>.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface DocumentFragment extends Node {
-}
diff --git a/external/jaxp/source/org/w3c/dom/DocumentType.java b/external/jaxp/source/org/w3c/dom/DocumentType.java
deleted file mode 100755
index 86c312b72..000000000
--- a/external/jaxp/source/org/w3c/dom/DocumentType.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * Each <code>Document</code> has a <code>doctype</code> attribute whose value
- * is either <code>null</code> or a <code>DocumentType</code> object. The
- * <code>DocumentType</code> interface in the DOM Core provides an interface
- * to the list of entities that are defined for the document, and little
- * else because the effect of namespaces and the various XML schema efforts
- * on DTD representation are not clearly understood as of this writing.
- * <p>The DOM Level 2 doesn't support editing <code>DocumentType</code> nodes.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface DocumentType extends Node {
- /**
- * The name of DTD; i.e., the name immediately following the
- * <code>DOCTYPE</code> keyword.
- */
- public String getName();
-
- /**
- * A <code>NamedNodeMap</code> containing the general entities, both
- * external and internal, declared in the DTD. Parameter entities are
- * not contained. Duplicates are discarded. For example in:
- * <pre>&lt;!DOCTYPE
- * ex SYSTEM "ex.dtd" [ &lt;!ENTITY foo "foo"&gt; &lt;!ENTITY bar
- * "bar"&gt; &lt;!ENTITY bar "bar2"&gt; &lt;!ENTITY % baz "baz"&gt;
- * ]&gt; &lt;ex/&gt;</pre>
- * the interface provides access to <code>foo</code>
- * and the first declaration of <code>bar</code> but not the second
- * declaration of <code>bar</code> or <code>baz</code>. Every node in
- * this map also implements the <code>Entity</code> interface.
- * <br>The DOM Level 2 does not support editing entities, therefore
- * <code>entities</code> cannot be altered in any way.
- */
- public NamedNodeMap getEntities();
-
- /**
- * A <code>NamedNodeMap</code> containing the notations declared in the
- * DTD. Duplicates are discarded. Every node in this map also implements
- * the <code>Notation</code> interface.
- * <br>The DOM Level 2 does not support editing notations, therefore
- * <code>notations</code> cannot be altered in any way.
- */
- public NamedNodeMap getNotations();
-
- /**
- * The public identifier of the external subset.
- * @since DOM Level 2
- */
- public String getPublicId();
-
- /**
- * The system identifier of the external subset.
- * @since DOM Level 2
- */
- public String getSystemId();
-
- /**
- * The internal subset as a string, or <code>null</code> if there is none.
- * This is does not contain the delimiting square brackets.The actual
- * content returned depends on how much information is available to the
- * implementation. This may vary depending on various parameters,
- * including the XML processor used to build the document.
- * @since DOM Level 2
- */
- public String getInternalSubset();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Element.java b/external/jaxp/source/org/w3c/dom/Element.java
deleted file mode 100755
index 614ca8784..000000000
--- a/external/jaxp/source/org/w3c/dom/Element.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>Element</code> interface represents an element in an HTML or XML
- * document. Elements may have attributes associated with them; since the
- * <code>Element</code> interface inherits from <code>Node</code>, the
- * generic <code>Node</code> interface attribute <code>attributes</code> may
- * be used to retrieve the set of all attributes for an element. There are
- * methods on the <code>Element</code> interface to retrieve either an
- * <code>Attr</code> object by name or an attribute value by name. In XML,
- * where an attribute value may contain entity references, an
- * <code>Attr</code> object should be retrieved to examine the possibly
- * fairly complex sub-tree representing the attribute value. On the other
- * hand, in HTML, where all attributes have simple string values, methods to
- * directly access an attribute value can safely be used as a convenience.In
- * DOM Level 2, the method <code>normalize</code> is inherited from the
- * <code>Node</code> interface where it was moved.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Element extends Node {
- /**
- * The name of the element. For example, in:
- * <pre> &lt;elementExample
- * id="demo"&gt; ... &lt;/elementExample&gt; , </pre>
- * <code>tagName</code> has
- * the value <code>"elementExample"</code>. Note that this is
- * case-preserving in XML, as are all of the operations of the DOM. The
- * HTML DOM returns the <code>tagName</code> of an HTML element in the
- * canonical uppercase form, regardless of the case in the source HTML
- * document.
- */
- public String getTagName();
-
- /**
- * Retrieves an attribute value by name.
- * @param name The name of the attribute to retrieve.
- * @return The <code>Attr</code> value as a string, or the empty string
- * if that attribute does not have a specified or default value.
- */
- public String getAttribute(String name);
-
- /**
- * Adds a new attribute. If an attribute with that name is already present
- * in the element, its value is changed to be that of the value
- * parameter. This value is a simple string; it is not parsed as it is
- * being set. So any markup (such as syntax to be recognized as an
- * entity reference) is treated as literal text, and needs to be
- * appropriately escaped by the implementation when it is written out.
- * In order to assign an attribute value that contains entity
- * references, the user must create an <code>Attr</code> node plus any
- * <code>Text</code> and <code>EntityReference</code> nodes, build the
- * appropriate subtree, and use <code>setAttributeNode</code> to assign
- * it as the value of an attribute.
- * <br>To set an attribute with a qualified name and namespace URI, use
- * the <code>setAttributeNS</code> method.
- * @param name The name of the attribute to create or alter.
- * @param value Value to set in string form.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified name contains an
- * illegal character.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void setAttribute(String name,
- String value)
- throws DOMException;
-
- /**
- * Removes an attribute by name. If the removed attribute is known to have
- * a default value, an attribute immediately appears containing the
- * default value as well as the corresponding namespace URI, local name,
- * and prefix when applicable.
- * <br>To remove an attribute by local name and namespace URI, use the
- * <code>removeAttributeNS</code> method.
- * @param name The name of the attribute to remove.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public void removeAttribute(String name)
- throws DOMException;
-
- /**
- * Retrieves an attribute node by name.
- * <br>To retrieve an attribute node by qualified name and namespace URI,
- * use the <code>getAttributeNodeNS</code> method.
- * @param name The name (<code>nodeName</code>) of the attribute to
- * retrieve.
- * @return The <code>Attr</code> node with the specified name (
- * <code>nodeName</code>) or <code>null</code> if there is no such
- * attribute.
- */
- public Attr getAttributeNode(String name);
-
- /**
- * Adds a new attribute node. If an attribute with that name (
- * <code>nodeName</code>) is already present in the element, it is
- * replaced by the new one.
- * <br>To add a new attribute node with a qualified name and namespace
- * URI, use the <code>setAttributeNodeNS</code> method.
- * @param newAttr The <code>Attr</code> node to add to the attribute list.
- * @return If the <code>newAttr</code> attribute replaces an existing
- * attribute, the replaced <code>Attr</code> node is returned,
- * otherwise <code>null</code> is returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
- * different document than the one that created the element.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
- * attribute of another <code>Element</code> object. The DOM user must
- * explicitly clone <code>Attr</code> nodes to re-use them in other
- * elements.
- */
- public Attr setAttributeNode(Attr newAttr)
- throws DOMException;
-
- /**
- * Removes the specified attribute node. If the removed <code>Attr</code>
- * has a default value it is immediately replaced. The replacing
- * attribute has the same namespace URI and local name, as well as the
- * original prefix, when applicable.
- * @param oldAttr The <code>Attr</code> node to remove from the attribute
- * list.
- * @return The <code>Attr</code> node that was removed.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>NOT_FOUND_ERR: Raised if <code>oldAttr</code> is not an attribute
- * of the element.
- */
- public Attr removeAttributeNode(Attr oldAttr)
- throws DOMException;
-
- /**
- * Returns a <code>NodeList</code> of all descendant <code>Elements</code>
- * with a given tag name, in the order in which they are encountered in
- * a preorder traversal of this <code>Element</code> tree.
- * @param name The name of the tag to match on. The special value "*"
- * matches all tags.
- * @return A list of matching <code>Element</code> nodes.
- */
- public NodeList getElementsByTagName(String name);
-
- /**
- * Retrieves an attribute value by local name and namespace URI.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the attribute to retrieve.
- * @param localName The local name of the attribute to retrieve.
- * @return The <code>Attr</code> value as a string, or the empty string
- * if that attribute does not have a specified or default value.
- * @since DOM Level 2
- */
- public String getAttributeNS(String namespaceURI,
- String localName);
-
- /**
- * Adds a new attribute. If an attribute with the same local name and
- * namespace URI is already present on the element, its prefix is
- * changed to be the prefix part of the <code>qualifiedName</code>, and
- * its value is changed to be the <code>value</code> parameter. This
- * value is a simple string; it is not parsed as it is being set. So any
- * markup (such as syntax to be recognized as an entity reference) is
- * treated as literal text, and needs to be appropriately escaped by the
- * implementation when it is written out. In order to assign an
- * attribute value that contains entity references, the user must create
- * an <code>Attr</code> node plus any <code>Text</code> and
- * <code>EntityReference</code> nodes, build the appropriate subtree,
- * and use <code>setAttributeNodeNS</code> or
- * <code>setAttributeNode</code> to assign it as the value of an
- * attribute.
- * @param namespaceURI The namespace URI of the attribute to create or
- * alter.
- * @param qualifiedName The qualified name of the attribute to create or
- * alter.
- * @param value The value to set in string form.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified qualified name
- * contains an illegal character, per the XML 1.0 specification .
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>NAMESPACE_ERR: Raised if the <code>qualifiedName</code> is
- * malformed per the Namespaces in XML specification, if the
- * <code>qualifiedName</code> has a prefix and the
- * <code>namespaceURI</code> is <code>null</code>, if the
- * <code>qualifiedName</code> has a prefix that is "xml" and the
- * <code>namespaceURI</code> is different from "
- * http://www.w3.org/XML/1998/namespace", or if the
- * <code>qualifiedName</code>, or its prefix, is "xmlns" and the
- * <code>namespaceURI</code> is different from "
- * http://www.w3.org/2000/xmlns/".
- * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
- * support the <code>"XML"</code> feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public void setAttributeNS(String namespaceURI,
- String qualifiedName,
- String value)
- throws DOMException;
-
- /**
- * Removes an attribute by local name and namespace URI. If the removed
- * attribute has a default value it is immediately replaced. The
- * replacing attribute has the same namespace URI and local name, as
- * well as the original prefix.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the attribute to remove.
- * @param localName The local name of the attribute to remove.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * @since DOM Level 2
- */
- public void removeAttributeNS(String namespaceURI,
- String localName)
- throws DOMException;
-
- /**
- * Retrieves an <code>Attr</code> node by local name and namespace URI.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the attribute to retrieve.
- * @param localName The local name of the attribute to retrieve.
- * @return The <code>Attr</code> node with the specified attribute local
- * name and namespace URI or <code>null</code> if there is no such
- * attribute.
- * @since DOM Level 2
- */
- public Attr getAttributeNodeNS(String namespaceURI,
- String localName);
-
- /**
- * Adds a new attribute. If an attribute with that local name and that
- * namespace URI is already present in the element, it is replaced by
- * the new one.
- * @param newAttr The <code>Attr</code> node to add to the attribute list.
- * @return If the <code>newAttr</code> attribute replaces an existing
- * attribute with the same local name and namespace URI, the replaced
- * <code>Attr</code> node is returned, otherwise <code>null</code> is
- * returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if <code>newAttr</code> was created from a
- * different document than the one that created the element.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>newAttr</code> is already an
- * attribute of another <code>Element</code> object. The DOM user must
- * explicitly clone <code>Attr</code> nodes to re-use them in other
- * elements.
- * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
- * support the <code>"XML"</code> feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public Attr setAttributeNodeNS(Attr newAttr)
- throws DOMException;
-
- /**
- * Returns a <code>NodeList</code> of all the descendant
- * <code>Elements</code> with a given local name and namespace URI in
- * the order in which they are encountered in a preorder traversal of
- * this <code>Element</code> tree.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the elements to match on. The
- * special value "*" matches all namespaces.
- * @param localName The local name of the elements to match on. The
- * special value "*" matches all local names.
- * @return A new <code>NodeList</code> object containing all the matched
- * <code>Elements</code>.
- * @since DOM Level 2
- */
- public NodeList getElementsByTagNameNS(String namespaceURI,
- String localName);
-
- /**
- * Returns <code>true</code> when an attribute with a given name is
- * specified on this element or has a default value, <code>false</code>
- * otherwise.
- * @param name The name of the attribute to look for.
- * @return <code>true</code> if an attribute with the given name is
- * specified on this element or has a default value, <code>false</code>
- * otherwise.
- * @since DOM Level 2
- */
- public boolean hasAttribute(String name);
-
- /**
- * Returns <code>true</code> when an attribute with a given local name and
- * namespace URI is specified on this element or has a default value,
- * <code>false</code> otherwise.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the attribute to look for.
- * @param localName The local name of the attribute to look for.
- * @return <code>true</code> if an attribute with the given local name
- * and namespace URI is specified or has a default value on this
- * element, <code>false</code> otherwise.
- * @since DOM Level 2
- */
- public boolean hasAttributeNS(String namespaceURI,
- String localName);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Entity.java b/external/jaxp/source/org/w3c/dom/Entity.java
deleted file mode 100755
index 11bd0dfd6..000000000
--- a/external/jaxp/source/org/w3c/dom/Entity.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * This interface represents an entity, either parsed or unparsed, in an XML
- * document. Note that this models the entity itself not the entity
- * declaration. <code>Entity</code> declaration modeling has been left for a
- * later Level of the DOM specification.
- * <p>The <code>nodeName</code> attribute that is inherited from
- * <code>Node</code> contains the name of the entity.
- * <p>An XML processor may choose to completely expand entities before the
- * structure model is passed to the DOM; in this case there will be no
- * <code>EntityReference</code> nodes in the document tree.
- * <p>XML does not mandate that a non-validating XML processor read and
- * process entity declarations made in the external subset or declared in
- * external parameter entities. This means that parsed entities declared in
- * the external subset need not be expanded by some classes of applications,
- * and that the replacement value of the entity may not be available. When
- * the replacement value is available, the corresponding <code>Entity</code>
- * node's child list represents the structure of that replacement text.
- * Otherwise, the child list is empty.
- * <p>The DOM Level 2 does not support editing <code>Entity</code> nodes; if a
- * user wants to make changes to the contents of an <code>Entity</code>,
- * every related <code>EntityReference</code> node has to be replaced in the
- * structure model by a clone of the <code>Entity</code>'s contents, and
- * then the desired changes must be made to each of those clones instead.
- * <code>Entity</code> nodes and all their descendants are readonly.
- * <p>An <code>Entity</code> node does not have any parent.If the entity
- * contains an unbound namespace prefix, the <code>namespaceURI</code> of
- * the corresponding node in the <code>Entity</code> node subtree is
- * <code>null</code>. The same is true for <code>EntityReference</code>
- * nodes that refer to this entity, when they are created using the
- * <code>createEntityReference</code> method of the <code>Document</code>
- * interface. The DOM Level 2 does not support any mechanism to resolve
- * namespace prefixes.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Entity extends Node {
- /**
- * The public identifier associated with the entity, if specified. If the
- * public identifier was not specified, this is <code>null</code>.
- */
- public String getPublicId();
-
- /**
- * The system identifier associated with the entity, if specified. If the
- * system identifier was not specified, this is <code>null</code>.
- */
- public String getSystemId();
-
- /**
- * For unparsed entities, the name of the notation for the entity. For
- * parsed entities, this is <code>null</code>.
- */
- public String getNotationName();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/EntityReference.java b/external/jaxp/source/org/w3c/dom/EntityReference.java
deleted file mode 100755
index ff3cf9d9f..000000000
--- a/external/jaxp/source/org/w3c/dom/EntityReference.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * <code>EntityReference</code> objects may be inserted into the structure
- * model when an entity reference is in the source document, or when the
- * user wishes to insert an entity reference. Note that character references
- * and references to predefined entities are considered to be expanded by
- * the HTML or XML processor so that characters are represented by their
- * Unicode equivalent rather than by an entity reference. Moreover, the XML
- * processor may completely expand references to entities while building the
- * structure model, instead of providing <code>EntityReference</code>
- * objects. If it does provide such objects, then for a given
- * <code>EntityReference</code> node, it may be that there is no
- * <code>Entity</code> node representing the referenced entity. If such an
- * <code>Entity</code> exists, then the subtree of the
- * <code>EntityReference</code> node is in general a copy of the
- * <code>Entity</code> node subtree. However, this may not be true when an
- * entity contains an unbound namespace prefix. In such a case, because the
- * namespace prefix resolution depends on where the entity reference is, the
- * descendants of the <code>EntityReference</code> node may be bound to
- * different namespace URIs.
- * <p>As for <code>Entity</code> nodes, <code>EntityReference</code> nodes and
- * all their descendants are readonly.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface EntityReference extends Node {
-}
diff --git a/external/jaxp/source/org/w3c/dom/NamedNodeMap.java b/external/jaxp/source/org/w3c/dom/NamedNodeMap.java
deleted file mode 100755
index 843736679..000000000
--- a/external/jaxp/source/org/w3c/dom/NamedNodeMap.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * Objects implementing the <code>NamedNodeMap</code> interface are used to
- * represent collections of nodes that can be accessed by name. Note that
- * <code>NamedNodeMap</code> does not inherit from <code>NodeList</code>;
- * <code>NamedNodeMaps</code> are not maintained in any particular order.
- * Objects contained in an object implementing <code>NamedNodeMap</code> may
- * also be accessed by an ordinal index, but this is simply to allow
- * convenient enumeration of the contents of a <code>NamedNodeMap</code>,
- * and does not imply that the DOM specifies an order to these Nodes.
- * <p><code>NamedNodeMap</code> objects in the DOM are live.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface NamedNodeMap {
- /**
- * Retrieves a node specified by name.
- * @param name The <code>nodeName</code> of a node to retrieve.
- * @return A <code>Node</code> (of any type) with the specified
- * <code>nodeName</code>, or <code>null</code> if it does not identify
- * any node in this map.
- */
- public Node getNamedItem(String name);
-
- /**
- * Adds a node using its <code>nodeName</code> attribute. If a node with
- * that name is already present in this map, it is replaced by the new
- * one.
- * <br>As the <code>nodeName</code> attribute is used to derive the name
- * which the node must be stored under, multiple nodes of certain types
- * (those that have a "special" string value) cannot be stored as the
- * names would clash. This is seen as preferable to allowing nodes to be
- * aliased.
- * @param arg A node to store in this map. The node will later be
- * accessible using the value of its <code>nodeName</code> attribute.
- * @return If the new <code>Node</code> replaces an existing node the
- * replaced <code>Node</code> is returned, otherwise <code>null</code>
- * is returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
- * different document than the one that created this map.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
- * <code>Attr</code> that is already an attribute of another
- * <code>Element</code> object. The DOM user must explicitly clone
- * <code>Attr</code> nodes to re-use them in other elements.
- * <br>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
- * doesn't belong in this NamedNodeMap. Examples would include trying
- * to insert something other than an Attr node into an Element's map
- * of attributes, or a non-Entity node into the DocumentType's map of
- * Entities.
- */
- public Node setNamedItem(Node arg)
- throws DOMException;
-
- /**
- * Removes a node specified by name. When this map contains the attributes
- * attached to an element, if the removed attribute is known to have a
- * default value, an attribute immediately appears containing the
- * default value as well as the corresponding namespace URI, local name,
- * and prefix when applicable.
- * @param name The <code>nodeName</code> of the node to remove.
- * @return The node removed from this map if a node with such a name
- * exists.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised if there is no node named <code>name</code> in
- * this map.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- */
- public Node removeNamedItem(String name)
- throws DOMException;
-
- /**
- * Returns the <code>index</code>th item in the map. If <code>index</code>
- * is greater than or equal to the number of nodes in this map, this
- * returns <code>null</code>.
- * @param index Index into this map.
- * @return The node at the <code>index</code>th position in the map, or
- * <code>null</code> if that is not a valid index.
- */
- public Node item(int index);
-
- /**
- * The number of nodes in this map. The range of valid child node indices
- * is <code>0</code> to <code>length-1</code> inclusive.
- */
- public int getLength();
-
- /**
- * Retrieves a node specified by local name and namespace URI.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the node to retrieve.
- * @param localName The local name of the node to retrieve.
- * @return A <code>Node</code> (of any type) with the specified local
- * name and namespace URI, or <code>null</code> if they do not
- * identify any node in this map.
- * @since DOM Level 2
- */
- public Node getNamedItemNS(String namespaceURI,
- String localName);
-
- /**
- * Adds a node using its <code>namespaceURI</code> and
- * <code>localName</code>. If a node with that namespace URI and that
- * local name is already present in this map, it is replaced by the new
- * one.
- * @param arg A node to store in this map. The node will later be
- * accessible using the value of its <code>namespaceURI</code> and
- * <code>localName</code> attributes.
- * @return If the new <code>Node</code> replaces an existing node the
- * replaced <code>Node</code> is returned, otherwise <code>null</code>
- * is returned.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if <code>arg</code> was created from a
- * different document than the one that created this map.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- * <br>INUSE_ATTRIBUTE_ERR: Raised if <code>arg</code> is an
- * <code>Attr</code> that is already an attribute of another
- * <code>Element</code> object. The DOM user must explicitly clone
- * <code>Attr</code> nodes to re-use them in other elements.
- * <br>HIERARCHY_REQUEST_ERR: Raised if an attempt is made to add a node
- * doesn't belong in this NamedNodeMap. Examples would include trying
- * to insert something other than an Attr node into an Element's map
- * of attributes, or a non-Entity node into the DocumentType's map of
- * Entities.
- * <br>NOT_SUPPORTED_ERR: Always thrown if the current document does not
- * support the <code>"XML"</code> feature, since namespaces were
- * defined by XML.
- * @since DOM Level 2
- */
- public Node setNamedItemNS(Node arg)
- throws DOMException;
-
- /**
- * Removes a node specified by local name and namespace URI. A removed
- * attribute may be known to have a default value when this map contains
- * the attributes attached to an element, as returned by the attributes
- * attribute of the <code>Node</code> interface. If so, an attribute
- * immediately appears containing the default value as well as the
- * corresponding namespace URI, local name, and prefix when applicable.
- * <br>Documents which do not support the "XML" feature will permit only
- * the DOM Level 1 calls for creating/setting elements and attributes.
- * Hence, if you specify a non-null namespace URI, these DOMs will never
- * find a matching node.
- * @param namespaceURI The namespace URI of the node to remove.
- * @param localName The local name of the node to remove.
- * @return The node removed from this map if a node with such a local
- * name and namespace URI exists.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised if there is no node with the specified
- * <code>namespaceURI</code> and <code>localName</code> in this map.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this map is readonly.
- * @since DOM Level 2
- */
- public Node removeNamedItemNS(String namespaceURI,
- String localName)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Node.java b/external/jaxp/source/org/w3c/dom/Node.java
deleted file mode 100755
index 56ed30a57..000000000
--- a/external/jaxp/source/org/w3c/dom/Node.java
+++ /dev/null
@@ -1,526 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>Node</code> interface is the primary datatype for the entire
- * Document Object Model. It represents a single node in the document tree.
- * While all objects implementing the <code>Node</code> interface expose
- * methods for dealing with children, not all objects implementing the
- * <code>Node</code> interface may have children. For example,
- * <code>Text</code> nodes may not have children, and adding children to
- * such nodes results in a <code>DOMException</code> being raised.
- * <p>The attributes <code>nodeName</code>, <code>nodeValue</code> and
- * <code>attributes</code> are included as a mechanism to get at node
- * information without casting down to the specific derived interface. In
- * cases where there is no obvious mapping of these attributes for a
- * specific <code>nodeType</code> (e.g., <code>nodeValue</code> for an
- * <code>Element</code> or <code>attributes</code> for a <code>Comment</code>
- * ), this returns <code>null</code>. Note that the specialized interfaces
- * may contain additional and more convenient mechanisms to get and set the
- * relevant information.
- * <p>The values of <code>nodeName</code>,
- * <code>nodeValue</code>, and <code>attributes</code> vary according to the
- * node type as follows:
- * <table border='1'>
- * <tr>
- * <th>Interface</th>
- * <th>nodeName</th>
- * <th>nodeValue</th>
- * <th>attributes</th>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Attr</td>
- * <td valign='top' rowspan='1' colspan='1'>name of
- * attribute</td>
- * <td valign='top' rowspan='1' colspan='1'>value of attribute</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>CDATASection</td>
- * <td valign='top' rowspan='1' colspan='1'><code>"#cdata-section"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>
- * content of the CDATA Section</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Comment</td>
- * <td valign='top' rowspan='1' colspan='1'><code>"#comment"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>content of
- * the comment</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Document</td>
- * <td valign='top' rowspan='1' colspan='1'><code>"#document"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>DocumentFragment</td>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>"#document-fragment"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>DocumentType</td>
- * <td valign='top' rowspan='1' colspan='1'>document type name</td>
- * <td valign='top' rowspan='1' colspan='1'>
- * null</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Element</td>
- * <td valign='top' rowspan='1' colspan='1'>tag name</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * <td valign='top' rowspan='1' colspan='1'>NamedNodeMap</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Entity</td>
- * <td valign='top' rowspan='1' colspan='1'>entity name</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>
- * EntityReference</td>
- * <td valign='top' rowspan='1' colspan='1'>name of entity referenced</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Notation</td>
- * <td valign='top' rowspan='1' colspan='1'>notation name</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * <td valign='top' rowspan='1' colspan='1'>
- * null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>ProcessingInstruction</td>
- * <td valign='top' rowspan='1' colspan='1'>target</td>
- * <td valign='top' rowspan='1' colspan='1'>entire content excluding the target</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * <tr>
- * <td valign='top' rowspan='1' colspan='1'>Text</td>
- * <td valign='top' rowspan='1' colspan='1'>
- * <code>"#text"</code></td>
- * <td valign='top' rowspan='1' colspan='1'>content of the text node</td>
- * <td valign='top' rowspan='1' colspan='1'>null</td>
- * </tr>
- * </table>
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Node {
- // NodeType
- /**
- * The node is an <code>Element</code>.
- */
- public static final short ELEMENT_NODE = 1;
- /**
- * The node is an <code>Attr</code>.
- */
- public static final short ATTRIBUTE_NODE = 2;
- /**
- * The node is a <code>Text</code> node.
- */
- public static final short TEXT_NODE = 3;
- /**
- * The node is a <code>CDATASection</code>.
- */
- public static final short CDATA_SECTION_NODE = 4;
- /**
- * The node is an <code>EntityReference</code>.
- */
- public static final short ENTITY_REFERENCE_NODE = 5;
- /**
- * The node is an <code>Entity</code>.
- */
- public static final short ENTITY_NODE = 6;
- /**
- * The node is a <code>ProcessingInstruction</code>.
- */
- public static final short PROCESSING_INSTRUCTION_NODE = 7;
- /**
- * The node is a <code>Comment</code>.
- */
- public static final short COMMENT_NODE = 8;
- /**
- * The node is a <code>Document</code>.
- */
- public static final short DOCUMENT_NODE = 9;
- /**
- * The node is a <code>DocumentType</code>.
- */
- public static final short DOCUMENT_TYPE_NODE = 10;
- /**
- * The node is a <code>DocumentFragment</code>.
- */
- public static final short DOCUMENT_FRAGMENT_NODE = 11;
- /**
- * The node is a <code>Notation</code>.
- */
- public static final short NOTATION_NODE = 12;
-
- /**
- * The name of this node, depending on its type; see the table above.
- */
- public String getNodeName();
-
- /**
- * The value of this node, depending on its type; see the table above.
- * When it is defined to be <code>null</code>, setting it has no effect.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
- * fit in a <code>DOMString</code> variable on the implementation
- * platform.
- */
- public String getNodeValue()
- throws DOMException;
- /**
- * The value of this node, depending on its type; see the table above.
- * When it is defined to be <code>null</code>, setting it has no effect.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- * @exception DOMException
- * DOMSTRING_SIZE_ERR: Raised when it would return more characters than
- * fit in a <code>DOMString</code> variable on the implementation
- * platform.
- */
- public void setNodeValue(String nodeValue)
- throws DOMException;
-
- /**
- * A code representing the type of the underlying object, as defined above.
- */
- public short getNodeType();
-
- /**
- * The parent of this node. All nodes, except <code>Attr</code>,
- * <code>Document</code>, <code>DocumentFragment</code>,
- * <code>Entity</code>, and <code>Notation</code> may have a parent.
- * However, if a node has just been created and not yet added to the
- * tree, or if it has been removed from the tree, this is
- * <code>null</code>.
- */
- public Node getParentNode();
-
- /**
- * A <code>NodeList</code> that contains all children of this node. If
- * there are no children, this is a <code>NodeList</code> containing no
- * nodes.
- */
- public NodeList getChildNodes();
-
- /**
- * The first child of this node. If there is no such node, this returns
- * <code>null</code>.
- */
- public Node getFirstChild();
-
- /**
- * The last child of this node. If there is no such node, this returns
- * <code>null</code>.
- */
- public Node getLastChild();
-
- /**
- * The node immediately preceding this node. If there is no such node,
- * this returns <code>null</code>.
- */
- public Node getPreviousSibling();
-
- /**
- * The node immediately following this node. If there is no such node,
- * this returns <code>null</code>.
- */
- public Node getNextSibling();
-
- /**
- * A <code>NamedNodeMap</code> containing the attributes of this node (if
- * it is an <code>Element</code>) or <code>null</code> otherwise.
- */
- public NamedNodeMap getAttributes();
-
- /**
- * The <code>Document</code> object associated with this node. This is
- * also the <code>Document</code> object used to create new nodes. When
- * this node is a <code>Document</code> or a <code>DocumentType</code>
- * which is not used with any <code>Document</code> yet, this is
- * <code>null</code>.
- * @version DOM Level 2
- */
- public Document getOwnerDocument();
-
- /**
- * Inserts the node <code>newChild</code> before the existing child node
- * <code>refChild</code>. If <code>refChild</code> is <code>null</code>,
- * insert <code>newChild</code> at the end of the list of children.
- * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
- * all of its children are inserted, in the same order, before
- * <code>refChild</code>. If the <code>newChild</code> is already in the
- * tree, it is first removed.
- * @param newChild The node to insert.
- * @param refChild The reference node, i.e., the node before which the
- * new node must be inserted.
- * @return The node being inserted.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
- * allow children of the type of the <code>newChild</code> node, or if
- * the node to insert is one of this node's ancestors or this node
- * itself.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
- * from a different document than the one that created this node.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
- * if the parent of the node being inserted is readonly.
- * <br>NOT_FOUND_ERR: Raised if <code>refChild</code> is not a child of
- * this node.
- */
- public Node insertBefore(Node newChild,
- Node refChild)
- throws DOMException;
-
- /**
- * Replaces the child node <code>oldChild</code> with <code>newChild</code>
- * in the list of children, and returns the <code>oldChild</code> node.
- * <br>If <code>newChild</code> is a <code>DocumentFragment</code> object,
- * <code>oldChild</code> is replaced by all of the
- * <code>DocumentFragment</code> children, which are inserted in the
- * same order. If the <code>newChild</code> is already in the tree, it
- * is first removed.
- * @param newChild The new node to put in the child list.
- * @param oldChild The node being replaced in the list.
- * @return The node replaced.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
- * allow children of the type of the <code>newChild</code> node, or if
- * the node to put in is one of this node's ancestors or this node
- * itself.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
- * from a different document than the one that created this node.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node or the parent of
- * the new node is readonly.
- * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
- * this node.
- */
- public Node replaceChild(Node newChild,
- Node oldChild)
- throws DOMException;
-
- /**
- * Removes the child node indicated by <code>oldChild</code> from the list
- * of children, and returns it.
- * @param oldChild The node being removed.
- * @return The node removed.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>NOT_FOUND_ERR: Raised if <code>oldChild</code> is not a child of
- * this node.
- */
- public Node removeChild(Node oldChild)
- throws DOMException;
-
- /**
- * Adds the node <code>newChild</code> to the end of the list of children
- * of this node. If the <code>newChild</code> is already in the tree, it
- * is first removed.
- * @param newChild The node to add.If it is a
- * <code>DocumentFragment</code> object, the entire contents of the
- * document fragment are moved into the child list of this node
- * @return The node added.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if this node is of a type that does not
- * allow children of the type of the <code>newChild</code> node, or if
- * the node to append is one of this node's ancestors or this node
- * itself.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newChild</code> was created
- * from a different document than the one that created this node.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly or
- * if the previous parent of the node being inserted is readonly.
- */
- public Node appendChild(Node newChild)
- throws DOMException;
-
- /**
- * Returns whether this node has any children.
- * @return <code>true</code> if this node has any children,
- * <code>false</code> otherwise.
- */
- public boolean hasChildNodes();
-
- /**
- * Returns a duplicate of this node, i.e., serves as a generic copy
- * constructor for nodes. The duplicate node has no parent; (
- * <code>parentNode</code> is <code>null</code>.).
- * <br>Cloning an <code>Element</code> copies all attributes and their
- * values, including those generated by the XML processor to represent
- * defaulted attributes, but this method does not copy any text it
- * contains unless it is a deep clone, since the text is contained in a
- * child <code>Text</code> node. Cloning an <code>Attribute</code>
- * directly, as opposed to be cloned as part of an <code>Element</code>
- * cloning operation, returns a specified attribute (
- * <code>specified</code> is <code>true</code>). Cloning any other type
- * of node simply returns a copy of this node.
- * <br>Note that cloning an immutable subtree results in a mutable copy,
- * but the children of an <code>EntityReference</code> clone are readonly
- * . In addition, clones of unspecified <code>Attr</code> nodes are
- * specified. And, cloning <code>Document</code>,
- * <code>DocumentType</code>, <code>Entity</code>, and
- * <code>Notation</code> nodes is implementation dependent.
- * @param deep If <code>true</code>, recursively clone the subtree under
- * the specified node; if <code>false</code>, clone only the node
- * itself (and its attributes, if it is an <code>Element</code>).
- * @return The duplicate node.
- */
- public Node cloneNode(boolean deep);
-
- /**
- * Puts all <code>Text</code> nodes in the full depth of the sub-tree
- * underneath this <code>Node</code>, including attribute nodes, into a
- * "normal" form where only structure (e.g., elements, comments,
- * processing instructions, CDATA sections, and entity references)
- * separates <code>Text</code> nodes, i.e., there are neither adjacent
- * <code>Text</code> nodes nor empty <code>Text</code> nodes. This can
- * be used to ensure that the DOM view of a document is the same as if
- * it were saved and re-loaded, and is useful when operations (such as
- * XPointer lookups) that depend on a particular document tree
- * structure are to be used.In cases where the document contains
- * <code>CDATASections</code>, the normalize operation alone may not be
- * sufficient, since XPointers do not differentiate between
- * <code>Text</code> nodes and <code>CDATASection</code> nodes.
- * @version DOM Level 2
- */
- public void normalize();
-
- /**
- * Tests whether the DOM implementation implements a specific feature and
- * that feature is supported by this node.
- * @param feature The name of the feature to test. This is the same name
- * which can be passed to the method <code>hasFeature</code> on
- * <code>DOMImplementation</code>.
- * @param version This is the version number of the feature to test. In
- * Level 2, version 1, this is the string "2.0". If the version is not
- * specified, supporting any version of the feature will cause the
- * method to return <code>true</code>.
- * @return Returns <code>true</code> if the specified feature is
- * supported on this node, <code>false</code> otherwise.
- * @since DOM Level 2
- */
- public boolean isSupported(String feature,
- String version);
-
- /**
- * The namespace URI of this node, or <code>null</code> if it is
- * unspecified.
- * <br>This is not a computed value that is the result of a namespace
- * lookup based on an examination of the namespace declarations in
- * scope. It is merely the namespace URI given at creation time.
- * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
- * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
- * method, such as <code>createElement</code> from the
- * <code>Document</code> interface, this is always <code>null</code>.Per
- * the Namespaces in XML Specification an attribute does not inherit
- * its namespace from the element it is attached to. If an attribute is
- * not explicitly given a namespace, it simply has no namespace.
- * @since DOM Level 2
- */
- public String getNamespaceURI();
-
- /**
- * The namespace prefix of this node, or <code>null</code> if it is
- * unspecified.
- * <br>Note that setting this attribute, when permitted, changes the
- * <code>nodeName</code> attribute, which holds the qualified name, as
- * well as the <code>tagName</code> and <code>name</code> attributes of
- * the <code>Element</code> and <code>Attr</code> interfaces, when
- * applicable.
- * <br>Note also that changing the prefix of an attribute that is known to
- * have a default value, does not make a new attribute with the default
- * value and the original prefix appear, since the
- * <code>namespaceURI</code> and <code>localName</code> do not change.
- * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
- * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
- * method, such as <code>createElement</code> from the
- * <code>Document</code> interface, this is always <code>null</code>.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
- * illegal character, per the XML 1.0 specification .
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
- * malformed per the Namespaces in XML specification, if the
- * <code>namespaceURI</code> of this node is <code>null</code>, if the
- * specified prefix is "xml" and the <code>namespaceURI</code> of this
- * node is different from "http://www.w3.org/XML/1998/namespace", if
- * this node is an attribute and the specified prefix is "xmlns" and
- * the <code>namespaceURI</code> of this node is different from "
- * http://www.w3.org/2000/xmlns/", or if this node is an attribute and
- * the <code>qualifiedName</code> of this node is "xmlns" .
- * @since DOM Level 2
- */
- public String getPrefix();
- /**
- * The namespace prefix of this node, or <code>null</code> if it is
- * unspecified.
- * <br>Note that setting this attribute, when permitted, changes the
- * <code>nodeName</code> attribute, which holds the qualified name, as
- * well as the <code>tagName</code> and <code>name</code> attributes of
- * the <code>Element</code> and <code>Attr</code> interfaces, when
- * applicable.
- * <br>Note also that changing the prefix of an attribute that is known to
- * have a default value, does not make a new attribute with the default
- * value and the original prefix appear, since the
- * <code>namespaceURI</code> and <code>localName</code> do not change.
- * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
- * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
- * method, such as <code>createElement</code> from the
- * <code>Document</code> interface, this is always <code>null</code>.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: Raised if the specified prefix contains an
- * illegal character, per the XML 1.0 specification .
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- * <br>NAMESPACE_ERR: Raised if the specified <code>prefix</code> is
- * malformed per the Namespaces in XML specification, if the
- * <code>namespaceURI</code> of this node is <code>null</code>, if the
- * specified prefix is "xml" and the <code>namespaceURI</code> of this
- * node is different from "http://www.w3.org/XML/1998/namespace", if
- * this node is an attribute and the specified prefix is "xmlns" and
- * the <code>namespaceURI</code> of this node is different from "
- * http://www.w3.org/2000/xmlns/", or if this node is an attribute and
- * the <code>qualifiedName</code> of this node is "xmlns" .
- * @since DOM Level 2
- */
- public void setPrefix(String prefix)
- throws DOMException;
-
- /**
- * Returns the local part of the qualified name of this node.
- * <br>For nodes of any type other than <code>ELEMENT_NODE</code> and
- * <code>ATTRIBUTE_NODE</code> and nodes created with a DOM Level 1
- * method, such as <code>createElement</code> from the
- * <code>Document</code> interface, this is always <code>null</code>.
- * @since DOM Level 2
- */
- public String getLocalName();
-
- /**
- * Returns whether this node (if it is an element) has any attributes.
- * @return <code>true</code> if this node has any attributes,
- * <code>false</code> otherwise.
- * @since DOM Level 2
- */
- public boolean hasAttributes();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/NodeList.java b/external/jaxp/source/org/w3c/dom/NodeList.java
deleted file mode 100755
index a90b4fd4f..000000000
--- a/external/jaxp/source/org/w3c/dom/NodeList.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>NodeList</code> interface provides the abstraction of an ordered
- * collection of nodes, without defining or constraining how this collection
- * is implemented. <code>NodeList</code> objects in the DOM are live.
- * <p>The items in the <code>NodeList</code> are accessible via an integral
- * index, starting from 0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface NodeList {
- /**
- * Returns the <code>index</code>th item in the collection. If
- * <code>index</code> is greater than or equal to the number of nodes in
- * the list, this returns <code>null</code>.
- * @param index Index into the collection.
- * @return The node at the <code>index</code>th position in the
- * <code>NodeList</code>, or <code>null</code> if that is not a valid
- * index.
- */
- public Node item(int index);
-
- /**
- * The number of nodes in the list. The range of valid child node indices
- * is 0 to <code>length-1</code> inclusive.
- */
- public int getLength();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Notation.java b/external/jaxp/source/org/w3c/dom/Notation.java
deleted file mode 100755
index 186836d73..000000000
--- a/external/jaxp/source/org/w3c/dom/Notation.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * This interface represents a notation declared in the DTD. A notation either
- * declares, by name, the format of an unparsed entity (see section 4.7 of
- * the XML 1.0 specification ), or is used for formal declaration of
- * processing instruction targets (see section 2.6 of the XML 1.0
- * specification ). The <code>nodeName</code> attribute inherited from
- * <code>Node</code> is set to the declared name of the notation.
- * <p>The DOM Level 1 does not support editing <code>Notation</code> nodes;
- * they are therefore readonly.
- * <p>A <code>Notation</code> node does not have any parent.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Notation extends Node {
- /**
- * The public identifier of this notation. If the public identifier was
- * not specified, this is <code>null</code>.
- */
- public String getPublicId();
-
- /**
- * The system identifier of this notation. If the system identifier was
- * not specified, this is <code>null</code>.
- */
- public String getSystemId();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/ProcessingInstruction.java b/external/jaxp/source/org/w3c/dom/ProcessingInstruction.java
deleted file mode 100755
index fe447b51c..000000000
--- a/external/jaxp/source/org/w3c/dom/ProcessingInstruction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>ProcessingInstruction</code> interface represents a "processing
- * instruction", used in XML as a way to keep processor-specific information
- * in the text of the document.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface ProcessingInstruction extends Node {
- /**
- * The target of this processing instruction. XML defines this as being
- * the first token following the markup that begins the processing
- * instruction.
- */
- public String getTarget();
-
- /**
- * The content of this processing instruction. This is from the first non
- * white space character after the target to the character immediately
- * preceding the <code>?&gt;</code>.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public String getData();
- /**
- * The content of this processing instruction. This is from the first non
- * white space character after the target to the character immediately
- * preceding the <code>?&gt;</code>.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised when the node is readonly.
- */
- public void setData(String data)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/Text.java b/external/jaxp/source/org/w3c/dom/Text.java
deleted file mode 100755
index 842a9737b..000000000
--- a/external/jaxp/source/org/w3c/dom/Text.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom;
-
-/**
- * The <code>Text</code> interface inherits from <code>CharacterData</code>
- * and represents the textual content (termed character data in XML) of an
- * <code>Element</code> or <code>Attr</code>. If there is no markup inside
- * an element's content, the text is contained in a single object
- * implementing the <code>Text</code> interface that is the only child of
- * the element. If there is markup, it is parsed into the information items
- * (elements, comments, etc.) and <code>Text</code> nodes that form the list
- * of children of the element.
- * <p>When a document is first made available via the DOM, there is only one
- * <code>Text</code> node for each block of text. Users may create adjacent
- * <code>Text</code> nodes that represent the contents of a given element
- * without any intervening markup, but should be aware that there is no way
- * to represent the separations between these nodes in XML or HTML, so they
- * will not (in general) persist between DOM editing sessions. The
- * <code>normalize()</code> method on <code>Node</code> merges any such
- * adjacent <code>Text</code> objects into a single node for each block of
- * text.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113'>Document Object Model (DOM) Level 2 Core Specification</a>.
- */
-public interface Text extends CharacterData {
- /**
- * Breaks this node into two nodes at the specified <code>offset</code>,
- * keeping both in the tree as siblings. After being split, this node
- * will contain all the content up to the <code>offset</code> point. A
- * new node of the same type, which contains all the content at and
- * after the <code>offset</code> point, is returned. If the original
- * node had a parent node, the new node is inserted as the next sibling
- * of the original node. When the <code>offset</code> is equal to the
- * length of this node, the new node has no data.
- * @param offset The 16-bit unit offset at which to split, starting from
- * <code>0</code>.
- * @return The new node, of the same type as this node.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified offset is negative or greater
- * than the number of 16-bit units in <code>data</code>.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
- */
- public Text splitText(int offset)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2Azimuth.java b/external/jaxp/source/org/w3c/dom/css/CSS2Azimuth.java
deleted file mode 100755
index de9016ec0..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2Azimuth.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2Azimuth</code> interface represents the azimuth CSS Level 2
- * property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2Azimuth extends CSSValue {
- /**
- * A code defining the type of the value as defined in
- * <code>CSSValue</code> . It would be one of <code>CSS_DEG</code> ,
- * <code>CSS_RAD</code> , <code>CSS_GRAD</code> or <code>CSS_IDENT</code>
- * .
- */
- public short getAzimuthType();
-
- /**
- * If <code>azimuthType</code> is <code>CSS_IDENT</code> ,
- * <code>identifier</code> contains one of left-side, far-left, left,
- * center-left, center, center-right, right, far-right, right-side,
- * leftwards, rightwards. The empty string if none is set.
- */
- public String getIdentifier();
-
- /**
- * <code>behind</code> indicates whether the behind identifier has been
- * set.
- */
- public boolean getBehind();
-
- /**
- * A method to set the angle value with a specified unit. This method
- * will unset any previously set identifier value.
- * @param uType The unitType could only be one of <code>CSS_DEG</code> ,
- * <code>CSS_RAD</code> or <code>CSS_GRAD</code> ).
- * @param fValue The new float value of the angle.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the unit type is invalid.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setAngleValue(short uType,
- float fValue)
- throws DOMException;
-
- /**
- * Used to retrieved the float value of the azimuth property.
- * @param uType The unit type can be only an angle unit type (
- * <code>CSS_DEG</code> , <code>CSS_RAD</code> or <code>CSS_GRAD</code>
- * ).
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the unit type is invalid.
- */
- public float getAngleValue(short uType)
- throws DOMException;
-
- /**
- * Setting the identifier for the azimuth property will unset any
- * previously set angle value. The value of <code>azimuthType</code> is
- * set to <code>CSS_IDENT</code>
- * @param ident The new identifier. If the identifier is "leftwards" or
- * "rightward", the behind attribute is ignored.
- * @param b The new value for behind.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified <code>identifier</code> has a
- * syntax error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setIdentifier(String ident,
- boolean b)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2BackgroundPosition.java b/external/jaxp/source/org/w3c/dom/css/CSS2BackgroundPosition.java
deleted file mode 100755
index 159504353..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2BackgroundPosition.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2BackgroundPosition</code> interface represents the
- * background-position CSS Level 2 property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2BackgroundPosition extends CSSValue {
- /**
- * A code defining the type of the horizontal value. It would be one of
- * <code>CSS_PERCENTAGE</code> , <code>CSS_EMS</code> ,
- * <code>CSS_EXS</code> , <code>CSS_PX</code> , <code>CSS_CM</code> ,
- * <code>CSS_MM</code> , <code>CSS_IN</code> , <code>CSS_PT</code> ,
- * <code>CSS_PC</code> or <code>CSS_IDENT</code> . If one of horizontal or
- * vertical is <code>CSS_IDENT</code> , it's guaranteed that the other is
- * the same.
- */
- public short getHorizontalType();
-
- /**
- * A code defining the type of the horizontal value. The code can be one
- * of the following units : <code>CSS_PERCENTAGE</code> ,
- * <code>CSS_EMS</code> , <code>CSS_EXS</code> , <code>CSS_PX</code> ,
- * <code>CSS_CM</code> , <code>CSS_MM</code> , <code>CSS_IN</code> ,
- * <code>CSS_PT</code> , <code>CSS_PC</code> , <code>CSS_IDENT</code> ,
- * <code>CSS_INHERIT</code> . If one of horizontal or vertical is
- * <code>CSS_IDENT</code> or <code>CSS_INHERIT</code> , it's guaranteed
- * that the other is the same.
- */
- public short getVerticalType();
-
- /**
- * If <code>horizontalType</code> is <code>CSS_IDENT</code> or
- * <code>CSS_INHERIT</code> , this attribute contains the string
- * representation of the ident, otherwise it contains an empty string.
- */
- public String getHorizontalIdentifier();
-
- /**
- * If <code>verticalType</code> is <code>CSS_IDENT</code> or
- * <code>CSS_INHERIT</code> , this attribute contains the string
- * representation of the ident, otherwise it contains an empty string. The
- * value is <code>"center"</code> if only the horizontalIdentifier has
- * been set.
- */
- public String getVerticalIdentifier();
-
- /**
- * This method is used to get the float value in a specified unit if the
- * <code>horizontalPosition</code> represents a length or a percentage. If
- * the float doesn't contain a float value or can't be converted into the
- * specified unit, a <code>DOMException</code> is raised.
- * @param hType The horizontal unit.
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the property doesn't contain a float
- * or the value can't be converted.
- */
- public float getHorizontalPosition(float hType)
- throws DOMException;
-
- /**
- * This method is used to get the float value in a specified unit if the
- * <code>verticalPosition</code> represents a length or a percentage. If
- * the float doesn't contain a float value or can't be converted into the
- * specified unit, a <code>DOMException</code> is raised. The value is
- * <code>50%</code> if only the horizontal value has been specified.
- * @param vType The vertical unit.
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the property doesn't contain a float
- * or the value can't be converted.
- */
- public float getVerticalPosition(float vType)
- throws DOMException;
-
- /**
- * This method is used to set the horizontal position with a specified
- * unit. If the vertical value is not a percentage or a length, it sets
- * the vertical position to <code>50%</code> .
- * @param hType The specified unit (a length or a percentage).
- * @param value The new value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the specified unit is not a length or
- * a percentage.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setHorizontalPosition(short hType,
- float value)
- throws DOMException;
-
- /**
- * This method is used to set the vertical position with a specified
- * unit. If the horizontal value is not a percentage or a length, it sets
- * the vertical position to <code>50%</code> .
- * @param vType The specified unit (a length or a percentage).
- * @param value The new value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the specified unit is not a length or
- * a percentage.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setVerticalPosition(short vType,
- float value)
- throws DOMException;
-
- /**
- * Sets the identifiers. If the second identifier is the empty string,
- * the vertical identifier is set to its default value (
- * <code>"center"</code> ).
- * @param hIdentifier The new horizontal identifier.
- * @param vIdentifier The new vertical identifier.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the identifiers have a syntax error and are
- * unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setPositionIdentifier(String hIdentifier,
- String vIdentifier)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2BorderSpacing.java b/external/jaxp/source/org/w3c/dom/css/CSS2BorderSpacing.java
deleted file mode 100755
index 920ebb2b3..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2BorderSpacing.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2BorderSpacing</code> interface represents the border-spacing
- * CSS Level 2 property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2BorderSpacing extends CSSValue {
- /**
- * The A code defining the type of the value as defined in
- * <code>CSSValue</code> . It would be one of <code>CSS_EMS</code> ,
- * <code>CSS_EXS</code> , <code>CSS_PX</code> , <code>CSS_CM</code> ,
- * <code>CSS_MM</code> , <code>CSS_IN</code> , <code>CSS_PT</code> or
- * <code>CSS_PC</code> .
- */
- public short getHorizontalType();
-
- /**
- * The A code defining the type of the value as defined in
- * <code>CSSValue</code> . It would be one of <code>CSS_EMS</code> ,
- * <code>CSS_EXS</code> , <code>CSS_PX</code> , <code>CSS_CM</code> ,
- * <code>CSS_MM</code> , <code>CSS_IN</code> , <code>CSS_PT</code> ,
- * <code>CSS_PC</code> or <code>CSS_INHERIT</code> .
- */
- public short getVerticalType();
-
- /**
- * This method is used to get the float value in a specified unit if the
- * <code>horizontalSpacing</code> represents a length. If the float
- * doesn't contain a float value or can't be converted into the specified
- * unit, a <code>DOMException</code> is raised.
- * @param hType The horizontal unit.
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the property doesn't contain a float
- * or the value can't be converted.
- */
- public float getHorizontalSpacing(float hType)
- throws DOMException;
-
- /**
- * This method is used to get the float value in a specified unit if the
- * <code>verticalSpacing</code> represents a length. If the float doesn't
- * contain a float value or can't be converted into the specified unit, a
- * <code>DOMException</code> is raised. The value is <code>0</code> if
- * only the horizontal value has been specified.
- * @param vType The vertical unit.
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the property doesn't contain a float
- * or the value can't be converted.
- */
- public float getVerticalSpacing(float vType)
- throws DOMException;
-
- /**
- * This method is used to set the horizontal spacing with a specified
- * unit. If the vertical value is a length, it sets the vertical spacing
- * to <code>0</code> .
- * @param hType The horizontal unit.
- * @param value The new value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the specified unit is not a length.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setHorizontalSpacing(short hType,
- float value)
- throws DOMException;
-
- /**
- * This method is used to set the vertical spacing with a specified unit.
- * If the horizontal value is not a length, it sets the vertical spacing
- * to <code>0</code> .
- * @param vType The vertical unit.
- * @param value The new value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the specified unit is not a length or
- * a percentage.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setVerticalSpacing(short vType,
- float value)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2CounterIncrement.java b/external/jaxp/source/org/w3c/dom/css/CSS2CounterIncrement.java
deleted file mode 100755
index f1bd26ba1..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2CounterIncrement.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2CounterIncrement</code> interface represents a simple value
- * for the counter-increment CSS Level 2 property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2CounterIncrement extends CSSValue {
- /**
- * The element name.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified identifier has a syntax error
- * and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is
- * readonly.
- */
- public String getIdentifier();
- public void setIdentifier(String identifier)
- throws DOMException;
-
- /**
- * The increment. (Default value is 1.)
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is readonly.
- */
- public short getIncrement();
- public void setIncrement(short increment)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2CounterReset.java b/external/jaxp/source/org/w3c/dom/css/CSS2CounterReset.java
deleted file mode 100755
index 5c665f5da..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2CounterReset.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2CounterReset</code> interface represents a simple value for
- * the counter-reset CSS Level 2 property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2CounterReset extends CSSValue {
- /**
- * The element name.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified identifier has a syntax error
- * and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is
- * readonly.
- */
- public String getIdentifier();
- public void setIdentifier(String identifier)
- throws DOMException;
-
- /**
- * The reset (default value is 0).
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this identifier is readonly.
- */
- public short getReset();
- public void setReset(short reset)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2Cursor.java b/external/jaxp/source/org/w3c/dom/css/CSS2Cursor.java
deleted file mode 100755
index 298565d88..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2Cursor.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2Cursor</code> interface represents the cursor CSS Level 2
- * property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2Cursor extends CSSValue {
- /**
- * <code>uris</code> represents the list of URIs (<code>CSS_URI</code> )
- * on the cursor property. The list can be empty.
- */
- public CSSValueList getUris();
-
- /**
- * This identifier represents a generic cursor name or an empty string.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly.
- */
- public String getPredefinedCursor();
- public void setPredefinedCursor(String predefinedCursor)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2FontFaceSrc.java b/external/jaxp/source/org/w3c/dom/css/CSS2FontFaceSrc.java
deleted file mode 100755
index 1385e9357..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2FontFaceSrc.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2FontFaceSrc</code> interface represents the src CSS Level 2
- * descriptor.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2FontFaceSrc extends CSSValue {
- /**
- * Specifies the source of the font, empty string otherwise.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly.
- */
- public String getUri();
- public void setUri(String uri)
- throws DOMException;
-
- /**
- * This attribute contains a list of strings for the format CSS function.
- */
- public CSSValueList getFormat();
-
- /**
- * Specifies the full font name of a locally installed font.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly.
- */
- public String getFontFaceName();
- public void setFontFaceName(String fontFaceName)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2FontFaceWidths.java b/external/jaxp/source/org/w3c/dom/css/CSS2FontFaceWidths.java
deleted file mode 100755
index e4ad5e82c..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2FontFaceWidths.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2FontFaceWidths</code> interface represents a simple value
- * for the widths CSS Level 2 descriptor.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2FontFaceWidths extends CSSValue {
- /**
- * The range for the characters.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly.
- */
- public String getUrange();
- public void setUrange(String urange)
- throws DOMException;
-
- /**
- * A list of numbers representing the glyph widths.
- */
- public CSSValueList getNumbers();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2PageSize.java b/external/jaxp/source/org/w3c/dom/css/CSS2PageSize.java
deleted file mode 100755
index d27ec909e..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2PageSize.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2PageSize</code> interface represents the size CSS Level 2
- * descriptor.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2PageSize extends CSSValue {
- /**
- * A code defining the type of the width of the page. It would be one of
- * <code>CSS_EMS</code> , <code>CSS_EXS</code> , <code>CSS_PX</code> ,
- * <code>CSS_CM</code> , <code>CSS_MM</code> , <code>CSS_IN</code> ,
- * <code>CSS_PT</code> , <code>CSS_PC</code> or <code>CSS_IDENT</code> .
- */
- public short getWidthType();
-
- /**
- * A code defining the type of the height of the page. It would be one of
- * <code>CSS_EMS</code> , <code>CSS_EXS</code> , <code>CSS_PX</code> ,
- * <code>CSS_CM</code> , <code>CSS_MM</code> , <code>CSS_IN</code> ,
- * <code>CSS_PT</code> , <code>CSS_PC</code> or <code>CSS_IDENT</code> .
- * If one of width or height is <code>CSS_IDENT</code> , it's guaranteed
- * that the other is the same.
- */
- public short getHeightType();
-
- /**
- * If <code>width</code> is <code>CSS_IDENT</code> , this attribute
- * contains the string representation of the ident, otherwise it contains
- * an empty string.
- */
- public String getIdentifier();
-
- /**
- * This method is used to get the float value in a specified unit if the
- * <code>widthType</code> represents a length. If the float doesn't
- * contain a float value or can't be converted into the specified unit, a
- * <code>DOMException</code> is raised.
- * @param wType The width unit.
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the property doesn't contain a float
- * or the value can't be converted.
- */
- public float getWidth(float wType)
- throws DOMException;
-
- /**
- * This method is used to get the float value in a specified unit if the
- * <code>heightType</code> represents a length. If the float doesn't
- * contain a float value or can't be converted into the specified unit, a
- * <code>DOMException</code> is raised. If only the width value has been
- * specified, the height value is the same.
- * @param hType The height unit.
- * @return The float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the property doesn't contain a float
- * or the value can't be converted.
- */
- public float getHeightSize(float hType)
- throws DOMException;
-
- /**
- * This method is used to set the width position with a specified unit.
- * If the <code>heightType</code> is not a length, it sets the height
- * position to the same value.
- * @param wType The width unit.
- * @param value The new value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the specified unit is not a length or
- * a percentage.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setWidthSize(short wType,
- float value)
- throws DOMException;
-
- /**
- * This method is used to set the height position with a specified unit.
- * If the <code>widthType</code> is not a length, it sets the width
- * position to the same value.
- * @param hType The height unit.
- * @param value The new value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the specified unit is not a length or
- * a percentage.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setHeightSize(short hType,
- float value)
- throws DOMException;
-
- /**
- * Sets the identifier.
- * @param ident The new identifier.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the identifier has a syntax error and is
- * unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this property is
- * readonly.
- */
- public void setIdentifier(String ident)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2PlayDuring.java b/external/jaxp/source/org/w3c/dom/css/CSS2PlayDuring.java
deleted file mode 100755
index 4034cc4e5..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2PlayDuring.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2PlayDuring</code> interface represents the play-during CSS
- * Level 2 property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2PlayDuring extends CSSValue {
- /**
- * A code defining the type of the value as defined in
- * <code>CSSvalue</code> . It would be one of <code>CSS_UNKNOWN</code> or
- * <code>CSS_IDENT</code> .
- */
- public short getPlayDuringType();
-
- /**
- * One of <code>"inherit"</code> , <code>"auto"</code> ,
- * <code>"none"</code> or the empty string if the
- * <code>playDuringType</code> is <code>CSS_UNKNOWN</code> . On setting,
- * it will set the <code>uri</code> to the empty string and
- * <code>mix</code> and <code>repeat</code> to <code>false</code> .
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly.
- */
- public String getPlayDuringIdentifier();
- public void setPlayDuringIdentifier(String playDuringIdentifier)
- throws DOMException;
-
- /**
- * The sound specified by the <code>uri</code> . It will set the
- * <code>playDuringType</code> attribute to <code>CSS_UNKNOWN</code> .
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly.
- */
- public String getUri();
- public void setUri(String uri)
- throws DOMException;
-
- /**
- * <code>true</code> if the sound should be mixed. It will be ignored if
- * the attribute doesn't contain a <code>uri</code> .
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly.
- */
- public boolean getMix();
- public void setMix(boolean mix)
- throws DOMException;
-
- /**
- * <code>true</code> if the sound should be repeated. It will be ignored
- * if the attribute doesn't contain a <code>uri</code> .
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly.
- */
- public boolean getRepeat();
- public void setRepeat(boolean repeat)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2Properties.java b/external/jaxp/source/org/w3c/dom/css/CSS2Properties.java
deleted file mode 100755
index 18f589fd2..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2Properties.java
+++ /dev/null
@@ -1,2265 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSS2Properties</code> interface represents a convenience
- * mechanism for retrieving and setting properties within a
- * <code>CSSStyleDeclaration</code>. The attributes of this interface
- * correspond to all the properties specified in CSS2. Getting an attribute
- * of this interface is equivalent to calling the
- * <code>getPropertyValue</code> method of the
- * <code>CSSStyleDeclaration</code> interface. Setting an attribute of this
- * interface is equivalent to calling the <code>setProperty</code> method of
- * the <code>CSSStyleDeclaration</code> interface.
- * <p> A conformant implementation of the CSS module is not required to
- * implement the <code>CSS2Properties</code> interface. If an implementation
- * does implement this interface, the expectation is that language-specific
- * methods can be used to cast from an instance of the
- * <code>CSSStyleDeclaration</code> interface to the
- * <code>CSS2Properties</code> interface.
- * <p> If an implementation does implement this interface, it is expected to
- * understand the specific syntax of the shorthand properties, and apply
- * their semantics; when the <code>margin</code> property is set, for
- * example, the <code>marginTop</code>, <code>marginRight</code>,
- * <code>marginBottom</code> and <code>marginLeft</code> properties are
- * actually being set by the underlying implementation.
- * <p> When dealing with CSS "shorthand" properties, the shorthand properties
- * should be decomposed into their component longhand properties as
- * appropriate, and when querying for their value, the form returned should
- * be the shortest form exactly equivalent to the declarations made in the
- * ruleset. However, if there is no shorthand declaration that could be
- * added to the ruleset without changing in any way the rules already
- * declared in the ruleset (i.e., by adding longhand rules that were
- * previously not declared in the ruleset), then the empty string should be
- * returned for the shorthand property.
- * <p> For example, querying for the <code>font</code> property should not
- * return "normal normal normal 14pt/normal Arial, sans-serif", when "14pt
- * Arial, sans-serif" suffices. (The normals are initial values, and are
- * implied by use of the longhand property.)
- * <p> If the values for all the longhand properties that compose a particular
- * string are the initial values, then a string consisting of all the
- * initial values should be returned (e.g. a <code>border-width</code> value
- * of "medium" should be returned as such, not as "").
- * <p> For some shorthand properties that take missing values from other
- * sides, such as the <code>margin</code>, <code>padding</code>, and
- * <code>border-[width|style|color]</code> properties, the minimum number of
- * sides possible should be used; i.e., "0px 10px" will be returned instead
- * of "0px 10px 0px 10px".
- * <p> If the value of a shorthand property can not be decomposed into its
- * component longhand properties, as is the case for the <code>font</code>
- * property with a value of "menu", querying for the values of the component
- * longhand properties should return the empty string.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2Properties {
- /**
- * See the azimuth property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getAzimuth();
- /**
- * See the azimuth property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setAzimuth(String azimuth)
- throws DOMException;
-
- /**
- * See the background property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBackground();
- /**
- * See the background property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackground(String background)
- throws DOMException;
-
- /**
- * See the background-attachment property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBackgroundAttachment();
- /**
- * See the background-attachment property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundAttachment(String backgroundAttachment)
- throws DOMException;
-
- /**
- * See the background-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBackgroundColor();
- /**
- * See the background-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundColor(String backgroundColor)
- throws DOMException;
-
- /**
- * See the background-image property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBackgroundImage();
- /**
- * See the background-image property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundImage(String backgroundImage)
- throws DOMException;
-
- /**
- * See the background-position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBackgroundPosition();
- /**
- * See the background-position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundPosition(String backgroundPosition)
- throws DOMException;
-
- /**
- * See the background-repeat property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBackgroundRepeat();
- /**
- * See the background-repeat property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBackgroundRepeat(String backgroundRepeat)
- throws DOMException;
-
- /**
- * See the border property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorder();
- /**
- * See the border property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorder(String border)
- throws DOMException;
-
- /**
- * See the border-collapse property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderCollapse();
- /**
- * See the border-collapse property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderCollapse(String borderCollapse)
- throws DOMException;
-
- /**
- * See the border-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderColor();
- /**
- * See the border-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderColor(String borderColor)
- throws DOMException;
-
- /**
- * See the border-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderSpacing();
- /**
- * See the border-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderSpacing(String borderSpacing)
- throws DOMException;
-
- /**
- * See the border-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderStyle();
- /**
- * See the border-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderStyle(String borderStyle)
- throws DOMException;
-
- /**
- * See the border-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderTop();
- /**
- * See the border-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTop(String borderTop)
- throws DOMException;
-
- /**
- * See the border-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderRight();
- /**
- * See the border-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRight(String borderRight)
- throws DOMException;
-
- /**
- * See the border-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderBottom();
- /**
- * See the border-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottom(String borderBottom)
- throws DOMException;
-
- /**
- * See the border-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderLeft();
- /**
- * See the border-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeft(String borderLeft)
- throws DOMException;
-
- /**
- * See the border-top-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderTopColor();
- /**
- * See the border-top-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTopColor(String borderTopColor)
- throws DOMException;
-
- /**
- * See the border-right-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderRightColor();
- /**
- * See the border-right-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRightColor(String borderRightColor)
- throws DOMException;
-
- /**
- * See the border-bottom-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderBottomColor();
- /**
- * See the border-bottom-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottomColor(String borderBottomColor)
- throws DOMException;
-
- /**
- * See the border-left-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderLeftColor();
- /**
- * See the border-left-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeftColor(String borderLeftColor)
- throws DOMException;
-
- /**
- * See the border-top-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderTopStyle();
- /**
- * See the border-top-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTopStyle(String borderTopStyle)
- throws DOMException;
-
- /**
- * See the border-right-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderRightStyle();
- /**
- * See the border-right-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRightStyle(String borderRightStyle)
- throws DOMException;
-
- /**
- * See the border-bottom-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderBottomStyle();
- /**
- * See the border-bottom-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottomStyle(String borderBottomStyle)
- throws DOMException;
-
- /**
- * See the border-left-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderLeftStyle();
- /**
- * See the border-left-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeftStyle(String borderLeftStyle)
- throws DOMException;
-
- /**
- * See the border-top-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderTopWidth();
- /**
- * See the border-top-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderTopWidth(String borderTopWidth)
- throws DOMException;
-
- /**
- * See the border-right-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderRightWidth();
- /**
- * See the border-right-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderRightWidth(String borderRightWidth)
- throws DOMException;
-
- /**
- * See the border-bottom-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderBottomWidth();
- /**
- * See the border-bottom-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderBottomWidth(String borderBottomWidth)
- throws DOMException;
-
- /**
- * See the border-left-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderLeftWidth();
- /**
- * See the border-left-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderLeftWidth(String borderLeftWidth)
- throws DOMException;
-
- /**
- * See the border-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBorderWidth();
- /**
- * See the border-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBorderWidth(String borderWidth)
- throws DOMException;
-
- /**
- * See the bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getBottom();
- /**
- * See the bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setBottom(String bottom)
- throws DOMException;
-
- /**
- * See the caption-side property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCaptionSide();
- /**
- * See the caption-side property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCaptionSide(String captionSide)
- throws DOMException;
-
- /**
- * See the clear property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getClear();
- /**
- * See the clear property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setClear(String clear)
- throws DOMException;
-
- /**
- * See the clip property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getClip();
- /**
- * See the clip property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setClip(String clip)
- throws DOMException;
-
- /**
- * See the color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getColor();
- /**
- * See the color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setColor(String color)
- throws DOMException;
-
- /**
- * See the content property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getContent();
- /**
- * See the content property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setContent(String content)
- throws DOMException;
-
- /**
- * See the counter-increment property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCounterIncrement();
- /**
- * See the counter-increment property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCounterIncrement(String counterIncrement)
- throws DOMException;
-
- /**
- * See the counter-reset property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCounterReset();
- /**
- * See the counter-reset property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCounterReset(String counterReset)
- throws DOMException;
-
- /**
- * See the cue property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCue();
- /**
- * See the cue property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCue(String cue)
- throws DOMException;
-
- /**
- * See the cue-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCueAfter();
- /**
- * See the cue-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCueAfter(String cueAfter)
- throws DOMException;
-
- /**
- * See the cue-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCueBefore();
- /**
- * See the cue-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCueBefore(String cueBefore)
- throws DOMException;
-
- /**
- * See the cursor property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCursor();
- /**
- * See the cursor property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCursor(String cursor)
- throws DOMException;
-
- /**
- * See the direction property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getDirection();
- /**
- * See the direction property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setDirection(String direction)
- throws DOMException;
-
- /**
- * See the display property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getDisplay();
- /**
- * See the display property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setDisplay(String display)
- throws DOMException;
-
- /**
- * See the elevation property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getElevation();
- /**
- * See the elevation property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setElevation(String elevation)
- throws DOMException;
-
- /**
- * See the empty-cells property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getEmptyCells();
- /**
- * See the empty-cells property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setEmptyCells(String emptyCells)
- throws DOMException;
-
- /**
- * See the float property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getCssFloat();
- /**
- * See the float property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setCssFloat(String cssFloat)
- throws DOMException;
-
- /**
- * See the font property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFont();
- /**
- * See the font property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFont(String font)
- throws DOMException;
-
- /**
- * See the font-family property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontFamily();
- /**
- * See the font-family property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontFamily(String fontFamily)
- throws DOMException;
-
- /**
- * See the font-size property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontSize();
- /**
- * See the font-size property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontSize(String fontSize)
- throws DOMException;
-
- /**
- * See the font-size-adjust property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontSizeAdjust();
- /**
- * See the font-size-adjust property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontSizeAdjust(String fontSizeAdjust)
- throws DOMException;
-
- /**
- * See the font-stretch property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontStretch();
- /**
- * See the font-stretch property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontStretch(String fontStretch)
- throws DOMException;
-
- /**
- * See the font-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontStyle();
- /**
- * See the font-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontStyle(String fontStyle)
- throws DOMException;
-
- /**
- * See the font-variant property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontVariant();
- /**
- * See the font-variant property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontVariant(String fontVariant)
- throws DOMException;
-
- /**
- * See the font-weight property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getFontWeight();
- /**
- * See the font-weight property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFontWeight(String fontWeight)
- throws DOMException;
-
- /**
- * See the height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getHeight();
- /**
- * See the height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setHeight(String height)
- throws DOMException;
-
- /**
- * See the left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getLeft();
- /**
- * See the left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setLeft(String left)
- throws DOMException;
-
- /**
- * See the letter-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getLetterSpacing();
- /**
- * See the letter-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setLetterSpacing(String letterSpacing)
- throws DOMException;
-
- /**
- * See the line-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getLineHeight();
- /**
- * See the line-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setLineHeight(String lineHeight)
- throws DOMException;
-
- /**
- * See the list-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getListStyle();
- /**
- * See the list-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStyle(String listStyle)
- throws DOMException;
-
- /**
- * See the list-style-image property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getListStyleImage();
- /**
- * See the list-style-image property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStyleImage(String listStyleImage)
- throws DOMException;
-
- /**
- * See the list-style-position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getListStylePosition();
- /**
- * See the list-style-position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStylePosition(String listStylePosition)
- throws DOMException;
-
- /**
- * See the list-style-type property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getListStyleType();
- /**
- * See the list-style-type property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setListStyleType(String listStyleType)
- throws DOMException;
-
- /**
- * See the margin property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMargin();
- /**
- * See the margin property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMargin(String margin)
- throws DOMException;
-
- /**
- * See the margin-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMarginTop();
- /**
- * See the margin-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginTop(String marginTop)
- throws DOMException;
-
- /**
- * See the margin-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMarginRight();
- /**
- * See the margin-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginRight(String marginRight)
- throws DOMException;
-
- /**
- * See the margin-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMarginBottom();
- /**
- * See the margin-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginBottom(String marginBottom)
- throws DOMException;
-
- /**
- * See the margin-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMarginLeft();
- /**
- * See the margin-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarginLeft(String marginLeft)
- throws DOMException;
-
- /**
- * See the marker-offset property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMarkerOffset();
- /**
- * See the marker-offset property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarkerOffset(String markerOffset)
- throws DOMException;
-
- /**
- * See the marks property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMarks();
- /**
- * See the marks property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMarks(String marks)
- throws DOMException;
-
- /**
- * See the max-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMaxHeight();
- /**
- * See the max-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMaxHeight(String maxHeight)
- throws DOMException;
-
- /**
- * See the max-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMaxWidth();
- /**
- * See the max-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMaxWidth(String maxWidth)
- throws DOMException;
-
- /**
- * See the min-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMinHeight();
- /**
- * See the min-height property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMinHeight(String minHeight)
- throws DOMException;
-
- /**
- * See the min-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getMinWidth();
- /**
- * See the min-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setMinWidth(String minWidth)
- throws DOMException;
-
- /**
- * See the orphans property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getOrphans();
- /**
- * See the orphans property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOrphans(String orphans)
- throws DOMException;
-
- /**
- * See the outline property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getOutline();
- /**
- * See the outline property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutline(String outline)
- throws DOMException;
-
- /**
- * See the outline-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getOutlineColor();
- /**
- * See the outline-color property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutlineColor(String outlineColor)
- throws DOMException;
-
- /**
- * See the outline-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getOutlineStyle();
- /**
- * See the outline-style property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutlineStyle(String outlineStyle)
- throws DOMException;
-
- /**
- * See the outline-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getOutlineWidth();
- /**
- * See the outline-width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOutlineWidth(String outlineWidth)
- throws DOMException;
-
- /**
- * See the overflow property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getOverflow();
- /**
- * See the overflow property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setOverflow(String overflow)
- throws DOMException;
-
- /**
- * See the padding property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPadding();
- /**
- * See the padding property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPadding(String padding)
- throws DOMException;
-
- /**
- * See the padding-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPaddingTop();
- /**
- * See the padding-top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingTop(String paddingTop)
- throws DOMException;
-
- /**
- * See the padding-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPaddingRight();
- /**
- * See the padding-right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingRight(String paddingRight)
- throws DOMException;
-
- /**
- * See the padding-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPaddingBottom();
- /**
- * See the padding-bottom property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingBottom(String paddingBottom)
- throws DOMException;
-
- /**
- * See the padding-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPaddingLeft();
- /**
- * See the padding-left property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPaddingLeft(String paddingLeft)
- throws DOMException;
-
- /**
- * See the page property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPage();
- /**
- * See the page property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPage(String page)
- throws DOMException;
-
- /**
- * See the page-break-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPageBreakAfter();
- /**
- * See the page-break-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPageBreakAfter(String pageBreakAfter)
- throws DOMException;
-
- /**
- * See the page-break-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPageBreakBefore();
- /**
- * See the page-break-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPageBreakBefore(String pageBreakBefore)
- throws DOMException;
-
- /**
- * See the page-break-inside property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPageBreakInside();
- /**
- * See the page-break-inside property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPageBreakInside(String pageBreakInside)
- throws DOMException;
-
- /**
- * See the pause property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPause();
- /**
- * See the pause property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPause(String pause)
- throws DOMException;
-
- /**
- * See the pause-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPauseAfter();
- /**
- * See the pause-after property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPauseAfter(String pauseAfter)
- throws DOMException;
-
- /**
- * See the pause-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPauseBefore();
- /**
- * See the pause-before property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPauseBefore(String pauseBefore)
- throws DOMException;
-
- /**
- * See the pitch property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPitch();
- /**
- * See the pitch property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPitch(String pitch)
- throws DOMException;
-
- /**
- * See the pitch-range property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPitchRange();
- /**
- * See the pitch-range property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPitchRange(String pitchRange)
- throws DOMException;
-
- /**
- * See the play-during property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPlayDuring();
- /**
- * See the play-during property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPlayDuring(String playDuring)
- throws DOMException;
-
- /**
- * See the position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getPosition();
- /**
- * See the position property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setPosition(String position)
- throws DOMException;
-
- /**
- * See the quotes property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getQuotes();
- /**
- * See the quotes property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setQuotes(String quotes)
- throws DOMException;
-
- /**
- * See the richness property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getRichness();
- /**
- * See the richness property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setRichness(String richness)
- throws DOMException;
-
- /**
- * See the right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getRight();
- /**
- * See the right property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setRight(String right)
- throws DOMException;
-
- /**
- * See the size property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getSize();
- /**
- * See the size property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSize(String size)
- throws DOMException;
-
- /**
- * See the speak property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getSpeak();
- /**
- * See the speak property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeak(String speak)
- throws DOMException;
-
- /**
- * See the speak-header property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getSpeakHeader();
- /**
- * See the speak-header property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeakHeader(String speakHeader)
- throws DOMException;
-
- /**
- * See the speak-numeral property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getSpeakNumeral();
- /**
- * See the speak-numeral property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeakNumeral(String speakNumeral)
- throws DOMException;
-
- /**
- * See the speak-punctuation property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getSpeakPunctuation();
- /**
- * See the speak-punctuation property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeakPunctuation(String speakPunctuation)
- throws DOMException;
-
- /**
- * See the speech-rate property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getSpeechRate();
- /**
- * See the speech-rate property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setSpeechRate(String speechRate)
- throws DOMException;
-
- /**
- * See the stress property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getStress();
- /**
- * See the stress property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setStress(String stress)
- throws DOMException;
-
- /**
- * See the table-layout property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTableLayout();
- /**
- * See the table-layout property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTableLayout(String tableLayout)
- throws DOMException;
-
- /**
- * See the text-align property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTextAlign();
- /**
- * See the text-align property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextAlign(String textAlign)
- throws DOMException;
-
- /**
- * See the text-decoration property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTextDecoration();
- /**
- * See the text-decoration property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextDecoration(String textDecoration)
- throws DOMException;
-
- /**
- * See the text-indent property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTextIndent();
- /**
- * See the text-indent property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextIndent(String textIndent)
- throws DOMException;
-
- /**
- * See the text-shadow property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTextShadow();
- /**
- * See the text-shadow property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextShadow(String textShadow)
- throws DOMException;
-
- /**
- * See the text-transform property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTextTransform();
- /**
- * See the text-transform property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTextTransform(String textTransform)
- throws DOMException;
-
- /**
- * See the top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getTop();
- /**
- * See the top property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setTop(String top)
- throws DOMException;
-
- /**
- * See the unicode-bidi property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getUnicodeBidi();
- /**
- * See the unicode-bidi property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setUnicodeBidi(String unicodeBidi)
- throws DOMException;
-
- /**
- * See the vertical-align property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getVerticalAlign();
- /**
- * See the vertical-align property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVerticalAlign(String verticalAlign)
- throws DOMException;
-
- /**
- * See the visibility property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getVisibility();
- /**
- * See the visibility property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVisibility(String visibility)
- throws DOMException;
-
- /**
- * See the voice-family property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getVoiceFamily();
- /**
- * See the voice-family property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVoiceFamily(String voiceFamily)
- throws DOMException;
-
- /**
- * See the volume property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getVolume();
- /**
- * See the volume property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setVolume(String volume)
- throws DOMException;
-
- /**
- * See the white-space property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getWhiteSpace();
- /**
- * See the white-space property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWhiteSpace(String whiteSpace)
- throws DOMException;
-
- /**
- * See the widows property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getWidows();
- /**
- * See the widows property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWidows(String widows)
- throws DOMException;
-
- /**
- * See the width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getWidth();
- /**
- * See the width property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWidth(String width)
- throws DOMException;
-
- /**
- * See the word-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getWordSpacing();
- /**
- * See the word-spacing property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setWordSpacing(String wordSpacing)
- throws DOMException;
-
- /**
- * See the z-index property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public String getZIndex();
- /**
- * See the z-index property definition in CSS2.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the new value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setZIndex(String zIndex)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSS2TextShadow.java b/external/jaxp/source/org/w3c/dom/css/CSS2TextShadow.java
deleted file mode 100755
index fd17ef9cd..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSS2TextShadow.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>CSS2TextShadow</code> interface represents a simple value for
- * the text-shadow CSS Level 2 property.
- * <p> For this extension of the <code>CSSValue</code> interface, the
- * <code>valueType</code> attribute of the underlying <code>CSSValue</code>
- * interface shall be <code>CSS_CUSTOM</code> .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface CSS2TextShadow extends CSSValue {
- /**
- * Specifies the color of the text shadow. The CSS Value can contain an
- * empty string if no color has been specified.
- */
- public CSSValue getColor();
-
- /**
- * The horizontal position of the text shadow. <code>0</code> if no
- * length has been specified.
- */
- public CSSValue getHorizontal();
-
- /**
- * The vertical position of the text shadow. <code>0</code> if no length
- * has been specified.
- */
- public CSSValue getVertical();
-
- /**
- * The blur radius of the text shadow. <code>0</code> if no length has
- * been specified.
- */
- public CSSValue getBlur();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSCharsetRule.java b/external/jaxp/source/org/w3c/dom/css/CSSCharsetRule.java
deleted file mode 100755
index fc85a057d..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSCharsetRule.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSCharsetRule</code> interface represents a @charset rule in a
- * CSS style sheet. The value of the <code>encoding</code> attribute does
- * not affect the encoding of text data in the DOM objects; this encoding is
- * always UTF-16. After a stylesheet is loaded, the value of the
- * <code>encoding</code> attribute is the value found in the
- * <code>@charset</code> rule. If there was no <code>@charset</code> in the
- * original document, then no <code>CSSCharsetRule</code> is created. The
- * value of the <code>encoding</code> attribute may also be used as a hint
- * for the encoding used on serialization of the style sheet.
- * <p> The value of the @charset rule (and therefore of the
- * <code>CSSCharsetRule</code>) may not correspond to the encoding the
- * document actually came in; character encoding information e.g. in an HTTP
- * header, has priority (see CSS document representation) but this is not
- * reflected in the <code>CSSCharsetRule</code>.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSCharsetRule extends CSSRule {
- /**
- * The encoding information used in this <code>@charset</code> rule.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified encoding value has a syntax error
- * and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding rule is
- * readonly.
- */
- public String getEncoding();
- /**
- * The encoding information used in this <code>@charset</code> rule.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified encoding value has a syntax error
- * and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this encoding rule is
- * readonly.
- */
- public void setEncoding(String encoding)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSFontFaceRule.java b/external/jaxp/source/org/w3c/dom/css/CSSFontFaceRule.java
deleted file mode 100755
index a17957061..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSFontFaceRule.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>CSSFontFaceRule</code> interface represents a @font-face rule in
- * a CSS style sheet. The <code>@font-face</code> rule is used to hold a set
- * of font descriptions.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSFontFaceRule extends CSSRule {
- /**
- * The declaration-block of this rule.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSImportRule.java b/external/jaxp/source/org/w3c/dom/css/CSSImportRule.java
deleted file mode 100755
index e18ad569b..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSImportRule.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.stylesheets.MediaList;
-
-/**
- * The <code>CSSImportRule</code> interface represents a @import rule within
- * a CSS style sheet. The <code>@import</code> rule is used to import style
- * rules from other style sheets.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSImportRule extends CSSRule {
- /**
- * The location of the style sheet to be imported. The attribute will not
- * contain the <code>"url(...)"</code> specifier around the URI.
- */
- public String getHref();
-
- /**
- * A list of media types for which this style sheet may be used.
- */
- public MediaList getMedia();
-
- /**
- * The style sheet referred to by this rule, if it has been loaded. The
- * value of this attribute is <code>null</code> if the style sheet has
- * not yet been loaded or if it will not be loaded (e.g. if the style
- * sheet is for a media type not supported by the user agent).
- */
- public CSSStyleSheet getStyleSheet();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSMediaRule.java b/external/jaxp/source/org/w3c/dom/css/CSSMediaRule.java
deleted file mode 100755
index 68a73045e..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSMediaRule.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.stylesheets.MediaList;
-
-/**
- * The <code>CSSMediaRule</code> interface represents a @media rule in a CSS
- * style sheet. A <code>@media</code> rule can be used to delimit style
- * rules for specific media types.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSMediaRule extends CSSRule {
- /**
- * A list of media types for this rule.
- */
- public MediaList getMedia();
-
- /**
- * A list of all CSS rules contained within the media block.
- */
- public CSSRuleList getCssRules();
-
- /**
- * Used to insert a new rule into the media block.
- * @param rule The parsable text representing the rule. For rule sets
- * this contains both the selector and the style declaration. For
- * at-rules, this specifies both the at-identifier and the rule
- * content.
- * @param index The index within the media block's rule collection of
- * the rule before which to insert the specified rule. If the
- * specified index is equal to the length of the media blocks's rule
- * collection, the rule will be added to the end of the media block.
- * @return The index within the media block's rule collection of the
- * newly inserted rule.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the
- * specified index, e.g., if an <code>@import</code> rule is inserted
- * after a standard rule set or other at-rule.
- * <br>INDEX_SIZE_ERR: Raised if the specified index is not a valid
- * insertion point.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
- * readonly.
- * <br>SYNTAX_ERR: Raised if the specified rule has a syntax error and
- * is unparsable.
- */
- public int insertRule(String rule,
- int index)
- throws DOMException;
-
- /**
- * Used to delete a rule from the media block.
- * @param index The index within the media block's rule collection of
- * the rule to remove.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index does not correspond to
- * a rule in the media rule list.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media rule is
- * readonly.
- */
- public void deleteRule(int index)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSPageRule.java b/external/jaxp/source/org/w3c/dom/css/CSSPageRule.java
deleted file mode 100755
index cb95a3e59..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSPageRule.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSPageRule</code> interface represents a @page rule within a
- * CSS style sheet. The <code>@page</code> rule is used to specify the
- * dimensions, orientation, margins, etc. of a page box for paged media.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSPageRule extends CSSRule {
- /**
- * The parsable textual representation of the page selector for the rule.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.
- */
- public String getSelectorText();
- /**
- * The parsable textual representation of the page selector for the rule.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.
- */
- public void setSelectorText(String selectorText)
- throws DOMException;
-
- /**
- * The declaration-block of this rule.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSPrimitiveValue.java b/external/jaxp/source/org/w3c/dom/css/CSSPrimitiveValue.java
deleted file mode 100755
index 4131d26cd..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSPrimitiveValue.java
+++ /dev/null
@@ -1,296 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSPrimitiveValue</code> interface represents a single CSS value
- * . This interface may be used to determine the value of a specific style
- * property currently set in a block or to set a specific style property
- * explicitly within the block. An instance of this interface might be
- * obtained from the <code>getPropertyCSSValue</code> method of the
- * <code>CSSStyleDeclaration</code> interface. A
- * <code>CSSPrimitiveValue</code> object only occurs in a context of a CSS
- * property.
- * <p> Conversions are allowed between absolute values (from millimeters to
- * centimeters, from degrees to radians, and so on) but not between relative
- * values. (For example, a pixel value cannot be converted to a centimeter
- * value.) Percentage values can't be converted since they are relative to
- * the parent value (or another property value). There is one exception for
- * color percentage values: since a color percentage value is relative to
- * the range 0-255, a color percentage value can be converted to a number;
- * (see also the <code>RGBColor</code> interface).
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSPrimitiveValue extends CSSValue {
- // UnitTypes
- /**
- * The value is not a recognized CSS2 value. The value can only be
- * obtained by using the <code>cssText</code> attribute.
- */
- public static final short CSS_UNKNOWN = 0;
- /**
- * The value is a simple number. The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_NUMBER = 1;
- /**
- * The value is a percentage. The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_PERCENTAGE = 2;
- /**
- * The value is a length (ems). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_EMS = 3;
- /**
- * The value is a length (exs). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_EXS = 4;
- /**
- * The value is a length (px). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_PX = 5;
- /**
- * The value is a length (cm). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_CM = 6;
- /**
- * The value is a length (mm). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_MM = 7;
- /**
- * The value is a length (in). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_IN = 8;
- /**
- * The value is a length (pt). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_PT = 9;
- /**
- * The value is a length (pc). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_PC = 10;
- /**
- * The value is an angle (deg). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_DEG = 11;
- /**
- * The value is an angle (rad). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_RAD = 12;
- /**
- * The value is an angle (grad). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_GRAD = 13;
- /**
- * The value is a time (ms). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_MS = 14;
- /**
- * The value is a time (s). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_S = 15;
- /**
- * The value is a frequency (Hz). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_HZ = 16;
- /**
- * The value is a frequency (kHz). The value can be obtained by using the
- * <code>getFloatValue</code> method.
- */
- public static final short CSS_KHZ = 17;
- /**
- * The value is a number with an unknown dimension. The value can be
- * obtained by using the <code>getFloatValue</code> method.
- */
- public static final short CSS_DIMENSION = 18;
- /**
- * The value is a STRING. The value can be obtained by using the
- * <code>getStringValue</code> method.
- */
- public static final short CSS_STRING = 19;
- /**
- * The value is a URI. The value can be obtained by using the
- * <code>getStringValue</code> method.
- */
- public static final short CSS_URI = 20;
- /**
- * The value is an identifier. The value can be obtained by using the
- * <code>getStringValue</code> method.
- */
- public static final short CSS_IDENT = 21;
- /**
- * The value is a attribute function. The value can be obtained by using
- * the <code>getStringValue</code> method.
- */
- public static final short CSS_ATTR = 22;
- /**
- * The value is a counter or counters function. The value can be obtained
- * by using the <code>getCounterValue</code> method.
- */
- public static final short CSS_COUNTER = 23;
- /**
- * The value is a rect function. The value can be obtained by using the
- * <code>getRectValue</code> method.
- */
- public static final short CSS_RECT = 24;
- /**
- * The value is a RGB color. The value can be obtained by using the
- * <code>getRGBColorValue</code> method.
- */
- public static final short CSS_RGBCOLOR = 25;
-
- /**
- * The type of the value as defined by the constants specified above.
- */
- public short getPrimitiveType();
-
- /**
- * A method to set the float value with a specified unit. If the property
- * attached with this value can not accept the specified unit or the
- * float value, the value will be unchanged and a
- * <code>DOMException</code> will be raised.
- * @param unitType A unit code as defined above. The unit code can only
- * be a float unit type (i.e. <code>CSS_NUMBER</code>,
- * <code>CSS_PERCENTAGE</code>, <code>CSS_EMS</code>,
- * <code>CSS_EXS</code>, <code>CSS_PX</code>, <code>CSS_CM</code>,
- * <code>CSS_MM</code>, <code>CSS_IN</code>, <code>CSS_PT</code>,
- * <code>CSS_PC</code>, <code>CSS_DEG</code>, <code>CSS_RAD</code>,
- * <code>CSS_GRAD</code>, <code>CSS_MS</code>, <code>CSS_S</code>,
- * <code>CSS_HZ</code>, <code>CSS_KHZ</code>,
- * <code>CSS_DIMENSION</code>).
- * @param floatValue The new float value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the attached property doesn't support
- * the float value or the unit type.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setFloatValue(short unitType,
- float floatValue)
- throws DOMException;
-
- /**
- * This method is used to get a float value in a specified unit. If this
- * CSS value doesn't contain a float value or can't be converted into
- * the specified unit, a <code>DOMException</code> is raised.
- * @param unitType A unit code to get the float value. The unit code can
- * only be a float unit type (i.e. <code>CSS_NUMBER</code>,
- * <code>CSS_PERCENTAGE</code>, <code>CSS_EMS</code>,
- * <code>CSS_EXS</code>, <code>CSS_PX</code>, <code>CSS_CM</code>,
- * <code>CSS_MM</code>, <code>CSS_IN</code>, <code>CSS_PT</code>,
- * <code>CSS_PC</code>, <code>CSS_DEG</code>, <code>CSS_RAD</code>,
- * <code>CSS_GRAD</code>, <code>CSS_MS</code>, <code>CSS_S</code>,
- * <code>CSS_HZ</code>, <code>CSS_KHZ</code>,
- * <code>CSS_DIMENSION</code>).
- * @return The float value in the specified unit.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a float
- * value or if the float value can't be converted into the specified
- * unit.
- */
- public float getFloatValue(short unitType)
- throws DOMException;
-
- /**
- * A method to set the string value with the specified unit. If the
- * property attached to this value can't accept the specified unit or
- * the string value, the value will be unchanged and a
- * <code>DOMException</code> will be raised.
- * @param stringType A string code as defined above. The string code can
- * only be a string unit type (i.e. <code>CSS_STRING</code>,
- * <code>CSS_URI</code>, <code>CSS_IDENT</code>, and
- * <code>CSS_ATTR</code>).
- * @param stringValue The new string value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string
- * value or if the string value can't be converted into the specified
- * unit.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this property is readonly.
- */
- public void setStringValue(short stringType,
- String stringValue)
- throws DOMException;
-
- /**
- * This method is used to get the string value. If the CSS value doesn't
- * contain a string value, a <code>DOMException</code> is raised. Some
- * properties (like 'font-family' or 'voice-family') convert a
- * whitespace separated list of idents to a string.
- * @return The string value in the current unit. The current
- * <code>primitiveType</code> can only be a string unit type (i.e.
- * <code>CSS_STRING</code>, <code>CSS_URI</code>,
- * <code>CSS_IDENT</code> and <code>CSS_ATTR</code>).
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a string
- * value.
- */
- public String getStringValue()
- throws DOMException;
-
- /**
- * This method is used to get the Counter value. If this CSS value
- * doesn't contain a counter value, a <code>DOMException</code> is
- * raised. Modification to the corresponding style property can be
- * achieved using the <code>Counter</code> interface.
- * @return The Counter value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a
- * Counter value (e.g. this is not <code>CSS_COUNTER</code>).
- */
- public Counter getCounterValue()
- throws DOMException;
-
- /**
- * This method is used to get the Rect value. If this CSS value doesn't
- * contain a rect value, a <code>DOMException</code> is raised.
- * Modification to the corresponding style property can be achieved
- * using the <code>Rect</code> interface.
- * @return The Rect value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the CSS value doesn't contain a Rect
- * value. (e.g. this is not <code>CSS_RECT</code>).
- */
- public Rect getRectValue()
- throws DOMException;
-
- /**
- * This method is used to get the RGB color. If this CSS value doesn't
- * contain a RGB color value, a <code>DOMException</code> is raised.
- * Modification to the corresponding style property can be achieved
- * using the <code>RGBColor</code> interface.
- * @return the RGB color value.
- * @exception DOMException
- * INVALID_ACCESS_ERR: Raised if the attached property can't return a
- * RGB color value (e.g. this is not <code>CSS_RGBCOLOR</code>).
- */
- public RGBColor getRGBColorValue()
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSRule.java b/external/jaxp/source/org/w3c/dom/css/CSSRule.java
deleted file mode 100755
index 2d375e91a..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSRule.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSRule</code> interface is the abstract base interface for any
- * type of CSS statement. This includes both rule sets and at-rules. An
- * implementation is expected to preserve all rules specified in a CSS style
- * sheet, even if the rule is not recognized by the parser. Unrecognized
- * rules are represented using the <code>CSSUnknownRule</code> interface.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSRule {
- // RuleType
- /**
- * The rule is a <code>CSSUnknownRule</code>.
- */
- public static final short UNKNOWN_RULE = 0;
- /**
- * The rule is a <code>CSSStyleRule</code>.
- */
- public static final short STYLE_RULE = 1;
- /**
- * The rule is a <code>CSSCharsetRule</code>.
- */
- public static final short CHARSET_RULE = 2;
- /**
- * The rule is a <code>CSSImportRule</code>.
- */
- public static final short IMPORT_RULE = 3;
- /**
- * The rule is a <code>CSSMediaRule</code>.
- */
- public static final short MEDIA_RULE = 4;
- /**
- * The rule is a <code>CSSFontFaceRule</code>.
- */
- public static final short FONT_FACE_RULE = 5;
- /**
- * The rule is a <code>CSSPageRule</code>.
- */
- public static final short PAGE_RULE = 6;
-
- /**
- * The type of the rule, as defined above. The expectation is that
- * binding-specific casting methods can be used to cast down from an
- * instance of the <code>CSSRule</code> interface to the specific
- * derived interface implied by the <code>type</code>.
- */
- public short getType();
-
- /**
- * The parsable textual representation of the rule. This reflects the
- * current state of the rule and not its initial value.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string
- * value represents a different type of rule than the current one.
- * <br>HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
- * this point in the style sheet.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.
- */
- public String getCssText();
- /**
- * The parsable textual representation of the rule. This reflects the
- * current state of the rule and not its initial value.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string
- * value represents a different type of rule than the current one.
- * <br>HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at
- * this point in the style sheet.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if the rule is readonly.
- */
- public void setCssText(String cssText)
- throws DOMException;
-
- /**
- * The style sheet that contains this rule.
- */
- public CSSStyleSheet getParentStyleSheet();
-
- /**
- * If this rule is contained inside another rule (e.g. a style rule
- * inside an @media block), this is the containing rule. If this rule is
- * not nested inside any other rules, this returns <code>null</code>.
- */
- public CSSRule getParentRule();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSRuleList.java b/external/jaxp/source/org/w3c/dom/css/CSSRuleList.java
deleted file mode 100755
index 41c2c6837..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSRuleList.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>CSSRuleList</code> interface provides the abstraction of an
- * ordered collection of CSS rules.
- * <p> The items in the <code>CSSRuleList</code> are accessible via an
- * integral index, starting from 0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSRuleList {
- /**
- * The number of <code>CSSRules</code> in the list. The range of valid
- * child rule indices is <code>0</code> to <code>length-1</code>
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve a CSS rule by ordinal index. The order in this
- * collection represents the order of the rules in the CSS style sheet.
- * If index is greater than or equal to the number of rules in the list,
- * this returns <code>null</code>.
- * @param index Index into the collection
- * @return The style rule at the <code>index</code> position in the
- * <code>CSSRuleList</code>, or <code>null</code> if that is not a
- * valid index.
- */
- public CSSRule item(int index);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSStyleDeclaration.java b/external/jaxp/source/org/w3c/dom/css/CSSStyleDeclaration.java
deleted file mode 100755
index bcd5229ff..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSStyleDeclaration.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSStyleDeclaration</code> interface represents a single CSS
- * declaration block. This interface may be used to determine the style
- * properties currently set in a block or to set style properties explicitly
- * within the block.
- * <p> While an implementation may not recognize all CSS properties within a
- * CSS declaration block, it is expected to provide access to all specified
- * properties in the style sheet through the <code>CSSStyleDeclaration</code>
- * interface. Furthermore, implementations that support a specific level of
- * CSS should correctly handle CSS shorthand properties for that level. For
- * a further discussion of shorthand properties, see the
- * <code>CSS2Properties</code> interface.
- * <p> This interface is also used to provide a read-only access to the
- * computed values of an element. See also the <code>ViewCSS</code>
- * interface. The CSS Object Model doesn't provide an access to the
- * specified or actual values of the CSS cascade.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSStyleDeclaration {
- /**
- * The parsable textual representation of the declaration block
- * (excluding the surrounding curly braces). Setting this attribute will
- * result in the parsing of the new value and resetting of all the
- * properties in the declaration block including the removal or addition
- * of properties.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly or a property is readonly.
- */
- public String getCssText();
- /**
- * The parsable textual representation of the declaration block
- * (excluding the surrounding curly braces). Setting this attribute will
- * result in the parsing of the new value and resetting of all the
- * properties in the declaration block including the removal or addition
- * of properties.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly or a property is readonly.
- */
- public void setCssText(String cssText)
- throws DOMException;
-
- /**
- * Used to retrieve the value of a CSS property if it has been explicitly
- * set within this declaration block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return Returns the value of the property if it has been explicitly
- * set for this declaration block. Returns the empty string if the
- * property has not been set.
- */
- public String getPropertyValue(String propertyName);
-
- /**
- * Used to retrieve the object representation of the value of a CSS
- * property if it has been explicitly set within this declaration block.
- * This method returns <code>null</code> if the property is a shorthand
- * property. Shorthand property values can only be accessed and modified
- * as strings, using the <code>getPropertyValue</code> and
- * <code>setProperty</code> methods.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return Returns the value of the property if it has been explicitly
- * set for this declaration block. Returns <code>null</code> if the
- * property has not been set.
- */
- public CSSValue getPropertyCSSValue(String propertyName);
-
- /**
- * Used to remove a CSS property if it has been explicitly set within
- * this declaration block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return Returns the value of the property if it has been explicitly
- * set for this declaration block. Returns the empty string if the
- * property has not been set or the property name does not correspond
- * to a known CSS property.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is readonly
- * or the property is readonly.
- */
- public String removeProperty(String propertyName)
- throws DOMException;
-
- /**
- * Used to retrieve the priority of a CSS property (e.g. the
- * <code>"important"</code> qualifier) if the property has been
- * explicitly set in this declaration block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @return A string representing the priority (e.g.
- * <code>"important"</code>) if one exists. The empty string if none
- * exists.
- */
- public String getPropertyPriority(String propertyName);
-
- /**
- * Used to set a property value and priority within this declaration
- * block.
- * @param propertyName The name of the CSS property. See the CSS
- * property index.
- * @param value The new value of the property.
- * @param priority The new priority of the property (e.g.
- * <code>"important"</code>).
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified value has a syntax error and is
- * unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this declaration is
- * readonly or the property is readonly.
- */
- public void setProperty(String propertyName,
- String value,
- String priority)
- throws DOMException;
-
- /**
- * The number of properties that have been explicitly set in this
- * declaration block. The range of valid indices is 0 to length-1
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve the properties that have been explicitly set in this
- * declaration block. The order of the properties retrieved using this
- * method does not have to be the order in which they were set. This
- * method can be used to iterate over all properties in this declaration
- * block.
- * @param index Index of the property name to retrieve.
- * @return The name of the property at this ordinal position. The empty
- * string if no property exists at this position.
- */
- public String item(int index);
-
- /**
- * The CSS rule that contains this declaration block or <code>null</code>
- * if this <code>CSSStyleDeclaration</code> is not attached to a
- * <code>CSSRule</code>.
- */
- public CSSRule getParentRule();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSStyleRule.java b/external/jaxp/source/org/w3c/dom/css/CSSStyleRule.java
deleted file mode 100755
index e3e0cd81a..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSStyleRule.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSStyleRule</code> interface represents a single rule set in a
- * CSS style sheet.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSStyleRule extends CSSRule {
- /**
- * The textual representation of the selector for the rule set. The
- * implementation may have stripped out insignificant whitespace while
- * parsing the selector.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.
- */
- public String getSelectorText();
- /**
- * The textual representation of the selector for the rule set. The
- * implementation may have stripped out insignificant whitespace while
- * parsing the selector.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this rule is readonly.
- */
- public void setSelectorText(String selectorText)
- throws DOMException;
-
- /**
- * The declaration-block of this rule set.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSStyleSheet.java b/external/jaxp/source/org/w3c/dom/css/CSSStyleSheet.java
deleted file mode 100755
index b529e5db0..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSStyleSheet.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-import org.w3c.dom.stylesheets.StyleSheet;
-
-/**
- * The <code>CSSStyleSheet</code> interface is a concrete interface used to
- * represent a CSS style sheet i.e., a style sheet whose content type is
- * "text/css".
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSStyleSheet extends StyleSheet {
- /**
- * If this style sheet comes from an <code>@import</code> rule, the
- * <code>ownerRule</code> attribute will contain the
- * <code>CSSImportRule</code>. In that case, the <code>ownerNode</code>
- * attribute in the <code>StyleSheet</code> interface will be
- * <code>null</code>. If the style sheet comes from an element or a
- * processing instruction, the <code>ownerRule</code> attribute will be
- * <code>null</code> and the <code>ownerNode</code> attribute will
- * contain the <code>Node</code>.
- */
- public CSSRule getOwnerRule();
-
- /**
- * The list of all CSS rules contained within the style sheet. This
- * includes both rule sets and at-rules.
- */
- public CSSRuleList getCssRules();
-
- /**
- * Used to insert a new rule into the style sheet. The new rule now
- * becomes part of the cascade.
- * @param rule The parsable text representing the rule. For rule sets
- * this contains both the selector and the style declaration. For
- * at-rules, this specifies both the at-identifier and the rule
- * content.
- * @param index The index within the style sheet's rule list of the rule
- * before which to insert the specified rule. If the specified index
- * is equal to the length of the style sheet's rule collection, the
- * rule will be added to the end of the style sheet.
- * @return The index within the style sheet's rule collection of the
- * newly inserted rule.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if the rule cannot be inserted at the
- * specified index e.g. if an <code>@import</code> rule is inserted
- * after a standard rule set or other at-rule.
- * <br>INDEX_SIZE_ERR: Raised if the specified index is not a valid
- * insertion point.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
- * readonly.
- * <br>SYNTAX_ERR: Raised if the specified rule has a syntax error and
- * is unparsable.
- */
- public int insertRule(String rule,
- int index)
- throws DOMException;
-
- /**
- * Used to delete a rule from the style sheet.
- * @param index The index within the style sheet's rule list of the rule
- * to remove.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index does not correspond to
- * a rule in the style sheet's rule list.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this style sheet is
- * readonly.
- */
- public void deleteRule(int index)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSUnknownRule.java b/external/jaxp/source/org/w3c/dom/css/CSSUnknownRule.java
deleted file mode 100755
index 763d5f1b6..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSUnknownRule.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>CSSUnknownRule</code> interface represents an at-rule not
- * supported by this user agent.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSUnknownRule extends CSSRule {
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSValue.java b/external/jaxp/source/org/w3c/dom/css/CSSValue.java
deleted file mode 100755
index 48b2fbd6f..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSValue.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>CSSValue</code> interface represents a simple or a complex
- * value. A <code>CSSValue</code> object only occurs in a context of a CSS
- * property.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSValue {
- // UnitTypes
- /**
- * The value is inherited and the <code>cssText</code> contains "inherit".
- */
- public static final short CSS_INHERIT = 0;
- /**
- * The value is a primitive value and an instance of the
- * <code>CSSPrimitiveValue</code> interface can be obtained by using
- * binding-specific casting methods on this instance of the
- * <code>CSSValue</code> interface.
- */
- public static final short CSS_PRIMITIVE_VALUE = 1;
- /**
- * The value is a <code>CSSValue</code> list and an instance of the
- * <code>CSSValueList</code> interface can be obtained by using
- * binding-specific casting methods on this instance of the
- * <code>CSSValue</code> interface.
- */
- public static final short CSS_VALUE_LIST = 2;
- /**
- * The value is a custom value.
- */
- public static final short CSS_CUSTOM = 3;
-
- /**
- * A string representation of the current value.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error (according to the attached property) or is unparsable.
- * <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string
- * value represents a different type of values than the values allowed
- * by the CSS property.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this value is readonly.
- */
- public String getCssText();
- /**
- * A string representation of the current value.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified CSS string value has a syntax
- * error (according to the attached property) or is unparsable.
- * <br>INVALID_MODIFICATION_ERR: Raised if the specified CSS string
- * value represents a different type of values than the values allowed
- * by the CSS property.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this value is readonly.
- */
- public void setCssText(String cssText)
- throws DOMException;
-
- /**
- * A code defining the type of the value as defined above.
- */
- public short getCssValueType();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/CSSValueList.java b/external/jaxp/source/org/w3c/dom/css/CSSValueList.java
deleted file mode 100755
index bf15bb3eb..000000000
--- a/external/jaxp/source/org/w3c/dom/css/CSSValueList.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>CSSValueList</code> interface provides the abstraction of an
- * ordered collection of CSS values.
- * <p> Some properties allow an empty list into their syntax. In that case,
- * these properties take the <code>none</code> identifier. So, an empty list
- * means that the property has the value <code>none</code>.
- * <p> The items in the <code>CSSValueList</code> are accessible via an
- * integral index, starting from 0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface CSSValueList extends CSSValue {
- /**
- * The number of <code>CSSValues</code> in the list. The range of valid
- * values of the indices is <code>0</code> to <code>length-1</code>
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve a <code>CSSValue</code> by ordinal index. The order in
- * this collection represents the order of the values in the CSS style
- * property. If index is greater than or equal to the number of values
- * in the list, this returns <code>null</code>.
- * @param index Index into the collection.
- * @return The <code>CSSValue</code> at the <code>index</code> position
- * in the <code>CSSValueList</code>, or <code>null</code> if that is
- * not a valid index.
- */
- public CSSValue item(int index);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/Counter.java b/external/jaxp/source/org/w3c/dom/css/Counter.java
deleted file mode 100755
index 8cd4967b3..000000000
--- a/external/jaxp/source/org/w3c/dom/css/Counter.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>Counter</code> interface is used to represent any counter or
- * counters function value. This interface reflects the values in the
- * underlying style property.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface Counter {
- /**
- * This attribute is used for the identifier of the counter.
- */
- public String getIdentifier();
-
- /**
- * This attribute is used for the style of the list.
- */
- public String getListStyle();
-
- /**
- * This attribute is used for the separator of the nested counters.
- */
- public String getSeparator();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/DOMImplementationCSS.java b/external/jaxp/source/org/w3c/dom/css/DOMImplementationCSS.java
deleted file mode 100755
index 65c97291e..000000000
--- a/external/jaxp/source/org/w3c/dom/css/DOMImplementationCSS.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.DOMImplementation;
-import org.w3c.dom.DOMException;
-
-/**
- * This interface allows the DOM user to create a <code>CSSStyleSheet</code>
- * outside the context of a document. There is no way to associate the new
- * <code>CSSStyleSheet</code> with a document in DOM Level 2.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface DOMImplementationCSS extends DOMImplementation {
- /**
- * Creates a new <code>CSSStyleSheet</code>.
- * @param title The advisory title. See also the section.
- * @param media The comma-separated list of media associated with the
- * new style sheet. See also the section.
- * @return A new CSS style sheet.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified media string value has a syntax
- * error and is unparsable.
- */
- public CSSStyleSheet createCSSStyleSheet(String title,
- String media)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/DocumentCSS.java b/external/jaxp/source/org/w3c/dom/css/DocumentCSS.java
deleted file mode 100755
index 8fe93c79a..000000000
--- a/external/jaxp/source/org/w3c/dom/css/DocumentCSS.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.stylesheets.DocumentStyle;
-
-/**
- * This interface represents a document with a CSS view.
- * <p> The <code>getOverrideStyle</code> method provides a mechanism through
- * which a DOM author could effect immediate change to the style of an
- * element without modifying the explicitly linked style sheets of a
- * document or the inline style of elements in the style sheets. This style
- * sheet comes after the author style sheet in the cascade algorithm and is
- * called override style sheet. The override style sheet takes precedence
- * over author style sheets. An "!important" declaration still takes
- * precedence over a normal declaration. Override, author, and user style
- * sheets all may contain "!important" declarations. User "!important" rules
- * take precedence over both override and author "!important" rules, and
- * override "!important" rules take precedence over author "!important"
- * rules.
- * <p> The expectation is that an instance of the <code>DocumentCSS</code>
- * interface can be obtained by using binding-specific casting methods on an
- * instance of the <code>Document</code> interface.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface DocumentCSS extends DocumentStyle {
- /**
- * This method is used to retrieve the override style declaration for a
- * specified element and a specified pseudo-element.
- * @param elt The element whose style is to be modified. This parameter
- * cannot be null.
- * @param pseudoElt The pseudo-element or <code>null</code> if none.
- * @return The override style declaration.
- */
- public CSSStyleDeclaration getOverrideStyle(Element elt,
- String pseudoElt);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/ElementCSSInlineStyle.java b/external/jaxp/source/org/w3c/dom/css/ElementCSSInlineStyle.java
deleted file mode 100755
index 98b60bf9d..000000000
--- a/external/jaxp/source/org/w3c/dom/css/ElementCSSInlineStyle.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * Inline style information attached to elements is exposed through the
- * <code>style</code> attribute. This represents the contents of the STYLE
- * attribute for HTML elements (or elements in other schemas or DTDs which
- * use the STYLE attribute in the same way). The expectation is that an
- * instance of the ElementCSSInlineStyle interface can be obtained by using
- * binding-specific casting methods on an instance of the Element interface
- * when the element supports inline CSS style informations.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface ElementCSSInlineStyle {
- /**
- * The style attribute.
- */
- public CSSStyleDeclaration getStyle();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/RGBColor.java b/external/jaxp/source/org/w3c/dom/css/RGBColor.java
deleted file mode 100755
index cd5daa567..000000000
--- a/external/jaxp/source/org/w3c/dom/css/RGBColor.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>RGBColor</code> interface is used to represent any RGB color
- * value. This interface reflects the values in the underlying style
- * property. Hence, modifications made to the <code>CSSPrimitiveValue</code>
- * objects modify the style property.
- * <p> A specified RGB color is not clipped (even if the number is outside the
- * range 0-255 or 0%-100%). A computed RGB color is clipped depending on the
- * device.
- * <p> Even if a style sheet can only contain an integer for a color value,
- * the internal storage of this integer is a float, and this can be used as
- * a float in the specified or the computed style.
- * <p> A color percentage value can always be converted to a number and vice
- * versa.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface RGBColor {
- /**
- * This attribute is used for the red value of the RGB color.
- */
- public CSSPrimitiveValue getRed();
-
- /**
- * This attribute is used for the green value of the RGB color.
- */
- public CSSPrimitiveValue getGreen();
-
- /**
- * This attribute is used for the blue value of the RGB color.
- */
- public CSSPrimitiveValue getBlue();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/Rect.java b/external/jaxp/source/org/w3c/dom/css/Rect.java
deleted file mode 100755
index f5efb1084..000000000
--- a/external/jaxp/source/org/w3c/dom/css/Rect.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-/**
- * The <code>Rect</code> interface is used to represent any rect value. This
- * interface reflects the values in the underlying style property. Hence,
- * modifications made to the <code>CSSPrimitiveValue</code> objects modify
- * the style property.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface Rect {
- /**
- * This attribute is used for the top of the rect.
- */
- public CSSPrimitiveValue getTop();
-
- /**
- * This attribute is used for the right of the rect.
- */
- public CSSPrimitiveValue getRight();
-
- /**
- * This attribute is used for the bottom of the rect.
- */
- public CSSPrimitiveValue getBottom();
-
- /**
- * This attribute is used for the left of the rect.
- */
- public CSSPrimitiveValue getLeft();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/ViewCSS.java b/external/jaxp/source/org/w3c/dom/css/ViewCSS.java
deleted file mode 100755
index 0f7e88ff9..000000000
--- a/external/jaxp/source/org/w3c/dom/css/ViewCSS.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.css;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.views.AbstractView;
-
-/**
- * This interface represents a CSS view. The <code>getComputedStyle</code>
- * method provides a read only access to the computed values of an element.
- * <p> The expectation is that an instance of the <code>ViewCSS</code>
- * interface can be obtained by using binding-specific casting methods on an
- * instance of the <code>AbstractView</code> interface.
- * <p> Since a computed style is related to an <code>Element</code> node, if
- * this element is removed from the document, the associated
- * <code>CSSStyleDeclaration</code> and <code>CSSValue</code> related to
- * this declaration are no longer valid.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface ViewCSS extends AbstractView {
- /**
- * This method is used to get the computed style as it is defined in .
- * @param elt The element whose style is to be computed. This parameter
- * cannot be null.
- * @param pseudoElt The pseudo-element or <code>null</code> if none.
- * @return The computed style. The <code>CSSStyleDeclaration</code> is
- * read-only and contains only absolute values.
- */
- public CSSStyleDeclaration getComputedStyle(Element elt,
- String pseudoElt);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/css/package.html b/external/jaxp/source/org/w3c/dom/css/package.html
deleted file mode 100755
index 7f4d5a7ea..000000000
--- a/external/jaxp/source/org/w3c/dom/css/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports the optional "CSS" and "CSS2"
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/"
->stylesheet</a>
-features of the
-DOM Level 2 Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/events/DocumentEvent.java b/external/jaxp/source/org/w3c/dom/events/DocumentEvent.java
deleted file mode 100755
index 76644bc5a..000000000
--- a/external/jaxp/source/org/w3c/dom/events/DocumentEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>DocumentEvent</code> interface provides a mechanism by which the
- * user can create an Event of a type supported by the implementation. It is
- * expected that the <code>DocumentEvent</code> interface will be
- * implemented on the same object which implements the <code>Document</code>
- * interface in an implementation which supports the Event model.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface DocumentEvent {
- /**
- *
- * @param eventType The <code>eventType</code> parameter specifies the
- * type of <code>Event</code> interface to be created. If the
- * <code>Event</code> interface specified is supported by the
- * implementation this method will return a new <code>Event</code> of
- * the interface type requested. If the <code>Event</code> is to be
- * dispatched via the <code>dispatchEvent</code> method the
- * appropriate event init method must be called after creation in
- * order to initialize the <code>Event</code>'s values. As an example,
- * a user wishing to synthesize some kind of <code>UIEvent</code>
- * would call <code>createEvent</code> with the parameter "UIEvents".
- * The <code>initUIEvent</code> method could then be called on the
- * newly created <code>UIEvent</code> to set the specific type of
- * UIEvent to be dispatched and set its context information.The
- * <code>createEvent</code> method is used in creating
- * <code>Event</code>s when it is either inconvenient or unnecessary
- * for the user to create an <code>Event</code> themselves. In cases
- * where the implementation provided <code>Event</code> is
- * insufficient, users may supply their own <code>Event</code>
- * implementations for use with the <code>dispatchEvent</code> method.
- * @return The newly created <code>Event</code>
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the implementation does not support the
- * type of <code>Event</code> interface requested
- */
- public Event createEvent(String eventType)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/Event.java b/external/jaxp/source/org/w3c/dom/events/Event.java
deleted file mode 100755
index 14a9239ed..000000000
--- a/external/jaxp/source/org/w3c/dom/events/Event.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * The <code>Event</code> interface is used to provide contextual information
- * about an event to the handler processing the event. An object which
- * implements the <code>Event</code> interface is generally passed as the
- * first parameter to an event handler. More specific context information is
- * passed to event handlers by deriving additional interfaces from
- * <code>Event</code> which contain information directly relating to the
- * type of event they accompany. These derived interfaces are also
- * implemented by the object passed to the event listener.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface Event {
- // PhaseType
- /**
- * The current event phase is the capturing phase.
- */
- public static final short CAPTURING_PHASE = 1;
- /**
- * The event is currently being evaluated at the target
- * <code>EventTarget</code>.
- */
- public static final short AT_TARGET = 2;
- /**
- * The current event phase is the bubbling phase.
- */
- public static final short BUBBLING_PHASE = 3;
-
- /**
- * The name of the event (case-insensitive). The name must be an XML name.
- */
- public String getType();
-
- /**
- * Used to indicate the <code>EventTarget</code> to which the event was
- * originally dispatched.
- */
- public EventTarget getTarget();
-
- /**
- * Used to indicate the <code>EventTarget</code> whose
- * <code>EventListeners</code> are currently being processed. This is
- * particularly useful during capturing and bubbling.
- */
- public EventTarget getCurrentTarget();
-
- /**
- * Used to indicate which phase of event flow is currently being
- * evaluated.
- */
- public short getEventPhase();
-
- /**
- * Used to indicate whether or not an event is a bubbling event. If the
- * event can bubble the value is true, else the value is false.
- */
- public boolean getBubbles();
-
- /**
- * Used to indicate whether or not an event can have its default action
- * prevented. If the default action can be prevented the value is true,
- * else the value is false.
- */
- public boolean getCancelable();
-
- /**
- * Used to specify the time (in milliseconds relative to the epoch) at
- * which the event was created. Due to the fact that some systems may
- * not provide this information the value of <code>timeStamp</code> may
- * be not available for all events. When not available, a value of 0
- * will be returned. Examples of epoch time are the time of the system
- * start or 0:0:0 UTC 1st January 1970.
- */
- public long getTimeStamp();
-
- /**
- * The <code>stopPropagation</code> method is used prevent further
- * propagation of an event during event flow. If this method is called
- * by any <code>EventListener</code> the event will cease propagating
- * through the tree. The event will complete dispatch to all listeners
- * on the current <code>EventTarget</code> before event flow stops. This
- * method may be used during any stage of event flow.
- */
- public void stopPropagation();
-
- /**
- * If an event is cancelable, the <code>preventDefault</code> method is
- * used to signify that the event is to be canceled, meaning any default
- * action normally taken by the implementation as a result of the event
- * will not occur. If, during any stage of event flow, the
- * <code>preventDefault</code> method is called the event is canceled.
- * Any default action associated with the event will not occur. Calling
- * this method for a non-cancelable event has no effect. Once
- * <code>preventDefault</code> has been called it will remain in effect
- * throughout the remainder of the event's propagation. This method may
- * be used during any stage of event flow.
- */
- public void preventDefault();
-
- /**
- * The <code>initEvent</code> method is used to initialize the value of an
- * <code>Event</code> created through the <code>DocumentEvent</code>
- * interface. This method may only be called before the
- * <code>Event</code> has been dispatched via the
- * <code>dispatchEvent</code> method, though it may be called multiple
- * times during that phase if necessary. If called multiple times the
- * final invocation takes precedence. If called from a subclass of
- * <code>Event</code> interface only the values specified in the
- * <code>initEvent</code> method are modified, all other attributes are
- * left unchanged.
- * @param eventTypeArg Specifies the event type. This type may be any
- * event type currently defined in this specification or a new event
- * type.. The string must be an XML name. Any new event type must not
- * begin with any upper, lower, or mixed case version of the string
- * "DOM". This prefix is reserved for future DOM event sets. It is
- * also strongly recommended that third parties adding their own
- * events use their own prefix to avoid confusion and lessen the
- * probability of conflicts with other new events.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- */
- public void initEvent(String eventTypeArg,
- boolean canBubbleArg,
- boolean cancelableArg);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/EventException.java b/external/jaxp/source/org/w3c/dom/events/EventException.java
deleted file mode 100755
index 7a6ff2620..000000000
--- a/external/jaxp/source/org/w3c/dom/events/EventException.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * Event operations may throw an <code>EventException</code> as specified in
- * their method descriptions.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public class EventException extends RuntimeException {
- public EventException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // EventExceptionCode
- /**
- * If the <code>Event</code>'s type was not specified by initializing the
- * event before the method was called. Specification of the Event's type
- * as <code>null</code> or an empty string will also trigger this
- * exception.
- */
- public static final short UNSPECIFIED_EVENT_TYPE_ERR = 0;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/EventListener.java b/external/jaxp/source/org/w3c/dom/events/EventListener.java
deleted file mode 100755
index 1df80202c..000000000
--- a/external/jaxp/source/org/w3c/dom/events/EventListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * The <code>EventListener</code> interface is the primary method for
- * handling events. Users implement the <code>EventListener</code> interface
- * and register their listener on an <code>EventTarget</code> using the
- * <code>AddEventListener</code> method. The users should also remove their
- * <code>EventListener</code> from its <code>EventTarget</code> after they
- * have completed using the listener.
- * <p> When a <code>Node</code> is copied using the <code>cloneNode</code>
- * method the <code>EventListener</code>s attached to the source
- * <code>Node</code> are not attached to the copied <code>Node</code>. If
- * the user wishes the same <code>EventListener</code>s to be added to the
- * newly created copy the user must add them manually.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface EventListener {
- /**
- * This method is called whenever an event occurs of the type for which
- * the <code> EventListener</code> interface was registered.
- * @param evt The <code>Event</code> contains contextual information
- * about the event. It also contains the <code>stopPropagation</code>
- * and <code>preventDefault</code> methods which are used in
- * determining the event's flow and default action.
- */
- public void handleEvent(Event evt);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/EventTarget.java b/external/jaxp/source/org/w3c/dom/events/EventTarget.java
deleted file mode 100755
index f07663660..000000000
--- a/external/jaxp/source/org/w3c/dom/events/EventTarget.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-/**
- * The <code>EventTarget</code> interface is implemented by all
- * <code>Nodes</code> in an implementation which supports the DOM Event
- * Model. Therefore, this interface can be obtained by using
- * binding-specific casting methods on an instance of the <code>Node</code>
- * interface. The interface allows registration and removal of
- * <code>EventListeners</code> on an <code>EventTarget</code> and dispatch
- * of events to that <code>EventTarget</code>.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface EventTarget {
- /**
- * This method allows the registration of event listeners on the event
- * target. If an <code>EventListener</code> is added to an
- * <code>EventTarget</code> while it is processing an event, it will not
- * be triggered by the current actions but may be triggered during a
- * later stage of event flow, such as the bubbling phase.
- * <br> If multiple identical <code>EventListener</code>s are registered
- * on the same <code>EventTarget</code> with the same parameters the
- * duplicate instances are discarded. They do not cause the
- * <code>EventListener</code> to be called twice and since they are
- * discarded they do not need to be removed with the
- * <code>removeEventListener</code> method.
- * @param type The event type for which the user is registering
- * @param listener The <code>listener</code> parameter takes an interface
- * implemented by the user which contains the methods to be called
- * when the event occurs.
- * @param useCapture If true, <code>useCapture</code> indicates that the
- * user wishes to initiate capture. After initiating capture, all
- * events of the specified type will be dispatched to the registered
- * <code>EventListener</code> before being dispatched to any
- * <code>EventTargets</code> beneath them in the tree. Events which
- * are bubbling upward through the tree will not trigger an
- * <code>EventListener</code> designated to use capture.
- */
- public void addEventListener(String type,
- EventListener listener,
- boolean useCapture);
-
- /**
- * This method allows the removal of event listeners from the event
- * target. If an <code>EventListener</code> is removed from an
- * <code>EventTarget</code> while it is processing an event, it will not
- * be triggered by the current actions. <code>EventListener</code>s can
- * never be invoked after being removed.
- * <br>Calling <code>removeEventListener</code> with arguments which do
- * not identify any currently registered <code>EventListener</code> on
- * the <code>EventTarget</code> has no effect.
- * @param type Specifies the event type of the <code>EventListener</code>
- * being removed.
- * @param listener The <code>EventListener</code> parameter indicates the
- * <code>EventListener </code> to be removed.
- * @param useCapture Specifies whether the <code>EventListener</code>
- * being removed was registered as a capturing listener or not. If a
- * listener was registered twice, one with capture and one without,
- * each must be removed separately. Removal of a capturing listener
- * does not affect a non-capturing version of the same listener, and
- * vice versa.
- */
- public void removeEventListener(String type,
- EventListener listener,
- boolean useCapture);
-
- /**
- * This method allows the dispatch of events into the implementations
- * event model. Events dispatched in this manner will have the same
- * capturing and bubbling behavior as events dispatched directly by the
- * implementation. The target of the event is the
- * <code> EventTarget</code> on which <code>dispatchEvent</code> is
- * called.
- * @param evt Specifies the event type, behavior, and contextual
- * information to be used in processing the event.
- * @return The return value of <code>dispatchEvent</code> indicates
- * whether any of the listeners which handled the event called
- * <code>preventDefault</code>. If <code>preventDefault</code> was
- * called the value is false, else the value is true.
- * @exception EventException
- * UNSPECIFIED_EVENT_TYPE_ERR: Raised if the <code>Event</code>'s type
- * was not specified by initializing the event before
- * <code>dispatchEvent</code> was called. Specification of the
- * <code>Event</code>'s type as <code>null</code> or an empty string
- * will also trigger this exception.
- */
- public boolean dispatchEvent(Event evt)
- throws EventException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/MouseEvent.java b/external/jaxp/source/org/w3c/dom/events/MouseEvent.java
deleted file mode 100755
index be780357a..000000000
--- a/external/jaxp/source/org/w3c/dom/events/MouseEvent.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.views.AbstractView;
-
-/**
- * The <code>MouseEvent</code> interface provides specific contextual
- * information associated with Mouse events.
- * <p>The <code>detail</code> attribute inherited from <code>UIEvent</code>
- * indicates the number of times a mouse button has been pressed and
- * released over the same screen location during a user action. The
- * attribute value is 1 when the user begins this action and increments by 1
- * for each full sequence of pressing and releasing. If the user moves the
- * mouse between the mousedown and mouseup the value will be set to 0,
- * indicating that no click is occurring.
- * <p>In the case of nested elements mouse events are always targeted at the
- * most deeply nested element. Ancestors of the targeted element may use
- * bubbling to obtain notification of mouse events which occur within its
- * descendent elements.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface MouseEvent extends UIEvent {
- /**
- * The horizontal coordinate at which the event occurred relative to the
- * origin of the screen coordinate system.
- */
- public int getScreenX();
-
- /**
- * The vertical coordinate at which the event occurred relative to the
- * origin of the screen coordinate system.
- */
- public int getScreenY();
-
- /**
- * The horizontal coordinate at which the event occurred relative to the
- * DOM implementation's client area.
- */
- public int getClientX();
-
- /**
- * The vertical coordinate at which the event occurred relative to the DOM
- * implementation's client area.
- */
- public int getClientY();
-
- /**
- * Used to indicate whether the 'ctrl' key was depressed during the firing
- * of the event.
- */
- public boolean getCtrlKey();
-
- /**
- * Used to indicate whether the 'shift' key was depressed during the
- * firing of the event.
- */
- public boolean getShiftKey();
-
- /**
- * Used to indicate whether the 'alt' key was depressed during the firing
- * of the event. On some platforms this key may map to an alternative
- * key name.
- */
- public boolean getAltKey();
-
- /**
- * Used to indicate whether the 'meta' key was depressed during the firing
- * of the event. On some platforms this key may map to an alternative
- * key name.
- */
- public boolean getMetaKey();
-
- /**
- * During mouse events caused by the depression or release of a mouse
- * button, <code>button</code> is used to indicate which mouse button
- * changed state. The values for <code>button</code> range from zero to
- * indicate the left button of the mouse, one to indicate the middle
- * button if present, and two to indicate the right button. For mice
- * configured for left handed use in which the button actions are
- * reversed the values are instead read from right to left.
- */
- public short getButton();
-
- /**
- * Used to identify a secondary <code>EventTarget</code> related to a UI
- * event. Currently this attribute is used with the mouseover event to
- * indicate the <code>EventTarget</code> which the pointing device
- * exited and with the mouseout event to indicate the
- * <code>EventTarget</code> which the pointing device entered.
- */
- public EventTarget getRelatedTarget();
-
- /**
- * The <code>initMouseEvent</code> method is used to initialize the value
- * of a <code>MouseEvent</code> created through the
- * <code>DocumentEvent</code> interface. This method may only be called
- * before the <code>MouseEvent</code> has been dispatched via the
- * <code>dispatchEvent</code> method, though it may be called multiple
- * times during that phase if necessary. If called multiple times, the
- * final invocation takes precedence.
- * @param typeArg Specifies the event type.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- * @param viewArg Specifies the <code>Event</code>'s
- * <code>AbstractView</code>.
- * @param detailArg Specifies the <code>Event</code>'s mouse click count.
- * @param screenXArg Specifies the <code>Event</code>'s screen x
- * coordinate
- * @param screenYArg Specifies the <code>Event</code>'s screen y
- * coordinate
- * @param clientXArg Specifies the <code>Event</code>'s client x
- * coordinate
- * @param clientYArg Specifies the <code>Event</code>'s client y
- * coordinate
- * @param ctrlKeyArg Specifies whether or not control key was depressed
- * during the <code>Event</code>.
- * @param altKeyArg Specifies whether or not alt key was depressed during
- * the <code>Event</code>.
- * @param shiftKeyArg Specifies whether or not shift key was depressed
- * during the <code>Event</code>.
- * @param metaKeyArg Specifies whether or not meta key was depressed
- * during the <code>Event</code>.
- * @param buttonArg Specifies the <code>Event</code>'s mouse button.
- * @param relatedTargetArg Specifies the <code>Event</code>'s related
- * <code>EventTarget</code>.
- */
- public void initMouseEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg,
- int screenXArg,
- int screenYArg,
- int clientXArg,
- int clientYArg,
- boolean ctrlKeyArg,
- boolean altKeyArg,
- boolean shiftKeyArg,
- boolean metaKeyArg,
- short buttonArg,
- EventTarget relatedTargetArg);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/MutationEvent.java b/external/jaxp/source/org/w3c/dom/events/MutationEvent.java
deleted file mode 100755
index 351f77b3b..000000000
--- a/external/jaxp/source/org/w3c/dom/events/MutationEvent.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.Node;
-
-/**
- * The <code>MutationEvent</code> interface provides specific contextual
- * information associated with Mutation events.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface MutationEvent extends Event {
- // attrChangeType
- /**
- * The <code>Attr</code> was modified in place.
- */
- public static final short MODIFICATION = 1;
- /**
- * The <code>Attr</code> was just added.
- */
- public static final short ADDITION = 2;
- /**
- * The <code>Attr</code> was just removed.
- */
- public static final short REMOVAL = 3;
-
- /**
- * <code>relatedNode</code> is used to identify a secondary node related
- * to a mutation event. For example, if a mutation event is dispatched
- * to a node indicating that its parent has changed, the
- * <code>relatedNode</code> is the changed parent. If an event is
- * instead dispatched to a subtree indicating a node was changed within
- * it, the <code>relatedNode</code> is the changed node. In the case of
- * the DOMAttrModified event it indicates the <code>Attr</code> node
- * which was modified, added, or removed.
- */
- public Node getRelatedNode();
-
- /**
- * <code>prevValue</code> indicates the previous value of the
- * <code>Attr</code> node in DOMAttrModified events, and of the
- * <code>CharacterData</code> node in DOMCharDataModified events.
- */
- public String getPrevValue();
-
- /**
- * <code>newValue</code> indicates the new value of the <code>Attr</code>
- * node in DOMAttrModified events, and of the <code>CharacterData</code>
- * node in DOMCharDataModified events.
- */
- public String getNewValue();
-
- /**
- * <code>attrName</code> indicates the name of the changed
- * <code>Attr</code> node in a DOMAttrModified event.
- */
- public String getAttrName();
-
- /**
- * <code>attrChange</code> indicates the type of change which triggered
- * the DOMAttrModified event. The values can be <code>MODIFICATION</code>
- * , <code>ADDITION</code>, or <code>REMOVAL</code>.
- */
- public short getAttrChange();
-
- /**
- * The <code>initMutationEvent</code> method is used to initialize the
- * value of a <code>MutationEvent</code> created through the
- * <code>DocumentEvent</code> interface. This method may only be called
- * before the <code>MutationEvent</code> has been dispatched via the
- * <code>dispatchEvent</code> method, though it may be called multiple
- * times during that phase if necessary. If called multiple times, the
- * final invocation takes precedence.
- * @param typeArg Specifies the event type.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- * @param relatedNodeArg Specifies the <code>Event</code>'s related Node.
- * @param prevValueArg Specifies the <code>Event</code>'s
- * <code>prevValue</code> attribute. This value may be null.
- * @param newValueArg Specifies the <code>Event</code>'s
- * <code>newValue</code> attribute. This value may be null.
- * @param attrNameArg Specifies the <code>Event</code>'s
- * <code>attrName</code> attribute. This value may be null.
- * @param attrChangeArg Specifies the <code>Event</code>'s
- * <code>attrChange</code> attribute
- */
- public void initMutationEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- Node relatedNodeArg,
- String prevValueArg,
- String newValueArg,
- String attrNameArg,
- short attrChangeArg);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/UIEvent.java b/external/jaxp/source/org/w3c/dom/events/UIEvent.java
deleted file mode 100755
index 15affe879..000000000
--- a/external/jaxp/source/org/w3c/dom/events/UIEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.events;
-
-import org.w3c.dom.views.AbstractView;
-
-/**
- * The <code>UIEvent</code> interface provides specific contextual information
- * associated with User Interface events.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113'>Document Object Model (DOM) Level 2 Events Specification</a>.
- * @since DOM Level 2
- */
-public interface UIEvent extends Event {
- /**
- * The <code>view</code> attribute identifies the <code>AbstractView</code>
- * from which the event was generated.
- */
- public AbstractView getView();
-
- /**
- * Specifies some detail information about the <code>Event</code>,
- * depending on the type of event.
- */
- public int getDetail();
-
- /**
- * The <code>initUIEvent</code> method is used to initialize the value of
- * a <code>UIEvent</code> created through the <code>DocumentEvent</code>
- * interface. This method may only be called before the
- * <code>UIEvent</code> has been dispatched via the
- * <code>dispatchEvent</code> method, though it may be called multiple
- * times during that phase if necessary. If called multiple times, the
- * final invocation takes precedence.
- * @param typeArg Specifies the event type.
- * @param canBubbleArg Specifies whether or not the event can bubble.
- * @param cancelableArg Specifies whether or not the event's default
- * action can be prevented.
- * @param viewArg Specifies the <code>Event</code>'s
- * <code>AbstractView</code>.
- * @param detailArg Specifies the <code>Event</code>'s detail.
- */
- public void initUIEvent(String typeArg,
- boolean canBubbleArg,
- boolean cancelableArg,
- AbstractView viewArg,
- int detailArg);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/events/package.html b/external/jaxp/source/org/w3c/dom/events/package.html
deleted file mode 100755
index 7131ce96e..000000000
--- a/external/jaxp/source/org/w3c/dom/events/package.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports the optional
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/"
->"Events"</a>, "UIEvents", "MouseEvents",
-"MutationEvents", and "HTMLEvents" features of the
-DOM Level 2 Recommendation. </p>
-
-<p> Note that apart from the basic "Events" infrastructure and
-the "MutationEvents", all other events currently defined in the
-DOM specification imply having some user interface that issues
-various events to the DOM. Also, to fully
-support the "UIEvents" and its child event set "MouseEvents",
-the DOM implementation must also support the "Views" feature. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLAnchorElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLAnchorElement.java
deleted file mode 100755
index b086cb7f1..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLAnchorElement.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * The anchor element. See the A element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLAnchorElement extends HTMLElement {
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * The character encoding of the linked resource. See the charset
- * attribute definition in HTML 4.0.
- */
- public String getCharset();
- public void setCharset(String charset);
-
- /**
- * Comma-separated list of lengths, defining an active region geometry.
- * See also <code>shape</code> for the shape of the region. See the
- * coords attribute definition in HTML 4.0.
- */
- public String getCoords();
- public void setCoords(String coords);
-
- /**
- * The URI of the linked resource. See the href attribute definition in
- * HTML 4.0.
- */
- public String getHref();
- public void setHref(String href);
-
- /**
- * Language code of the linked resource. See the hreflang attribute
- * definition in HTML 4.0.
- */
- public String getHreflang();
- public void setHreflang(String hreflang);
-
- /**
- * Anchor name. See the name attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Forward link type. See the rel attribute definition in HTML 4.0.
- */
- public String getRel();
- public void setRel(String rel);
-
- /**
- * Reverse link type. See the rev attribute definition in HTML 4.0.
- */
- public String getRev();
- public void setRev(String rev);
-
- /**
- * The shape of the active area. The coordinates are given by
- * <code>coords</code> . See the shape attribute definition in HTML 4.0.
- */
- public String getShape();
- public void setShape(String shape);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * Frame to render the resource in. See the target attribute definition
- * in HTML 4.0.
- */
- public String getTarget();
- public void setTarget(String target);
-
- /**
- * Advisory content type. See the type attribute definition in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLAppletElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLAppletElement.java
deleted file mode 100755
index 2e32bd6b9..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLAppletElement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * An embedded Java applet. See the APPLET element definition in HTML 4.0.
- * This element is deprecated in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLAppletElement extends HTMLElement {
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Alternate text for user agents not rendering the normal content of
- * this element. See the alt attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getAlt();
- public void setAlt(String alt);
-
- /**
- * Comma-separated archive list. See the archive attribute definition in
- * HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getArchive();
- public void setArchive(String archive);
-
- /**
- * Applet class file. See the code attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getCode();
- public void setCode(String code);
-
- /**
- * Optional base URI for applet. See the codebase attribute definition
- * in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getCodeBase();
- public void setCodeBase(String codeBase);
-
- /**
- * Override height. See the height attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getHeight();
- public void setHeight(String height);
-
- /**
- * Horizontal space to the left and right of this image, applet, or
- * object. See the hspace attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getHspace();
- public void setHspace(String hspace);
-
- /**
- * The name of the applet. See the name attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Serialized applet file. See the object attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getObject();
- public void setObject(String object);
-
- /**
- * Vertical space above and below this image, applet, or object. See the
- * vspace attribute definition in HTML 4.0. This attribute is deprecated
- * in HTML 4.0.
- */
- public String getVspace();
- public void setVspace(String vspace);
-
- /**
- * Override width. See the width attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLAreaElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLAreaElement.java
deleted file mode 100755
index bbb244825..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLAreaElement.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Client-side image map area definition. See the AREA element definition in
- * HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLAreaElement extends HTMLElement {
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * Alternate text for user agents not rendering the normal content of
- * this element. See the alt attribute definition in HTML 4.0.
- */
- public String getAlt();
- public void setAlt(String alt);
-
- /**
- * Comma-separated list of lengths, defining an active region geometry.
- * See also <code>shape</code> for the shape of the region. See the
- * coords attribute definition in HTML 4.0.
- */
- public String getCoords();
- public void setCoords(String coords);
-
- /**
- * The URI of the linked resource. See the href attribute definition in
- * HTML 4.0.
- */
- public String getHref();
- public void setHref(String href);
-
- /**
- * Specifies that this area is inactive, i.e., has no associated action.
- * See the nohref attribute definition in HTML 4.0.
- */
- public boolean getNoHref();
- public void setNoHref(boolean noHref);
-
- /**
- * The shape of the active area. The coordinates are given by
- * <code>coords</code> . See the shape attribute definition in HTML 4.0.
- */
- public String getShape();
- public void setShape(String shape);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * Frame to render the resource in. See the target attribute definition
- * in HTML 4.0.
- */
- public String getTarget();
- public void setTarget(String target);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLBRElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLBRElement.java
deleted file mode 100755
index 12eba4e69..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLBRElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Force a line break. See the BR element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLBRElement extends HTMLElement {
- /**
- * Control flow of text around floats. See the clear attribute definition
- * in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getClear();
- public void setClear(String clear);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLBaseElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLBaseElement.java
deleted file mode 100755
index c976632e1..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLBaseElement.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Document base URI. See the BASE element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLBaseElement extends HTMLElement {
- /**
- * The base URI. See the href attribute definition in HTML 4.0.
- */
- public String getHref();
- public void setHref(String href);
-
- /**
- * The default target frame. See the target attribute definition in HTML
- * 4.0.
- */
- public String getTarget();
- public void setTarget(String target);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLBaseFontElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLBaseFontElement.java
deleted file mode 100755
index ba6a9f989..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLBaseFontElement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Base font. See the BASEFONT element definition in HTML 4.0. This element
- * is deprecated in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLBaseFontElement extends HTMLElement {
- /**
- * Font color. See the color attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getColor();
- public void setColor(String color);
-
- /**
- * Font face identifier. See the face attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getFace();
- public void setFace(String face);
-
- /**
- * Font size. See the size attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getSize();
- public void setSize(String size);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLBodyElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLBodyElement.java
deleted file mode 100755
index fd780b5b2..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLBodyElement.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * The HTML document body. This element is always present in the DOM API,
- * even if the tags are not present in the source document. See the BODY
- * element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLBodyElement extends HTMLElement {
- /**
- * Color of active links (after mouse-button down, but before
- * mouse-button up). See the alink attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getALink();
- public void setALink(String aLink);
-
- /**
- * URI of the background texture tile image. See the background
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public String getBackground();
- public void setBackground(String background);
-
- /**
- * Document background color. See the bgcolor attribute definition in
- * HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getBgColor();
- public void setBgColor(String bgColor);
-
- /**
- * Color of links that are not active and unvisited. See the link
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public String getLink();
- public void setLink(String link);
-
- /**
- * Document text color. See the text attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getText();
- public void setText(String text);
-
- /**
- * Color of links that have been visited by the user. See the vlink
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public String getVLink();
- public void setVLink(String vLink);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLButtonElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLButtonElement.java
deleted file mode 100755
index 4696cfaa9..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLButtonElement.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Push button. See the BUTTON element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLButtonElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * The control is unavailable in this context. See the disabled
- * attribute definition in HTML 4.0.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * The type of button. See the type attribute definition in HTML 4.0.
- */
- public String getType();
-
- /**
- * The current form control value. See the value attribute definition in
- * HTML 4.0.
- */
- public String getValue();
- public void setValue(String value);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLCollection.java b/external/jaxp/source/org/w3c/dom/html/HTMLCollection.java
deleted file mode 100755
index 8fd54f68c..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLCollection.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.Node;
-
-/**
- * An <code>HTMLCollection</code> is a list of nodes. An individual node may
- * be accessed by either ordinal index or the node's<code>name</code> or
- * <code>id</code> attributes. Note: Collections in the HTML DOM are assumed
- * to be live meaning that they are automatically updated when the
- * underlying document is changed.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLCollection {
- /**
- * This attribute specifies the length or size of the list.
- */
- public int getLength();
-
- /**
- * This method retrieves a node specified by ordinal index. Nodes are
- * numbered in tree order (depth-first traversal order).
- * @param index The index of the node to be fetched. The index origin is
- * 0.
- * @return The <code>Node</code> at the corresponding position upon
- * success. A value of <code>null</code> is returned if the index is
- * out of range.
- */
- public Node item(int index);
-
- /**
- * This method retrieves a <code>Node</code> using a name. It first
- * searches for a <code>Node</code> with a matching <code>id</code>
- * attribute. If it doesn't find one, it then searches for a
- * <code>Node</code> with a matching <code>name</code> attribute, but
- * only on those elements that are allowed a name attribute.
- * @param name The name of the <code>Node</code> to be fetched.
- * @return The <code>Node</code> with a <code>name</code> or
- * <code>id</code> attribute whose value corresponds to the specified
- * string. Upon failure (e.g., no node with this name exists), returns
- * <code>null</code> .
- */
- public Node namedItem(String name);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLDListElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLDListElement.java
deleted file mode 100755
index 0d4bbeb29..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLDListElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Definition list. See the DL element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLDListElement extends HTMLElement {
- /**
- * Reduce spacing between list items. See the compact attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getCompact();
- public void setCompact(boolean compact);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLDOMImplementation.java b/external/jaxp/source/org/w3c/dom/html/HTMLDOMImplementation.java
deleted file mode 100755
index 98284078e..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLDOMImplementation.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.DOMImplementation;
-
-/**
- * The <code>HTMLDOMImplementation</code> interface extends the
- * <code>DOMImplementation</code> interface with a method for creating an
- * HTML document instance.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- * @since DOM Level 2
- */
-public interface HTMLDOMImplementation extends DOMImplementation {
- /**
- * Creates an <code>HTMLDocument</code> object with the minimal tree made
- * of the following elements: <code>HTML</code> , <code>HEAD</code> ,
- * <code>TITLE</code> , and <code>BODY</code> .
- * @param title The title of the document to be set as the content of the
- * <code>TITLE</code> element, through a child <code>Text</code> node.
- * @return A new <code>HTMLDocument</code> object.
- */
- public HTMLDocument createHTMLDocument(String title);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLDirectoryElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLDirectoryElement.java
deleted file mode 100755
index 7c9de1019..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLDirectoryElement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Directory list. See the DIR element definition in HTML 4.0. This element
- * is deprecated in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLDirectoryElement extends HTMLElement {
- /**
- * Reduce spacing between list items. See the compact attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getCompact();
- public void setCompact(boolean compact);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLDivElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLDivElement.java
deleted file mode 100755
index 239a3ad85..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLDivElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Generic block container. See the DIV element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLDivElement extends HTMLElement {
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLDocument.java b/external/jaxp/source/org/w3c/dom/html/HTMLDocument.java
deleted file mode 100755
index 23c3099d6..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLDocument.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-/**
- * An <code>HTMLDocument</code> is the root of the HTML hierarchy and holds
- * the entire content. Besides providing access to the hierarchy, it also
- * provides some convenience methods for accessing certain sets of
- * information from the document.
- * <p> The following properties have been deprecated in favor of the
- * corresponding ones for the <code>BODY</code> element: alinkColor background
- * bgColor fgColor linkColor vlinkColor In DOM Level 2, the method
- * <code>getElementById</code> is inherited from the <code>Document</code>
- * interface where it was moved.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLDocument extends Document {
- /**
- * The title of a document as specified by the <code>TITLE</code> element
- * in the head of the document.
- */
- public String getTitle();
- public void setTitle(String title);
-
- /**
- * Returns the URI of the page that linked to this page. The value is an
- * empty string if the user navigated to the page directly (not through a
- * link, but, for example, via a bookmark).
- */
- public String getReferrer();
-
- /**
- * The domain name of the server that served the document, or
- * <code>null</code> if the server cannot be identified by a domain name.
- */
- public String getDomain();
-
- /**
- * The complete URI of the document.
- */
- public String getURL();
-
- /**
- * The element that contains the content for the document. In documents
- * with <code>BODY</code> contents, returns the <code>BODY</code>
- * element. In frameset documents, this returns the outermost
- * <code>FRAMESET</code> element.
- */
- public HTMLElement getBody();
- public void setBody(HTMLElement body);
-
- /**
- * A collection of all the <code>IMG</code> elements in a document. The
- * behavior is limited to <code>IMG</code> elements for backwards
- * compatibility.
- */
- public HTMLCollection getImages();
-
- /**
- * A collection of all the <code>OBJECT</code> elements that include
- * applets and <code>APPLET</code> ( deprecated ) elements in a document.
- */
- public HTMLCollection getApplets();
-
- /**
- * A collection of all <code>AREA</code> elements and anchor (
- * <code>A</code> ) elements in a document with a value for the
- * <code>href</code> attribute.
- */
- public HTMLCollection getLinks();
-
- /**
- * A collection of all the forms of a document.
- */
- public HTMLCollection getForms();
-
- /**
- * A collection of all the anchor (<code>A</code> ) elements in a document
- * with a value for the <code>name</code> attribute. Note. For reasons
- * of backwards compatibility, the returned set of anchors only contains
- * those anchors created with the <code>name</code> attribute, not those
- * created with the <code>id</code> attribute.
- */
- public HTMLCollection getAnchors();
-
- /**
- * The cookies associated with this document. If there are none, the
- * value is an empty string. Otherwise, the value is a string: a
- * semicolon-delimited list of "name, value" pairs for all the cookies
- * associated with the page. For example,
- * <code>name=value;expires=date</code> .
- */
- public String getCookie();
- public void setCookie(String cookie);
-
- /**
- * Note. This method and the ones following allow a user to add to or
- * replace the structure model of a document using strings of unparsed
- * HTML. At the time of writing alternate methods for providing similar
- * functionality for both HTML and XML documents were being considered.
- * The following methods may be deprecated at some point in the future in
- * favor of a more general-purpose mechanism.
- * <br> Open a document stream for writing. If a document exists in the
- * target, this method clears it.
- */
- public void open();
-
- /**
- * Closes a document stream opened by <code>open()</code> and forces
- * rendering.
- */
- public void close();
-
- /**
- * Write a string of text to a document stream opened by
- * <code>open()</code> . The text is parsed into the document's structure
- * model.
- * @param text The string to be parsed into some structure in the
- * document structure model.
- */
- public void write(String text);
-
- /**
- * Write a string of text followed by a newline character to a document
- * stream opened by <code>open()</code> . The text is parsed into the
- * document's structure model.
- * @param text The string to be parsed into some structure in the
- * document structure model.
- */
- public void writeln(String text);
-
- /**
- * Returns the (possibly empty) collection of elements whose
- * <code>name</code> value is given by <code>elementName</code> .
- * @param elementName The <code>name</code> attribute value for an
- * element.
- * @return The matching elements.
- */
- public NodeList getElementsByName(String elementName);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLElement.java
deleted file mode 100755
index 73ac6d4cb..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLElement.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.Element;
-
-/**
- * All HTML element interfaces derive from this class. Elements that only
- * expose the HTML core attributes are represented by the base
- * <code>HTMLElement</code> interface. These elements are as follows: HEAD
- * special: SUB, SUP, SPAN, BDO font: TT, I, B, U, S, STRIKE, BIG, SMALL
- * phrase: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ACRONYM, ABBR list:
- * DD, DT NOFRAMES, NOSCRIPT ADDRESS, CENTER The <code>style</code> attribute
- * of an HTML element is accessible through the
- * <code>ElementCSSInlineStyle</code> interface which is defined in the .
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLElement extends Element {
- /**
- * The element's identifier. See the id attribute definition in HTML 4.0.
- */
- public String getId();
- public void setId(String id);
-
- /**
- * The element's advisory title. See the title attribute definition in
- * HTML 4.0.
- */
- public String getTitle();
- public void setTitle(String title);
-
- /**
- * Language code defined in RFC 1766. See the lang attribute definition
- * in HTML 4.0.
- */
- public String getLang();
- public void setLang(String lang);
-
- /**
- * Specifies the base direction of directionally neutral text and the
- * directionality of tables. See the dir attribute definition in HTML
- * 4.0.
- */
- public String getDir();
- public void setDir(String dir);
-
- /**
- * The class attribute of the element. This attribute has been renamed
- * due to conflicts with the "class" keyword exposed by many languages.
- * See the class attribute definition in HTML 4.0.
- */
- public String getClassName();
- public void setClassName(String className);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLFieldSetElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLFieldSetElement.java
deleted file mode 100755
index 0abea21db..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLFieldSetElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Organizes form controls into logical groups. See the FIELDSET element
- * definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLFieldSetElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLFontElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLFontElement.java
deleted file mode 100755
index 052020baf..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLFontElement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Local change to font. See the FONT element definition in HTML 4.0. This
- * element is deprecated in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLFontElement extends HTMLElement {
- /**
- * Font color. See the color attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getColor();
- public void setColor(String color);
-
- /**
- * Font face identifier. See the face attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getFace();
- public void setFace(String face);
-
- /**
- * Font size. See the size attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getSize();
- public void setSize(String size);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLFormElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLFormElement.java
deleted file mode 100755
index 2a74fb328..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLFormElement.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * The <code>FORM</code> element encompasses behavior similar to a collection
- * and an element. It provides direct access to the contained input elements
- * as well as the attributes of the form element. See the FORM element
- * definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLFormElement extends HTMLElement {
- /**
- * Returns a collection of all control elements in the form.
- */
- public HTMLCollection getElements();
-
- /**
- * The number of form controls in the form.
- */
- public int getLength();
-
- /**
- * Names the form.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * List of character sets supported by the server. See the
- * accept-charset attribute definition in HTML 4.0.
- */
- public String getAcceptCharset();
- public void setAcceptCharset(String acceptCharset);
-
- /**
- * Server-side form handler. See the action attribute definition in HTML
- * 4.0.
- */
- public String getAction();
- public void setAction(String action);
-
- /**
- * The content type of the submitted form, generally
- * "application/x-www-form-urlencoded". See the enctype attribute
- * definition in HTML 4.0.
- */
- public String getEnctype();
- public void setEnctype(String enctype);
-
- /**
- * HTTP method used to submit form. See the method attribute definition
- * in HTML 4.0.
- */
- public String getMethod();
- public void setMethod(String method);
-
- /**
- * Frame to render the resource in. See the target attribute definition
- * in HTML 4.0.
- */
- public String getTarget();
- public void setTarget(String target);
-
- /**
- * Submits the form. It performs the same action as a submit button.
- */
- public void submit();
-
- /**
- * Restores a form element's default values. It performs the same action
- * as a reset button.
- */
- public void reset();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLFrameElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLFrameElement.java
deleted file mode 100755
index 6efd70257..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLFrameElement.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.Document;
-
-/**
- * Create a frame. See the FRAME element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLFrameElement extends HTMLElement {
- /**
- * Request frame borders. See the frameborder attribute definition in
- * HTML 4.0.
- */
- public String getFrameBorder();
- public void setFrameBorder(String frameBorder);
-
- /**
- * URI designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.0.
- */
- public String getLongDesc();
- public void setLongDesc(String longDesc);
-
- /**
- * Frame margin height, in pixels. See the marginheight attribute
- * definition in HTML 4.0.
- */
- public String getMarginHeight();
- public void setMarginHeight(String marginHeight);
-
- /**
- * Frame margin width, in pixels. See the marginwidth attribute
- * definition in HTML 4.0.
- */
- public String getMarginWidth();
- public void setMarginWidth(String marginWidth);
-
- /**
- * The frame name (object of the <code>target</code> attribute). See the
- * name attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * When true, forbid user from resizing frame. See the noresize
- * attribute definition in HTML 4.0.
- */
- public boolean getNoResize();
- public void setNoResize(boolean noResize);
-
- /**
- * Specify whether or not the frame should have scrollbars. See the
- * scrolling attribute definition in HTML 4.0.
- */
- public String getScrolling();
- public void setScrolling(String scrolling);
-
- /**
- * A URI designating the initial frame contents. See the src attribute
- * definition in HTML 4.0.
- */
- public String getSrc();
- public void setSrc(String src);
-
- /**
- * The document this frame contains, if there is any and it is available,
- * or <code>null</code> otherwise.
- * @since DOM Level 2
- */
- public Document getContentDocument();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLFrameSetElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLFrameSetElement.java
deleted file mode 100755
index c13453b64..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLFrameSetElement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Create a grid of frames. See the FRAMESET element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLFrameSetElement extends HTMLElement {
- /**
- * The number of columns of frames in the frameset. See the cols
- * attribute definition in HTML 4.0.
- */
- public String getCols();
- public void setCols(String cols);
-
- /**
- * The number of rows of frames in the frameset. See the rows attribute
- * definition in HTML 4.0.
- */
- public String getRows();
- public void setRows(String rows);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLHRElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLHRElement.java
deleted file mode 100755
index 8a10aa660..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLHRElement.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Create a horizontal rule. See the HR element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLHRElement extends HTMLElement {
- /**
- * Align the rule on the page. See the align attribute definition in
- * HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Indicates to the user agent that there should be no shading in the
- * rendering of this element. See the noshade attribute definition in
- * HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getNoShade();
- public void setNoShade(boolean noShade);
-
- /**
- * The height of the rule. See the size attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getSize();
- public void setSize(String size);
-
- /**
- * The width of the rule. See the width attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLHeadElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLHeadElement.java
deleted file mode 100755
index 93abb7502..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLHeadElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Document head information. See the HEAD element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLHeadElement extends HTMLElement {
- /**
- * URI designating a metadata profile. See the profile attribute
- * definition in HTML 4.0.
- */
- public String getProfile();
- public void setProfile(String profile);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLHeadingElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLHeadingElement.java
deleted file mode 100755
index 8121d2c45..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLHeadingElement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * For the <code>H1</code> to <code>H6</code> elements. See the H1 element
- * definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLHeadingElement extends HTMLElement {
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLHtmlElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLHtmlElement.java
deleted file mode 100755
index ee8f16eab..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLHtmlElement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Root of an HTML document. See the HTML element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLHtmlElement extends HTMLElement {
- /**
- * Version information about the document's DTD. See the version
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public String getVersion();
- public void setVersion(String version);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLIFrameElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLIFrameElement.java
deleted file mode 100755
index d78f4a99c..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLIFrameElement.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.Document;
-
-/**
- * Inline subwindows. See the IFRAME element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLIFrameElement extends HTMLElement {
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Request frame borders. See the frameborder attribute definition in
- * HTML 4.0.
- */
- public String getFrameBorder();
- public void setFrameBorder(String frameBorder);
-
- /**
- * Frame height. See the height attribute definition in HTML 4.0.
- */
- public String getHeight();
- public void setHeight(String height);
-
- /**
- * URI designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.0.
- */
- public String getLongDesc();
- public void setLongDesc(String longDesc);
-
- /**
- * Frame margin height, in pixels. See the marginheight attribute
- * definition in HTML 4.0.
- */
- public String getMarginHeight();
- public void setMarginHeight(String marginHeight);
-
- /**
- * Frame margin width, in pixels. See the marginwidth attribute
- * definition in HTML 4.0.
- */
- public String getMarginWidth();
- public void setMarginWidth(String marginWidth);
-
- /**
- * The frame name (object of the <code>target</code> attribute). See the
- * name attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Specify whether or not the frame should have scrollbars. See the
- * scrolling attribute definition in HTML 4.0.
- */
- public String getScrolling();
- public void setScrolling(String scrolling);
-
- /**
- * A URI designating the initial frame contents. See the src attribute
- * definition in HTML 4.0.
- */
- public String getSrc();
- public void setSrc(String src);
-
- /**
- * Frame width. See the width attribute definition in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
- /**
- * The document this frame contains, if there is any and it is available,
- * or <code>null</code> otherwise.
- * @since DOM Level 2
- */
- public Document getContentDocument();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLImageElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLImageElement.java
deleted file mode 100755
index 6b59c032d..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLImageElement.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Embedded image. See the IMG element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLImageElement extends HTMLElement {
- /**
- * URI designating the source of this image, for low-resolution output.
- */
- public String getLowSrc();
- public void setLowSrc(String lowSrc);
-
- /**
- * The name of the element (for backwards compatibility).
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Alternate text for user agents not rendering the normal content of
- * this element. See the alt attribute definition in HTML 4.0.
- */
- public String getAlt();
- public void setAlt(String alt);
-
- /**
- * Width of border around image. See the border attribute definition in
- * HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getBorder();
- public void setBorder(String border);
-
- /**
- * Override height. See the height attribute definition in HTML 4.0.
- */
- public String getHeight();
- public void setHeight(String height);
-
- /**
- * Horizontal space to the left and right of this image. See the hspace
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public String getHspace();
- public void setHspace(String hspace);
-
- /**
- * Use server-side image map. See the ismap attribute definition in HTML
- * 4.0.
- */
- public boolean getIsMap();
- public void setIsMap(boolean isMap);
-
- /**
- * URI designating a long description of this image or frame. See the
- * longdesc attribute definition in HTML 4.0.
- */
- public String getLongDesc();
- public void setLongDesc(String longDesc);
-
- /**
- * URI designating the source of this image. See the src attribute
- * definition in HTML 4.0.
- */
- public String getSrc();
- public void setSrc(String src);
-
- /**
- * Use client-side image map. See the usemap attribute definition in
- * HTML 4.0.
- */
- public String getUseMap();
- public void setUseMap(String useMap);
-
- /**
- * Vertical space above and below this image. See the vspace attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getVspace();
- public void setVspace(String vspace);
-
- /**
- * Override width. See the width attribute definition in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLInputElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLInputElement.java
deleted file mode 100755
index 372eb8a91..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLInputElement.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Form control. Note. Depending upon the environment in which the page is
- * being viewed, the value property may be read-only for the file upload
- * input type. For the "password" input type, the actual value returned may
- * be masked to prevent unauthorized use. See the INPUT element definition
- * in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLInputElement extends HTMLElement {
- /**
- * When the <code>type</code> attribute of the element has the value
- * "Text", "File" or "Password", this represents the HTML value attribute
- * of the element. The value of this attribute does not change if the
- * contents of the corresponding form control, in an interactive user
- * agent, changes. Changing this attribute, however, resets the contents
- * of the form control. See the value attribute definition in HTML 4.0.
- */
- public String getDefaultValue();
- public void setDefaultValue(String defaultValue);
-
- /**
- * When <code>type</code> has the value "Radio" or "Checkbox", this
- * represents the HTML checked attribute of the element. The value of
- * this attribute does not change if the state of the corresponding form
- * control, in an interactive user agent, changes. Changes to this
- * attribute, however, resets the state of the form control. See the
- * checked attribute definition in HTML 4.0.
- */
- public boolean getDefaultChecked();
- public void setDefaultChecked(boolean defaultChecked);
-
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A comma-separated list of content types that a server processing this
- * form will handle correctly. See the accept attribute definition in
- * HTML 4.0.
- */
- public String getAccept();
- public void setAccept(String accept);
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Alternate text for user agents not rendering the normal content of
- * this element. See the alt attribute definition in HTML 4.0.
- */
- public String getAlt();
- public void setAlt(String alt);
-
- /**
- * When the <code>type</code> attribute of the element has the value
- * "Radio" or "Checkbox", this represents the current state of the form
- * control, in an interactive user agent. Changes to this attribute
- * change the state of the form control, but do not change the value of
- * the HTML value attribute of the element.
- */
- public boolean getChecked();
- public void setChecked(boolean checked);
-
- /**
- * The control is unavailable in this context. See the disabled
- * attribute definition in HTML 4.0.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * Maximum number of characters for text fields, when <code>type</code>
- * has the value "Text" or "Password". See the maxlength attribute
- * definition in HTML 4.0.
- */
- public int getMaxLength();
- public void setMaxLength(int maxLength);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * This control is read-only. Relevant only when <code>type</code> has
- * the value "Text" or "Password". See the readonly attribute definition
- * in HTML 4.0.
- */
- public boolean getReadOnly();
- public void setReadOnly(boolean readOnly);
-
- /**
- * Size information. The precise meaning is specific to each type of
- * field. See the size attribute definition in HTML 4.0.
- */
- public String getSize();
- public void setSize(String size);
-
- /**
- * When the <code>type</code> attribute has the value "Image", this
- * attribute specifies the location of the image to be used to decorate
- * the graphical submit button. See the src attribute definition in HTML
- * 4.0.
- */
- public String getSrc();
- public void setSrc(String src);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * The type of control created. See the type attribute definition in
- * HTML 4.0.
- */
- public String getType();
-
- /**
- * Use client-side image map. See the usemap attribute definition in
- * HTML 4.0.
- */
- public String getUseMap();
- public void setUseMap(String useMap);
-
- /**
- * When the <code>type</code> attribute of the element has the value
- * "Text", "File" or "Password", this represents the current contents of
- * the corresponding form control, in an interactive user agent. Changing
- * this attribute changes the contents of the form control, but does not
- * change the value of the HTML value attribute of the element. When the
- * <code>type</code> attribute of the element has the value "Button",
- * "Hidden", "Submit", "Reset", "Image", "Checkbox" or "Radio", this
- * represents the HTML value attribute of the element. See the value
- * attribute definition in HTML 4.0.
- */
- public String getValue();
- public void setValue(String value);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
- /**
- * Select the contents of the text area. For <code>INPUT</code> elements
- * whose <code>type</code> attribute has one of the following values:
- * "Text", "File", or "Password".
- */
- public void select();
-
- /**
- * Simulate a mouse-click. For <code>INPUT</code> elements whose
- * <code>type</code> attribute has one of the following values: "Button",
- * "Checkbox", "Radio", "Reset", or "Submit".
- */
- public void click();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLIsIndexElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLIsIndexElement.java
deleted file mode 100755
index 6eb459627..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLIsIndexElement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * This element is used for single-line text input. See the ISINDEX element
- * definition in HTML 4.0. This element is deprecated in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLIsIndexElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * The prompt message. See the prompt attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getPrompt();
- public void setPrompt(String prompt);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLLIElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLLIElement.java
deleted file mode 100755
index c7dba9ca5..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLLIElement.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * List item. See the LI element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLLIElement extends HTMLElement {
- /**
- * List item bullet style. See the type attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
- /**
- * Reset sequence number when used in <code>OL</code> . See the value
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public int getValue();
- public void setValue(int value);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLLabelElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLLabelElement.java
deleted file mode 100755
index 17334155e..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLLabelElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Form field label text. See the LABEL element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLLabelElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * This attribute links this label with another form control by
- * <code>id</code> attribute. See the for attribute definition in HTML
- * 4.0.
- */
- public String getHtmlFor();
- public void setHtmlFor(String htmlFor);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLLegendElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLLegendElement.java
deleted file mode 100755
index 9bf48d43c..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLLegendElement.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Provides a caption for a <code>FIELDSET</code> grouping. See the LEGEND
- * element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLLegendElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * Text alignment relative to <code>FIELDSET</code> . See the align
- * attribute definition in HTML 4.0. This attribute is deprecated in HTML
- * 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLLinkElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLLinkElement.java
deleted file mode 100755
index 089b90cc5..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLLinkElement.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * The <code>LINK</code> element specifies a link to an external resource,
- * and defines this document's relationship to that resource (or vice versa).
- * See the LINK element definition in HTML 4.0 (see also the
- * <code>LinkStyle</code> interface in the module).
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLLinkElement extends HTMLElement {
- /**
- * Enables/disables the link. This is currently only used for style sheet
- * links, and may be used to activate or deactivate style sheets.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * The character encoding of the resource being linked to. See the
- * charset attribute definition in HTML 4.0.
- */
- public String getCharset();
- public void setCharset(String charset);
-
- /**
- * The URI of the linked resource. See the href attribute definition in
- * HTML 4.0.
- */
- public String getHref();
- public void setHref(String href);
-
- /**
- * Language code of the linked resource. See the hreflang attribute
- * definition in HTML 4.0.
- */
- public String getHreflang();
- public void setHreflang(String hreflang);
-
- /**
- * Designed for use with one or more target media. See the media
- * attribute definition in HTML 4.0.
- */
- public String getMedia();
- public void setMedia(String media);
-
- /**
- * Forward link type. See the rel attribute definition in HTML 4.0.
- */
- public String getRel();
- public void setRel(String rel);
-
- /**
- * Reverse link type. See the rev attribute definition in HTML 4.0.
- */
- public String getRev();
- public void setRev(String rev);
-
- /**
- * Frame to render the resource in. See the target attribute definition
- * in HTML 4.0.
- */
- public String getTarget();
- public void setTarget(String target);
-
- /**
- * Advisory content type. See the type attribute definition in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLMapElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLMapElement.java
deleted file mode 100755
index bd464b1a7..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLMapElement.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Client-side image map. See the MAP element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLMapElement extends HTMLElement {
- /**
- * The list of areas defined for the image map.
- */
- public HTMLCollection getAreas();
-
- /**
- * Names the map (for use with <code>usemap</code> ). See the name
- * attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLMenuElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLMenuElement.java
deleted file mode 100755
index cf1fd1247..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLMenuElement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Menu list. See the MENU element definition in HTML 4.0. This element is
- * deprecated in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLMenuElement extends HTMLElement {
- /**
- * Reduce spacing between list items. See the compact attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getCompact();
- public void setCompact(boolean compact);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLMetaElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLMetaElement.java
deleted file mode 100755
index 8cb608a27..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLMetaElement.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * This contains generic meta-information about the document. See the META
- * element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLMetaElement extends HTMLElement {
- /**
- * Associated information. See the content attribute definition in HTML
- * 4.0.
- */
- public String getContent();
- public void setContent(String content);
-
- /**
- * HTTP response header name. See the http-equiv attribute definition in
- * HTML 4.0.
- */
- public String getHttpEquiv();
- public void setHttpEquiv(String httpEquiv);
-
- /**
- * Meta information name. See the name attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Select form of content. See the scheme attribute definition in HTML
- * 4.0.
- */
- public String getScheme();
- public void setScheme(String scheme);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLModElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLModElement.java
deleted file mode 100755
index 419825d8b..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLModElement.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Notice of modification to part of a document. See the INS and DEL
- * element definitions in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLModElement extends HTMLElement {
- /**
- * A URI designating a document that describes the reason for the change.
- * See the cite attribute definition in HTML 4.0.
- */
- public String getCite();
- public void setCite(String cite);
-
- /**
- * The date and time of the change. See the datetime attribute definition
- * in HTML 4.0.
- */
- public String getDateTime();
- public void setDateTime(String dateTime);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLOListElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLOListElement.java
deleted file mode 100755
index 1357ff138..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLOListElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Ordered list. See the OL element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLOListElement extends HTMLElement {
- /**
- * Reduce spacing between list items. See the compact attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getCompact();
- public void setCompact(boolean compact);
-
- /**
- * Starting sequence number. See the start attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public int getStart();
- public void setStart(int start);
-
- /**
- * Numbering style. See the type attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLObjectElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLObjectElement.java
deleted file mode 100755
index c682e67fc..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLObjectElement.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.Document;
-
-/**
- * Generic embedded object. Note. In principle, all properties on the object
- * element are read-write but in some environments some properties may be
- * read-only once the underlying object is instantiated. See the OBJECT
- * element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLObjectElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * Applet class file. See the <code>code</code> attribute for
- * HTMLAppletElement.
- */
- public String getCode();
- public void setCode(String code);
-
- /**
- * Aligns this object (vertically or horizontally) with respect to its
- * surrounding text. See the align attribute definition in HTML 4.0.
- * This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Space-separated list of archives. See the archive attribute definition
- * in HTML 4.0.
- */
- public String getArchive();
- public void setArchive(String archive);
-
- /**
- * Width of border around the object. See the border attribute definition
- * in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getBorder();
- public void setBorder(String border);
-
- /**
- * Base URI for <code>classid</code> , <code>data</code> , and
- * <code>archive</code> attributes. See the codebase attribute definition
- * in HTML 4.0.
- */
- public String getCodeBase();
- public void setCodeBase(String codeBase);
-
- /**
- * Content type for data downloaded via <code>classid</code> attribute.
- * See the codetype attribute definition in HTML 4.0.
- */
- public String getCodeType();
- public void setCodeType(String codeType);
-
- /**
- * A URI specifying the location of the object's data. See the data
- * attribute definition in HTML 4.0.
- */
- public String getData();
- public void setData(String data);
-
- /**
- * Declare (for future reference), but do not instantiate, this object.
- * See the declare attribute definition in HTML 4.0.
- */
- public boolean getDeclare();
- public void setDeclare(boolean declare);
-
- /**
- * Override height. See the height attribute definition in HTML 4.0.
- */
- public String getHeight();
- public void setHeight(String height);
-
- /**
- * Horizontal space to the left and right of this image, applet, or
- * object. See the hspace attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getHspace();
- public void setHspace(String hspace);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Message to render while loading the object. See the standby attribute
- * definition in HTML 4.0.
- */
- public String getStandby();
- public void setStandby(String standby);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * Content type for data downloaded via <code>data</code> attribute. See
- * the type attribute definition in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
- /**
- * Use client-side image map. See the usemap attribute definition in
- * HTML 4.0.
- */
- public String getUseMap();
- public void setUseMap(String useMap);
-
- /**
- * Vertical space above and below this image, applet, or object. See the
- * vspace attribute definition in HTML 4.0. This attribute is deprecated
- * in HTML 4.0.
- */
- public String getVspace();
- public void setVspace(String vspace);
-
- /**
- * Override width. See the width attribute definition in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
- /**
- * The document this object contains, if there is any and it is
- * available, or <code>null</code> otherwise.
- * @since DOM Level 2
- */
- public Document getContentDocument();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLOptGroupElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLOptGroupElement.java
deleted file mode 100755
index ca38157b6..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLOptGroupElement.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Group options together in logical subdivisions. See the OPTGROUP element
- * definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLOptGroupElement extends HTMLElement {
- /**
- * The control is unavailable in this context. See the disabled
- * attribute definition in HTML 4.0.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * Assigns a label to this option group. See the label attribute
- * definition in HTML 4.0.
- */
- public String getLabel();
- public void setLabel(String label);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLOptionElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLOptionElement.java
deleted file mode 100755
index 8af033c37..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLOptionElement.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * A selectable choice. See the OPTION element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLOptionElement extends HTMLElement {
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * Represents the value of the HTML selected attribute. The value of this
- * attribute does not change if the state of the corresponding form
- * control, in an interactive user agent, changes. Changing
- * <code>defaultSelected</code> , however, resets the state of the form
- * control. See the selected attribute definition in HTML 4.0.
- */
- public boolean getDefaultSelected();
- public void setDefaultSelected(boolean defaultSelected);
-
- /**
- * The text contained within the option element.
- */
- public String getText();
-
- /**
- * The index of this <code>OPTION</code> in its parent <code>SELECT</code>
- * , starting from 0.
- */
- public int getIndex();
-
- /**
- * The control is unavailable in this context. See the disabled
- * attribute definition in HTML 4.0.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * Option label for use in hierarchical menus. See the label attribute
- * definition in HTML 4.0.
- */
- public String getLabel();
- public void setLabel(String label);
-
- /**
- * Represents the current state of the corresponding form control, in an
- * interactive user agent. Changing this attribute changes the state of
- * the form control, but does not change the value of the HTML selected
- * attribute of the element.
- */
- public boolean getSelected();
- public void setSelected(boolean selected);
-
- /**
- * The current form control value. See the value attribute definition in
- * HTML 4.0.
- */
- public String getValue();
- public void setValue(String value);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLParagraphElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLParagraphElement.java
deleted file mode 100755
index 179241a9f..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLParagraphElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Paragraphs. See the P element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLParagraphElement extends HTMLElement {
- /**
- * Horizontal text alignment. See the align attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLParamElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLParamElement.java
deleted file mode 100755
index e30fd5329..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLParamElement.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Parameters fed to the <code>OBJECT</code> element. See the PARAM element
- * definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLParamElement extends HTMLElement {
- /**
- * The name of a run-time parameter. See the name attribute definition
- * in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Content type for the <code>value</code> attribute when
- * <code>valuetype</code> has the value "ref". See the type attribute
- * definition in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
- /**
- * The value of a run-time parameter. See the value attribute definition
- * in HTML 4.0.
- */
- public String getValue();
- public void setValue(String value);
-
- /**
- * Information about the meaning of the <code>value</code> attribute
- * value. See the valuetype attribute definition in HTML 4.0.
- */
- public String getValueType();
- public void setValueType(String valueType);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLPreElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLPreElement.java
deleted file mode 100755
index 23fc398eb..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLPreElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Preformatted text. See the PRE element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLPreElement extends HTMLElement {
- /**
- * Fixed width for content. See the width attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public int getWidth();
- public void setWidth(int width);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLQuoteElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLQuoteElement.java
deleted file mode 100755
index 26873f48f..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLQuoteElement.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * For the <code>Q</code> and <code>BLOCKQUOTE</code> elements. See the Q
- * element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLQuoteElement extends HTMLElement {
- /**
- * A URI designating a source document or message. See the cite
- * attribute definition in HTML 4.0.
- */
- public String getCite();
- public void setCite(String cite);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLScriptElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLScriptElement.java
deleted file mode 100755
index 3294a504f..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLScriptElement.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Script statements. See the SCRIPT element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLScriptElement extends HTMLElement {
- /**
- * The script content of the element.
- */
- public String getText();
- public void setText(String text);
-
- /**
- * Reserved for future use.
- */
- public String getHtmlFor();
- public void setHtmlFor(String htmlFor);
-
- /**
- * Reserved for future use.
- */
- public String getEvent();
- public void setEvent(String event);
-
- /**
- * The character encoding of the linked resource. See the charset
- * attribute definition in HTML 4.0.
- */
- public String getCharset();
- public void setCharset(String charset);
-
- /**
- * Indicates that the user agent can defer processing of the script. See
- * the defer attribute definition in HTML 4.0.
- */
- public boolean getDefer();
- public void setDefer(boolean defer);
-
- /**
- * URI designating an external script. See the src attribute definition
- * in HTML 4.0.
- */
- public String getSrc();
- public void setSrc(String src);
-
- /**
- * The content type of the script language. See the type attribute
- * definition in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLSelectElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLSelectElement.java
deleted file mode 100755
index c66995f3c..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLSelectElement.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The select element allows the selection of an option. The contained
- * options can be directly accessed through the select element as a
- * collection. See the SELECT element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLSelectElement extends HTMLElement {
- /**
- * The type of this form control. This is the string "select-multiple"
- * when the multiple attribute is <code>true</code> and the string
- * "select-one" when <code>false</code> .
- */
- public String getType();
-
- /**
- * The ordinal index of the selected option, starting from 0. The value
- * -1 is returned if no element is selected. If multiple options are
- * selected, the index of the first selected option is returned.
- */
- public int getSelectedIndex();
- public void setSelectedIndex(int selectedIndex);
-
- /**
- * The current form control value.
- */
- public String getValue();
- public void setValue(String value);
-
- /**
- * The number of options in this <code>SELECT</code> .
- */
- public int getLength();
-
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * The collection of <code>OPTION</code> elements contained by this
- * element.
- */
- public HTMLCollection getOptions();
-
- /**
- * The control is unavailable in this context. See the disabled
- * attribute definition in HTML 4.0.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * If true, multiple <code>OPTION</code> elements may be selected in
- * this <code>SELECT</code> . See the multiple attribute definition in
- * HTML 4.0.
- */
- public boolean getMultiple();
- public void setMultiple(boolean multiple);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * Number of visible rows. See the size attribute definition in HTML 4.0.
- */
- public int getSize();
- public void setSize(int size);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * Add a new element to the collection of <code>OPTION</code> elements
- * for this <code>SELECT</code> . This method is the equivalent of the
- * <code>appendChild</code> method of the <code>Node</code> interface if
- * the <code>before</code> parameter is <code>null</code> . It is
- * equivalent to the <code>insertBefore</code> method on the parent of
- * <code>before</code> in all other cases.
- * @param element The element to add.
- * @param before The element to insert before, or <code>null</code> for
- * the tail of the list.
- * @exception DOMException
- * NOT_FOUND_ERR: Raised if <code>before</code> is not a descendant of
- * the <code>SELECT</code> element.
- */
- public void add(HTMLElement element,
- HTMLElement before)
- throws DOMException;
-
- /**
- * Remove an element from the collection of <code>OPTION</code> elements
- * for this <code>SELECT</code> . Does nothing if no element has the given
- * index.
- * @param index The index of the item to remove, starting from 0.
- */
- public void remove(int index);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLStyleElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLStyleElement.java
deleted file mode 100755
index e3d04bd44..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLStyleElement.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Style information. See the STYLE element definition in HTML 4.0, the
- * module and the <code>LinkStyle</code> interface in the module.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLStyleElement extends HTMLElement {
- /**
- * Enables/disables the style sheet.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * Designed for use with one or more target media. See the media
- * attribute definition in HTML 4.0.
- */
- public String getMedia();
- public void setMedia(String media);
-
- /**
- * The content type pf the style sheet language. See the type attribute
- * definition in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTableCaptionElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTableCaptionElement.java
deleted file mode 100755
index 58a8bed5e..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTableCaptionElement.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Table caption See the CAPTION element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTableCaptionElement extends HTMLElement {
- /**
- * Caption alignment with respect to the table. See the align attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTableCellElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTableCellElement.java
deleted file mode 100755
index b818ce137..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTableCellElement.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * The object used to represent the <code>TH</code> and <code>TD</code>
- * elements. See the TD element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTableCellElement extends HTMLElement {
- /**
- * The index of this cell in the row, starting from 0. This index is in
- * document tree order and not display order.
- */
- public int getCellIndex();
-
- /**
- * Abbreviation for header cells. See the abbr attribute definition in
- * HTML 4.0.
- */
- public String getAbbr();
- public void setAbbr(String abbr);
-
- /**
- * Horizontal alignment of data in cell. See the align attribute
- * definition in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Names group of related headers. See the axis attribute definition in
- * HTML 4.0.
- */
- public String getAxis();
- public void setAxis(String axis);
-
- /**
- * Cell background color. See the bgcolor attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getBgColor();
- public void setBgColor(String bgColor);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.0.
- */
- public String getCh();
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition
- * in HTML 4.0.
- */
- public String getChOff();
- public void setChOff(String chOff);
-
- /**
- * Number of columns spanned by cell. See the colspan attribute
- * definition in HTML 4.0.
- */
- public int getColSpan();
- public void setColSpan(int colSpan);
-
- /**
- * List of <code>id</code> attribute values for header cells. See the
- * headers attribute definition in HTML 4.0.
- */
- public String getHeaders();
- public void setHeaders(String headers);
-
- /**
- * Cell height. See the height attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getHeight();
- public void setHeight(String height);
-
- /**
- * Suppress word wrapping. See the nowrap attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getNoWrap();
- public void setNoWrap(boolean noWrap);
-
- /**
- * Number of rows spanned by cell. See the rowspan attribute definition
- * in HTML 4.0.
- */
- public int getRowSpan();
- public void setRowSpan(int rowSpan);
-
- /**
- * Scope covered by header cells. See the scope attribute definition in
- * HTML 4.0.
- */
- public String getScope();
- public void setScope(String scope);
-
- /**
- * Vertical alignment of data in cell. See the valign attribute
- * definition in HTML 4.0.
- */
- public String getVAlign();
- public void setVAlign(String vAlign);
-
- /**
- * Cell width. See the width attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTableColElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTableColElement.java
deleted file mode 100755
index 895ee041e..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTableColElement.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Regroups the <code>COL</code> and <code>COLGROUP</code> elements. See the
- * COL element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTableColElement extends HTMLElement {
- /**
- * Horizontal alignment of cell data in column. See the align attribute
- * definition in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.0.
- */
- public String getCh();
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition
- * in HTML 4.0.
- */
- public String getChOff();
- public void setChOff(String chOff);
-
- /**
- * Indicates the number of columns in a group or affected by a grouping.
- * See the span attribute definition in HTML 4.0.
- */
- public int getSpan();
- public void setSpan(int span);
-
- /**
- * Vertical alignment of cell data in column. See the valign attribute
- * definition in HTML 4.0.
- */
- public String getVAlign();
- public void setVAlign(String vAlign);
-
- /**
- * Default column width. See the width attribute definition in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTableElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTableElement.java
deleted file mode 100755
index 42aa2482e..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTableElement.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The create* and delete* methods on the table allow authors to construct
- * and modify tables. HTML 4.0 specifies that only one of each of the
- * <code>CAPTION</code> , <code>THEAD</code> , and <code>TFOOT</code>
- * elements may exist in a table. Therefore, if one exists, and the
- * createTHead() or createTFoot() method is called, the method returns the
- * existing THead or TFoot element. See the TABLE element definition in HTML
- * 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTableElement extends HTMLElement {
- /**
- * Returns the table's <code>CAPTION</code> , or void if none exists.
- */
- public HTMLTableCaptionElement getCaption();
- public void setCaption(HTMLTableCaptionElement caption);
-
- /**
- * Returns the table's <code>THEAD</code> , or <code>null</code> if none
- * exists.
- */
- public HTMLTableSectionElement getTHead();
- public void setTHead(HTMLTableSectionElement tHead);
-
- /**
- * Returns the table's <code>TFOOT</code> , or <code>null</code> if none
- * exists.
- */
- public HTMLTableSectionElement getTFoot();
- public void setTFoot(HTMLTableSectionElement tFoot);
-
- /**
- * Returns a collection of all the rows in the table, including all in
- * <code>THEAD</code> , <code>TFOOT</code> , all <code>TBODY</code>
- * elements.
- */
- public HTMLCollection getRows();
-
- /**
- * Returns a collection of the defined table bodies.
- */
- public HTMLCollection getTBodies();
-
- /**
- * Specifies the table's position with respect to the rest of the
- * document. See the align attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Cell background color. See the bgcolor attribute definition in HTML
- * 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getBgColor();
- public void setBgColor(String bgColor);
-
- /**
- * The width of the border around the table. See the border attribute
- * definition in HTML 4.0.
- */
- public String getBorder();
- public void setBorder(String border);
-
- /**
- * Specifies the horizontal and vertical space between cell content and
- * cell borders. See the cellpadding attribute definition in HTML 4.0.
- */
- public String getCellPadding();
- public void setCellPadding(String cellPadding);
-
- /**
- * Specifies the horizontal and vertical separation between cells. See
- * the cellspacing attribute definition in HTML 4.0.
- */
- public String getCellSpacing();
- public void setCellSpacing(String cellSpacing);
-
- /**
- * Specifies which external table borders to render. See the frame
- * attribute definition in HTML 4.0.
- */
- public String getFrame();
- public void setFrame(String frame);
-
- /**
- * Specifies which internal table borders to render. See the rules
- * attribute definition in HTML 4.0.
- */
- public String getRules();
- public void setRules(String rules);
-
- /**
- * Description about the purpose or structure of a table. See the
- * summary attribute definition in HTML 4.0.
- */
- public String getSummary();
- public void setSummary(String summary);
-
- /**
- * Specifies the desired table width. See the width attribute definition
- * in HTML 4.0.
- */
- public String getWidth();
- public void setWidth(String width);
-
- /**
- * Create a table header row or return an existing one.
- * @return A new table header element (<code>THEAD</code> ).
- */
- public HTMLElement createTHead();
-
- /**
- * Delete the header from the table, if one exists.
- */
- public void deleteTHead();
-
- /**
- * Create a table footer row or return an existing one.
- * @return A footer element (<code>TFOOT</code> ).
- */
- public HTMLElement createTFoot();
-
- /**
- * Delete the footer from the table, if one exists.
- */
- public void deleteTFoot();
-
- /**
- * Create a new table caption object or return an existing one.
- * @return A <code>CAPTION</code> element.
- */
- public HTMLElement createCaption();
-
- /**
- * Delete the table caption, if one exists.
- */
- public void deleteCaption();
-
- /**
- * Insert a new empty row in the table. The new row is inserted
- * immediately before and in the same section as the current
- * <code>index</code> th row in the table. If <code>index</code> is equal
- * to the number of rows, the new row is appended. In addition, when the
- * table is empty the row is inserted into a <code>TBODY</code> which is
- * created and inserted into the table. Note. A table row cannot be empty
- * according to HTML 4.0 Recommendation.
- * @param index The row number where to insert a new row. This index
- * starts from 0 and is relative to all the rows contained inside the
- * table, regardless of section parentage.
- * @return The newly created row.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than the
- * number of rows or if the index is negative.
- */
- public HTMLElement insertRow(int index)
- throws DOMException;
-
- /**
- * Delete a table row.
- * @param index The index of the row to be deleted. This index starts
- * from 0 and is relative to all the rows contained inside the table,
- * regardless of section parentage.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than or
- * equal to the number of rows or if the index is negative.
- */
- public void deleteRow(int index)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTableRowElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTableRowElement.java
deleted file mode 100755
index a15f06f0a..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTableRowElement.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.DOMException;
-
-/**
- * A row in a table. See the TR element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTableRowElement extends HTMLElement {
- /**
- * The index of this row, relative to the entire table, starting from 0.
- * This is in document tree order and not display order. The
- * <code>rowIndex</code> does not take into account sections (
- * <code>THEAD</code> , <code>TFOOT</code> , or <code>TBODY</code> )
- * within the table.
- */
- public int getRowIndex();
-
- /**
- * The index of this row, relative to the current section (
- * <code>THEAD</code> , <code>TFOOT</code> , or <code>TBODY</code> ),
- * starting from 0.
- */
- public int getSectionRowIndex();
-
- /**
- * The collection of cells in this row.
- */
- public HTMLCollection getCells();
-
- /**
- * Horizontal alignment of data within cells of this row. See the align
- * attribute definition in HTML 4.0.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Background color for rows. See the bgcolor attribute definition in
- * HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public String getBgColor();
- public void setBgColor(String bgColor);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.0.
- */
- public String getCh();
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition
- * in HTML 4.0.
- */
- public String getChOff();
- public void setChOff(String chOff);
-
- /**
- * Vertical alignment of data within cells of this row. See the valign
- * attribute definition in HTML 4.0.
- */
- public String getVAlign();
- public void setVAlign(String vAlign);
-
- /**
- * Insert an empty <code>TD</code> cell into this row. If
- * <code>index</code> is equal to the number of cells, the new cell is
- * appended
- * @param index The place to insert the cell, starting from 0.
- * @return The newly created cell.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified <code>index</code> is
- * greater than the number of cells or if the index is negative.
- */
- public HTMLElement insertCell(int index)
- throws DOMException;
-
- /**
- * Delete a cell from the current row.
- * @param index The index of the cell to delete, starting from 0.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified <code>index</code> is
- * greater than or equal to the number of cells or if the index is
- * negative.
- */
- public void deleteCell(int index)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTableSectionElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTableSectionElement.java
deleted file mode 100755
index 99bff3591..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTableSectionElement.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>THEAD</code> , <code>TFOOT</code> , and <code>TBODY</code>
- * elements.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTableSectionElement extends HTMLElement {
- /**
- * Horizontal alignment of data in cells. See the <code>align</code>
- * attribute for HTMLTheadElement for details.
- */
- public String getAlign();
- public void setAlign(String align);
-
- /**
- * Alignment character for cells in a column. See the char attribute
- * definition in HTML 4.0.
- */
- public String getCh();
- public void setCh(String ch);
-
- /**
- * Offset of alignment character. See the charoff attribute definition
- * in HTML 4.0.
- */
- public String getChOff();
- public void setChOff(String chOff);
-
- /**
- * Vertical alignment of data in cells. See the <code>valign</code>
- * attribute for HTMLTheadElement for details.
- */
- public String getVAlign();
- public void setVAlign(String vAlign);
-
- /**
- * The collection of rows in this table section.
- */
- public HTMLCollection getRows();
-
- /**
- * Insert a row into this section. The new row is inserted immediately
- * before the current <code>index</code> th row in this section. If
- * <code>index</code> is equal to the number of rows in this section, the
- * new row is appended.
- * @param index The row number where to insert a new row. This index
- * starts from 0 and is relative only to the rows contained inside this
- * section, not all the rows in the table.
- * @return The newly created row.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than the
- * number of rows of if the index is neagative.
- */
- public HTMLElement insertRow(int index)
- throws DOMException;
-
- /**
- * Delete a row from this section.
- * @param index The index of the row to be deleted. This index starts
- * from 0 and is relative only to the rows contained inside this
- * section, not all the rows in the table.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if the specified index is greater than or
- * equal to the number of rows or if the index is negative.
- */
- public void deleteRow(int index)
- throws DOMException;
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTextAreaElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTextAreaElement.java
deleted file mode 100755
index b189a968d..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTextAreaElement.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Multi-line text field. See the TEXTAREA element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTextAreaElement extends HTMLElement {
- /**
- * Represents the contents of the element. The value of this attribute
- * does not change if the contents of the corresponding form control, in
- * an interactive user agent, changes. Changing this attribute, however,
- * resets the contents of the form control.
- */
- public String getDefaultValue();
- public void setDefaultValue(String defaultValue);
-
- /**
- * Returns the <code>FORM</code> element containing this control. Returns
- * <code>null</code> if this control is not within the context of a form.
- */
- public HTMLFormElement getForm();
-
- /**
- * A single character access key to give access to the form control. See
- * the accesskey attribute definition in HTML 4.0.
- */
- public String getAccessKey();
- public void setAccessKey(String accessKey);
-
- /**
- * Width of control (in characters). See the cols attribute definition
- * in HTML 4.0.
- */
- public int getCols();
- public void setCols(int cols);
-
- /**
- * The control is unavailable in this context. See the disabled
- * attribute definition in HTML 4.0.
- */
- public boolean getDisabled();
- public void setDisabled(boolean disabled);
-
- /**
- * Form control or object name when submitted with a form. See the name
- * attribute definition in HTML 4.0.
- */
- public String getName();
- public void setName(String name);
-
- /**
- * This control is read-only. See the readonly attribute definition in
- * HTML 4.0.
- */
- public boolean getReadOnly();
- public void setReadOnly(boolean readOnly);
-
- /**
- * Number of text rows. See the rows attribute definition in HTML 4.0.
- */
- public int getRows();
- public void setRows(int rows);
-
- /**
- * Index that represents the element's position in the tabbing order. See
- * the tabindex attribute definition in HTML 4.0.
- */
- public int getTabIndex();
- public void setTabIndex(int tabIndex);
-
- /**
- * The type of this form control. This the string "textarea".
- */
- public String getType();
-
- /**
- * Represents the current contents of the corresponding form control, in
- * an interactive user agent. Changing this attribute changes the
- * contents of the form control, but does not change the contents of the
- * element. If the entirety of the data can not fit into a single
- * <code>DOMString</code> , the implementation may truncate the data.
- */
- public String getValue();
- public void setValue(String value);
-
- /**
- * Removes keyboard focus from this element.
- */
- public void blur();
-
- /**
- * Gives keyboard focus to this element.
- */
- public void focus();
-
- /**
- * Select the contents of the <code>TEXTAREA</code> .
- */
- public void select();
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLTitleElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLTitleElement.java
deleted file mode 100755
index 9a2b1ff1d..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLTitleElement.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * The document title. See the TITLE element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLTitleElement extends HTMLElement {
- /**
- * The specified title as a string.
- */
- public String getText();
- public void setText(String text);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/HTMLUListElement.java b/external/jaxp/source/org/w3c/dom/html/HTMLUListElement.java
deleted file mode 100755
index dac1789d9..000000000
--- a/external/jaxp/source/org/w3c/dom/html/HTMLUListElement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE. See W3C License http://www.w3.org/Consortium/Legal/ for more
- * details.
- */
-
-package org.w3c.dom.html;
-
-/**
- * Unordered list. See the UL element definition in HTML 4.0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/CR-DOM-Level-2-20000510'>Document Object Model (DOM) Level 2 Specification</a>.
- */
-public interface HTMLUListElement extends HTMLElement {
- /**
- * Reduce spacing between list items. See the compact attribute
- * definition in HTML 4.0. This attribute is deprecated in HTML 4.0.
- */
- public boolean getCompact();
- public void setCompact(boolean compact);
-
- /**
- * Bullet style. See the type attribute definition in HTML 4.0. This
- * attribute is deprecated in HTML 4.0.
- */
- public String getType();
- public void setType(String type);
-
-}
-
diff --git a/external/jaxp/source/org/w3c/dom/html/package.html b/external/jaxp/source/org/w3c/dom/html/package.html
deleted file mode 100755
index f1dca68d2..000000000
--- a/external/jaxp/source/org/w3c/dom/html/package.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports the optional "HTML" feature of the
-second DOM Level 2 Candidate Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/package.html b/external/jaxp/source/org/w3c/dom/package.html
deleted file mode 100755
index b333acec6..000000000
--- a/external/jaxp/source/org/w3c/dom/package.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<html><head>
-<title>DOM Level 2</title>
-</head><body>
-
-<p>Contains the core and "XML" feature set of the
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-core-20001113/">
-DOM Level 2</a> Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/ranges/DocumentRange.java b/external/jaxp/source/org/w3c/dom/ranges/DocumentRange.java
deleted file mode 100644
index 6b522670e..000000000
--- a/external/jaxp/source/org/w3c/dom/ranges/DocumentRange.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.ranges;
-
-/**
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public interface DocumentRange {
- /**
- * This interface can be obtained from the object implementing the
- * <code>Document</code> interface using binding-specific casting
- * methods.
- * @return The initial state of the Range returned from this method is
- * such that both of its boundary-points are positioned at the
- * beginning of the corresponding Document, before any content. The
- * Range returned can only be used to select content associated with
- * this Document, or with DocumentFragments and Attrs for which this
- * Document is the <code>ownerDocument</code>.
- */
- public Range createRange();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/ranges/Range.java b/external/jaxp/source/org/w3c/dom/ranges/Range.java
deleted file mode 100644
index a576b4dd6..000000000
--- a/external/jaxp/source/org/w3c/dom/ranges/Range.java
+++ /dev/null
@@ -1,416 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.ranges;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-import org.w3c.dom.DocumentFragment;
-
-/**
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public interface Range {
- /**
- * Node within which the Range begins
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public Node getStartContainer()
- throws DOMException;
-
- /**
- * Offset within the starting node of the Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public int getStartOffset()
- throws DOMException;
-
- /**
- * Node within which the Range ends
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public Node getEndContainer()
- throws DOMException;
-
- /**
- * Offset within the ending node of the Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public int getEndOffset()
- throws DOMException;
-
- /**
- * TRUE if the Range is collapsed
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public boolean getCollapsed()
- throws DOMException;
-
- /**
- * The deepest common ancestor container of the Range's two
- * boundary-points.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public Node getCommonAncestorContainer()
- throws DOMException;
-
- /**
- * Sets the attributes describing the start of the Range.
- * @param refNode The <code>refNode</code> value. This parameter must be
- * different from <code>null</code>.
- * @param offset The <code>startOffset</code> value.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor
- * of <code>refNode</code> is an Entity, Notation, or DocumentType
- * node.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if <code>offset</code> is negative or greater
- * than the number of child units in <code>refNode</code>. Child units
- * are 16-bit units if <code>refNode</code> is a type of CharacterData
- * node (e.g., a Text or Comment node) or a ProcessingInstruction
- * node. Child units are Nodes in all other cases.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void setStart(Node refNode,
- int offset)
- throws RangeException, DOMException;
-
- /**
- * Sets the attributes describing the end of a Range.
- * @param refNode The <code>refNode</code> value. This parameter must be
- * different from <code>null</code>.
- * @param offset The <code>endOffset</code> value.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor
- * of <code>refNode</code> is an Entity, Notation, or DocumentType
- * node.
- * @exception DOMException
- * INDEX_SIZE_ERR: Raised if <code>offset</code> is negative or greater
- * than the number of child units in <code>refNode</code>. Child units
- * are 16-bit units if <code>refNode</code> is a type of CharacterData
- * node (e.g., a Text or Comment node) or a ProcessingInstruction
- * node. Child units are Nodes in all other cases.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void setEnd(Node refNode,
- int offset)
- throws RangeException, DOMException;
-
- /**
- * Sets the start position to be before a node
- * @param refNode Range starts before <code>refNode</code>
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * <code>refNode</code> is not an Attr, Document, or DocumentFragment
- * node or if <code>refNode</code> is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void setStartBefore(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Sets the start position to be after a node
- * @param refNode Range starts after <code>refNode</code>
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * <code>refNode</code> is not an Attr, Document, or DocumentFragment
- * node or if <code>refNode</code> is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void setStartAfter(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Sets the end position to be before a node.
- * @param refNode Range ends before <code>refNode</code>
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * <code>refNode</code> is not an Attr, Document, or DocumentFragment
- * node or if <code>refNode</code> is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void setEndBefore(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Sets the end of a Range to be after a node
- * @param refNode Range ends after <code>refNode</code>.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if the root container of
- * <code>refNode</code> is not an Attr, Document or DocumentFragment
- * node or if <code>refNode</code> is a Document, DocumentFragment,
- * Attr, Entity, or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void setEndAfter(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Collapse a Range onto one of its boundary-points
- * @param toStart If TRUE, collapses the Range onto its start; if FALSE,
- * collapses it onto its end.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public void collapse(boolean toStart)
- throws DOMException;
-
- /**
- * Select a node and its contents
- * @param refNode The node to select.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if an ancestor of <code>refNode</code>
- * is an Entity, Notation or DocumentType node or if
- * <code>refNode</code> is a Document, DocumentFragment, Attr, Entity,
- * or Notation node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void selectNode(Node refNode)
- throws RangeException, DOMException;
-
- /**
- * Select the contents within a node
- * @param refNode Node to select from
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if <code>refNode</code> or an ancestor
- * of <code>refNode</code> is an Entity, Notation or DocumentType node.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>refNode</code> was created
- * from a different document than the one that created this range.
- */
- public void selectNodeContents(Node refNode)
- throws RangeException, DOMException;
-
- // CompareHow
- /**
- * Compare start boundary-point of <code>sourceRange</code> to start
- * boundary-point of Range on which <code>compareBoundaryPoints</code>
- * is invoked.
- */
- public static final short START_TO_START = 0;
- /**
- * Compare start boundary-point of <code>sourceRange</code> to end
- * boundary-point of Range on which <code>compareBoundaryPoints</code>
- * is invoked.
- */
- public static final short START_TO_END = 1;
- /**
- * Compare end boundary-point of <code>sourceRange</code> to end
- * boundary-point of Range on which <code>compareBoundaryPoints</code>
- * is invoked.
- */
- public static final short END_TO_END = 2;
- /**
- * Compare end boundary-point of <code>sourceRange</code> to start
- * boundary-point of Range on which <code>compareBoundaryPoints</code>
- * is invoked.
- */
- public static final short END_TO_START = 3;
-
- /**
- * Compare the boundary-points of two Ranges in a document.
- * @param how A code representing the type of comparison, as defined
- * above.
- * @param sourceRange The <code>Range</code> on which this current
- * <code>Range</code> is compared to.
- * @return -1, 0 or 1 depending on whether the corresponding
- * boundary-point of the Range is respectively before, equal to, or
- * after the corresponding boundary-point of <code>sourceRange</code>.
- * @exception DOMException
- * WRONG_DOCUMENT_ERR: Raised if the two Ranges are not in the same
- * Document or DocumentFragment.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- */
- public short compareBoundaryPoints(short how,
- Range sourceRange)
- throws DOMException;
-
- /**
- * Removes the contents of a Range from the containing document or
- * document fragment without returning a reference to the removed
- * content.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
- * the Range is read-only or any of the nodes that contain any of the
- * content of the Range are read-only.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- */
- public void deleteContents()
- throws DOMException;
-
- /**
- * Moves the contents of a Range from the containing document or document
- * fragment to a new DocumentFragment.
- * @return A DocumentFragment containing the extracted contents.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if any portion of the content of
- * the Range is read-only or any of the nodes which contain any of the
- * content of the Range are read-only.
- * <br>HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be
- * extracted into the new DocumentFragment.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- */
- public DocumentFragment extractContents()
- throws DOMException;
-
- /**
- * Duplicates the contents of a Range
- * @return A DocumentFragment that contains content equivalent to this
- * Range.
- * @exception DOMException
- * HIERARCHY_REQUEST_ERR: Raised if a DocumentType node would be
- * extracted into the new DocumentFragment.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- */
- public DocumentFragment cloneContents()
- throws DOMException;
-
- /**
- * Inserts a node into the Document or DocumentFragment at the start of
- * the Range. If the container is a Text node, this will be split at the
- * start of the Range (as if the Text node's splitText method was
- * performed at the insertion point) and the insertion will occur
- * between the two resulting Text nodes. Adjacent Text nodes will not be
- * automatically merged. If the node to be inserted is a
- * DocumentFragment node, the children will be inserted rather than the
- * DocumentFragment node itself.
- * @param newNode The node to insert at the start of the Range
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of the
- * start of the Range is read-only.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code>newNode</code> and the
- * container of the start of the Range were not created from the same
- * document.
- * <br>HIERARCHY_REQUEST_ERR: Raised if the container of the start of
- * the Range is of a type that does not allow children of the type of
- * <code>newNode</code> or if <code>newNode</code> is an ancestor of
- * the container.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- * @exception RangeException
- * INVALID_NODE_TYPE_ERR: Raised if <code>newNode</code> is an Attr,
- * Entity, Notation, or Document node.
- */
- public void insertNode(Node newNode)
- throws DOMException, RangeException;
-
- /**
- * Reparents the contents of the Range to the given node and inserts the
- * node at the position of the start of the Range.
- * @param newParent The node to surround the contents with.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if an ancestor container of
- * either boundary-point of the Range is read-only.
- * <br>WRONG_DOCUMENT_ERR: Raised if <code> newParent</code> and the
- * container of the start of the Range were not created from the same
- * document.
- * <br>HIERARCHY_REQUEST_ERR: Raised if the container of the start of
- * the Range is of a type that does not allow children of the type of
- * <code>newParent</code> or if <code>newParent</code> is an ancestor
- * of the container or if <code>node</code> would end up with a child
- * node of a type not allowed by the type of <code>node</code>.
- * <br>INVALID_STATE_ERR: Raised if <code>detach()</code> has already
- * been invoked on this object.
- * @exception RangeException
- * BAD_BOUNDARYPOINTS_ERR: Raised if the Range partially selects a
- * non-text node.
- * <br>INVALID_NODE_TYPE_ERR: Raised if <code> node</code> is an Attr,
- * Entity, DocumentType, Notation, Document, or DocumentFragment node.
- */
- public void surroundContents(Node newParent)
- throws DOMException, RangeException;
-
- /**
- * Produces a new Range whose boundary-points are equal to the
- * boundary-points of the Range.
- * @return The duplicated Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public Range cloneRange()
- throws DOMException;
-
- /**
- * Returns the contents of a Range as a string. This string contains only
- * the data characters, not any markup.
- * @return The contents of the Range.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public String toString()
- throws DOMException;
-
- /**
- * Called to indicate that the Range is no longer in use and that the
- * implementation may relinquish any resources associated with this
- * Range. Subsequent calls to any methods or attribute getters on this
- * Range will result in a <code>DOMException</code> being thrown with an
- * error code of <code>INVALID_STATE_ERR</code>.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if <code>detach()</code> has already been
- * invoked on this object.
- */
- public void detach()
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/ranges/RangeException.java b/external/jaxp/source/org/w3c/dom/ranges/RangeException.java
deleted file mode 100644
index 551008e5d..000000000
--- a/external/jaxp/source/org/w3c/dom/ranges/RangeException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.ranges;
-
-/**
- * Range operations may throw a <code>RangeException</code> as specified in
- * their method descriptions.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public class RangeException extends RuntimeException {
- public RangeException(short code, String message) {
- super(message);
- this.code = code;
- }
- public short code;
- // RangeExceptionCode
- /**
- * If the boundary-points of a Range do not meet specific requirements.
- */
- public static final short BAD_BOUNDARYPOINTS_ERR = 1;
- /**
- * If the container of an boundary-point of a Range is being set to either
- * a node of an invalid type or a node with an ancestor of an invalid
- * type.
- */
- public static final short INVALID_NODE_TYPE_ERR = 2;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/ranges/package.html b/external/jaxp/source/org/w3c/dom/ranges/package.html
deleted file mode 100755
index cdb9bb792..000000000
--- a/external/jaxp/source/org/w3c/dom/ranges/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports the optional
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/"
->"Range"</a> feature of the
-DOM Level 2 Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/stylesheets/DocumentStyle.java b/external/jaxp/source/org/w3c/dom/stylesheets/DocumentStyle.java
deleted file mode 100755
index 2270505e7..000000000
--- a/external/jaxp/source/org/w3c/dom/stylesheets/DocumentStyle.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-/**
- * The <code>DocumentStyle</code> interface provides a mechanism by which the
- * style sheets embedded in a document can be retrieved. The expectation is
- * that an instance of the <code>DocumentStyle</code> interface can be
- * obtained by using binding-specific casting methods on an instance of the
- * <code>Document</code> interface.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface DocumentStyle {
- /**
- * A list containing all the style sheets explicitly linked into or
- * embedded in a document. For HTML documents, this includes external
- * style sheets, included via the HTML LINK element, and inline STYLE
- * elements. In XML, this includes external style sheets, included via
- * style sheet processing instructions (see ).
- */
- public StyleSheetList getStyleSheets();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/stylesheets/LinkStyle.java b/external/jaxp/source/org/w3c/dom/stylesheets/LinkStyle.java
deleted file mode 100755
index 481bd19db..000000000
--- a/external/jaxp/source/org/w3c/dom/stylesheets/LinkStyle.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-/**
- * The <code>LinkStyle</code> interface provides a mechanism by which a style
- * sheet can be retrieved from the node responsible for linking it into a
- * document. An instance of the <code>LinkStyle</code> interface can be
- * obtained using binding-specific casting methods on an instance of a
- * linking node (<code>HTMLLinkElement</code>, <code>HTMLStyleElement</code>
- * or <code>ProcessingInstruction</code> in DOM Level 2).
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface LinkStyle {
- /**
- * The style sheet.
- */
- public StyleSheet getSheet();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/stylesheets/MediaList.java b/external/jaxp/source/org/w3c/dom/stylesheets/MediaList.java
deleted file mode 100755
index 3b10ed213..000000000
--- a/external/jaxp/source/org/w3c/dom/stylesheets/MediaList.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-import org.w3c.dom.DOMException;
-
-/**
- * The <code>MediaList</code> interface provides the abstraction of an
- * ordered collection of media, without defining or constraining how this
- * collection is implemented. An empty list is the same as a list that
- * contains the medium <code>"all"</code>.
- * <p> The items in the <code>MediaList</code> are accessible via an integral
- * index, starting from 0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface MediaList {
- /**
- * The parsable textual representation of the media list. This is a
- * comma-separated list of media.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified string value has a syntax error
- * and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is
- * readonly.
- */
- public String getMediaText();
- /**
- * The parsable textual representation of the media list. This is a
- * comma-separated list of media.
- * @exception DOMException
- * SYNTAX_ERR: Raised if the specified string value has a syntax error
- * and is unparsable.
- * <br>NO_MODIFICATION_ALLOWED_ERR: Raised if this media list is
- * readonly.
- */
- public void setMediaText(String mediaText)
- throws DOMException;
-
- /**
- * The number of media in the list. The range of valid media is
- * <code>0</code> to <code>length-1</code> inclusive.
- */
- public int getLength();
-
- /**
- * Returns the <code>index</code>th in the list. If <code>index</code> is
- * greater than or equal to the number of media in the list, this
- * returns <code>null</code>.
- * @param index Index into the collection.
- * @return The medium at the <code>index</code>th position in the
- * <code>MediaList</code>, or <code>null</code> if that is not a valid
- * index.
- */
- public String item(int index);
-
- /**
- * Deletes the medium indicated by <code>oldMedium</code> from the list.
- * @param oldMedium The medium to delete in the media list.
- * @exception DOMException
- * NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
- * <br> NOT_FOUND_ERR: Raised if <code>oldMedium</code> is not in the
- * list.
- */
- public void deleteMedium(String oldMedium)
- throws DOMException;
-
- /**
- * Adds the medium <code>newMedium</code> to the end of the list. If the
- * <code>newMedium</code> is already used, it is first removed.
- * @param newMedium The new medium to add.
- * @exception DOMException
- * INVALID_CHARACTER_ERR: If the medium contains characters that are
- * invalid in the underlying style language.
- * <br> NO_MODIFICATION_ALLOWED_ERR: Raised if this list is readonly.
- */
- public void appendMedium(String newMedium)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/stylesheets/StyleSheet.java b/external/jaxp/source/org/w3c/dom/stylesheets/StyleSheet.java
deleted file mode 100755
index 3da430769..000000000
--- a/external/jaxp/source/org/w3c/dom/stylesheets/StyleSheet.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-import org.w3c.dom.Node;
-
-/**
- * The <code>StyleSheet</code> interface is the abstract base interface for
- * any type of style sheet. It represents a single style sheet associated
- * with a structured document. In HTML, the StyleSheet interface represents
- * either an external style sheet, included via the HTML LINK element, or
- * an inline STYLE element. In XML, this interface represents an external
- * style sheet, included via a style sheet processing instruction.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface StyleSheet {
- /**
- * This specifies the style sheet language for this style sheet. The
- * style sheet language is specified as a content type (e.g.
- * "text/css"). The content type is often specified in the
- * <code>ownerNode</code>. Also see the type attribute definition for
- * the <code>LINK</code> element in HTML 4.0, and the type
- * pseudo-attribute for the XML style sheet processing instruction.
- */
- public String getType();
-
- /**
- * <code>false</code> if the style sheet is applied to the document.
- * <code>true</code> if it is not. Modifying this attribute may cause a
- * new resolution of style for the document. A stylesheet only applies
- * if both an appropriate medium definition is present and the disabled
- * attribute is false. So, if the media doesn't apply to the current
- * user agent, the <code>disabled</code> attribute is ignored.
- */
- public boolean getDisabled();
- /**
- * <code>false</code> if the style sheet is applied to the document.
- * <code>true</code> if it is not. Modifying this attribute may cause a
- * new resolution of style for the document. A stylesheet only applies
- * if both an appropriate medium definition is present and the disabled
- * attribute is false. So, if the media doesn't apply to the current
- * user agent, the <code>disabled</code> attribute is ignored.
- */
- public void setDisabled(boolean disabled);
-
- /**
- * The node that associates this style sheet with the document. For HTML,
- * this may be the corresponding <code>LINK</code> or <code>STYLE</code>
- * element. For XML, it may be the linking processing instruction. For
- * style sheets that are included by other style sheets, the value of
- * this attribute is <code>null</code>.
- */
- public Node getOwnerNode();
-
- /**
- * For style sheet languages that support the concept of style sheet
- * inclusion, this attribute represents the including style sheet, if
- * one exists. If the style sheet is a top-level style sheet, or the
- * style sheet language does not support inclusion, the value of this
- * attribute is <code>null</code>.
- */
- public StyleSheet getParentStyleSheet();
-
- /**
- * If the style sheet is a linked style sheet, the value of its attribute
- * is its location. For inline style sheets, the value of this attribute
- * is <code>null</code>. See the href attribute definition for the
- * <code>LINK</code> element in HTML 4.0, and the href pseudo-attribute
- * for the XML style sheet processing instruction.
- */
- public String getHref();
-
- /**
- * The advisory title. The title is often specified in the
- * <code>ownerNode</code>. See the title attribute definition for the
- * <code>LINK</code> element in HTML 4.0, and the title pseudo-attribute
- * for the XML style sheet processing instruction.
- */
- public String getTitle();
-
- /**
- * The intended destination media for style information. The media is
- * often specified in the <code>ownerNode</code>. If no media has been
- * specified, the <code>MediaList</code> will be empty. See the media
- * attribute definition for the <code>LINK</code> element in HTML 4.0,
- * and the media pseudo-attribute for the XML style sheet processing
- * instruction . Modifying the media list may cause a change to the
- * attribute <code>disabled</code>.
- */
- public MediaList getMedia();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/stylesheets/StyleSheetList.java b/external/jaxp/source/org/w3c/dom/stylesheets/StyleSheetList.java
deleted file mode 100755
index b8f9a4423..000000000
--- a/external/jaxp/source/org/w3c/dom/stylesheets/StyleSheetList.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.stylesheets;
-
-/**
- * The <code>StyleSheetList</code> interface provides the abstraction of an
- * ordered collection of style sheets.
- * <p> The items in the <code>StyleSheetList</code> are accessible via an
- * integral index, starting from 0.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113'>Document Object Model (DOM) Level 2 Style Specification</a>.
- * @since DOM Level 2
- */
-public interface StyleSheetList {
- /**
- * The number of <code>StyleSheets</code> in the list. The range of valid
- * child stylesheet indices is <code>0</code> to <code>length-1</code>
- * inclusive.
- */
- public int getLength();
-
- /**
- * Used to retrieve a style sheet by ordinal index. If index is greater
- * than or equal to the number of style sheets in the list, this returns
- * <code>null</code>.
- * @param index Index into the collection
- * @return The style sheet at the <code>index</code> position in the
- * <code>StyleSheetList</code>, or <code>null</code> if that is not a
- * valid index.
- */
- public StyleSheet item(int index);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/stylesheets/package.html b/external/jaxp/source/org/w3c/dom/stylesheets/package.html
deleted file mode 100755
index 8a50000de..000000000
--- a/external/jaxp/source/org/w3c/dom/stylesheets/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports optional
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Style-20001113/">
-"StyleSheets"</a> features (see the sibling
-CSS package) of the DOM Level 2 Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/traversal/DocumentTraversal.java b/external/jaxp/source/org/w3c/dom/traversal/DocumentTraversal.java
deleted file mode 100755
index 103cde0de..000000000
--- a/external/jaxp/source/org/w3c/dom/traversal/DocumentTraversal.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * <code>DocumentTraversal</code> contains methods that create
- * <code>NodeIterators</code> and <code>TreeWalkers</code> to traverse a
- * node and its children in document order (depth first, pre-order
- * traversal, which is equivalent to the order in which the start tags occur
- * in the text representation of the document). In DOMs which support the
- * Traversal feature, <code>DocumentTraversal</code> will be implemented by
- * the same objects that implement the Document interface.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public interface DocumentTraversal {
- /**
- * Create a new <code>NodeIterator</code> over the subtree rooted at the
- * specified node.
- * @param root The node which will be iterated together with its
- * children. The <code>NodeIterator</code> is initially positioned
- * just before this node. The <code>whatToShow</code> flags and the
- * filter, if any, are not considered when setting this position. The
- * root must not be <code>null</code>.
- * @param whatToShow This flag specifies which node types may appear in
- * the logical view of the tree presented by the
- * <code>NodeIterator</code>. See the description of
- * <code>NodeFilter</code> for the set of possible <code>SHOW_</code>
- * values.These flags can be combined using <code>OR</code>.
- * @param filter The <code>NodeFilter</code> to be used with this
- * <code>TreeWalker</code>, or <code>null</code> to indicate no filter.
- * @param entityReferenceExpansion The value of this flag determines
- * whether entity reference nodes are expanded.
- * @return The newly created <code>NodeIterator</code>.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the specified <code>root</code> is
- * <code>null</code>.
- */
- public NodeIterator createNodeIterator(Node root,
- int whatToShow,
- NodeFilter filter,
- boolean entityReferenceExpansion)
- throws DOMException;
-
- /**
- * Create a new <code>TreeWalker</code> over the subtree rooted at the
- * specified node.
- * @param root The node which will serve as the <code>root</code> for the
- * <code>TreeWalker</code>. The <code>whatToShow</code> flags and the
- * <code>NodeFilter</code> are not considered when setting this value;
- * any node type will be accepted as the <code>root</code>. The
- * <code>currentNode</code> of the <code>TreeWalker</code> is
- * initialized to this node, whether or not it is visible. The
- * <code>root</code> functions as a stopping point for traversal
- * methods that look upward in the document structure, such as
- * <code>parentNode</code> and nextNode. The <code>root</code> must
- * not be <code>null</code>.
- * @param whatToShow This flag specifies which node types may appear in
- * the logical view of the tree presented by the
- * <code>TreeWalker</code>. See the description of
- * <code>NodeFilter</code> for the set of possible <code>SHOW_</code>
- * values.These flags can be combined using <code>OR</code>.
- * @param filter The <code>NodeFilter</code> to be used with this
- * <code>TreeWalker</code>, or <code>null</code> to indicate no filter.
- * @param entityReferenceExpansion If this flag is false, the contents of
- * <code>EntityReference</code> nodes are not presented in the logical
- * view.
- * @return The newly created <code>TreeWalker</code>.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if the specified <code>root</code> is
- * <code>null</code>.
- */
- public TreeWalker createTreeWalker(Node root,
- int whatToShow,
- NodeFilter filter,
- boolean entityReferenceExpansion)
- throws DOMException;
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/traversal/NodeFilter.java b/external/jaxp/source/org/w3c/dom/traversal/NodeFilter.java
deleted file mode 100755
index b9beac476..000000000
--- a/external/jaxp/source/org/w3c/dom/traversal/NodeFilter.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-
-/**
- * Filters are objects that know how to "filter out" nodes. If a
- * <code>NodeIterator</code> or <code>TreeWalker</code> is given a
- * <code>NodeFilter</code>, it applies the filter before it returns the next
- * node. If the filter says to accept the node, the traversal logic returns
- * it; otherwise, traversal looks for the next node and pretends that the
- * node that was rejected was not there.
- * <p>The DOM does not provide any filters. <code>NodeFilter</code> is just an
- * interface that users can implement to provide their own filters.
- * <p><code>NodeFilters</code> do not need to know how to traverse from node
- * to node, nor do they need to know anything about the data structure that
- * is being traversed. This makes it very easy to write filters, since the
- * only thing they have to know how to do is evaluate a single node. One
- * filter may be used with a number of different kinds of traversals,
- * encouraging code reuse.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public interface NodeFilter {
- // Constants returned by acceptNode
- /**
- * Accept the node. Navigation methods defined for
- * <code>NodeIterator</code> or <code>TreeWalker</code> will return this
- * node.
- */
- public static final short FILTER_ACCEPT = 1;
- /**
- * Reject the node. Navigation methods defined for
- * <code>NodeIterator</code> or <code>TreeWalker</code> will not return
- * this node. For <code>TreeWalker</code>, the children of this node
- * will also be rejected. <code>NodeIterators</code> treat this as a
- * synonym for <code>FILTER_SKIP</code>.
- */
- public static final short FILTER_REJECT = 2;
- /**
- * Skip this single node. Navigation methods defined for
- * <code>NodeIterator</code> or <code>TreeWalker</code> will not return
- * this node. For both <code>NodeIterator</code> and
- * <code>TreeWalker</code>, the children of this node will still be
- * considered.
- */
- public static final short FILTER_SKIP = 3;
-
- // Constants for whatToShow
- /**
- * Show all <code>Nodes</code>.
- */
- public static final int SHOW_ALL = 0xFFFFFFFF;
- /**
- * Show <code>Element</code> nodes.
- */
- public static final int SHOW_ELEMENT = 0x00000001;
- /**
- * Show <code>Attr</code> nodes. This is meaningful only when creating an
- * <code>NodeIterator</code> or <code>TreeWalker</code> with an
- * attribute node as its <code>root</code>; in this case, it means that
- * the attribute node will appear in the first position of the iteration
- * or traversal. Since attributes are never children of other nodes,
- * they do not appear when traversing over the document tree.
- */
- public static final int SHOW_ATTRIBUTE = 0x00000002;
- /**
- * Show <code>Text</code> nodes.
- */
- public static final int SHOW_TEXT = 0x00000004;
- /**
- * Show <code>CDATASection</code> nodes.
- */
- public static final int SHOW_CDATA_SECTION = 0x00000008;
- /**
- * Show <code>EntityReference</code> nodes.
- */
- public static final int SHOW_ENTITY_REFERENCE = 0x00000010;
- /**
- * Show <code>Entity</code> nodes. This is meaningful only when creating
- * an <code>NodeIterator</code> or <code>TreeWalker</code> with an
- * <code>Entity</code> node as its <code>root</code>; in this case, it
- * means that the <code>Entity</code> node will appear in the first
- * position of the traversal. Since entities are not part of the
- * document tree, they do not appear when traversing over the document
- * tree.
- */
- public static final int SHOW_ENTITY = 0x00000020;
- /**
- * Show <code>ProcessingInstruction</code> nodes.
- */
- public static final int SHOW_PROCESSING_INSTRUCTION = 0x00000040;
- /**
- * Show <code>Comment</code> nodes.
- */
- public static final int SHOW_COMMENT = 0x00000080;
- /**
- * Show <code>Document</code> nodes.
- */
- public static final int SHOW_DOCUMENT = 0x00000100;
- /**
- * Show <code>DocumentType</code> nodes.
- */
- public static final int SHOW_DOCUMENT_TYPE = 0x00000200;
- /**
- * Show <code>DocumentFragment</code> nodes.
- */
- public static final int SHOW_DOCUMENT_FRAGMENT = 0x00000400;
- /**
- * Show <code>Notation</code> nodes. This is meaningful only when creating
- * an <code>NodeIterator</code> or <code>TreeWalker</code> with a
- * <code>Notation</code> node as its <code>root</code>; in this case, it
- * means that the <code>Notation</code> node will appear in the first
- * position of the traversal. Since notations are not part of the
- * document tree, they do not appear when traversing over the document
- * tree.
- */
- public static final int SHOW_NOTATION = 0x00000800;
-
- /**
- * Test whether a specified node is visible in the logical view of a
- * <code>TreeWalker</code> or <code>NodeIterator</code>. This function
- * will be called by the implementation of <code>TreeWalker</code> and
- * <code>NodeIterator</code>; it is not normally called directly from
- * user code. (Though you could do so if you wanted to use the same
- * filter to guide your own application logic.)
- * @param n The node to check to see if it passes the filter or not.
- * @return A constant to determine whether the node is accepted,
- * rejected, or skipped, as defined above.
- */
- public short acceptNode(Node n);
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/traversal/NodeIterator.java b/external/jaxp/source/org/w3c/dom/traversal/NodeIterator.java
deleted file mode 100755
index d1f0d0839..000000000
--- a/external/jaxp/source/org/w3c/dom/traversal/NodeIterator.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * <code>NodeIterators</code> are used to step through a set of nodes, e.g.
- * the set of nodes in a <code>NodeList</code>, the document subtree
- * governed by a particular <code>Node</code>, the results of a query, or
- * any other set of nodes. The set of nodes to be iterated is determined by
- * the implementation of the <code>NodeIterator</code>. DOM Level 2
- * specifies a single <code>NodeIterator</code> implementation for
- * document-order traversal of a document subtree. Instances of these
- * <code>NodeIterators</code> are created by calling
- * <code>DocumentTraversal</code><code>.createNodeIterator()</code>.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public interface NodeIterator {
- /**
- * The root node of the <code>NodeIterator</code>, as specified when it
- * was created.
- */
- public Node getRoot();
-
- /**
- * This attribute determines which node types are presented via the
- * <code>NodeIterator</code>. The available set of constants is defined
- * in the <code>NodeFilter</code> interface. Nodes not accepted by
- * <code>whatToShow</code> will be skipped, but their children may still
- * be considered. Note that this skip takes precedence over the filter,
- * if any.
- */
- public int getWhatToShow();
-
- /**
- * The <code>NodeFilter</code> used to screen nodes.
- */
- public NodeFilter getFilter();
-
- /**
- * The value of this flag determines whether the children of entity
- * reference nodes are visible to the <code>NodeIterator</code>. If
- * false, these children and their descendants will be rejected. Note
- * that this rejection takes precedence over <code>whatToShow</code> and
- * the filter. Also note that this is currently the only situation where
- * <code>NodeIterators</code> may reject a complete subtree rather than
- * skipping individual nodes.
- * <br>
- * <br> To produce a view of the document that has entity references
- * expanded and does not expose the entity reference node itself, use
- * the <code>whatToShow</code> flags to hide the entity reference node
- * and set <code>expandEntityReferences</code> to true when creating the
- * <code>NodeIterator</code>. To produce a view of the document that has
- * entity reference nodes but no entity expansion, use the
- * <code>whatToShow</code> flags to show the entity reference node and
- * set <code>expandEntityReferences</code> to false.
- */
- public boolean getExpandEntityReferences();
-
- /**
- * Returns the next node in the set and advances the position of the
- * <code>NodeIterator</code> in the set. After a
- * <code>NodeIterator</code> is created, the first call to
- * <code>nextNode()</code> returns the first node in the set.
- * @return The next <code>Node</code> in the set being iterated over, or
- * <code>null</code> if there are no more members in that set.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if this method is called after the
- * <code>detach</code> method was invoked.
- */
- public Node nextNode()
- throws DOMException;
-
- /**
- * Returns the previous node in the set and moves the position of the
- * <code>NodeIterator</code> backwards in the set.
- * @return The previous <code>Node</code> in the set being iterated over,
- * or <code>null</code> if there are no more members in that set.
- * @exception DOMException
- * INVALID_STATE_ERR: Raised if this method is called after the
- * <code>detach</code> method was invoked.
- */
- public Node previousNode()
- throws DOMException;
-
- /**
- * Detaches the <code>NodeIterator</code> from the set which it iterated
- * over, releasing any computational resources and placing the
- * <code>NodeIterator</code> in the INVALID state. After
- * <code>detach</code> has been invoked, calls to <code>nextNode</code>
- * or <code>previousNode</code> will raise the exception
- * INVALID_STATE_ERR.
- */
- public void detach();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/traversal/TreeWalker.java b/external/jaxp/source/org/w3c/dom/traversal/TreeWalker.java
deleted file mode 100755
index e90da0663..000000000
--- a/external/jaxp/source/org/w3c/dom/traversal/TreeWalker.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.traversal;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.DOMException;
-
-/**
- * <code>TreeWalker</code> objects are used to navigate a document tree or
- * subtree using the view of the document defined by their
- * <code>whatToShow</code> flags and filter (if any). Any function which
- * performs navigation using a <code>TreeWalker</code> will automatically
- * support any view defined by a <code>TreeWalker</code>.
- * <p>Omitting nodes from the logical view of a subtree can result in a
- * structure that is substantially different from the same subtree in the
- * complete, unfiltered document. Nodes that are siblings in the
- * <code>TreeWalker</code> view may be children of different, widely
- * separated nodes in the original view. For instance, consider a
- * <code>NodeFilter</code> that skips all nodes except for Text nodes and
- * the root node of a document. In the logical view that results, all text
- * nodes will be siblings and appear as direct children of the root node, no
- * matter how deeply nested the structure of the original document.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113'>Document Object Model (DOM) Level 2 Traversal and Range Specification</a>.
- * @since DOM Level 2
- */
-public interface TreeWalker {
- /**
- * The <code>root</code> node of the <code>TreeWalker</code>, as specified
- * when it was created.
- */
- public Node getRoot();
-
- /**
- * This attribute determines which node types are presented via the
- * <code>TreeWalker</code>. The available set of constants is defined in
- * the <code>NodeFilter</code> interface. Nodes not accepted by
- * <code>whatToShow</code> will be skipped, but their children may still
- * be considered. Note that this skip takes precedence over the filter,
- * if any.
- */
- public int getWhatToShow();
-
- /**
- * The filter used to screen nodes.
- */
- public NodeFilter getFilter();
-
- /**
- * The value of this flag determines whether the children of entity
- * reference nodes are visible to the <code>TreeWalker</code>. If false,
- * these children and their descendants will be rejected. Note that
- * this rejection takes precedence over <code>whatToShow</code> and the
- * filter, if any.
- * <br> To produce a view of the document that has entity references
- * expanded and does not expose the entity reference node itself, use
- * the <code>whatToShow</code> flags to hide the entity reference node
- * and set <code>expandEntityReferences</code> to true when creating the
- * <code>TreeWalker</code>. To produce a view of the document that has
- * entity reference nodes but no entity expansion, use the
- * <code>whatToShow</code> flags to show the entity reference node and
- * set <code>expandEntityReferences</code> to false.
- */
- public boolean getExpandEntityReferences();
-
- /**
- * The node at which the <code>TreeWalker</code> is currently positioned.
- * <br>Alterations to the DOM tree may cause the current node to no longer
- * be accepted by the <code>TreeWalker</code>'s associated filter.
- * <code>currentNode</code> may also be explicitly set to any node,
- * whether or not it is within the subtree specified by the
- * <code>root</code> node or would be accepted by the filter and
- * <code>whatToShow</code> flags. Further traversal occurs relative to
- * <code>currentNode</code> even if it is not part of the current view,
- * by applying the filters in the requested direction; if no traversal
- * is possible, <code>currentNode</code> is not changed.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if an attempt is made to set
- * <code>currentNode</code> to <code>null</code>.
- */
- public Node getCurrentNode();
- /**
- * The node at which the <code>TreeWalker</code> is currently positioned.
- * <br>Alterations to the DOM tree may cause the current node to no longer
- * be accepted by the <code>TreeWalker</code>'s associated filter.
- * <code>currentNode</code> may also be explicitly set to any node,
- * whether or not it is within the subtree specified by the
- * <code>root</code> node or would be accepted by the filter and
- * <code>whatToShow</code> flags. Further traversal occurs relative to
- * <code>currentNode</code> even if it is not part of the current view,
- * by applying the filters in the requested direction; if no traversal
- * is possible, <code>currentNode</code> is not changed.
- * @exception DOMException
- * NOT_SUPPORTED_ERR: Raised if an attempt is made to set
- * <code>currentNode</code> to <code>null</code>.
- */
- public void setCurrentNode(Node currentNode)
- throws DOMException;
-
- /**
- * Moves to and returns the closest visible ancestor node of the current
- * node. If the search for <code>parentNode</code> attempts to step
- * upward from the <code>TreeWalker</code>'s <code>root</code> node, or
- * if it fails to find a visible ancestor node, this method retains the
- * current position and returns <code>null</code>.
- * @return The new parent node, or <code>null</code> if the current node
- * has no parent in the <code>TreeWalker</code>'s logical view.
- */
- public Node parentNode();
-
- /**
- * Moves the <code>TreeWalker</code> to the first visible child of the
- * current node, and returns the new node. If the current node has no
- * visible children, returns <code>null</code>, and retains the current
- * node.
- * @return The new node, or <code>null</code> if the current node has no
- * visible children in the <code>TreeWalker</code>'s logical view.
- */
- public Node firstChild();
-
- /**
- * Moves the <code>TreeWalker</code> to the last visible child of the
- * current node, and returns the new node. If the current node has no
- * visible children, returns <code>null</code>, and retains the current
- * node.
- * @return The new node, or <code>null</code> if the current node has no
- * children in the <code>TreeWalker</code>'s logical view.
- */
- public Node lastChild();
-
- /**
- * Moves the <code>TreeWalker</code> to the previous sibling of the
- * current node, and returns the new node. If the current node has no
- * visible previous sibling, returns <code>null</code>, and retains the
- * current node.
- * @return The new node, or <code>null</code> if the current node has no
- * previous sibling. in the <code>TreeWalker</code>'s logical view.
- */
- public Node previousSibling();
-
- /**
- * Moves the <code>TreeWalker</code> to the next sibling of the current
- * node, and returns the new node. If the current node has no visible
- * next sibling, returns <code>null</code>, and retains the current node.
- * @return The new node, or <code>null</code> if the current node has no
- * next sibling. in the <code>TreeWalker</code>'s logical view.
- */
- public Node nextSibling();
-
- /**
- * Moves the <code>TreeWalker</code> to the previous visible node in
- * document order relative to the current node, and returns the new
- * node. If the current node has no previous node, or if the search for
- * <code>previousNode</code> attempts to step upward from the
- * <code>TreeWalker</code>'s <code>root</code> node, returns
- * <code>null</code>, and retains the current node.
- * @return The new node, or <code>null</code> if the current node has no
- * previous node in the <code>TreeWalker</code>'s logical view.
- */
- public Node previousNode();
-
- /**
- * Moves the <code>TreeWalker</code> to the next visible node in document
- * order relative to the current node, and returns the new node. If the
- * current node has no next node, or if the search for nextNode attempts
- * to step upward from the <code>TreeWalker</code>'s <code>root</code>
- * node, returns <code>null</code>, and retains the current node.
- * @return The new node, or <code>null</code> if the current node has no
- * next node in the <code>TreeWalker</code>'s logical view.
- */
- public Node nextNode();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/traversal/package.html b/external/jaxp/source/org/w3c/dom/traversal/package.html
deleted file mode 100755
index f3caf0697..000000000
--- a/external/jaxp/source/org/w3c/dom/traversal/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports the optional
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Traversal-Range-20001113/"
->"Traversal"</a> feature of the
-DOM Level 2 Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/w3c/dom/views/AbstractView.java b/external/jaxp/source/org/w3c/dom/views/AbstractView.java
deleted file mode 100755
index 97e8f0e2b..000000000
--- a/external/jaxp/source/org/w3c/dom/views/AbstractView.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.views;
-
-/**
- * A base interface that all views shall derive from.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113'>Document Object Model (DOM) Level 2 Views Specification</a>.
- * @since DOM Level 2
- */
-public interface AbstractView {
- /**
- * The source <code>DocumentView</code> of which this is an
- * <code>AbstractView</code>.
- */
- public DocumentView getDocument();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/views/DocumentView.java b/external/jaxp/source/org/w3c/dom/views/DocumentView.java
deleted file mode 100755
index 2cb9eebb8..000000000
--- a/external/jaxp/source/org/w3c/dom/views/DocumentView.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2000 World Wide Web Consortium,
- * (Massachusetts Institute of Technology, Institut National de
- * Recherche en Informatique et en Automatique, Keio University). All
- * Rights Reserved. This program is distributed under the W3C's Software
- * Intellectual Property License. This program is distributed in the
- * hope that it will be useful, but WITHOUT ANY WARRANTY; without even
- * the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.
- * See W3C License http://www.w3.org/Consortium/Legal/ for more details.
- */
-
-package org.w3c.dom.views;
-
-/**
- * The <code>DocumentView</code> interface is implemented by
- * <code>Document</code> objects in DOM implementations supporting DOM
- * Views. It provides an attribute to retrieve the default view of a
- * document.
- * <p>See also the <a href='http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113'>Document Object Model (DOM) Level 2 Views Specification</a>.
- * @since DOM Level 2
- */
-public interface DocumentView {
- /**
- * The default <code>AbstractView</code> for this <code>Document</code>,
- * or <code>null</code> if none available.
- */
- public AbstractView getDefaultView();
-
-}
diff --git a/external/jaxp/source/org/w3c/dom/views/package.html b/external/jaxp/source/org/w3c/dom/views/package.html
deleted file mode 100755
index 2582247ee..000000000
--- a/external/jaxp/source/org/w3c/dom/views/package.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html><head>
-<title>yadda yadda</title>
-</head><body>
-
-<p>Supports the optional
-<a href="http://www.w3.org/TR/2000/REC-DOM-Level-2-Views-20001113/"
->"Views"</a> feature of the
-DOM Level 2 Recommendation. </p>
-
-</body></html>
diff --git a/external/jaxp/source/org/xml/sax/AttributeList.java b/external/jaxp/source/org/xml/sax/AttributeList.java
deleted file mode 100755
index 0d6405759..000000000
--- a/external/jaxp/source/org/xml/sax/AttributeList.java
+++ /dev/null
@@ -1,192 +0,0 @@
-// SAX Attribute List Interface.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-/**
- * Interface for an element's attribute specifications.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This is the original SAX1 interface for reporting an element's
- * attributes. Unlike the new {@link org.xml.sax.Attributes Attributes}
- * interface, it does not support Namespace-related information.</p>
- *
- * <p>When an attribute list is supplied as part of a
- * {@link org.xml.sax.DocumentHandler#startElement startElement}
- * event, the list will return valid results only during the
- * scope of the event; once the event handler returns control
- * to the parser, the attribute list is invalid. To save a
- * persistent copy of the attribute list, use the SAX1
- * {@link org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
- * helper class.</p>
- *
- * <p>An attribute list includes only attributes that have been
- * specified or defaulted: #IMPLIED attributes will not be included.</p>
- *
- * <p>There are two ways for the SAX application to obtain information
- * from the AttributeList. First, it can iterate through the entire
- * list:</p>
- *
- * <pre>
- * public void startElement (String name, AttributeList atts) {
- * for (int i = 0; i < atts.getLength(); i++) {
- * String name = atts.getName(i);
- * String type = atts.getType(i);
- * String value = atts.getValue(i);
- * [...]
- * }
- * }
- * </pre>
- *
- * <p>(Note that the result of getLength() will be zero if there
- * are no attributes.)
- *
- * <p>As an alternative, the application can request the value or
- * type of specific attributes:</p>
- *
- * <pre>
- * public void startElement (String name, AttributeList atts) {
- * String identifier = atts.getValue("id");
- * String label = atts.getValue("label");
- * [...]
- * }
- * </pre>
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.Attributes Attributes}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.DocumentHandler#startElement startElement
- * @see org.xml.sax.helpers.AttributeListImpl AttributeListImpl
- */
-public interface AttributeList {
-
-
- ////////////////////////////////////////////////////////////////////
- // Iteration methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in this list.
- *
- * <p>The SAX parser may provide attributes in any
- * arbitrary order, regardless of the order in which they were
- * declared or specified. The number of attributes may be
- * zero.</p>
- *
- * @return The number of attributes in the list.
- */
- public abstract int getLength ();
-
-
- /**
- * Return the name of an attribute in this list (by position).
- *
- * <p>The names must be unique: the SAX parser shall not include the
- * same attribute twice. Attributes without values (those declared
- * #IMPLIED without a value specified in the start tag) will be
- * omitted from the list.</p>
- *
- * <p>If the attribute name has a namespace prefix, the prefix
- * will still be attached.</p>
- *
- * @param i The index of the attribute in the list (starting at 0).
- * @return The name of the indexed attribute, or null
- * if the index is out of range.
- * @see #getLength
- */
- public abstract String getName (int i);
-
-
- /**
- * Return the type of an attribute in the list (by position).
- *
- * <p>The attribute type is one of the strings "CDATA", "ID",
- * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
- * or "NOTATION" (always in upper case).</p>
- *
- * <p>If the parser has not read a declaration for the attribute,
- * or if the parser does not report attribute types, then it must
- * return the value "CDATA" as stated in the XML 1.0 Recommentation
- * (clause 3.3.3, "Attribute-Value Normalization").</p>
- *
- * <p>For an enumerated attribute that is not a notation, the
- * parser will report the type as "NMTOKEN".</p>
- *
- * @param i The index of the attribute in the list (starting at 0).
- * @return The attribute type as a string, or
- * null if the index is out of range.
- * @see #getLength
- * @see #getType(java.lang.String)
- */
- public abstract String getType (int i);
-
-
- /**
- * Return the value of an attribute in the list (by position).
- *
- * <p>If the attribute value is a list of tokens (IDREFS,
- * ENTITIES, or NMTOKENS), the tokens will be concatenated
- * into a single string separated by whitespace.</p>
- *
- * @param i The index of the attribute in the list (starting at 0).
- * @return The attribute value as a string, or
- * null if the index is out of range.
- * @see #getLength
- * @see #getValue(java.lang.String)
- */
- public abstract String getValue (int i);
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Lookup methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the type of an attribute in the list (by name).
- *
- * <p>The return value is the same as the return value for
- * getType(int).</p>
- *
- * <p>If the attribute name has a namespace prefix in the document,
- * the application must include the prefix here.</p>
- *
- * @param name The name of the attribute.
- * @return The attribute type as a string, or null if no
- * such attribute exists.
- * @see #getType(int)
- */
- public abstract String getType (String name);
-
-
- /**
- * Return the value of an attribute in the list (by name).
- *
- * <p>The return value is the same as the return value for
- * getValue(int).</p>
- *
- * <p>If the attribute name has a namespace prefix in the document,
- * the application must include the prefix here.</p>
- *
- * @param i The index of the attribute in the list.
- * @return The attribute value as a string, or null if
- * no such attribute exists.
- * @see #getValue(int)
- */
- public abstract String getValue (String name);
-
-}
-
-// end of AttributeList.java
diff --git a/external/jaxp/source/org/xml/sax/Attributes.java b/external/jaxp/source/org/xml/sax/Attributes.java
deleted file mode 100755
index 7affd992a..000000000
--- a/external/jaxp/source/org/xml/sax/Attributes.java
+++ /dev/null
@@ -1,249 +0,0 @@
-// Attributes.java - attribute list with Namespace support
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the public domain.
-
-package org.xml.sax;
-
-
-/**
- * Interface for a list of XML attributes.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This interface allows access to a list of attributes in
- * three different ways:</p>
- *
- * <ol>
- * <li>by attribute index;</li>
- * <li>by Namespace-qualified name; or</li>
- * <li>by qualified (prefixed) name.</li>
- * </ol>
- *
- * <p>The list will not contain attributes that were declared
- * #IMPLIED but not specified in the start tag. It will also not
- * contain attributes used as Namespace declarations (xmlns*) unless
- * the <code>http://xml.org/sax/features/namespace-prefixes</code>
- * feature is set to <var>true</var> (it is <var>false</var> by
- * default).
- * Because SAX2 conforms to the "Namespaces in XML" specification,
- * it does not give namespace declaration attributes a namespace URI.
- * Some other W3C specifications are in conflict with that, expecting
- * these declarations to be in a namespace.
- * Handler code may need to resolve that conflict.
- * </p>
- *
- * <p>If the namespace-prefixes feature (see above) is <var>false</var>,
- * access by qualified name may not be available; if the
- * <code>http://xml.org/sax/features/namespaces</code>
- * feature is <var>false</var>, access by Namespace-qualified names
- * may not be available.</p>
- *
- * <p>This interface replaces the now-deprecated SAX1 {@link
- * org.xml.sax.AttributeList AttributeList} interface, which does not
- * contain Namespace support. In addition to Namespace support, it
- * adds the <var>getIndex</var> methods (below).</p>
- *
- * <p>The order of attributes in the list is unspecified, and will
- * vary from implementation to implementation.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.helpers.AttributesImpl
- * @see org.xml.sax.ext.DeclHandler#attributeDecl
- */
-public interface Attributes
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Indexed access.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in the list.
- *
- * <p>Once you know the number of attributes, you can iterate
- * through the list.</p>
- *
- * @return The number of attributes in the list.
- * @see #getURI(int)
- * @see #getLocalName(int)
- * @see #getQName(int)
- * @see #getType(int)
- * @see #getValue(int)
- */
- public abstract int getLength ();
-
-
- /**
- * Look up an attribute's Namespace URI by index.
- *
- * @param index The attribute index (zero-based).
- * @return The Namespace URI, or the empty string if none
- * is available, or null if the index is out of
- * range.
- * @see #getLength
- */
- public abstract String getURI (int index);
-
-
- /**
- * Look up an attribute's local name by index.
- *
- * @param index The attribute index (zero-based).
- * @return The local name, or the empty string if Namespace
- * processing is not being performed, or null
- * if the index is out of range.
- * @see #getLength
- */
- public abstract String getLocalName (int index);
-
-
- /**
- * Look up an attribute's XML 1.0 qualified name by index.
- *
- * @param index The attribute index (zero-based).
- * @return The XML 1.0 qualified name, or the empty string
- * if none is available, or null if the index
- * is out of range.
- * @see #getLength
- */
- public abstract String getQName (int index);
-
-
- /**
- * Look up an attribute's type by index.
- *
- * <p>The attribute type is one of the strings "CDATA", "ID",
- * "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY", "ENTITIES",
- * or "NOTATION" (always in upper case).</p>
- *
- * <p>If the parser has not read a declaration for the attribute,
- * or if the parser does not report attribute types, then it must
- * return the value "CDATA" as stated in the XML 1.0 Recommentation
- * (clause 3.3.3, "Attribute-Value Normalization").</p>
- *
- * <p>For an enumerated attribute that is not a notation, the
- * parser will report the type as "NMTOKEN".</p>
- *
- * @param index The attribute index (zero-based).
- * @return The attribute's type as a string, or null if the
- * index is out of range.
- * @see #getLength
- */
- public abstract String getType (int index);
-
-
- /**
- * Look up an attribute's value by index.
- *
- * <p>If the attribute value is a list of tokens (IDREFS,
- * ENTITIES, or NMTOKENS), the tokens will be concatenated
- * into a single string with each token separated by a
- * single space.</p>
- *
- * @param index The attribute index (zero-based).
- * @return The attribute's value as a string, or null if the
- * index is out of range.
- * @see #getLength
- */
- public abstract String getValue (int index);
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Name-based query.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Look up the index of an attribute by Namespace name.
- *
- * @param uri The Namespace URI, or the empty string if
- * the name has no Namespace URI.
- * @param localName The attribute's local name.
- * @return The index of the attribute, or -1 if it does not
- * appear in the list.
- */
- public int getIndex (String uri, String localName);
-
-
- /**
- * Look up the index of an attribute by XML 1.0 qualified name.
- *
- * @param qName The qualified (prefixed) name.
- * @return The index of the attribute, or -1 if it does not
- * appear in the list.
- */
- public int getIndex (String qName);
-
-
- /**
- * Look up an attribute's type by Namespace name.
- *
- * <p>See {@link #getType(int) getType(int)} for a description
- * of the possible types.</p>
- *
- * @param uri The Namespace URI, or the empty String if the
- * name has no Namespace URI.
- * @param localName The local name of the attribute.
- * @return The attribute type as a string, or null if the
- * attribute is not in the list or if Namespace
- * processing is not being performed.
- */
- public abstract String getType (String uri, String localName);
-
-
- /**
- * Look up an attribute's type by XML 1.0 qualified name.
- *
- * <p>See {@link #getType(int) getType(int)} for a description
- * of the possible types.</p>
- *
- * @param qName The XML 1.0 qualified name.
- * @return The attribute type as a string, or null if the
- * attribute is not in the list or if qualified names
- * are not available.
- */
- public abstract String getType (String qName);
-
-
- /**
- * Look up an attribute's value by Namespace name.
- *
- * <p>See {@link #getValue(int) getValue(int)} for a description
- * of the possible values.</p>
- *
- * @param uri The Namespace URI, or the empty String if the
- * name has no Namespace URI.
- * @param localName The local name of the attribute.
- * @return The attribute value as a string, or null if the
- * attribute is not in the list.
- */
- public abstract String getValue (String uri, String localName);
-
-
- /**
- * Look up an attribute's value by XML 1.0 qualified name.
- *
- * <p>See {@link #getValue(int) getValue(int)} for a description
- * of the possible values.</p>
- *
- * @param qName The XML 1.0 qualified name.
- * @return The attribute value as a string, or null if the
- * attribute is not in the list or if qualified names
- * are not available.
- */
- public abstract String getValue (String qName);
-
-}
-
-// end of Attributes.java
diff --git a/external/jaxp/source/org/xml/sax/ContentHandler.java b/external/jaxp/source/org/xml/sax/ContentHandler.java
deleted file mode 100755
index e1b68ae02..000000000
--- a/external/jaxp/source/org/xml/sax/ContentHandler.java
+++ /dev/null
@@ -1,406 +0,0 @@
-// ContentHandler.java - handle main document content.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the public domain.
-
-package org.xml.sax;
-
-
-/**
- * Receive notification of the logical content of a document.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This is the main interface that most SAX applications
- * implement: if the application needs to be informed of basic parsing
- * events, it implements this interface and registers an instance with
- * the SAX parser using the {@link org.xml.sax.XMLReader#setContentHandler
- * setContentHandler} method. The parser uses the instance to report
- * basic document-related events like the start and end of elements
- * and character data.</p>
- *
- * <p>The order of events in this interface is very important, and
- * mirrors the order of information in the document itself. For
- * example, all of an element's content (character data, processing
- * instructions, and/or subelements) will appear, in order, between
- * the startElement event and the corresponding endElement event.</p>
- *
- * <p>This interface is similar to the now-deprecated SAX 1.0
- * DocumentHandler interface, but it adds support for Namespaces
- * and for reporting skipped entities (in non-validating XML
- * processors).</p>
- *
- * <p>Implementors should note that there is also a Java class
- * {@link java.net.ContentHandler ContentHandler} in the java.net
- * package; that means that it's probably a bad idea to do</p>
- *
- * <blockquote>
- * import java.net.*;
- * import org.xml.sax.*;
- * </blockquote>
- *
- * <p>In fact, "import ...*" is usually a sign of sloppy programming
- * anyway, so the user should consider this a feature rather than a
- * bug.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.ErrorHandler
- */
-public interface ContentHandler
-{
-
- /**
- * Receive an object for locating the origin of SAX document events.
- *
- * <p>SAX parsers are strongly encouraged (though not absolutely
- * required) to supply a locator: if it does so, it must supply
- * the locator to the application by invoking this method before
- * invoking any of the other methods in the ContentHandler
- * interface.</p>
- *
- * <p>The locator allows the application to determine the end
- * position of any document-related event, even if the parser is
- * not reporting an error. Typically, the application will
- * use this information for reporting its own errors (such as
- * character content that does not match an application's
- * business rules). The information returned by the locator
- * is probably not sufficient for use with a search engine.</p>
- *
- * <p>Note that the locator will return correct information only
- * during the invocation of the events in this interface. The
- * application should not attempt to use it at any other time.</p>
- *
- * @param locator An object that can return the location of
- * any SAX document event.
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator (Locator locator);
-
-
- /**
- * Receive notification of the beginning of a document.
- *
- * <p>The SAX parser will invoke this method only once, before any
- * other event callbacks (except for {@link #setDocumentLocator
- * setDocumentLocator}).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #endDocument
- */
- public void startDocument ()
- throws SAXException;
-
-
- /**
- * Receive notification of the end of a document.
- *
- * <p>The SAX parser will invoke this method only once, and it will
- * be the last method invoked during the parse. The parser shall
- * not invoke this method until it has either abandoned parsing
- * (because of an unrecoverable error) or reached the end of
- * input.</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #startDocument
- */
- public void endDocument()
- throws SAXException;
-
-
- /**
- * Begin the scope of a prefix-URI Namespace mapping.
- *
- * <p>The information from this event is not necessary for
- * normal Namespace processing: the SAX XML reader will
- * automatically replace prefixes for element and attribute
- * names when the <code>http://xml.org/sax/features/namespaces</code>
- * feature is <var>true</var> (the default).</p>
- *
- * <p>There are cases, however, when applications need to
- * use prefixes in character data or in attribute values,
- * where they cannot safely be expanded automatically; the
- * start/endPrefixMapping event supplies the information
- * to the application to expand prefixes in those contexts
- * itself, if necessary.</p>
- *
- * <p>Note that start/endPrefixMapping events are not
- * guaranteed to be properly nested relative to each other:
- * all startPrefixMapping events will occur immediately before the
- * corresponding {@link #startElement startElement} event,
- * and all {@link #endPrefixMapping endPrefixMapping}
- * events will occur immediately after the corresponding
- * {@link #endElement endElement} event,
- * but their order is not otherwise
- * guaranteed.</p>
- *
- * <p>There should never be start/endPrefixMapping events for the
- * "xml" prefix, since it is predeclared and immutable.</p>
- *
- * @param prefix The Namespace prefix being declared.
- * An empty string is used for the default element namespace,
- * which has no prefix.
- * @param uri The Namespace URI the prefix is mapped to.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see #endPrefixMapping
- * @see #startElement
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException;
-
-
- /**
- * End the scope of a prefix-URI mapping.
- *
- * <p>See {@link #startPrefixMapping startPrefixMapping} for
- * details. These events will always occur immediately after the
- * corresponding {@link #endElement endElement} event, but the order of
- * {@link #endPrefixMapping endPrefixMapping} events is not otherwise
- * guaranteed.</p>
- *
- * @param prefix The prefix that was being mapped.
- * This is the empty string when a default mapping scope ends.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @see #startPrefixMapping
- * @see #endElement
- */
- public void endPrefixMapping (String prefix)
- throws SAXException;
-
-
- /**
- * Receive notification of the beginning of an element.
- *
- * <p>The Parser will invoke this method at the beginning of every
- * element in the XML document; there will be a corresponding
- * {@link #endElement endElement} event for every startElement event
- * (even when the element is empty). All of the element's content will be
- * reported, in order, before the corresponding endElement
- * event.</p>
- *
- * <p>This event allows up to three name components for each
- * element:</p>
- *
- * <ol>
- * <li>the Namespace URI;</li>
- * <li>the local name; and</li>
- * <li>the qualified (prefixed) name.</li>
- * </ol>
- *
- * <p>Any or all of these may be provided, depending on the
- * values of the <var>http://xml.org/sax/features/namespaces</var>
- * and the <var>http://xml.org/sax/features/namespace-prefixes</var>
- * properties:</p>
- *
- * <ul>
- * <li>the Namespace URI and local name are required when
- * the namespaces property is <var>true</var> (the default), and are
- * optional when the namespaces property is <var>false</var> (if one is
- * specified, both must be);</li>
- * <li>the qualified name is required when the namespace-prefixes property
- * is <var>true</var>, and is optional when the namespace-prefixes property
- * is <var>false</var> (the default).</li>
- * </ul>
- *
- * <p>Note that the attribute list provided will contain only
- * attributes with explicit values (specified or defaulted):
- * #IMPLIED attributes will be omitted. The attribute list
- * will contain attributes used for Namespace declarations
- * (xmlns* attributes) only if the
- * <code>http://xml.org/sax/features/namespace-prefixes</code>
- * property is true (it is false by default, and support for a
- * true value is optional).</p>
- *
- * <p>Like {@link #characters characters()}, attribute values may have
- * characters that need more than one <code>char</code> value. </p>
- *
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param qName The qualified name (with prefix), or the
- * empty string if qualified names are not available.
- * @param atts The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #endElement
- * @see org.xml.sax.Attributes
- */
- public void startElement (String uri, String localName,
- String qName, Attributes atts)
- throws SAXException;
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>The SAX parser will invoke this method at the end of every
- * element in the XML document; there will be a corresponding
- * {@link #startElement startElement} event for every endElement
- * event (even when the element is empty).</p>
- *
- * <p>For information on the names, see startElement.</p>
- *
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param qName The qualified XML 1.0 name (with prefix), or the
- * empty string if qualified names are not available.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void endElement (String uri, String localName,
- String qName)
- throws SAXException;
-
-
- /**
- * Receive notification of character data.
- *
- * <p>The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
- * data in a single chunk, or they may split it into several
- * chunks; however, all of the characters in any single event
- * must come from the same external entity so that the Locator
- * provides useful information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * <p>Individual characters may consist of more than one Java
- * <code>char</code> value. There are two important cases where this
- * happens, because characters can't be represented in just sixteen bits.
- * In one case, characters are represented in a <em>Surrogate Pair</em>,
- * using two special Unicode values. Such characters are in the so-called
- * "Astral Planes", with a code point above U+FFFF. A second case involves
- * composite characters, such as a base character combining with one or
- * more accent characters. </p>
- *
- * <p> Your code should not assume that algorithms using
- * <code>char</code>-at-a-time idioms will be working in character
- * units; in some cases they will split characters. This is relevant
- * wherever XML permits arbitrary characters, such as attribute values,
- * processing instruction data, and comments as well as in data reported
- * from this method. It's also generally relevant whenever Java code
- * manipulates internationalized text; the issue isn't unique to XML.</p>
- *
- * <p>Note that some parsers will report whitespace in element
- * content using the {@link #ignorableWhitespace ignorableWhitespace}
- * method rather than this one (validating parsers <em>must</em>
- * do so).</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #ignorableWhitespace
- * @see org.xml.sax.Locator
- */
- public void characters (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>Validating Parsers must use this method to report each chunk
- * of whitespace in element content (see the W3C XML 1.0 recommendation,
- * section 2.10): non-validating parsers may also use this method
- * if they are capable of parsing and using content models.</p>
- *
- * <p>SAX parsers may return all contiguous whitespace in a single
- * chunk, or they may split it into several chunks; however, all of
- * the characters in any single event must come from the same
- * external entity, so that the Locator provides useful
- * information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #characters
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>The Parser will invoke this method once for each processing
- * instruction found: note that processing instructions may occur
- * before or after the main document element.</p>
- *
- * <p>A SAX parser must never report an XML declaration (XML 1.0,
- * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
- * using this method.</p>
- *
- * <p>Like {@link #characters characters()}, processing instruction
- * data may have characters that need more than one <code>char</code>
- * value. </p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none was supplied. The data does not include any
- * whitespace separating it from the target.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void processingInstruction (String target, String data)
- throws SAXException;
-
-
- /**
- * Receive notification of a skipped entity.
- * This is not called for entity references within markup constructs
- * such as element start tags or markup declarations. (The XML
- * recommendation requires reporting skipped external entities.
- * SAX also reports internal entity expansion/non-expansion, except
- * within markup constructs.)
- *
- * <p>The Parser will invoke this method each time the entity is
- * skipped. Non-validating processors may skip entities if they
- * have not seen the declarations (because, for example, the
- * entity was declared in an external DTD subset). All processors
- * may skip external entities, depending on the values of the
- * <code>http://xml.org/sax/features/external-general-entities</code>
- * and the
- * <code>http://xml.org/sax/features/external-parameter-entities</code>
- * properties.</p>
- *
- * @param name The name of the skipped entity. If it is a
- * parameter entity, the name will begin with '%', and if
- * it is the external DTD subset, it will be the string
- * "[dtd]".
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void skippedEntity (String name)
- throws SAXException;
-}
-
-// end of ContentHandler.java
diff --git a/external/jaxp/source/org/xml/sax/DTDHandler.java b/external/jaxp/source/org/xml/sax/DTDHandler.java
deleted file mode 100755
index 9c95e9bcf..000000000
--- a/external/jaxp/source/org/xml/sax/DTDHandler.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// SAX DTD handler.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-/**
- * Receive notification of basic DTD-related events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>If a SAX application needs information about notations and
- * unparsed entities, then the application implements this
- * interface and registers an instance with the SAX parser using
- * the parser's setDTDHandler method. The parser uses the
- * instance to report notation and unparsed entity declarations to
- * the application.</p>
- *
- * <p>Note that this interface includes only those DTD events that
- * the XML recommendation <em>requires</em> processors to report:
- * notation and unparsed entity declarations.</p>
- *
- * <p>The SAX parser may report these events in any order, regardless
- * of the order in which the notations and unparsed entities were
- * declared; however, all DTD events must be reported after the
- * document handler's startDocument event, and before the first
- * startElement event.
- * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is
- * used, these events must also be reported before the endDTD event.)
- * </p>
- *
- * <p>It is up to the application to store the information for
- * future use (perhaps in a hash table or object tree).
- * If the application encounters attributes of type "NOTATION",
- * "ENTITY", or "ENTITIES", it can use the information that it
- * obtained through this interface to find the entity and/or
- * notation corresponding with the attribute value.</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLReader#setDTDHandler
- */
-public interface DTDHandler {
-
-
- /**
- * Receive notification of a notation declaration event.
- *
- * <p>It is up to the application to record the notation for later
- * reference, if necessary;
- * notations may appear as attribute values and in unparsed entity
- * declarations, and are sometime used with processing instruction
- * target names.</p>
- *
- * <p>At least one of publicId and systemId must be non-null.
- * If a system identifier is present, and it is a URL, the SAX
- * parser must resolve it fully before passing it to the
- * application through this event.</p>
- *
- * <p>There is no guarantee that the notation declaration will be
- * reported before any unparsed entities that use it.</p>
- *
- * @param name The notation name.
- * @param publicId The notation's public identifier, or null if
- * none was given.
- * @param systemId The notation's system identifier, or null if
- * none was given.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #unparsedEntityDecl
- * @see org.xml.sax.Attributes
- */
- public abstract void notationDecl (String name,
- String publicId,
- String systemId)
- throws SAXException;
-
-
- /**
- * Receive notification of an unparsed entity declaration event.
- *
- * <p>Note that the notation name corresponds to a notation
- * reported by the {@link #notationDecl notationDecl} event.
- * It is up to the application to record the entity for later
- * reference, if necessary;
- * unparsed entities may appear as attribute values.
- * </p>
- *
- * <p>If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application.</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @param name The unparsed entity's name.
- * @param publicId The entity's public identifier, or null if none
- * was given.
- * @param systemId The entity's system identifier.
- * @param notationName The name of the associated notation.
- * @see #notationDecl
- * @see org.xml.sax.Attributes
- */
- public abstract void unparsedEntityDecl (String name,
- String publicId,
- String systemId,
- String notationName)
- throws SAXException;
-
-}
-
-// end of DTDHandler.java
diff --git a/external/jaxp/source/org/xml/sax/DocumentHandler.java b/external/jaxp/source/org/xml/sax/DocumentHandler.java
deleted file mode 100755
index 7d925a260..000000000
--- a/external/jaxp/source/org/xml/sax/DocumentHandler.java
+++ /dev/null
@@ -1,231 +0,0 @@
-// SAX document handler.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-/**
- * Receive notification of general document events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This was the main event-handling interface for SAX1; in
- * SAX2, it has been replaced by {@link org.xml.sax.ContentHandler
- * ContentHandler}, which provides Namespace support and reporting
- * of skipped entities. This interface is included in SAX2 only
- * to support legacy SAX1 applications.</p>
- *
- * <p>The order of events in this interface is very important, and
- * mirrors the order of information in the document itself. For
- * example, all of an element's content (character data, processing
- * instructions, and/or subelements) will appear, in order, between
- * the startElement event and the corresponding endElement event.</p>
- *
- * <p>Application writers who do not want to implement the entire
- * interface can derive a class from HandlerBase, which implements
- * the default functionality; parser writers can instantiate
- * HandlerBase to obtain a default handler. The application can find
- * the location of any document event using the Locator interface
- * supplied by the Parser through the setDocumentLocator method.</p>
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.ContentHandler ContentHandler}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.Parser#setDocumentHandler
- * @see org.xml.sax.Locator
- * @see org.xml.sax.HandlerBase
- */
-public interface DocumentHandler {
-
-
- /**
- * Receive an object for locating the origin of SAX document events.
- *
- * <p>SAX parsers are strongly encouraged (though not absolutely
- * required) to supply a locator: if it does so, it must supply
- * the locator to the application by invoking this method before
- * invoking any of the other methods in the DocumentHandler
- * interface.</p>
- *
- * <p>The locator allows the application to determine the end
- * position of any document-related event, even if the parser is
- * not reporting an error. Typically, the application will
- * use this information for reporting its own errors (such as
- * character content that does not match an application's
- * business rules). The information returned by the locator
- * is probably not sufficient for use with a search engine.</p>
- *
- * <p>Note that the locator will return correct information only
- * during the invocation of the events in this interface. The
- * application should not attempt to use it at any other time.</p>
- *
- * @param locator An object that can return the location of
- * any SAX document event.
- * @see org.xml.sax.Locator
- */
- public abstract void setDocumentLocator (Locator locator);
-
-
- /**
- * Receive notification of the beginning of a document.
- *
- * <p>The SAX parser will invoke this method only once, before any
- * other methods in this interface or in DTDHandler (except for
- * setDocumentLocator).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void startDocument ()
- throws SAXException;
-
-
- /**
- * Receive notification of the end of a document.
- *
- * <p>The SAX parser will invoke this method only once, and it will
- * be the last method invoked during the parse. The parser shall
- * not invoke this method until it has either abandoned parsing
- * (because of an unrecoverable error) or reached the end of
- * input.</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void endDocument ()
- throws SAXException;
-
-
- /**
- * Receive notification of the beginning of an element.
- *
- * <p>The Parser will invoke this method at the beginning of every
- * element in the XML document; there will be a corresponding
- * endElement() event for every startElement() event (even when the
- * element is empty). All of the element's content will be
- * reported, in order, before the corresponding endElement()
- * event.</p>
- *
- * <p>If the element name has a namespace prefix, the prefix will
- * still be attached. Note that the attribute list provided will
- * contain only attributes with explicit values (specified or
- * defaulted): #IMPLIED attributes will be omitted.</p>
- *
- * @param name The element type name.
- * @param atts The attributes attached to the element, if any.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #endElement
- * @see org.xml.sax.AttributeList
- */
- public abstract void startElement (String name, AttributeList atts)
- throws SAXException;
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>The SAX parser will invoke this method at the end of every
- * element in the XML document; there will be a corresponding
- * startElement() event for every endElement() event (even when the
- * element is empty).</p>
- *
- * <p>If the element name has a namespace prefix, the prefix will
- * still be attached to the name.</p>
- *
- * @param name The element type name
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void endElement (String name)
- throws SAXException;
-
-
- /**
- * Receive notification of character data.
- *
- * <p>The Parser will call this method to report each chunk of
- * character data. SAX parsers may return all contiguous character
- * data in a single chunk, or they may split it into several
- * chunks; however, all of the characters in any single event
- * must come from the same external entity, so that the Locator
- * provides useful information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * <p>Note that some parsers will report whitespace using the
- * ignorableWhitespace() method rather than this one (validating
- * parsers must do so).</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #ignorableWhitespace
- * @see org.xml.sax.Locator
- */
- public abstract void characters (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>Validating Parsers must use this method to report each chunk
- * of ignorable whitespace (see the W3C XML 1.0 recommendation,
- * section 2.10): non-validating parsers may also use this method
- * if they are capable of parsing and using content models.</p>
- *
- * <p>SAX parsers may return all contiguous whitespace in a single
- * chunk, or they may split it into several chunks; however, all of
- * the characters in any single event must come from the same
- * external entity, so that the Locator provides useful
- * information.</p>
- *
- * <p>The application must not attempt to read from the array
- * outside of the specified range.</p>
- *
- * @param ch The characters from the XML document.
- * @param start The start position in the array.
- * @param length The number of characters to read from the array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see #characters
- */
- public abstract void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException;
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>The Parser will invoke this method once for each processing
- * instruction found: note that processing instructions may occur
- * before or after the main document element.</p>
- *
- * <p>A SAX parser should never report an XML declaration (XML 1.0,
- * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
- * using this method.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none was supplied.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public abstract void processingInstruction (String target, String data)
- throws SAXException;
-
-}
-
-// end of DocumentHandler.java
diff --git a/external/jaxp/source/org/xml/sax/EntityResolver.java b/external/jaxp/source/org/xml/sax/EntityResolver.java
deleted file mode 100755
index 4a0ecd964..000000000
--- a/external/jaxp/source/org/xml/sax/EntityResolver.java
+++ /dev/null
@@ -1,118 +0,0 @@
-// SAX entity resolver.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-import java.io.IOException;
-
-
-/**
- * Basic interface for resolving entities.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>If a SAX application needs to implement customized handling
- * for external entities, it must implement this interface and
- * register an instance with the SAX driver using the
- * {@link org.xml.sax.XMLReader#setEntityResolver setEntityResolver}
- * method.</p>
- *
- * <p>The XML reader will then allow the application to intercept any
- * external entities (including the external DTD subset and external
- * parameter entities, if any) before including them.</p>
- *
- * <p>Many SAX applications will not need to implement this interface,
- * but it will be especially useful for applications that build
- * XML documents from databases or other specialised input sources,
- * or for applications that use URI types other than URLs.</p>
- *
- * <p>The following resolver would provide the application
- * with a special character stream for the entity with the system
- * identifier "http://www.myhost.com/today":</p>
- *
- * <pre>
- * import org.xml.sax.EntityResolver;
- * import org.xml.sax.InputSource;
- *
- * public class MyResolver implements EntityResolver {
- * public InputSource resolveEntity (String publicId, String systemId)
- * {
- * if (systemId.equals("http://www.myhost.com/today")) {
- * // return a special input source
- * MyReader reader = new MyReader();
- * return new InputSource(reader);
- * } else {
- * // use the default behaviour
- * return null;
- * }
- * }
- * }
- * </pre>
- *
- * <p>The application can also use this interface to redirect system
- * identifiers to local URIs or to look up replacements in a catalog
- * (possibly by using the public identifier).</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLReader#setEntityResolver
- * @see org.xml.sax.InputSource
- */
-public interface EntityResolver {
-
-
- /**
- * Allow the application to resolve external entities.
- *
- * <p>The parser will call this method before opening any external
- * entity except the top-level document entity. Such entities include
- * the external DTD subset and external parameter entities referenced
- * within the DTD (in either case, only if the parser reads external
- * parameter entities), and external general entities referenced
- * within the document element (if the parser reads external general
- * entities). The application may request that the parser locate
- * the entity itself, that it use an alternative URI, or that it
- * use data provided by the application (as a character or byte
- * input stream).</p>
- *
- * <p>Application writers can use this method to redirect external
- * system identifiers to secure and/or local URIs, to look up
- * public identifiers in a catalogue, or to read an entity from a
- * database or other input source (including, for example, a dialog
- * box). Neither XML nor SAX specifies a preferred policy for using
- * public or system IDs to resolve resources. However, SAX specifies
- * how to interpret any InputSource returned by this method, and that
- * if none is returned, then the system ID will be dereferenced as
- * a URL. </p>
- *
- * <p>If the system identifier is a URL, the SAX parser must
- * resolve it fully before reporting it to the application.</p>
- *
- * @param publicId The public identifier of the external entity
- * being referenced, or null if none was supplied.
- * @param systemId The system identifier of the external entity
- * being referenced.
- * @return An InputSource object describing the new input source,
- * or null to request that the parser open a regular
- * URI connection to the system identifier.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException A Java-specific IO exception,
- * possibly the result of creating a new InputStream
- * or Reader for the InputSource.
- * @see org.xml.sax.InputSource
- */
- public abstract InputSource resolveEntity (String publicId,
- String systemId)
- throws SAXException, IOException;
-
-}
-
-// end of EntityResolver.java
diff --git a/external/jaxp/source/org/xml/sax/ErrorHandler.java b/external/jaxp/source/org/xml/sax/ErrorHandler.java
deleted file mode 100755
index e3d304709..000000000
--- a/external/jaxp/source/org/xml/sax/ErrorHandler.java
+++ /dev/null
@@ -1,124 +0,0 @@
-// SAX error handler.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-
-/**
- * Basic interface for SAX error handlers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>If a SAX application needs to implement customized error
- * handling, it must implement this interface and then register an
- * instance with the XML reader using the
- * {@link org.xml.sax.XMLReader#setErrorHandler setErrorHandler}
- * method. The parser will then report all errors and warnings
- * through this interface.</p>
- *
- * <p><strong>WARNING:</strong> If an application does <em>not</em>
- * register an ErrorHandler, XML parsing errors will go unreported
- * and bizarre behaviour may result.</p>
- *
- * <p>For XML processing errors, a SAX driver must use this interface
- * instead of throwing an exception: it is up to the application
- * to decide whether to throw an exception for different types of
- * errors and warnings. Note, however, that there is no requirement that
- * the parser continue to provide useful information after a call to
- * {@link #fatalError fatalError} (in other words, a SAX driver class
- * could catch an exception and report a fatalError).</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLReader#setErrorHandler
- * @see org.xml.sax.SAXParseException
- */
-public interface ErrorHandler {
-
-
- /**
- * Receive notification of a warning.
- *
- * <p>SAX parsers will use this method to report conditions that
- * are not errors or fatal errors as defined by the XML 1.0
- * recommendation. The default behaviour is to take no action.</p>
- *
- * <p>The SAX parser must continue to provide normal parsing events
- * after invoking this method: it should still be possible for the
- * application to process the document through to the end.</p>
- *
- * <p>Filters may use this method to report other, non-XML warnings
- * as well.</p>
- *
- * @param exception The warning information encapsulated in a
- * SAX parse exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.SAXParseException
- */
- public abstract void warning (SAXParseException exception)
- throws SAXException;
-
-
- /**
- * Receive notification of a recoverable error.
- *
- * <p>This corresponds to the definition of "error" in section 1.2
- * of the W3C XML 1.0 Recommendation. For example, a validating
- * parser would use this callback to report the violation of a
- * validity constraint. The default behaviour is to take no
- * action.</p>
- *
- * <p>The SAX parser must continue to provide normal parsing events
- * after invoking this method: it should still be possible for the
- * application to process the document through to the end. If the
- * application cannot do so, then the parser should report a fatal
- * error even if the XML 1.0 recommendation does not require it to
- * do so.</p>
- *
- * <p>Filters may use this method to report other, non-XML errors
- * as well.</p>
- *
- * @param exception The error information encapsulated in a
- * SAX parse exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.SAXParseException
- */
- public abstract void error (SAXParseException exception)
- throws SAXException;
-
-
- /**
- * Receive notification of a non-recoverable error.
- *
- * <p>This corresponds to the definition of "fatal error" in
- * section 1.2 of the W3C XML 1.0 Recommendation. For example, a
- * parser would use this callback to report the violation of a
- * well-formedness constraint.</p>
- *
- * <p>The application must assume that the document is unusable
- * after the parser has invoked this method, and should continue
- * (if at all) only for the sake of collecting addition error
- * messages: in fact, SAX parsers are free to stop reporting any
- * other events once this method has been invoked.</p>
- *
- * @param exception The error information encapsulated in a
- * SAX parse exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.SAXParseException
- */
- public abstract void fatalError (SAXParseException exception)
- throws SAXException;
-
-}
-
-// end of ErrorHandler.java
diff --git a/external/jaxp/source/org/xml/sax/HandlerBase.java b/external/jaxp/source/org/xml/sax/HandlerBase.java
deleted file mode 100755
index cad622867..000000000
--- a/external/jaxp/source/org/xml/sax/HandlerBase.java
+++ /dev/null
@@ -1,369 +0,0 @@
-// SAX default handler base class.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-/**
- * Default base class for handlers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class implements the default behaviour for four SAX1
- * interfaces: EntityResolver, DTDHandler, DocumentHandler,
- * and ErrorHandler. It is now obsolete, but is included in SAX2 to
- * support legacy SAX1 applications. SAX2 applications should use
- * the {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
- * class instead.</p>
- *
- * <p>Application writers can extend this class when they need to
- * implement only part of an interface; parser writers can
- * instantiate this class to provide default handlers when the
- * application has not supplied its own.</p>
- *
- * <p>Note that the use of this class is optional.</p>
- *
- * @deprecated This class works with the deprecated
- * {@link org.xml.sax.DocumentHandler DocumentHandler}
- * interface. It has been replaced by the SAX2
- * {@link org.xml.sax.helpers.DefaultHandler DefaultHandler}
- * class.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.DocumentHandler
- * @see org.xml.sax.ErrorHandler
- */
-public class HandlerBase
- implements EntityResolver, DTDHandler, DocumentHandler, ErrorHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the EntityResolver interface.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Resolve an external entity.
- *
- * <p>Always return null, so that the parser will use the system
- * identifier provided in the XML document. This method implements
- * the SAX default behaviour: application writers can override it
- * in a subclass to do special translations such as catalog lookups
- * or URI redirection.</p>
- *
- * @param publicId The public identifer, or null if none is
- * available.
- * @param systemId The system identifier provided in the XML
- * document.
- * @return The new input source, or null to require the
- * default behaviour.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.EntityResolver#resolveEntity
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException
- {
- return null;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of DTDHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a notation declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to keep track of the notations
- * declared in a document.</p>
- *
- * @param name The notation name.
- * @param publicId The notation public identifier, or null if not
- * available.
- * @param systemId The notation system identifier.
- * @see org.xml.sax.DTDHandler#notationDecl
- */
- public void notationDecl (String name, String publicId, String systemId)
- {
- // no op
- }
-
-
- /**
- * Receive notification of an unparsed entity declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to keep track of the unparsed entities
- * declared in a document.</p>
- *
- * @param name The entity name.
- * @param publicId The entity public identifier, or null if not
- * available.
- * @param systemId The entity system identifier.
- * @param notationName The name of the associated notation.
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of DocumentHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive a Locator object for document events.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to store the locator for use
- * with other document events.</p>
- *
- * @param locator A locator for all SAX document events.
- * @see org.xml.sax.DocumentHandler#setDocumentLocator
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator (Locator locator)
- {
- // no op
- }
-
-
- /**
- * Receive notification of the beginning of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as allocating the root node of a tree or
- * creating an output file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as finalising a tree or closing an output
- * file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the start of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each element (such as allocating a new tree node or writing
- * output to a file).</p>
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public void startElement (String name, AttributeList attributes)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each element (such as finalising a tree node or writing
- * output to a file).</p>
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#endElement
- */
- public void endElement (String name)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of character data inside an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of character data
- * (such as adding the data to a node or buffer, or printing it to
- * a file).</p>
- *
- * @param ch The characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of ignorable
- * whitespace (such as adding data to a node or buffer, or printing
- * it to a file).</p>
- *
- * @param ch The whitespace characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none is supplied.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DocumentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the ErrorHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a parser warning.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each warning, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void warning (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a recoverable parser error.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each error, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void error (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Report a fatal XML parsing error.
- *
- * <p>The default implementation throws a SAXParseException.
- * Application writers may override this method in a subclass if
- * they need to take specific actions for each fatal error (such as
- * collecting all of the errors into a single report): in any case,
- * the application must stop all regular processing when this
- * method is invoked, since the document is no longer reliable, and
- * the parser may no longer report parsing events.</p>
- *
- * @param e The error information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#fatalError
- * @see org.xml.sax.SAXParseException
- */
- public void fatalError (SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
-}
-
-// end of HandlerBase.java
diff --git a/external/jaxp/source/org/xml/sax/InputSource.java b/external/jaxp/source/org/xml/sax/InputSource.java
deleted file mode 100755
index 9b4791258..000000000
--- a/external/jaxp/source/org/xml/sax/InputSource.java
+++ /dev/null
@@ -1,335 +0,0 @@
-// SAX input source.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-import java.io.Reader;
-import java.io.InputStream;
-
-/**
- * A single input source for an XML entity.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class allows a SAX application to encapsulate information
- * about an input source in a single object, which may include
- * a public identifier, a system identifier, a byte stream (possibly
- * with a specified encoding), and/or a character stream.</p>
- *
- * <p>There are two places that the application can deliver an
- * input source to the parser: as the argument to the Parser.parse
- * method, or as the return value of the EntityResolver.resolveEntity
- * method.</p>
- *
- * <p>The SAX parser will use the InputSource object to determine how
- * to read XML input. If there is a character stream available, the
- * parser will read that stream directly, disregarding any text
- * encoding declaration found in that stream.
- * If there is no character stream, but there is
- * a byte stream, the parser will use that byte stream, using the
- * encoding specified in the InputSource or else (if no encoding is
- * specified) autodetecting the character encoding using an algorithm
- * such as the one in the XML specification. If neither a character
- * stream nor a
- * byte stream is available, the parser will attempt to open a URI
- * connection to the resource identified by the system
- * identifier.</p>
- *
- * <p>An InputSource object belongs to the application: the SAX parser
- * shall never modify it in any way (it may modify a copy if
- * necessary). However, standard processing of both byte and
- * character streams is to close them on as part of end-of-parse cleanup,
- * so applications should not attempt to re-use such streams after they
- * have been handed to a parser. </p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
- * @see org.xml.sax.EntityResolver#resolveEntity
- * @see java.io.InputStream
- * @see java.io.Reader
- */
-public class InputSource {
-
- /**
- * Zero-argument default constructor.
- *
- * @see #setPublicId
- * @see #setSystemId
- * @see #setByteStream
- * @see #setCharacterStream
- * @see #setEncoding
- */
- public InputSource ()
- {
- }
-
-
- /**
- * Create a new input source with a system identifier.
- *
- * <p>Applications may use setPublicId to include a
- * public identifier as well, or setEncoding to specify
- * the character encoding, if known.</p>
- *
- * <p>If the system identifier is a URL, it must be fully
- * resolved (it may not be a relative URL).</p>
- *
- * @param systemId The system identifier (URI).
- * @see #setPublicId
- * @see #setSystemId
- * @see #setByteStream
- * @see #setEncoding
- * @see #setCharacterStream
- */
- public InputSource (String systemId)
- {
- setSystemId(systemId);
- }
-
-
- /**
- * Create a new input source with a byte stream.
- *
- * <p>Application writers should use setSystemId() to provide a base
- * for resolving relative URIs, may use setPublicId to include a
- * public identifier, and may use setEncoding to specify the object's
- * character encoding.</p>
- *
- * @param byteStream The raw byte stream containing the document.
- * @see #setPublicId
- * @see #setSystemId
- * @see #setEncoding
- * @see #setByteStream
- * @see #setCharacterStream
- */
- public InputSource (InputStream byteStream)
- {
- setByteStream(byteStream);
- }
-
-
- /**
- * Create a new input source with a character stream.
- *
- * <p>Application writers should use setSystemId() to provide a base
- * for resolving relative URIs, and may use setPublicId to include a
- * public identifier.</p>
- *
- * <p>The character stream shall not include a byte order mark.</p>
- *
- * @see #setPublicId
- * @see #setSystemId
- * @see #setByteStream
- * @see #setCharacterStream
- */
- public InputSource (Reader characterStream)
- {
- setCharacterStream(characterStream);
- }
-
-
- /**
- * Set the public identifier for this input source.
- *
- * <p>The public identifier is always optional: if the application
- * writer includes one, it will be provided as part of the
- * location information.</p>
- *
- * @param publicId The public identifier as a string.
- * @see #getPublicId
- * @see org.xml.sax.Locator#getPublicId
- * @see org.xml.sax.SAXParseException#getPublicId
- */
- public void setPublicId (String publicId)
- {
- this.publicId = publicId;
- }
-
-
- /**
- * Get the public identifier for this input source.
- *
- * @return The public identifier, or null if none was supplied.
- * @see #setPublicId
- */
- public String getPublicId ()
- {
- return publicId;
- }
-
-
- /**
- * Set the system identifier for this input source.
- *
- * <p>The system identifier is optional if there is a byte stream
- * or a character stream, but it is still useful to provide one,
- * since the application can use it to resolve relative URIs
- * and can include it in error messages and warnings (the parser
- * will attempt to open a connection to the URI only if
- * there is no byte stream or character stream specified).</p>
- *
- * <p>If the application knows the character encoding of the
- * object pointed to by the system identifier, it can register
- * the encoding using the setEncoding method.</p>
- *
- * <p>If the system identifier is a URL, it must be fully
- * resolved (it may not be a relative URL).</p>
- *
- * @param systemId The system identifier as a string.
- * @see #setEncoding
- * @see #getSystemId
- * @see org.xml.sax.Locator#getSystemId
- * @see org.xml.sax.SAXParseException#getSystemId
- */
- public void setSystemId (String systemId)
- {
- this.systemId = systemId;
- }
-
-
- /**
- * Get the system identifier for this input source.
- *
- * <p>The getEncoding method will return the character encoding
- * of the object pointed to, or null if unknown.</p>
- *
- * <p>If the system ID is a URL, it will be fully resolved.</p>
- *
- * @return The system identifier, or null if none was supplied.
- * @see #setSystemId
- * @see #getEncoding
- */
- public String getSystemId ()
- {
- return systemId;
- }
-
-
- /**
- * Set the byte stream for this input source.
- *
- * <p>The SAX parser will ignore this if there is also a character
- * stream specified, but it will use a byte stream in preference
- * to opening a URI connection itself.</p>
- *
- * <p>If the application knows the character encoding of the
- * byte stream, it should set it with the setEncoding method.</p>
- *
- * @param byteStream A byte stream containing an XML document or
- * other entity.
- * @see #setEncoding
- * @see #getByteStream
- * @see #getEncoding
- * @see java.io.InputStream
- */
- public void setByteStream (InputStream byteStream)
- {
- this.byteStream = byteStream;
- }
-
-
- /**
- * Get the byte stream for this input source.
- *
- * <p>The getEncoding method will return the character
- * encoding for this byte stream, or null if unknown.</p>
- *
- * @return The byte stream, or null if none was supplied.
- * @see #getEncoding
- * @see #setByteStream
- */
- public InputStream getByteStream ()
- {
- return byteStream;
- }
-
-
- /**
- * Set the character encoding, if known.
- *
- * <p>The encoding must be a string acceptable for an
- * XML encoding declaration (see section 4.3.3 of the XML 1.0
- * recommendation).</p>
- *
- * <p>This method has no effect when the application provides a
- * character stream.</p>
- *
- * @param encoding A string describing the character encoding.
- * @see #setSystemId
- * @see #setByteStream
- * @see #getEncoding
- */
- public void setEncoding (String encoding)
- {
- this.encoding = encoding;
- }
-
-
- /**
- * Get the character encoding for a byte stream or URI.
- * This value will be ignored when the application provides a
- * character stream.
- *
- * @return The encoding, or null if none was supplied.
- * @see #setByteStream
- * @see #getSystemId
- * @see #getByteStream
- */
- public String getEncoding ()
- {
- return encoding;
- }
-
-
- /**
- * Set the character stream for this input source.
- *
- * <p>If there is a character stream specified, the SAX parser
- * will ignore any byte stream and will not attempt to open
- * a URI connection to the system identifier.</p>
- *
- * @param characterStream The character stream containing the
- * XML document or other entity.
- * @see #getCharacterStream
- * @see java.io.Reader
- */
- public void setCharacterStream (Reader characterStream)
- {
- this.characterStream = characterStream;
- }
-
-
- /**
- * Get the character stream for this input source.
- *
- * @return The character stream, or null if none was supplied.
- * @see #setCharacterStream
- */
- public Reader getCharacterStream ()
- {
- return characterStream;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private String publicId;
- private String systemId;
- private InputStream byteStream;
- private String encoding;
- private Reader characterStream;
-
-}
-
-// end of InputSource.java
diff --git a/external/jaxp/source/org/xml/sax/Locator.java b/external/jaxp/source/org/xml/sax/Locator.java
deleted file mode 100755
index 4428de22f..000000000
--- a/external/jaxp/source/org/xml/sax/Locator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// SAX locator interface for document events.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-
-/**
- * Interface for associating a SAX event with a document location.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>If a SAX parser provides location information to the SAX
- * application, it does so by implementing this interface and then
- * passing an instance to the application using the content
- * handler's {@link org.xml.sax.ContentHandler#setDocumentLocator
- * setDocumentLocator} method. The application can use the
- * object to obtain the location of any other SAX event
- * in the XML source document.</p>
- *
- * <p>Note that the results returned by the object will be valid only
- * during the scope of each callback method: the application
- * will receive unpredictable results if it attempts to use the
- * locator at any other time, or after parsing completes.</p>
- *
- * <p>SAX parsers are not required to supply a locator, but they are
- * very strongly encouraged to do so. If the parser supplies a
- * locator, it must do so before reporting any other document events.
- * If no locator has been set by the time the application receives
- * the {@link org.xml.sax.ContentHandler#startDocument startDocument}
- * event, the application should assume that a locator is not
- * available.</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
-public interface Locator {
-
-
- /**
- * Return the public identifier for the current document event.
- *
- * <p>The return value is the public identifier of the document
- * entity or of the external parsed entity in which the markup
- * triggering the event appears.</p>
- *
- * @return A string containing the public identifier, or
- * null if none is available.
- * @see #getSystemId
- */
- public abstract String getPublicId ();
-
-
- /**
- * Return the system identifier for the current document event.
- *
- * <p>The return value is the system identifier of the document
- * entity or of the external parsed entity in which the markup
- * triggering the event appears.</p>
- *
- * <p>If the system identifier is a URL, the parser must resolve it
- * fully before passing it to the application. For example, a file
- * name must always be provided as a <em>file:...</em> URL, and other
- * kinds of relative URI are also resolved against their bases.</p>
- *
- * @return A string containing the system identifier, or null
- * if none is available.
- * @see #getPublicId
- */
- public abstract String getSystemId ();
-
-
- /**
- * Return the line number where the current document event ends.
- * Lines are delimited by line ends, which are defined in
- * the XML specification.
- *
- * <p><strong>Warning:</strong> The return value from the method
- * is intended only as an approximation for the sake of diagnostics;
- * it is not intended to provide sufficient information
- * to edit the character content of the original XML document.
- * In some cases, these "line" numbers match what would be displayed
- * as columns, and in others they may not match the source text
- * due to internal entity expansion. </p>
- *
- * <p>The return value is an approximation of the line number
- * in the document entity or external parsed entity where the
- * markup triggering the event appears.</p>
- *
- * <p>If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event. The first line is line 1.</p>
- *
- * @return The line number, or -1 if none is available.
- * @see #getColumnNumber
- */
- public abstract int getLineNumber ();
-
-
- /**
- * Return the column number where the current document event ends.
- * This is one-based number of Java <code>char</code> values since
- * the last line end.
- *
- * <p><strong>Warning:</strong> The return value from the method
- * is intended only as an approximation for the sake of diagnostics;
- * it is not intended to provide sufficient information
- * to edit the character content of the original XML document.
- * For example, when lines contain combining character sequences, wide
- * characters, surrogate pairs, or bi-directional text, the value may
- * not correspond to the column in a text editor's display. </p>
- *
- * <p>The return value is an approximation of the column number
- * in the document entity or external parsed entity where the
- * markup triggering the event appears.</p>
- *
- * <p>If possible, the SAX driver should provide the line position
- * of the first character after the text associated with the document
- * event. The first column in each line is column 1.</p>
- *
- * @return The column number, or -1 if none is available.
- * @see #getLineNumber
- */
- public abstract int getColumnNumber ();
-
-}
-
-// end of Locator.java
diff --git a/external/jaxp/source/org/xml/sax/Parser.java b/external/jaxp/source/org/xml/sax/Parser.java
deleted file mode 100755
index 2080b6105..000000000
--- a/external/jaxp/source/org/xml/sax/Parser.java
+++ /dev/null
@@ -1,208 +0,0 @@
-// SAX parser interface.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-import java.io.IOException;
-import java.util.Locale;
-
-
-/**
- * Basic interface for SAX (Simple API for XML) parsers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This was the main event supplier interface for SAX1; it has
- * been replaced in SAX2 by {@link org.xml.sax.XMLReader XMLReader},
- * which includes Namespace support and sophisticated configurability
- * and extensibility.</p>
- *
- * <p>All SAX1 parsers must implement this basic interface: it allows
- * applications to register handlers for different types of events
- * and to initiate a parse from a URI, or a character stream.</p>
- *
- * <p>All SAX1 parsers must also implement a zero-argument constructor
- * (though other constructors are also allowed).</p>
- *
- * <p>SAX1 parsers are reusable but not re-entrant: the application
- * may reuse a parser object (possibly with a different input source)
- * once the first parse has completed successfully, but it may not
- * invoke the parse() methods recursively within a parse.</p>
- *
- * @deprecated This interface has been replaced by the SAX2
- * {@link org.xml.sax.XMLReader XMLReader}
- * interface, which includes Namespace support.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.DocumentHandler
- * @see org.xml.sax.ErrorHandler
- * @see org.xml.sax.HandlerBase
- * @see org.xml.sax.InputSource
- */
-public interface Parser
-{
-
- /**
- * Allow an application to request a locale for errors and warnings.
- *
- * <p>SAX parsers are not required to provide localisation for errors
- * and warnings; if they cannot support the requested locale,
- * however, they must throw a SAX exception. Applications may
- * not request a locale change in the middle of a parse.</p>
- *
- * @param locale A Java Locale object.
- * @exception org.xml.sax.SAXException Throws an exception
- * (using the previous or default locale) if the
- * requested locale is not supported.
- * @see org.xml.sax.SAXException
- * @see org.xml.sax.SAXParseException
- */
- public abstract void setLocale (Locale locale)
- throws SAXException;
-
-
- /**
- * Allow an application to register a custom entity resolver.
- *
- * <p>If the application does not register an entity resolver, the
- * SAX parser will resolve system identifiers and open connections
- * to entities itself (this is the default behaviour implemented in
- * HandlerBase).</p>
- *
- * <p>Applications may register a new or different entity resolver
- * in the middle of a parse, and the SAX parser must begin using
- * the new resolver immediately.</p>
- *
- * @param resolver The object for resolving entities.
- * @see EntityResolver
- * @see HandlerBase
- */
- public abstract void setEntityResolver (EntityResolver resolver);
-
-
- /**
- * Allow an application to register a DTD event handler.
- *
- * <p>If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently
- * ignored (this is the default behaviour implemented by
- * HandlerBase).</p>
- *
- * <p>Applications may register a new or different
- * handler in the middle of a parse, and the SAX parser must
- * begin using the new handler immediately.</p>
- *
- * @param handler The DTD handler.
- * @see DTDHandler
- * @see HandlerBase
- */
- public abstract void setDTDHandler (DTDHandler handler);
-
-
- /**
- * Allow an application to register a document event handler.
- *
- * <p>If the application does not register a document handler, all
- * document events reported by the SAX parser will be silently
- * ignored (this is the default behaviour implemented by
- * HandlerBase).</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The document handler.
- * @see DocumentHandler
- * @see HandlerBase
- */
- public abstract void setDocumentHandler (DocumentHandler handler);
-
-
- /**
- * Allow an application to register an error event handler.
- *
- * <p>If the application does not register an error event handler,
- * all error events reported by the SAX parser will be silently
- * ignored, except for fatalError, which will throw a SAXException
- * (this is the default behaviour implemented by HandlerBase).</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The error handler.
- * @see ErrorHandler
- * @see SAXException
- * @see HandlerBase
- */
- public abstract void setErrorHandler (ErrorHandler handler);
-
-
- /**
- * Parse an XML document.
- *
- * <p>The application can use this method to instruct the SAX parser
- * to begin parsing an XML document from any valid input
- * source (a character stream, a byte stream, or a URI).</p>
- *
- * <p>Applications may not invoke this method while a parse is in
- * progress (they should create a new Parser instead for each
- * additional XML document). Once a parse is complete, an
- * application may reuse the same Parser object, possibly with a
- * different input source.</p>
- *
- * @param source The input source for the top-level of the
- * XML document.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see org.xml.sax.InputSource
- * @see #parse(java.lang.String)
- * @see #setEntityResolver
- * @see #setDTDHandler
- * @see #setDocumentHandler
- * @see #setErrorHandler
- */
- public abstract void parse (InputSource source)
- throws SAXException, IOException;
-
-
- /**
- * Parse an XML document from a system identifier (URI).
- *
- * <p>This method is a shortcut for the common case of reading a
- * document from a system identifier. It is the exact
- * equivalent of the following:</p>
- *
- * <pre>
- * parse(new InputSource(systemId));
- * </pre>
- *
- * <p>If the system identifier is a URL, it must be fully resolved
- * by the application before it is passed to the parser.</p>
- *
- * @param systemId The system identifier (URI).
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see #parse(org.xml.sax.InputSource)
- */
- public abstract void parse (String systemId)
- throws SAXException, IOException;
-
-}
-
-// end of Parser.java
diff --git a/external/jaxp/source/org/xml/sax/SAXException.java b/external/jaxp/source/org/xml/sax/SAXException.java
deleted file mode 100755
index 3e5005c7a..000000000
--- a/external/jaxp/source/org/xml/sax/SAXException.java
+++ /dev/null
@@ -1,152 +0,0 @@
-// SAX exception class.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-/**
- * Encapsulate a general SAX error or warning.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class can contain basic error or warning information from
- * either the XML parser or the application: a parser writer or
- * application writer can subclass it to provide additional
- * functionality. SAX handlers may throw this exception or
- * any exception subclassed from it.</p>
- *
- * <p>If the application needs to pass through other types of
- * exceptions, it must wrap those exceptions in a SAXException
- * or an exception derived from a SAXException.</p>
- *
- * <p>If the parser or application needs to include information about a
- * specific location in an XML document, it should use the
- * {@link org.xml.sax.SAXParseException SAXParseException} subclass.</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.SAXParseException
- */
-public class SAXException extends Exception {
-
-
- /**
- * Create a new SAXException.
- */
- public SAXException ()
- {
- super();
- this.exception = null;
- }
-
-
- /**
- * Create a new SAXException.
- *
- * @param message The error or warning message.
- */
- public SAXException (String message) {
- super(message);
- this.exception = null;
- }
-
-
- /**
- * Create a new SAXException wrapping an existing exception.
- *
- * <p>The existing exception will be embedded in the new
- * one, and its message will become the default message for
- * the SAXException.</p>
- *
- * @param e The exception to be wrapped in a SAXException.
- */
- public SAXException (Exception e)
- {
- super();
- this.exception = e;
- }
-
-
- /**
- * Create a new SAXException from an existing exception.
- *
- * <p>The existing exception will be embedded in the new
- * one, but the new exception will have its own message.</p>
- *
- * @param message The detail message.
- * @param e The exception to be wrapped in a SAXException.
- */
- public SAXException (String message, Exception e)
- {
- super(message);
- this.exception = e;
- }
-
-
- /**
- * Return a detail message for this exception.
- *
- * <p>If there is an embedded exception, and if the SAXException
- * has no detail message of its own, this method will return
- * the detail message from the embedded exception.</p>
- *
- * @return The error or warning message.
- */
- public String getMessage ()
- {
- String message = super.getMessage();
-
- if (message == null && exception != null) {
- return exception.getMessage();
- } else {
- return message;
- }
- }
-
-
- /**
- * Return the embedded exception, if any.
- *
- * @return The embedded exception, or null if there is none.
- */
- public Exception getException ()
- {
- return exception;
- }
-
-
- /**
- * Override toString to pick up any embedded exception.
- *
- * @return A string representation of this exception.
- */
- public String toString ()
- {
- if (exception != null) {
- return exception.toString();
- } else {
- return super.toString();
- }
- }
-
-
-
- //////////////////////////////////////////////////////////////////////
- // Internal state.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * @serial The embedded exception if tunnelling, or null.
- */
- private Exception exception;
-
-}
-
-// end of SAXException.java
diff --git a/external/jaxp/source/org/xml/sax/SAXNotRecognizedException.java b/external/jaxp/source/org/xml/sax/SAXNotRecognizedException.java
deleted file mode 100755
index 07f62ff60..000000000
--- a/external/jaxp/source/org/xml/sax/SAXNotRecognizedException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// SAXNotRecognizedException.java - unrecognized feature or value.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax;
-
-
-/**
- * Exception class for an unrecognized identifier.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>An XMLReader will throw this exception when it finds an
- * unrecognized feature or property identifier; SAX applications and
- * extensions may use this class for other, similar purposes.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.SAXNotSupportedException
- */
-public class SAXNotRecognizedException extends SAXException
-{
-
- /**
- * Default constructor.
- */
- public SAXNotRecognizedException ()
- {
- super();
- }
-
-
- /**
- * Construct a new exception with the given message.
- *
- * @param message The text message of the exception.
- */
- public SAXNotRecognizedException (String message)
- {
- super(message);
- }
-
-}
-
-// end of SAXNotRecognizedException.java
diff --git a/external/jaxp/source/org/xml/sax/SAXNotSupportedException.java b/external/jaxp/source/org/xml/sax/SAXNotSupportedException.java
deleted file mode 100755
index 9eacfa6f3..000000000
--- a/external/jaxp/source/org/xml/sax/SAXNotSupportedException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// SAXNotSupportedException.java - unsupported feature or value.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax;
-
-/**
- * Exception class for an unsupported operation.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>An XMLReader will throw this exception when it recognizes a
- * feature or property identifier, but cannot perform the requested
- * operation (setting a state or value). Other SAX2 applications and
- * extensions may use this class for similar purposes.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.SAXNotRecognizedException
- */
-public class SAXNotSupportedException extends SAXException
-{
-
- /**
- * Construct a new exception with no message.
- */
- public SAXNotSupportedException ()
- {
- super();
- }
-
-
- /**
- * Construct a new exception with the given message.
- *
- * @param message The text message of the exception.
- */
- public SAXNotSupportedException (String message)
- {
- super(message);
- }
-
-}
-
-// end of SAXNotSupportedException.java
diff --git a/external/jaxp/source/org/xml/sax/SAXParseException.java b/external/jaxp/source/org/xml/sax/SAXParseException.java
deleted file mode 100755
index eae1f4391..000000000
--- a/external/jaxp/source/org/xml/sax/SAXParseException.java
+++ /dev/null
@@ -1,269 +0,0 @@
-// SAX exception class.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax;
-
-/**
- * Encapsulate an XML parse error or warning.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This exception may include information for locating the error
- * in the original XML document, as if it came from a {@link Locator}
- * object. Note that although the application
- * will receive a SAXParseException as the argument to the handlers
- * in the {@link org.xml.sax.ErrorHandler ErrorHandler} interface,
- * the application is not actually required to throw the exception;
- * instead, it can simply read the information in it and take a
- * different action.</p>
- *
- * <p>Since this exception is a subclass of {@link org.xml.sax.SAXException
- * SAXException}, it inherits the ability to wrap another exception.</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.SAXException
- * @see org.xml.sax.Locator
- * @see org.xml.sax.ErrorHandler
- */
-public class SAXParseException extends SAXException {
-
-
- //////////////////////////////////////////////////////////////////////
- // Constructors.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * Create a new SAXParseException from a message and a Locator.
- *
- * <p>This constructor is especially useful when an application is
- * creating its own exception from within a {@link org.xml.sax.ContentHandler
- * ContentHandler} callback.</p>
- *
- * @param message The error or warning message.
- * @param locator The locator object for the error or warning (may be
- * null).
- * @see org.xml.sax.Locator
- */
- public SAXParseException (String message, Locator locator) {
- super(message);
- if (locator != null) {
- init(locator.getPublicId(), locator.getSystemId(),
- locator.getLineNumber(), locator.getColumnNumber());
- } else {
- init(null, null, -1, -1);
- }
- }
-
-
- /**
- * Wrap an existing exception in a SAXParseException.
- *
- * <p>This constructor is especially useful when an application is
- * creating its own exception from within a {@link org.xml.sax.ContentHandler
- * ContentHandler} callback, and needs to wrap an existing exception that is not a
- * subclass of {@link org.xml.sax.SAXException SAXException}.</p>
- *
- * @param message The error or warning message, or null to
- * use the message from the embedded exception.
- * @param locator The locator object for the error or warning (may be
- * null).
- * @param e Any exception.
- * @see org.xml.sax.Locator
- */
- public SAXParseException (String message, Locator locator,
- Exception e) {
- super(message, e);
- if (locator != null) {
- init(locator.getPublicId(), locator.getSystemId(),
- locator.getLineNumber(), locator.getColumnNumber());
- } else {
- init(null, null, -1, -1);
- }
- }
-
-
- /**
- * Create a new SAXParseException.
- *
- * <p>This constructor is most useful for parser writers.</p>
- *
- * <p>All parameters except the message are as if
- * they were provided by a {@link Locator}. For example, if the
- * system identifier is a URL (including relative filename), the
- * caller must resolve it fully before creating the exception.</p>
- *
- *
- * @param message The error or warning message.
- * @param publicId The public identifer of the entity that generated
- * the error or warning.
- * @param systemId The system identifer of the entity that generated
- * the error or warning.
- * @param lineNumber The line number of the end of the text that
- * caused the error or warning.
- * @param columnNumber The column number of the end of the text that
- * cause the error or warning.
- */
- public SAXParseException (String message, String publicId, String systemId,
- int lineNumber, int columnNumber)
- {
- super(message);
- init(publicId, systemId, lineNumber, columnNumber);
- }
-
-
- /**
- * Create a new SAXParseException with an embedded exception.
- *
- * <p>This constructor is most useful for parser writers who
- * need to wrap an exception that is not a subclass of
- * {@link org.xml.sax.SAXException SAXException}.</p>
- *
- * <p>All parameters except the message and exception are as if
- * they were provided by a {@link Locator}. For example, if the
- * system identifier is a URL (including relative filename), the
- * caller must resolve it fully before creating the exception.</p>
- *
- * @param message The error or warning message, or null to use
- * the message from the embedded exception.
- * @param publicId The public identifer of the entity that generated
- * the error or warning.
- * @param systemId The system identifer of the entity that generated
- * the error or warning.
- * @param lineNumber The line number of the end of the text that
- * caused the error or warning.
- * @param columnNumber The column number of the end of the text that
- * cause the error or warning.
- * @param e Another exception to embed in this one.
- */
- public SAXParseException (String message, String publicId, String systemId,
- int lineNumber, int columnNumber, Exception e)
- {
- super(message, e);
- init(publicId, systemId, lineNumber, columnNumber);
- }
-
-
- /**
- * Internal initialization method.
- *
- * @param publicId The public identifier of the entity which generated the exception,
- * or null.
- * @param systemId The system identifier of the entity which generated the exception,
- * or null.
- * @param lineNumber The line number of the error, or -1.
- * @param columnNumber The column number of the error, or -1.
- */
- private void init (String publicId, String systemId,
- int lineNumber, int columnNumber)
- {
- this.publicId = publicId;
- this.systemId = systemId;
- this.lineNumber = lineNumber;
- this.columnNumber = columnNumber;
- }
-
-
- /**
- * Get the public identifier of the entity where the exception occurred.
- *
- * @return A string containing the public identifier, or null
- * if none is available.
- * @see org.xml.sax.Locator#getPublicId
- */
- public String getPublicId ()
- {
- return this.publicId;
- }
-
-
- /**
- * Get the system identifier of the entity where the exception occurred.
- *
- * <p>If the system identifier is a URL, it will have been resolved
- * fully.</p>
- *
- * @return A string containing the system identifier, or null
- * if none is available.
- * @see org.xml.sax.Locator#getSystemId
- */
- public String getSystemId ()
- {
- return this.systemId;
- }
-
-
- /**
- * The line number of the end of the text where the exception occurred.
- *
- * <p>The first line is line 1.</p>
- *
- * @return An integer representing the line number, or -1
- * if none is available.
- * @see org.xml.sax.Locator#getLineNumber
- */
- public int getLineNumber ()
- {
- return this.lineNumber;
- }
-
-
- /**
- * The column number of the end of the text where the exception occurred.
- *
- * <p>The first column in a line is position 1.</p>
- *
- * @return An integer representing the column number, or -1
- * if none is available.
- * @see org.xml.sax.Locator#getColumnNumber
- */
- public int getColumnNumber ()
- {
- return this.columnNumber;
- }
-
-
-
- //////////////////////////////////////////////////////////////////////
- // Internal state.
- //////////////////////////////////////////////////////////////////////
-
-
- /**
- * @serial The public identifier, or null.
- * @see #getPublicId
- */
- private String publicId;
-
-
- /**
- * @serial The system identifier, or null.
- * @see #getSystemId
- */
- private String systemId;
-
-
- /**
- * @serial The line number, or -1.
- * @see #getLineNumber
- */
- private int lineNumber;
-
-
- /**
- * @serial The column number, or -1.
- * @see #getColumnNumber
- */
- private int columnNumber;
-
-}
-
-// end of SAXParseException.java
diff --git a/external/jaxp/source/org/xml/sax/XMLFilter.java b/external/jaxp/source/org/xml/sax/XMLFilter.java
deleted file mode 100755
index 3fe733ff4..000000000
--- a/external/jaxp/source/org/xml/sax/XMLFilter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-// XMLFilter.java - filter SAX2 events.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax;
-
-
-/**
- * Interface for an XML filter.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>An XML filter is like an XML reader, except that it obtains its
- * events from another XML reader rather than a primary source like
- * an XML document or database. Filters can modify a stream of
- * events as they pass on to the final application.</p>
- *
- * <p>The XMLFilterImpl helper class provides a convenient base
- * for creating SAX2 filters, by passing on all {@link org.xml.sax.EntityResolver
- * EntityResolver}, {@link org.xml.sax.DTDHandler DTDHandler},
- * {@link org.xml.sax.ContentHandler ContentHandler} and {@link org.xml.sax.ErrorHandler
- * ErrorHandler} events automatically.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.helpers.XMLFilterImpl
- */
-public interface XMLFilter extends XMLReader
-{
-
- /**
- * Set the parent reader.
- *
- * <p>This method allows the application to link the filter to
- * a parent reader (which may be another filter). The argument
- * may not be null.</p>
- *
- * @param parent The parent reader.
- */
- public abstract void setParent (XMLReader parent);
-
-
- /**
- * Get the parent reader.
- *
- * <p>This method allows the application to query the parent
- * reader (which may be another filter). It is generally a
- * bad idea to perform any operations on the parent reader
- * directly: they should all pass through this filter.</p>
- *
- * @return The parent filter, or null if none has been set.
- */
- public abstract XMLReader getParent ();
-
-}
-
-// end of XMLFilter.java
diff --git a/external/jaxp/source/org/xml/sax/XMLReader.java b/external/jaxp/source/org/xml/sax/XMLReader.java
deleted file mode 100755
index 41aae08ec..000000000
--- a/external/jaxp/source/org/xml/sax/XMLReader.java
+++ /dev/null
@@ -1,396 +0,0 @@
-// XMLReader.java - read an XML document.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax;
-
-import java.io.IOException;
-
-
-/**
- * Interface for reading an XML document using callbacks.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p><strong>Note:</strong> despite its name, this interface does
- * <em>not</em> extend the standard Java {@link java.io.Reader Reader}
- * interface, because reading XML is a fundamentally different activity
- * than reading character data.</p>
- *
- * <p>XMLReader is the interface that an XML parser's SAX2 driver must
- * implement. This interface allows an application to set and
- * query features and properties in the parser, to register
- * event handlers for document processing, and to initiate
- * a document parse.</p>
- *
- * <p>All SAX interfaces are assumed to be synchronous: the
- * {@link #parse parse} methods must not return until parsing
- * is complete, and readers must wait for an event-handler callback
- * to return before reporting the next event.</p>
- *
- * <p>This interface replaces the (now deprecated) SAX 1.0 {@link
- * org.xml.sax.Parser Parser} interface. The XMLReader interface
- * contains two important enhancements over the old Parser
- * interface (as well as some minor ones):</p>
- *
- * <ol>
- * <li>it adds a standard way to query and set features and
- * properties; and</li>
- * <li>it adds Namespace support, which is required for many
- * higher-level XML standards.</li>
- * </ol>
- *
- * <p>There are adapters available to convert a SAX1 Parser to
- * a SAX2 XMLReader and vice-versa.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLFilter
- * @see org.xml.sax.helpers.ParserAdapter
- * @see org.xml.sax.helpers.XMLReaderAdapter
- */
-public interface XMLReader
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Configuration.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Look up the value of a feature flag.
- *
- * <p>The feature name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a feature name but
- * temporarily be unable to return its value.
- * Some feature values may be available only in specific
- * contexts, such as before, during, or after a parse.
- * Also, some feature values may not be programmatically accessible.
- * (In the case of an adapter for SAX1 {@link Parser}, there is no
- * implementation-independent way to expose whether the underlying
- * parser is performing validation, expanding external entities,
- * and so forth.) </p>
- *
- * <p>All XMLReaders are required to recognize the
- * http://xml.org/sax/features/namespaces and the
- * http://xml.org/sax/features/namespace-prefixes feature names.</p>
- *
- * <p>Typical usage is something like this:</p>
- *
- * <pre>
- * XMLReader r = new MySAXDriver();
- *
- * // try to activate validation
- * try {
- * r.setFeature("http://xml.org/sax/features/validation", true);
- * } catch (SAXException e) {
- * System.err.println("Cannot activate validation.");
- * }
- *
- * // register event handlers
- * r.setContentHandler(new MyContentHandler());
- * r.setErrorHandler(new MyErrorHandler());
- *
- * // parse the first document
- * try {
- * r.parse("http://www.foo.com/mydoc.xml");
- * } catch (IOException e) {
- * System.err.println("I/O exception reading XML document");
- * } catch (SAXException e) {
- * System.err.println("XML exception reading document.");
- * }
- * </pre>
- *
- * <p>Implementors are free (and encouraged) to invent their own features,
- * using names built on their own URIs.</p>
- *
- * @param name The feature name, which is a fully-qualified URI.
- * @return The current value of the feature (true or false).
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * value can't be assigned or retrieved.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the feature name but
- * cannot determine its value at this time.
- * @see #setFeature
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
- /**
- * Set the value of a feature flag.
- *
- * <p>The feature name is any fully-qualified URI. It is
- * possible for an XMLReader to expose a feature value but
- * to be unable to change the current value.
- * Some feature values may be immutable or mutable only
- * in specific contexts, such as before, during, or after
- * a parse.</p>
- *
- * <p>All XMLReaders are required to support setting
- * http://xml.org/sax/features/namespaces to true and
- * http://xml.org/sax/features/namespace-prefixes to false.</p>
- *
- * @param name The feature name, which is a fully-qualified URI.
- * @param value The requested value of the feature (true or false).
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * value can't be assigned or retrieved.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the feature name but
- * cannot set the requested value.
- * @see #getFeature
- */
- public void setFeature (String name, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
- /**
- * Look up the value of a property.
- *
- * <p>The property name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a property name but
- * temporarily be unable to return its value.
- * Some property values may be available only in specific
- * contexts, such as before, during, or after a parse.</p>
- *
- * <p>XMLReaders are not required to recognize any specific
- * property names, though an initial core set is documented for
- * SAX2.</p>
- *
- * <p>Implementors are free (and encouraged) to invent their own properties,
- * using names built on their own URIs.</p>
- *
- * @param name The property name, which is a fully-qualified URI.
- * @return The current value of the property.
- * @exception org.xml.sax.SAXNotRecognizedException If the property
- * value can't be assigned or retrieved.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the property name but
- * cannot determine its value at this time.
- * @see #setProperty
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
- /**
- * Set the value of a property.
- *
- * <p>The property name is any fully-qualified URI. It is
- * possible for an XMLReader to recognize a property name but
- * to be unable to change the current value.
- * Some property values may be immutable or mutable only
- * in specific contexts, such as before, during, or after
- * a parse.</p>
- *
- * <p>XMLReaders are not required to recognize setting
- * any specific property names, though a core set is defined by
- * SAX2.</p>
- *
- * <p>This method is also the standard mechanism for setting
- * extended handlers.</p>
- *
- * @param name The property name, which is a fully-qualified URI.
- * @param value The requested value for the property.
- * @exception org.xml.sax.SAXNotRecognizedException If the property
- * value can't be assigned or retrieved.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * XMLReader recognizes the property name but
- * cannot set the requested value.
- */
- public void setProperty (String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Event handlers.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Allow an application to register an entity resolver.
- *
- * <p>If the application does not register an entity resolver,
- * the XMLReader will perform its own default resolution.</p>
- *
- * <p>Applications may register a new or different resolver in the
- * middle of a parse, and the SAX parser must begin using the new
- * resolver immediately.</p>
- *
- * @param resolver The entity resolver.
- * @see #getEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver);
-
-
- /**
- * Return the current entity resolver.
- *
- * @return The current entity resolver, or null if none
- * has been registered.
- * @see #setEntityResolver
- */
- public EntityResolver getEntityResolver ();
-
-
- /**
- * Allow an application to register a DTD event handler.
- *
- * <p>If the application does not register a DTD handler, all DTD
- * events reported by the SAX parser will be silently ignored.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The DTD handler.
- * @see #getDTDHandler
- */
- public void setDTDHandler (DTDHandler handler);
-
-
- /**
- * Return the current DTD handler.
- *
- * @return The current DTD handler, or null if none
- * has been registered.
- * @see #setDTDHandler
- */
- public DTDHandler getDTDHandler ();
-
-
- /**
- * Allow an application to register a content event handler.
- *
- * <p>If the application does not register a content handler, all
- * content events reported by the SAX parser will be silently
- * ignored.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The content handler.
- * @see #getContentHandler
- */
- public void setContentHandler (ContentHandler handler);
-
-
- /**
- * Return the current content handler.
- *
- * @return The current content handler, or null if none
- * has been registered.
- * @see #setContentHandler
- */
- public ContentHandler getContentHandler ();
-
-
- /**
- * Allow an application to register an error event handler.
- *
- * <p>If the application does not register an error handler, all
- * error events reported by the SAX parser will be silently
- * ignored; however, normal processing may not continue. It is
- * highly recommended that all SAX applications implement an
- * error handler to avoid unexpected bugs.</p>
- *
- * <p>Applications may register a new or different handler in the
- * middle of a parse, and the SAX parser must begin using the new
- * handler immediately.</p>
- *
- * @param handler The error handler.
- * @see #getErrorHandler
- */
- public void setErrorHandler (ErrorHandler handler);
-
-
- /**
- * Return the current error handler.
- *
- * @return The current error handler, or null if none
- * has been registered.
- * @see #setErrorHandler
- */
- public ErrorHandler getErrorHandler ();
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Parsing.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Parse an XML document.
- *
- * <p>The application can use this method to instruct the XML
- * reader to begin parsing an XML document from any valid input
- * source (a character stream, a byte stream, or a URI).</p>
- *
- * <p>Applications may not invoke this method while a parse is in
- * progress (they should create a new XMLReader instead for each
- * nested XML document). Once a parse is complete, an
- * application may reuse the same XMLReader object, possibly with a
- * different input source.</p>
- *
- * <p>During the parse, the XMLReader will provide information
- * about the XML document through the registered event
- * handlers.</p>
- *
- * <p>This method is synchronous: it will not return until parsing
- * has ended. If a client application wants to terminate
- * parsing early, it should throw an exception.</p>
- *
- * @param source The input source for the top-level of the
- * XML document.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see org.xml.sax.InputSource
- * @see #parse(java.lang.String)
- * @see #setEntityResolver
- * @see #setDTDHandler
- * @see #setContentHandler
- * @see #setErrorHandler
- */
- public void parse (InputSource input)
- throws IOException, SAXException;
-
-
- /**
- * Parse an XML document from a system identifier (URI).
- *
- * <p>This method is a shortcut for the common case of reading a
- * document from a system identifier. It is the exact
- * equivalent of the following:</p>
- *
- * <pre>
- * parse(new InputSource(systemId));
- * </pre>
- *
- * <p>If the system identifier is a URL, it must be fully resolved
- * by the application before it is passed to the parser.</p>
- *
- * @param systemId The system identifier (URI).
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- * @see #parse(org.xml.sax.InputSource)
- */
- public void parse (String systemId)
- throws IOException, SAXException;
-
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/Attributes2.java b/external/jaxp/source/org/xml/sax/ext/Attributes2.java
deleted file mode 100644
index ea7f1087e..000000000
--- a/external/jaxp/source/org/xml/sax/ext/Attributes2.java
+++ /dev/null
@@ -1,91 +0,0 @@
-// Attributes2.java - extended Attributes
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import org.xml.sax.Attributes;
-
-
-/**
- * SAX2 extension to augment the per-attribute information
- * provided though {@link Attributes}.
- * If an implementation supports this extension, the attributes
- * provided in {@link org.xml.sax.ContentHandler#startElement
- * ContentHandler.startElement() } will implement this interface,
- * and the <em>http://xml.org/sax/features/use-attributes2</em>
- * feature flag will have the value <em>true</em>.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p> XMLReader implementations are not required to support this
- * information, and it is not part of core-only SAX2 distributions.</p>
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBS
- */
-public interface Attributes2 extends Attributes
-{
-
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.ArrayIndexOutOfBoundsException
- * When the supplied index does not identify an attribute.
- */
- public boolean isDeclared (int index);
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared (java.lang.String qName);
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared (java.lang.String uri, java.lang.String localName);
-
-
- /**
- * Returns true unless the attribute value was provided
- * by DTD defaulting.
- *
- * @param index The attribute index (zero-based).
- * @return true if the value was found in the XML text,
- * false if the value was provided by DTD defaulting.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not identify an attribute.
- */
- public boolean isSpecified (int index);
-
- /**
- * Returns true unless the attribute value was provided
- * by DTD defaulting.
- *
- * @param uri The Namespace URI, or the empty string if
- * the name has no Namespace URI.
- * @param localName The attribute's local name.
- * @return true if the value was found in the XML text,
- * false if the value was provided by DTD defaulting.
- * @exception java.lang.IllegalArgumentException When the
- * supplied names do not identify an attribute.
- */
- public boolean isSpecified (String uri, String localName);
-
- /**
- * Returns true unless the attribute value was provided
- * by DTD defaulting.
- *
- * @param qName The XML 1.0 qualified name.
- * @return true if the value was found in the XML text,
- * false if the value was provided by DTD defaulting.
- * @exception java.lang.IllegalArgumentException When the
- * supplied name does not identify an attribute.
- */
- public boolean isSpecified (String qName);
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/Attributes2Impl.java b/external/jaxp/source/org/xml/sax/ext/Attributes2Impl.java
deleted file mode 100644
index 6781e1856..000000000
--- a/external/jaxp/source/org/xml/sax/ext/Attributes2Impl.java
+++ /dev/null
@@ -1,279 +0,0 @@
-// Attributes2Impl.java - extended AttributesImpl
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import org.xml.sax.Attributes;
-import org.xml.sax.helpers.AttributesImpl;
-
-
-/**
- * SAX2 extension helper for additional Attributes information,
- * implementing the {@link Attributes2} interface.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>This is not part of core-only SAX2 distributions.</p>
- *
- * <p>The <em>specified</em> flag for each attribute will always
- * be true, unless it has been set to false in the copy constructor
- * or using {@link #setSpecified}. </p>
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBS
- */
-public class Attributes2Impl extends AttributesImpl implements Attributes2
-{
- private boolean flags [];
-
- private boolean declaredFlags[];
-
- /**
- * Construct a new, empty Attributes2Impl object.
- */
- public Attributes2Impl () { }
-
-
- /**
- * Copy an existing Attributes or Attributes2 object.
- * If the object implements Attributes2, values of the
- * <em>specified</em> flag for each attribute are copied,
- * otherwise the flag values are set to <em>true</em>.
- *
- * <p>This constructor is especially useful inside a
- * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
- *
- * @param atts The existing Attributes object.
- */
- public Attributes2Impl (Attributes atts)
- {
- super (atts);
- }
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of Attributes2
- ////////////////////////////////////////////////////////////////////
-
-
-
- /*
- note(1)
- The implementation of the isDeclared methods is wrong. It's only here
- to make the class compile, it's not intended to work yet.
- */
-
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.ArrayIndexOutOfBoundsException
- * When the supplied index does not identify an attribute.
- */
- public boolean isDeclared (int index)
- {
- if (index < 0 || index >= getLength ())
- throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
- return declaredFlags [index];
- }
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared (java.lang.String qName)
- {
- int index = getIndex (qName);
- if (index < 0)
- throw new IllegalArgumentException ("No such attribute: " + qName);
- return declaredFlags [index];
- }
-
- /** @return false unless the attribute was declared in the DTD.
- * @throws java.lang.IllegalArgumentException
- * When the supplied names do not identify an attribute.
- */
- public boolean isDeclared (java.lang.String uri, java.lang.String localName)
- {
- int index = getIndex (uri, localName);
- if (index < 0)
- throw new IllegalArgumentException ("No such attribute: local="
- + localName
- + ", namespace=" + uri);
- return declaredFlags [index];
- }
-
-
- /**
- * Returns the current value of an attribute's "specified" flag.
- *
- * @param index The attribute index (zero-based).
- * @return current flag value
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not identify an attribute.
- */
- public boolean isSpecified (int index)
- {
- if (index < 0 || index >= getLength ())
- throw new ArrayIndexOutOfBoundsException (
- "No attribute at index: " + index);
- return flags [index];
- }
-
-
- /**
- * Returns the current value of an attribute's "specified" flag.
- *
- * @param uri The Namespace URI, or the empty string if
- * the name has no Namespace URI.
- * @param localName The attribute's local name.
- * @return current flag value
- * @exception java.lang.IllegalArgumentException When the
- * supplied names do not identify an attribute.
- */
- public boolean isSpecified (String uri, String localName)
- {
- int index = getIndex (uri, localName);
-
- if (index < 0)
- throw new IllegalArgumentException (
- "No such attribute: local=" + localName
- + ", namespace=" + uri);
- return flags [index];
- }
-
-
- /**
- * Returns the current value of an attribute's "specified" flag.
- *
- * @param qName The XML 1.0 qualified name.
- * @return current flag value
- * @exception java.lang.IllegalArgumentException When the
- * supplied name does not identify an attribute.
- */
- public boolean isSpecified (String qName)
- {
- int index = getIndex (qName);
-
- if (index < 0)
- throw new IllegalArgumentException (
- "No such attribute: " + qName);
- return flags [index];
- }
-
-
- ////////////////////////////////////////////////////////////////////
- // Manipulators
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Copy an entire Attributes object. The "specified" flags are
- * assigned as true, unless the object is an Attributes2 object
- * in which case those values are copied.
- *
- * @see AttributesImpl#setAttributes
- */
- public void setAttributes (Attributes atts)
- {
- int length = atts.getLength ();
-
- super.setAttributes (atts);
- flags = new boolean [length];
- declaredFlags = new boolean[length];
-
- if (atts instanceof Attributes2) {
- Attributes2 a2 = (Attributes2) atts;
- for (int i = 0; i < length; i++) {
- flags [i] = a2.isSpecified (i);
- declaredFlags[i] = a2.isDeclared(i);
- }
- } else {
- for (int i = 0; i < length; i++) {
- flags [i] = true;
- declaredFlags[i] = getType(i).equals("CDATA");
- }
- }
-
- }
-
-
- /**
- * Add an attribute to the end of the list, setting its
- * "specified" flag to true. To set that flag's value
- * to false, use {@link #setSpecified}.
- *
- * @see AttributesImpl#addAttribute
- */
- public void addAttribute (String uri, String localName, String qName,
- String type, String value)
- {
- super.addAttribute (uri, localName, qName, type, value);
-
- int length = getLength ();
-
- if (length < flags.length) {
- boolean newFlags [] = new boolean [length];
- System.arraycopy (flags, 0, newFlags, 0, flags.length);
- flags = newFlags;
- boolean newDeclFlags[] = new boolean[length];
- System.arraycopy (declaredFlags, 0, newDeclFlags, 0, declaredFlags.length);
- declaredFlags = newDeclFlags;
- }
-
- flags [length - 1] = true;
- declaredFlags[length - 1] = type.equals("CDATA");
- }
-
-
- // javadoc entirely from superclass
- public void removeAttribute (int index)
- {
- int origMax = getLength () - 1;
-
- super.removeAttribute (index);
- if (index != origMax)
- System.arraycopy (flags, index + 1, flags, index,
- origMax - index);
- }
-
-
-
- /**
- * Assign a value to the "declared" flag of a specific attribute.
- * This is the only way this flag can be cleared, except clearing
- * by initialization with the copy constructor.
- *
- * @param index The index of the attribute (zero-based).
- * @param value The desired flag value.
- * @throws java.lang.ArrayIndexOutOfBoundsException
- * When the supplied index does not identify an attribute.
- */
- public void setDeclared (int index, boolean value)
- {
- if (index < 0 || index >= getLength ())
- throw new ArrayIndexOutOfBoundsException ("No attribute at index: " + index);
- declaredFlags [index] = value;
- }
-
- /**
- * Assign a value to the "specified" flag of a specific attribute.
- * This is the only way this flag can be cleared, except clearing
- * by initialization with the copy constructor.
- *
- * @param index The index of the attribute (zero-based).
- * @param value The desired flag value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not identify an attribute.
- */
- public void setSpecified (int index, boolean value)
- {
- if (index < 0 || index >= getLength ())
- throw new ArrayIndexOutOfBoundsException (
- "No attribute at index: " + index);
- flags [index] = value;
- }
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/DeclHandler.java b/external/jaxp/source/org/xml/sax/ext/DeclHandler.java
deleted file mode 100755
index 85ac476f7..000000000
--- a/external/jaxp/source/org/xml/sax/ext/DeclHandler.java
+++ /dev/null
@@ -1,142 +0,0 @@
-// DeclHandler.java - Optional handler for DTD declaration events.
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import org.xml.sax.SAXException;
-
-
-/**
- * SAX2 extension handler for DTD declaration events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This is an optional extension handler for SAX2 to provide more
- * complete information about DTD declarations in an XML document.
- * XML readers are not required to recognize this handler, and it
- * is not part of core-only SAX2 distributions.</p>
- *
- * <p>Note that data-related DTD declarations (unparsed entities and
- * notations) are already reported through the {@link
- * org.xml.sax.DTDHandler DTDHandler} interface.</p>
- *
- * <p>If you are using the declaration handler together with a lexical
- * handler, all of the events will occur between the
- * {@link org.xml.sax.ext.LexicalHandler#startDTD startDTD} and the
- * {@link org.xml.sax.ext.LexicalHandler#endDTD endDTD} events.</p>
- *
- * <p>To set the DeclHandler for an XML reader, use the
- * {@link org.xml.sax.XMLReader#setProperty setProperty} method
- * with the property name
- * <code>http://xml.org/sax/properties/declaration-handler</code>
- * and an object implementing this interface (or null) as the value.
- * If the reader does not report declaration events, it will throw a
- * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
- * when you attempt to register the handler.</p>
- *
- * @since SAX 2.0 (extensions 1.0)
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- */
-public interface DeclHandler
-{
-
- /**
- * Report an element type declaration.
- *
- * <p>The content model will consist of the string "EMPTY", the
- * string "ANY", or a parenthesised group, optionally followed
- * by an occurrence indicator. The model will be normalized so
- * that all parameter entities are fully resolved and all whitespace
- * is removed,and will include the enclosing parentheses. Other
- * normalization (such as removing redundant parentheses or
- * simplifying occurrence indicators) is at the discretion of the
- * parser.</p>
- *
- * @param name The element type name.
- * @param model The content model as a normalized string.
- * @exception SAXException The application may raise an exception.
- */
- public abstract void elementDecl (String name, String model)
- throws SAXException;
-
-
- /**
- * Report an attribute type declaration.
- *
- * <p>Only the effective (first) declaration for an attribute will
- * be reported. The type will be one of the strings "CDATA",
- * "ID", "IDREF", "IDREFS", "NMTOKEN", "NMTOKENS", "ENTITY",
- * "ENTITIES", a parenthesized token group with
- * the separator "|" and all whitespace removed, or the word
- * "NOTATION" followed by a space followed by a parenthesized
- * token group with all whitespace removed.</p>
- *
- * <p>The value will be the value as reported to applications,
- * appropriately normalized and with entity and character
- * references expanded. </p>
- *
- * @param eName The name of the associated element.
- * @param aName The name of the attribute.
- * @param type A string representing the attribute type.
- * @param mode A string representing the attribute defaulting mode
- * ("#IMPLIED", "#REQUIRED", or "#FIXED") or null if
- * none of these applies.
- * @param value A string representing the attribute's default value,
- * or null if there is none.
- * @exception SAXException The application may raise an exception.
- */
- public abstract void attributeDecl (String eName,
- String aName,
- String type,
- String mode,
- String value)
- throws SAXException;
-
-
- /**
- * Report an internal entity declaration.
- *
- * <p>Only the effective (first) declaration for each entity
- * will be reported. All parameter entities in the value
- * will be expanded, but general entities will not.</p>
- *
- * @param name The name of the entity. If it is a parameter
- * entity, the name will begin with '%'.
- * @param value The replacement text of the entity.
- * @exception SAXException The application may raise an exception.
- * @see #externalEntityDecl
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public abstract void internalEntityDecl (String name, String value)
- throws SAXException;
-
-
- /**
- * Report a parsed external entity declaration.
- *
- * <p>Only the effective (first) declaration for each entity
- * will be reported.</p>
- *
- * @param name The name of the entity. If it is a parameter
- * entity, the name will begin with '%'.
- * @param publicId The declared public identifier of the entity, or
- * null if none was declared.
- * @param systemId The declared system identifier of the entity.
- * @exception SAXException The application may raise an exception.
- * @see #internalEntityDecl
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public abstract void externalEntityDecl (String name, String publicId,
- String systemId)
- throws SAXException;
-
-}
-
-// end of DeclHandler.java
diff --git a/external/jaxp/source/org/xml/sax/ext/DefaultHandler2.java b/external/jaxp/source/org/xml/sax/ext/DefaultHandler2.java
deleted file mode 100644
index b8fc670d3..000000000
--- a/external/jaxp/source/org/xml/sax/ext/DefaultHandler2.java
+++ /dev/null
@@ -1,129 +0,0 @@
-// DefaultHandler2.java - extended DefaultHandler
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import java.io.IOException;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
-
-
-/**
- * This class extends the SAX2 base handler class to support the
- * SAX2 {@link LexicalHandler}, {@link DeclHandler}, and
- * {@link EntityResolver2} extensions. Except for overriding the
- * original SAX1 {@link DefaultHandler#resolveEntity resolveEntity()}
- * method the added handler methods just return. Subclassers may
- * override everything on a method-by-method basis.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p> <em>Note:</em> this class might yet learn that the
- * <em>ContentHandler.setDocumentLocator()</em> call might be passed a
- * {@link Locator2} object, and that the
- * <em>ContentHandler.startElement()</em> call might be passed a
- * {@link Attributes2} object.
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBS
- */
-public class DefaultHandler2 extends DefaultHandler
- implements LexicalHandler, DeclHandler, EntityResolver2
-{
- /** Constructs a handler which ignores all parsing events. */
- public DefaultHandler2 () { }
-
-
- // SAX2 ext-1.0 LexicalHandler
-
- public void startCDATA ()
- throws SAXException
- {}
-
- public void endCDATA ()
- throws SAXException
- {}
-
- public void startDTD (String name, String publicId, String systemId)
- throws SAXException
- {}
-
- public void endDTD ()
- throws SAXException
- {}
-
- public void startEntity (String name)
- throws SAXException
- {}
-
- public void endEntity (String name)
- throws SAXException
- {}
-
- public void comment (char ch [], int start, int length)
- throws SAXException
- { }
-
-
- // SAX2 ext-1.0 DeclHandler
-
- public void attributeDecl (String eName, String aName,
- String type, String mode, String value)
- throws SAXException
- {}
-
- public void elementDecl (String name, String model)
- throws SAXException
- {}
-
- public void externalEntityDecl (String name,
- String publicId, String systemId)
- throws SAXException
- {}
-
- public void internalEntityDecl (String name, String value)
- throws SAXException
- {}
-
- // SAX2 ext-1.1 EntityResolver2
-
- /**
- * Tells the parser that if no external subset has been declared
- * in the document text, none should be used.
- */
- public InputSource getExternalSubset (String name, String baseURI)
- throws SAXException, IOException
- { return null; }
-
- /**
- * Tells the parser to resolve the systemId against the baseURI
- * and read the entity text from that resulting absolute URI.
- * Note that because the older
- * {@link DefaultHandler#resolveEntity DefaultHandler.resolveEntity()},
- * method is overridden to call this one, this method may sometimes
- * be invoked with null <em>name</em> and <em>baseURI</em>, and
- * with the <em>systemId</em> already absolutized.
- */
- public InputSource resolveEntity (String name, String publicId,
- String baseURI, String systemId)
- throws SAXException, IOException
- { return null; }
-
- // SAX1 EntityResolver
-
- /**
- * Invokes
- * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
- * with null entity name and base URI.
- * You only need to override that method to use this class.
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException, IOException
- { return resolveEntity (null, publicId, null, systemId); }
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/EntityResolver2.java b/external/jaxp/source/org/xml/sax/ext/EntityResolver2.java
deleted file mode 100644
index f25bd32bc..000000000
--- a/external/jaxp/source/org/xml/sax/ext/EntityResolver2.java
+++ /dev/null
@@ -1,196 +0,0 @@
-// EntityResolver2.java - Extended SAX entity resolver.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax.ext;
-
-import java.io.IOException;
-
-import org.xml.sax.EntityResolver;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-
-
-/**
- * Extended interface for mapping external entity references to input
- * sources, or providing a missing external subset. The
- * {@link XMLReader#setEntityResolver XMLReader.setEntityResolver()} method
- * is used to provide implementations of this interface to parsers.
- * When a parser uses the methods in this interface, the
- * {@link EntityResolver2#resolveEntity EntityResolver2.resolveEntity()}
- * method (in this interface) is used <em>instead of</em> the older (SAX 1.0)
- * {@link EntityResolver#resolveEntity EntityResolver.resolveEntity()} method.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p>If a SAX application requires the customized handling which this
- * interface defines for external entities, it must ensure that it uses
- * an XMLReader with the
- * <em>http://xml.org/sax/features/use-entity-resolver2</em> feature flag
- * set to <em>true</em> (which is its default value when the feature is
- * recognized). If that flag is unrecognized, or its value is false,
- * or the resolver does not implement this interface, then only the
- * {@link EntityResolver} method will be used.
- * </p>
- *
- * <p>That supports three categories of application that modify entity
- * resolution. <em>Old Style</em> applications won't know about this interface;
- * they will provide an EntityResolver.
- * <em>Transitional Mode</em> provide an EntityResolver2 and automatically
- * get the benefit of its methods in any systems (parsers or other tools)
- * supporting it, due to polymorphism.
- * Both <em>Old Style</em> and <em>Transitional Mode</em> applications will
- * work with any SAX2 parser.
- * <em>New style</em> applications will fail to run except on SAX2 parsers
- * that support this particular feature.
- * They will insist that feature flag have a value of "true", and the
- * EntityResolver2 implementation they provide might throw an exception
- * if the original SAX 1.0 style entity resolution method is invoked.
- * </p>
- *
- * @see org.xml.sax.XMLReader#setEntityResolver
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBD
- */
-public interface EntityResolver2 extends EntityResolver
-{
- /**
- * Allows applications to provide an external subset for documents
- * that don't explicitly define one. Documents with DOCTYPE declarations
- * that omit an external subset can thus augment the declarations
- * available for validation, entity processing, and attribute processing
- * (normalization, defaulting, and reporting types including ID).
- * This augmentation is reported
- * through the {@link LexicalHandler#startDTD startDTD()} method as if
- * the document text had originally included the external subset;
- * this callback is made before any internal subset data or errors
- * are reported.</p>
- *
- * <p>This method can also be used with documents that have no DOCTYPE
- * declaration. When the root element is encountered,
- * but no DOCTYPE declaration has been seen, this method is
- * invoked. If it returns a value for the external subset, that root
- * element is declared to be the root element, giving the effect of
- * splicing a DOCTYPE declaration at the end the prolog of a document
- * that could not otherwise be valid. The sequence of parser callbacks
- * in that case logically resembles this:</p>
- *
- * <pre>
- * ... comments and PIs from the prolog (as usual)
- * startDTD ("rootName", source.getPublicId (), source.getSystemId ());
- * startEntity ("[dtd]");
- * ... declarations, comments, and PIs from the external subset
- * endEntity ("[dtd]");
- * endDTD ();
- * ... then the rest of the document (as usual)
- * startElement (..., "rootName", ...);
- * </pre>
- *
- * <p>Note that the InputSource gets no further resolution.
- * Implementations of this method may wish to invoke
- * {@link #resolveEntity resolveEntity()} to gain benefits such as use
- * of local caches of DTD entities. Also, this method will never be
- * used by a (non-validating) processor that is not including external
- * parameter entities. </p>
- *
- * <p>Uses for this method include facilitating data validation when
- * interoperating with XML processors that would always require
- * undesirable network accesses for external entities, or which for
- * other reasons adopt a "no DTDs" policy.
- * Non-validation motives include forcing documents to include DTDs so
- * that attributes are handled consistently.
- * For example, an XPath processor needs to know which attibutes have
- * type "ID" before it can process a widely used type of reference.</p>
- *
- * <p><strong>Warning:</strong> Returning an external subset modifies
- * the input document. By providing definitions for general entities,
- * it can make a malformed document appear to be well formed.
- * </p>
- *
- * @param name Identifies the document root element. This name comes
- * from a DOCTYPE declaration (where available) or from the actual
- * root element.
- * @param baseURI The document's base URI, serving as an additional
- * hint for selecting the external subset. This is always an absolute
- * URI, unless it is null because the XMLReader was given an InputSource
- * without one.
- *
- * @return An InputSource object describing the new external subset
- * to be used by the parser, or null to indicate that no external
- * subset is provided.
- *
- * @exception SAXException Any SAX exception, possibly wrapping
- * another exception.
- * @exception IOException Probably indicating a failure to create
- * a new InputStream or Reader, or an illegal URL.
- */
- public InputSource getExternalSubset (String name, String baseURI)
- throws SAXException, IOException;
-
- /**
- * Allows applications to map references to external entities into input
- * sources, or tell the parser it should use conventional URI resolution.
- * This method is only called for external entities which have been
- * properly declared.
- * This method provides more flexibility than the {@link EntityResolver}
- * interface, supporting implementations of more complex catalogue
- * schemes such as the one defined by the <a href=
- "http://www.oasis-open.org/committees/entity/spec-2001-08-06.html"
- >OASIS XML Catalogs</a> specification.</p>
- *
- * <p>Parsers configured to use this resolver method will call it
- * to determine the input source to use for any external entity
- * being included because of a reference in the XML text.
- * That excludes the document entity, and any external entity returned
- * by {@link #getExternalSubset getExternalSubset()}.
- * When a (non-validating) processor is configured not to include
- * a class of entities (parameter or general) through use of feature
- * flags, this method is not invoked for such entities. </p>
- *
- * <p>Note that the entity naming scheme used here is the same one
- * used in the {@link LexicalHandler}, or in the {@link
- org.xml.sax.ContentHandler#skippedEntity
- ContentHandler.skippedEntity()}
- * method. </p>
- *
- * @param name Identifies the external entity being resolved.
- * Either "[dtd]" for the external subset, or a name starting
- * with "%" to indicate a parameter entity, or else the name of
- * a general entity. This is never null when invoked by a SAX2
- * parser.
- * @param publicId The public identifier of the external entity being
- * referenced (normalized as required by the XML specification), or
- * null if none was supplied.
- * @param baseURI The URI with respect to which relative systemIDs
- * are interpreted. This is always an absolute URI, unless it is
- * null (likely because the XMLReader was given an InputSource without
- * one). This URI is defined by the XML specification to be the one
- * associated with the "&lt;" starting the relevant declaration.
- * @param systemId The system identifier of the external entity
- * being referenced; either a relative or absolute URI.
- * This is never null when invoked by a SAX2 parser; only declared
- * entities, and any external subset, are resolved by such parsers.
- *
- * @return An InputSource object describing the new input source to
- * be used by the parser. Returning null directs the parser to
- * resolve the system ID against the base URI and open a connection
- * to resulting URI.
- *
- * @exception SAXException Any SAX exception, possibly wrapping
- * another exception.
- * @exception IOException Probably indicating a failure to create
- * a new InputStream or Reader, or an illegal URL.
- */
- public InputSource resolveEntity (
- String name,
- String publicId,
- String baseURI,
- String systemId
- ) throws SAXException, IOException;
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/LexicalHandler.java b/external/jaxp/source/org/xml/sax/ext/LexicalHandler.java
deleted file mode 100755
index f59062c1a..000000000
--- a/external/jaxp/source/org/xml/sax/ext/LexicalHandler.java
+++ /dev/null
@@ -1,211 +0,0 @@
-// LexicalHandler.java - optional handler for lexical parse events.
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import org.xml.sax.SAXException;
-
-/**
- * SAX2 extension handler for lexical events.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This is an optional extension handler for SAX2 to provide
- * lexical information about an XML document, such as comments
- * and CDATA section boundaries.
- * XML readers are not required to recognize this handler, and it
- * is not part of core-only SAX2 distributions.</p>
- *
- * <p>The events in the lexical handler apply to the entire document,
- * not just to the document element, and all lexical handler events
- * must appear between the content handler's startDocument and
- * endDocument events.</p>
- *
- * <p>To set the LexicalHandler for an XML reader, use the
- * {@link org.xml.sax.XMLReader#setProperty setProperty} method
- * with the property name
- * <code>http://xml.org/sax/properties/lexical-handler</code>
- * and an object implementing this interface (or null) as the value.
- * If the reader does not report lexical events, it will throw a
- * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}
- * when you attempt to register the handler.</p>
- *
- * @since SAX 2.0 (extensions 1.0)
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- */
-public interface LexicalHandler
-{
-
- /**
- * Report the start of DTD declarations, if any.
- *
- * <p>This method is intended to report the beginning of the
- * DOCTYPE declaration; if the document has no DOCTYPE declaration,
- * this method will not be invoked.</p>
- *
- * <p>All declarations reported through
- * {@link org.xml.sax.DTDHandler DTDHandler} or
- * {@link org.xml.sax.ext.DeclHandler DeclHandler} events must appear
- * between the startDTD and {@link #endDTD endDTD} events.
- * Declarations are assumed to belong to the internal DTD subset
- * unless they appear between {@link #startEntity startEntity}
- * and {@link #endEntity endEntity} events. Comments and
- * processing instructions from the DTD should also be reported
- * between the startDTD and endDTD events, in their original
- * order of (logical) occurrence; they are not required to
- * appear in their correct locations relative to DTDHandler
- * or DeclHandler events, however.</p>
- *
- * <p>Note that the start/endDTD events will appear within
- * the start/endDocument events from ContentHandler and
- * before the first
- * {@link org.xml.sax.ContentHandler#startElement startElement}
- * event.</p>
- *
- * @param name The document type name.
- * @param publicId The declared public identifier for the
- * external DTD subset, or null if none was declared.
- * @param systemId The declared system identifier for the
- * external DTD subset, or null if none was declared.
- * (Note that this is not resolved against the document
- * base URI.)
- * @exception SAXException The application may raise an
- * exception.
- * @see #endDTD
- * @see #startEntity
- */
- public abstract void startDTD (String name, String publicId,
- String systemId)
- throws SAXException;
-
-
- /**
- * Report the end of DTD declarations.
- *
- * <p>This method is intended to report the end of the
- * DOCTYPE declaration; if the document has no DOCTYPE declaration,
- * this method will not be invoked.</p>
- *
- * @exception SAXException The application may raise an exception.
- * @see #startDTD
- */
- public abstract void endDTD ()
- throws SAXException;
-
-
- /**
- * Report the beginning of some internal and external XML entities.
- *
- * <p>The reporting of parameter entities (including
- * the external DTD subset) is optional, and SAX2 drivers that
- * report LexicalHandler events may not implement it; you can use the
- * <code
- * >http://xml.org/sax/features/lexical-handler/parameter-entities</code>
- * feature to query or control the reporting of parameter entities.</p>
- *
- * <p>General entities are reported with their regular names,
- * parameter entities have '%' prepended to their names, and
- * the external DTD subset has the pseudo-entity name "[dtd]".</p>
- *
- * <p>When a SAX2 driver is providing these events, all other
- * events must be properly nested within start/end entity
- * events. There is no additional requirement that events from
- * {@link org.xml.sax.ext.DeclHandler DeclHandler} or
- * {@link org.xml.sax.DTDHandler DTDHandler} be properly ordered.</p>
- *
- * <p>Note that skipped entities will be reported through the
- * {@link org.xml.sax.ContentHandler#skippedEntity skippedEntity}
- * event, which is part of the ContentHandler interface.</p>
- *
- * <p>Because of the streaming event model that SAX uses, some
- * entity boundaries cannot be reported under any
- * circumstances:</p>
- *
- * <ul>
- * <li>general entities within attribute values</li>
- * <li>parameter entities within declarations</li>
- * </ul>
- *
- * <p>These will be silently expanded, with no indication of where
- * the original entity boundaries were.</p>
- *
- * <p>Note also that the boundaries of character references (which
- * are not really entities anyway) are not reported.</p>
- *
- * <p>All start/endEntity events must be properly nested.
- *
- * @param name The name of the entity. If it is a parameter
- * entity, the name will begin with '%', and if it is the
- * external DTD subset, it will be "[dtd]".
- * @exception SAXException The application may raise an exception.
- * @see #endEntity
- * @see org.xml.sax.ext.DeclHandler#internalEntityDecl
- * @see org.xml.sax.ext.DeclHandler#externalEntityDecl
- */
- public abstract void startEntity (String name)
- throws SAXException;
-
-
- /**
- * Report the end of an entity.
- *
- * @param name The name of the entity that is ending.
- * @exception SAXException The application may raise an exception.
- * @see #startEntity
- */
- public abstract void endEntity (String name)
- throws SAXException;
-
-
- /**
- * Report the start of a CDATA section.
- *
- * <p>The contents of the CDATA section will be reported through
- * the regular {@link org.xml.sax.ContentHandler#characters
- * characters} event; this event is intended only to report
- * the boundary.</p>
- *
- * @exception SAXException The application may raise an exception.
- * @see #endCDATA
- */
- public abstract void startCDATA ()
- throws SAXException;
-
-
- /**
- * Report the end of a CDATA section.
- *
- * @exception SAXException The application may raise an exception.
- * @see #startCDATA
- */
- public abstract void endCDATA ()
- throws SAXException;
-
-
- /**
- * Report an XML comment anywhere in the document.
- *
- * <p>This callback will be used for comments inside or outside the
- * document element, including comments in the external DTD
- * subset (if read). Comments in the DTD must be properly
- * nested inside start/endDTD and start/endEntity events (if
- * used).</p>
- *
- * @param ch An array holding the characters in the comment.
- * @param start The starting position in the array.
- * @param length The number of characters to use from the array.
- * @exception SAXException The application may raise an exception.
- */
- public abstract void comment (char ch[], int start, int length)
- throws SAXException;
-
-}
-
-// end of LexicalHandler.java
diff --git a/external/jaxp/source/org/xml/sax/ext/Locator2.java b/external/jaxp/source/org/xml/sax/ext/Locator2.java
deleted file mode 100644
index 150a1ba11..000000000
--- a/external/jaxp/source/org/xml/sax/ext/Locator2.java
+++ /dev/null
@@ -1,76 +0,0 @@
-// Locator2.java - extended Locator
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import org.xml.sax.Locator;
-
-
-/**
- * SAX2 extension to augment the entity information provided
- * though a {@link Locator}.
- * If an implementation supports this extension, the Locator
- * provided in {@link org.xml.sax.ContentHandler#setDocumentLocator
- * ContentHandler.setDocumentLocator() } will implement this
- * interface, and the
- * <em>http://xml.org/sax/features/use-locator2</em> feature
- * flag will have the value <em>true</em>.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p> XMLReader implementations are not required to support this
- * information, and it is not part of core-only SAX2 distributions.</p>
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBS
- */
-public interface Locator2 extends Locator
-{
- /**
- * Returns the version of XML used for the entity. This will
- * normally be the identifier from the current entity's
- * <em>&lt;?xml&nbsp;version='...'&nbsp;...?&gt;</em> declaration,
- * or be defaulted by the parser.
- *
- * <p> At this writing, only one version ("1.0") is defined, but it
- * seems likely that a new version will be defined which has slightly
- * different rules about which characters are legal in XML names.
- *
- * @return Identifier for the XML version being used to interpret
- * the entity's text.
- */
- public String getXMLVersion ();
-
- /**
- * Returns the name of the character encoding for the entity.
- * If the encoding was declared externally (for example, in a MIME
- * Content-Type header), that will be the name returned. Else if there
- * was an <em>&lt;?xml&nbsp;...encoding='...'?&gt;</em> declaration at
- * the start of the document, that encoding name will be returned.
- * Otherwise the encoding will been inferred (normally to be UTF-8, or
- * some UTF-16 variant), and that inferred name will be returned.
- *
- * <p>When an {@link org.xml.sax.InputSource InputSource} is used
- * to provide an entity's character stream, this method returns the
- * encoding provided in that input stream.
- *
- * <p> Note that some recent W3C specifications require that text
- * in some encodings be normalized, using Unicode Normalization
- * Form C, before processing. Such normalization must be performed
- * by applications, and would normally be triggered based on the
- * value returned by this method.
- *
- * <p> Encoding names may be those used by the underlying JVM,
- * and comparisons should be case-insensitive.
- *
- * @return Name of the character encoding being used to interpret
- * the entity's text, or null if this was not provided for a
- * character stream passed through an InputSource.
- */
- public String getEncoding ();
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/Locator2Impl.java b/external/jaxp/source/org/xml/sax/ext/Locator2Impl.java
deleted file mode 100644
index c77dfe605..000000000
--- a/external/jaxp/source/org/xml/sax/ext/Locator2Impl.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Locator2Impl.java - extended LocatorImpl
-// http://www.saxproject.org
-// Public Domain: no warranty.
-
-package org.xml.sax.ext;
-
-import org.xml.sax.Locator;
-import org.xml.sax.helpers.LocatorImpl;
-
-
-/**
- * SAX2 extension helper for holding additional Entity information,
- * implementing the {@link Locator2} interface.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * </blockquote>
- *
- * <p> This is not part of core-only SAX2 distributions.</p>
- *
- * @since SAX 2.0 (extensions 1.1 alpha)
- * @author David Brownell
- * @version TBS
- */
-public class Locator2Impl extends LocatorImpl implements Locator2
-{
- private String encoding;
- private String version;
-
-
- /**
- * Construct a new, empty Locator2Impl object.
- * This will not normally be useful, since the main purpose
- * of this class is to make a snapshot of an existing Locator.
- */
- public Locator2Impl () { }
-
- /**
- * Copy an existing Locator or Locator2 object.
- * If the object implements Locator2, values of the
- * <em>encoding</em> and <em>version</em>strings are copied,
- * otherwise they set to <em>null</em>.
- *
- * @param locator The existing Locator object.
- */
- public Locator2Impl (Locator locator)
- {
- super (locator);
- if (locator instanceof Locator2) {
- Locator2 l2 = (Locator2) locator;
-
- version = l2.getXMLVersion ();
- encoding = l2.getEncoding ();
- }
- }
-
- ////////////////////////////////////////////////////////////////////
- // Locator2 method implementations
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Returns the current value of the version property.
- *
- * @see #setXMLVersion
- */
- public String getXMLVersion ()
- { return version; }
-
- /**
- * Returns the current value of the encoding property.
- *
- * @see #setEncoding
- */
- public String getEncoding ()
- { return encoding; }
-
-
- ////////////////////////////////////////////////////////////////////
- // Setters
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Assigns the current value of the version property.
- *
- * @param version the new "version" value
- * @see #getXMLVersion
- */
- public void setXMLVersion (String version)
- { this.version = version; }
-
- /**
- * Assigns the current value of the encoding property.
- *
- * @param version the new "encoding" value
- * @see #getEncoding
- */
- public void setEncoding (String encoding)
- { this.encoding = encoding; }
-}
diff --git a/external/jaxp/source/org/xml/sax/ext/package.html b/external/jaxp/source/org/xml/sax/ext/package.html
deleted file mode 100755
index 6f5db3e3b..000000000
--- a/external/jaxp/source/org/xml/sax/ext/package.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<HTML><HEAD>
-<!-- $Id: package.html,v 1.2 2004-05-01 16:18:52 mark Exp $ -->
-</HEAD><BODY>
-
-<p>
-This package contains interfaces to SAX2 facilities that
-conformant SAX drivers won't necessarily support.
-
-<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
-for more information about SAX.</p>
-
-<p> This package is independent of the SAX2 core, though the functionality
-exposed generally needs to be implemented within a parser core.
-That independence has several consequences:</p>
-
-<ul>
-
-<li>SAX2 drivers are <em>not</em> required to recognize these handlers.
-</li>
-
-<li>You cannot assume that the class files will be present in every SAX2
-installation.</li>
-
-<li>This package may be updated independently of SAX2 (i.e. new
-handlers and classes may be added without updating SAX2 itself).</li>
-
-<li>The new handlers are not implemented by the SAX2
-<code>org.xml.sax.helpers.DefaultHandler</code> or
-<code>org.xml.sax.helpers.XMLFilterImpl</code> classes.
-You can subclass these if you need such behavior, or
-use the helper classes found here.</li>
-
-<li>The handlers need to be registered differently than core SAX2
-handlers.</li>
-
-</ul>
-
-<p>This package, SAX2-ext, is a standardized extension to SAX2. It is
-designed both to allow SAX parsers to pass certain types of information
-to applications, and to serve as a simple model for other SAX2 parser
-extension packages. Not all such extension packages should need to
-be recognized directly by parsers, however.
-As an example, most validation systems can be cleanly layered on top
-of parsers supporting the standardized SAX2 interfaces. </p>
-
-</BODY></HTML>
diff --git a/external/jaxp/source/org/xml/sax/helpers/AttributeListImpl.java b/external/jaxp/source/org/xml/sax/helpers/AttributeListImpl.java
deleted file mode 100755
index a8009e8a2..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/AttributeListImpl.java
+++ /dev/null
@@ -1,311 +0,0 @@
-// SAX default implementation for AttributeList.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.AttributeList;
-
-import java.util.Vector;
-
-
-/**
- * Default implementation for AttributeList.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>AttributeList implements the deprecated SAX1 {@link
- * org.xml.sax.AttributeList AttributeList} interface, and has been
- * replaced by the new SAX2 {@link org.xml.sax.helpers.AttributesImpl
- * AttributesImpl} interface.</p>
- *
- * <p>This class provides a convenience implementation of the SAX
- * {@link org.xml.sax.AttributeList AttributeList} interface. This
- * implementation is useful both for SAX parser writers, who can use
- * it to provide attributes to the application, and for SAX application
- * writers, who can use it to create a persistent copy of an element's
- * attribute specifications:</p>
- *
- * <pre>
- * private AttributeList myatts;
- *
- * public void startElement (String name, AttributeList atts)
- * {
- * // create a persistent copy of the attribute list
- * // for use outside this method
- * myatts = new AttributeListImpl(atts);
- * [...]
- * }
- * </pre>
- *
- * <p>Please note that SAX parsers are not required to use this
- * class to provide an implementation of AttributeList; it is
- * supplied only as an optional convenience. In particular,
- * parser writers are encouraged to invent more efficient
- * implementations.</p>
- *
- * @deprecated This class implements a deprecated interface,
- * {@link org.xml.sax.AttributeList AttributeList};
- * that interface has been replaced by
- * {@link org.xml.sax.Attributes Attributes},
- * which is implemented in the
- * {@link org.xml.sax.helpers.AttributesImpl
- * AttributesImpl} helper class.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.AttributeList
- * @see org.xml.sax.DocumentHandler#startElement
- */
-public class AttributeListImpl implements AttributeList
-{
-
- /**
- * Create an empty attribute list.
- *
- * <p>This constructor is most useful for parser writers, who
- * will use it to create a single, reusable attribute list that
- * can be reset with the clear method between elements.</p>
- *
- * @see #addAttribute
- * @see #clear
- */
- public AttributeListImpl ()
- {
- }
-
-
- /**
- * Construct a persistent copy of an existing attribute list.
- *
- * <p>This constructor is most useful for application writers,
- * who will use it to create a persistent copy of an existing
- * attribute list.</p>
- *
- * @param atts The attribute list to copy
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public AttributeListImpl (AttributeList atts)
- {
- setAttributeList(atts);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Methods specific to this class.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the attribute list, discarding previous contents.
- *
- * <p>This method allows an application writer to reuse an
- * attribute list easily.</p>
- *
- * @param atts The attribute list to copy.
- */
- public void setAttributeList (AttributeList atts)
- {
- int count = atts.getLength();
-
- clear();
-
- for (int i = 0; i < count; i++) {
- addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
- }
- }
-
-
- /**
- * Add an attribute to an attribute list.
- *
- * <p>This method is provided for SAX parser writers, to allow them
- * to build up an attribute list incrementally before delivering
- * it to the application.</p>
- *
- * @param name The attribute name.
- * @param type The attribute type ("NMTOKEN" for an enumeration).
- * @param value The attribute value (must not be null).
- * @see #removeAttribute
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public void addAttribute (String name, String type, String value)
- {
- names.addElement(name);
- types.addElement(type);
- values.addElement(value);
- }
-
-
- /**
- * Remove an attribute from the list.
- *
- * <p>SAX application writers can use this method to filter an
- * attribute out of an AttributeList. Note that invoking this
- * method will change the length of the attribute list and
- * some of the attribute's indices.</p>
- *
- * <p>If the requested attribute is not in the list, this is
- * a no-op.</p>
- *
- * @param name The attribute name.
- * @see #addAttribute
- */
- public void removeAttribute (String name)
- {
- int i = names.indexOf(name);
-
- if (i >= 0) {
- names.removeElementAt(i);
- types.removeElementAt(i);
- values.removeElementAt(i);
- }
- }
-
-
- /**
- * Clear the attribute list.
- *
- * <p>SAX parser writers can use this method to reset the attribute
- * list between DocumentHandler.startElement events. Normally,
- * it will make sense to reuse the same AttributeListImpl object
- * rather than allocating a new one each time.</p>
- *
- * @see org.xml.sax.DocumentHandler#startElement
- */
- public void clear ()
- {
- names.removeAllElements();
- types.removeAllElements();
- values.removeAllElements();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.AttributeList
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in the list.
- *
- * @return The number of attributes in the list.
- * @see org.xml.sax.AttributeList#getLength
- */
- public int getLength ()
- {
- return names.size();
- }
-
-
- /**
- * Get the name of an attribute (by position).
- *
- * @param i The position of the attribute in the list.
- * @return The attribute name as a string, or null if there
- * is no attribute at that position.
- * @see org.xml.sax.AttributeList#getName(int)
- */
- public String getName (int i)
- {
- if (i < 0) {
- return null;
- }
- try {
- return (String)names.elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
-
- /**
- * Get the type of an attribute (by position).
- *
- * @param i The position of the attribute in the list.
- * @return The attribute type as a string ("NMTOKEN" for an
- * enumeration, and "CDATA" if no declaration was
- * read), or null if there is no attribute at
- * that position.
- * @see org.xml.sax.AttributeList#getType(int)
- */
- public String getType (int i)
- {
- if (i < 0) {
- return null;
- }
- try {
- return (String)types.elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
-
- /**
- * Get the value of an attribute (by position).
- *
- * @param i The position of the attribute in the list.
- * @return The attribute value as a string, or null if
- * there is no attribute at that position.
- * @see org.xml.sax.AttributeList#getValue(int)
- */
- public String getValue (int i)
- {
- if (i < 0) {
- return null;
- }
- try {
- return (String)values.elementAt(i);
- } catch (ArrayIndexOutOfBoundsException e) {
- return null;
- }
- }
-
-
- /**
- * Get the type of an attribute (by name).
- *
- * @param name The attribute name.
- * @return The attribute type as a string ("NMTOKEN" for an
- * enumeration, and "CDATA" if no declaration was
- * read).
- * @see org.xml.sax.AttributeList#getType(java.lang.String)
- */
- public String getType (String name)
- {
- return getType(names.indexOf(name));
- }
-
-
- /**
- * Get the value of an attribute (by name).
- *
- * @param name The attribute name.
- * @see org.xml.sax.AttributeList#getValue(java.lang.String)
- */
- public String getValue (String name)
- {
- return getValue(names.indexOf(name));
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- Vector names = new Vector();
- Vector types = new Vector();
- Vector values = new Vector();
-
-}
-
-// end of AttributeListImpl.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/AttributesImpl.java b/external/jaxp/source/org/xml/sax/helpers/AttributesImpl.java
deleted file mode 100755
index 0a6099e93..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/AttributesImpl.java
+++ /dev/null
@@ -1,617 +0,0 @@
-// AttributesImpl.java - default implementation of Attributes.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the public domain.
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.Attributes;
-
-
-/**
- * Default implementation of the Attributes interface.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class provides a default implementation of the SAX2
- * {@link org.xml.sax.Attributes Attributes} interface, with the
- * addition of manipulators so that the list can be modified or
- * reused.</p>
- *
- * <p>There are two typical uses of this class:</p>
- *
- * <ol>
- * <li>to take a persistent snapshot of an Attributes object
- * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or</li>
- * <li>to construct or modify an Attributes object in a SAX2 driver or filter.</li>
- * </ol>
- *
- * <p>This class replaces the now-deprecated SAX1 {@link
- * org.xml.sax.helpers.AttributeListImpl AttributeListImpl}
- * class; in addition to supporting the updated Attributes
- * interface rather than the deprecated {@link org.xml.sax.AttributeList
- * AttributeList} interface, it also includes a much more efficient
- * implementation using a single array rather than a set of Vectors.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- */
-public class AttributesImpl implements Attributes
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct a new, empty AttributesImpl object.
- */
- public AttributesImpl ()
- {
- length = 0;
- data = null;
- }
-
-
- /**
- * Copy an existing Attributes object.
- *
- * <p>This constructor is especially useful inside a
- * {@link org.xml.sax.ContentHandler#startElement startElement} event.</p>
- *
- * @param atts The existing Attributes object.
- */
- public AttributesImpl (Attributes atts)
- {
- setAttributes(atts);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.Attributes.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the number of attributes in the list.
- *
- * @return The number of attributes in the list.
- * @see org.xml.sax.Attributes#getLength
- */
- public int getLength ()
- {
- return length;
- }
-
-
- /**
- * Return an attribute's Namespace URI.
- *
- * @param index The attribute's index (zero-based).
- * @return The Namespace URI, the empty string if none is
- * available, or null if the index is out of range.
- * @see org.xml.sax.Attributes#getURI
- */
- public String getURI (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's local name.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's local name, the empty string if
- * none is available, or null if the index if out of range.
- * @see org.xml.sax.Attributes#getLocalName
- */
- public String getLocalName (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+1];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's qualified (prefixed) name.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's qualified name, the empty string if
- * none is available, or null if the index is out of bounds.
- * @see org.xml.sax.Attributes#getQName
- */
- public String getQName (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+2];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's type by index.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's type, "CDATA" if the type is unknown, or null
- * if the index is out of bounds.
- * @see org.xml.sax.Attributes#getType(int)
- */
- public String getType (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+3];
- } else {
- return null;
- }
- }
-
-
- /**
- * Return an attribute's value by index.
- *
- * @param index The attribute's index (zero-based).
- * @return The attribute's value or null if the index is out of bounds.
- * @see org.xml.sax.Attributes#getValue(int)
- */
- public String getValue (int index)
- {
- if (index >= 0 && index < length) {
- return data[index*5+4];
- } else {
- return null;
- }
- }
-
-
- /**
- * Look up an attribute's index by Namespace name.
- *
- * <p>In many cases, it will be more efficient to look up the name once and
- * use the index query methods rather than using the name query methods
- * repeatedly.</p>
- *
- * @param uri The attribute's Namespace URI, or the empty
- * string if none is available.
- * @param localName The attribute's local name.
- * @return The attribute's index, or -1 if none matches.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
- */
- public int getIndex (String uri, String localName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i].equals(uri) && data[i+1].equals(localName)) {
- return i / 5;
- }
- }
- return -1;
- }
-
-
- /**
- * Look up an attribute's index by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's index, or -1 if none matches.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String)
- */
- public int getIndex (String qName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i+2].equals(qName)) {
- return i / 5;
- }
- }
- return -1;
- }
-
-
- /**
- * Look up an attribute's type by Namespace-qualified name.
- *
- * @param uri The Namespace URI, or the empty string for a name
- * with no explicit Namespace URI.
- * @param localName The local name.
- * @return The attribute's type, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String)
- */
- public String getType (String uri, String localName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i].equals(uri) && data[i+1].equals(localName)) {
- return data[i+3];
- }
- }
- return null;
- }
-
-
- /**
- * Look up an attribute's type by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's type, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getType(java.lang.String)
- */
- public String getType (String qName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i+2].equals(qName)) {
- return data[i+3];
- }
- }
- return null;
- }
-
-
- /**
- * Look up an attribute's value by Namespace-qualified name.
- *
- * @param uri The Namespace URI, or the empty string for a name
- * with no explicit Namespace URI.
- * @param localName The local name.
- * @return The attribute's value, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String)
- */
- public String getValue (String uri, String localName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i].equals(uri) && data[i+1].equals(localName)) {
- return data[i+4];
- }
- }
- return null;
- }
-
-
- /**
- * Look up an attribute's value by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's value, or null if there is no
- * matching attribute.
- * @see org.xml.sax.Attributes#getValue(java.lang.String)
- */
- public String getValue (String qName)
- {
- int max = length * 5;
- for (int i = 0; i < max; i += 5) {
- if (data[i+2].equals(qName)) {
- return data[i+4];
- }
- }
- return null;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Manipulators.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Clear the attribute list for reuse.
- *
- * <p>Note that little memory is freed by this call:
- * the current array is kept so it can be
- * reused.</p>
- */
- public void clear ()
- {
- if (data != null) {
- for (int i = 0; i < (length * 5); i++)
- data [i] = null;
- }
- length = 0;
- }
-
-
- /**
- * Copy an entire Attributes object.
- *
- * <p>It may be more efficient to reuse an existing object
- * rather than constantly allocating new ones.</p>
- *
- * @param atts The attributes to copy.
- */
- public void setAttributes (Attributes atts)
- {
- clear();
- length = atts.getLength();
- if (length > 0) {
- data = new String[length*5];
- for (int i = 0; i < length; i++) {
- data[i*5] = atts.getURI(i);
- data[i*5+1] = atts.getLocalName(i);
- data[i*5+2] = atts.getQName(i);
- data[i*5+3] = atts.getType(i);
- data[i*5+4] = atts.getValue(i);
- }
- }
- }
-
-
- /**
- * Add an attribute to the end of the list.
- *
- * <p>For the sake of speed, this method does no checking
- * to see if the attribute is already in the list: that is
- * the responsibility of the application.</p>
- *
- * @param uri The Namespace URI, or the empty string if
- * none is available or Namespace processing is not
- * being performed.
- * @param localName The local name, or the empty string if
- * Namespace processing is not being performed.
- * @param qName The qualified (prefixed) name, or the empty string
- * if qualified names are not available.
- * @param type The attribute type as a string.
- * @param value The attribute value.
- */
- public void addAttribute (String uri, String localName, String qName,
- String type, String value)
- {
- ensureCapacity(length+1);
- data[length*5] = uri;
- data[length*5+1] = localName;
- data[length*5+2] = qName;
- data[length*5+3] = type;
- data[length*5+4] = value;
- length++;
- }
-
-
- /**
- * Set an attribute in the list.
- *
- * <p>For the sake of speed, this method does no checking
- * for name conflicts or well-formedness: such checks are the
- * responsibility of the application.</p>
- *
- * @param index The index of the attribute (zero-based).
- * @param uri The Namespace URI, or the empty string if
- * none is available or Namespace processing is not
- * being performed.
- * @param localName The local name, or the empty string if
- * Namespace processing is not being performed.
- * @param qName The qualified name, or the empty string
- * if qualified names are not available.
- * @param type The attribute type as a string.
- * @param value The attribute value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setAttribute (int index, String uri, String localName,
- String qName, String type, String value)
- {
- if (index >= 0 && index < length) {
- data[index*5] = uri;
- data[index*5+1] = localName;
- data[index*5+2] = qName;
- data[index*5+3] = type;
- data[index*5+4] = value;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Remove an attribute from the list.
- *
- * @param index The index of the attribute (zero-based).
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void removeAttribute (int index)
- {
- if (index >= 0 && index < length) {
- if (index < length - 1) {
- System.arraycopy(data, (index+1)*5, data, index*5,
- (length-index-1)*5);
- }
- index = (length - 1) * 5;
- data [index++] = null;
- data [index++] = null;
- data [index++] = null;
- data [index++] = null;
- data [index] = null;
- length--;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the Namespace URI of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param uri The attribute's Namespace URI, or the empty
- * string for none.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setURI (int index, String uri)
- {
- if (index >= 0 && index < length) {
- data[index*5] = uri;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the local name of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param localName The attribute's local name, or the empty
- * string for none.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setLocalName (int index, String localName)
- {
- if (index >= 0 && index < length) {
- data[index*5+1] = localName;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the qualified name of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param qName The attribute's qualified name, or the empty
- * string for none.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setQName (int index, String qName)
- {
- if (index >= 0 && index < length) {
- data[index*5+2] = qName;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the type of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param type The attribute's type.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setType (int index, String type)
- {
- if (index >= 0 && index < length) {
- data[index*5+3] = type;
- } else {
- badIndex(index);
- }
- }
-
-
- /**
- * Set the value of a specific attribute.
- *
- * @param index The index of the attribute (zero-based).
- * @param value The attribute's value.
- * @exception java.lang.ArrayIndexOutOfBoundsException When the
- * supplied index does not point to an attribute
- * in the list.
- */
- public void setValue (int index, String value)
- {
- if (index >= 0 && index < length) {
- data[index*5+4] = value;
- } else {
- badIndex(index);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Ensure the internal array's capacity.
- *
- * @param n The minimum number of attributes that the array must
- * be able to hold.
- */
- private void ensureCapacity (int n) {
- if (n <= 0) {
- return;
- }
- int max;
- if (data == null || data.length == 0) {
- max = 25;
- }
- else if (data.length >= n * 5) {
- return;
- }
- else {
- max = data.length;
- }
- while (max < n * 5) {
- max *= 2;
- }
-
- String newData[] = new String[max];
- if (length > 0) {
- System.arraycopy(data, 0, newData, 0, length*5);
- }
- data = newData;
- }
-
-
- /**
- * Report a bad array index in a manipulator.
- *
- * @param index The index to report.
- * @exception java.lang.ArrayIndexOutOfBoundsException Always.
- */
- private void badIndex (int index)
- throws ArrayIndexOutOfBoundsException
- {
- String msg =
- "Attempt to modify attribute at illegal index: " + index;
- throw new ArrayIndexOutOfBoundsException(msg);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- int length;
- String data [];
-
-}
-
-// end of AttributesImpl.java
-
diff --git a/external/jaxp/source/org/xml/sax/helpers/DefaultHandler.java b/external/jaxp/source/org/xml/sax/helpers/DefaultHandler.java
deleted file mode 100755
index 343774dec..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/DefaultHandler.java
+++ /dev/null
@@ -1,466 +0,0 @@
-// DefaultHandler.java - default implementation of the core handlers.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the public domain.
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-
-/**
- * Default base class for SAX2 event handlers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class is available as a convenience base class for SAX2
- * applications: it provides default implementations for all of the
- * callbacks in the four core SAX2 handler classes:</p>
- *
- * <ul>
- * <li>{@link org.xml.sax.EntityResolver EntityResolver}</li>
- * <li>{@link org.xml.sax.DTDHandler DTDHandler}</li>
- * <li>{@link org.xml.sax.ContentHandler ContentHandler}</li>
- * <li>{@link org.xml.sax.ErrorHandler ErrorHandler}</li>
- * </ul>
- *
- * <p>Application writers can extend this class when they need to
- * implement only part of an interface; parser writers can
- * instantiate this class to provide default handlers when the
- * application has not supplied its own.</p>
- *
- * <p>This class replaces the deprecated SAX1
- * {@link org.xml.sax.HandlerBase HandlerBase} class.</p>
- *
- * @since SAX 2.0
- * @author David Megginson,
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.ContentHandler
- * @see org.xml.sax.ErrorHandler
- */
-public class DefaultHandler
- implements EntityResolver, DTDHandler, ContentHandler, ErrorHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the EntityResolver interface.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Resolve an external entity.
- *
- * <p>Always return null, so that the parser will use the system
- * identifier provided in the XML document. This method implements
- * the SAX default behaviour: application writers can override it
- * in a subclass to do special translations such as catalog lookups
- * or URI redirection.</p>
- *
- * @param publicId The public identifer, or null if none is
- * available.
- * @param systemId The system identifier provided in the XML
- * document.
- * @return The new input source, or null to require the
- * default behaviour.
- * @exception java.io.IOException If there is an error setting
- * up the new input source.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.EntityResolver#resolveEntity
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws IOException, SAXException
- {
- return null;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of DTDHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a notation declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to keep track of the notations
- * declared in a document.</p>
- *
- * @param name The notation name.
- * @param publicId The notation public identifier, or null if not
- * available.
- * @param systemId The notation system identifier.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DTDHandler#notationDecl
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of an unparsed entity declaration.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to keep track of the unparsed entities
- * declared in a document.</p>
- *
- * @param name The entity name.
- * @param publicId The entity public identifier, or null if not
- * available.
- * @param systemId The entity system identifier.
- * @param notationName The name of the associated notation.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.DTDHandler#unparsedEntityDecl
- */
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
- throws SAXException
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of ContentHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive a Locator object for document events.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass if they wish to store the locator for use
- * with other document events.</p>
- *
- * @param locator A locator for all SAX document events.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- * @see org.xml.sax.Locator
- */
- public void setDocumentLocator (Locator locator)
- {
- // no op
- }
-
-
- /**
- * Receive notification of the beginning of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the beginning
- * of a document (such as allocating the root node of a tree or
- * creating an output file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of the document.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end
- * of a document (such as finalising a tree or closing an output
- * file).</p>
- *
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the start of a Namespace mapping.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each Namespace prefix scope (such as storing the prefix mapping).</p>
- *
- * @param prefix The Namespace prefix being declared.
- * @param uri The Namespace URI mapped to the prefix.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of a Namespace mapping.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each prefix mapping.</p>
- *
- * @param prefix The Namespace prefix being declared.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
- */
- public void endPrefixMapping (String prefix)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the start of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the start of
- * each element (such as allocating a new tree node or writing
- * output to a file).</p>
- *
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param qName The qualified name (with prefix), or the
- * empty string if qualified names are not available.
- * @param atts The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#startElement
- */
- public void startElement (String uri, String localName,
- String qName, Attributes attributes)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of the end of an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions at the end of
- * each element (such as finalising a tree node or writing
- * output to a file).</p>
- *
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param qName The qualified name (with prefix), or the
- * empty string if qualified names are not available.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#endElement
- */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of character data inside an element.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of character data
- * (such as adding the data to a node or buffer, or printing it to
- * a file).</p>
- *
- * @param ch The characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of ignorable whitespace in element content.
- *
- * <p>By default, do nothing. Application writers may override this
- * method to take specific actions for each chunk of ignorable
- * whitespace (such as adding data to a node or buffer, or printing
- * it to a file).</p>
- *
- * @param ch The whitespace characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a processing instruction.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods.</p>
- *
- * @param target The processing instruction target.
- * @param data The processing instruction data, or null if
- * none is supplied.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a skipped entity.
- *
- * <p>By default, do nothing. Application writers may override this
- * method in a subclass to take specific actions for each
- * processing instruction, such as setting status variables or
- * invoking other methods.</p>
- *
- * @param name The name of the skipped entity.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- // no op
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Default implementation of the ErrorHandler interface.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Receive notification of a parser warning.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each warning, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void warning (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Receive notification of a recoverable parser error.
- *
- * <p>The default implementation does nothing. Application writers
- * may override this method in a subclass to take specific actions
- * for each error, such as inserting the message in a log file or
- * printing it to the console.</p>
- *
- * @param e The warning information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#warning
- * @see org.xml.sax.SAXParseException
- */
- public void error (SAXParseException e)
- throws SAXException
- {
- // no op
- }
-
-
- /**
- * Report a fatal XML parsing error.
- *
- * <p>The default implementation throws a SAXParseException.
- * Application writers may override this method in a subclass if
- * they need to take specific actions for each fatal error (such as
- * collecting all of the errors into a single report): in any case,
- * the application must stop all regular processing when this
- * method is invoked, since the document is no longer reliable, and
- * the parser may no longer report parsing events.</p>
- *
- * @param e The error information encoded as an exception.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ErrorHandler#fatalError
- * @see org.xml.sax.SAXParseException
- */
- public void fatalError (SAXParseException e)
- throws SAXException
- {
- throw e;
- }
-
-}
-
-// end of DefaultHandler.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/LocatorImpl.java b/external/jaxp/source/org/xml/sax/helpers/LocatorImpl.java
deleted file mode 100755
index a5b633c49..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/LocatorImpl.java
+++ /dev/null
@@ -1,213 +0,0 @@
-// SAX default implementation for Locator.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax.helpers;
-
-import org.xml.sax.Locator;
-
-
-/**
- * Provide an optional convenience implementation of Locator.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class is available mainly for application writers, who
- * can use it to make a persistent snapshot of a locator at any
- * point during a document parse:</p>
- *
- * <pre>
- * Locator locator;
- * Locator startloc;
- *
- * public void setLocator (Locator locator)
- * {
- * // note the locator
- * this.locator = locator;
- * }
- *
- * public void startDocument ()
- * {
- * // save the location of the start of the document
- * // for future use.
- * Locator startloc = new LocatorImpl(locator);
- * }
- *</pre>
- *
- * <p>Normally, parser writers will not use this class, since it
- * is more efficient to provide location information only when
- * requested, rather than constantly updating a Locator object.</p>
- *
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.Locator Locator
- */
-public class LocatorImpl implements Locator
-{
-
-
- /**
- * Zero-argument constructor.
- *
- * <p>This will not normally be useful, since the main purpose
- * of this class is to make a snapshot of an existing Locator.</p>
- */
- public LocatorImpl ()
- {
- }
-
-
- /**
- * Copy constructor.
- *
- * <p>Create a persistent copy of the current state of a locator.
- * When the original locator changes, this copy will still keep
- * the original values (and it can be used outside the scope of
- * DocumentHandler methods).</p>
- *
- * @param locator The locator to copy.
- */
- public LocatorImpl (Locator locator)
- {
- setPublicId(locator.getPublicId());
- setSystemId(locator.getSystemId());
- setLineNumber(locator.getLineNumber());
- setColumnNumber(locator.getColumnNumber());
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.Locator
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Return the saved public identifier.
- *
- * @return The public identifier as a string, or null if none
- * is available.
- * @see org.xml.sax.Locator#getPublicId
- * @see #setPublicId
- */
- public String getPublicId ()
- {
- return publicId;
- }
-
-
- /**
- * Return the saved system identifier.
- *
- * @return The system identifier as a string, or null if none
- * is available.
- * @see org.xml.sax.Locator#getSystemId
- * @see #setSystemId
- */
- public String getSystemId ()
- {
- return systemId;
- }
-
-
- /**
- * Return the saved line number (1-based).
- *
- * @return The line number as an integer, or -1 if none is available.
- * @see org.xml.sax.Locator#getLineNumber
- * @see #setLineNumber
- */
- public int getLineNumber ()
- {
- return lineNumber;
- }
-
-
- /**
- * Return the saved column number (1-based).
- *
- * @return The column number as an integer, or -1 if none is available.
- * @see org.xml.sax.Locator#getColumnNumber
- * @see #setColumnNumber
- */
- public int getColumnNumber ()
- {
- return columnNumber;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Setters for the properties (not in org.xml.sax.Locator)
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the public identifier for this locator.
- *
- * @param publicId The new public identifier, or null
- * if none is available.
- * @see #getPublicId
- */
- public void setPublicId (String publicId)
- {
- this.publicId = publicId;
- }
-
-
- /**
- * Set the system identifier for this locator.
- *
- * @param systemId The new system identifier, or null
- * if none is available.
- * @see #getSystemId
- */
- public void setSystemId (String systemId)
- {
- this.systemId = systemId;
- }
-
-
- /**
- * Set the line number for this locator (1-based).
- *
- * @param lineNumber The line number, or -1 if none is available.
- * @see #getLineNumber
- */
- public void setLineNumber (int lineNumber)
- {
- this.lineNumber = lineNumber;
- }
-
-
- /**
- * Set the column number for this locator (1-based).
- *
- * @param columnNumber The column number, or -1 if none is available.
- * @see #getColumnNumber
- */
- public void setColumnNumber (int columnNumber)
- {
- this.columnNumber = columnNumber;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private String publicId;
- private String systemId;
- private int lineNumber;
- private int columnNumber;
-
-}
-
-// end of LocatorImpl.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/NamespaceSupport.java b/external/jaxp/source/org/xml/sax/helpers/NamespaceSupport.java
deleted file mode 100755
index dae8e5cc7..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/NamespaceSupport.java
+++ /dev/null
@@ -1,768 +0,0 @@
-// NamespaceSupport.java - generic Namespace support for SAX.
-// http://www.saxproject.org
-// Written by David Megginson
-// This class is in the Public Domain. NO WARRANTY!
-
-package org.xml.sax.helpers;
-
-import java.util.EmptyStackException;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-
-/**
- * Encapsulate Namespace logic for use by applications using SAX,
- * or internally by SAX drivers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class encapsulates the logic of Namespace processing:
- * it tracks the declarations currently in force for each context
- * and automatically processes qualified XML 1.0 names into their
- * Namespace parts; it can also be used in reverse for generating
- * XML 1.0 from Namespaces.</p>
- *
- * <p>Namespace support objects are reusable, but the reset method
- * must be invoked between each session.</p>
- *
- * <p>Here is a simple session:</p>
- *
- * <pre>
- * String parts[] = new String[3];
- * NamespaceSupport support = new NamespaceSupport();
- *
- * support.pushContext();
- * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
- * support.declarePrefix("dc", "http://www.purl.org/dc#");
- *
- * parts = support.processName("p", parts, false);
- * System.out.println("Namespace URI: " + parts[0]);
- * System.out.println("Local name: " + parts[1]);
- * System.out.println("Raw name: " + parts[2]);
- *
- * parts = support.processName("dc:title", parts, false);
- * System.out.println("Namespace URI: " + parts[0]);
- * System.out.println("Local name: " + parts[1]);
- * System.out.println("Raw name: " + parts[2]);
- *
- * support.popContext();
- * </pre>
- *
- * <p>Note that this class is optimized for the use case where most
- * elements do not contain Namespace declarations: if the same
- * prefix/URI mapping is repeated for each context (for example), this
- * class will be somewhat less efficient.</p>
- *
- * <p>Although SAX drivers (parsers) may choose to use this class to
- * implement namespace handling, they are not required to do so.
- * Applications must track namespace information themselves if they
- * want to use namespace information.
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- */
-public class NamespaceSupport
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constants.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * The XML Namespace URI as a constant.
- * The value is <code>http://www.w3.org/XML/1998/namespace</code>
- * as defined in the XML Namespaces specification.
- *
- * <p>This is the Namespace URI that is automatically mapped
- * to the "xml" prefix.</p>
- */
- public final static String XMLNS =
- "http://www.w3.org/XML/1998/namespace";
-
-
- /**
- * An empty enumeration.
- */
- private final static Enumeration EMPTY_ENUMERATION =
- new Vector().elements();
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructor.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Create a new Namespace support object.
- */
- public NamespaceSupport ()
- {
- reset();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Context management.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Reset this Namespace support object for reuse.
- *
- * <p>It is necessary to invoke this method before reusing the
- * Namespace support object for a new session.</p>
- */
- public void reset ()
- {
- contexts = new Context[32];
- contextPos = 0;
- contexts[contextPos] = currentContext = new Context();
- currentContext.declarePrefix("xml", XMLNS);
- }
-
-
- /**
- * Start a new Namespace context.
- * The new context will automatically inherit
- * the declarations of its parent context, but it will also keep
- * track of which declarations were made within this context.
- *
- * <p>Event callback code should start a new context once per element.
- * This means being ready to call this in either of two places.
- * For elements that don't include namespace declarations, the
- * <em>ContentHandler.startElement()</em> callback is the right place.
- * For elements with such a declaration, it'd done in the first
- * <em>ContentHandler.startPrefixMapping()</em> callback.
- * A boolean flag can be used to
- * track whether a context has been started yet. When either of
- * those methods is called, it checks the flag to see if a new context
- * needs to be started. If so, it starts the context and sets the
- * flag. After <em>ContentHandler.startElement()</em>
- * does that, it always clears the flag.
- *
- * <p>Normally, SAX drivers would push a new context at the beginning
- * of each XML element. Then they perform a first pass over the
- * attributes to process all namespace declarations, making
- * <em>ContentHandler.startPrefixMapping()</em> callbacks.
- * Then a second pass is made, to determine the namespace-qualified
- * names for all attributes and for the element name.
- * Finally all the information for the
- * <em>ContentHandler.startElement()</em> callback is available,
- * so it can then be made.
- *
- * <p>The Namespace support object always starts with a base context
- * already in force: in this context, only the "xml" prefix is
- * declared.</p>
- *
- * @see org.xml.sax.ContentHandler
- * @see #popContext
- */
- public void pushContext ()
- {
- int max = contexts.length;
-
- contexts [contextPos].declsOK = false;
- contextPos++;
-
- // Extend the array if necessary
- if (contextPos >= max) {
- Context newContexts[] = new Context[max*2];
- System.arraycopy(contexts, 0, newContexts, 0, max);
- max *= 2;
- contexts = newContexts;
- }
-
- // Allocate the context if necessary.
- currentContext = contexts[contextPos];
- if (currentContext == null) {
- contexts[contextPos] = currentContext = new Context();
- }
-
- // Set the parent, if any.
- if (contextPos > 0) {
- currentContext.setParent(contexts[contextPos - 1]);
- }
- }
-
-
- /**
- * Revert to the previous Namespace context.
- *
- * <p>Normally, you should pop the context at the end of each
- * XML element. After popping the context, all Namespace prefix
- * mappings that were previously in force are restored.</p>
- *
- * <p>You must not attempt to declare additional Namespace
- * prefixes after popping a context, unless you push another
- * context first.</p>
- *
- * @see #pushContext
- */
- public void popContext ()
- {
- contexts[contextPos].clear();
- contextPos--;
- if (contextPos < 0) {
- throw new EmptyStackException();
- }
- currentContext = contexts[contextPos];
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Operations within a context.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Declare a Namespace prefix. All prefixes must be declared
- * before they are referenced. For example, a SAX driver (parser)
- * would scan an element's attributes
- * in two passes: first for namespace declarations,
- * then a second pass using {@link #processName processName()} to
- * interpret prefixes against (potentially redefined) prefixes.
- *
- * <p>This method declares a prefix in the current Namespace
- * context; the prefix will remain in force until this context
- * is popped, unless it is shadowed in a descendant context.</p>
- *
- * <p>To declare the default element Namespace, use the empty string as
- * the prefix.</p>
- *
- * <p>Note that you must <em>not</em> declare a prefix after
- * you've pushed and popped another Namespace context, or
- * treated the declarations phase as complete by processing
- * a prefixed name.</p>
- *
- * <p>Note that there is an asymmetry in this library: {@link
- * #getPrefix getPrefix} will not return the "" prefix,
- * even if you have declared a default element namespace.
- * To check for a default namespace,
- * you have to look it up explicitly using {@link #getURI getURI}.
- * This asymmetry exists to make it easier to look up prefixes
- * for attribute names, where the default prefix is not allowed.</p>
- *
- * @param prefix The prefix to declare, or the empty string to
- * indicate the default element namespace. This may never have
- * the value "xml" or "xmlns".
- * @param uri The Namespace URI to associate with the prefix.
- * @return true if the prefix was legal, false otherwise
- * @exception IllegalStateException when a prefix is declared
- * after looking up a name in the context, or after pushing
- * another context on top of it.
- *
- * @see #processName
- * @see #getURI
- * @see #getPrefix
- */
- public boolean declarePrefix (String prefix, String uri)
- {
- if (prefix.equals("xml") || prefix.equals("xmlns")) {
- return false;
- } else {
- currentContext.declarePrefix(prefix, uri);
- return true;
- }
- }
-
-
- /**
- * Process a raw XML 1.0 name, after all declarations in the current
- * context have been handled by {@link #declarePrefix declarePrefix()}.
- *
- * <p>This method processes a raw XML 1.0 name in the current
- * context by removing the prefix and looking it up among the
- * prefixes currently declared. The return value will be the
- * array supplied by the caller, filled in as follows:</p>
- *
- * <dl>
- * <dt>parts[0]</dt>
- * <dd>The Namespace URI, or an empty string if none is
- * in use.</dd>
- * <dt>parts[1]</dt>
- * <dd>The local name (without prefix).</dd>
- * <dt>parts[2]</dt>
- * <dd>The original raw name.</dd>
- * </dl>
- *
- * <p>All of the strings in the array will be internalized. If
- * the raw name has a prefix that has not been declared, then
- * the return value will be null.</p>
- *
- * <p>Note that attribute names are processed differently than
- * element names: an unprefixed element name will received the
- * default Namespace (if any), while an unprefixed attribute name
- * will not.</p>
- *
- * @param qName The raw XML 1.0 name to be processed.
- * @param parts An array supplied by the caller, capable of
- * holding at least three members.
- * @param isAttribute A flag indicating whether this is an
- * attribute name (true) or an element name (false).
- * @return The supplied array holding three internalized strings
- * representing the Namespace URI (or empty string), the
- * local name, and the raw XML 1.0 name; or null if there
- * is an undeclared prefix.
- * @see #declarePrefix
- * @see java.lang.String#intern */
- public String [] processName (String qName, String parts[],
- boolean isAttribute)
- {
- String myParts[] = currentContext.processName(qName, isAttribute);
- if (myParts == null) {
- return null;
- } else {
- parts[0] = myParts[0];
- parts[1] = myParts[1];
- parts[2] = myParts[2];
- return parts;
- }
- }
-
-
- /**
- * Look up a prefix and get the currently-mapped Namespace URI.
- *
- * <p>This method looks up the prefix in the current context.
- * Use the empty string ("") for the default Namespace.</p>
- *
- * @param prefix The prefix to look up.
- * @return The associated Namespace URI, or null if the prefix
- * is undeclared in this context.
- * @see #getPrefix
- * @see #getPrefixes
- */
- public String getURI (String prefix)
- {
- return currentContext.getURI(prefix);
- }
-
-
- /**
- * Return an enumeration of all prefixes currently declared.
- *
- * <p><strong>Note:</strong> if there is a default prefix, it will not be
- * returned in this enumeration; check for the default prefix
- * using the {@link #getURI getURI} with an argument of "".</p>
- *
- * @return An enumeration of all prefixes declared in the
- * current context except for the empty (default)
- * prefix.
- * @see #getDeclaredPrefixes
- * @see #getURI
- */
- public Enumeration getPrefixes ()
- {
- return currentContext.getPrefixes();
- }
-
-
- /**
- * Return one of the prefixes mapped to a Namespace URI.
- *
- * <p>If more than one prefix is currently mapped to the same
- * URI, this method will make an arbitrary selection; if you
- * want all of the prefixes, use the {@link #getPrefixes}
- * method instead.</p>
- *
- * <p><strong>Note:</strong> this will never return the empty (default) prefix;
- * to check for a default prefix, use the {@link #getURI getURI}
- * method with an argument of "".</p>
- *
- * @param uri The Namespace URI.
- * @param isAttribute true if this prefix is for an attribute
- * (and the default Namespace is not allowed).
- * @return One of the prefixes currently mapped to the URI supplied,
- * or null if none is mapped or if the URI is assigned to
- * the default Namespace.
- * @see #getPrefixes(java.lang.String)
- * @see #getURI
- */
- public String getPrefix (String uri)
- {
- return currentContext.getPrefix(uri);
- }
-
-
- /**
- * Return an enumeration of all prefixes currently declared for a URI.
- *
- * <p>This method returns prefixes mapped to a specific Namespace
- * URI. The xml: prefix will be included. If you want only one
- * prefix that's mapped to the Namespace URI, and you don't care
- * which one you get, use the {@link #getPrefix getPrefix}
- * method instead.</p>
- *
- * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
- * in this enumeration; to check for the presence of a default
- * Namespace, use the {@link #getURI getURI} method with an
- * argument of "".</p>
- *
- * @param uri The Namespace URI.
- * @return An enumeration of all prefixes declared in the
- * current context.
- * @see #getPrefix
- * @see #getDeclaredPrefixes
- * @see #getURI
- */
- public Enumeration getPrefixes (String uri)
- {
- Vector prefixes = new Vector();
- Enumeration allPrefixes = getPrefixes();
- while (allPrefixes.hasMoreElements()) {
- String prefix = (String)allPrefixes.nextElement();
- if (uri.equals(getURI(prefix))) {
- prefixes.addElement(prefix);
- }
- }
- return prefixes.elements();
- }
-
-
- /**
- * Return an enumeration of all prefixes declared in this context.
- *
- * <p>The empty (default) prefix will be included in this
- * enumeration; note that this behaviour differs from that of
- * {@link #getPrefix} and {@link #getPrefixes}.</p>
- *
- * @return An enumeration of all prefixes declared in this
- * context.
- * @see #getPrefixes
- * @see #getURI
- */
- public Enumeration getDeclaredPrefixes ()
- {
- return currentContext.getDeclaredPrefixes();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private Context contexts[];
- private Context currentContext;
- private int contextPos;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal classes.
- ////////////////////////////////////////////////////////////////////
-
- /**
- * Internal class for a single Namespace context.
- *
- * <p>This module caches and reuses Namespace contexts,
- * so the number allocated
- * will be equal to the element depth of the document, not to the total
- * number of elements (i.e. 5-10 rather than tens of thousands).
- * Also, data structures used to represent contexts are shared when
- * possible (child contexts without declarations) to further reduce
- * the amount of memory that's consumed.
- * </p>
- */
- final class Context {
-
- /**
- * Create the root-level Namespace context.
- */
- Context ()
- {
- copyTables();
- }
-
-
- /**
- * (Re)set the parent of this Namespace context.
- * The context must either have been freshly constructed,
- * or must have been cleared.
- *
- * @param context The parent Namespace context object.
- */
- void setParent (Context parent)
- {
- this.parent = parent;
- declarations = null;
- prefixTable = parent.prefixTable;
- uriTable = parent.uriTable;
- elementNameTable = parent.elementNameTable;
- attributeNameTable = parent.attributeNameTable;
- defaultNS = parent.defaultNS;
- declSeen = false;
- declsOK = true;
- }
-
- /**
- * Makes associated state become collectible,
- * invalidating this context.
- * {@link #setParent} must be called before
- * this context may be used again.
- */
- void clear ()
- {
- parent = null;
- prefixTable = null;
- uriTable = null;
- elementNameTable = null;
- attributeNameTable = null;
- defaultNS = null;
- }
-
-
- /**
- * Declare a Namespace prefix for this context.
- *
- * @param prefix The prefix to declare.
- * @param uri The associated Namespace URI.
- * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix
- */
- void declarePrefix (String prefix, String uri)
- {
- // Lazy processing...
- if (!declsOK)
- throw new IllegalStateException (
- "can't declare any more prefixes in this context");
- if (!declSeen) {
- copyTables();
- }
- if (declarations == null) {
- declarations = new Vector();
- }
-
- prefix = prefix.intern();
- uri = uri.intern();
- if ("".equals(prefix)) {
- if ("".equals(uri)) {
- defaultNS = null;
- } else {
- defaultNS = uri;
- }
- } else {
- prefixTable.put(prefix, uri);
- uriTable.put(uri, prefix); // may wipe out another prefix
- }
- declarations.addElement(prefix);
- }
-
-
- /**
- * Process a raw XML 1.0 name in this context.
- *
- * @param qName The raw XML 1.0 name.
- * @param isAttribute true if this is an attribute name.
- * @return An array of three strings containing the
- * URI part (or empty string), the local part,
- * and the raw name, all internalized, or null
- * if there is an undeclared prefix.
- * @see org.xml.sax.helpers.NamespaceSupport#processName
- */
- String [] processName (String qName, boolean isAttribute)
- {
- String name[];
- Hashtable table;
-
- // detect errors in call sequence
- declsOK = false;
-
- // Select the appropriate table.
- if (isAttribute) {
- table = attributeNameTable;
- } else {
- table = elementNameTable;
- }
-
- // Start by looking in the cache, and
- // return immediately if the name
- // is already known in this content
- name = (String[])table.get(qName);
- if (name != null) {
- return name;
- }
-
- // We haven't seen this name in this
- // context before. Maybe in the parent
- // context, but we can't assume prefix
- // bindings are the same.
- name = new String[3];
- name[2] = qName.intern();
- int index = qName.indexOf(':');
-
-
- // No prefix.
- if (index == -1) {
- if (isAttribute || defaultNS == null) {
- name[0] = "";
- } else {
- name[0] = defaultNS;
- }
- name[1] = name[2];
- }
-
- // Prefix
- else {
- String prefix = qName.substring(0, index);
- String local = qName.substring(index+1);
- String uri;
- if ("".equals(prefix)) {
- uri = defaultNS;
- } else {
- uri = (String)prefixTable.get(prefix);
- }
- if (uri == null) {
- return null;
- }
- name[0] = uri;
- name[1] = local.intern();
- }
-
- // Save in the cache for future use.
- // (Could be shared with parent context...)
- table.put(name[2], name);
- return name;
- }
-
-
- /**
- * Look up the URI associated with a prefix in this context.
- *
- * @param prefix The prefix to look up.
- * @return The associated Namespace URI, or null if none is
- * declared.
- * @see org.xml.sax.helpers.NamespaceSupport#getURI
- */
- String getURI (String prefix)
- {
- if ("".equals(prefix)) {
- return defaultNS;
- } else if (prefixTable == null) {
- return null;
- } else {
- return (String)prefixTable.get(prefix);
- }
- }
-
-
- /**
- * Look up one of the prefixes associated with a URI in this context.
- *
- * <p>Since many prefixes may be mapped to the same URI,
- * the return value may be unreliable.</p>
- *
- * @param uri The URI to look up.
- * @return The associated prefix, or null if none is declared.
- * @see org.xml.sax.helpers.NamespaceSupport#getPrefix
- */
- String getPrefix (String uri)
- {
- if (uriTable == null) {
- return null;
- } else {
- return (String)uriTable.get(uri);
- }
- }
-
-
- /**
- * Return an enumeration of prefixes declared in this context.
- *
- * @return An enumeration of prefixes (possibly empty).
- * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
- */
- Enumeration getDeclaredPrefixes ()
- {
- if (declarations == null) {
- return EMPTY_ENUMERATION;
- } else {
- return declarations.elements();
- }
- }
-
-
- /**
- * Return an enumeration of all prefixes currently in force.
- *
- * <p>The default prefix, if in force, is <em>not</em>
- * returned, and will have to be checked for separately.</p>
- *
- * @return An enumeration of prefixes (never empty).
- * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes
- */
- Enumeration getPrefixes ()
- {
- if (prefixTable == null) {
- return EMPTY_ENUMERATION;
- } else {
- return prefixTable.keys();
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////
- // Internal methods.
- ////////////////////////////////////////////////////////////////
-
-
- /**
- * Copy on write for the internal tables in this context.
- *
- * <p>This class is optimized for the normal case where most
- * elements do not contain Namespace declarations.</p>
- */
- private void copyTables ()
- {
- if (prefixTable != null) {
- prefixTable = (Hashtable)prefixTable.clone();
- } else {
- prefixTable = new Hashtable();
- }
- if (uriTable != null) {
- uriTable = (Hashtable)uriTable.clone();
- } else {
- uriTable = new Hashtable();
- }
- elementNameTable = new Hashtable();
- attributeNameTable = new Hashtable();
- declSeen = true;
- }
-
-
-
- ////////////////////////////////////////////////////////////////
- // Protected state.
- ////////////////////////////////////////////////////////////////
-
- Hashtable prefixTable;
- Hashtable uriTable;
- Hashtable elementNameTable;
- Hashtable attributeNameTable;
- String defaultNS = null;
- boolean declsOK = true;
-
-
-
- ////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////
-
- private Vector declarations = null;
- private boolean declSeen = false;
- private Context parent = null;
- }
-}
-
-// end of NamespaceSupport.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/NewInstance.java b/external/jaxp/source/org/xml/sax/helpers/NewInstance.java
deleted file mode 100644
index cfd9a4724..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/NewInstance.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// NewInstance.java - create a new instance of a class by name.
-// http://www.saxproject.org
-// Written by Edwin Goei, edwingo@apache.org
-// and by David Brownell, dbrownell@users.sourceforge.net
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax.helpers;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Create a new instance of a class by name.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class contains a static method for creating an instance of a
- * class from an explicit class name. It tries to use the thread's context
- * ClassLoader if possible and falls back to using
- * Class.forName(String).</p>
- *
- * <p>This code is designed to compile and run on JDK version 1.1 and later
- * including versions of Java 2.</p>
- *
- * @author Edwin Goei, David Brownell
- * @version 2.0.1 (sax2r2)
- */
-class NewInstance {
-
- /**
- * Creates a new instance of the specified class name
- *
- * Package private so this code is not exposed at the API level.
- */
- static Object newInstance (ClassLoader classLoader, String className)
- throws ClassNotFoundException, IllegalAccessException,
- InstantiationException
- {
- Class driverClass;
- if (classLoader == null) {
- driverClass = Class.forName(className);
- } else {
- driverClass = classLoader.loadClass(className);
- }
- return driverClass.newInstance();
- }
-
- /**
- * Figure out which ClassLoader to use. For JDK 1.2 and later use
- * the context ClassLoader.
- */
- static ClassLoader getClassLoader ()
- {
- Method m = null;
-
- try {
- m = Thread.class.getMethod("getContextClassLoader", null);
- } catch (NoSuchMethodException e) {
- // Assume that we are running JDK 1.1, use the current ClassLoader
- return NewInstance.class.getClassLoader();
- }
-
- try {
- return (ClassLoader) m.invoke(Thread.currentThread(), null);
- } catch (IllegalAccessException e) {
- // assert(false)
- throw new UnknownError(e.getMessage());
- } catch (InvocationTargetException e) {
- // assert(e.getTargetException() instanceof SecurityException)
- throw new UnknownError(e.getMessage());
- }
- }
-}
diff --git a/external/jaxp/source/org/xml/sax/helpers/ParserAdapter.java b/external/jaxp/source/org/xml/sax/helpers/ParserAdapter.java
deleted file mode 100755
index 1dfef61c7..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/ParserAdapter.java
+++ /dev/null
@@ -1,1024 +0,0 @@
-// ParserAdapter.java - adapt a SAX1 Parser to a SAX2 XMLReader.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the public domain.
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.xml.sax.Parser; // deprecated
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.AttributeList; // deprecated
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler; // deprecated
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-
-
-/**
- * Adapt a SAX1 Parser as a SAX2 XMLReader.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class wraps a SAX1 {@link org.xml.sax.Parser Parser}
- * and makes it act as a SAX2 {@link org.xml.sax.XMLReader XMLReader},
- * with feature, property, and Namespace support. Note
- * that it is not possible to report {@link org.xml.sax.ContentHandler#skippedEntity
- * skippedEntity} events, since SAX1 does not make that information available.</p>
- *
- * <p>This adapter does not test for duplicate Namespace-qualified
- * attribute names.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.helpers.XMLReaderAdapter
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.Parser
- */
-public class ParserAdapter implements XMLReader, DocumentHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct a new parser adapter.
- *
- * <p>Use the "org.xml.sax.parser" property to locate the
- * embedded SAX1 driver.</p>
- *
- * @exception SAXException If the embedded driver
- * cannot be instantiated or if the
- * org.xml.sax.parser property is not specified.
- */
- public ParserAdapter ()
- throws SAXException
- {
- super();
-
- String driver = System.getProperty("org.xml.sax.parser");
-
- try {
- setup(ParserFactory.makeParser());
- } catch (ClassNotFoundException e1) {
- throw new
- SAXException("Cannot find SAX1 driver class " +
- driver, e1);
- } catch (IllegalAccessException e2) {
- throw new
- SAXException("SAX1 driver class " +
- driver +
- " found but cannot be loaded", e2);
- } catch (InstantiationException e3) {
- throw new
- SAXException("SAX1 driver class " +
- driver +
- " loaded but cannot be instantiated", e3);
- } catch (ClassCastException e4) {
- throw new
- SAXException("SAX1 driver class " +
- driver +
- " does not implement org.xml.sax.Parser");
- } catch (NullPointerException e5) {
- throw new
- SAXException("System property org.xml.sax.parser not specified");
- }
- }
-
-
- /**
- * Construct a new parser adapter.
- *
- * <p>Note that the embedded parser cannot be changed once the
- * adapter is created; to embed a different parser, allocate
- * a new ParserAdapter.</p>
- *
- * @param parser The SAX1 parser to embed.
- * @exception java.lang.NullPointerException If the parser parameter
- * is null.
- */
- public ParserAdapter (Parser parser)
- {
- super();
- setup(parser);
- }
-
-
- /**
- * Internal setup method.
- *
- * @param parser The embedded parser.
- * @exception java.lang.NullPointerException If the parser parameter
- * is null.
- */
- private void setup (Parser parser)
- {
- if (parser == null) {
- throw new
- NullPointerException("Parser argument must not be null");
- }
- this.parser = parser;
- atts = new AttributesImpl();
- nsSupport = new NamespaceSupport();
- attAdapter = new AttributeListAdapter();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.XMLReader.
- ////////////////////////////////////////////////////////////////////
-
-
- //
- // Internal constants for the sake of convenience.
- //
- private final static String FEATURES = "http://xml.org/sax/features/";
- private final static String NAMESPACES = FEATURES + "namespaces";
- private final static String NAMESPACE_PREFIXES = FEATURES + "namespace-prefixes";
-
-
- /**
- * Set a feature flag for the parser.
- *
- * <p>The only features recognized are namespaces and
- * namespace-prefixes.</p>
- *
- * @param name The feature name, as a complete URI.
- * @param value The requested feature value.
- * @exception SAXNotRecognizedException If the feature
- * can't be assigned or retrieved.
- * @exception SAXNotSupportedException If the feature
- * can't be assigned that value.
- * @see org.xml.sax.XMLReader#setFeature
- */
- public void setFeature (String name, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (name.equals(NAMESPACES)) {
- checkNotParsing("feature", name);
- namespaces = value;
- if (!namespaces && !prefixes) {
- prefixes = true;
- }
- } else if (name.equals(NAMESPACE_PREFIXES)) {
- checkNotParsing("feature", name);
- prefixes = value;
- if (!prefixes && !namespaces) {
- namespaces = true;
- }
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Check a parser feature flag.
- *
- * <p>The only features recognized are namespaces and
- * namespace-prefixes.</p>
- *
- * @param name The feature name, as a complete URI.
- * @return The current feature value.
- * @exception SAXNotRecognizedException If the feature
- * value can't be assigned or retrieved.
- * @exception SAXNotSupportedException If the
- * feature is not currently readable.
- * @see org.xml.sax.XMLReader#setFeature
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (name.equals(NAMESPACES)) {
- return namespaces;
- } else if (name.equals(NAMESPACE_PREFIXES)) {
- return prefixes;
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Set a parser property.
- *
- * <p>No properties are currently recognized.</p>
- *
- * @param name The property name.
- * @param value The property value.
- * @exception SAXNotRecognizedException If the property
- * value can't be assigned or retrieved.
- * @exception SAXNotSupportedException If the property
- * can't be assigned that value.
- * @see org.xml.sax.XMLReader#setProperty
- */
- public void setProperty (String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- throw new SAXNotRecognizedException("Property: " + name);
- }
-
-
- /**
- * Get a parser property.
- *
- * <p>No properties are currently recognized.</p>
- *
- * @param name The property name.
- * @return The property value.
- * @exception SAXNotRecognizedException If the property
- * value can't be assigned or retrieved.
- * @exception SAXNotSupportedException If the property
- * value is not currently readable.
- * @see org.xml.sax.XMLReader#getProperty
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- throw new SAXNotRecognizedException("Property: " + name);
- }
-
-
- /**
- * Set the entity resolver.
- *
- * @param resolver The new entity resolver.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- entityResolver = resolver;
- }
-
-
- /**
- * Return the current entity resolver.
- *
- * @return The current entity resolver, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public EntityResolver getEntityResolver ()
- {
- return entityResolver;
- }
-
-
- /**
- * Set the DTD handler.
- *
- * @param resolver The new DTD handler.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setDTDHandler (DTDHandler handler)
- {
- dtdHandler = handler;
- }
-
-
- /**
- * Return the current DTD handler.
- *
- * @return The current DTD handler, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
-
- /**
- * Set the content handler.
- *
- * @param resolver The new content handler.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setContentHandler (ContentHandler handler)
- {
- contentHandler = handler;
- }
-
-
- /**
- * Return the current content handler.
- *
- * @return The current content handler, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public ContentHandler getContentHandler ()
- {
- return contentHandler;
- }
-
-
- /**
- * Set the error handler.
- *
- * @param resolver The new error handler.
- * @see org.xml.sax.XMLReader#setEntityResolver
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- errorHandler = handler;
- }
-
-
- /**
- * Return the current error handler.
- *
- * @return The current error handler, or null if none was supplied.
- * @see org.xml.sax.XMLReader#getEntityResolver
- */
- public ErrorHandler getErrorHandler ()
- {
- return errorHandler;
- }
-
-
- /**
- * Parse an XML document.
- *
- * @param systemId The absolute URL of the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception SAXException If there is a problem
- * processing the document.
- * @see #parse(org.xml.sax.InputSource)
- * @see org.xml.sax.Parser#parse(java.lang.String)
- */
- public void parse (String systemId)
- throws IOException, SAXException
- {
- parse(new InputSource(systemId));
- }
-
-
- /**
- * Parse an XML document.
- *
- * @param input An input source for the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception SAXException If there is a problem
- * processing the document.
- * @see #parse(java.lang.String)
- * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
- */
- public void parse (InputSource input)
- throws IOException, SAXException
- {
- if (parsing) {
- throw new SAXException("Parser is already in use");
- }
- setupParser();
- parsing = true;
- try {
- parser.parse(input);
- } finally {
- parsing = false;
- }
- parsing = false;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.DocumentHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 document locator event.
- *
- * @param locator A document locator.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- if (contentHandler != null) {
- contentHandler.setDocumentLocator(locator);
- }
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 start document event.
- *
- * @exception SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startDocument();
- }
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 end document event.
- *
- * @exception SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endDocument();
- }
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 startElement event.
- *
- * <p>If necessary, perform Namespace processing.</p>
- *
- * @param qName The qualified (prefixed) name.
- * @param qAtts The XML 1.0 attribute list (with qnames).
- * @exception SAXException The client may raise a
- * processing exception.
- */
- public void startElement (String qName, AttributeList qAtts)
- throws SAXException
- {
- // These are exceptions from the
- // first pass; they should be
- // ignored if there's a second pass,
- // but reported otherwise.
- Vector exceptions = null;
-
- // If we're not doing Namespace
- // processing, dispatch this quickly.
- if (!namespaces) {
- if (contentHandler != null) {
- attAdapter.setAttributeList(qAtts);
- contentHandler.startElement("", "", qName.intern(),
- attAdapter);
- }
- return;
- }
-
-
- // OK, we're doing Namespace processing.
- nsSupport.pushContext();
- int length = qAtts.getLength();
-
- // First pass: handle NS decls
- for (int i = 0; i < length; i++) {
- String attQName = qAtts.getName(i);
-
- if (!attQName.startsWith("xmlns"))
- continue;
- // Could be a declaration...
- String prefix;
- int n = attQName.indexOf(':');
-
- // xmlns=...
- if (n == -1 && attQName.length () == 5) {
- prefix = "";
- } else if (n != 5) {
- // XML namespaces spec doesn't discuss "xmlnsf:oo"
- // (and similarly named) attributes ... at most, warn
- continue;
- } else // xmlns:foo=...
- prefix = attQName.substring(n+1);
-
- String value = qAtts.getValue(i);
- if (!nsSupport.declarePrefix(prefix, value)) {
- reportError("Illegal Namespace prefix: " + prefix);
- continue;
- }
- if (contentHandler != null)
- contentHandler.startPrefixMapping(prefix, value);
- }
-
- // Second pass: copy all relevant
- // attributes into the SAX2 AttributeList
- // using updated prefix bindings
- atts.clear();
- for (int i = 0; i < length; i++) {
- String attQName = qAtts.getName(i);
- String type = qAtts.getType(i);
- String value = qAtts.getValue(i);
-
- // Declaration?
- if (attQName.startsWith("xmlns")) {
- String prefix;
- int n = attQName.indexOf(':');
-
- if (n == -1 && attQName.length () == 5) {
- prefix = "";
- } else if (n != 5) {
- // XML namespaces spec doesn't discuss "xmlnsf:oo"
- // (and similarly named) attributes ... ignore
- prefix = null;
- } else {
- prefix = attQName.substring(n+1);
- }
- // Yes, decl: report or prune
- if (prefix != null) {
- if (prefixes)
- atts.addAttribute("", "", attQName.intern(),
- type, value);
- continue;
- }
- }
-
- // Not a declaration -- report
- try {
- String attName[] = processName(attQName, true, true);
- atts.addAttribute(attName[0], attName[1], attName[2],
- type, value);
- } catch (SAXException e) {
- if (exceptions == null)
- exceptions = new Vector();
- exceptions.addElement(e);
- atts.addAttribute("", attQName, attQName, type, value);
- }
- }
-
- // now handle the deferred exception reports
- if (exceptions != null && errorHandler != null) {
- for (int i = 0; i < exceptions.size(); i++)
- errorHandler.error((SAXParseException)
- (exceptions.elementAt(i)));
- }
-
- // OK, finally report the event.
- if (contentHandler != null) {
- String name[] = processName(qName, false, false);
- contentHandler.startElement(name[0], name[1], name[2], atts);
- }
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 end element event.
- *
- * @param qName The qualified (prefixed) name.
- * @exception SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#endElement
- */
- public void endElement (String qName)
- throws SAXException
- {
- // If we're not doing Namespace
- // processing, dispatch this quickly.
- if (!namespaces) {
- if (contentHandler != null) {
- contentHandler.endElement("", "", qName.intern());
- }
- return;
- }
-
- // Split the name.
- String names[] = processName(qName, false, false);
- if (contentHandler != null) {
- contentHandler.endElement(names[0], names[1], names[2]);
- Enumeration prefixes = nsSupport.getDeclaredPrefixes();
- while (prefixes.hasMoreElements()) {
- String prefix = (String)prefixes.nextElement();
- contentHandler.endPrefixMapping(prefix);
- }
- }
- nsSupport.popContext();
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 characters event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.characters(ch, start, length);
- }
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 ignorable whitespace event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
- }
-
-
- /**
- * Adapter implementation method; do not call.
- * Adapt a SAX1 processing instruction event.
- *
- * @param target The processing instruction target.
- * @param data The remainder of the processing instruction
- * @exception SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.DocumentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.processingInstruction(target, data);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal utility methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Initialize the parser before each run.
- */
- private void setupParser ()
- {
- nsSupport.reset();
-
- if (entityResolver != null) {
- parser.setEntityResolver(entityResolver);
- }
- if (dtdHandler != null) {
- parser.setDTDHandler(dtdHandler);
- }
- if (errorHandler != null) {
- parser.setErrorHandler(errorHandler);
- }
- parser.setDocumentHandler(this);
- locator = null;
- }
-
-
- /**
- * Process a qualified (prefixed) name.
- *
- * <p>If the name has an undeclared prefix, use only the qname
- * and make an ErrorHandler.error callback in case the app is
- * interested.</p>
- *
- * @param qName The qualified (prefixed) name.
- * @param isAttribute true if this is an attribute name.
- * @return The name split into three parts.
- * @exception SAXException The client may throw
- * an exception if there is an error callback.
- */
- private String [] processName (String qName, boolean isAttribute,
- boolean useException)
- throws SAXException
- {
- String parts[] = nsSupport.processName(qName, nameParts,
- isAttribute);
- if (parts == null) {
- if (useException)
- throw makeException("Undeclared prefix: " + qName);
- reportError("Undeclared prefix: " + qName);
- parts = new String[3];
- parts[0] = parts[1] = "";
- parts[2] = qName.intern();
- }
- return parts;
- }
-
-
- /**
- * Report a non-fatal error.
- *
- * @param message The error message.
- * @exception SAXException The client may throw
- * an exception.
- */
- void reportError (String message)
- throws SAXException
- {
- if (errorHandler != null)
- errorHandler.error(makeException(message));
- }
-
-
- /**
- * Construct an exception for the current context.
- *
- * @param message The error message.
- */
- private SAXParseException makeException (String message)
- {
- if (locator != null) {
- return new SAXParseException(message, locator);
- } else {
- return new SAXParseException(message, null, null, -1, -1);
- }
- }
-
-
- /**
- * Throw an exception if we are parsing.
- *
- * <p>Use this method to detect illegal feature or
- * property changes.</p>
- *
- * @param type The type of thing (feature or property).
- * @param name The feature or property name.
- * @exception SAXNotSupportedException If a
- * document is currently being parsed.
- */
- private void checkNotParsing (String type, String name)
- throws SAXNotSupportedException
- {
- if (parsing) {
- throw new SAXNotSupportedException("Cannot change " +
- type + ' ' +
- name + " while parsing");
-
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private NamespaceSupport nsSupport;
- private AttributeListAdapter attAdapter;
-
- private boolean parsing = false;
- private String nameParts[] = new String[3];
-
- private Parser parser = null;
-
- private AttributesImpl atts = null;
-
- // Features
- private boolean namespaces = true;
- private boolean prefixes = false;
-
- // Properties
-
- // Handlers
- Locator locator;
-
- EntityResolver entityResolver = null;
- DTDHandler dtdHandler = null;
- ContentHandler contentHandler = null;
- ErrorHandler errorHandler = null;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Inner class to wrap an AttributeList when not doing NS proc.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Adapt a SAX1 AttributeList as a SAX2 Attributes object.
- *
- * <p>This class is in the Public Domain, and comes with NO
- * WARRANTY of any kind.</p>
- *
- * <p>This wrapper class is used only when Namespace support
- * is disabled -- it provides pretty much a direct mapping
- * from SAX1 to SAX2, except that names and types are
- * interned whenever requested.</p>
- */
- final class AttributeListAdapter implements Attributes
- {
-
- /**
- * Construct a new adapter.
- */
- AttributeListAdapter ()
- {
- }
-
-
- /**
- * Set the embedded AttributeList.
- *
- * <p>This method must be invoked before any of the others
- * can be used.</p>
- *
- * @param The SAX1 attribute list (with qnames).
- */
- void setAttributeList (AttributeList qAtts)
- {
- this.qAtts = qAtts;
- }
-
-
- /**
- * Return the length of the attribute list.
- *
- * @return The number of attributes in the list.
- * @see org.xml.sax.Attributes#getLength
- */
- public int getLength ()
- {
- return qAtts.getLength();
- }
-
-
- /**
- * Return the Namespace URI of the specified attribute.
- *
- * @param The attribute's index.
- * @return Always the empty string.
- * @see org.xml.sax.Attributes#getURI
- */
- public String getURI (int i)
- {
- return "";
- }
-
-
- /**
- * Return the local name of the specified attribute.
- *
- * @param The attribute's index.
- * @return Always the empty string.
- * @see org.xml.sax.Attributes#getLocalName
- */
- public String getLocalName (int i)
- {
- return "";
- }
-
-
- /**
- * Return the qualified (prefixed) name of the specified attribute.
- *
- * @param The attribute's index.
- * @return The attribute's qualified name, internalized.
- */
- public String getQName (int i)
- {
- return qAtts.getName(i).intern();
- }
-
-
- /**
- * Return the type of the specified attribute.
- *
- * @param The attribute's index.
- * @return The attribute's type as an internalized string.
- */
- public String getType (int i)
- {
- return qAtts.getType(i).intern();
- }
-
-
- /**
- * Return the value of the specified attribute.
- *
- * @param The attribute's index.
- * @return The attribute's value.
- */
- public String getValue (int i)
- {
- return qAtts.getValue(i);
- }
-
-
- /**
- * Look up an attribute index by Namespace name.
- *
- * @param uri The Namespace URI or the empty string.
- * @param localName The local name.
- * @return The attributes index, or -1 if none was found.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String)
- */
- public int getIndex (String uri, String localName)
- {
- return -1;
- }
-
-
- /**
- * Look up an attribute index by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attributes index, or -1 if none was found.
- * @see org.xml.sax.Attributes#getIndex(java.lang.String)
- */
- public int getIndex (String qName)
- {
- int max = atts.getLength();
- for (int i = 0; i < max; i++) {
- if (qAtts.getName(i).equals(qName)) {
- return i;
- }
- }
- return -1;
- }
-
-
- /**
- * Look up the type of an attribute by Namespace name.
- *
- * @param uri The Namespace URI
- * @param localName The local name.
- * @return The attribute's type as an internalized string.
- */
- public String getType (String uri, String localName)
- {
- return null;
- }
-
-
- /**
- * Look up the type of an attribute by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's type as an internalized string.
- */
- public String getType (String qName)
- {
- return qAtts.getType(qName).intern();
- }
-
-
- /**
- * Look up the value of an attribute by Namespace name.
- *
- * @param uri The Namespace URI
- * @param localName The local name.
- * @return The attribute's value.
- */
- public String getValue (String uri, String localName)
- {
- return null;
- }
-
-
- /**
- * Look up the value of an attribute by qualified (prefixed) name.
- *
- * @param qName The qualified name.
- * @return The attribute's value.
- */
- public String getValue (String qName)
- {
- return qAtts.getValue(qName);
- }
-
- private AttributeList qAtts;
- }
-}
-
-// end of ParserAdapter.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/ParserFactory.java b/external/jaxp/source/org/xml/sax/helpers/ParserFactory.java
deleted file mode 100755
index c3a64eafe..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/ParserFactory.java
+++ /dev/null
@@ -1,128 +0,0 @@
-// SAX parser factory.
-// http://www.saxproject.org
-// No warranty; no copyright -- use this as you will.
-
-package org.xml.sax.helpers;
-
-import java.lang.ClassNotFoundException;
-import java.lang.IllegalAccessException;
-import java.lang.InstantiationException;
-import java.lang.SecurityException;
-import java.lang.ClassCastException;
-
-import org.xml.sax.Parser;
-
-
-/**
- * Java-specific class for dynamically loading SAX parsers.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p><strong>Note:</strong> This class is designed to work with the now-deprecated
- * SAX1 {@link org.xml.sax.Parser Parser} class. SAX2 applications should use
- * {@link org.xml.sax.helpers.XMLReaderFactory XMLReaderFactory} instead.</p>
- *
- * <p>ParserFactory is not part of the platform-independent definition
- * of SAX; it is an additional convenience class designed
- * specifically for Java XML application writers. SAX applications
- * can use the static methods in this class to allocate a SAX parser
- * dynamically at run-time based either on the value of the
- * `org.xml.sax.parser' system property or on a string containing the class
- * name.</p>
- *
- * <p>Note that the application still requires an XML parser that
- * implements SAX1.</p>
- *
- * @deprecated This class works with the deprecated
- * {@link org.xml.sax.Parser Parser}
- * interface.
- * @since SAX 1.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- */
-public class ParserFactory {
-
-
- /**
- * Private null constructor.
- */
- private ParserFactory ()
- {
- }
-
-
- /**
- * Create a new SAX parser using the `org.xml.sax.parser' system property.
- *
- * <p>The named class must exist and must implement the
- * {@link org.xml.sax.Parser Parser} interface.</p>
- *
- * @exception java.lang.NullPointerException There is no value
- * for the `org.xml.sax.parser' system property.
- * @exception java.lang.ClassNotFoundException The SAX parser
- * class was not found (check your CLASSPATH).
- * @exception IllegalAccessException The SAX parser class was
- * found, but you do not have permission to load
- * it.
- * @exception InstantiationException The SAX parser class was
- * found but could not be instantiated.
- * @exception java.lang.ClassCastException The SAX parser class
- * was found and instantiated, but does not implement
- * org.xml.sax.Parser.
- * @see #makeParser(java.lang.String)
- * @see org.xml.sax.Parser
- */
- public static Parser makeParser ()
- throws ClassNotFoundException,
- IllegalAccessException,
- InstantiationException,
- NullPointerException,
- ClassCastException
- {
- String className = System.getProperty("org.xml.sax.parser");
- if (className == null) {
- throw new NullPointerException("No value for sax.parser property");
- } else {
- return makeParser(className);
- }
- }
-
-
- /**
- * Create a new SAX parser object using the class name provided.
- *
- * <p>The named class must exist and must implement the
- * {@link org.xml.sax.Parser Parser} interface.</p>
- *
- * @param className A string containing the name of the
- * SAX parser class.
- * @exception java.lang.ClassNotFoundException The SAX parser
- * class was not found (check your CLASSPATH).
- * @exception IllegalAccessException The SAX parser class was
- * found, but you do not have permission to load
- * it.
- * @exception InstantiationException The SAX parser class was
- * found but could not be instantiated.
- * @exception java.lang.ClassCastException The SAX parser class
- * was found and instantiated, but does not implement
- * org.xml.sax.Parser.
- * @see #makeParser()
- * @see org.xml.sax.Parser
- */
- public static Parser makeParser (String className)
- throws ClassNotFoundException,
- IllegalAccessException,
- InstantiationException,
- ClassCastException
- {
- return (Parser) NewInstance.newInstance (
- NewInstance.getClassLoader (), className);
- }
-
-}
-
diff --git a/external/jaxp/source/org/xml/sax/helpers/XMLFilterImpl.java b/external/jaxp/source/org/xml/sax/helpers/XMLFilterImpl.java
deleted file mode 100755
index b5f0e2fd0..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/XMLFilterImpl.java
+++ /dev/null
@@ -1,712 +0,0 @@
-// XMLFilterImpl.java - base SAX2 filter implementation.
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.XMLFilter;
-import org.xml.sax.InputSource;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXNotRecognizedException;
-
-
-/**
- * Base class for deriving an XML filter.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader
- * XMLReader} and the client application's event handlers. By default, it
- * does nothing but pass requests up to the reader and events
- * on to the handlers unmodified, but subclasses can override
- * specific methods to modify the event stream or the configuration
- * requests as they pass through.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.XMLFilter
- * @see org.xml.sax.XMLReader
- * @see org.xml.sax.EntityResolver
- * @see org.xml.sax.DTDHandler
- * @see org.xml.sax.ContentHandler
- * @see org.xml.sax.ErrorHandler
- */
-public class XMLFilterImpl
- implements XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructors.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Construct an empty XML filter, with no parent.
- *
- * <p>This filter will have no parent: you must assign a parent
- * before you start a parse or do any configuration with
- * setFeature or setProperty, unless you use this as a pure event
- * consumer rather than as an {@link XMLReader}.</p>
- *
- * @see org.xml.sax.XMLReader#setFeature
- * @see org.xml.sax.XMLReader#setProperty
- * @see #setParent
- */
- public XMLFilterImpl ()
- {
- super();
- }
-
-
- /**
- * Construct an XML filter with the specified parent.
- *
- * @see #setParent
- * @see #getParent
- */
- public XMLFilterImpl (XMLReader parent)
- {
- super();
- setParent(parent);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.XMLFilter.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the parent reader.
- *
- * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which
- * this filter will obtain its events and to which it will pass its
- * configuration requests. The parent may itself be another filter.</p>
- *
- * <p>If there is no parent reader set, any attempt to parse
- * or to set or get a feature or property will fail.</p>
- *
- * @param parent The parent XML reader.
- * @see #getParent
- */
- public void setParent (XMLReader parent)
- {
- this.parent = parent;
- }
-
-
- /**
- * Get the parent reader.
- *
- * @return The parent XML reader, or null if none is set.
- * @see #setParent
- */
- public XMLReader getParent ()
- {
- return parent;
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.XMLReader.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the value of a feature.
- *
- * <p>This will always fail if the parent is null.</p>
- *
- * @param name The feature name.
- * @param value The requested feature value.
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * value can't be assigned or retrieved from the parent.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * parent recognizes the feature name but
- * cannot set the requested value.
- */
- public void setFeature (String name, boolean value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- parent.setFeature(name, value);
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Look up the value of a feature.
- *
- * <p>This will always fail if the parent is null.</p>
- *
- * @param name The feature name.
- * @return The current value of the feature.
- * @exception org.xml.sax.SAXNotRecognizedException If the feature
- * value can't be assigned or retrieved from the parent.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * parent recognizes the feature name but
- * cannot determine its value at this time.
- */
- public boolean getFeature (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- return parent.getFeature(name);
- } else {
- throw new SAXNotRecognizedException("Feature: " + name);
- }
- }
-
-
- /**
- * Set the value of a property.
- *
- * <p>This will always fail if the parent is null.</p>
- *
- * @param name The property name.
- * @param value The requested property value.
- * @exception org.xml.sax.SAXNotRecognizedException If the property
- * value can't be assigned or retrieved from the parent.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * parent recognizes the property name but
- * cannot set the requested value.
- */
- public void setProperty (String name, Object value)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- parent.setProperty(name, value);
- } else {
- throw new SAXNotRecognizedException("Property: " + name);
- }
- }
-
-
- /**
- * Look up the value of a property.
- *
- * @param name The property name.
- * @return The current value of the property.
- * @exception org.xml.sax.SAXNotRecognizedException If the property
- * value can't be assigned or retrieved from the parent.
- * @exception org.xml.sax.SAXNotSupportedException When the
- * parent recognizes the property name but
- * cannot determine its value at this time.
- */
- public Object getProperty (String name)
- throws SAXNotRecognizedException, SAXNotSupportedException
- {
- if (parent != null) {
- return parent.getProperty(name);
- } else {
- throw new SAXNotRecognizedException("Property: " + name);
- }
- }
-
-
- /**
- * Set the entity resolver.
- *
- * @param resolver The new entity resolver.
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- entityResolver = resolver;
- }
-
-
- /**
- * Get the current entity resolver.
- *
- * @return The current entity resolver, or null if none was set.
- */
- public EntityResolver getEntityResolver ()
- {
- return entityResolver;
- }
-
-
- /**
- * Set the DTD event handler.
- *
- * @param resolver The new DTD handler.
- */
- public void setDTDHandler (DTDHandler handler)
- {
- dtdHandler = handler;
- }
-
-
- /**
- * Get the current DTD event handler.
- *
- * @return The current DTD handler, or null if none was set.
- */
- public DTDHandler getDTDHandler ()
- {
- return dtdHandler;
- }
-
-
- /**
- * Set the content event handler.
- *
- * @param resolver The new content handler.
- */
- public void setContentHandler (ContentHandler handler)
- {
- contentHandler = handler;
- }
-
-
- /**
- * Get the content event handler.
- *
- * @return The current content handler, or null if none was set.
- */
- public ContentHandler getContentHandler ()
- {
- return contentHandler;
- }
-
-
- /**
- * Set the error event handler.
- *
- * @param handle The new error handler.
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- errorHandler = handler;
- }
-
-
- /**
- * Get the current error event handler.
- *
- * @return The current error handler, or null if none was set.
- */
- public ErrorHandler getErrorHandler ()
- {
- return errorHandler;
- }
-
-
- /**
- * Parse a document.
- *
- * @param input The input source for the document entity.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- */
- public void parse (InputSource input)
- throws SAXException, IOException
- {
- setupParse();
- parent.parse(input);
- }
-
-
- /**
- * Parse a document.
- *
- * @param systemId The system identifier as a fully-qualified URI.
- * @exception org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @exception java.io.IOException An IO exception from the parser,
- * possibly from a byte stream or character stream
- * supplied by the application.
- */
- public void parse (String systemId)
- throws SAXException, IOException
- {
- parse(new InputSource(systemId));
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.EntityResolver.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter an external entity resolution.
- *
- * @param publicId The entity's public identifier, or null.
- * @param systemId The entity's system identifier.
- * @return A new InputSource or null for the default.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- * @exception java.io.IOException The client may throw an
- * I/O-related exception while obtaining the
- * new InputSource.
- */
- public InputSource resolveEntity (String publicId, String systemId)
- throws SAXException, IOException
- {
- if (entityResolver != null) {
- return entityResolver.resolveEntity(publicId, systemId);
- } else {
- return null;
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.DTDHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter a notation declaration event.
- *
- * @param name The notation name.
- * @param publicId The notation's public identifier, or null.
- * @param systemId The notation's system identifier, or null.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void notationDecl (String name, String publicId, String systemId)
- throws SAXException
- {
- if (dtdHandler != null) {
- dtdHandler.notationDecl(name, publicId, systemId);
- }
- }
-
-
- /**
- * Filter an unparsed entity declaration event.
- *
- * @param name The entity name.
- * @param publicId The entity's public identifier, or null.
- * @param systemId The entity's system identifier, or null.
- * @param notationName The name of the associated notation.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void unparsedEntityDecl (String name, String publicId,
- String systemId, String notationName)
- throws SAXException
- {
- if (dtdHandler != null) {
- dtdHandler.unparsedEntityDecl(name, publicId, systemId,
- notationName);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.ContentHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter a new document locator event.
- *
- * @param locator The document locator.
- */
- public void setDocumentLocator (Locator locator)
- {
- this.locator = locator;
- if (contentHandler != null) {
- contentHandler.setDocumentLocator(locator);
- }
- }
-
-
- /**
- * Filter a start document event.
- *
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void startDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startDocument();
- }
- }
-
-
- /**
- * Filter an end document event.
- *
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void endDocument ()
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endDocument();
- }
- }
-
-
- /**
- * Filter a start Namespace prefix mapping event.
- *
- * @param prefix The Namespace prefix.
- * @param uri The Namespace URI.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void startPrefixMapping (String prefix, String uri)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startPrefixMapping(prefix, uri);
- }
- }
-
-
- /**
- * Filter an end Namespace prefix mapping event.
- *
- * @param prefix The Namespace prefix.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void endPrefixMapping (String prefix)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endPrefixMapping(prefix);
- }
- }
-
-
- /**
- * Filter a start element event.
- *
- * @param uri The element's Namespace URI, or the empty string.
- * @param localName The element's local name, or the empty string.
- * @param qName The element's qualified (prefixed) name, or the empty
- * string.
- * @param atts The element's attributes.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void startElement (String uri, String localName, String qName,
- Attributes atts)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.startElement(uri, localName, qName, atts);
- }
- }
-
-
- /**
- * Filter an end element event.
- *
- * @param uri The element's Namespace URI, or the empty string.
- * @param localName The element's local name, or the empty string.
- * @param qName The element's qualified (prefixed) name, or the empty
- * string.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void endElement (String uri, String localName, String qName)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.endElement(uri, localName, qName);
- }
- }
-
-
- /**
- * Filter a character data event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use from the array.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.characters(ch, start, length);
- }
- }
-
-
- /**
- * Filter an ignorable whitespace event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use from the array.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.ignorableWhitespace(ch, start, length);
- }
- }
-
-
- /**
- * Filter a processing instruction event.
- *
- * @param target The processing instruction target.
- * @param data The text following the target.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.processingInstruction(target, data);
- }
- }
-
-
- /**
- * Filter a skipped entity event.
- *
- * @param name The name of the skipped entity.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- if (contentHandler != null) {
- contentHandler.skippedEntity(name);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.ErrorHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Filter a warning event.
- *
- * @param e The warning as an exception.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void warning (SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null) {
- errorHandler.warning(e);
- }
- }
-
-
- /**
- * Filter an error event.
- *
- * @param e The error as an exception.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void error (SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null) {
- errorHandler.error(e);
- }
- }
-
-
- /**
- * Filter a fatal error event.
- *
- * @param e The error as an exception.
- * @exception org.xml.sax.SAXException The client may throw
- * an exception during processing.
- */
- public void fatalError (SAXParseException e)
- throws SAXException
- {
- if (errorHandler != null) {
- errorHandler.fatalError(e);
- }
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal methods.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set up before a parse.
- *
- * <p>Before every parse, check whether the parent is
- * non-null, and re-register the filter for all of the
- * events.</p>
- */
- private void setupParse ()
- {
- if (parent == null) {
- throw new NullPointerException("No parent for filter");
- }
- parent.setEntityResolver(this);
- parent.setDTDHandler(this);
- parent.setContentHandler(this);
- parent.setErrorHandler(this);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- private XMLReader parent = null;
- private Locator locator = null;
- private EntityResolver entityResolver = null;
- private DTDHandler dtdHandler = null;
- private ContentHandler contentHandler = null;
- private ErrorHandler errorHandler = null;
-
-}
-
-// end of XMLFilterImpl.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/XMLReaderAdapter.java b/external/jaxp/source/org/xml/sax/helpers/XMLReaderAdapter.java
deleted file mode 100755
index 7438a3d04..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/XMLReaderAdapter.java
+++ /dev/null
@@ -1,537 +0,0 @@
-// XMLReaderAdapter.java - adapt an SAX2 XMLReader to a SAX1 Parser
-// http://www.saxproject.org
-// Written by David Megginson
-// NO WARRANTY! This class is in the public domain.
-
-package org.xml.sax.helpers;
-
-import java.io.IOException;
-import java.util.Locale;
-
-import org.xml.sax.Parser; // deprecated
-import org.xml.sax.Locator;
-import org.xml.sax.InputSource;
-import org.xml.sax.AttributeList; // deprecated
-import org.xml.sax.EntityResolver;
-import org.xml.sax.DTDHandler;
-import org.xml.sax.DocumentHandler; // deprecated
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-
-import org.xml.sax.XMLReader;
-import org.xml.sax.Attributes;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXNotSupportedException;
-
-
-/**
- * Adapt a SAX2 XMLReader as a SAX1 Parser.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class wraps a SAX2 {@link org.xml.sax.XMLReader XMLReader}
- * and makes it act as a SAX1 {@link org.xml.sax.Parser Parser}. The XMLReader
- * must support a true value for the
- * http://xml.org/sax/features/namespace-prefixes property or parsing will fail
- * with a {@link org.xml.sax.SAXException SAXException}; if the XMLReader
- * supports a false value for the http://xml.org/sax/features/namespaces
- * property, that will also be used to improve efficiency.</p>
- *
- * @since SAX 2.0
- * @author David Megginson
- * @version 2.0.1 (sax2r2)
- * @see org.xml.sax.Parser
- * @see org.xml.sax.XMLReader
- */
-public class XMLReaderAdapter implements Parser, ContentHandler
-{
-
-
- ////////////////////////////////////////////////////////////////////
- // Constructor.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Create a new adapter.
- *
- * <p>Use the "org.xml.sax.driver" property to locate the SAX2
- * driver to embed.</p>
- *
- * @exception org.xml.sax.SAXException If the embedded driver
- * cannot be instantiated or if the
- * org.xml.sax.driver property is not specified.
- */
- public XMLReaderAdapter ()
- throws SAXException
- {
- setup(XMLReaderFactory.createXMLReader());
- }
-
-
- /**
- * Create a new adapter.
- *
- * <p>Create a new adapter, wrapped around a SAX2 XMLReader.
- * The adapter will make the XMLReader act like a SAX1
- * Parser.</p>
- *
- * @param xmlReader The SAX2 XMLReader to wrap.
- * @exception java.lang.NullPointerException If the argument is null.
- */
- public XMLReaderAdapter (XMLReader xmlReader)
- {
- setup(xmlReader);
- }
-
-
-
- /**
- * Internal setup.
- *
- * @param xmlReader The embedded XMLReader.
- */
- private void setup (XMLReader xmlReader)
- {
- if (xmlReader == null) {
- throw new NullPointerException("XMLReader must not be null");
- }
- this.xmlReader = xmlReader;
- qAtts = new AttributesAdapter();
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.Parser.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set the locale for error reporting.
- *
- * <p>This is not supported in SAX2, and will always throw
- * an exception.</p>
- *
- * @param The locale for error reporting.
- * @see org.xml.sax.Parser#setLocale
- * @exception org.xml.sax.SAXException Thrown unless overridden.
- */
- public void setLocale (Locale locale)
- throws SAXException
- {
- throw new SAXNotSupportedException("setLocale not supported");
- }
-
-
- /**
- * Register the entity resolver.
- *
- * @param resolver The new resolver.
- * @see org.xml.sax.Parser#setEntityResolver
- */
- public void setEntityResolver (EntityResolver resolver)
- {
- xmlReader.setEntityResolver(resolver);
- }
-
-
- /**
- * Register the DTD event handler.
- *
- * @param handler The new DTD event handler.
- * @see org.xml.sax.Parser#setDTDHandler
- */
- public void setDTDHandler (DTDHandler handler)
- {
- xmlReader.setDTDHandler(handler);
- }
-
-
- /**
- * Register the SAX1 document event handler.
- *
- * <p>Note that the SAX1 document handler has no Namespace
- * support.</p>
- *
- * @param handler The new SAX1 document event handler.
- * @see org.xml.sax.Parser#setDocumentHandler
- */
- public void setDocumentHandler (DocumentHandler handler)
- {
- documentHandler = handler;
- }
-
-
- /**
- * Register the error event handler.
- *
- * @param handler The new error event handler.
- * @see org.xml.sax.Parser#setErrorHandler
- */
- public void setErrorHandler (ErrorHandler handler)
- {
- xmlReader.setErrorHandler(handler);
- }
-
-
- /**
- * Parse the document.
- *
- * <p>This method will throw an exception if the embedded
- * XMLReader does not support the
- * http://xml.org/sax/features/namespace-prefixes property.</p>
- *
- * @param systemId The absolute URL of the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception org.xml.sax.SAXException If there is a problem
- * processing the document.
- * @see #parse(org.xml.sax.InputSource)
- * @see org.xml.sax.Parser#parse(java.lang.String)
- */
- public void parse (String systemId)
- throws IOException, SAXException
- {
- parse(new InputSource(systemId));
- }
-
-
- /**
- * Parse the document.
- *
- * <p>This method will throw an exception if the embedded
- * XMLReader does not support the
- * http://xml.org/sax/features/namespace-prefixes property.</p>
- *
- * @param input An input source for the document.
- * @exception java.io.IOException If there is a problem reading
- * the raw content of the document.
- * @exception org.xml.sax.SAXException If there is a problem
- * processing the document.
- * @see #parse(java.lang.String)
- * @see org.xml.sax.Parser#parse(org.xml.sax.InputSource)
- */
- public void parse (InputSource input)
- throws IOException, SAXException
- {
- setupXMLReader();
- xmlReader.parse(input);
- }
-
-
- /**
- * Set up the XML reader.
- */
- private void setupXMLReader ()
- throws SAXException
- {
- xmlReader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
- try {
- xmlReader.setFeature("http://xml.org/sax/features/namespaces",
- false);
- } catch (SAXException e) {
- // NO OP: it's just extra information, and we can ignore it
- }
- xmlReader.setContentHandler(this);
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Implementation of org.xml.sax.ContentHandler.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Set a document locator.
- *
- * @param locator The document locator.
- * @see org.xml.sax.ContentHandler#setDocumentLocator
- */
- public void setDocumentLocator (Locator locator)
- {
- if (documentHandler != null)
- documentHandler.setDocumentLocator(locator);
- }
-
-
- /**
- * Start document event.
- *
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#startDocument
- */
- public void startDocument ()
- throws SAXException
- {
- if (documentHandler != null)
- documentHandler.startDocument();
- }
-
-
- /**
- * End document event.
- *
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void endDocument ()
- throws SAXException
- {
- if (documentHandler != null)
- documentHandler.endDocument();
- }
-
-
- /**
- * Adapt a SAX2 start prefix mapping event.
- *
- * @param prefix The prefix being mapped.
- * @param uri The Namespace URI being mapped to.
- * @see org.xml.sax.ContentHandler#startPrefixMapping
- */
- public void startPrefixMapping (String prefix, String uri)
- {
- }
-
-
- /**
- * Adapt a SAX2 end prefix mapping event.
- *
- * @param prefix The prefix being mapped.
- * @see org.xml.sax.ContentHandler#endPrefixMapping
- */
- public void endPrefixMapping (String prefix)
- {
- }
-
-
- /**
- * Adapt a SAX2 start element event.
- *
- * @param uri The Namespace URI.
- * @param localName The Namespace local name.
- * @param qName The qualified (prefixed) name.
- * @param atts The SAX2 attributes.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#endDocument
- */
- public void startElement (String uri, String localName,
- String qName, Attributes atts)
- throws SAXException
- {
- if (documentHandler != null) {
- qAtts.setAttributes(atts);
- documentHandler.startElement(qName, qAtts);
- }
- }
-
-
- /**
- * Adapt a SAX2 end element event.
- *
- * @param uri The Namespace URI.
- * @param localName The Namespace local name.
- * @param qName The qualified (prefixed) name.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#endElement
- */
- public void endElement (String uri, String localName,
- String qName)
- throws SAXException
- {
- if (documentHandler != null)
- documentHandler.endElement(qName);
- }
-
-
- /**
- * Adapt a SAX2 characters event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters (char ch[], int start, int length)
- throws SAXException
- {
- if (documentHandler != null)
- documentHandler.characters(ch, start, length);
- }
-
-
- /**
- * Adapt a SAX2 ignorable whitespace event.
- *
- * @param ch An array of characters.
- * @param start The starting position in the array.
- * @param length The number of characters to use.
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#ignorableWhitespace
- */
- public void ignorableWhitespace (char ch[], int start, int length)
- throws SAXException
- {
- if (documentHandler != null)
- documentHandler.ignorableWhitespace(ch, start, length);
- }
-
-
- /**
- * Adapt a SAX2 processing instruction event.
- *
- * @param target The processing instruction target.
- * @param data The remainder of the processing instruction
- * @exception org.xml.sax.SAXException The client may raise a
- * processing exception.
- * @see org.xml.sax.ContentHandler#processingInstruction
- */
- public void processingInstruction (String target, String data)
- throws SAXException
- {
- if (documentHandler != null)
- documentHandler.processingInstruction(target, data);
- }
-
-
- /**
- * Adapt a SAX2 skipped entity event.
- *
- * @param name The name of the skipped entity.
- * @see org.xml.sax.ContentHandler#skippedEntity
- * @exception org.xml.sax.SAXException Throwable by subclasses.
- */
- public void skippedEntity (String name)
- throws SAXException
- {
- }
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal state.
- ////////////////////////////////////////////////////////////////////
-
- XMLReader xmlReader;
- DocumentHandler documentHandler;
- AttributesAdapter qAtts;
-
-
-
- ////////////////////////////////////////////////////////////////////
- // Internal class.
- ////////////////////////////////////////////////////////////////////
-
-
- /**
- * Internal class to wrap a SAX2 Attributes object for SAX1.
- */
- final class AttributesAdapter implements AttributeList
- {
- AttributesAdapter ()
- {
- }
-
-
- /**
- * Set the embedded Attributes object.
- *
- * @param The embedded SAX2 Attributes.
- */
- void setAttributes (Attributes attributes)
- {
- this.attributes = attributes;
- }
-
-
- /**
- * Return the number of attributes.
- *
- * @return The length of the attribute list.
- * @see org.xml.sax.AttributeList#getLength
- */
- public int getLength ()
- {
- return attributes.getLength();
- }
-
-
- /**
- * Return the qualified (prefixed) name of an attribute by position.
- *
- * @return The qualified name.
- * @see org.xml.sax.AttributeList#getName
- */
- public String getName (int i)
- {
- return attributes.getQName(i);
- }
-
-
- /**
- * Return the type of an attribute by position.
- *
- * @return The type.
- * @see org.xml.sax.AttributeList#getType(int)
- */
- public String getType (int i)
- {
- return attributes.getType(i);
- }
-
-
- /**
- * Return the value of an attribute by position.
- *
- * @return The value.
- * @see org.xml.sax.AttributeList#getValue(int)
- */
- public String getValue (int i)
- {
- return attributes.getValue(i);
- }
-
-
- /**
- * Return the type of an attribute by qualified (prefixed) name.
- *
- * @return The type.
- * @see org.xml.sax.AttributeList#getType(java.lang.String)
- */
- public String getType (String qName)
- {
- return attributes.getType(qName);
- }
-
-
- /**
- * Return the value of an attribute by qualified (prefixed) name.
- *
- * @return The value.
- * @see org.xml.sax.AttributeList#getValue(java.lang.String)
- */
- public String getValue (String qName)
- {
- return attributes.getValue(qName);
- }
-
- private Attributes attributes;
- }
-
-}
-
-// end of XMLReaderAdapter.java
diff --git a/external/jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java b/external/jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java
deleted file mode 100755
index 32b7f1c08..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/XMLReaderFactory.java
+++ /dev/null
@@ -1,200 +0,0 @@
-// XMLReaderFactory.java - factory for creating a new reader.
-// http://www.saxproject.org
-// Written by David Megginson
-// and by David Brownell
-// NO WARRANTY! This class is in the Public Domain.
-
-package org.xml.sax.helpers;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import org.xml.sax.XMLReader;
-import org.xml.sax.SAXException;
-
-
-/**
- * Factory for creating an XML reader.
- *
- * <blockquote>
- * <em>This module, both source code and documentation, is in the
- * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
- * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
- * for further information.
- * </blockquote>
- *
- * <p>This class contains static methods for creating an XML reader
- * from an explicit class name, or based on runtime defaults:</p>
- *
- * <pre>
- * try {
- * XMLReader myReader = XMLReaderFactory.createXMLReader();
- * } catch (SAXException e) {
- * System.err.println(e.getMessage());
- * }
- * </pre>
- *
- * <p><strong>Note to Distributions bundled with parsers:</strong>
- * You should modify the implementation of the no-arguments
- * <em>createXMLReader</em> to handle cases where the external
- * configuration mechanisms aren't set up. That method should do its
- * best to return a parser when one is in the class path, even when
- * nothing bound its class name to <code>org.xml.sax.driver</code> so
- * those configuration mechanisms would see it.</p>
- *
- * @since SAX 2.0
- * @author David Megginson, David Brownell
- * @version 2.0.1 (sax2r2)
- */
-final public class XMLReaderFactory
-{
- /**
- * Private constructor.
- *
- * <p>This constructor prevents the class from being instantiated.</p>
- */
- private XMLReaderFactory ()
- {
- }
-
- private static final String property = "org.xml.sax.driver";
-
- /**
- * Attempt to create an XMLReader from system defaults.
- * In environments which can support it, the name of the XMLReader
- * class is determined by trying each these options in order, and
- * using the first one which succeeds:</p> <ul>
- *
- * <li>If the system property <code>org.xml.sax.driver</code>
- * has a value, that is used as an XMLReader class name. </li>
- *
- * <li>The JAR "Services API" is used to look for a class name
- * in the <em>META-INF/services/org.xml.sax.driver</em> file in
- * jarfiles available to the runtime.</li>
- *
- * <li> SAX parser distributions are strongly encouraged to provide
- * a default XMLReader class name that will take effect only when
- * previous options (on this list) are not successful.</li>
- *
- * <li>Finally, if {@link ParserFactory#makeParser()} can
- * return a system default SAX1 parser, that parser is wrapped in
- * a {@link ParserAdapter}. (This is a migration aid for SAX1
- * environments, where the <code>org.xml.sax.parser</code> system
- * property will often be usable.) </li>
- *
- * </ul>
- *
- * <p> In environments such as small embedded systems, which can not
- * support that flexibility, other mechanisms to determine the default
- * may be used. </p>
- *
- * <p>Note that many Java environments allow system properties to be
- * initialized on a command line. This means that <em>in most cases</em>
- * setting a good value for that property ensures that calls to this
- * method will succeed, except when security policies intervene.
- * This will also maximize application portability to older SAX
- * environments, with less robust implementations of this method.
- * </p>
- *
- * @return A new XMLReader.
- * @exception org.xml.sax.SAXException If no default XMLReader class
- * can be identified and instantiated.
- * @see #createXMLReader(java.lang.String)
- */
- public static XMLReader createXMLReader ()
- throws SAXException
- {
- String className = null;
- ClassLoader loader = NewInstance.getClassLoader ();
-
- // 1. try the JVM-instance-wide system property
- try { className = System.getProperty (property); }
- catch (RuntimeException e) { /* normally fails for applets */ }
-
- // 2. if that fails, try META-INF/services/
- if (className == null) {
- try {
- String service = "META-INF/services/" + property;
- InputStream in;
- BufferedReader reader;
-
- if (loader == null)
- in = ClassLoader.getSystemResourceAsStream (service);
- else
- in = loader.getResourceAsStream (service);
-
- if (in != null) {
- reader = new BufferedReader (
- new InputStreamReader (in, "UTF8"));
- className = reader.readLine ();
- in.close ();
- }
- } catch (Exception e) {
- }
- }
-
- // 3. Distro-specific fallback
- if (className == null) {
-// BEGIN DISTRIBUTION-SPECIFIC
-
- // use the non-validating one
- className = "gnu.xml.aelfred2.SAXDriver";
-
-// END DISTRIBUTION-SPECIFIC
- }
-
- // do we know the XMLReader implementation class yet?
- if (className != null)
- return loadClass (loader, className);
-
- // 4. panic -- adapt any SAX1 parser
- try {
- return new ParserAdapter (ParserFactory.makeParser ());
- } catch (Exception e) {
- throw new SAXException ("Can't create default XMLReader; "
- + "is system property org.xml.sax.driver set?");
- }
- }
-
-
- /**
- * Attempt to create an XML reader from a class name.
- *
- * <p>Given a class name, this method attempts to load
- * and instantiate the class as an XML reader.</p>
- *
- * <p>Note that this method will not be usable in environments where
- * the caller (perhaps an applet) is not permitted to load classes
- * dynamically.</p>
- *
- * @return A new XML reader.
- * @exception org.xml.sax.SAXException If the class cannot be
- * loaded, instantiated, and cast to XMLReader.
- * @see #createXMLReader()
- */
- public static XMLReader createXMLReader (String className)
- throws SAXException
- {
- return loadClass (NewInstance.getClassLoader (), className);
- }
-
- private static XMLReader loadClass (ClassLoader loader, String className)
- throws SAXException
- {
- try {
- return (XMLReader) NewInstance.newInstance (loader, className);
- } catch (ClassNotFoundException e1) {
- throw new SAXException("SAX2 driver class " + className +
- " not found", e1);
- } catch (IllegalAccessException e2) {
- throw new SAXException("SAX2 driver class " + className +
- " found but cannot be loaded", e2);
- } catch (InstantiationException e3) {
- throw new SAXException("SAX2 driver class " + className +
- " loaded but cannot be instantiated (no empty public constructor?)",
- e3);
- } catch (ClassCastException e4) {
- throw new SAXException("SAX2 driver class " + className +
- " does not implement XMLReader", e4);
- }
- }
-}
diff --git a/external/jaxp/source/org/xml/sax/helpers/package.html b/external/jaxp/source/org/xml/sax/helpers/package.html
deleted file mode 100755
index 3eecb08f7..000000000
--- a/external/jaxp/source/org/xml/sax/helpers/package.html
+++ /dev/null
@@ -1,11 +0,0 @@
-<HTML><HEAD>
-<!-- $Id: package.html,v 1.2 2004-05-01 16:18:52 mark Exp $ -->
-</HEAD><BODY>
-
-<p>This package contains "helper" classes, including
-support for bootstrapping SAX-based applications.
-
-<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
-for more information about SAX.</p>
-
-</BODY></HTML>
diff --git a/external/jaxp/source/org/xml/sax/package.html b/external/jaxp/source/org/xml/sax/package.html
deleted file mode 100755
index e87676622..000000000
--- a/external/jaxp/source/org/xml/sax/package.html
+++ /dev/null
@@ -1,229 +0,0 @@
-<html><head>
-<!-- $Id: package.html,v 1.2 2004-05-01 16:18:52 mark Exp $ -->
-</head><body>
-
-<p> This package provides the core SAX APIs.
-Some SAX1 APIs are deprecated to encourage integration of
-namespace-awareness into designs of new applications
-and into maintainance of existing infrastructure. </p>
-
-<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
-for more information about SAX.</p>
-
-
-<h2> SAX2 Standard Feature Flags </h2>
-
-<p> One of the essential characteristics of SAX2 is that it added
-feature flags which can be used to examine and perhaps modify
-parser modes, in particular modes such as validation.
-Since features are identified by (absolute) URIs, anyone
-can define such features.
-Currently defined standard feature URIs have the prefix
-<code>http://xml.org/sax/features/</code> before an identifier such as
-<code>validation</code>. Turn features on or off using
-<em>setFeature</em>. Those standard identifiers are: </p>
-
-
-<table border="1" cellpadding="3" cellspacing="0" width="100%">
- <tr align="center" bgcolor="#ccccff">
- <th>Feature ID</th>
- <th>Default</th>
- <th>Description</th>
- </tr>
-
- <tr>
- <td>external-general-entities</td>
- <td><em>unspecified</em></td>
- <td> Reports whether this parser processes external
- general entities; always true if validating</td>
- </tr>
-
- <tr>
- <td>external-parameter-entities</td>
- <td><em>unspecified</em></td>
- <td> Reports whether this parser processes external
- parameter entities; always true if validating</td>
- </tr>
-
- <tr>
- <td>is-standalone</td>
- <td><em>none</em></td>
- <td> May be examined only during a parse, after the
- <em>startDocument()</em> callback has been made; read-only.
- The value is true if the document specified the
- "standalone" flag in its XML declaration,
- and otherwise is false. </td>
- </tr>
-
- <tr>
- <td>lexical-handler/parameter-entities</td>
- <td><em>unspecified</em></td>
- <td> true indicates that the LexicalHandler will report the
- beginning and end of parameter entities
- </td>
- </tr>
-
- <tr>
- <td>namespaces</td>
- <td>true</td>
- <td> true indicates namespace URIs and unprefixed local names
- for element and attribute names will be available </td>
- </tr>
-
- <tr>
- <td>namespace-prefixes</td>
- <td>false</td>
- <td> true indicates XML 1.0 names (with prefixes) and attributes
- (including <em>xmlns*</em> attributes) will be available </td>
- </tr>
-
- <tr>
- <td>resolve-dtd-uris</td>
- <td><em>true</em></td>
- <td> A value of "true" indicates that system IDs in declarations will
- be absolutized (relative to their base URIs) before reporting.
- (That is the default behavior for all SAX2 XML parsers.)
- A value of "false" indicates those IDs will not be absolutized;
- parsers will provide the base URI from
- <em>Locator.getSystemId()</em>.
- This applies to system IDs passed in <ul>
- <li><em>DTDHandler.notationDecl()</em>,
- <li><em>DTDHandler.unparsedEntityDecl()</em>, and
- <li><em>DeclHandler.externalEntityDecl()</em>.
- </ul>
- It does not apply to <em>EntityResolver.resolveEntity()</em>,
- which is not used to report declarations, or to
- <em>LexicalHandler.startDTD()</em>, which already provides
- the non-absolutized URI.
- </td>
- </tr>
-
- <tr>
- <td>string-interning</td>
- <td><em>unspecified</em></td>
- <td> true if all XML names (for elements, prefixes, attributes,
- entities, notations, and local names),
- as well as Namespace URIs, will have been interned
- using <em>java.lang.String.intern</em>. This supports fast
- testing of equality/inequality against string constants.</td>
- </tr>
-
- <tr>
- <td>use-attributes2</td>
- <td><em>unspecified</em></td>
- <td> Returns true if the <em>Attributes</em> objects passed by
- this parser in <em>ContentHandler.startElement()</em>
- implement the <a href="ext/Attributes2.html"
- ><em>org.xml.sax.ext.Attributes2</em></a> interface.
- That interface exposes additional information,
- such as whether the attribute was specified in the
- source text rather than defaulted.
- </td>
- </tr>
-
- <tr>
- <td>use-locator2</td>
- <td><em>unspecified</em></td>
- <td> Returns true if the <em>Locator</em> objects passed by
- this parser in <em>ContentHandler.setDocumentLocator()</em>
- implement the <a href="ext/Locator2.html"
- ><em>org.xml.sax.ext.Locator2</em></a> interface.
- That interface exposes additional entity information,
- such as the character encoding and XML version used.
- </td>
- </tr>
-
- <tr>
- <td>use-entity-resolver2</td>
- <td><em>true</em> (when recognized)</td>
- <td> Returns true if, when <em>setEntityResolver</em> is given
- an object implementing the <a href="ext/EntityResolver2.html"
- ><em>org.xml.sax.ext.EntityResolver2</em></a> interface,
- those new methods will be used.
- Returns false to indicate that those methods will not be used.
- </td>
- </tr>
-
- <tr>
- <td>validation</td>
- <td><em>unspecified</em></td>
- <td> controls whether the parser is reporting all validity
- errors; if true, all external entities will be read. </td>
- </tr>
-
-</table>
-
-<p> Support for the default values of the
-<em>namespaces</em> and <em>namespace-prefixes</em>
-properties is required.
-</p>
-
-<p> For default values not specified by SAX2,
-each XMLReader implementation specifies its default,
-or may choose not to expose the feature flag.
-Unless otherwise specified here,
-implementations may support changing current values
-of these standard feature flags, but not while parsing.
-</p>
-
-<h2> SAX2 Standard Handler and Property IDs </h2>
-
-<p> For parser interface characteristics that are described
-as objects, a separate namespace is defined. The
-objects in this namespace are again identified by URI, and
-the standard property URIs have the prefix
-<code>http://xml.org/sax/properties/</code> before an identifier such as
-<code>lexical-handler</code> or
-<code>dom-node</code>. Manage those properties using
-<em>setProperty()</em>. Those identifiers are: </p>
-
-<table border="1" cellpadding="3" cellspacing="0" width="100%">
- <tr align="center" bgcolor="#ccccff">
- <th>Property ID</th>
- <th>Description</th>
- </tr>
-
- <tr>
- <td>declaration-handler</td>
- <td> Used to see most DTD declarations except those treated
- as lexical ("document element name is ...") or which are
- mandatory for all SAX parsers (<em>DTDHandler</em>).
- The Object must implement <a href="ext/DeclHandler.html"
- ><em>org.xml.sax.ext.DeclHandler</em></a>.
- </td>
- </tr>
-
- <tr>
- <td>dom-node</td>
- <td> For "DOM Walker" style parsers, which ignore their
- <em>parser.parse()</em> parameters, this is used to
- specify the DOM (sub)tree being walked by the parser.
- The Object must implement the
- <em>org.w3c.dom.Node</em> interface.
- </td>
- </tr>
-
- <tr>
- <td>lexical-handler</td>
- <td> Used to see some syntax events that are essential in some
- applications: comments, CDATA delimeters, selected general
- entity inclusions, and the start and end of the DTD
- (and declaration of document element name).
- The Object must implement <a href="ext/LexicalHandler.html"
- ><em>org.xml.sax.ext.LexicalHandler</em></a>.
- </td>
- </tr>
-
- <tr>
- <td>xml-string</td>
- <td> Readable only during a parser callback, this exposes a <b>TBS</b>
- chunk of characters responsible for the current event. </td>
- </tr>
-
-</table>
-
-<p> All of these standard properties are optional;
-XMLReader implementations need not support them.
-</p>
-
-</body></html>
diff --git a/external/jaxp/tests/dom/NodeType.java b/external/jaxp/tests/dom/NodeType.java
deleted file mode 100644
index 7dac3b7d3..000000000
--- a/external/jaxp/tests/dom/NodeType.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package tests.dom;
-
-
-import org.w3c.dom.*;
-import javax.xml.parsers.*;
-import java.io.*;
-
-/**
- * NodeType DOM test.
- * Test that the values of Dom nodes are correct.
- *
- *
- * @author <a href="mailto:arnaud.vandyck@ulg.ac.be">Arnaud Vandyck</a>
- * @created Thu Oct 10 21:44:07 2002
- * @version
- */
-public class NodeType
-{
-
- public static String[] NODETYPE =
- {
- "Unknow Node", "ELEMENT_NODE", "ATTRIBUTE_NODE", "TEXT_NODE",
- "CDATA_SECTION_NODE", "ENTITY_REFERENCE_NODE", "ENTITY_NODE",
- "PROCESSING_INSTRUCTION_NODE", "COMMENT_NODE", "DOCUMENT_NODE",
- "DOCUMENT_TYPE_NODE", "DOCUMENT_FRAGMENT_NODE", "NOTATION_NODE"
- };
-
- public NodeType ()
- {
- }
-
- public static void main(String[] args)
- {
- try
- {
- System.out.println( "Starting processing..." );
-
- DocumentBuilder domManager = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-
- FileInputStream fis = new FileInputStream("tests/dom/nodetype.xml");
- Document d = domManager.parse( fis );
- System.out.println( "File has been passed to the processor..." );
-
- Element root = d.getDocumentElement();
- System.out.println( "Root tag name: " + root.getTagName() );
-
- printChildNodes( root.getChildNodes() );
- }
- catch (Exception e1)
- {
- e1.printStackTrace();
- }
- }
-
- static private void printChildNodes( NodeList list )
- {
- int l = list.getLength();
- for (int i=0; i<l; i++)
- {
- Node node = list.item( i );
- printNode( node );
- printChildNodes( node.getChildNodes() );
- }
- }
-
- static private void printNode( Node node )
- {
- System.out.println( node.getNodeName()
- + " [" + NODETYPE[node.getNodeType()] + "]: "
- + node.getNodeValue() );
- }
-
-}
diff --git a/external/jaxp/tests/dom/nodetype.xml b/external/jaxp/tests/dom/nodetype.xml
deleted file mode 100644
index 333030d8a..000000000
--- a/external/jaxp/tests/dom/nodetype.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
-<?xml-stylesheet type="text/xsl" href="sdocbook.xsl"?>
-<!DOCTYPE article SYSTEM "file:///usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd"
-[
-<!NOTATION wmf SYSTEM "wmf" >
-<!ENTITY g001 SYSTEM "images/example_001.wmf" NDATA wmf >
-
-<!ENTITY yo "Yooooooo">
-<!ENTITY yo2 "&yo;">
-]>
-
-<article>
- <articleinfo>
- <title>Titre de test</title>
- <author>
- <firstname>Arnaud</firstname>
- <surname>Vandyck</surname>
- </author>
- </articleinfo>
- <section>
- <title>Test</title>
- <para>Entite yo: &yo;</para>
- <para>Entite yo2: &yo2;</para>
- <para>Entite EURO: &euro;</para>
- </section>
-</article> \ No newline at end of file
diff --git a/gnu/classpath/Configuration.java b/gnu/classpath/Configuration.java
new file mode 100644
index 000000000..6969b5c4d
--- /dev/null
+++ b/gnu/classpath/Configuration.java
@@ -0,0 +1,113 @@
+/* gnu.classpath.Configuration
+ Copyright (C) 1998, 2001, 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.classpath;
+
+/**
+ * This file defines compile-time constants that can be accessed by
+ * java code. It is pre-processed by configure.
+ */
+public interface Configuration
+{
+ /**
+ * The value of CLASSPATH_HOME is the location that the classpath
+ * libraries and support files where installed in. It is set according to
+ * the argument for --prefix given to configure and used to set the
+ * System property gnu.classpath.home.
+ */
+ String CLASSPATH_HOME = "/home/gandalf/projects/java/classpath/generics-build";
+
+ /**
+ * The release version number of GNU Classpath.
+ * It is set according to the value of 'version' in the configure[.in] file
+ * and used to set the System property gnu.classpath.version.
+ */
+ String CLASSPATH_VERSION = "0.11+cvs";
+
+ /**
+ * The value of DEBUG is substituted according to whether the
+ * "--enable-debug" argument was passed to configure. Code
+ * which is made conditional based on the value of this flag - typically
+ * code that generates debugging output - will be removed by the optimizer
+ * in a non-debug build.
+ */
+ boolean DEBUG = false;
+
+ /**
+ * The value of LOAD_LIBRARY is substituted according to whether the
+ * "--enable-load-library" or "--disable-load-library" argument was passed
+ * to configure. By default, configure should define this is as true.
+ * If set to false, loadLibrary() calls to load native function
+ * implementations, typically found in static initializers of classes
+ * which contain native functions, will be omitted. This is useful for
+ * runtimes which pre-link their native function implementations and do
+ * not require additional shared libraries to be loaded.
+ */
+ boolean INIT_LOAD_LIBRARY = true;
+
+ /**
+ * Set to true if the VM provides a native method to implement
+ * Proxy.getProxyClass completely, including argument verification.
+ * If this is true, HAVE_NATIVE_GET_PROXY_DATA and
+ * HAVE_NATIVE_GENERATE_PROXY_CLASS should be false.
+ * @see java.lang.reflect.Proxy
+ */
+ boolean HAVE_NATIVE_GET_PROXY_CLASS = false;
+
+ /**
+ * Set to true if the VM provides a native method to implement
+ * the first part of Proxy.getProxyClass: generation of the array
+ * of methods to convert, and verification of the arguments.
+ * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
+ * @see java.lang.reflect.Proxy
+ */
+ boolean HAVE_NATIVE_GET_PROXY_DATA = false;
+
+ /**
+ * Set to true if the VM provides a native method to implement
+ * the second part of Proxy.getProxyClass: conversion of an array of
+ * methods into an actual proxy class.
+ * If this is true, HAVE_NATIVE_GET_PROXY_CLASS should be false.
+ * @see java.lang.reflect.Proxy
+ */
+ boolean HAVE_NATIVE_GENERATE_PROXY_CLASS = false;
+
+ /**
+ * Name of default AWT peer library.
+ */
+ String default_awt_peer_toolkit = "gnu.java.awt.peer.gtk.GtkToolkit";
+}
diff --git a/gnu/java/awt/peer/gtk/GdkGraphics.java b/gnu/java/awt/peer/gtk/GdkGraphics.java
index c374ba218..4f2ccb86c 100644
--- a/gnu/java/awt/peer/gtk/GdkGraphics.java
+++ b/gnu/java/awt/peer/gtk/GdkGraphics.java
@@ -116,7 +116,6 @@ public class GdkGraphics extends Graphics
// public Graphics create (int x, int y, int width, int height)
// {
// GdkGraphics g = new GdkGraphics (this);
-// System.out.println ("translating by: " + x +" " + y);
// g.translate (x, y);
// g.clipRect (0, 0, width, height);
@@ -350,7 +349,6 @@ public class GdkGraphics extends Graphics
public Rectangle getClipBounds ()
{
-// System.out.println ("returning CLIP: " + clip);
return new Rectangle (clip.x, clip.y, clip.width, clip.height);
}
@@ -396,7 +394,7 @@ public class GdkGraphics extends Graphics
public void setColor (Color c)
{
if (c == null)
- color = new Color (0, 0, 0);
+ color = Color.BLACK;
else
color = c;
diff --git a/gnu/java/awt/peer/gtk/GdkGraphics2D.java b/gnu/java/awt/peer/gtk/GdkGraphics2D.java
index 0986960b8..768b35e8d 100644
--- a/gnu/java/awt/peer/gtk/GdkGraphics2D.java
+++ b/gnu/java/awt/peer/gtk/GdkGraphics2D.java
@@ -85,6 +85,8 @@ public class GdkGraphics2D extends Graphics2D
private RenderingHints hints;
private BufferedImage bimage;
+ private Composite comp;
+
private Stack stateStack;
native private void initState (GtkComponentPeer component);
@@ -268,6 +270,7 @@ public class GdkGraphics2D extends Graphics2D
private Shape clip;
private AffineTransform transform;
private Font font;
+ private Composite comp;
DrawState (GdkGraphics2D g)
{
this.paint = g.paint;
@@ -278,6 +281,7 @@ public class GdkGraphics2D extends Graphics2D
if (g.transform != null)
this.transform = (AffineTransform) g.transform.clone();
this.font = g.font;
+ this.comp = g.comp;
}
public void restore(GdkGraphics2D g)
{
@@ -288,6 +292,7 @@ public class GdkGraphics2D extends Graphics2D
g.clip = this.clip;
g.transform = this.transform;
g.font = this.font;
+ g.comp = this.comp;
}
}
@@ -771,6 +776,9 @@ public class GdkGraphics2D extends Graphics2D
public void setColor (Color c)
{
+ if (c == null)
+ c = Color.BLACK;
+
fg = c;
paint = c;
cairoSetRGBColor (fg.getRed() / 255.0,
@@ -1259,6 +1267,8 @@ public class GdkGraphics2D extends Graphics2D
public void setComposite(Composite comp)
{
+ this.comp = comp;
+
if (comp instanceof AlphaComposite)
{
AlphaComposite a = (AlphaComposite) comp;
@@ -1345,7 +1355,10 @@ public class GdkGraphics2D extends Graphics2D
public Composite getComposite()
{
- throw new java.lang.UnsupportedOperationException ();
+ if (comp == null)
+ return AlphaComposite.SrcOver;
+ else
+ return comp;
}
public FontRenderContext getFontRenderContext ()
diff --git a/gnu/java/awt/peer/gtk/GtkButtonPeer.java b/gnu/java/awt/peer/gtk/GtkButtonPeer.java
index db8aed608..5281b9a8c 100644
--- a/gnu/java/awt/peer/gtk/GtkButtonPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkButtonPeer.java
@@ -52,13 +52,13 @@ public class GtkButtonPeer extends GtkComponentPeer
{
native void create (String label);
- public native void connectJObject ();
public native void connectSignals ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkSetLabel (String label);
native void gtkWidgetSetForeground (int red, int green, int blue);
native void gtkActivate ();
+ native void gtkWidgetRequestFocus ();
public GtkButtonPeer (Button b)
{
@@ -86,8 +86,8 @@ public class GtkButtonPeer extends GtkComponentPeer
if (!me.isConsumed ()
&& (me.getModifiersEx () & MouseEvent.BUTTON1_DOWN_MASK) != 0
&& awtComponent.getBounds().contains(p))
- postActionEvent (((Button)awtComponent).getActionCommand (),
- me.getModifiersEx ());
+ postActionEvent (((Button) awtComponent).getActionCommand (),
+ me.getModifiersEx ());
}
if (e.getID () == KeyEvent.KEY_PRESSED)
diff --git a/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java b/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
index 361136f08..a6fd1bac1 100644
--- a/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkCheckboxPeer.java
@@ -55,7 +55,7 @@ public class GtkCheckboxPeer extends GtkComponentPeer
public native void create (GtkCheckboxGroupPeer group);
public native void nativeSetCheckboxGroup (GtkCheckboxGroupPeer group);
public native void connectSignals ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkButtonSetLabel (String label);
native void gtkToggleButtonSetActive (boolean is_active);
diff --git a/gnu/java/awt/peer/gtk/GtkClipboard.java b/gnu/java/awt/peer/gtk/GtkClipboard.java
index 86678f8ab..f9348aca3 100644
--- a/gnu/java/awt/peer/gtk/GtkClipboard.java
+++ b/gnu/java/awt/peer/gtk/GtkClipboard.java
@@ -60,15 +60,13 @@ public class GtkClipboard extends Clipboard
static boolean hasSelection = false;
- protected
- GtkClipboard ()
+ protected GtkClipboard()
{
- super ("System Clipboard");
- initNativeState ();
+ super("System Clipboard");
+ initNativeState();
}
- public Transferable
- getContents (Object requestor)
+ public Transferable getContents(Object requestor)
{
synchronized (this)
{
@@ -77,72 +75,76 @@ public class GtkClipboard extends Clipboard
}
/* Java doesn't own the selection, so we need to ask X11 */
+ // XXX: Does this hold with Swing too ?
synchronized (selectionLock)
{
- requestStringConversion ();
+ requestStringConversion();
+
try
{
- selectionLock.wait (SELECTION_RECEIVED_TIMEOUT);
+ selectionLock.wait(SELECTION_RECEIVED_TIMEOUT);
}
catch (InterruptedException e)
{
return null;
}
- return (selection == null) ? null : new StringSelection (selection);
+ return selection == null ? null : new StringSelection(selection);
}
}
- void
- stringSelectionReceived (String newSelection)
+ void stringSelectionReceived(String newSelection)
{
synchronized (selectionLock)
{
selection = newSelection;
- selectionLock.notify ();
+ selectionLock.notify();
}
}
/* convert Java clipboard data into a String suitable for sending
to another application */
- synchronized String
- stringSelectionHandler () throws IOException
+ synchronized String stringSelectionHandler() throws IOException
{
String selection = null;
- try {
- if (contents.isDataFlavorSupported (DataFlavor.stringFlavor))
- selection = (String)contents.getTransferData (DataFlavor.stringFlavor);
- else if (contents.isDataFlavorSupported (DataFlavor.plainTextFlavor))
- {
- StringBuffer sbuf = new StringBuffer ();
- InputStreamReader reader;
- char readBuf[] = new char[512];
- int numChars;
+ try
+ {
+ if (contents.isDataFlavorSupported(DataFlavor.stringFlavor))
+ selection = (String)contents.getTransferData(DataFlavor.stringFlavor);
+ else if (contents.isDataFlavorSupported(DataFlavor.plainTextFlavor))
+ {
+ StringBuffer sbuf = new StringBuffer();
+ InputStreamReader reader;
+ char readBuf[] = new char[512];
+ int numChars;
- reader = new InputStreamReader
- ((InputStream)
- contents.getTransferData (DataFlavor.plainTextFlavor), "UNICODE");
+ reader = new InputStreamReader
+ ((InputStream)
+ contents.getTransferData(DataFlavor.plainTextFlavor), "UNICODE");
- while (true)
- {
- numChars = reader.read (readBuf);
- if (numChars == -1)
- break;
- sbuf.append (readBuf, 0, numChars);
- }
+ while (true)
+ {
+ numChars = reader.read(readBuf);
+ if (numChars == -1)
+ break;
+ sbuf.append(readBuf, 0, numChars);
+ }
- selection = new String (sbuf);
- }
- } catch (Exception e) { }
+ selection = new String(sbuf);
+ }
+ }
+ catch (Exception e)
+ {
+ }
return selection;
}
- public synchronized void
- setContents (Transferable contents, ClipboardOwner owner)
+ public synchronized void setContents(Transferable contents,
+ ClipboardOwner owner)
{
- selectionGet ();
+ selectionGet();
this.contents = contents;
this.owner = owner;
@@ -150,20 +152,19 @@ public class GtkClipboard extends Clipboard
hasSelection = true;
}
- synchronized
- void selectionClear ()
+ synchronized void selectionClear()
{
hasSelection = false;
if (owner != null)
{
- owner.lostOwnership (this, contents);
+ owner.lostOwnership(this, contents);
owner = null;
contents = null;
}
}
- native void initNativeState ();
- native static void requestStringConversion ();
- native static void selectionGet ();
+ native void initNativeState();
+ native static void requestStringConversion();
+ native static void selectionGet();
}
diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
index bcdb950ff..e4e4f08f4 100644
--- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java
@@ -77,6 +77,8 @@ public class GtkComponentPeer extends GtkGenericPeer
Insets insets;
+ boolean isInRepaint;
+
/* this isEnabled differs from Component.isEnabled, in that it
knows if a parent is disabled. In that case Component.isEnabled
may return true, but our isEnabled will always return false */
@@ -97,10 +99,7 @@ public class GtkComponentPeer extends GtkGenericPeer
native void gtkWidgetRequestFocus ();
native void gtkWidgetDispatchKeyEvent (int id, long when, int mods,
int keyCode, int keyLocation);
- native void gtkSetFont (String name, int style, int size);
- native void gtkWidgetQueueDrawArea(int x, int y, int width, int height);
- native void addExposeFilter();
- native void removeExposeFilter();
+ native void gtkWidgetRepaintArea(int x, int y, int width, int height);
void create ()
{
@@ -134,8 +133,6 @@ public class GtkComponentPeer extends GtkGenericPeer
setComponentBounds ();
- Rectangle bounds = awtComponent.getBounds ();
- setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
setVisibleAndEnabled ();
}
@@ -154,15 +151,27 @@ public class GtkComponentPeer extends GtkGenericPeer
gtkWidgetSetParent (p);
}
+ void beginNativeRepaint ()
+ {
+ isInRepaint = true;
+ }
+
+ void endNativeRepaint ()
+ {
+ isInRepaint = false;
+ }
+
/*
* Set the bounds of this peer's AWT Component based on dimensions
* returned by the native windowing system. Most Components impose
- * their dimensions on the peers so the default implementation does
- * nothing. However some peers, like GtkFileDialogPeer, need to
- * pass their size back to the AWT Component.
+ * their dimensions on the peers which is what the default
+ * implementation does. However some peers, like GtkFileDialogPeer,
+ * need to pass their size back to the AWT Component.
*/
void setComponentBounds ()
{
+ Rectangle bounds = awtComponent.getBounds ();
+ setBounds (bounds.x, bounds.y, bounds.width, bounds.height);
}
void setVisibleAndEnabled ()
@@ -265,8 +274,8 @@ public class GtkComponentPeer extends GtkGenericPeer
// Some peers like GtkFileDialogPeer are repainted by Gtk itself
if (g == null)
break;
-
- g.setClip (((PaintEvent)event).getUpdateRect());
+
+ g.setClip (((PaintEvent) event).getUpdateRect());
if (id == PaintEvent.PAINT)
awtComponent.paint (g);
@@ -310,21 +319,6 @@ public class GtkComponentPeer extends GtkGenericPeer
public void paint (Graphics g)
{
- Component parent = awtComponent.getParent();
- GtkComponentPeer parentPeer = null;
- if ((parent instanceof Container) && !parent.isLightweight())
- parentPeer = (GtkComponentPeer) parent.getPeer();
-
- addExposeFilter();
- if (parentPeer != null)
- parentPeer.addExposeFilter();
-
- Rectangle clip = g.getClipBounds();
- gtkWidgetQueueDrawArea(clip.x, clip.y, clip.width, clip.height);
-
- removeExposeFilter();
- if (parentPeer != null)
- parentPeer.removeExposeFilter();
}
public Dimension preferredSize ()
@@ -371,8 +365,11 @@ public class GtkComponentPeer extends GtkGenericPeer
public void repaint (long tm, int x, int y, int width, int height)
{
+ beginNativeRepaint ();
+ gtkWidgetRepaintArea (x, y, width, height);
+ endNativeRepaint ();
q.postEvent (new PaintEvent (awtComponent, PaintEvent.UPDATE,
- new Rectangle (x, y, width, height)));
+ new Rectangle (x, y, width, height)));
}
public void requestFocus ()
@@ -426,8 +423,14 @@ public class GtkComponentPeer extends GtkGenericPeer
if (parent instanceof Window && !lightweightChild)
{
Insets insets = ((Window) parent).getInsets ();
- // Convert from Java coordinates to GTK coordinates.
- setNativeBounds (x - insets.left, y - insets.top, width, height);
+ GtkWindowPeer peer = (GtkWindowPeer) parent.getPeer ();
+ int menuBarHeight = 0;
+ if (peer instanceof GtkFramePeer)
+ menuBarHeight = ((GtkFramePeer) peer).getMenuBarHeight ();
+
+ // Convert from Java coordinates to GTK coordinates.
+ setNativeBounds (x - insets.left, y - insets.top + menuBarHeight,
+ width, height);
}
else
setNativeBounds (x, y, width, height);
@@ -448,7 +451,7 @@ public class GtkComponentPeer extends GtkGenericPeer
// FIXME: This should really affect the widget tree below me.
// Currently this is only handled if the call is made directly on
// a text widget, which implements setFont() itself.
- gtkSetFont(f.getName(), f.getStyle(), f.getSize());
+ gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
}
public void setForeground (Color c)
@@ -488,8 +491,9 @@ public class GtkComponentPeer extends GtkGenericPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
- q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x, y, width, height)));
+ if (!isInRepaint)
+ q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+ new Rectangle (x, y, width, height)));
}
protected void postKeyEvent (int id, long when, int mods,
diff --git a/gnu/java/awt/peer/gtk/GtkDialogPeer.java b/gnu/java/awt/peer/gtk/GtkDialogPeer.java
index 1d6ce8b8b..53b57d474 100644
--- a/gnu/java/awt/peer/gtk/GtkDialogPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkDialogPeer.java
@@ -75,11 +75,12 @@ public class GtkDialogPeer extends GtkWindowPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
- q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x + insets.left,
- y + insets.top,
- width, height)));
- }
+ if (!isInRepaint)
+ q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+ new Rectangle (x + insets.left,
+ y + insets.top,
+ width, height)));
+ }
void create ()
{
diff --git a/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java b/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
index 12e5a434c..7adf72cf2 100644
--- a/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkFileDialogPeer.java
@@ -94,6 +94,7 @@ public class GtkFileDialogPeer extends GtkDialogPeer implements FileDialogPeer
awtComponent.getY (),
dims[0], dims[1]);
}
+ super.setComponentBounds ();
}
public void setFile (String fileName)
diff --git a/gnu/java/awt/peer/gtk/GtkFramePeer.java b/gnu/java/awt/peer/gtk/GtkFramePeer.java
index e1a877eed..4916a7d0a 100644
--- a/gnu/java/awt/peer/gtk/GtkFramePeer.java
+++ b/gnu/java/awt/peer/gtk/GtkFramePeer.java
@@ -39,6 +39,7 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
import java.awt.Component;
+import java.awt.Container;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
@@ -57,51 +58,69 @@ public class GtkFramePeer extends GtkWindowPeer
private int menuBarHeight;
private MenuBarPeer menuBar;
native int getMenuBarHeight (MenuBarPeer bar);
-
+ native void setMenuBarWidth (MenuBarPeer bar, int width);
native void setMenuBarPeer (MenuBarPeer bar);
native void removeMenuBarPeer ();
- native void moveLayout (int offset);
- native void gtkLayoutSetVisible (boolean vis);
+ native void gtkFixedSetVisible (boolean visible);
+
+ int getMenuBarHeight ()
+ {
+ return menuBar == null ? 0 : getMenuBarHeight (menuBar);
+ }
public void setMenuBar (MenuBar bar)
{
- if (bar == null)
- {
- if (menuBar != null)
+ if (bar == null && menuBar != null)
{
- gtkLayoutSetVisible(false);
- removeMenuBarPeer();
+ // We're removing the menubar.
+ gtkFixedSetVisible (false);
menuBar = null;
- moveLayout(menuBarHeight);
+ removeMenuBarPeer ();
insets.top -= menuBarHeight;
- menuBarHeight = 0;
- awtComponent.doLayout();
- gtkLayoutSetVisible(true);
+ menuBarHeight = 0;
+ awtComponent.validate ();
+ gtkFixedSetVisible (true);
}
- }
- else
- {
- gtkLayoutSetVisible(false);
- int oldHeight = 0;
- if (menuBar != null)
+ else if (bar != null && menuBar == null)
+ {
+ // We're adding a menubar where there was no menubar before.
+ gtkFixedSetVisible (false);
+ menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
+ setMenuBarPeer (menuBar);
+ int menuBarWidth =
+ awtComponent.getWidth () - insets.left - insets.right;
+ setMenuBarWidth (menuBar, menuBarWidth);
+ menuBarHeight = getMenuBarHeight ();
+ insets.top += menuBarHeight;
+ awtComponent.validate ();
+ gtkFixedSetVisible (true);
+ }
+ else if (bar != null && menuBar != null)
{
+ // We're swapping the menubar.
+ gtkFixedSetVisible (false);
removeMenuBarPeer();
- oldHeight = menuBarHeight;
- insets.top -= menuBarHeight;
+ int oldHeight = menuBarHeight;
+ int menuBarWidth =
+ awtComponent.getWidth () - insets.left - insets.right;
+ menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer ();
+ setMenuBarPeer (menuBar);
+ setMenuBarWidth (menuBar, menuBarWidth);
+ menuBarHeight = getMenuBarHeight ();
+ if (oldHeight != menuBarHeight)
+ {
+ insets.top += (menuBarHeight - oldHeight);
+ awtComponent.validate ();
+ }
+ gtkFixedSetVisible (true);
}
- menuBar = (MenuBarPeer) ((MenuBar) bar).getPeer();
- setMenuBarPeer(menuBar);
- menuBarHeight = getMenuBarHeight (menuBar);
- if (oldHeight != menuBarHeight)
- moveLayout(oldHeight - menuBarHeight);
- insets.top += menuBarHeight;
- awtComponent.doLayout();
- gtkLayoutSetVisible(true);
- }
}
public void setBounds (int x, int y, int width, int height)
{
+ if (menuBar != null)
+ setMenuBarWidth (menuBar, width - insets.left - insets.right);
+
nativeSetBounds (x, y,
width - insets.left - insets.right,
height - insets.top - insets.bottom
@@ -206,15 +225,19 @@ public class GtkFramePeer extends GtkWindowPeer
|| frame_width != awtComponent.getWidth()
|| frame_height != awtComponent.getHeight())
{
+ if (frame_width != awtComponent.getWidth() && menuBar != null)
+ setMenuBarWidth (menuBar, width);
+
setBoundsCallback ((Window) awtComponent,
frame_x,
frame_y,
frame_width,
frame_height);
}
+
awtComponent.validate();
}
-
+
protected void postMouseEvent(int id, long when, int mods, int x, int y,
int clickCount, boolean popupTrigger)
{
@@ -225,10 +248,11 @@ public class GtkFramePeer extends GtkWindowPeer
protected void postExposeEvent (int x, int y, int width, int height)
{
- q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
- new Rectangle (x + insets.left,
- y + insets.top,
- width, height)));
+ if (!isInRepaint)
+ q.postEvent (new PaintEvent (awtComponent, PaintEvent.PAINT,
+ new Rectangle (x + insets.left,
+ y + insets.top,
+ width, height)));
}
public int getState ()
diff --git a/gnu/java/awt/peer/gtk/GtkGenericPeer.java b/gnu/java/awt/peer/gtk/GtkGenericPeer.java
index f7a7b2270..657e830bf 100644
--- a/gnu/java/awt/peer/gtk/GtkGenericPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkGenericPeer.java
@@ -82,4 +82,6 @@ public class GtkGenericPeer
// Let's assume this will never wrap.
return next_native_state++;
}
+
+ native void gtkWidgetModifyFont (String name, int style, int size);
}
diff --git a/gnu/java/awt/peer/gtk/GtkImagePainter.java b/gnu/java/awt/peer/gtk/GtkImagePainter.java
index d15cb4a4a..107c236c0 100644
--- a/gnu/java/awt/peer/gtk/GtkImagePainter.java
+++ b/gnu/java/awt/peer/gtk/GtkImagePainter.java
@@ -75,7 +75,7 @@ public class GtkImagePainter implements Runnable, ImageConsumer
s_width = s_height = 0;
clip = null;
- new Thread (this).start ();
+ run ();
}
public
@@ -105,7 +105,7 @@ public class GtkImagePainter implements Runnable, ImageConsumer
s_height = Math.abs (sy2 - sy1);
clip = new Rectangle (sx1, sy1, s_width, s_height);
- new Thread (this).start ();
+ run ();
}
public void
diff --git a/gnu/java/awt/peer/gtk/GtkLabelPeer.java b/gnu/java/awt/peer/gtk/GtkLabelPeer.java
index c28b7f597..b500a9910 100644
--- a/gnu/java/awt/peer/gtk/GtkLabelPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkLabelPeer.java
@@ -47,7 +47,7 @@ public class GtkLabelPeer extends GtkComponentPeer
implements LabelPeer
{
native void create (String text, float alignment);
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void nativeSetAlignment (float alignment);
native public void setText (String text);
diff --git a/gnu/java/awt/peer/gtk/GtkListPeer.java b/gnu/java/awt/peer/gtk/GtkListPeer.java
index a85aba952..6447d3e37 100644
--- a/gnu/java/awt/peer/gtk/GtkListPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkListPeer.java
@@ -60,7 +60,7 @@ public class GtkListPeer extends GtkComponentPeer
native void create (int rows);
native void connectJObject ();
native void connectSignals ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkWidgetRequestFocus ();
native void getSize (int rows, int visibleRows, int dims[]);
diff --git a/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java b/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
index 404628180..90ad0c01b 100644
--- a/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkMenuBarPeer.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import java.awt.Font;
import java.awt.Menu;
import java.awt.MenuBar;
+import java.awt.MenuComponent;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuPeer;
@@ -53,18 +55,25 @@ public class GtkMenuBarPeer extends GtkMenuComponentPeer
public GtkMenuBarPeer (MenuBar target)
{
super (target);
- create ();
}
- /* In Gnome, help menus are no longer right flushed. */
- public void addHelpMenu (Menu menu)
+ void setFont ()
{
- addMenu (menu);
+ MenuComponent mc = (MenuComponent) awtWidget;
+ Font f = mc.getFont ();
+
+ if (f == null)
+ mc.setFont (new Font ("Dialog", Font.PLAIN, 12));
}
- public void addMenu (Menu menu)
+ // FIXME: remove this method or replace it with one that does
+ // something useful.
+ /* In Gnome, help menus are no longer right flushed. */
+ native void nativeSetHelpMenu(MenuPeer menuPeer);
+
+ public void addHelpMenu (Menu menu)
{
- addMenu ((MenuPeer) menu.getPeer ());
+ // nativeSetHelpMenu((MenuPeer) menu.getPeer());
}
native public void delMenu (int index);
diff --git a/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java b/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
index 92f022306..dd061ed37 100644
--- a/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkMenuComponentPeer.java
@@ -38,15 +38,28 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import java.awt.Font;
+import java.awt.MenuComponent;
import java.awt.peer.MenuComponentPeer;
public class GtkMenuComponentPeer extends GtkGenericPeer
implements MenuComponentPeer
{
+ void create ()
+ {
+ throw new RuntimeException ();
+ }
+
+ void setFont ()
+ {
+ }
+
public GtkMenuComponentPeer (Object awtWidget)
{
super (awtWidget);
+ create ();
+ setFont ();
}
-
+
public native void dispose();
}
diff --git a/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java b/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
index 55581d1c6..d58916614 100644
--- a/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkMenuItemPeer.java
@@ -38,9 +38,11 @@ exception statement from your version. */
package gnu.java.awt.peer.gtk;
+import java.awt.Font;
import java.awt.Menu;
import java.awt.MenuBar;
import java.awt.MenuItem;
+import java.awt.MenuComponent;
import java.awt.peer.MenuItemPeer;
import java.awt.peer.MenuComponentPeer;
import java.awt.peer.MenuBarPeer;
@@ -50,12 +52,17 @@ public class GtkMenuItemPeer extends GtkMenuComponentPeer
implements MenuItemPeer
{
native void create (String label);
- public native void connectSignals ();
+ native void connectSignals ();
+ native void gtkWidgetModifyFont (String name, int style, int size);
+
+ void create ()
+ {
+ create (((MenuItem) awtWidget).getLabel());
+ }
public GtkMenuItemPeer (MenuItem item)
{
super (item);
- create (item.getLabel ());
setEnabled (item.isEnabled ());
setParent (item);
@@ -63,6 +70,21 @@ public class GtkMenuItemPeer extends GtkMenuComponentPeer
connectSignals();
}
+ void setFont ()
+ {
+ MenuComponent mc = ((MenuComponent) awtWidget);
+ Font f = mc.getFont ();
+
+ if (f == null)
+ {
+ MenuComponent parent = (MenuComponent) mc.getParent ();
+ Font pf = parent.getFont ();
+ gtkWidgetModifyFont (pf.getName (), pf.getStyle (), pf.getSize ());
+ }
+ else
+ gtkWidgetModifyFont(f.getName(), f.getStyle(), f.getSize());
+ }
+
void setParent (MenuItem item)
{
// add ourself differently, based on what type of parent we have
@@ -89,10 +111,8 @@ public class GtkMenuItemPeer extends GtkMenuComponentPeer
setEnabled (true);
}
- public void setEnabled (boolean b)
- {
- // do nothing, for now.
- }
+ native public void setEnabled (boolean b);
+
native public void setLabel (String label);
protected void postMenuActionEvent ()
diff --git a/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java b/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
index b08728b2b..651118d84 100644
--- a/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkTextAreaPeer.java
@@ -52,7 +52,7 @@ public class GtkTextAreaPeer extends GtkTextComponentPeer
native void create (int width, int height, int scrollbarVisibility);
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
native void gtkWidgetRequestFocus ();
void create ()
diff --git a/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java b/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
index d4a702deb..73d92cbaa 100644
--- a/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
+++ b/gnu/java/awt/peer/gtk/GtkTextFieldPeer.java
@@ -84,7 +84,7 @@ public class GtkTextFieldPeer extends GtkTextComponentPeer
native int gtkEntryGetBorderWidth ();
- native void gtkSetFont (String name, int style, int size);
+ native void gtkWidgetModifyFont (String name, int style, int size);
public GtkTextFieldPeer (TextField tf)
{
diff --git a/gnu/java/io/EncodingManager.java b/gnu/java/io/EncodingManager.java
index b55138b47..0c56d3b7a 100644
--- a/gnu/java/io/EncodingManager.java
+++ b/gnu/java/io/EncodingManager.java
@@ -1,5 +1,5 @@
/* EncodingManager.java -- Manages character encoding translators
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -42,13 +42,12 @@ import java.lang.reflect.Constructor;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
+import java.security.AccessController;
import java.util.Hashtable;
import java.util.StringTokenizer;
import gnu.java.io.decode.Decoder;
import gnu.java.io.encode.Encoder;
-
-
-import java.io.FileOutputStream;
+import gnu.java.security.action.GetPropertyAction;
/**
* This class is used to create new instances of Decoders for a specified
@@ -101,75 +100,65 @@ private static Decoder default_decoder_instance;
private static Encoder default_encoder_instance;
/**
- * This is our hash table of previously loaded <code>Decoder</code> classes
- */
-private static Hashtable decoder_cons;
-
-/**
* This is hash table of cached instances of <code>Decoder</code> objects
*/
private static Hashtable decoder_instances;
/**
- * This is our hash table of previously loaded <code>Encoder</code> classes
- */
-private static Hashtable encoder_cons;
-
-/**
* This is hash table of cached instances of <code>Encoder</code> objects
*/
private static Hashtable encoder_instances;
+/**
+ * Helper method to get system properties in the proper security context.
+ */
+private static String getSystemProperty(String propName, String defaultValue)
+{
+ GetPropertyAction getProp = new GetPropertyAction(propName, defaultValue);
+ return (String)AccessController.doPrivileged(getProp);
+}
static
{
// Initialize hashtables
- decoder_cons = new Hashtable();
- encoder_cons = new Hashtable();
decoder_instances = new Hashtable();
encoder_instances = new Hashtable();
// Find the system default decoder search path
- encoding_path = System.getProperty("file.encoding.pkg");
+ encoding_path = getSystemProperty("file.encoding.pkg", null);
if (encoding_path == null)
encoding_path = "gnu.java.io";
else
encoding_path = encoding_path + ":gnu.java.io";
// Find the system default encoding name
- String default_encoding = System.getProperty("file.encoding","8859_1");
+ String default_encoding = getSystemProperty("file.encoding", "8859_1");
// Load the class
try
{
// First the Decoder side
- default_decoder_cons = findDecoderConstructor(default_encoding, true);
+ default_decoder_cons = findDecoderConstructor(default_encoding);
- Object[] objs = new Object[1];
- objs[0] = null;
+ Object[] objs = new Object[] { null };
default_decoder_instance =
(Decoder)default_decoder_cons.newInstance(objs);
// Now the Encoder side
- default_encoder_cons = findEncoderConstructor(default_encoding, true);
-
- objs = new Object[1];
- objs[0] = null;
+ default_encoder_cons = findEncoderConstructor(default_encoding);
default_encoder_instance =
(Encoder)default_encoder_cons.newInstance(objs);
// Add items to the hashtable;
- decoder_cons.put(default_encoding, default_decoder_cons);
- encoder_cons.put(default_encoding, default_encoder_cons);
decoder_instances.put(default_encoding, default_decoder_instance);
encoder_instances.put(default_encoding, default_encoder_instance);
}
catch(Exception e)
{
- throw new Error("Cannot load system default encoding '" +
- default_encoding + "': " + e.getMessage());
+ throw new Error("Cannot load system default encoding: " +
+ default_encoding, e);
}
}
@@ -185,15 +174,12 @@ static
*
* @exception UnsupportedEncodingException If a <code>Decoder</code> for this encoding cannot be found.
*/
-private static Constructor
-findDecoderConstructor(String encoding, boolean cache)
- throws UnsupportedEncodingException
+private static Constructor findDecoderConstructor(String encoding)
+ throws UnsupportedEncodingException
{
// First check for an aliased encoding name
- String alias = System.getProperty("gnu.java.io.encoding_scheme_alias." +
- encoding);
- if (alias != null)
- encoding = alias;
+ encoding = getSystemProperty("gnu.java.io.encoding_scheme_alias." +
+ encoding, encoding);
StringTokenizer st = new StringTokenizer(encoding_path, ":");
@@ -203,16 +189,7 @@ findDecoderConstructor(String encoding, boolean cache)
try
{
Class cls = Class.forName(classname);
-
- Class[] params = new Class[1];
- params[0] = InputStream.class;
-
- Constructor cons = cls.getConstructor(params);
-
- if (cache)
- decoder_cons.put(encoding, cons);
-
- return(cons);
+ return cls.getConstructor(new Class[] { InputStream.class });
}
catch(Exception e) { ; }
}
@@ -228,15 +205,12 @@ findDecoderConstructor(String encoding, boolean cache)
*
* @exception UnsupportedEncodingException If a <code>Encoder</code> for this encoding cannot be found.
*/
-private static Constructor
-findEncoderConstructor(String encoding, boolean cache)
- throws UnsupportedEncodingException
+private static Constructor findEncoderConstructor(String encoding)
+ throws UnsupportedEncodingException
{
// First check for an aliased encoding name
- String alias = System.getProperty("gnu.java.io.encoding_scheme_alias." +
- encoding);
- if (alias != null)
- encoding = alias;
+ encoding = getSystemProperty("gnu.java.io.encoding_scheme_alias." +
+ encoding, encoding);
StringTokenizer st = new StringTokenizer(encoding_path, ":");
@@ -246,16 +220,7 @@ findEncoderConstructor(String encoding, boolean cache)
try
{
Class cls = Class.forName(classname);
-
- Class[] params = new Class[1];
- params[0] = OutputStream.class;
-
- Constructor cons = cls.getConstructor(params);
-
- if (cache)
- encoder_cons.put(encoding, cons);
-
- return(cons);
+ return cls.getConstructor(new Class[] { OutputStream.class });
}
catch(Exception e) { ; }
}
@@ -273,10 +238,9 @@ findEncoderConstructor(String encoding, boolean cache)
*
* @return An instance of the default <code>Decoder</code>.
*/
-public static Decoder
-getDecoder()
+public static Decoder getDecoder()
{
- return(default_decoder_instance);
+ return default_decoder_instance;
}
/*************************************************************************/
@@ -299,40 +263,16 @@ getDecoder()
*
* @exception UnsupportedEncodingException If a <code>Decoder</code> for the named encoding cannot be found
*/
-public static Decoder
-getDecoder(String encoding) throws UnsupportedEncodingException
-{
- return(getDecoder(encoding, true));
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the default instance of the <code>Decoder</code>
- * for the named encoding. This must be used only for calling the static
- * byte array conversion methods. Calling any instance methods on this
- * object will result in a <code>NullPointerException</code>
- *
- * @param encoding The name of the encoding to retrieve a <code>Decoder</code> for.
- * @param cache <code>true</code> to cache this encoding, <code>false</code> otherwise
- *
- * @return An instance of the <code>Decoder</code> for the named encoding.
- *
- * @exception UnsupportedEncodingException If a <code>Decoder</code> for the named encoding cannot be found
- */
-public static Decoder
-getDecoder(String encoding, boolean cache) throws UnsupportedEncodingException
+public static Decoder getDecoder(String encoding)
+ throws UnsupportedEncodingException
{
Decoder dec = (Decoder)decoder_instances.get(encoding);
if (dec != null)
- return(dec);
+ return dec;
- dec = getDecoder(null, encoding, cache);
-
- if (cache)
- decoder_instances.put(encoding, dec);
-
- return(dec);
+ dec = getDecoder(null, encoding);
+ decoder_instances.put(encoding, dec);
+ return dec;
}
/*************************************************************************/
@@ -344,23 +284,17 @@ getDecoder(String encoding, boolean cache) throws UnsupportedEncodingException
*
* @param in The <code>InputStream</code> to read from
*/
-public static Decoder
-getDecoder(InputStream in)
+public static Decoder getDecoder(InputStream in)
{
- Object[] params = new Object[1];
- params[0] = in;
-
- Decoder dec = null;
try
{
- dec = (Decoder)default_decoder_cons.newInstance(params);
+ Object[] params = new Object[] { in };
+ return (Decoder)default_decoder_cons.newInstance(params);
}
catch(Exception e)
{
- throw new Error("Unexpected problems with default decoder");
+ throw new Error("Unexpected problems with default decoder", e);
}
-
- return(dec);
}
/*************************************************************************/
@@ -380,43 +314,20 @@ getDecoder(InputStream in)
*
* @exception UnsupportedEncodingException If a <code>Decoder</code> for this encoding cannot be found
*/
-public static Decoder
-getDecoder(InputStream in, String encoding) throws UnsupportedEncodingException
-{
- return(getDecoder(in, encoding, true));
-}
-
-/*************************************************************************/
-
-/**
- * This method returns a <code>Decoder</code> object that can read from
- * the specified <code>InputStream</code> using the named encoding
- *
- * @param in The <code>InputStream</code> to read from
- * @param encoding The name of the character encoding scheme to use
- * @param cache <code>true</code> to cache the returned <code>Decoder</code>, <code>false</code> otherwise.
- *
- * @exception UnsupportedEncodingException If a <code>Decoder</code> for this encoding cannot be found
- */
-public static Decoder
-getDecoder(InputStream in, String encoding, boolean cache)
- throws UnsupportedEncodingException
+public static Decoder getDecoder(InputStream in, String encoding)
+ throws UnsupportedEncodingException
{
- Constructor cons = findDecoderConstructor(encoding, cache);
- Object[] params = new Object[1];
- params[0] = in;
+ Constructor cons = findDecoderConstructor(encoding);
- Decoder dec = null;
try
{
- dec = (Decoder)cons.newInstance(params);
+ return (Decoder)cons.newInstance(new Object[] { in });
}
catch(Exception e)
{
- throw new UnsupportedEncodingException(encoding + ": " + e.getMessage());
+ throw (UnsupportedEncodingException)
+ new UnsupportedEncodingException(encoding).initCause(e);
}
-
- return(dec);
}
/*************************************************************************/
@@ -429,10 +340,9 @@ getDecoder(InputStream in, String encoding, boolean cache)
*
* @return An instance of the default <code>Encoder</code>.
*/
-public static Encoder
-getEncoder()
+public static Encoder getEncoder()
{
- return(default_encoder_instance);
+ return default_encoder_instance;
}
/*************************************************************************/
@@ -455,40 +365,16 @@ getEncoder()
*
* @exception UnsupportedEncodingException If a <code>Encoder</code> for the named encoding cannot be found
*/
-public static Encoder
-getEncoder(String encoding) throws UnsupportedEncodingException
-{
- return(getEncoder(encoding, true));
-}
-
-/*************************************************************************/
-
-/**
- * This method returns the default instance of the <code>Encoder</code>
- * for the named encoding. This must be used only for calling the static
- * byte array conversion methods. Calling any instance methods on this
- * object will result in a <code>NullPointerException</code>
- *
- * @param encoding The name of the encoding to retrieve a <code>Encoder</code> for.
- * @param cache <code>true</code> to cache this encoding, <code>false</code> otherwise
- *
- * @return An instance of the <code>Encoder</code> for the named encoding.
- *
- * @exception UnsupportedEncodingException If a <code>Encoder</code> for the named encoding cannot be found
- */
-public static Encoder
-getEncoder(String encoding, boolean cache) throws UnsupportedEncodingException
+public static Encoder getEncoder(String encoding)
+ throws UnsupportedEncodingException
{
Encoder enc = (Encoder)encoder_instances.get(encoding);
if (enc != null)
- return(enc);
+ return enc;
- enc = getEncoder(null, encoding, cache);
-
- if (cache)
- encoder_instances.put(encoding, enc);
-
- return(enc);
+ enc = getEncoder(null, encoding);
+ encoder_instances.put(encoding, enc);
+ return enc;
}
/*************************************************************************/
@@ -500,23 +386,17 @@ getEncoder(String encoding, boolean cache) throws UnsupportedEncodingException
*
* @param out The <code>OutputStream</code> to read from
*/
-public static Encoder
-getEncoder(OutputStream out)
+public static Encoder getEncoder(OutputStream out)
{
- Object[] params = new Object[1];
- params[0] = out;
-
- Encoder enc = null;
try
{
- enc = (Encoder)default_encoder_cons.newInstance(params);
+ Object[] params = new Object[] { out };
+ return (Encoder)default_encoder_cons.newInstance(params);
}
catch(Exception e)
{
- throw new Error("Unexpected problems with default decoder");
+ throw new Error("Unexpected problems with default decoder", e);
}
-
- return(enc);
}
/*************************************************************************/
@@ -536,44 +416,20 @@ getEncoder(OutputStream out)
*
* @exception UnsupportedEncodingException If an <code>Encoder</code> for this encoding cannot be found
*/
-public static Encoder
-getEncoder(OutputStream in, String encoding) throws UnsupportedEncodingException
+public static Encoder getEncoder(OutputStream out, String encoding)
+ throws UnsupportedEncodingException
{
- return(getEncoder(in, encoding, true));
-}
-
-/*************************************************************************/
+ Constructor cons = findEncoderConstructor(encoding);
-/**
- * This method returns an <code>Encoder</code> object that can write to
- * the specified <code>OutputStream</code> using the named encoding
- *
- * @param in The <code>OutputStream</code> to read from
- * @param encoding The name of the character encoding scheme to use
- * @param cache <code>true</code> to cache the returned <code>Encoder</code>, <code>false</code> otherwise.
- *
- * @exception UnsupportedEncodingException If a <code>Decoder</code> for this encoding cannot be found
- */
-public static Encoder
-getEncoder(OutputStream out, String encoding, boolean cache)
- throws UnsupportedEncodingException
-{
- Constructor cons = findEncoderConstructor(encoding, cache);
- Object[] params = new Object[1];
- params[0] = out;
-
- Encoder enc = null;
try
{
- enc = (Encoder)cons.newInstance(params);
+ return (Encoder)cons.newInstance(new Object[] { out });
}
catch(Exception e)
{
- throw new UnsupportedEncodingException(encoding + ": " + e.getMessage());
+ throw (UnsupportedEncodingException)
+ new UnsupportedEncodingException(encoding).initCause(e);
}
-
- return(enc);
}
} // class EncodingManager
-
diff --git a/gnu/java/net/protocol/file/Connection.java b/gnu/java/net/protocol/file/Connection.java
index 0dc223cf0..2754717bb 100644
--- a/gnu/java/net/protocol/file/Connection.java
+++ b/gnu/java/net/protocol/file/Connection.java
@@ -37,8 +37,11 @@ exception statement from your version. */
package gnu.java.net.protocol.file;
+import gnu.java.security.action.GetPropertyAction;
+
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -50,10 +53,10 @@ import java.net.ProtocolException;
import java.net.URL;
import java.net.URLConnection;
import java.security.Permission;
-import java.util.AbstractSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.NoSuchElementException;
+import java.security.AccessController;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.Locale;
/**
* This subclass of java.net.URLConnection models a URLConnection via
@@ -71,6 +74,15 @@ public class Connection extends URLConnection
private static final String DEFAULT_PERMISSION = "read";
/**
+ * HTTP-style DateFormat, used to format the last-modified header.
+ */
+ private static SimpleDateFormat dateFormat
+ = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss 'GMT'",
+ new Locale ("En", "Us", "Unix"));
+
+ private static String lineSeparator;
+
+ /**
* This is a File object for this connection
*/
private File file;
@@ -111,11 +123,38 @@ public class Connection extends URLConnection
// If not connected, then file needs to be openned.
file = new File (getURL().getFile());
- if (doInput)
- inputStream = new BufferedInputStream(new FileInputStream(file));
+
+ if (! file.isDirectory())
+ {
+ if (doInput)
+ inputStream = new BufferedInputStream(new FileInputStream(file));
- if (doOutput)
- outputStream = new BufferedOutputStream(new FileOutputStream(file));
+ if (doOutput)
+ outputStream = new BufferedOutputStream(new FileOutputStream(file));
+ }
+ else
+ {
+ if (doInput)
+ {
+ if (lineSeparator == null)
+ {
+ GetPropertyAction getProperty = new GetPropertyAction("line.separator");
+ lineSeparator = (String) AccessController.doPrivileged(getProperty);
+ }
+
+ StringBuffer sb = new StringBuffer();
+ String[] files = file.list();
+
+ for (int index = 0; index < files.length; ++index)
+ sb.append(files[index]).append(lineSeparator);
+
+ inputStream = new ByteArrayInputStream(sb.toString().getBytes());
+ }
+
+ if (doOutput)
+ throw new ProtocolException
+ ("file: protocol does not support output on directories");
+ }
connected = true;
}
@@ -178,6 +217,35 @@ public class Connection extends URLConnection
return -1;
}
}
+
+ /**
+ * Get an http-style header field. Just handle a few common ones.
+ */
+ public String getHeaderField(String field)
+ {
+ try
+ {
+ if (!connected)
+ connect();
+
+ if (field.equals("content-type"))
+ return guessContentTypeFromName(file.getName());
+ else if (field.equals("content-length"))
+ return Long.toString(file.length());
+ else if (field.equals("last-modified"))
+ {
+ synchronized (dateFormat)
+ {
+ return dateFormat.format(new Date(file.lastModified()));
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // Fall through.
+ }
+ return null;
+ }
/**
* Get the length of content.
@@ -211,105 +279,4 @@ public class Connection extends URLConnection
{
return permission;
}
-
- /**
- * Does the resource pointed to actually exist?
- */
- public final boolean exists()
- {
- if (file == null)
- return false;
-
- return file.exists();
- }
-
- /**
- * Is the resource pointed to a directory?
- */
- public final boolean isDirectory()
- {
- return file.isDirectory();
- }
-
- /**
- * Get a listing of the directory, if it is a directory.
- *
- * @return a set which can supply an iteration of the
- * contents of the directory.
- *
- * @throws IllegalStateException if this is not pointing
- * to a directory.
- */
- public Set getListing()
- {
- if (!file.isDirectory())
- throw new IllegalStateException ("this is not a directory");
-
- final File[] directoryList = file.listFiles();
- return new AbstractSet()
- {
- File[] dirList = directoryList;
-
- public int size()
- {
- return dirList.length;
- }
-
- public Iterator iterator()
- {
- return new Iterator()
- {
- int index = 0;
-
- public boolean hasNext()
- {
- return index < dirList.length;
- }
-
- public Object next()
- {
- try
- {
- String value = dirList [index++].getName();
- return value;
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- throw new NoSuchElementException ("no more content");
- }
- }
-
- public void remove()
- {
- try
- {
- File[] newDirList = new File [dirList.length - 1];
- int realIndex = index - 1;
-
- if (realIndex < 1)
- {
- System.arraycopy (dirList, 1, newDirList, 0,
- dirList.length - 1);
- index--;
- }
- else
- {
- System.arraycopy (dirList, 0, newDirList, 0, realIndex);
-
- if (index < dirList.length - 1)
- System.arraycopy (dirList, index,
- newDirList, realIndex,
- dirList.length - realIndex);
- }
- dirList = newDirList;
- }
- catch (ArrayIndexOutOfBoundsException e)
- {
- throw new NoSuchElementException("no more content");
- }
- }
- };
- }
- };
- }
}
diff --git a/gnu/java/net/protocol/file/Handler.java b/gnu/java/net/protocol/file/Handler.java
index 06ab3922b..18f91720e 100644
--- a/gnu/java/net/protocol/file/Handler.java
+++ b/gnu/java/net/protocol/file/Handler.java
@@ -79,9 +79,8 @@ public class Handler extends URLStreamHandler
// Reset the protocol (and implicitly the handler) for this URL.
// Then have the URL attempt the connection again, as it will
// get the changed handler the next time around.
- // N.B.: FTP protocol is not supported by default in GNU Classpath
- // but it does not matter because setURL will keep the current protocol
- // if "ftp" is not available.
+ // If the ftp protocol handler is not installed, an
+ // exception will be thrown from the new openConnection() call.
setURL (url, "ftp", url.getHost(), url.getPort(), url.getFile(),
url.getRef());
return url.openConnection();
diff --git a/gnu/java/rmi/server/UnicastServer.java b/gnu/java/rmi/server/UnicastServer.java
index ace43f018..423095404 100644
--- a/gnu/java/rmi/server/UnicastServer.java
+++ b/gnu/java/rmi/server/UnicastServer.java
@@ -46,6 +46,7 @@ import java.net.InetAddress;
import java.util.Hashtable;
import java.net.UnknownHostException;
import java.rmi.Remote;
+import java.rmi.ServerError;
import java.rmi.server.ObjID;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.UID;
@@ -136,6 +137,10 @@ private static void incomingMessageCall(UnicastConnection conn) throws IOExcepti
returnval = e;
returncode = RETURN_NACK;
}
+ catch (Error e) {
+ returnval = new ServerError ("An Error is thrown while processing the invocation on the server", e);
+ returncode = RETURN_NACK;
+ }
}
else {
returnval = new NoSuchObjectException("");
diff --git a/gnu/java/rmi/server/UnicastServerRef.java b/gnu/java/rmi/server/UnicastServerRef.java
index 3e9529c59..1c5823a70 100644
--- a/gnu/java/rmi/server/UnicastServerRef.java
+++ b/gnu/java/rmi/server/UnicastServerRef.java
@@ -284,7 +284,16 @@ public Object incomingMessageCall(UnicastConnection conn, int method, long hash)
try{
ret = meth.invoke(myself, args);
}catch(InvocationTargetException e){
- throw (Exception)(e.getTargetException());
+ Throwable cause = e.getTargetException();
+ if (cause instanceof Exception) {
+ throw (Exception)cause;
+ }
+ else if (cause instanceof Error) {
+ throw (Error)cause;
+ }
+ else {
+ throw new Error("The remote method threw a java.lang.Throwable that is neither java.lang.Exception nor java.lang.Error.", e);
+ }
}
return ret;
}
diff --git a/gnu/regexp/RE.java b/gnu/regexp/RE.java
index fdc00feb3..d782975e9 100644
--- a/gnu/regexp/RE.java
+++ b/gnu/regexp/RE.java
@@ -492,8 +492,25 @@ public class RE extends REToken {
else if ((unit.ch == '(') && (syntax.get(RESyntax.RE_NO_BK_PARENS) ^ unit.bk)) {
boolean pure = false;
boolean comment = false;
+ boolean lookAhead = false;
+ boolean negativelh = false;
if ((index+1 < pLength) && (pattern[index] == '?')) {
switch (pattern[index+1]) {
+ case '!':
+ if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
+ pure = true;
+ negativelh = true;
+ lookAhead = true;
+ index += 2;
+ }
+ break;
+ case '=':
+ if (syntax.get(RESyntax.RE_LOOKAHEAD)) {
+ pure = true;
+ lookAhead = true;
+ index += 2;
+ }
+ break;
case ':':
if (syntax.get(RESyntax.RE_PURE_GROUPING)) {
pure = true;
@@ -539,10 +556,14 @@ public class RE extends REToken {
numSubs++;
}
- int useIndex = (pure) ? 0 : nextSub + numSubs;
+ int useIndex = (pure || lookAhead) ? 0 : nextSub + numSubs;
currentToken = new RE(String.valueOf(pattern,index,endIndex-index).toCharArray(),cflags,syntax,useIndex,nextSub + numSubs);
numSubs += ((RE) currentToken).getNumSubs();
+ if (lookAhead) {
+ currentToken = new RETokenLookAhead(currentToken,negativelh);
+ }
+
index = nextIndex;
} // not a comment
} // subexpression
diff --git a/gnu/regexp/RETokenLookAhead.java b/gnu/regexp/RETokenLookAhead.java
new file mode 100644
index 000000000..650bb351b
--- /dev/null
+++ b/gnu/regexp/RETokenLookAhead.java
@@ -0,0 +1,87 @@
+/* gnu/regexp/RETokenLookAhead.java
+ Copyright (C) 1998-2001, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package gnu.regexp;
+
+/**
+ * @since gnu.regexp 1.1.3
+ * @author Shashank Bapat
+ */
+final class RETokenLookAhead extends REToken
+{
+ REToken re;
+ boolean negative;
+
+ RETokenLookAhead(REToken re, boolean negative) throws REException {
+ super(0);
+ this.re = re;
+ this.negative = negative;
+ }
+
+ boolean match(CharIndexed input, REMatch mymatch)
+ {
+ REMatch trymatch = (REMatch)mymatch.clone();
+ REMatch trymatch1 = (REMatch)mymatch.clone();
+ REMatch newMatch = null;
+ if (re.match(input, trymatch)) {
+ if (negative) return false;
+ if (next(input, trymatch1))
+ newMatch = trymatch1;
+ }
+
+ if (newMatch != null) {
+ if (negative) return false;
+ //else
+ mymatch.assignFrom(newMatch);
+ return true;
+ }
+ else { // no match
+ if (negative)
+ return next(input, mymatch);
+ //else
+ return false;
+ }
+ }
+
+ void dump(StringBuffer os) {
+ os.append("(?");
+ os.append(negative ? '!' : '=');
+ re.dumpAll(os);
+ os.append(')');
+ }
+}
+
diff --git a/include/Makefile.am b/include/Makefile.am
index 5a6b5a88d..942756ff2 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -64,7 +64,7 @@ $(top_srcdir)/include/java_net_NetworkInterface.h \
$(top_srcdir)/include/java_nio_DirectByteBufferImpl.h \
$(top_srcdir)/include/java_nio_MappedByteBufferImpl.h \
$(top_srcdir)/include/java_nio_channels_Channels.h \
-$(top_srcdir)/include/java_util_TimeZone.h
+$(top_srcdir)/include/java_util_VMTimeZone.h
if CREATE_JNI_HEADERS
@@ -188,7 +188,7 @@ $(top_srcdir)/include/java_nio_channels_Channels.h: $(top_srcdir)/java/nio/chann
$(JAVAH) -o $@ java.nio.channels.Channels
$(top_srcdir)/include/gnu_java_nio_channels_FileChannelImpl.h: $(top_srcdir)/gnu/java/nio/channels/FileChannelImpl.java
$(JAVAH) -o $@ gnu.java.nio.channels.FileChannelImpl
-$(top_srcdir)/include/java_util_TimeZone.h: $(top_srcdir)/java/util/TimeZone.java
- $(JAVAH) -o $@ java.util.TimeZone
+$(top_srcdir)/include/java_util_VMTimeZone.h: $(top_srcdir)/vm/reference/java/util/VMTimeZone.java
+ $(JAVAH) -o $@ java.util.VMTimeZone
endif # CREATE_JNI_HEADERS
diff --git a/include/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h b/include/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h
new file mode 100644
index 000000000..b7c10e864
--- /dev/null
+++ b/include/gnu_java_awt_peer_gtk_GdkClasspathFontPeer.h
@@ -0,0 +1,22 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_java_awt_peer_gtk_GdkClasspathFontPeer__
+#define __gnu_java_awt_peer_gtk_GdkClasspathFontPeer__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_initStaticState (JNIEnv *env, jclass);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_initState (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_dispose (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeer_setFont (JNIEnv *env, jobject, jstring, jint, jint);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_java_awt_peer_gtk_GdkClasspathFontPeer__ */
diff --git a/include/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.h b/include/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.h
new file mode 100644
index 000000000..ab33c9dd3
--- /dev/null
+++ b/include/gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics.h
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics__
+#define __gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics_initState (JNIEnv *env, jobject, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_java_awt_peer_gtk_GdkClasspathFontPeerMetrics__ */
diff --git a/include/gnu_java_awt_peer_gtk_GdkGlyphVector.h b/include/gnu_java_awt_peer_gtk_GdkGlyphVector.h
new file mode 100644
index 000000000..0e6d033e9
--- /dev/null
+++ b/include/gnu_java_awt_peer_gtk_GdkGlyphVector.h
@@ -0,0 +1,32 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_java_awt_peer_gtk_GdkGlyphVector__
+#define __gnu_java_awt_peer_gtk_GdkGlyphVector__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initStaticState (JNIEnv *env, jclass);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_initState (JNIEnv *env, jobject, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars (JNIEnv *env, jobject, jstring);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setGlyphCodes (JNIEnv *env, jobject, jintArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_dispose (JNIEnv *env, jobject);
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCode (JNIEnv *env, jobject, jint);
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_numGlyphs (JNIEnv *env, jobject);
+JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphCharIndex (JNIEnv *env, jobject, jint);
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allLogicalExtents (JNIEnv *env, jobject);
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkExtents (JNIEnv *env, jobject);
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphLogicalExtents (JNIEnv *env, jobject, jint);
+JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphInkExtents (JNIEnv *env, jobject, jint);
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_glyphIsHorizontal (JNIEnv *env, jobject, jint);
+JNIEXPORT jboolean JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_isEqual (JNIEnv *env, jobject, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_java_awt_peer_gtk_GdkGlyphVector__ */
diff --git a/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h b/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
new file mode 100644
index 000000000..7365bb4ca
--- /dev/null
+++ b/include/gnu_java_awt_peer_gtk_GdkGraphics2D.h
@@ -0,0 +1,55 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __gnu_java_awt_peer_gtk_GdkGraphics2D__
+#define __gnu_java_awt_peer_gtk_GdkGraphics2D__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initStaticState (JNIEnv *env, jclass);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__Lgnu_java_awt_peer_gtk_GtkComponentPeer_2 (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_initState__II (JNIEnv *env, jobject, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_copyState (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_dispose (JNIEnv *env, jobject);
+JNIEXPORT jintArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_getImagePixels (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSurfaceSetFilter (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_gdkDrawDrawable (JNIEnv *env, jobject, jobject, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_drawPixels (JNIEnv *env, jobject, jintArray, jint, jint, jint, jdoubleArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setTexturePixels (JNIEnv *env, jobject, jintArray, jint, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_setGradient (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jint, jint, jint, jint, jint, jint, jint, jint, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSave (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRestore (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMatrix (JNIEnv *env, jobject, jdoubleArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFont (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoShowGlyphs (JNIEnv *env, jobject, jintArray, jfloatArray);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetOperator (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetRGBColor (JNIEnv *env, jobject, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetAlpha (JNIEnv *env, jobject, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetFillRule (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineWidth (JNIEnv *env, jobject, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineCap (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetLineJoin (JNIEnv *env, jobject, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetDash (JNIEnv *env, jobject, jdoubleArray, jint, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoSetMiterLimit (JNIEnv *env, jobject, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoNewPath (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoLineTo (JNIEnv *env, jobject, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoCurveTo (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelMoveTo (JNIEnv *env, jobject, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelLineTo (JNIEnv *env, jobject, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRelCurveTo (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoRectangle (JNIEnv *env, jobject, jdouble, jdouble, jdouble, jdouble);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClosePath (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoStroke (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoFill (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics2D_cairoClip (JNIEnv *env, jobject);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __gnu_java_awt_peer_gtk_GdkGraphics2D__ */
diff --git a/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h b/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h
index 90edbe28b..1a2240016 100644
--- a/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkButtonPeer.h
@@ -11,12 +11,12 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create (JNIEnv *env, jobject, jstring);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectJObject (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel (JNIEnv *env, jobject, jstring);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetSetForeground (JNIEnv *env, jobject, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkActivate (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetRequestFocus (JNIEnv *env, jobject);
#ifdef __cplusplus
}
diff --git a/include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h b/include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h
index 5156be30d..88a45f07c 100644
--- a/include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkCheckboxPeer.h
@@ -13,7 +13,7 @@ extern "C"
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_create (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_nativeSetCheckboxGroup (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_connectSignals (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkButtonSetLabel (JNIEnv *env, jobject, jstring);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkToggleButtonSetActive (JNIEnv *env, jobject, jboolean);
diff --git a/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h b/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
index d66a77035..cc351f3ff 100644
--- a/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkComponentPeer.h
@@ -25,10 +25,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetS
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetRequestFocus (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetDispatchKeyEvent (JNIEnv *env, jobject, jint, jlong, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueueDrawArea (JNIEnv *env, jobject, jint, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetRepaintArea (JNIEnv *env, jobject, jint, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectJObject (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBounds (JNIEnv *env, jobject, jint, jint, jint, jint);
diff --git a/include/gnu_java_awt_peer_gtk_GtkFramePeer.h b/include/gnu_java_awt_peer_gtk_GtkFramePeer.h
index c7c146142..27f8e83f3 100644
--- a/include/gnu_java_awt_peer_gtk_GtkFramePeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkFramePeer.h
@@ -11,10 +11,10 @@ extern "C"
#endif
JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth (JNIEnv *env, jobject, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout (JNIEnv *env, jobject, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkLayoutSetVisible (JNIEnv *env, jobject, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible (JNIEnv *env, jobject, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromData (JNIEnv *env, jobject, jintArray, jint, jint);
diff --git a/include/gnu_java_awt_peer_gtk_GtkGenericPeer.h b/include/gnu_java_awt_peer_gtk_GtkGenericPeer.h
index 78987399b..fd9b10687 100644
--- a/include/gnu_java_awt_peer_gtk_GtkGenericPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkGenericPeer.h
@@ -11,6 +11,7 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
#ifdef __cplusplus
}
diff --git a/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h b/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h
index b2da80a09..91e7417a4 100644
--- a/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkLabelPeer.h
@@ -11,7 +11,7 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create (JNIEnv *env, jobject, jstring, jfloat);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_nativeSetAlignment (JNIEnv *env, jobject, jfloat);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText (JNIEnv *env, jobject, jstring);
diff --git a/include/gnu_java_awt_peer_gtk_GtkListPeer.h b/include/gnu_java_awt_peer_gtk_GtkListPeer.h
index 0a3cae16d..61f442092 100644
--- a/include/gnu_java_awt_peer_gtk_GtkListPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkListPeer.h
@@ -13,7 +13,7 @@ extern "C"
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_create (JNIEnv *env, jobject, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_connectJObject (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetRequestFocus (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_getSize (JNIEnv *env, jobject, jint, jint, jintArray);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkListPeer_append (JNIEnv *env, jobject, jobjectArray);
diff --git a/include/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h b/include/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h
index 61a4641e6..6d855be66 100644
--- a/include/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkMenuBarPeer.h
@@ -12,6 +12,7 @@ extern "C"
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu (JNIEnv *env, jobject, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu (JNIEnv *env, jobject, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu (JNIEnv *env, jobject, jint);
#ifdef __cplusplus
diff --git a/include/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h b/include/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h
index 09940df85..e96544a3b 100644
--- a/include/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkMenuItemPeer.h
@@ -12,6 +12,8 @@ extern "C"
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create (JNIEnv *env, jobject, jstring);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals (JNIEnv *env, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled (JNIEnv *env, jobject, jboolean);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel (JNIEnv *env, jobject, jstring);
#ifdef __cplusplus
diff --git a/include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h b/include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h
index 1853bd0fa..46252bd81 100644
--- a/include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkTextAreaPeer.h
@@ -11,7 +11,7 @@ extern "C"
#endif
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_create (JNIEnv *env, jobject, jint, jint, jint);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetRequestFocus (JNIEnv *env, jobject);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_insert (JNIEnv *env, jobject, jstring, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange (JNIEnv *env, jobject, jstring, jint, jint);
diff --git a/include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h b/include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h
index 2dc24b81b..04499564d 100644
--- a/include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h
+++ b/include/gnu_java_awt_peer_gtk_GtkTextFieldPeer.h
@@ -14,7 +14,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_create (JNIEn
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetSetBackground (JNIEnv *env, jobject, jint, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetSetForeground (JNIEnv *env, jobject, jint, jint, jint);
JNIEXPORT jint JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkEntryGetBorderWidth (JNIEnv *env, jobject);
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkSetFont (JNIEnv *env, jobject, jstring, jint, jint);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetModifyFont (JNIEnv *env, jobject, jstring, jint, jint);
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar (JNIEnv *env, jobject, jchar);
#ifdef __cplusplus
diff --git a/include/java_util_TimeZone.h b/include/java_util_TimeZone.h
deleted file mode 100644
index 2854c6634..000000000
--- a/include/java_util_TimeZone.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-
-#ifndef __java_util_TimeZone__
-#define __java_util_TimeZone__
-
-#include <jni.h>
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
-JNIEXPORT jstring JNICALL Java_java_util_TimeZone_getDefaultTimeZoneId (JNIEnv *env, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __java_util_TimeZone__ */
diff --git a/include/java_util_VMTimeZone.h b/include/java_util_VMTimeZone.h
new file mode 100644
index 000000000..8431e67b4
--- /dev/null
+++ b/include/java_util_VMTimeZone.h
@@ -0,0 +1,19 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+
+#ifndef __java_util_VMTimeZone__
+#define __java_util_VMTimeZone__
+
+#include <jni.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+JNIEXPORT jstring JNICALL Java_java_util_VMTimeZone_getSystemTimeZoneId (JNIEnv *env, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __java_util_VMTimeZone__ */
diff --git a/java/applet/Applet.java b/java/applet/Applet.java
index 5990c6392..4fbf17c11 100644
--- a/java/applet/Applet.java
+++ b/java/applet/Applet.java
@@ -1,5 +1,5 @@
/* Applet.java -- Java base applet class
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -48,6 +48,7 @@ import java.io.ObjectInputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Locale;
+
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleState;
@@ -228,11 +229,11 @@ public class Applet extends Panel
{
try
{
- return getImage(new URL(url, name));
+ return getImage(new URL(url, name));
}
catch (MalformedURLException e)
{
- return null;
+ return null;
}
}
@@ -284,11 +285,11 @@ public class Applet extends Panel
{
try
{
- return getAudioClip(new URL(url, name));
+ return getAudioClip(new URL(url, name));
}
catch (MalformedURLException e)
{
- return null;
+ return null;
}
}
@@ -343,7 +344,7 @@ public class Applet extends Panel
AudioClip ac = getAudioClip(url);
try
{
- ac.play();
+ ac.play();
}
catch (Exception ignored)
{
@@ -364,7 +365,7 @@ public class Applet extends Panel
{
try
{
- getAudioClip(url, name).play();
+ getAudioClip(url, name).play();
}
catch (Exception ignored)
{
@@ -500,7 +501,7 @@ public class Applet extends Panel
{
AccessibleStateSet s = super.getAccessibleStateSet();
if (isActive())
- s.add(AccessibleState.ACTIVE);
+ s.add(AccessibleState.ACTIVE);
return s;
}
} // class AccessibleApplet
diff --git a/java/applet/AppletContext.java b/java/applet/AppletContext.java
index 7d44679fe..1e7053754 100644
--- a/java/applet/AppletContext.java
+++ b/java/applet/AppletContext.java
@@ -39,8 +39,8 @@ exception statement from your version. */
package java.applet;
import java.awt.Image;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
import java.util.Iterator;
diff --git a/java/applet/AppletStub.java b/java/applet/AppletStub.java
index 7694cc822..44722cc61 100644
--- a/java/applet/AppletStub.java
+++ b/java/applet/AppletStub.java
@@ -1,5 +1,5 @@
/* AppletStub.java -- low level interface to the browser
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.applet;
import java.net.URL;
diff --git a/java/applet/AudioClip.java b/java/applet/AudioClip.java
index 41dd3be2a..531ab1739 100644
--- a/java/applet/AudioClip.java
+++ b/java/applet/AudioClip.java
@@ -1,5 +1,5 @@
/* AudioClip.java -- play an audio clip in an applet
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,6 +38,7 @@ exception statement from your version. */
package java.applet;
+
/**
* This interface provides a simple mechanism for playing audio clips.
* If multiple clips are played at once, the browser combines them into a
diff --git a/java/awt/AWTEventMulticaster.java b/java/awt/AWTEventMulticaster.java
index 58950ef0b..b26d1f35d 100644
--- a/java/awt/AWTEventMulticaster.java
+++ b/java/awt/AWTEventMulticaster.java
@@ -181,7 +181,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentResized(ComponentEvent e)
{
@@ -193,7 +193,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentMoved(ComponentEvent e)
{
@@ -205,7 +205,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentShown(ComponentEvent e)
{
@@ -217,7 +217,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentHidden(ComponentEvent e)
{
@@ -229,7 +229,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentAdded(ContainerEvent e)
{
@@ -241,7 +241,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void componentRemoved(ContainerEvent e)
{
@@ -253,7 +253,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void focusGained(FocusEvent e)
{
@@ -265,7 +265,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void focusLost(FocusEvent e)
{
@@ -277,7 +277,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void keyTyped(KeyEvent e)
{
@@ -289,7 +289,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void keyPressed(KeyEvent e)
{
@@ -301,7 +301,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void keyReleased(KeyEvent e)
{
@@ -313,7 +313,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseClicked(MouseEvent e)
{
@@ -325,7 +325,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mousePressed(MouseEvent e)
{
@@ -337,7 +337,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseReleased(MouseEvent e)
{
@@ -349,7 +349,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseEntered(MouseEvent e)
{
@@ -361,7 +361,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseExited(MouseEvent e)
{
@@ -373,7 +373,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseDragged(MouseEvent e)
{
@@ -385,7 +385,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void mouseMoved(MouseEvent e)
{
@@ -397,7 +397,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowOpened(WindowEvent e)
{
@@ -409,7 +409,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowClosing(WindowEvent e)
{
@@ -421,7 +421,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowClosed(WindowEvent e)
{
@@ -433,7 +433,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowIconified(WindowEvent e)
{
@@ -445,7 +445,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowDeiconified(WindowEvent e)
{
@@ -457,7 +457,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowActivated(WindowEvent e)
{
@@ -469,7 +469,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void windowDeactivated(WindowEvent e)
{
@@ -481,7 +481,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void windowStateChanged(WindowEvent e)
@@ -494,7 +494,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void windowGainedFocus(WindowEvent e)
@@ -507,7 +507,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void windowLostFocus(WindowEvent e)
@@ -520,7 +520,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void actionPerformed(ActionEvent e)
{
@@ -532,7 +532,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void itemStateChanged(ItemEvent e)
{
@@ -544,7 +544,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void adjustmentValueChanged(AdjustmentEvent e)
{
@@ -556,7 +556,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
*/
public void textValueChanged(TextEvent e)
{
@@ -568,7 +568,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.2
*/
public void inputMethodTextChanged(InputMethodEvent e)
@@ -581,7 +581,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.2
*/
public void caretPositionChanged(InputMethodEvent e)
@@ -594,7 +594,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.3
*/
public void hierarchyChanged(HierarchyEvent e)
@@ -607,7 +607,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.3
*/
public void ancestorMoved(HierarchyEvent e)
@@ -620,7 +620,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.3
*/
public void ancestorResized(HierarchyEvent e)
@@ -633,7 +633,7 @@ public class AWTEventMulticaster
* Handles this event by dispatching it to the "a" and "b" listener
* instances.
*
- * @param event the event to handle
+ * @param e the event to handle
* @since 1.4
*/
public void mouseWheelMoved(MouseWheelEvent e)
diff --git a/java/awt/AWTKeyStroke.java b/java/awt/AWTKeyStroke.java
index 4e012972d..dc3a76e73 100644
--- a/java/awt/AWTKeyStroke.java
+++ b/java/awt/AWTKeyStroke.java
@@ -1,5 +1,5 @@
/* AWTKeyStroke.java -- an immutable key stroke
- Copyright (C) 2002, 2005 Free Software Foundation
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -48,9 +48,9 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-import java.util.Map;
import java.util.HashMap;
import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.StringTokenizer;
/**
diff --git a/java/awt/Adjustable.java b/java/awt/Adjustable.java
index 58116e4e5..815c77ca9 100644
--- a/java/awt/Adjustable.java
+++ b/java/awt/Adjustable.java
@@ -157,7 +157,7 @@ public interface Adjustable
* Adds a listener that will receive adjustment events for this object.
*
* @param listener the adjustment listener to add
- * @see AdjustmentEvent
+ * @see java.awt.event.AdjustmentEvent
*/
void addAdjustmentListener(AdjustmentListener listener);
@@ -165,7 +165,7 @@ public interface Adjustable
* Removes an adjustment listener from this object.
*
* @param listener the adjustment listener to remove
- * @see AdjustmentEvent
+ * @see java.awt.event.AdjustmentEvent
*/
void removeAdjustmentListener(AdjustmentListener listener);
} // interface Adjustable
diff --git a/java/awt/Canvas.java b/java/awt/Canvas.java
index a244b34dc..1bb48e4de 100644
--- a/java/awt/Canvas.java
+++ b/java/awt/Canvas.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* Canvas.java --
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -40,6 +41,7 @@ package java.awt;
import java.awt.image.BufferStrategy;
import java.awt.peer.ComponentPeer;
import java.io.Serializable;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -136,6 +138,10 @@ public class Canvas
protected class AccessibleAWTCanvas
extends AccessibleAWTComponent
{
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = -6325592262103146699L;
/**
* Constructor for the accessible canvas.
diff --git a/java/awt/CardLayout.java b/java/awt/CardLayout.java
index fa4f4ec0f..6e17daab1 100644
--- a/java/awt/CardLayout.java
+++ b/java/awt/CardLayout.java
@@ -1,6 +1,5 @@
-// CardLayout.java - Card-based layout engine
-
-/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
+/* CardLayout.java -- Card-based layout engine
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -39,9 +38,9 @@ exception statement from your version. */
package java.awt;
+import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
-import java.io.Serializable;
/** This class implements a card-based layout scheme. Each included
* component is treated as a card. Only one card can be shown at a
diff --git a/java/awt/CheckboxMenuItem.java b/java/awt/CheckboxMenuItem.java
index c7df075b3..0630c302b 100644
--- a/java/awt/CheckboxMenuItem.java
+++ b/java/awt/CheckboxMenuItem.java
@@ -1,5 +1,5 @@
/* CheckboxMenuItem.java -- A menu option with a checkbox on it.
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,7 +41,6 @@ package java.awt;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.peer.CheckboxMenuItemPeer;
-import java.awt.peer.MenuItemPeer;
import java.util.EventListener;
/**
@@ -198,12 +197,9 @@ getSelectedObjects()
public synchronized void
addNotify()
{
- if (peer != null)
- {
- // This choice of toolkit seems unsatisfying, but I'm not sure
- // what else to do.
- peer = getToolkit().createCheckboxMenuItem(this);
- }
+ if (peer == null)
+ peer = getToolkit().createCheckboxMenuItem(this);
+
super.addNotify ();
}
diff --git a/java/awt/Color.java b/java/awt/Color.java
index c41117a6e..c32438521 100644
--- a/java/awt/Color.java
+++ b/java/awt/Color.java
@@ -506,7 +506,7 @@ public class Color implements Paint, Serializable
/**
* Returns the RGB value for this color, in the sRGB color space. The blue
- * value will be in bits 0-7, green in 8-15, red in 6-23, and alpha value in
+ * value will be in bits 0-7, green in 8-15, red in 16-23, and alpha value in
* 24-31.
*
* @return the RGB value for this color
@@ -772,9 +772,9 @@ public class Color implements Paint, Serializable
if (red == max)
array[0] = (green - blue) / delta;
else if (green == max)
- array[0] = 1 / 3 + (blue - red) / delta;
+ array[0] = 1f / 3 + (blue - red) / delta;
else
- array[0] = 2 / 3 + (red - green) / delta;
+ array[0] = 2f / 3 + (red - green) / delta;
if (array[0] < 0)
array[0]++;
}
diff --git a/java/awt/Component.java b/java/awt/Component.java
index 205976aae..f73c55204 100644
--- a/java/awt/Component.java
+++ b/java/awt/Component.java
@@ -1,5 +1,5 @@
/* Component.java -- a graphics component
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -47,17 +47,18 @@ import java.awt.event.FocusListener;
import java.awt.event.HierarchyBoundsListener;
import java.awt.event.HierarchyEvent;
import java.awt.event.HierarchyListener;
-import java.awt.event.KeyEvent;
-import java.awt.event.KeyListener;
import java.awt.event.InputEvent;
import java.awt.event.InputMethodEvent;
import java.awt.event.InputMethodListener;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
-import java.awt.event.MouseWheelListener;
import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
import java.awt.event.PaintEvent;
+import java.awt.event.WindowEvent;
import java.awt.im.InputContext;
import java.awt.im.InputMethodRequests;
import java.awt.image.BufferStrategy;
@@ -69,8 +70,8 @@ import java.awt.peer.ComponentPeer;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.ObjectInputStream;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
@@ -83,6 +84,7 @@ import java.util.Iterator;
import java.util.Locale;
import java.util.Set;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleComponent;
import javax.accessibility.AccessibleContext;
@@ -292,7 +294,7 @@ public abstract class Component
* @see #getLocale()
* @see #setLocale(Locale)
*/
- Locale locale;
+ Locale locale = Locale.getDefault ();
/**
* True if the object should ignore repaint events (usually because it is
@@ -2269,7 +2271,7 @@ public abstract class Component
{
boolean handled = handleEvent (e);
- if (!handled)
+ if (!handled && getParent() != null)
// FIXME: need to translate event coordinates to parent's
// coordinate space.
handled = getParent ().postEvent (e);
@@ -3432,7 +3434,7 @@ public abstract class Component
*/
public boolean isFocusTraversable()
{
- return enabled && visible && (peer == null || peer.isFocusTraversable());
+ return enabled && visible && (peer == null || isLightweight() || peer.isFocusTraversable());
}
/**
@@ -3447,7 +3449,11 @@ public abstract class Component
}
/**
- * Specify whether this component can receive focus.
+ * Specify whether this component can receive focus. This method also
+ * sets the {@link #isFocusTraversableOverridden} field to 1, which
+ * appears to be the undocumented way {@link
+ * DefaultFocusTraversalPolicy#accept()} determines whether to respect
+ * the {@link #isFocusable()} method of the component.
*
* @param focusable the new focusable status
* @since 1.4
@@ -3456,6 +3462,7 @@ public abstract class Component
{
firePropertyChange("focusable", this.focusable, focusable);
this.focusable = focusable;
+ this.isFocusTraversableOverridden = 1;
}
/**
@@ -3715,7 +3722,7 @@ public abstract class Component
Window toplevel = (Window) parent;
if (toplevel.isFocusableWindow ())
{
- if (peer != null)
+ if (peer != null && !isLightweight())
// This call will cause a FOCUS_GAINED event to be
// posted to the system event queue if the native
// windowing system grants the focus request.
@@ -3801,7 +3808,7 @@ public abstract class Component
Window toplevel = (Window) parent;
if (toplevel.isFocusableWindow ())
{
- if (peer != null)
+ if (peer != null && !isLightweight())
// This call will cause a FOCUS_GAINED event to be
// posted to the system event queue if the native
// windowing system grants the focus request.
@@ -3922,6 +3929,7 @@ public abstract class Component
if (focusedWindow == toplevel)
{
if (peer != null
+ && !isLightweight()
&& !(this instanceof Window))
// This call will cause a FOCUS_GAINED event to be
// posted to the system event queue if the native
@@ -4499,7 +4507,7 @@ p * <li>the set of backward traversal keys
*
* @return an AWT 1.0 event representing e
*/
- private Event translateEvent (AWTEvent e)
+ static Event translateEvent (AWTEvent e)
{
Component target = (Component) e.getSource ();
Event translated = null;
@@ -4691,6 +4699,7 @@ p * <li>the set of backward traversal keys
*
* @param e the event to dispatch
*/
+
void dispatchEventImpl (AWTEvent e)
{
Event oldEvent = translateEvent (e);
@@ -4699,7 +4708,30 @@ p * <li>the set of backward traversal keys
postEvent (oldEvent);
if (eventTypeEnabled (e.id))
- processEvent (e);
+ {
+ // the trick we use to communicate between dispatch and redispatch
+ // is to have KeyboardFocusManager.redispatch synchronize on the
+ // object itself. we then do not redispatch to KeyboardFocusManager
+ // if we are already holding the lock.
+ if (! Thread.holdsLock(e))
+ {
+ switch (e.id)
+ {
+ case WindowEvent.WINDOW_GAINED_FOCUS:
+ case WindowEvent.WINDOW_LOST_FOCUS:
+ case KeyEvent.KEY_PRESSED:
+ case KeyEvent.KEY_RELEASED:
+ case KeyEvent.KEY_TYPED:
+ case FocusEvent.FOCUS_GAINED:
+ case FocusEvent.FOCUS_LOST:
+ if (KeyboardFocusManager
+ .getCurrentKeyboardFocusManager()
+ .dispatchEvent(e))
+ return;
+ }
+ }
+ processEvent (e);
+ }
}
/**
diff --git a/java/awt/Container.java b/java/awt/Container.java
index f164afa89..778b72b86 100644
--- a/java/awt/Container.java
+++ b/java/awt/Container.java
@@ -35,27 +35,29 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
-import java.awt.event.MouseEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
import java.awt.peer.ContainerPeer;
import java.awt.peer.LightweightPeer;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
-import java.io.ObjectInputStream;
import java.io.IOException;
+import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.util.Collections;
import java.util.EventListener;
-import java.util.Iterator;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.Set;
+
import javax.accessibility.Accessible;
import javax.swing.SwingUtilities;
@@ -527,7 +529,7 @@ public class Container extends Component
/**
* Recursively invalidates the container tree.
*/
- private void invalidateTree()
+ void invalidateTree()
{
for (int i = 0; i < ncomponents; i++)
{
@@ -572,8 +574,8 @@ public class Container extends Component
}
/* children will call invalidate() when they are layed out. It
- is therefore imporant that valid is not set to true
- before after the children has been layed out. */
+ is therefore important that valid is not set to true
+ until after the children have been layed out. */
valid = true;
if (cPeer != null)
@@ -704,6 +706,8 @@ public class Container extends Component
{
if (!isShowing())
return;
+ // Paint self first.
+ super.paint(g);
// Visit heavyweights as well, in case they were
// erased when we cleared the background for this container.
visitChildren(g, GfxPaintVisitor.INSTANCE, false);
@@ -1507,10 +1511,11 @@ public class Container extends Component
void dispatchEventImpl(AWTEvent e)
{
// Give lightweight dispatcher a chance to handle it.
- if (dispatcher != null
+ if (eventTypeEnabled (e.id)
+ && dispatcher != null
&& dispatcher.handleEvent (e))
return;
-
+
if ((e.id <= ContainerEvent.CONTAINER_LAST
&& e.id >= ContainerEvent.CONTAINER_FIRST)
&& (containerListener != null
@@ -1588,7 +1593,6 @@ public class Container extends Component
{
if (dispatcher == null)
dispatcher = new LightweightDispatcher (this);
- dispatcher.enableEvents (component[i].eventMask);
}
@@ -1833,7 +1837,6 @@ class LightweightDispatcher implements Serializable
{
private static final long serialVersionUID = 5184291520170872969L;
private Container nativeContainer;
- private Component focus;
private Cursor nativeCursor;
private long eventMask;
@@ -1847,11 +1850,6 @@ class LightweightDispatcher implements Serializable
nativeContainer = c;
}
- void enableEvents(long l)
- {
- eventMask |= l;
- }
-
void acquireComponentForMouseEvent(MouseEvent me)
{
int x = me.getX ();
@@ -1951,9 +1949,6 @@ class LightweightDispatcher implements Serializable
boolean handleEvent(AWTEvent e)
{
- if ((eventMask & e.getID()) == 0)
- return false;
-
if (e instanceof MouseEvent)
{
MouseEvent me = (MouseEvent) e;
@@ -1991,10 +1986,6 @@ class LightweightDispatcher implements Serializable
e.consume();
}
}
- else if (e instanceof KeyEvent && focus != null)
- {
- focus.processKeyEvent((KeyEvent) e);
- }
return e.isConsumed();
}
diff --git a/java/awt/DefaultFocusTraversalPolicy.java b/java/awt/DefaultFocusTraversalPolicy.java
index 73b1e95a9..f49f386a1 100644
--- a/java/awt/DefaultFocusTraversalPolicy.java
+++ b/java/awt/DefaultFocusTraversalPolicy.java
@@ -92,19 +92,17 @@ public class DefaultFocusTraversalPolicy
&& comp.enabled)
{
if (comp.isFocusTraversableOverridden != 0
- && comp.isFocusTraversable ())
- return true;
- else
- {
- if (!(comp instanceof Canvas
- || comp instanceof Panel
- || comp instanceof Label
- || comp instanceof ScrollPane
- || comp instanceof Scrollbar
- || comp instanceof Window
- || comp.isLightweight ()))
- return true;
- }
+ && (comp.isFocusTraversable () || comp.isFocusable()))
+ return true;
+
+ if (!(comp instanceof Canvas
+ || comp instanceof Panel
+ || comp instanceof Label
+ || comp instanceof ScrollPane
+ || comp instanceof Scrollbar
+ || comp instanceof Window
+ || comp.isLightweight ()))
+ return true;
}
return false;
}
diff --git a/java/awt/DefaultKeyboardFocusManager.java b/java/awt/DefaultKeyboardFocusManager.java
index dec1d944a..3c0c30aa0 100644
--- a/java/awt/DefaultKeyboardFocusManager.java
+++ b/java/awt/DefaultKeyboardFocusManager.java
@@ -1,5 +1,5 @@
/* DefaultKeyboardFocusManager.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,15 @@ exception statement from your version. */
package java.awt;
-import java.util.*;
-import java.awt.event.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.WindowEvent;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
// FIXME: finish documentation
public class DefaultKeyboardFocusManager extends KeyboardFocusManager
@@ -155,7 +162,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
&& e.id != WindowEvent.WINDOW_DEACTIVATED)
return false;
- target.dispatchEvent (e);
+ redispatchEvent(target, e);
return true;
}
else if (e instanceof FocusEvent)
@@ -197,7 +204,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
setGlobalPermanentFocusOwner (null);
}
- target.dispatchEvent (e);
+ redispatchEvent(target, e);
return true;
}
@@ -258,7 +265,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
Component focusOwner = getGlobalPermanentFocusOwner ();
if (focusOwner != null)
- focusOwner.dispatchEvent (e);
+ redispatchEvent(focusOwner, e);
// Loop through all registered KeyEventPostProcessors, giving
// each a chance to process this event.
@@ -311,7 +318,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
MenuItem item = menu.getItem (j);
MenuShortcut shortcut = item.getShortcut ();
- if (shortcut != null)
+ if (item.isEnabled() && shortcut != null)
{
// Dispatch a new ActionEvent if:
//
@@ -443,7 +450,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
Component previous = policy.getComponentBefore (focusCycleRoot, focusComp);
- previous.requestFocusInWindow ();
+ if (previous != null)
+ previous.requestFocusInWindow ();
}
public void focusNextComponent (Component comp)
@@ -453,7 +461,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
Component next = policy.getComponentAfter (focusCycleRoot, focusComp);
- next.requestFocusInWindow ();
+ if (next != null)
+ next.requestFocusInWindow ();
}
public void upFocusCycle (Component comp)
@@ -465,7 +474,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
{
FocusTraversalPolicy policy = focusCycleRoot.getFocusTraversalPolicy ();
Component defaultComponent = policy.getDefaultComponent (focusCycleRoot);
- defaultComponent.requestFocusInWindow ();
+ if (defaultComponent != null)
+ defaultComponent.requestFocusInWindow ();
}
else
{
@@ -485,7 +495,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager
{
FocusTraversalPolicy policy = cont.getFocusTraversalPolicy ();
Component defaultComponent = policy.getDefaultComponent (cont);
- defaultComponent.requestFocusInWindow ();
+ if (defaultComponent != null)
+ defaultComponent.requestFocusInWindow ();
setGlobalCurrentFocusCycleRoot (cont);
}
}
diff --git a/java/awt/EventDispatchThread.java b/java/awt/EventDispatchThread.java
index 89b609557..097cc001b 100644
--- a/java/awt/EventDispatchThread.java
+++ b/java/awt/EventDispatchThread.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* EventDispatchThread.java -
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,12 +35,12 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-/** @author Bryce McKinlay */
-
-/* Status: believed complete, but untested. */
-
package java.awt;
+/**
+ * @author Bryce McKinlay
+ * @status believed complete, but untested.
+ */
class EventDispatchThread extends Thread
{
private static int dispatchThreadNum = 1;
diff --git a/java/awt/FileDialog.java b/java/awt/FileDialog.java
index 854d092f0..1af1de3b7 100644
--- a/java/awt/FileDialog.java
+++ b/java/awt/FileDialog.java
@@ -1,5 +1,5 @@
/* FileDialog.java -- A filename selection dialog box
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FileDialogPeer;
-import java.awt.peer.DialogPeer;
import java.io.FilenameFilter;
import java.io.Serializable;
diff --git a/java/awt/FlowLayout.java b/java/awt/FlowLayout.java
index 98d74941e..a06d16611 100644
--- a/java/awt/FlowLayout.java
+++ b/java/awt/FlowLayout.java
@@ -1,6 +1,5 @@
-// FlowLayout.java - Grid-based layout engine
-
-/* Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation
+/* FlowLayout.java -- Grid-based layout engine
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -47,7 +46,7 @@ import java.io.Serializable;
* supports horizontal and vertical gaps. These are used for spacing
* between components.
*
- * @author Tom Tromey <tromey@redhat.com>
+ * @author Tom Tromey (tromey@redhat.com)
* @author Aaron M. Renn (arenn@urbanophile.com)
*/
public class FlowLayout implements LayoutManager, Serializable
diff --git a/java/awt/Font.java b/java/awt/Font.java
index 754e078d7..25a1d925b 100644
--- a/java/awt/Font.java
+++ b/java/awt/Font.java
@@ -38,35 +38,34 @@ exception statement from your version. */
package java.awt;
+import gnu.java.awt.ClasspathToolkit;
+import gnu.java.awt.peer.ClasspathFontPeer;
+
import java.awt.font.FontRenderContext;
import java.awt.font.GlyphVector;
import java.awt.font.LineMetrics;
import java.awt.font.TextAttribute;
-import java.awt.font.TransformAttribute;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
import java.awt.peer.FontPeer;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.Serializable;
+import java.text.AttributedCharacterIterator;
+import java.text.CharacterIterator;
+import java.text.StringCharacterIterator;
+import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
-import java.util.HashMap;
import java.util.StringTokenizer;
-import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
-import java.text.StringCharacterIterator;
-
-import gnu.java.awt.ClasspathToolkit;
-import gnu.java.awt.peer.ClasspathFontPeer;
/**
- * This class represents a windowing system font.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- * @author Warren Levy <warrenl@cygnus.com>
- * @author Graydon Hoare <graydon@redhat.com>
- */
+ * This class represents a windowing system font.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
+ * @author Graydon Hoare (graydon@redhat.com)
+ */
public class Font implements Serializable
{
diff --git a/java/awt/FontMetrics.java b/java/awt/FontMetrics.java
index cb76f5079..9fd1ac962 100644
--- a/java/awt/FontMetrics.java
+++ b/java/awt/FontMetrics.java
@@ -38,6 +38,10 @@ exception statement from your version. */
package java.awt;
+import java.awt.font.FontRenderContext;
+import java.awt.font.LineMetrics;
+import java.text.CharacterIterator;
+
// FIXME: I leave many methods basically unimplemented. This
// should be reviewed.
@@ -349,6 +353,114 @@ toString()
+ ",descent=" + getDescent() + ",height=" + getHeight() + "]");
}
+
+// Generic FontRenderContext used when getLineMetrics is called with a
+// plain Graphics object.
+private static final FontRenderContext gRC = new FontRenderContext(null,
+ false,
+ false);
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param text The string to calculate metrics from.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ */
+public LineMetrics getLineMetrics(String text, Graphics g)
+{
+ return getLineMetrics(text, 0, text.length(), g);
+}
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param text The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
+public LineMetrics getLineMetrics(String text, int begin,
+ int limit, Graphics g)
+{
+ FontRenderContext rc;
+ if (g instanceof Graphics2D)
+ rc = ((Graphics2D) g).getFontRenderContext();
+ else
+ rc = gRC;
+ return font.getLineMetrics(text, begin, limit, rc);
+}
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param chars The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
+public LineMetrics getLineMetrics(char[] chars, int begin,
+ int limit, Graphics g)
+{
+ FontRenderContext rc;
+ if (g instanceof Graphics2D)
+ rc = ((Graphics2D) g).getFontRenderContext();
+ else
+ rc = gRC;
+ return font.getLineMetrics(chars, begin, limit, rc);
+}
+
+/**
+ * Returns a {@link LineMetrics} object constructed with the
+ * specified text and the {@link FontRenderContext} of the Graphics
+ * object when it is an instance of Graphics2D or a generic
+ * FontRenderContext with a null transform, not anti-aliased and not
+ * using fractional metrics.
+ *
+ * @param rc The string to calculate metrics from.
+ * @param begin Index of first character in <code>text</code> to measure.
+ * @param limit Index of last character in <code>text</code> to measure.
+ * @param g The Graphics object that will be used.
+ *
+ * @return A new {@link LineMetrics} object.
+ *
+ * @throws IndexOutOfBoundsException if the range [begin, limit] is
+ * invalid in <code>text</code>.
+ */
+public LineMetrics getLineMetrics(CharacterIterator ci, int begin,
+ int limit, Graphics g)
+{
+ FontRenderContext rc;
+ if (g instanceof Graphics2D)
+ rc = ((Graphics2D) g).getFontRenderContext();
+ else
+ rc = gRC;
+ return font.getLineMetrics(ci, begin, limit, rc);
+}
+
} // class FontMetrics
diff --git a/java/awt/Frame.java b/java/awt/Frame.java
index 633f8604a..42d85bc79 100644
--- a/java/awt/Frame.java
+++ b/java/awt/Frame.java
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.FramePeer;
-import java.util.Enumeration;
import java.util.Vector;
/**
@@ -317,6 +316,7 @@ setMenuBar(MenuBar menuBar)
this.menuBar.removeNotify();
if (menuBar != null)
menuBar.addNotify();
+ invalidateTree ();
((FramePeer) peer).setMenuBar(menuBar);
}
this.menuBar = menuBar;
diff --git a/java/awt/Graphics2D.java b/java/awt/Graphics2D.java
index b35f08aa8..e16c2d8fb 100644
--- a/java/awt/Graphics2D.java
+++ b/java/awt/Graphics2D.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,6 +34,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt;
import java.awt.font.FontRenderContext;
@@ -41,12 +42,10 @@ import java.awt.font.GlyphVector;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.BufferedImageOp;
-import java.awt.image.RenderedImage;
import java.awt.image.ImageObserver;
+import java.awt.image.RenderedImage;
import java.awt.image.renderable.RenderableImage;
-
import java.text.AttributedCharacterIterator;
-
import java.util.Map;
/**
diff --git a/java/awt/GraphicsEnvironment.java b/java/awt/GraphicsEnvironment.java
index 2b4ce5128..b963f4bab 100644
--- a/java/awt/GraphicsEnvironment.java
+++ b/java/awt/GraphicsEnvironment.java
@@ -1,5 +1,5 @@
/* GraphicsEnvironment.java -- information about the graphics environment
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,16 +38,17 @@ exception statement from your version. */
package java.awt;
+import gnu.java.awt.ClasspathToolkit;
+
import java.awt.image.BufferedImage;
import java.util.Locale;
-import gnu.java.awt.ClasspathToolkit;
/**
* This descibes the collection of GraphicsDevice and Font objects available
* on a given platform. The resources might be local or remote, and specify
* the valid configurations for displaying graphics.
*
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see GraphicsDevice
* @see GraphicsConfiguration
* @since 1.4
diff --git a/java/awt/GridBagConstraints.java b/java/awt/GridBagConstraints.java
index 651cfdc19..2795b9ed9 100644
--- a/java/awt/GridBagConstraints.java
+++ b/java/awt/GridBagConstraints.java
@@ -1,6 +1,5 @@
-// GridBagConstraints.java - Constraints for GridBag layout manager
-
-/* Copyright (C) 2000, 2001, 2002 Free Software Foundation
+/* GridBagConstraints.java -- Constraints for GridBag layout manager
+ Copyright (C) 2000, 2001, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -41,8 +40,10 @@ package java.awt;
import java.io.Serializable;
-/** This specifies the constraints for a component managed by the
- * GridBagLayout layout manager. */
+/**
+ * This specifies the constraints for a component managed by the
+ * GridBagLayout layout manager.
+ */
public class GridBagConstraints implements Cloneable, Serializable
{
static final long serialVersionUID = -1000070633030801713L;
diff --git a/java/awt/GridBagLayout.java b/java/awt/GridBagLayout.java
index fa627f400..8f6716471 100644
--- a/java/awt/GridBagLayout.java
+++ b/java/awt/GridBagLayout.java
@@ -1,5 +1,5 @@
/* GridBagLayout - Layout manager for components according to GridBagConstraints
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,8 +40,8 @@ package java.awt;
import java.io.Serializable;
import java.util.ArrayList;
-import java.util.Hashtable;
import java.util.HashMap;
+import java.util.Hashtable;
/**
* @author Michael Koch <konqueror@gmx.de>
diff --git a/java/awt/GridLayout.java b/java/awt/GridLayout.java
index a8befc4c0..b98102d46 100644
--- a/java/awt/GridLayout.java
+++ b/java/awt/GridLayout.java
@@ -1,6 +1,5 @@
-// GridLayout.java - Grid-based layout engine
-
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* GridLayout.java -- Grid-based layout engine
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
diff --git a/java/awt/Image.java b/java/awt/Image.java
index 451b092e6..37617719b 100644
--- a/java/awt/Image.java
+++ b/java/awt/Image.java
@@ -1,5 +1,5 @@
/* Image.java -- superclass for images
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.image.AreaAveragingScaleFilter;
import java.awt.image.FilteredImageSource;
import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
diff --git a/java/awt/KeyboardFocusManager.java b/java/awt/KeyboardFocusManager.java
index 15b9db556..eeb4f50ce 100644
--- a/java/awt/KeyboardFocusManager.java
+++ b/java/awt/KeyboardFocusManager.java
@@ -1,5 +1,5 @@
/* KeyboardFocusManager.java -- manage component focusing via the keyboard
- Copyright (C) 2002, 2005 Free Software Foundation
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.KeyEvent;
import java.awt.event.FocusEvent;
+import java.awt.event.KeyEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
@@ -1098,8 +1098,11 @@ public abstract class KeyboardFocusManager
*/
public final void redispatchEvent (Component target, AWTEvent e)
{
- e.setSource (target);
- dispatchEvent (e);
+ synchronized (e)
+ {
+ e.setSource (target);
+ target.dispatchEvent (e);
+ }
}
/**
diff --git a/java/awt/Label.java b/java/awt/Label.java
index 0cc92abe4..a98812ce8 100644
--- a/java/awt/Label.java
+++ b/java/awt/Label.java
@@ -1,5 +1,5 @@
/* Label.java -- Java label widget
- Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,6 +39,7 @@ exception statement from your version. */
package java.awt;
import java.awt.peer.LabelPeer;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -259,6 +260,11 @@ protected class AccessibleAWTLabel
extends AccessibleAWTComponent
{
/**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -3568967560160480438L;
+
+ /**
* Constructor for the accessible label.
*/
public AccessibleAWTLabel()
diff --git a/java/awt/List.java b/java/awt/List.java
index 47177edc7..d79bcf6fb 100644
--- a/java/awt/List.java
+++ b/java/awt/List.java
@@ -1,5 +1,5 @@
/* List.java -- A listbox widget
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,7 @@ import java.awt.event.ItemListener;
import java.awt.peer.ListPeer;
import java.util.EventListener;
import java.util.Vector;
+
import javax.accessibility.Accessible;
/**
diff --git a/java/awt/MediaTracker.java b/java/awt/MediaTracker.java
index d1df8b383..e69832d11 100644
--- a/java/awt/MediaTracker.java
+++ b/java/awt/MediaTracker.java
@@ -1,5 +1,5 @@
/* MediaTracker.java -- Class used for keeping track of images
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002i, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt;
-import java.util.ArrayList;
import java.awt.image.ImageObserver;
+import java.util.ArrayList;
/**
* This class is used for keeping track of the status of various media
diff --git a/java/awt/Menu.java b/java/awt/Menu.java
index c6c4f214d..33391525a 100644
--- a/java/awt/Menu.java
+++ b/java/awt/Menu.java
@@ -40,8 +40,8 @@ package java.awt;
import java.awt.peer.MenuPeer;
import java.io.Serializable;
-import java.util.Vector;
import java.util.Enumeration;
+import java.util.Vector;
/**
* This class represents a pull down or tear off menu in Java's AWT.
@@ -72,17 +72,20 @@ private Vector items = new Vector();
/**
* @serial Flag indicating whether or not this menu is a tear off
*/
-private boolean isTearOff;
+private boolean tearOff;
/**
* @serial Indicates whether or not this is a help menu.
*/
private boolean isHelpMenu;
-// From the serialization spec. FIXME: what should it be?
-private int menuSerializedDataVersion;
+ /*
+ * @serial Unused in this implementation, but present in Sun's
+ * serialization spec. Value obtained via reflection.
+ */
+ private int menuSerializedDataVersion = 1;
-static final String separatorLabel = "-";
+static final transient String separatorLabel = "-";
/*************************************************************************/
@@ -134,7 +137,7 @@ Menu(String label, boolean isTearOff)
{
super(label);
- this.isTearOff = isTearOff;
+ tearOff = isTearOff;
if (label.equals("Help"))
isHelpMenu = true;
@@ -158,7 +161,7 @@ Menu(String label, boolean isTearOff)
public boolean
isTearOff()
{
- return(isTearOff);
+ return(tearOff);
}
/*************************************************************************/
@@ -251,8 +254,6 @@ add(String label)
* @param item The menu item to add.
* @param index The index of the menu item.
*
- * XXX: FIXME
- *
* @exception IllegalArgumentException If the index is less than zero.
* @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
*/
@@ -262,12 +263,26 @@ insert(MenuItem item, int index)
if (index < 0)
throw new IllegalArgumentException("Index is less than zero");
- items.insertElementAt(item, index);
+ MenuPeer peer = (MenuPeer) getPeer();
+ if (peer == null)
+ return;
- MenuPeer mp = (MenuPeer)getPeer();
- // FIXME: Need to add a peer method here.
-// if (mp != null)
-// mp.insertItem(item, index);
+ int count = getItemCount ();
+
+ if (index >= count)
+ peer.addItem (item);
+ else
+ {
+ for (int i = count - 1; i >= index; i--)
+ peer.delItem (i);
+
+ peer.addItem (item);
+
+ for (int i = index; i < count; i++)
+ peer.addItem ((MenuItem) items.elementAt (i));
+ }
+
+ items.insertElementAt(item, index);
}
/*************************************************************************/
@@ -305,8 +320,6 @@ addSeparator()
*
* @param index The index at which to insert a separator bar.
*
- * XXX: FIXME
- *
* @exception IllegalArgumentException If the index is less than zero.
* @exception ArrayIndexOutOfBoundsException If the index is otherwise invalid.
*/
@@ -339,7 +352,7 @@ remove(int index)
/**
* Removes the specifed item from the menu. If the specified component
- * does not exist, this method does nothing. // FIXME: Right?
+ * does not exist, this method does nothing.
*
* @param item The component to remove.
*/
@@ -415,7 +428,7 @@ removeNotify()
public String
paramString()
{
- return (",isTearOff=" + isTearOff + ",isHelpMenu=" + isHelpMenu
+ return (",tearOff=" + tearOff + ",isHelpMenu=" + isHelpMenu
+ super.paramString());
}
diff --git a/java/awt/MenuBar.java b/java/awt/MenuBar.java
index fb2672900..0607a0526 100644
--- a/java/awt/MenuBar.java
+++ b/java/awt/MenuBar.java
@@ -45,14 +45,19 @@ import java.io.Serializable;
import java.util.Enumeration;
import java.util.Vector;
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
/**
* This class implements a menu bar in the AWT system.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
* @author Tom Tromey <tromey@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
*/
public class MenuBar extends MenuComponent
- implements MenuContainer, Serializable
+ implements MenuContainer, Serializable, Accessible
{
/*
@@ -78,6 +83,14 @@ private Menu helpMenu;
*/
private Vector menus = new Vector();
+ /**
+ * The accessible context for this component.
+ *
+ * @see #getAccessibleContext()
+ * @serial ignored.
+ */
+ private transient AccessibleContext accessibleContext;
+
/*************************************************************************/
/*
@@ -128,17 +141,17 @@ setHelpMenu(Menu menu)
helpMenu.removeNotify ();
helpMenu.parent = null;
}
+ helpMenu = menu;
if (menu.parent != null)
menu.parent.remove (menu);
- if (menu.parent != null)
- menu.parent.remove (menu);
menu.parent = this;
+ MenuBarPeer peer = (MenuBarPeer) getPeer ();
if (peer != null)
{
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.addHelpMenu (menu);
+ menu.addNotify();
+ peer.addHelpMenu (menu);
}
}
@@ -163,8 +176,7 @@ add(Menu menu)
if (peer != null)
{
- MenuBarPeer mp = (MenuBarPeer) peer;
- mp.addMenu (menu);
+ menu.addNotify();
}
return(menu);
@@ -234,8 +246,7 @@ getMenuCount()
public int
countMenus()
{
- // FIXME: How does the help menu fit in here?
- return menus.size ();
+ return menus.size () + (getHelpMenu () == null ? 0 : 1);
}
/*************************************************************************/
@@ -269,6 +280,11 @@ addNotify()
Menu mi = (Menu)e.nextElement();
mi.addNotify();
}
+ if (helpMenu != null)
+ {
+ helpMenu.addNotify();
+ ((MenuBarPeer) peer).addHelpMenu(helpMenu);
+ }
}
/*************************************************************************/
@@ -353,4 +369,56 @@ deleteShortcut(MenuShortcut shortcut)
it.deleteShortcut ();
}
+/**
+ * Gets the AccessibleContext associated with this <code>MenuBar</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+public AccessibleContext getAccessibleContext()
+{
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleAWTMenuBar();
+ }
+ return accessibleContext;
+}
+
+/**
+ * This class provides accessibility support for AWT menu bars.
+ *
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ */
+protected class AccessibleAWTMenuBar
+ extends AccessibleAWTMenuComponent
+{
+
+ /**
+ * Compatible with JDK 1.4.2 revision 5
+ */
+ private static final long serialVersionUID = -8577604491830083815L;
+
+ /**
+ * This is the default constructor, which simply calls the default
+ * constructor of the superclass.
+ */
+ protected AccessibleAWTMenuBar()
+ {
+ super();
+ }
+
+ /**
+ * Returns the accessible role relating to the menu bar.
+ *
+ * @return <code>AccessibleRole.MENU_BAR</code>.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.MENU_BAR;
+ }
+
+} // class AccessibleAWTMenuBar
+
} // class MenuBar
diff --git a/java/awt/MenuComponent.java b/java/awt/MenuComponent.java
index ccf2b4974..78adfaea6 100644
--- a/java/awt/MenuComponent.java
+++ b/java/awt/MenuComponent.java
@@ -1,5 +1,5 @@
/* MenuComponent.java -- Superclass of all AWT menu components
- Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,15 +38,24 @@ exception statement from your version. */
package java.awt;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import java.awt.peer.MenuComponentPeer;
import java.io.Serializable;
+import java.util.Locale;
-// FIXME: Java 1.0 event model unimplemented
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
/**
- * This is the superclass of all non-menu AWT widgets.
+ * This is the superclass of all menu AWT widgets.
*
* @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
*/
public abstract class MenuComponent implements Serializable
{
@@ -59,31 +68,101 @@ public abstract class MenuComponent implements Serializable
private static final long serialVersionUID = -4536902356223894379L;
/*************************************************************************/
-
+
/*
* Instance Variables
*/
- // FIXME: missing serialized fields `nameExplicitlySet',
- // `newEventsOnly', and `accessibleContext'.
+/**
+ * The font for this component.
+ *
+ * @see #getFont()
+ * @see #setFont(java.awt.Font)
+ * @serial the component's font.
+ */
+ private Font font;
+
+ /**
+ * The name of the component.
+ *
+ * @see #getName()
+ * @see #setName(String)
+ * @serial the component's name.
+ */
+ private String name;
+
+ /**
+ * The parent of this component.
+ *
+ * @see #getParent()
+ * @see #setParent(java.awt.MenuContainer)
+ * @serial ignored.
+ */
+ transient MenuContainer parent;
-// The font for this component
-private Font font;
+ /**
+ * The native peer for this component.
+ *
+ * @see #getPeer()
+ * @see #setPeer(java.awt.peer.MenuComponentPeer)
+ * @serial ignored.
+ */
+ transient MenuComponentPeer peer;
-// The name of the component
-private String name;
+ /**
+ * The synchronization locking object for this component.
+ *
+ * @serial ignored.
+ */
+ private transient Object tree_lock = this;
-// The parent of this component
-transient MenuContainer parent;
+ /**
+ * The toolkit for this object.
+ *
+ * @see #getToolkit()
+ * @serial ignored.
+ */
+ private static transient Toolkit toolkit = Toolkit.getDefaultToolkit();
-// The native peer for this componet
-transient MenuComponentPeer peer;
+ /**
+ * The accessible context for this component.
+ *
+ * @see #getAccessibleContext()
+ * @serial the accessibility information for this component.
+ */
+ private AccessibleContext accessibleContext;
-// The synchronization locking object for this component
-private transient Object tree_lock = this;
+ /**
+ * Was the name of the component set? This value defaults
+ * to false and becomes true after a call to <code>setName()</code>.
+ * Please note that this does not guarantee that name will then
+ * be non-null, as this may be the value passed to <code>setName()</code>.
+ *
+ * @see #setName(String)
+ * @serial true if the name value has been explicitly set by calling
+ * <code>setName()</code>.
+ */
+ private boolean nameExplicitlySet;
-// The toolkit for this object
-private static transient Toolkit toolkit = Toolkit.getDefaultToolkit();
+ /**
+ * Does this component handle new events? Events will be handled
+ * by this component if this is true. Otherwise, they will be forwarded
+ * up the component hierarchy. This implementation does not use this
+ * variable; it is merely provided for serialization compatability.
+ *
+ * @see #dispatchEvent(AWTEvent)
+ * @serial true if events are to be processed locally. Unused.
+ */
+ private boolean newEventsOnly;
+
+ /**
+ * The focus listener chain handler which deals with focus events for
+ * the accessible context of this component.
+ *
+ * @see AccessibleAWTMenuComponent#addFocusListener(java.awt.event.FocusListener)
+ * @serial ignored.
+ */
+ private transient FocusListener focusListener;
/*************************************************************************/
@@ -117,7 +196,13 @@ MenuComponent()
public Font
getFont()
{
- return(font);
+ if (font != null)
+ return font;
+
+ if (parent != null)
+ return parent.getFont ();
+
+ return null;
}
/*************************************************************************/
@@ -157,6 +242,7 @@ public void
setName(String name)
{
this.name = name;
+ nameExplicitlySet = true;
}
/*************************************************************************/
@@ -260,13 +346,14 @@ setTreeLock(Object tree_lock)
* AWT 1.0 event dispatcher.
*
* @deprecated Deprecated in favor of <code>dispatchEvent()</code>.
+ * @return true if the event was dispatched, false otherwise.
*/
public boolean
postEvent(Event event)
{
- return(false);
+ // This is overridden by subclasses that support events.
+ return false;
}
-
/*************************************************************************/
/**
@@ -274,17 +361,35 @@ postEvent(Event event)
*
* @param event The event to dispatch
*/
-public final void
-dispatchEvent(AWTEvent event)
+public final void dispatchEvent(AWTEvent event)
{
// See comment in Component.dispatchEvent().
dispatchEventImpl(event);
}
-void
-dispatchEventImpl(AWTEvent e)
+
+/**
+ * Implementation of dispatchEvent. Allows trusted package classes
+ * to dispatch additional events first. This implementation first
+ * translates <code>event</code> to an AWT 1.0 event and sends the
+ * result to {@link #postEvent}. The event is then
+ * passed on to {@link #processEvent} for local processing.
+ *
+ * @param event the event to dispatch.
+ */
+void dispatchEventImpl(AWTEvent event)
{
+ Event oldStyleEvent;
+
// This is overridden by subclasses that support events.
+ /* Convert AWT 1.1 event to AWT 1.0 event */
+ oldStyleEvent = Component.translateEvent(event);
+ if (oldStyleEvent != null)
+ {
+ postEvent(oldStyleEvent);
+ }
+ /* Do local processing */
+ processEvent(event);
}
/*************************************************************************/
@@ -298,6 +403,25 @@ dispatchEventImpl(AWTEvent e)
protected void
processEvent(AWTEvent event)
{
+ /*
+ Pass a focus event to the focus listener for
+ the accessibility context.
+ */
+ if (event instanceof FocusEvent)
+ {
+ if (focusListener != null)
+ {
+ switch (event.id)
+ {
+ case FocusEvent.FOCUS_GAINED:
+ focusListener.focusGained((FocusEvent) event);
+ break;
+ case FocusEvent.FOCUS_LOST:
+ focusListener.focusLost((FocusEvent) event);
+ break;
+ }
+ }
+ }
}
/*************************************************************************/
@@ -316,15 +440,884 @@ toString()
/*************************************************************************/
/**
- * Returns a debugging string for this component
- */
+ * Returns a debugging string for this component
+ */
protected String
paramString()
{
return "name=" + getName();
}
-// Accessibility API not yet implemented.
-// public AccessibleContext getAccessibleContext()
+/**
+ * Gets the AccessibleContext associated with this <code>MenuComponent</code>.
+ * As an abstract class, we return null. Concrete subclasses should return
+ * their implementation of the accessibility context.
+ *
+ * @return null.
+ */
+
+public AccessibleContext getAccessibleContext()
+{
+ return null;
+}
+
+/**
+ * This class provides a base for the accessibility support of menu
+ * components.
+ *
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ */
+protected abstract class AccessibleAWTMenuComponent
+ extends AccessibleContext
+ implements Serializable, AccessibleComponent, AccessibleSelection
+{
+
+ /**
+ * Compatible with JDK 1.4.2 revision 5
+ */
+ private static final long serialVersionUID = -4269533416223798698L;
+
+ /**
+ * This is the default constructor. It should be called by
+ * concrete subclasses to ensure necessary groundwork is completed.
+ */
+ protected AccessibleAWTMenuComponent()
+ {
+ }
+
+ /**
+ * Replaces or supplements the component's selection with the
+ * <code>Accessible</code> child at the supplied index. If
+ * the component supports multiple selection, the child is
+ * added to the current selection. Otherwise, the current
+ * selection becomes the specified child. If the child is
+ * already selected, nothing happens.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the specified child within a
+ * zero-based list of the component's children.
+ */
+ public void addAccessibleSelection(int index)
+ {
+ /* Subclasses with children should implement this */
+ }
+
+ /**
+ * Registers the specified focus listener to receive
+ * focus events from this component.
+ *
+ * @param listener the new focus listener.
+ */
+ public void addFocusListener(FocusListener listener)
+ {
+ /*
+ * Chain the new focus listener to the existing chain
+ * of focus listeners. Each new focus listener is
+ * coupled via multicasting to the existing chain.
+ */
+ focusListener = AWTEventMulticaster.add(focusListener, listener);
+ }
+
+ /**
+ * Clears the component's current selection. Following
+ * the calling of this method, no children of the component
+ * will be selected.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ */
+ public void clearAccessibleSelection()
+ {
+ }
+
+ /**
+ * Returns true if the specified point lies within the
+ * component. The supplied co-ordinates are assumed to
+ * be relative to the co-ordinate system of the component
+ * itself. Thus, the point (0,0) is the upper left corner
+ * of this component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @param point the point to check against this component.
+ * @return true if the point is within this component.
+ * @see #getBounds()
+ */
+ public boolean contains(Point point)
+ {
+ /*
+ We can simply return the result of a
+ test for containment in the bounding rectangle
+ */
+ return getBounds().contains(point);
+ }
+
+ /**
+ * Returns the <code>Accessible</code> child of this component present
+ * at the specified point. The supplied co-ordinates are
+ * assumed to be relative to the co-ordinate system of this
+ * component (the parent of any returned accessible). Thus,
+ * the point (0,0) is the upper left corner of this menu
+ * component.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param point the point at which the returned accessible
+ * is located.
+ * @return null.
+ */
+ public Accessible getAccessibleAt(Point point)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the <code>Accessible</code> child at the supplied
+ * index within the list of children of this component.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the <code>Accessible</code> child
+ * to retrieve.
+ * @return null.
+ */
+ public Accessible getAccessibleChild(int index)
+ {
+ return null;
+ }
+
+ /**
+ * Returns the number of children of this component which
+ * implement the <code>Accessible</code> interface. If
+ * all children of this component are accessible, then
+ * the returned value will be the same as the number of
+ * children.
+ * <br />
+ * <br />
+ *
+ * @return 0.
+ */
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Retrieves the <code>AccessibleComponent</code> associated
+ * with this accessible context and its component. As the
+ * context itself implements <code>AccessibleComponent</code>,
+ * this is the return value.
+ *
+ * @return the context itself.
+ */
+ public AccessibleComponent getAccessibleComponent()
+ {
+ return this;
+ }
+
+ /**
+ * Returns the accessible name for this menu component. This
+ * is the name given to the component, which may be null if
+ * not set using <code>setName()</code>.
+ * <br />
+ * <br />
+ * The name is not the most appropriate description of this
+ * object. Subclasses should preferably provide a more
+ * accurate description. For example, a File menu could
+ * have the description `Lists commands related to the
+ * file system'.
+ *
+ * @return a description of the component. Currently,
+ * this is just the contents of the name property.
+ * @see MenuComponent#setName(String)
+ */
+ public String getAccessibleDescription()
+ {
+ return MenuComponent.this.getName();
+ }
+
+ /**
+ * Retrieves the index of this component within its parent.
+ * If no parent exists, -1 is returned.
+ *
+ * @return -1 as the parent, a <code>MenuContainer</code>
+ * is not <code>Accessible</code>.
+ */
+ public int getAccessibleIndexInParent()
+ {
+ return -1;
+ }
+
+ /**
+ * Returns the accessible name of this component. This
+ * is the name given to the component, which may be null if
+ * not set using <code>setName()</code>.
+ * <br />
+ * <br />
+ * The name property is not the most suitable string to return
+ * for this method. The string should be localized, and
+ * relevant to the operation of the component. For example,
+ * it could be the text of a menu item. However, this can
+ * not be used at this level of abstraction, so it is the
+ * responsibility of subclasses to provide a more appropriate
+ * name.
+ *
+ * @return a localized name for this component. Currently, this
+ * is just the contents of the name property.
+ * @see MenuComponent#setName(String)
+ */
+ public String getAccessibleName()
+ {
+ return MenuComponent.this.getName();
+ }
+
+ /**
+ * Returns the <code>Accessible</code> parent of this component.
+ * As the parent of a <code>MenuComponent</code> is a
+ * <code>MenuContainer</code>, which doesn't implement
+ * <code>Accessible</code>, this method returns null.
+ *
+ * @return null.
+ */
+ public Accessible getAccessibleParent()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the accessible role of this component.
+ * <br />
+ * <br />
+ * The abstract implementation of this method returns
+ * <code>AccessibleRole.AWT_COMPONENT</code>,
+ * as the abstract component has no specific role. This
+ * method should be overridden by concrete subclasses, so
+ * as to return an appropriate role for the component.
+ *
+ * @return <code>AccessibleRole.AWT_COMPONENT</code>.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.AWT_COMPONENT;
+ }
+
+ /**
+ * Retrieves the <code>AccessibleSelection</code> associated
+ * with this accessible context and its component. As the
+ * context itself implements <code>AccessibleSelection</code>,
+ * this is the return value.
+ *
+ * @return the context itself.
+ */
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return this;
+ }
+
+ /**
+ * Retrieves the <code>Accessible</code> selected child
+ * at the specified index. If there are no selected children
+ * or the index is outside the range of selected children,
+ * null is returned. Please note that the index refers
+ * to the index of the child in the list of <strong>selected
+ * children</strong>, and not the index of the child in
+ * the list of all <code>Accessible</code> children.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the selected <code>Accessible</code>
+ * child.
+ */
+ public Accessible getAccessibleSelection(int index)
+ {
+ return null;
+ }
+
+ /**
+ * Returns a count of the number of <code>Accessible</code>
+ * children of this component which are currently selected.
+ * If there are no children currently selected, 0 is returned.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @return 0.
+ */
+ public int getAccessibleSelectionCount()
+ {
+ return 0;
+ }
+
+ /**
+ * Retrieves the current state of this component
+ * in an accessible form. For example, a given component
+ * may be visible, selected, disabled, etc.
+ * <br />
+ * <br />
+ * As this class tells us virtually nothing about the component,
+ * except for its name and font, no state information can be
+ * provided. This implementation thus returns an empty
+ * state set, and it is left to concrete subclasses to provide
+ * a more acceptable and relevant state set. Changes to these
+ * properties also need to be handled using
+ * <code>PropertyChangeListener</code>s.
+ *
+ * @return an empty <code>AccessibleStateSet</code>.
+ */
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ return new AccessibleStateSet();
+ }
+
+ /**
+ * Returns the background color of the component, or null
+ * if this property is unsupported.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns the
+ * default system background color used for rendering menus.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return the default system background color for menus.
+ * @see #setBackground(java.awt.Color)
+ */
+ public Color getBackground()
+ {
+ return SystemColor.menu;
+ }
+
+ /**
+ * Returns a <code>Rectangle</code> which represents the
+ * bounds of this component. The returned rectangle has the
+ * height and width of the component's bounds, and is positioned
+ * at a location relative to this component's parent, the
+ * <code>MenuContainer</code>. null is returned if bounds
+ * are not supported by the component.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns null.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return null.
+ * @see #setBounds(java.awt.Rectangle)
+ */
+ public Rectangle getBounds()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the <code>Cursor</code> displayed when the pointer
+ * is positioned over this component. Alternatively, null
+ * is returned if the component doesn't support the cursor
+ * property.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns the default
+ * system cursor. Concrete subclasses which handle the drawing
+ * of an onscreen menu component may override this method and provide
+ * the appropriate information.
+ *
+ * @return the default system cursor.
+ * @see #setCursor(java.awt.Cursor)
+ */
+ public Cursor getCursor()
+ {
+ return Cursor.getDefaultCursor();
+ }
+
+ /**
+ * Returns the <code>Font</code> used for text created by this component.
+ *
+ * @return the current font.
+ * @see #setFont(java.awt.Font)
+ */
+ public Font getFont()
+ {
+ return MenuComponent.this.getFont();
+ }
+
+ /**
+ * Retrieves information on the rendering and metrics of the supplied
+ * font. If font metrics are not supported by this component, null
+ * is returned.
+ * <br />
+ * <br />
+ * The abstract implementation of this method simply uses the toolkit
+ * to obtain the <code>FontMetrics</code>. Concrete subclasses may
+ * find it more efficient to invoke their peer class directly, if one
+ * is available.
+ *
+ * @param font the font about which to retrieve rendering and metric
+ * information.
+ * @return the metrics of the given font, as provided by the system
+ * toolkit.
+ * @throws NullPointerException if the supplied font was null.
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return MenuComponent.this.getToolkit().getFontMetrics(font);
+ }
+
+ /**
+ * Returns the foreground color of the component, or null
+ * if this property is unsupported.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns the
+ * default system text color used for rendering menus.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return the default system text color for menus.
+ * @see #setForeground(java.awt.Color)
+ */
+ public Color getForeground()
+ {
+ return SystemColor.menuText;
+ }
+
+ /**
+ * Returns the locale currently in use by this component.
+ * <br />
+ * <br />
+ * This abstract class has no property relating to the
+ * locale used by the component, so this method simply
+ * returns the default locale for the current instance
+ * of the Java Virtual Machine (JVM). Concrete subclasses
+ * which maintain such a property should override this method
+ * and provide the locale information more accurately.
+ *
+ * @return the default locale for this JVM instance.
+ */
+ public Locale getLocale()
+ {
+ return Locale.getDefault();
+ }
+
+ /**
+ * Returns the location of the component, with co-ordinates
+ * relative to the parent component and using the co-ordinate
+ * space of the screen. Thus, the point (0,0) is the upper
+ * left corner of the parent component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @return the location of the component, relative to its parent.
+ * @see #setLocation(java.awt.Point)
+ */
+ public Point getLocation()
+ {
+ /* Simply return the location of the bounding rectangle */
+ return getBounds().getLocation();
+ }
+
+ /**
+ * Returns the location of the component, with co-ordinates
+ * relative to the screen. Thus, the point (0,0) is the upper
+ * left corner of the screen. null is returned if the component
+ * is either not on screen or if this property is unsupported.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply returns null.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @return the location of the component, relative to the screen.
+ */
+ public Point getLocationOnScreen()
+ {
+ return null;
+ }
+
+ /**
+ * Returns the size of the component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @return the size of the component.
+ * @see #setSize(java.awt.Dimension)
+ */
+ public Dimension getSize()
+ {
+ /* Simply return the size of the bounding rectangle */
+ return getBounds().getSize();
+ }
+
+ /**
+ * Returns true if the accessible child specified by the supplied index
+ * is currently selected.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the accessible child to check for selection.
+ * @return false.
+ */
+ public boolean isAccessibleChildSelected(int index)
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if this component is currently enabled.
+ * <br />
+ * <br />
+ * As this abstract component has no properties related to
+ * its enabled or disabled state, the implementation of this
+ * method is left to subclasses.
+ *
+ * @return false.
+ * @see #setEnabled(boolean)
+ */
+ public boolean isEnabled()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if this component is included in the traversal
+ * of the current focus from one component to the other.
+ * <br />
+ * <br />
+ * As this abstract component has no properties related to
+ * its ability to accept the focus, the implementation of this
+ * method is left to subclasses.
+ *
+ * @return false.
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if the component is being shown on screen.
+ * A component is determined to be shown if it is visible,
+ * and each parent component is also visible. Please note
+ * that, even when a component is showing, it may still be
+ * obscured by other components in front. This method only
+ * determines if the component is being drawn on the screen.
+ * <br />
+ * <br />
+ * As this abstract component and its parent have no properties
+ * relating to visibility, the implementation of this method is
+ * left to subclasses.
+ *
+ * @return false.
+ * @see #isVisible()
+ */
+ public boolean isShowing()
+ {
+ return false;
+ }
+
+ /**
+ * Returns true if the component is visible. A component may
+ * be visible but not drawn on the screen if one of its parent
+ * components is not visible. To determine if the component is
+ * actually drawn on screen, <code>isShowing()</code> should be
+ * used.
+ * <br />
+ * <br />
+ * As this abstract component has no properties relating to its
+ * visibility, the implementation of this method is left to subclasses.
+ *
+ * @return false.
+ * @see #isShowing()
+ * @see #setVisible(boolean)
+ */
+ public boolean isVisible()
+ {
+ return false;
+ }
+
+ /**
+ * Removes the accessible child specified by the supplied index from
+ * the list of currently selected children. If the child specified
+ * is not selected, nothing happens.
+ * <br />
+ * <br />
+ * As the existence of children can not be determined from
+ * this abstract class, the implementation of this method
+ * is left to subclasses.
+ *
+ * @param index the index of the <code>Accessible</code> child.
+ */
+ public void removeAccessibleSelection(int index)
+ {
+ /* Subclasses with children should implement this */
+ }
+
+ /**
+ * Removes the specified focus listener from the list of registered
+ * focus listeners for this component.
+ *
+ * @param listener the listener to remove.
+ */
+ public void removeFocusListener(FocusListener listener)
+ {
+ /* Remove the focus listener from the chain */
+ focusListener = AWTEventMulticaster.remove(focusListener, listener);
+ }
+
+ /**
+ * Requests that this component gains focus. This depends on the
+ * component being focus traversable.
+ * <br />
+ * <br />
+ * As this abstract component has no properties relating to its
+ * focus traversability, or access to a peer with request focusing
+ * abilities, the implementation of this method is left to subclasses.
+ */
+ public void requestFocus()
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Selects all <code>Accessible</code> children of this component which
+ * it is possible to select. The component needs to support multiple
+ * selections.
+ * <br />
+ * <br />
+ * This abstract component provides a simplistic implementation of this
+ * method, which ignores the ability of the component to support multiple
+ * selections and simply uses <code>addAccessibleSelection</code> to
+ * add each <code>Accessible</code> child to the selection. The last
+ * <code>Accessible</code> component is thus selected for components
+ * which don't support multiple selections. Concrete implementations should
+ * override this with a more appopriate and efficient implementation, which
+ * properly takes into account the ability of the component to support multiple
+ * selections.
+ */
+ public void selectAllAccessibleSelection()
+ {
+ /* Simply call addAccessibleSelection() on all accessible children */
+ for (int a = 0; a < getAccessibleChildrenCount(); ++a)
+ {
+ addAccessibleSelection(a);
+ }
+ }
+
+ /**
+ * Sets the background color of the component to that specified.
+ * Unspecified behaviour occurs when null is given as the new
+ * background color.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the supplied
+ * color and continues to use the default system color.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @param color the new color to use for the background.
+ * @see getBackground()
+ */
+ public void setBackground(Color color)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the height and width of the component, and its position
+ * relative to this component's parent, to the values specified
+ * by the supplied rectangle. Unspecified behaviour occurs when
+ * null is given as the new bounds.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the new
+ * rectangle and continues to return null from <code>getBounds()</code>.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @param rectangle a rectangle which specifies the new bounds of
+ * the component.
+ * @see #getBounds()
+ */
+ public void setBounds(Rectangle rectangle)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the <code>Cursor</code> used when the pointer is positioned over the
+ * component. Unspecified behaviour occurs when null is given as the new
+ * cursor.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the new cursor
+ * and continues to return the default system cursor. Concrete
+ * subclasses which handle the drawing of an onscreen menu component
+ * may override this method and provide the appropriate information.
+ *
+ * @param cursor the new cursor to use.
+ * @see #getCursor()
+ */
+ public void setCursor(Cursor cursor)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the enabled/disabled state of this component.
+ * <br />
+ * <br />
+ * As this abstract component has no properties related to
+ * its enabled or disabled state, the implementation of this
+ * method is left to subclasses.
+ *
+ * @param enabled true if the component should be enabled,
+ * false otherwise.
+ * @see #getEnabled()
+ */
+ public void setEnabled(boolean enabled)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the <code>Font</code> used for text created by this component.
+ * Unspecified behaviour occurs when null is given as the new
+ * font.
+ *
+ * @param font the new font to use for text.
+ * @see #getFont()
+ */
+ public void setFont(Font font)
+ {
+ /* Call the method of the enclosing component */
+ MenuComponent.this.setFont(font);
+ }
+
+ /**
+ * Sets the foreground color of the component to that specified.
+ * Unspecified behaviour occurs when null is given as the new
+ * background color.
+ * <br />
+ * <br />
+ * This abstract class knows nothing about how the component
+ * is drawn on screen, so this method simply ignores the supplied
+ * color and continues to return the default system text color used
+ * for rendering menus.
+ * Concrete subclasses which handle the drawing of an onscreen
+ * menu component should override this method and provide
+ * the appropriate information.
+ *
+ * @param color the new foreground color.
+ * @see #getForeground()
+ */
+ public void setForeground(Color color)
+ {
+ /* Ignored */
+ }
+
+ /**
+ * Sets the location of the component, with co-ordinates
+ * relative to the parent component and using the co-ordinate
+ * space of the screen. Thus, the point (0,0) is the upper
+ * left corner of the parent component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @param point the location of the component, relative to its parent.
+ * @see #getLocation()
+ */
+ public void setLocation(Point point)
+ {
+ getBounds().setLocation(point);
+ }
+
+ /**
+ * Sets the size of the component.
+ * <br />
+ * <br />
+ * Please note that this method depends on a correctly implemented
+ * version of the <code>getBounds()</code> method. Subclasses
+ * must provide the bounding rectangle via <code>getBounds()</code>
+ * in order for this method to work.
+ *
+ * @param size the new size of the component.
+ * @see #getSize()
+ */
+ public void setSize(Dimension size)
+ {
+ getBounds().setSize(size);
+ }
+
+ /**
+ * Sets the visibility state of the component. A component may
+ * be visible but not drawn on the screen if one of its parent
+ * components is not visible. To determine if the component is
+ * actually drawn on screen, <code>isShowing()</code> should be
+ * used.
+ * <br />
+ * <br />
+ * As this abstract component has no properties relating to its
+ * visibility, the implementation of this method is left to subclasses.
+ *
+ * @param visibility the new visibility of the component -- true if
+ * the component is visible, false if not.
+ * @see #isShowing()
+ * @see #isVisible()
+ */
+ public void setVisible(boolean visibility)
+ {
+ /* Ignored */
+ }
+
+} /* class AccessibleAWTMenuComponent */
+
-} // class Component
+} // class MenuComponent
diff --git a/java/awt/MenuItem.java b/java/awt/MenuItem.java
index 8511f698f..66c0a5f3a 100644
--- a/java/awt/MenuItem.java
+++ b/java/awt/MenuItem.java
@@ -54,8 +54,6 @@ public class MenuItem extends MenuComponent
implements Serializable
{
-// FIXME: The enabled event mask is not used at this time.
-
/*
* Static Variables
*/
@@ -77,7 +75,7 @@ private String actionCommand;
/**
* @serial Indicates whether or not this menu item is enabled.
*/
-private boolean enabled;
+private boolean enabled = true;
/**
* @serial The mask of events that are enabled for this menu item.
diff --git a/java/awt/Panel.java b/java/awt/Panel.java
index dbe322896..1795540ea 100644
--- a/java/awt/Panel.java
+++ b/java/awt/Panel.java
@@ -1,5 +1,5 @@
/* Panel.java -- Simple container object
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.PaintEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -47,8 +46,8 @@ import javax.accessibility.AccessibleRole;
* A panel is a simple container class. It's default layout is the
* <code>FlowLayout</code> manager.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @see FlowLayout
* @since 1.0
* @status updated to 1.4
@@ -98,36 +97,6 @@ public class Panel extends Container implements Accessible
}
/**
- * Consume initial application-requested paint event if it has not
- * already been consumed, and if the initial system-requested paint
- * event has not already been handled. Otherwise, call
- * super.dispatchEventImpl. These extra steps are required to
- * prevent a Panel from being painted twice when it is initially
- * shown.
- *
- * @param e the event to dispatch
- */
- void dispatchEventImpl (AWTEvent e)
- {
- if (e instanceof PaintEvent)
- {
- if (e.id == PaintEvent.UPDATE)
- {
- if (!initialUpdateConsumed
- && !initialSystemUpdateDone)
- {
- e.consume ();
- initialUpdateConsumed = true;
- }
- }
- else if (e.id == PaintEvent.PAINT)
- initialSystemUpdateDone = true;
- }
- else
- super.dispatchEventImpl (e);
- }
-
- /**
* Notifies this object to create its native peer.
*
* @see #isDisplayable()
diff --git a/java/awt/Point.java b/java/awt/Point.java
index 9d5126434..3731b4134 100644
--- a/java/awt/Point.java
+++ b/java/awt/Point.java
@@ -95,7 +95,7 @@ public class Point extends Point2D implements Serializable
* Initializes a new instance of <code>Point</code> with coordinates
* identical to the coordinates of the specified points.
*
- * @param point the point to copy the coordinates from
+ * @param p the point to copy the coordinates from
* @throws NullPointerException if p is null
*/
public Point(Point p)
diff --git a/java/awt/Polygon.java b/java/awt/Polygon.java
index 96c370aaf..36739e306 100644
--- a/java/awt/Polygon.java
+++ b/java/awt/Polygon.java
@@ -684,7 +684,7 @@ public class Polygon implements Shape, Serializable
* path iterator is not either.
*
* @param transform an optional transform to apply to the iterator
- * @param double the maximum distance for deviation from the real boundary
+ * @param flatness the maximum distance for deviation from the real boundary
* @return a new iterator over the boundary
* @since 1.2
*/
diff --git a/java/awt/PopupMenu.java b/java/awt/PopupMenu.java
index 83ffb35a8..fd953c328 100644
--- a/java/awt/PopupMenu.java
+++ b/java/awt/PopupMenu.java
@@ -1,5 +1,5 @@
/* PopupMenu.java -- An AWT popup menu
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +38,6 @@ exception statement from your version. */
package java.awt;
-import java.awt.peer.MenuPeer;
import java.awt.peer.PopupMenuPeer;
/**
diff --git a/java/awt/Rectangle.java b/java/awt/Rectangle.java
index 5dc54116f..66190960a 100644
--- a/java/awt/Rectangle.java
+++ b/java/awt/Rectangle.java
@@ -338,7 +338,7 @@ public class Rectangle extends Rectangle2D implements Shape, Serializable
* its upper left corner.
*
* @return the point where this rectangle is located
- * @see setLocation(Point)
+ * @see #setLocation(Point)
* @since 1.1
*/
public Point getLocation()
diff --git a/java/awt/ScrollPane.java b/java/awt/ScrollPane.java
index 457df0c0e..abd5514d8 100644
--- a/java/awt/ScrollPane.java
+++ b/java/awt/ScrollPane.java
@@ -1,5 +1,5 @@
/* ScrollPane.java -- Scrolling window
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -41,6 +41,7 @@ package java.awt;
import java.awt.event.MouseEvent;
import java.awt.peer.ComponentPeer;
import java.awt.peer.ScrollPanePeer;
+
import javax.accessibility.Accessible;
/**
diff --git a/java/awt/Scrollbar.java b/java/awt/Scrollbar.java
index a01dc3ccd..d09a1682a 100644
--- a/java/awt/Scrollbar.java
+++ b/java/awt/Scrollbar.java
@@ -1,5 +1,6 @@
/* Scrollbar.java -- AWT Scrollbar widget
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +39,11 @@ exception statement from your version. */
package java.awt;
-import java.awt.event.AdjustmentListener;
import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
import java.awt.peer.ScrollbarPeer;
import java.util.EventListener;
+
import javax.accessibility.Accessible;
/**
diff --git a/java/awt/Shape.java b/java/awt/Shape.java
index 8d61c4a9a..47c97192a 100644
--- a/java/awt/Shape.java
+++ b/java/awt/Shape.java
@@ -57,8 +57,8 @@ import java.awt.geom.Rectangle2D;
* @author Aaron M. Renn <arenn@urbanophile.com>
* @see PathIterator
* @see AffineTransform
- * @see FlatteningPathIterator
- * @see GeneralPath
+ * @see java.awt.geom.FlatteningPathIterator
+ * @see java.awt.geom.GeneralPath
* @since 1.0
* @status updated to 1.4
*/
@@ -109,15 +109,15 @@ public interface Shape
* Test if a high-precision rectangle intersects the shape. This is true
* if any point in the rectangle is in the shape, with the caveat that the
* operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
* @param w the width of the rectangle, undefined results if negative
* @param h the height of the rectangle, undefined results if negative
* @return true if the rectangle intersects this shape
- * @see Area
+ * @see java.awt.geom.Area
* @since 1.2
*/
boolean intersects(double x, double y, double w, double h);
@@ -126,8 +126,8 @@ public interface Shape
* Test if a high-precision rectangle intersects the shape. This is true
* if any point in the rectangle is in the shape, with the caveat that the
* operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param r the rectangle
* @return true if the rectangle intersects this shape
@@ -141,15 +141,15 @@ public interface Shape
* Test if a high-precision rectangle lies completely in the shape. This is
* true if all points in the rectangle are in the shape, with the caveat
* that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param x the x coordinate of the rectangle
* @param y the y coordinate of the rectangle
* @param w the width of the rectangle, undefined results if negative
* @param h the height of the rectangle, undefined results if negative
* @return true if the rectangle is contained in this shape
- * @see Area
+ * @see java.awt.geom.Area
* @since 1.2
*/
boolean contains(double x, double y, double w, double h);
@@ -158,8 +158,8 @@ public interface Shape
* Test if a high-precision rectangle lies completely in the shape. This is
* true if all points in the rectangle are in the shape, with the caveat
* that the operation may include high probability estimates when the actual
- * calculation is prohibitively expensive. The {@link Area} class can
- * be used for more precise answers.
+ * calculation is prohibitively expensive. The {@link java.awt.geom.Area}
+ * class can be used for more precise answers.
*
* @param r the rectangle
* @return true if the rectangle is contained in this shape
@@ -195,7 +195,7 @@ public interface Shape
* iterations from future changes to the boundary, and document this fact.
*
* @param transform an optional transform to apply to the iterator
- * @param double the maximum distance for deviation from the real boundary
+ * @param flatness the maximum distance for deviation from the real boundary
* @return a new iterator over the boundary
* @since 1.2
*/
diff --git a/java/awt/SystemColor.java b/java/awt/SystemColor.java
index 5217677b7..3428fba3c 100644
--- a/java/awt/SystemColor.java
+++ b/java/awt/SystemColor.java
@@ -1,5 +1,5 @@
/* SystemColor.java -- access dynamic system color values
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,9 @@ exception statement from your version. */
package java.awt;
-import java.awt.image.ColorModel;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
+import java.awt.image.ColorModel;
import java.io.Serializable;
/**
@@ -72,7 +72,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the desktop color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #desktop
*/
@@ -80,7 +80,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the active caption color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #activeCaption
*/
@@ -88,7 +88,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the active caption text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #activeCaptionText
*/
@@ -96,7 +96,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the active caption border color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #activeCaptionBorder
*/
@@ -104,7 +104,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive caption color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #inactiveCaption
*/
@@ -112,7 +112,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive caption text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #inactiveCaptionText
*/
@@ -120,7 +120,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive caption border color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #inactiveCaptionBorder
*/
@@ -128,7 +128,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the window background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #window
*/
@@ -136,7 +136,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the window border color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #windowBorder
*/
@@ -144,7 +144,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the window text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #windowText
*/
@@ -152,7 +152,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the menu background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #menu
*/
@@ -160,7 +160,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the menu text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #menuText
*/
@@ -168,7 +168,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the text background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #text
*/
@@ -176,7 +176,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the text foreground color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textText
*/
@@ -184,7 +184,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the highlighted text background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textHighlight
*/
@@ -192,7 +192,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the highlighted text foreground color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textHighlightText
*/
@@ -200,7 +200,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the inactive text foreground color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #textInactiveText
*/
@@ -208,7 +208,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #control
*/
@@ -216,7 +216,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the control text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlText
*/
@@ -224,7 +224,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the highlighted control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlHighlight
*/
@@ -232,7 +232,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the lightly highlighted control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlLtHighlight
*/
@@ -240,7 +240,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the shadowed control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlShadow
*/
@@ -248,7 +248,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the darkly shadowed control background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #controlDkShadow
*/
@@ -256,7 +256,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the scrollbar background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #scrollbar
*/
@@ -264,7 +264,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the info background color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #info
*/
@@ -272,7 +272,7 @@ public final class SystemColor extends Color implements Serializable
/**
* Array index of the info text color. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*
* @see #infoText
*/
@@ -280,7 +280,7 @@ public final class SystemColor extends Color implements Serializable
/**
* The number of system colors. Used by
- * {@link Toolkit#loadSystemColors()}.
+ * {@link Toolkit#loadSystemColors(int[])}.
*/
public static final int NUM_COLORS = 26;
diff --git a/java/awt/TextArea.java b/java/awt/TextArea.java
index 6355376df..ad246dede 100644
--- a/java/awt/TextArea.java
+++ b/java/awt/TextArea.java
@@ -1,45 +1,46 @@
/* TextArea.java -- A multi-line text entry component
Copyright (C) 1999, 2004 Free Software Foundation, Inc.
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
package java.awt;
+import java.awt.event.KeyEvent;
import java.awt.peer.ComponentPeer;
import java.awt.peer.TextAreaPeer;
-import java.awt.event.KeyEvent;
import java.util.HashSet;
import java.util.Set;
diff --git a/java/awt/TextField.java b/java/awt/TextField.java
index 1a783e27a..65a4790a9 100644
--- a/java/awt/TextField.java
+++ b/java/awt/TextField.java
@@ -1,5 +1,5 @@
/* TextField.java -- A one line text entry field
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,8 +40,8 @@ package java.awt;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.awt.peer.TextFieldPeer;
import java.awt.peer.ComponentPeer;
+import java.awt.peer.TextFieldPeer;
import java.util.EventListener;
/**
diff --git a/java/awt/Toolkit.java b/java/awt/Toolkit.java
index 2ee3f5089..b125263eb 100644
--- a/java/awt/Toolkit.java
+++ b/java/awt/Toolkit.java
@@ -53,8 +53,8 @@ import java.awt.image.ImageObserver;
import java.awt.image.ImageProducer;
import java.awt.peer.ButtonPeer;
import java.awt.peer.CanvasPeer;
-import java.awt.peer.CheckboxPeer;
import java.awt.peer.CheckboxMenuItemPeer;
+import java.awt.peer.CheckboxPeer;
import java.awt.peer.ChoicePeer;
import java.awt.peer.DialogPeer;
import java.awt.peer.FileDialogPeer;
@@ -63,13 +63,13 @@ import java.awt.peer.FramePeer;
import java.awt.peer.LabelPeer;
import java.awt.peer.LightweightPeer;
import java.awt.peer.ListPeer;
-import java.awt.peer.MenuPeer;
import java.awt.peer.MenuBarPeer;
import java.awt.peer.MenuItemPeer;
+import java.awt.peer.MenuPeer;
import java.awt.peer.PanelPeer;
import java.awt.peer.PopupMenuPeer;
-import java.awt.peer.ScrollbarPeer;
import java.awt.peer.ScrollPanePeer;
+import java.awt.peer.ScrollbarPeer;
import java.awt.peer.TextAreaPeer;
import java.awt.peer.TextFieldPeer;
import java.awt.peer.WindowPeer;
diff --git a/java/awt/Window.java b/java/awt/Window.java
index 7397a1c1c..b265da25e 100644
--- a/java/awt/Window.java
+++ b/java/awt/Window.java
@@ -1,5 +1,5 @@
/* Window.java --
- Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -48,11 +48,12 @@ import java.awt.event.WindowStateListener;
import java.awt.peer.WindowPeer;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
-import java.util.Iterator;
import java.util.EventListener;
+import java.util.Iterator;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.Vector;
+
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
@@ -291,7 +292,7 @@ public class Window extends Container implements Accessible
initialFocusOwner = policy.getInitialComponent (this);
if (initialFocusOwner != null)
- initialFocusOwner.requestFocusInWindow (false);
+ initialFocusOwner.requestFocusInWindow ();
shown = true;
}
diff --git a/java/awt/color/ICC_Profile.java b/java/awt/color/ICC_Profile.java
index eb534ebff..b9ea5ed9f 100644
--- a/java/awt/color/ICC_Profile.java
+++ b/java/awt/color/ICC_Profile.java
@@ -40,8 +40,8 @@ package java.awt.color;
import java.io.FileInputStream;
import java.io.FileOutputStream;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.ObjectStreamException;
diff --git a/java/awt/datatransfer/Clipboard.java b/java/awt/datatransfer/Clipboard.java
index 93bba7c1a..ca9b6ebdb 100644
--- a/java/awt/datatransfer/Clipboard.java
+++ b/java/awt/datatransfer/Clipboard.java
@@ -39,102 +39,76 @@ exception statement from your version. */
package java.awt.datatransfer;
/**
- * This class allows data to be transferred using a cut and paste type
- * mechanism.
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class Clipboard
-{
-
-/*
- * Instance Variables
- */
-
-/**
- * The data being transferred.
- */
-protected Transferable contents;
-
-/**
- * The owner of this clipboard.
- */
-protected ClipboardOwner owner;
-
-// The clipboard name
-private String name;
-
-/*************************************************************************/
-
-/*
- * Constructors
- */
-
-/**
- * Initializes a new instance of <code>Clipboard</code> with the
- * specified name.
- *
- * @param name The clipboard name.
- */
-public
-Clipboard(String name)
-{
- this.name = name;
-}
-
-/*************************************************************************/
-
-/*
- * Instance Methods
+ * This class allows data to be transferred using a cut and paste type
+ * mechanism.
+ *
+ * @author Aaron M. Renn (arenn@urbanophile.com)
*/
-
-/**
- * Returns the name of the clipboard.
- */
-public String
-getName()
-{
- return(name);
-}
-
-/*************************************************************************/
-
-/**
- * Returns the contents of the clipboard.
- *
- * @param requestor The object requesting the contents.
- *
- * @exception IllegalStateException If the clipboard is currently unavailable
- */
-public synchronized Transferable
-getContents(Object requestor)
-{
- return(contents);
-}
-
-/*************************************************************************/
-
-/**
- * Sets the content and owner of this clipboard.
- * If the given owner is different from the current owner
- * then lostOwnership is called on the current owner.
- * XXX - is this called with the old or new contents.
- *
- * @param contents The new clipboard contents.
- * @param owner The new clipboard owner
- *
- * @exception IllegalStateException If the clipboard is currently unavailable
- */
-public synchronized void
-setContents(Transferable contents, ClipboardOwner owner)
+public class Clipboard
{
- if (this.owner != owner)
- if (this.owner != null)
- this.owner.lostOwnership(this, contents);
+ /**
+ * The data being transferred.
+ */
+ protected Transferable contents;
+
+ /**
+ * The owner of this clipboard.
+ */
+ protected ClipboardOwner owner;
+
+ // The clipboard name
+ private String name;
+
+ /**
+ * Initializes a new instance of <code>Clipboard</code> with the
+ * specified name.
+ *
+ * @param name The clipboard name.
+ */
+ public Clipboard(String name)
+ {
+ this.name = name;
+ }
+
+ /**
+ * Returns the name of the clipboard.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Returns the contents of the clipboard.
+ *
+ * @param requestor The object requesting the contents.
+ *
+ * @exception IllegalStateException If the clipboard is currently unavailable
+ */
+ public synchronized Transferable getContents(Object requestor)
+ {
+ return contents;
+ }
+
+ /**
+ * Sets the content and owner of this clipboard.
+ * If the given owner is different from the current owner
+ * then lostOwnership is called on the current owner.
+ * XXX - is this called with the old or new contents.
+ *
+ * @param contents The new clipboard contents.
+ * @param owner The new clipboard owner
+ *
+ * @exception IllegalStateException If the clipboard is currently unavailable
+ */
+ public synchronized void setContents(Transferable contents, ClipboardOwner owner)
+ {
+ if (this.owner != owner)
+ if (this.owner != null)
+ this.owner.lostOwnership(this, contents);
- this.owner = owner;
- this.contents = contents;
+ this.owner = owner;
+ this.contents = contents;
+ }
}
-} // class Clipboard
-
diff --git a/java/awt/datatransfer/ClipboardOwner.java b/java/awt/datatransfer/ClipboardOwner.java
index 28e58aae1..b5ca9e37d 100644
--- a/java/awt/datatransfer/ClipboardOwner.java
+++ b/java/awt/datatransfer/ClipboardOwner.java
@@ -53,6 +53,5 @@ public interface ClipboardOwner
* @param contents The contents of the clipboard which are no longer owned.
*/
void lostOwnership (Clipboard clipboard, Transferable contents);
-
-} // interface ClipboardOwner
+}
diff --git a/java/awt/datatransfer/DataFlavor.java b/java/awt/datatransfer/DataFlavor.java
index 3ec219119..7a9eb7169 100644
--- a/java/awt/datatransfer/DataFlavor.java
+++ b/java/awt/datatransfer/DataFlavor.java
@@ -39,11 +39,11 @@ exception statement from your version. */
package java.awt.datatransfer;
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-import java.io.IOException;
-import java.io.ObjectOutput;
import java.io.ObjectInput;
+import java.io.ObjectOutput;
import java.io.Reader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
diff --git a/java/awt/datatransfer/StringSelection.java b/java/awt/datatransfer/StringSelection.java
index 51addb729..7d27db034 100644
--- a/java/awt/datatransfer/StringSelection.java
+++ b/java/awt/datatransfer/StringSelection.java
@@ -1,5 +1,5 @@
/* StringSelection.java -- Clipboard handler for text.
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt.datatransfer;
-import java.io.StringReader;
import java.io.IOException;
+import java.io.StringReader;
/**
* This class transfers a string as plain text using the clipboard.
diff --git a/java/awt/datatransfer/SystemFlavorMap.java b/java/awt/datatransfer/SystemFlavorMap.java
index 7d914120e..826992b7c 100644
--- a/java/awt/datatransfer/SystemFlavorMap.java
+++ b/java/awt/datatransfer/SystemFlavorMap.java
@@ -1,5 +1,5 @@
/* SystemFlavorMap.java -- Maps between native flavor names and MIME types.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,8 @@ exception statement from your version. */
package java.awt.datatransfer;
import java.util.HashMap;
-import java.util.Map;
import java.util.List;
+import java.util.Map;
/**
* This class maps between native platform type names and DataFlavors.
diff --git a/java/awt/dnd/Autoscroll.java b/java/awt/dnd/Autoscroll.java
index 5c5233874..ae868c077 100644
--- a/java/awt/dnd/Autoscroll.java
+++ b/java/awt/dnd/Autoscroll.java
@@ -1,5 +1,5 @@
/* Autoscroll.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,10 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.dnd;
-import java.awt.Point;
import java.awt.Insets;
+import java.awt.Point;
/**
* During DnD operations it is possible that a user may wish to drop the
diff --git a/java/awt/dnd/DropTarget.java b/java/awt/dnd/DropTarget.java
index 4063e206a..7379ca71c 100644
--- a/java/awt/dnd/DropTarget.java
+++ b/java/awt/dnd/DropTarget.java
@@ -1,5 +1,5 @@
/* DropTarget.java --
- Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,13 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.dnd;
-import java.awt.Point;
import java.awt.Component;
import java.awt.GraphicsEnvironment;
import java.awt.HeadlessException;
+import java.awt.Point;
import java.awt.datatransfer.FlavorMap;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
diff --git a/java/awt/dnd/DropTargetContext.java b/java/awt/dnd/DropTargetContext.java
index 7bf77ffe6..7e78869ac 100644
--- a/java/awt/dnd/DropTargetContext.java
+++ b/java/awt/dnd/DropTargetContext.java
@@ -1,5 +1,5 @@
/* DropTargetContext.java --
- Copyright (C) 2002, 2003, 2005 Free Software Foundation
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,12 +37,12 @@ exception statement from your version. */
package java.awt.dnd;
-import java.io.Serializable;
-import java.io.IOException;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
+import java.io.IOException;
+import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
diff --git a/java/awt/dnd/DropTargetDragEvent.java b/java/awt/dnd/DropTargetDragEvent.java
index e95b2d1ae..d4a13ea46 100644
--- a/java/awt/dnd/DropTargetDragEvent.java
+++ b/java/awt/dnd/DropTargetDragEvent.java
@@ -1,5 +1,5 @@
/* DropTargetDragEvent.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,12 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.dnd;
-import java.util.List;
import java.awt.Point;
import java.awt.datatransfer.DataFlavor;
+import java.util.List;
/**
* @since 1.2
diff --git a/java/awt/dnd/package.html b/java/awt/dnd/package.html
index 52a36c43e..4b2341331 100644
--- a/java/awt/dnd/package.html
+++ b/java/awt/dnd/package.html
@@ -1,6 +1,6 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!-- package.html - describes classes in java.awt.dnd package.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,7 +40,7 @@ exception statement from your version. -->
<head><title>GNU Classpath - java.awt.dnd</title></head>
<body>
-<p>Events and listerners for drag and drop sources and targets.</p>
+<p>Events and listeners for drag and drop sources and targets.</p>
</body>
</html>
diff --git a/java/awt/dnd/peer/DropTargetContextPeer.java b/java/awt/dnd/peer/DropTargetContextPeer.java
index 239a43778..a2e3ba218 100644
--- a/java/awt/dnd/peer/DropTargetContextPeer.java
+++ b/java/awt/dnd/peer/DropTargetContextPeer.java
@@ -1,5 +1,5 @@
/* DropTargetContextPeer.java -- interface for drag-and-drop peers
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,11 +35,12 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.dnd.peer;
-import java.awt.dnd.DropTarget;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
+import java.awt.dnd.DropTarget;
import java.awt.dnd.InvalidDnDOperationException;
diff --git a/java/awt/event/AdjustmentEvent.java b/java/awt/event/AdjustmentEvent.java
index 48b208b5d..623dab5ea 100644
--- a/java/awt/event/AdjustmentEvent.java
+++ b/java/awt/event/AdjustmentEvent.java
@@ -1,5 +1,5 @@
/* AdjustmentEvent.java -- an adjustable value was changed
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt.event;
-import java.awt.Adjustable;
import java.awt.AWTEvent;
+import java.awt.Adjustable;
/**
* This class represents an event that is generated when an adjustable
diff --git a/java/awt/event/InputEvent.java b/java/awt/event/InputEvent.java
index 1689e5114..169982cd2 100644
--- a/java/awt/event/InputEvent.java
+++ b/java/awt/event/InputEvent.java
@@ -1,5 +1,5 @@
/* InputEvent.java -- common superclass of component input events
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,9 +38,10 @@ exception statement from your version. */
package java.awt.event;
-import java.awt.Component;
import gnu.java.awt.EventModifier;
+import java.awt.Component;
+
/**
* This is the common superclass for all component input classes. These are
* passed to listeners before the component, so that listeners can consume
diff --git a/java/awt/event/InvocationEvent.java b/java/awt/event/InvocationEvent.java
index 76d4a5582..fb58595c7 100644
--- a/java/awt/event/InvocationEvent.java
+++ b/java/awt/event/InvocationEvent.java
@@ -1,5 +1,5 @@
/* InvocationEvent.java -- call a runnable when dispatched
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,8 @@ exception statement from your version. */
package java.awt.event;
-import java.awt.ActiveEvent;
import java.awt.AWTEvent;
+import java.awt.ActiveEvent;
import java.awt.EventQueue;
/**
diff --git a/java/awt/event/KeyEvent.java b/java/awt/event/KeyEvent.java
index 455d7ee52..7212c0c97 100644
--- a/java/awt/event/KeyEvent.java
+++ b/java/awt/event/KeyEvent.java
@@ -1,5 +1,5 @@
/* KeyEvent.java -- event for key presses
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,10 +38,11 @@ exception statement from your version. */
package java.awt.event;
+import gnu.java.awt.EventModifier;
+
import java.awt.Component;
import java.io.IOException;
import java.io.ObjectInputStream;
-import gnu.java.awt.EventModifier;
/**
* This event is generated when a key is pressed or released. There are two
diff --git a/java/awt/event/MouseEvent.java b/java/awt/event/MouseEvent.java
index ac8804c24..7f3e014a2 100644
--- a/java/awt/event/MouseEvent.java
+++ b/java/awt/event/MouseEvent.java
@@ -1,5 +1,5 @@
/* MouseEvent.java -- a mouse event
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,12 @@ exception statement from your version. */
package java.awt.event;
+import gnu.java.awt.EventModifier;
+
import java.awt.Component;
import java.awt.Point;
import java.io.IOException;
import java.io.ObjectInputStream;
-import gnu.java.awt.EventModifier;
/**
* This event is generated for a mouse event. There are three main categories
diff --git a/java/awt/font/TextLayout.java b/java/awt/font/TextLayout.java
index b58b5a583..aecbbe085 100644
--- a/java/awt/font/TextLayout.java
+++ b/java/awt/font/TextLayout.java
@@ -1,5 +1,5 @@
/* TextLayout.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -43,12 +43,10 @@ import java.awt.Graphics2D;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Rectangle2D;
-import java.text.CharacterIterator;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;
+import java.text.CharacterIterator;
import java.util.Map;
-import java.awt.font.TextAttribute;
-
/**
* @author Michael Koch
diff --git a/java/awt/geom/Arc2D.java b/java/awt/geom/Arc2D.java
index 8d8e9dead..5e6d191f0 100644
--- a/java/awt/geom/Arc2D.java
+++ b/java/awt/geom/Arc2D.java
@@ -569,40 +569,83 @@ public abstract class Arc2D extends RectangularShape
|| contains(x + w, y + h))
return true;
- double mx = getX() + getWidth() / 2;
- double my = getY() + getHeight() / 2;
- double x1 = mx
- + getWidth() * Math.cos(Math.toRadians(getAngleStart())) / 2;
- double y1 = my
- - getHeight() * Math.sin(Math.toRadians(getAngleStart())) / 2;
- double x2 = mx
- + getWidth() * Math.cos(Math.toRadians(getAngleStart()
- + extent)) / 2;
- double y2 = my
- - getHeight() * Math.sin(Math.toRadians(getAngleStart()
- + extent)) / 2;
+ Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
+
+ double a = getWidth() / 2.0;
+ double b = getHeight() / 2.0;
+
+ double mx = getX() + a;
+ double my = getY() + b;
+ double x1 = mx + a * Math.cos(Math.toRadians(getAngleStart()));
+ double y1 = my - b * Math.sin(Math.toRadians(getAngleStart()));
+ double x2 = mx + a * Math.cos(Math.toRadians(getAngleStart() + extent));
+ double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
+
if (getArcType() != CHORD)
{
// check intersections against the pie radii
- if (Line2D.linesIntersect(mx, my, x1, y1, x, y, x + w, y)
- || Line2D.linesIntersect(mx, my, x1, y1, x + w, y, x + w, y + h)
- || Line2D.linesIntersect(mx, my, x1, y1, x, y, x, y + h)
- || Line2D.linesIntersect(mx, my, x1, y1, x, y + h, x + w, y + h))
+ if (rect.intersectsLine(mx, my, x1, y1))
return true;
-
- if (Line2D.linesIntersect(mx, my, x2, y2, x, y, x + w, y)
- || Line2D.linesIntersect(mx, my, x2, y2, x + w, y, x + w, y + h)
- || Line2D.linesIntersect(mx, my, x2, y2, x, y, x, y + h)
- || Line2D.linesIntersect(mx, my, x2, y2, x, y + h, x + w, y + h))
+ if (rect.intersectsLine(mx, my, x2, y2))
return true;
}
- else if (Line2D.linesIntersect(x1, y1, x2, y2, x, y, x + w, y)
- || Line2D.linesIntersect(x1, y1, x2, y2, x + w, y, x + w, y + h)
- || Line2D.linesIntersect(x1, y1, x2, y2, x, y, x, y + h)
- || Line2D.linesIntersect(x1, y1, x2, y2, x, y + h, x + w, y + h))
+ else// check the chord
+ if (rect.intersectsLine(x1, y1, x2, y2))
return true;
- if ((new Rectangle2D.Double(x, y, w, h)).contains(x1, y1))
+ // Check the Arc segment against the four edges
+ double dx;
+
+ // Check the Arc segment against the four edges
+ double dy;
+ dy = y - my;
+ dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
+ if (! java.lang.Double.isNaN(dx))
+ {
+ if (mx + dx >= x && mx + dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (mx - dx >= x && mx - dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
+ return true;
+ }
+ dy = (y + h) - my;
+ dx = a * Math.sqrt(1 - ((dy * dy) / (b * b)));
+ if (! java.lang.Double.isNaN(dx))
+ {
+ if (mx + dx >= x && mx + dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (mx - dx >= x && mx - dx <= x + w
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, -dx))))
+ return true;
+ }
+ dx = x - mx;
+ dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
+ if (! java.lang.Double.isNaN(dy))
+ {
+ if (my + dy >= y && my + dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (my - dy >= y && my - dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
+ return true;
+ }
+
+ dx = (x + w) - mx;
+ dy = b * Math.sqrt(1 - ((dx * dx) / (a * a)));
+ if (! java.lang.Double.isNaN(dy))
+ {
+ if (my + dy >= y && my + dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(-dy, dx))))
+ return true;
+ if (my - dy >= y && my - dy <= y + h
+ && containsAngle(Math.toDegrees(Math.atan2(dy, dx))))
+ return true;
+ }
+
+ // Check whether the arc is contained within the box
+ if (rect.contains(mx, my))
return true;
return false;
@@ -627,37 +670,27 @@ public abstract class Arc2D extends RectangularShape
&& contains(x + w, y + h)))
return false;
- double mx = getX() + getWidth() / 2;
- double my = getY() + getHeight() / 2;
- double x1 = mx
- + getWidth() * Math.cos(Math.toRadians(getAngleStart())) / 2;
- double y1 = my
- - getHeight() * Math.sin(Math.toRadians(getAngleStart())) / 2;
- double x2 = mx
- + getWidth() * Math.cos(Math.toRadians(getAngleStart()
- + extent)) / 2;
- double y2 = my
- - getHeight() * Math.sin(Math.toRadians(getAngleStart()
- + extent)) / 2;
+ Rectangle2D rect = new Rectangle2D.Double(x, y, w, h);
+
+ double a = getWidth() / 2.0;
+ double b = getHeight() / 2.0;
+
+ double mx = getX() + a;
+ double my = getY() + b;
+ double x1 = mx + a * Math.cos(Math.toRadians(getAngleStart()));
+ double y1 = my - b * Math.sin(Math.toRadians(getAngleStart()));
+ double x2 = mx + a * Math.cos(Math.toRadians(getAngleStart() + extent));
+ double y2 = my - b * Math.sin(Math.toRadians(getAngleStart() + extent));
if (getArcType() != CHORD)
{
// check intersections against the pie radii
- if (Line2D.linesIntersect(mx, my, x1, y1, x, y, x + w, y)
- || Line2D.linesIntersect(mx, my, x1, y1, x + w, y, x + w, y + h)
- || Line2D.linesIntersect(mx, my, x1, y1, x, y, x, y + h)
- || Line2D.linesIntersect(mx, my, x1, y1, x, y + h, x + w, y + h))
+ if (rect.intersectsLine(mx, my, x1, y1))
return false;
- if (Line2D.linesIntersect(mx, my, x2, y2, x, y, x + w, y)
- || Line2D.linesIntersect(mx, my, x2, y2, x + w, y, x + w, y + h)
- || Line2D.linesIntersect(mx, my, x2, y2, x, y, x, y + h)
- || Line2D.linesIntersect(mx, my, x2, y2, x, y + h, x + w, y + h))
+ if (rect.intersectsLine(mx, my, x2, y2))
return false;
}
- else if (Line2D.linesIntersect(x1, y1, x2, y2, x, y, x + w, y)
- || Line2D.linesIntersect(x1, y1, x2, y2, x + w, y, x + w, y + h)
- || Line2D.linesIntersect(x1, y1, x2, y2, x, y, x, y + h)
- || Line2D.linesIntersect(x1, y1, x2, y2, x, y + h, x + w, y + h))
+ else if (rect.intersectsLine(x1, y1, x2, y2))
return false;
return true;
}
diff --git a/java/awt/geom/Area.java b/java/awt/geom/Area.java
index 1297a0e01..705699567 100644
--- a/java/awt/geom/Area.java
+++ b/java/awt/geom/Area.java
@@ -124,6 +124,10 @@ public class Area implements Shape, Cloneable
* of non-self-intersecting subpaths, and any inner paths which
* are found redundant in accordance with the Shape's winding rule
* will not be included.
+ *
+ * @param s the shape (<code>null</code> not permitted).
+ *
+ * @throws NullPointerException if <code>s</code> is <code>null</code>.
*/
public Area(Shape s)
{
@@ -261,7 +265,8 @@ public class Area implements Shape, Cloneable
/**
* Performs a subtraction operation on this Area.<BR>
- * @param area - the area to be subtracted from this area.
+ * @param area the area to be subtracted from this area.
+ * @throws NullPointerException if <code>area</code> is <code>null</code>.
*/
public void subtract(Area area)
{
@@ -357,6 +362,7 @@ public class Area implements Shape, Cloneable
/**
* Performs an intersection operation on this Area.<BR>
* @param area - the area to be intersected with this area.
+ * @throws NullPointerException if <code>area</code> is <code>null</code>.
*/
public void intersect(Area area)
{
@@ -448,6 +454,7 @@ public class Area implements Shape, Cloneable
/**
* Performs an exclusive-or operation on this Area.<BR>
* @param area - the area to be XORed with this area.
+ * @throws NullPointerException if <code>area</code> is <code>null</code>.
*/
public void exclusiveOr(Area area)
{
@@ -584,6 +591,9 @@ public class Area implements Shape, Cloneable
*/
public boolean isRectangular()
{
+ if (isEmpty())
+ return true;
+
if (holes.size() != 0 || solids.size() != 1)
return false;
@@ -663,6 +673,8 @@ public class Area implements Shape, Cloneable
/**
* Returns the bounds of this object in Rectangle format.
* Please note that this may lead to loss of precision.
+ *
+ * @return The bounds.
* @see #getBounds2D()
*/
public Rectangle getBounds()
@@ -695,11 +707,17 @@ public class Area implements Shape, Cloneable
/**
* Compares two Areas.
- *
- * @return true if the areas are equal. False otherwise.
+ *
+ * @param area the area to compare against this area (<code>null</code>
+ * permitted).
+ * @return <code>true</code> if the areas are equal, and <code>false</code>
+ * otherwise.
*/
public boolean equals(Area area)
{
+ if (area == null)
+ return false;
+
if (! getBounds2D().equals(area.getBounds2D()))
return false;
@@ -736,7 +754,9 @@ public class Area implements Shape, Cloneable
}
/**
- * Transforms this area by the AffineTransform at
+ * Transforms this area by the AffineTransform at.
+ *
+ * @param at the transform.
*/
public void transform(AffineTransform at)
{
@@ -755,8 +775,10 @@ public class Area implements Shape, Cloneable
/**
* Returns a new Area equal to this one, transformed
- * by the AffineTransform at
+ * by the AffineTransform at.
+ * @param at the transform.
* @return the transformed area
+ * @throws NullPointerException if <code>at</code> is <code>null</code>.
*/
public Area createTransformedArea(AffineTransform at)
{
@@ -768,6 +790,8 @@ public class Area implements Shape, Cloneable
/**
* Determines if the point (x,y) is contained within this Area.
*
+ * @param x the x-coordinate of the point.
+ * @param y the y-coordinate of the point.
* @return true if the point is contained, false otherwise.
*/
public boolean contains(double x, double y)
@@ -787,7 +811,10 @@ public class Area implements Shape, Cloneable
/**
* Determines if the Point2D p is contained within this Area.
*
- * @return true if the point is contained, false otherwise.
+ * @param p the point.
+ * @return <code>true</code> if the point is contained, <code>false</code>
+ * otherwise.
+ * @throws NullPointerException if <code>p</code> is <code>null</code>.
*/
public boolean contains(Point2D p)
{
@@ -801,7 +828,12 @@ public class Area implements Shape, Cloneable
*
* This method should always produce the correct results, unlike for other
* classes in geom.
- * @return true if the rectangle is considered contained
+ *
+ * @param x the x-coordinate of the rectangle.
+ * @param y the y-coordinate of the rectangle.
+ * @param w the width of the the rectangle.
+ * @param h the height of the rectangle.
+ * @return <code>true</code> if the rectangle is considered contained
*/
public boolean contains(double x, double y, double w, double h)
{
@@ -853,7 +885,7 @@ public class Area implements Shape, Cloneable
Rectangle2D r = new Rectangle2D.Double(x, y, w, h);
for (int path = 0; path < holes.size(); path++)
if (! ((Segment) holes.elementAt(path)).isSegmentOutside(r))
- return false;
+ return false;
return true;
}
@@ -864,7 +896,11 @@ public class Area implements Shape, Cloneable
*
* This method should always produce the correct results, unlike for other
* classes in geom.
- * @return true if the rectangle is considered contained
+ *
+ * @param r the rectangle.
+ * @return <code>true</code> if the rectangle is considered contained
+ *
+ * @throws NullPointerException if <code>r</code> is <code>null</code>.
*/
public boolean contains(Rectangle2D r)
{
@@ -874,7 +910,13 @@ public class Area implements Shape, Cloneable
/**
* Determines if the rectangle specified by (x,y) as the upper-left
* and with width w and height h intersects any part of this Area.
- * @return true if the rectangle intersects the area, false otherwise.
+ *
+ * @param x the x-coordinate for the rectangle.
+ * @param y the y-coordinate for the rectangle.
+ * @param w the width of the rectangle.
+ * @param h the height of the rectangle.
+ * @return <code>true</code> if the rectangle intersects the area,
+ * <code>false</code> otherwise.
*/
public boolean intersects(double x, double y, double w, double h)
{
@@ -919,7 +961,7 @@ public class Area implements Shape, Cloneable
}
// Non-intersecting, Is any point inside?
- if (contains(x, y))
+ if (contains(x + w * 0.5, y + h * 0.5))
return true;
// What if the rectangle encloses the whole shape?
@@ -932,7 +974,11 @@ public class Area implements Shape, Cloneable
/**
* Determines if the Rectangle2D specified by r intersects any
* part of this Area.
- * @return true if the rectangle intersects the area, false otherwise.
+ * @param r the rectangle to test intersection with (<code>null</code>
+ * not permitted).
+ * @return <code>true</code> if the rectangle intersects the area,
+ * <code>false</code> otherwise.
+ * @throws NullPointerException if <code>r</code> is <code>null</code>.
*/
public boolean intersects(Rectangle2D r)
{
@@ -942,24 +988,31 @@ public class Area implements Shape, Cloneable
/**
* Returns a PathIterator object defining the contour of this Area,
* transformed by at.
+ *
+ * @param at the transform.
+ * @return A path iterator.
*/
public PathIterator getPathIterator(AffineTransform at)
{
return (new AreaIterator(at));
}
- //---------------------------------------------------------------------
- // Non-public methods and classes
-
/**
* Returns a flattened PathIterator object defining the contour of this
* Area, transformed by at and with a defined flatness.
+ *
+ * @param at the transform.
+ * @param flatness the flatness.
+ * @return A path iterator.
*/
public PathIterator getPathIterator(AffineTransform at, double flatness)
{
return new FlatteningPathIterator(getPathIterator(at), flatness);
}
+ //---------------------------------------------------------------------
+ // Non-public methods and classes
+
/**
* Private pathiterator object.
*/
@@ -2515,12 +2568,13 @@ public class Area implements Shape, Cloneable
return 0;
if (y0 == 0.0)
- y0 += EPSILON;
+ y0 -= EPSILON;
if (y1 == 0.0)
- y1 += EPSILON;
+ y1 -= EPSILON;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, Double.MAX_VALUE, 0.0))
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ EPSILON, 0.0, Double.MAX_VALUE, 0.0))
return 1;
return 0;
}
@@ -2727,9 +2781,9 @@ public class Area implements Shape, Cloneable
if ((x0 > 0.0 || x1 > 0.0 || x2 > 0.0) && (y0 * y1 <= 0 || y1 * y2 <= 0))
{
if (y0 == 0.0)
- y0 += EPSILON;
+ y0 -= EPSILON;
if (y2 == 0.0)
- y2 += EPSILON;
+ y2 -= EPSILON;
r[0] = y0;
r[1] = 2 * (y1 - y0);
@@ -3139,9 +3193,9 @@ public class Area implements Shape, Cloneable
&& (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
{
if (y0 == 0.0)
- y0 += EPSILON;
+ y0 -= EPSILON;
if (y3 == 0.0)
- y3 += EPSILON;
+ y3 -= EPSILON;
r[0] = y0;
r[1] = 3 * (y1 - y0);
diff --git a/java/awt/geom/CubicCurve2D.java b/java/awt/geom/CubicCurve2D.java
index 56b90e998..20373061d 100644
--- a/java/awt/geom/CubicCurve2D.java
+++ b/java/awt/geom/CubicCurve2D.java
@@ -59,6 +59,7 @@ import java.util.NoSuchElementException;
public abstract class CubicCurve2D implements Shape, Cloneable
{
private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
+ private static final double EPSILON = 1E-10;
/**
* Constructs a new CubicCurve2D. Typical users will want to
@@ -1089,21 +1090,21 @@ public abstract class CubicCurve2D implements Shape, Cloneable
If this is not done, bad behaviour may result for points on that axis.*/
if (a0 == 0.0 || a3 == 0.0)
{
- double small = getFlatness() * (1E-10);
+ double small = getFlatness() * EPSILON;
if (a0 == 0.0)
- a0 += small;
+ a0 -= small;
if (a3 == 0.0)
- a3 += small;
+ a3 -= small;
}
if (useYaxis)
{
- if (Line2D.linesIntersect(b0, a0, b3, a3, 0.0, 0.0, distance, 0.0))
+ if (Line2D.linesIntersect(b0, a0, b3, a3, EPSILON, 0.0, distance, 0.0))
nCrossings++;
}
else
{
- if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, 0.0, 0.0, distance))
+ if (Line2D.linesIntersect(a0, b0, a3, b3, 0.0, EPSILON, 0.0, distance))
nCrossings++;
}
diff --git a/java/awt/geom/Ellipse2D.java b/java/awt/geom/Ellipse2D.java
index 209a2184b..bd64adf1e 100644
--- a/java/awt/geom/Ellipse2D.java
+++ b/java/awt/geom/Ellipse2D.java
@@ -101,6 +101,9 @@ public abstract class Ellipse2D extends RectangularShape
* Note: An ellipse cannot be represented exactly in PathIterator
* segments, the outline is thefore approximated with cubic
* Bezier segments.
+ *
+ * @param at an optional transform.
+ * @return A path iterator.
*/
public PathIterator getPathIterator(AffineTransform at)
{
@@ -139,6 +142,10 @@ public abstract class Ellipse2D extends RectangularShape
return false;
}
+ /**
+ * An {@link Ellipse2D} that stores its coordinates using <code>double</code>
+ * primitives.
+ */
public static class Double extends Ellipse2D
{
/**
@@ -162,7 +169,7 @@ public abstract class Ellipse2D extends RectangularShape
public double y;
/**
- * Creates a new Ellipse2D with an upper-right coordinate of (0,0)
+ * Creates a new Ellipse2D with an upper-left coordinate of (0,0)
* and a zero size.
*/
public Double()
@@ -172,11 +179,10 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Creates a new Ellipse2D within a given rectangle
* using double-precision coordinates.<P>
- * @param x - x coordinate of the upper-right of the bounding rectangle
- * @param y - y coordinate of the upper-right of the bounding rectangle
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
* @param w - width of the ellipse
* @param h - height of the ellipse
- *
*/
public Double(double x, double y, double w, double h)
{
@@ -188,6 +194,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns the bounding-box of the ellipse.
+ * @return The bounding box.
*/
public Rectangle2D getBounds2D()
{
@@ -196,6 +203,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns the height of the ellipse.
+ * @return The height of the ellipse.
*/
public double getHeight()
{
@@ -204,6 +212,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns the width of the ellipse.
+ * @return The width of the ellipse.
*/
public double getWidth()
{
@@ -213,6 +222,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns x coordinate of the upper-left corner of
* the ellipse's bounding-box.
+ * @return The x coordinate.
*/
public double getX()
{
@@ -222,6 +232,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns y coordinate of the upper-left corner of
* the ellipse's bounding-box.
+ * @return The y coordinate.
*/
public double getY()
{
@@ -229,7 +240,10 @@ public abstract class Ellipse2D extends RectangularShape
}
/**
- * Returns true if the ellipse encloses any area.
+ * Returns <code>true</code> if the ellipse encloses no area, and
+ * <code>false</code> otherwise.
+ *
+ * @return A boolean.
*/
public boolean isEmpty()
{
@@ -239,8 +253,8 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Sets the geometry of the ellipse's bounding box.<P>
*
- * @param x - x coordinate of the upper-right of the bounding rectangle
- * @param y - y coordinate of the upper-right of the bounding rectangle
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
* @param w - width of the ellipse
* @param h - height of the ellipse
*/
@@ -253,6 +267,10 @@ public abstract class Ellipse2D extends RectangularShape
}
} // class Double
+ /**
+ * An {@link Ellipse2D} that stores its coordinates using <code>float</code>
+ * primitives.
+ */
public static class Float extends Ellipse2D
{
/**
@@ -276,7 +294,7 @@ public abstract class Ellipse2D extends RectangularShape
public float y;
/**
- * Creates a new Ellipse2D with an upper-right coordinate of (0,0)
+ * Creates a new Ellipse2D with an upper-left coordinate of (0,0)
* and a zero size.
*/
public Float()
@@ -286,8 +304,8 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Creates a new Ellipse2D within a given rectangle
* using floating-point precision.<P>
- * @param x - x coordinate of the upper-right of the bounding rectangle
- * @param y - y coordinate of the upper-right of the bounding rectangle
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
* @param w - width of the ellipse
* @param h - height of the ellipse
*
@@ -302,6 +320,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns the bounding-box of the ellipse.
+ * @return The bounding box.
*/
public Rectangle2D getBounds2D()
{
@@ -310,6 +329,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns the height of the ellipse.
+ * @return The height of the ellipse.
*/
public double getHeight()
{
@@ -318,6 +338,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns the width of the ellipse.
+ * @return The width of the ellipse.
*/
public double getWidth()
{
@@ -327,6 +348,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns x coordinate of the upper-left corner of
* the ellipse's bounding-box.
+ * @return The x coordinate.
*/
public double getX()
{
@@ -336,6 +358,7 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Returns y coordinate of the upper-left corner of
* the ellipse's bounding-box.
+ * @return The y coordinate.
*/
public double getY()
{
@@ -343,7 +366,10 @@ public abstract class Ellipse2D extends RectangularShape
}
/**
- * Returns true if the ellipse encloses any area.
+ * Returns <code>true</code> if the ellipse encloses no area, and
+ * <code>false</code> otherwise.
+ *
+ * @return A boolean.
*/
public boolean isEmpty()
{
@@ -353,8 +379,8 @@ public abstract class Ellipse2D extends RectangularShape
/**
* Sets the geometry of the ellipse's bounding box.<P>
*
- * @param x - x coordinate of the upper-right of the bounding rectangle
- * @param y - y coordinate of the upper-right of the bounding rectangle
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
* @param w - width of the ellipse
* @param h - height of the ellipse
*/
@@ -371,8 +397,8 @@ public abstract class Ellipse2D extends RectangularShape
*
* Note: This leads to a loss of precision.<P>
*
- * @param x - x coordinate of the upper-right of the bounding rectangle
- * @param y - y coordinate of the upper-right of the bounding rectangle
+ * @param x - x coordinate of the upper-left of the bounding rectangle
+ * @param y - y coordinate of the upper-left of the bounding rectangle
* @param w - width of the ellipse
* @param h - height of the ellipse
*/
diff --git a/java/awt/geom/GeneralPath.java b/java/awt/geom/GeneralPath.java
index 40182eabf..dfedb65bb 100644
--- a/java/awt/geom/GeneralPath.java
+++ b/java/awt/geom/GeneralPath.java
@@ -1,39 +1,40 @@
/* GeneralPath.java -- represents a shape built from subpaths
Copyright (C) 2002, 2003, 2004 Free Software Foundation
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
package java.awt.geom;
@@ -793,11 +794,11 @@ public final class GeneralPath implements Shape, Cloneable
y1 = firsty;
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y1 == 0.0)
- y1 += epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, distance,
- 0.0))
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
windingNumber += (y1 < y0) ? 1 : negative;
cx = firstx;
@@ -814,10 +815,11 @@ public final class GeneralPath implements Shape, Cloneable
y1 = firsty;
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y1 == 0.0)
- y1 += epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, distance, 0.0))
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
windingNumber += (y1 < y0) ? 1 : negative;
cx = firstx;
@@ -832,10 +834,11 @@ public final class GeneralPath implements Shape, Cloneable
y1 = ypoints[pos++] - (float) y;
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y1 == 0.0)
- y1 += epsilon;
- if (Line2D.linesIntersect(x0, y0, x1, y1, 0.0, 0.0, distance, 0.0))
+ y1 -= epsilon;
+ if (Line2D.linesIntersect(x0, y0, x1, y1,
+ epsilon, 0.0, distance, 0.0))
windingNumber += (y1 < y0) ? 1 : negative;
cx = xpoints[pos - 1] - (float) x;
@@ -854,9 +857,9 @@ public final class GeneralPath implements Shape, Cloneable
&& (y0 * y1 <= 0 || y1 * y2 <= 0))
{
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y2 == 0.0)
- y2 += epsilon;
+ y2 -= epsilon;
r[0] = y0;
r[1] = 2 * (y1 - y0);
@@ -897,9 +900,9 @@ public final class GeneralPath implements Shape, Cloneable
&& (y0 * y1 <= 0 || y1 * y2 <= 0 || y2 * y3 <= 0))
{
if (y0 == 0.0)
- y0 += epsilon;
+ y0 -= epsilon;
if (y3 == 0.0)
- y3 += epsilon;
+ y3 -= epsilon;
r[0] = y0;
r[1] = 3 * (y1 - y0);
@@ -942,3 +945,4 @@ public final class GeneralPath implements Shape, Cloneable
return (windingNumber);
}
} // class GeneralPath
+
diff --git a/java/awt/geom/PathIterator.java b/java/awt/geom/PathIterator.java
index 1fb0a46e0..8076b5c83 100644
--- a/java/awt/geom/PathIterator.java
+++ b/java/awt/geom/PathIterator.java
@@ -46,8 +46,8 @@ package java.awt.geom;
*
* @author Tom Tromey <tromey@cygnus.com>
* @author Eric Blake <ebb9@email.byu.edu>
- * @see Shape
- * @see Stroke
+ * @see java.awt.Shape
+ * @see java.awt.Stroke
* @see FlatteningPathIterator
* @since 1.2
* @status updated to 1.4
diff --git a/java/awt/geom/Point2D.java b/java/awt/geom/Point2D.java
index 48b12f67d..d27505fa4 100644
--- a/java/awt/geom/Point2D.java
+++ b/java/awt/geom/Point2D.java
@@ -1,5 +1,5 @@
/* Point2D.java -- generic point in 2-D space
- Copyright (C) 1999, 2000, 2002 Free Software Foundation
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.geom;
/**
@@ -42,8 +43,8 @@ package java.awt.geom;
* representation is left up to the subclass. Point includes two useful
* nested classes, for float and double storage respectively.
*
- * @author Per Bothner <bothner@cygnus.com>
- * @author Eric Blake <ebb9@email.byu.edu>
+ * @author Per Bothner (bothner@cygnus.com)
+ * @author Eric Blake (ebb9@email.byu.edu)
* @since 1.2
* @status updated to 1.4
*/
@@ -52,7 +53,7 @@ public abstract class Point2D implements Cloneable
/**
* The default constructor.
*
- * @see Point
+ * @see java.awt.Point
* @see Point2D.Float
* @see Point2D.Double
*/
@@ -120,7 +121,7 @@ public abstract class Point2D implements Cloneable
* @param y2 the y coordinate of point 2
* @return the distance from (x1,y1) to (x2,y2)
*/
- static public double distance(double x1, double y1, double x2, double y2)
+ public static double distance(double x1, double y1, double x2, double y2)
{
return Math.sqrt(distanceSq(x1, y1, x2, y2));
}
diff --git a/java/awt/geom/QuadCurve2D.java b/java/awt/geom/QuadCurve2D.java
index 0cc9eb46e..0376d5a01 100644
--- a/java/awt/geom/QuadCurve2D.java
+++ b/java/awt/geom/QuadCurve2D.java
@@ -59,6 +59,7 @@ import java.util.NoSuchElementException;
public abstract class QuadCurve2D implements Shape, Cloneable
{
private static final double BIG_VALUE = java.lang.Double.MAX_VALUE / 10.0;
+ private static final double EPSILON = 1E-10;
/**
* Constructs a new QuadCurve2D. Typical users will want to
@@ -962,12 +963,12 @@ public abstract class QuadCurve2D implements Shape, Cloneable
If this is not done,bad behaviour may result for points on that axis. */
if (a0 == 0.0 || a2 == 0.0)
{
- double small = getFlatness() * (1E-10);
+ double small = getFlatness() * EPSILON;
if (a0 == 0.0)
- a0 += small;
+ a0 -= small;
if (a2 == 0.0)
- a2 += small;
+ a2 -= small;
}
r[0] = a0;
@@ -990,12 +991,12 @@ public abstract class QuadCurve2D implements Shape, Cloneable
if (useYaxis)
{
- if (Line2D.linesIntersect(b0, a0, b2, a2, 0.0, 0.0, distance, 0.0))
+ if (Line2D.linesIntersect(b0, a0, b2, a2, EPSILON, 0.0, distance, 0.0))
nCrossings++;
}
else
{
- if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, 0.0, 0.0, distance))
+ if (Line2D.linesIntersect(a0, b0, a2, b2, 0.0, EPSILON, 0.0, distance))
nCrossings++;
}
diff --git a/java/awt/geom/Rectangle2D.java b/java/awt/geom/Rectangle2D.java
index 8203ca344..96baf336a 100644
--- a/java/awt/geom/Rectangle2D.java
+++ b/java/awt/geom/Rectangle2D.java
@@ -368,7 +368,7 @@ public abstract class Rectangle2D extends RectangularShape
*
* @param r the rectangle to add to this rectangle
* @throws NullPointerException if r is null
- * @see #union(Rectangle2D)
+ * @see #union(Rectangle2D, Rectangle2D, Rectangle2D)
*/
public void add(Rectangle2D r)
{
diff --git a/java/awt/im/InputContext.java b/java/awt/im/InputContext.java
index 1df1c9cd0..95d607113 100644
--- a/java/awt/im/InputContext.java
+++ b/java/awt/im/InputContext.java
@@ -1,5 +1,5 @@
/* InputContext.java -- provides the context for text input
- Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,22 +35,24 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.im;
+import gnu.java.util.EmptyEnumeration;
+
import java.awt.AWTEvent;
import java.awt.AWTException;
import java.awt.Component;
import java.awt.im.spi.InputMethod;
import java.awt.im.spi.InputMethodDescriptor;
import java.io.BufferedReader;
-import java.io.InputStreamReader;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Locale;
-import gnu.java.util.EmptyEnumeration;
/**
* Provides a context for controlling input methods and keyboard layouts.
diff --git a/java/awt/im/spi/InputMethodContext.java b/java/awt/im/spi/InputMethodContext.java
index c6f1faacc..73003f046 100644
--- a/java/awt/im/spi/InputMethodContext.java
+++ b/java/awt/im/spi/InputMethodContext.java
@@ -1,5 +1,5 @@
/* InputMethodContext.java -- communication between an input method and client
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,12 +35,14 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.im.spi;
import java.awt.Window;
import java.awt.font.TextHitInfo;
import java.awt.im.InputMethodRequests;
import java.text.AttributedCharacterIterator;
+
import javax.swing.JFrame;
/**
diff --git a/java/awt/image/AffineTransformOp.java b/java/awt/image/AffineTransformOp.java
index 6219635fa..45a896b31 100644
--- a/java/awt/image/AffineTransformOp.java
+++ b/java/awt/image/AffineTransformOp.java
@@ -1,6 +1,6 @@
/* AffineTransformOp.java -- This class performs affine
- * transformation between two images or rasters in 2
- * dimensions. Copyright (C) 2004 Free Software Foundation
+ transformation between two images or rasters in 2 dimensions.
+ Copyright (C) 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -38,11 +38,12 @@ exception statement from your version. */
package java.awt.image;
-import java.awt.*;
-import java.awt.Graphics;
import java.awt.Graphics2D;
-import java.awt.geom.*;
-
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
/**
* This class performs affine transformation between two images or
diff --git a/java/awt/image/BandedSampleModel.java b/java/awt/image/BandedSampleModel.java
new file mode 100644
index 000000000..cf5dcbac8
--- /dev/null
+++ b/java/awt/image/BandedSampleModel.java
@@ -0,0 +1,538 @@
+/* Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.awt.image;
+
+/**
+ * MultiPixelPackedSampleModel provides a single band model that supports
+ * multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
+ * per data element.
+ *
+ * @author Jerry Quinn <jlquinn@optonline.net>
+ */
+public final class BandedSampleModel extends ComponentSampleModel
+{
+ private int scanlineStride;
+ private int[] bitMasks;
+ private int[] bitOffsets;
+ private int[] sampleSize;
+ private int dataBitOffset;
+ private int elemBits;
+ private int numberOfBits;
+ private int numElems;
+
+ public BandedSampleModel(int dataType, int w, int h, int numBands)
+ {
+ super(dataType, w, h, 1, w, new int[numBands]);
+ }
+
+ public BandedSampleModel(int dataType, int w, int h, int scanlineStride,
+ int[] bankIndices, int[] bandOffsets)
+ {
+ super(dataType, w, h, 1, scanlineStride, bankIndices, bandOffsets);
+ }
+
+ public SampleModel createCompatibleSampleModel(int w, int h)
+ {
+ // NOTE: blackdown 1.4.1 sets all offsets to 0. Sun's 1.4.2 docs
+ // disagree.
+
+ // Compress offsets so minimum is 0, others w*scanlineStride
+ int[] newoffsets = new int[bandOffsets.length];
+ int[] order = new int[bandOffsets.length];
+ for (int i=0; i < bandOffsets.length; i++)
+ order[i] = i;
+ // FIXME: This is N^2, but not a big issue, unless there's a lot of
+ // bands...
+ for (int i=0; i < bandOffsets.length; i++)
+ for (int j=i+1; j < bandOffsets.length; i++)
+ if (bankIndices[order[i]] > bankIndices[order[j]]
+ || (bankIndices[order[i]] == bankIndices[order[j]]
+ && bandOffsets[order[i]] > bandOffsets[order[j]]))
+ {
+ int t = order[i]; order[i] = order[j]; order[j] = t;
+ }
+ int bank = 0;
+ int offset = 0;
+ for (int i=0; i < bandOffsets.length; i++)
+ {
+ if (bankIndices[order[i]] != bank)
+ {
+ bank = bankIndices[order[i]];
+ offset = 0;
+ }
+ newoffsets[order[i]] = offset;
+ offset += w * scanlineStride;
+ }
+
+ return new BandedSampleModel(dataType, w, h, scanlineStride, bankIndices, newoffsets);
+ }
+
+
+ public SampleModel createSubsetSampleModel(int[] bands)
+ {
+ int[] newoff = new int[bands.length];
+ int[] newbanks = new int[bands.length];
+ for (int i=0; i < bands.length; i++)
+ {
+ int b = bands[i];
+ newoff[i] = bandOffsets[b];
+ newbanks[i] = bankIndices[b];
+ }
+
+ if (bands.length > bankIndices.length)
+ throw new
+ RasterFormatException("BandedSampleModel createSubsetSampleModel too"
+ +" many bands");
+
+ return new BandedSampleModel(dataType, width, height, scanlineStride,
+ newbanks, newoff);
+ }
+
+ /**
+ * Extract all samples of one pixel and return in an array of transfer type.
+ *
+ * Extracts the pixel at x, y from data and stores samples into the array
+ * obj. If obj is null, a new array of getTransferType() is created.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param obj The primitive array to store the pixels into or null to force creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ * @see java.awt.image.SampleModel#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public Object getDataElements(int x, int y, Object obj,
+ DataBuffer data)
+ {
+ int pixel = getSample(x, y, 0, data);
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ byte[] b = (byte[])obj;
+ if (b == null) b = new byte[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = (byte)getSample(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_SHORT:
+ case DataBuffer.TYPE_USHORT:
+ {
+ short[] b = (short[])obj;
+ if (b == null) b = new short[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = (short)getSample(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ int[] b = (int[])obj;
+ if (b == null) b = new int[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = getSample(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ {
+ float[] b = (float[])obj;
+ if (b == null) b = new float[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = getSampleFloat(x, y, i, data);
+ return b;
+ }
+ case DataBuffer.TYPE_DOUBLE:
+ {
+ double[] b = (double[])obj;
+ if (b == null) b = new double[numBands];
+ for (int i=0; i < numBands; i++)
+ b[i] = getSample(x, y, i, data);
+ return b;
+ }
+
+ default:
+ // Seems like the only sensible thing to do.
+ throw new ClassCastException();
+ }
+ }
+
+ public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[numBands];
+ for (int i=0; i < numBands; i++)
+ iArray[i] = getSample(x, y, 0, data);
+
+ return iArray;
+ }
+
+ /**
+ * Copy pixels from a region into an array.
+ *
+ * Copies the samples of the pixels in the rectangle starting at x, y that
+ * is w pixels wide and h scanlines high. When there is more than one band,
+ * the samples stored in order before the next pixel. This ordering isn't
+ * well specified in Sun's docs as of 1.4.2.
+ *
+ * If iArray is null, a new array is allocated, filled, and returned.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param w The width in pixels of the rectangle.
+ * @param h The height in pixels of the rectangle.
+ * @param iArray The int array to store the pixels into or null to force
+ * creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ */
+ public int[] getPixels(int x, int y, int w, int h, int[] iArray,
+ DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[w*h*numBands];
+ int outOffset = 0;
+ for (y=0; y<h; y++)
+ {
+ for (x=0; x<w;)
+ {
+ for (int b=0; b < numBands; b++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ iArray[outOffset++] =
+ data.getElem(bankIndices[b], offset);
+ }
+ }
+ }
+ return iArray;
+ }
+
+ public int getSample(int x, int y, int b, DataBuffer data)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ return data.getElem(bankIndices[b], offset);
+ }
+
+ public float getSampleFloat(int x, int y, int b, DataBuffer data)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ return data.getElemFloat(bankIndices[b], offset);
+ }
+
+ public double getSampleDouble(int x, int y, int b, DataBuffer data)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ return data.getElemDouble(bankIndices[b], offset);
+ }
+
+ /**
+ * Copy one band's samples from a region into an array.
+ *
+ * Copies from one band the samples of the pixels in the rectangle starting
+ * at x, y that is w pixels wide and h scanlines high.
+ *
+ * If iArray is null, a new array is allocated, filled, and returned.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in
+ * <code>iArray</code>.
+ * @param w The width in pixels of the rectangle.
+ * @param h The height in pixels of the rectangle.
+ * @param b The band to retrieve.
+ * @param iArray The int array to store the pixels into or null to force
+ * creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ */
+ public int[] getSamples(int x, int y, int w, int h, int b, int[] iArray,
+ DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[w*h];
+ int outOffset = 0;
+ for (y=0; y<h; y++)
+ {
+ for (x=0; x<w;)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + x;
+ iArray[outOffset++] =
+ data.getElem(bankIndices[b], offset);
+ }
+ }
+ return iArray;
+ }
+
+
+ /**
+ * Set the pixel at x, y to the value in the first element of the primitive
+ * array obj.
+ *
+ * @param x The x-coordinate of the data elements in <code>obj</code>.
+ * @param y The y-coordinate of the data elements in <code>obj</code>.
+ * @param obj The primitive array containing the data elements to set.
+ * @param data The DataBuffer to store the data elements into.
+ * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public void setDataElements(int x, int y, Object obj, DataBuffer data)
+ {
+ int transferType = getTransferType();
+ if (getTransferType() != data.getDataType())
+ {
+ throw new IllegalArgumentException("transfer type ("+
+ getTransferType()+"), "+
+ "does not match data "+
+ "buffer type (" +
+ data.getDataType() +
+ ").");
+ }
+
+ int offset = y * scanlineStride + x;
+
+ try
+ {
+ switch (transferType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] in = (byte[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_SHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] in = (short[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferUShort out = (DataBufferUShort) data;
+ short[] in = (short[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] in = (int[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ {
+ DataBufferFloat out = (DataBufferFloat) data;
+ float[] in = (float[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_DOUBLE:
+ {
+ DataBufferDouble out = (DataBufferDouble) data;
+ double[] in = (double[]) obj;
+ for (int i=0; i < numBands; i++)
+ out.getData(bankIndices[i])[offset + bandOffsets[i]] = in[0];
+ return;
+ }
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ String msg = "While writing data elements" +
+ ", x="+x+", y="+y+
+ ", width="+width+", height="+height+
+ ", scanlineStride="+scanlineStride+
+ ", offset="+offset+
+ ", data.getSize()="+data.getSize()+
+ ", data.getOffset()="+data.getOffset()+
+ ": " +
+ aioobe;
+ throw new ArrayIndexOutOfBoundsException(msg);
+ }
+ }
+
+ public void setPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ for (int b=0; b < numBands; b++)
+ data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x,
+ iArray[b]);
+ }
+
+ public void setPixels(int x, int y, int w, int h, int[] iArray,
+ DataBuffer data)
+ {
+ int inOffset = 0;
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = y * scanlineStride + (x + ww);
+ for (int b=0; b < numBands; b++)
+ data.setElem(bankIndices[b], bandOffsets[b] + offset,
+ iArray[inOffset++]);
+ }
+ y++;
+ }
+ }
+
+ public void setSample(int x, int y, int b, int s, DataBuffer data)
+ {
+ data.setElem(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
+ }
+
+ public void setSample(int x, int y, int b, float s, DataBuffer data)
+ {
+ data.setElemFloat(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
+ }
+
+ public void setSample(int x, int y, int b, double s, DataBuffer data)
+ {
+ data.setElemDouble(bankIndices[b], bandOffsets[b] + y * scanlineStride + x, s);
+ }
+
+ public void setSamples(int x, int y, int w, int h, int b, int[] iArray,
+ DataBuffer data)
+ {
+ int inOffset = 0;
+
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (byte)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_SHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (short)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferShort out = (DataBufferShort) data;
+ short[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = (short)iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] bank = out.getData(bankIndices[b]);
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ bank[offset] = iArray[inOffset++];
+ }
+ y++;
+ }
+ return;
+ }
+ case DataBuffer.TYPE_FLOAT:
+ case DataBuffer.TYPE_DOUBLE:
+ break;
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
+
+ // Default implementation probably slower for float and double
+ for (int hh = 0; hh < h; hh++)
+ {
+ for (int ww = 0; ww < w; ww++)
+ {
+ int offset = bandOffsets[b] + y * scanlineStride + (x + ww);
+ data.setElem(bankIndices[b], offset, iArray[inOffset++]);
+ }
+ y++;
+ }
+ }
+
+ /**
+ * Creates a String with some information about this SampleModel.
+ * @return A String describing this SampleModel.
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(getClass().getName());
+ result.append("[");
+ result.append("scanlineStride=").append(scanlineStride);
+ for(int i=0; i < bitMasks.length; i+=1)
+ {
+ result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
+ }
+
+ result.append("]");
+ return result.toString();
+ }
+}
diff --git a/java/awt/image/BufferedImage.java b/java/awt/image/BufferedImage.java
index b18779af1..723eeeb77 100644
--- a/java/awt/image/BufferedImage.java
+++ b/java/awt/image/BufferedImage.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002, 2003 Free Software Foundation
+/* BufferedImage.java --
+ Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,6 +38,8 @@ exception statement from your version. */
package java.awt.image;
+import gnu.java.awt.ComponentDataBlitOp;
+
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
@@ -45,11 +48,10 @@ import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import java.util.Hashtable;
-import java.util.Vector;
import java.util.HashSet;
+import java.util.Hashtable;
import java.util.Iterator;
-import gnu.java.awt.ComponentDataBlitOp;
+import java.util.Vector;
/**
* A buffered image always starts at coordinates (0, 0).
@@ -59,7 +61,7 @@ import gnu.java.awt.ComponentDataBlitOp;
* height of the image. This tile is always considered to be checked
* out.
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
*/
public class BufferedImage extends Image
implements WritableRenderedImage
@@ -79,20 +81,20 @@ public class BufferedImage extends Image
TYPE_BYTE_BINARY = 12,
TYPE_BYTE_INDEXED = 13;
- final static int[] bits3 = { 8, 8, 8 };
- final static int[] bits4 = { 8, 8, 8 };
- final static int[] bits1byte = { 8 };
- final static int[] bits1ushort = { 16 };
+ static final int[] bits3 = { 8, 8, 8 };
+ static final int[] bits4 = { 8, 8, 8 };
+ static final int[] bits1byte = { 8 };
+ static final int[] bits1ushort = { 16 };
- final static int[] masks_int = { 0x00ff0000,
+ static final int[] masks_int = { 0x00ff0000,
0x0000ff00,
0x000000ff,
DataBuffer.TYPE_INT };
- final static int[] masks_565 = { 0xf800,
+ static final int[] masks_565 = { 0xf800,
0x07e0,
0x001f,
DataBuffer.TYPE_USHORT};
- final static int[] masks_555 = { 0x7c00,
+ static final int[] masks_555 = { 0x7c00,
0x03e0,
0x001f,
DataBuffer.TYPE_USHORT};
diff --git a/java/awt/image/ColorModel.java b/java/awt/image/ColorModel.java
index 87ab94291..238bec1de 100644
--- a/java/awt/image/ColorModel.java
+++ b/java/awt/image/ColorModel.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
+/* ColorModel.java --
+ Copyright (C) 1999, 2000, 2002, 2003, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,11 +38,12 @@ exception statement from your version. */
package java.awt.image;
-import java.util.Arrays;
+import gnu.java.awt.Buffers;
+
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import gnu.java.awt.Buffers;
+import java.util.Arrays;
/**
* A color model operates with colors in several formats:
@@ -76,8 +78,8 @@ import gnu.java.awt.Buffers;
*
* </ul>
*
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
- * @author C. Brian Jones <cbj@gnu.org>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
+ * @author C. Brian Jones (cbj@gnu.org)
*/
public abstract class ColorModel implements Transparency
{
@@ -508,40 +510,89 @@ public abstract class ColorModel implements Transparency
* <code>(pixel == cm.getDataElement(cm.getComponents(pixel, null,
* 0), 0))</code>.
*
- * This method is typically overriden in subclasses to provide a
- * more efficient implementation.
+ * This method is overriden in subclasses since this abstract class throws
+ * UnsupportedOperationException().
*
- * @param arrays of unnormalized component samples of single
- * pixel. The scale and multiplication state of the samples are
- * according to the color model. Each component sample is stored
- * as a separate element in the array.
+ * @param components Array of unnormalized component samples of single
+ * pixel. The scale and multiplication state of the samples are according
+ * to the color model. Each component sample is stored as a separate element
+ * in the array.
+ * @param offset Position of the first value of the pixel in components.
*
* @return pixel value encoded according to the color model.
*/
public int getDataElement(int[] components, int offset)
{
- // subclasses has to implement this method.
+ // subclasses have to implement this method.
throw new UnsupportedOperationException();
}
+ /**
+ * Converts the normalized component samples from an array to a pixel
+ * value. I.e. composes the pixel from component samples, but does not
+ * perform any color conversion or scaling of the samples.
+ *
+ * This method is typically overriden in subclasses to provide a
+ * more efficient implementation. The method provided by this abstract
+ * class converts the components to unnormalized form and returns
+ * getDataElement(int[], int).
+ *
+ * @param components Array of normalized component samples of single pixel.
+ * The scale and multiplication state of the samples are according to the
+ * color model. Each component sample is stored as a separate element in the
+ * array.
+ * @param offset Position of the first value of the pixel in components.
+ *
+ * @return pixel value encoded according to the color model.
+ * @since 1.4
+ */
public int getDataElement (float[] components, int offset)
{
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
+ return
+ getDataElement(getUnnormalizedComponents(components, offset, null, 0),
+ 0);
}
public Object getDataElements(int[] components, int offset, Object obj)
{
- // subclasses has to implement this method.
+ // subclasses have to implement this method.
throw new UnsupportedOperationException();
}
- public int getDataElements (float[] components, Object obj)
+ /**
+ * Converts the normalized component samples from an array to an array of
+ * TransferType values. I.e. composes the pixel from component samples, but
+ * does not perform any color conversion or scaling of the samples.
+ *
+ * If obj is null, a new array of TransferType is allocated and returned.
+ * Otherwise the results are stored in obj and obj is returned. If obj is
+ * not long enough, ArrayIndexOutOfBounds is thrown. If obj is not an array
+ * of primitives, ClassCastException is thrown.
+ *
+ * This method is typically overriden in subclasses to provide a
+ * more efficient implementation. The method provided by this abstract
+ * class converts the components to unnormalized form and returns
+ * getDataElement(int[], int, Object).
+ *
+ * @param components Array of normalized component samples of single pixel.
+ * The scale and multiplication state of the samples are according to the
+ * color model. Each component sample is stored as a separate element in the
+ * array.
+ * @param offset Position of the first value of the pixel in components.
+ * @param obj Array of TransferType or null.
+ *
+ * @return pixel value encoded according to the color model.
+ * @throws ArrayIndexOutOfBounds
+ * @throws ClassCastException
+ * @since 1.4
+ */
+ public Object getDataElements(float[] components, int offset, Object obj)
{
- // subclasses has to implement this method.
- throw new UnsupportedOperationException();
+ return
+ getDataElements(getUnnormalizedComponents(components, offset, null, 0),
+ 0, obj);
}
-
+
public boolean equals(Object obj)
{
if (!(obj instanceof ColorModel)) return false;
diff --git a/java/awt/image/ComponentColorModel.java b/java/awt/image/ComponentColorModel.java
index 24d8b8ea6..3b3447953 100644
--- a/java/awt/image/ComponentColorModel.java
+++ b/java/awt/image/ComponentColorModel.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
+/* ComponentColorModel.java --
+ Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,9 +38,10 @@ exception statement from your version. */
package java.awt.image;
+import gnu.java.awt.Buffers;
+
import java.awt.Point;
import java.awt.color.ColorSpace;
-import gnu.java.awt.Buffers;
public class ComponentColorModel extends ColorModel
{
@@ -60,6 +62,32 @@ public class ComponentColorModel extends ColorModel
transparency, transferType);
}
+ /**
+ * Construct a new ComponentColorModel.
+ *
+ * This constructor makes all bits of each sample significant, so for a
+ * transferType of DataBuffer.BYTE, the bits per sample is 8, etc. If
+ * both hasAlpha and isAlphaPremultiplied are true, color samples are
+ * assumed to be premultiplied by the alpha component. Transparency may be
+ * one of OPAQUE, BITMASK, or TRANSLUCENT.
+ *
+ * @param colorSpace The colorspace for this color model.
+ * @param hasAlpha True if there is an alpha component.
+ * @param isAlphaPremultiplied True if colors are already multiplied by
+ * alpha.
+ * @param transparency The type of alpha values.
+ * @param transferType Data type of pixel sample values.
+ * @since 1.4
+ */
+ public ComponentColorModel(ColorSpace colorSpace,
+ boolean hasAlpha,
+ boolean isAlphaPremultiplied,
+ int transparency, int transferType)
+ {
+ this(colorSpace, null, hasAlpha, isAlphaPremultiplied,
+ transparency, transferType);
+ }
+
public int getRed(int pixel)
{
if (getNumComponents()>1) throw new IllegalArgumentException();
diff --git a/java/awt/image/ComponentSampleModel.java b/java/awt/image/ComponentSampleModel.java
index c7b08b919..f121296f1 100644
--- a/java/awt/image/ComponentSampleModel.java
+++ b/java/awt/image/ComponentSampleModel.java
@@ -41,6 +41,21 @@ import gnu.java.awt.Buffers;
/* FIXME: This class does not yet support data type TYPE_SHORT */
/**
+ * ComponentSampleModel supports a flexible organization of pixel samples in
+ * memory, permitting pixel samples to be interleaved by band, by scanline,
+ * and by pixel.
+ *
+ * A DataBuffer for this sample model has K banks of data. Pixels have N
+ * samples, so there are N bands in the DataBuffer. Each band is completely
+ * contained in one bank of data, but a bank may contain more than one band.
+ * Each pixel sample is stored in a single data element.
+ *
+ * Within a bank, each band begins at an offset stored in bandOffsets. The
+ * banks containing the band is given by bankIndices. Within the bank, there
+ * are three dimensions - band, pixel, and scanline. The dimension ordering
+ * is controlled by bandOffset, pixelStride, and scanlineStride, which means
+ * that any combination of interleavings is supported.
+ *
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
*/
public class ComponentSampleModel extends SampleModel
@@ -86,6 +101,7 @@ public class ComponentSampleModel extends SampleModel
this.bandOffsets = bandOffsets;
this.bankIndices = bankIndices;
+ this.numBanks = 0;
for (int b=0; b<bankIndices.length; b++)
this.numBanks = Math.max(this.numBanks, bankIndices[b]+1);
diff --git a/java/awt/image/CropImageFilter.java b/java/awt/image/CropImageFilter.java
index c9a170b9b..a006d26d8 100644
--- a/java/awt/image/CropImageFilter.java
+++ b/java/awt/image/CropImageFilter.java
@@ -1,5 +1,5 @@
/* CropImageFilter.java -- Java class for cropping image filter
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,11 +38,10 @@ exception statement from your version. */
package java.awt.image;
-import java.util.Hashtable;
import java.awt.Rectangle;
+import java.util.Hashtable;
/**
- * <br>
* Currently this filter does almost nothing and needs to be implemented.
*
* @author C. Brian Jones (cbj@gnu.org)
diff --git a/java/awt/image/DataBuffer.java b/java/awt/image/DataBuffer.java
index 967e1a26c..b921953ec 100644
--- a/java/awt/image/DataBuffer.java
+++ b/java/awt/image/DataBuffer.java
@@ -45,12 +45,45 @@ package java.awt.image;
*/
public abstract class DataBuffer
{
+ /**
+ * A constant representng a data type that uses <code>byte</code> primitives
+ * as the storage unit.
+ */
public static final int TYPE_BYTE = 0;
+
+ /**
+ * A constant representng a data type that uses <code>short</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_USHORT = 1;
+
+ /**
+ * A constant representng a data type that uses <code>short</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_SHORT = 2;
+
+ /**
+ * A constant representng a data type that uses <code>int</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_INT = 3;
+
+ /**
+ * A constant representng a data type that uses <code>float</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_FLOAT = 4;
+
+ /**
+ * A constant representng a data type that uses <code>double</code>
+ * primitives as the storage unit.
+ */
public static final int TYPE_DOUBLE = 5;
+
+ /**
+ * A constant representng an undefined data type.
+ */
public static final int TYPE_UNDEFINED = 32;
/** The type of the data elements stored in the data buffer. */
@@ -68,18 +101,57 @@ public abstract class DataBuffer
/** Offset into each bank. */
protected int[] offsets;
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type and
+ * size. The <code>dataType</code> should be one of the constants
+ * {@link #TYPE_BYTE}, {@link #TYPE_SHORT}, {@link #TYPE_USHORT},
+ * {@link #TYPE_INT}, {@link #TYPE_FLOAT} and {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ */
protected DataBuffer(int dataType, int size)
{
this.dataType = dataType;
this.size = size;
}
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type,
+ * size and number of banks. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ * @param numBanks the number of data banks.
+ */
protected DataBuffer(int dataType, int size, int numBanks) {
this(dataType, size);
banks = numBanks;
offsets = new int[numBanks];
}
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type,
+ * size and number of banks. An offset (which applies to all banks) is
+ * also specified. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ * @param numBanks the number of data banks.
+ * @param offset the offset to the first element for all banks.
+ */
protected DataBuffer(int dataType, int size, int numBanks, int offset) {
this(dataType, size, numBanks);
@@ -88,6 +160,24 @@ public abstract class DataBuffer
this.offset = offset;
}
+ /**
+ * Creates a new <code>DataBuffer</code> with the specified data type,
+ * size and number of banks. An offset (which applies to all banks) is
+ * also specified. The <code>dataType</code> should be one of
+ * the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ * <p>
+ * The physical (array-based) storage is allocated by a subclass.
+ *
+ * @param dataType the data type.
+ * @param size the number of elements in the buffer.
+ * @param numBanks the number of data banks.
+ * @param offsets the offsets to the first element for all banks.
+ *
+ * @throws ArrayIndexOutOfBoundsException if
+ * <code>numBanks != offsets.length</code>.
+ */
protected DataBuffer(int dataType, int size, int numBanks, int[] offsets) {
this(dataType, size);
if (numBanks != offsets.length)
@@ -99,6 +189,17 @@ public abstract class DataBuffer
offset = offsets[0];
}
+ /**
+ * Returns the size (number of bits) of the specified data type. Valid types
+ * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ *
+ * @param dataType the data type.
+ * @return The number of bits for the specified data type.
+ * @throws IllegalArgumentException if <code>dataType < 0</code> or
+ * <code>dataType > TYPE_DOUBLE</code>.
+ */
public static int getDataTypeSize(int dataType) {
// Maybe this should be a lookup table instead.
switch (dataType)
@@ -118,21 +219,45 @@ public abstract class DataBuffer
}
}
+ /**
+ * Returns the type of the data elements in the data buffer. Valid types
+ * are defined by the constants {@link #TYPE_BYTE}, {@link #TYPE_SHORT},
+ * {@link #TYPE_USHORT}, {@link #TYPE_INT}, {@link #TYPE_FLOAT} and
+ * {@link #TYPE_DOUBLE}.
+ *
+ * @return The type.
+ */
public int getDataType()
{
return dataType;
}
+ /**
+ * Returns the size of the data buffer.
+ *
+ * @return The size.
+ */
public int getSize()
{
return size;
}
+ /**
+ * Returns the element offset for the first data bank.
+ *
+ * @return The element offset.
+ */
public int getOffset()
{
return offset;
}
+ /**
+ * Returns the offsets for all the data banks used by this
+ * <code>DataBuffer</code>.
+ *
+ * @return The offsets.
+ */
public int[] getOffsets()
{
if (offsets == null)
@@ -144,60 +269,166 @@ public abstract class DataBuffer
return offsets;
}
+ /**
+ * Returns the number of data banks for this <code>DataBuffer</code>.
+ * @return The number of data banks.
+ */
public int getNumBanks()
{
return banks;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return getElem(0, i);
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public abstract int getElem(int bank, int i);
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
setElem(0, i, val);
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public abstract void setElem(int bank, int i, int val);
+ /**
+ * Returns an element from the first data bank, converted to a
+ * <code>float</code>. The offset (specified in the constructor) is added
+ * to <code>i</code> before accessing the underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public float getElemFloat(int i)
{
return getElem(i);
}
+ /**
+ * Returns an element from a particular data bank, converted to a
+ * <code>float</code>. The offset (specified in the constructor) is
+ * added to <code>i</code> before accessing the underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public float getElemFloat(int bank, int i)
{
return getElem(bank, i);
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemFloat(int i, float val)
{
setElem(i, (int) val);
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemFloat(int bank, int i, float val)
{
setElem(bank, i, (int) val);
}
+ /**
+ * Returns an element from the first data bank, converted to a
+ * <code>double</code>. The offset (specified in the constructor) is added
+ * to <code>i</code> before accessing the underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public double getElemDouble(int i)
{
return getElem(i);
}
+ /**
+ * Returns an element from a particular data bank, converted to a
+ * <code>double</code>. The offset (specified in the constructor) is
+ * added to <code>i</code> before accessing the underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public double getElemDouble(int bank, int i)
{
return getElem(bank, i);
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemDouble(int i, double val)
{
setElem(i, (int) val);
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElemDouble(int bank, int i, double val)
{
setElem(bank, i, (int) val);
diff --git a/java/awt/image/DataBufferByte.java b/java/awt/image/DataBufferByte.java
index 84df55106..fd16f11ac 100644
--- a/java/awt/image/DataBufferByte.java
+++ b/java/awt/image/DataBufferByte.java
@@ -54,12 +54,25 @@ public final class DataBufferByte extends DataBuffer
private byte[] data;
private byte[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>byte</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferByte(int size)
{
super(TYPE_BYTE, size);
data = new byte[size];
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>byte</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferByte(int size, int numBanks)
{
super(TYPE_BYTE, size, numBanks);
@@ -67,18 +80,49 @@ public final class DataBufferByte extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferByte(byte[] dataArray, int size)
{
super(TYPE_BYTE, size);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferByte(byte[] dataArray, int size, int offset)
{
super(TYPE_BYTE, size, 1, offset);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferByte(byte[][] dataArray, int size)
{
super(TYPE_BYTE, size, dataArray.length);
@@ -86,6 +130,17 @@ public final class DataBufferByte extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferByte(byte[][] dataArray, int size, int[] offsets)
{
super(TYPE_BYTE, size, dataArray.length, offsets);
@@ -93,37 +148,87 @@ public final class DataBufferByte extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public byte[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public byte[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public byte[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset] & 0xff; // get unsigned byte as int
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
// get unsigned byte as int
return bankData[bank][i+offsets[bank]] & 0xff;
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (byte) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (byte) val;
diff --git a/java/awt/image/DataBufferDouble.java b/java/awt/image/DataBufferDouble.java
index b1291f416..2d90ac863 100644
--- a/java/awt/image/DataBufferDouble.java
+++ b/java/awt/image/DataBufferDouble.java
@@ -58,12 +58,25 @@ public final class DataBufferDouble
private double[] data;
private double[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>double</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferDouble(int size)
{
super(TYPE_DOUBLE, size);
data = new double[size];
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>double</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferDouble(int size, int numBanks)
{
super(TYPE_DOUBLE, size, numBanks);
@@ -71,18 +84,49 @@ public final class DataBufferDouble
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferDouble(double[] dataArray, int size)
{
super(TYPE_DOUBLE, size);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferDouble(double[] dataArray, int size, int offset)
{
super(TYPE_DOUBLE, size, 1, offset);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferDouble(double[][] dataArray, int size)
{
super(TYPE_DOUBLE, size, dataArray.length);
@@ -90,6 +134,17 @@ public final class DataBufferDouble
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferDouble(double[][] dataArray, int size, int[] offsets)
{
super(TYPE_DOUBLE, size, dataArray.length, offsets);
@@ -97,36 +152,86 @@ public final class DataBufferDouble
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public double[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public double[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public double[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return (int) data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
return (int) bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (double) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (double) val;
diff --git a/java/awt/image/DataBufferFloat.java b/java/awt/image/DataBufferFloat.java
index b2d88c16b..da614789a 100644
--- a/java/awt/image/DataBufferFloat.java
+++ b/java/awt/image/DataBufferFloat.java
@@ -56,12 +56,25 @@ public final class DataBufferFloat
private float[] data;
private float[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>float</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferFloat(int size)
{
super(TYPE_FLOAT, size);
data = new float[size];
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>float</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferFloat(int size, int numBanks)
{
super(TYPE_FLOAT, size, numBanks);
@@ -69,18 +82,49 @@ public final class DataBufferFloat
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferFloat(float[] dataArray, int size)
{
super(TYPE_FLOAT, size);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferFloat(float[] dataArray, int size, int offset)
{
super(TYPE_FLOAT, size, 1, offset);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferFloat(float[][] dataArray, int size)
{
super(TYPE_FLOAT, size, dataArray.length);
@@ -88,6 +132,17 @@ public final class DataBufferFloat
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferFloat(float[][] dataArray, int size, int[] offsets)
{
super(TYPE_FLOAT, size, dataArray.length, offsets);
@@ -95,36 +150,86 @@ public final class DataBufferFloat
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public float[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public float[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public float[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return (int) data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
return (int) bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (float) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (float) val;
diff --git a/java/awt/image/DataBufferInt.java b/java/awt/image/DataBufferInt.java
index 54308fefd..87922c5c1 100644
--- a/java/awt/image/DataBufferInt.java
+++ b/java/awt/image/DataBufferInt.java
@@ -54,12 +54,25 @@ public final class DataBufferInt extends DataBuffer
private int[] data;
private int[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>int</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferInt(int size)
{
super(TYPE_INT, size);
data = new int[size];
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>int</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferInt(int size, int numBanks)
{
super(TYPE_INT, size, numBanks);
@@ -67,18 +80,49 @@ public final class DataBufferInt extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferInt(int[] dataArray, int size)
{
super(TYPE_INT, size);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferInt(int[] dataArray, int size, int offset)
{
super(TYPE_INT, size, 1, offset);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferInt(int[][] dataArray, int size)
{
super(TYPE_INT, size, dataArray.length);
@@ -86,6 +130,17 @@ public final class DataBufferInt extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferInt(int[][] dataArray, int size, int[] offsets)
{
super(TYPE_INT, size, dataArray.length, offsets);
@@ -93,39 +148,88 @@ public final class DataBufferInt extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public int[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public int[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public int[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The <code>offset</code> is
+ * added to the specified index before accessing the underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The <code>offset</code>
+ * is added to the specified index before accessing the underlying data
+ * array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
// get unsigned int as int
return bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
- data[i+offset] = (int) val;
+ data[i+offset] = val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
- bankData[bank][i+offsets[bank]] = (int) val;
+ bankData[bank][i+offsets[bank]] = val;
}
}
diff --git a/java/awt/image/DataBufferShort.java b/java/awt/image/DataBufferShort.java
index 7a5c39424..4dad5fbc3 100644
--- a/java/awt/image/DataBufferShort.java
+++ b/java/awt/image/DataBufferShort.java
@@ -54,12 +54,25 @@ public final class DataBufferShort extends DataBuffer
private short[] data;
private short[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferShort(int size)
{
super(TYPE_SHORT, size);
data = new short[size];
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferShort(int size, int numBanks)
{
super(TYPE_SHORT, size, numBanks);
@@ -67,18 +80,49 @@ public final class DataBufferShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferShort(short[] dataArray, int size)
{
super(TYPE_SHORT, size);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ * <p>
+ * Note: there is no exception when <code>dataArray</code> is
+ * <code>null</code>, but in that case an exception will be thrown
+ * later if you attempt to access the data buffer.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferShort(short[] dataArray, int size, int offset)
{
super(TYPE_SHORT, size, 1, offset);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferShort(short[][] dataArray, int size)
{
super(TYPE_SHORT, size, dataArray.length);
@@ -86,6 +130,17 @@ public final class DataBufferShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferShort(short[][] dataArray, int size, int[] offsets)
{
super(TYPE_SHORT, size, dataArray.length, offsets);
@@ -93,36 +148,86 @@ public final class DataBufferShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public short[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public short[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public short[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset];
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
return bankData[bank][i+offsets[bank]];
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (short) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (short) val;
diff --git a/java/awt/image/DataBufferUShort.java b/java/awt/image/DataBufferUShort.java
index e11b4ab10..a1abb26c5 100644
--- a/java/awt/image/DataBufferUShort.java
+++ b/java/awt/image/DataBufferUShort.java
@@ -54,12 +54,25 @@ public final class DataBufferUShort extends DataBuffer
private short[] data;
private short[][] bankData;
+ /**
+ * Creates a new data buffer with a single data bank containing the
+ * specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ */
public DataBufferUShort(int size)
{
super(TYPE_USHORT, size);
data = new short[size];
}
+ /**
+ * Creates a new data buffer with the specified number of data banks,
+ * each containing the specified number of <code>short</code> elements.
+ *
+ * @param size the number of elements in the data bank.
+ * @param numBanks the number of data banks.
+ */
public DataBufferUShort(int size, int numBanks)
{
super(TYPE_USHORT, size, numBanks);
@@ -67,18 +80,41 @@ public final class DataBufferUShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data bank.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ */
public DataBufferUShort(short[] dataArray, int size)
{
super(TYPE_USHORT, size);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data bank, with
+ * the specified offset to the first element.
+ *
+ * @param dataArray the data bank.
+ * @param size the number of elements in the data bank.
+ * @param offset the offset to the first element in the array.
+ */
public DataBufferUShort(short[] dataArray, int size, int offset)
{
super(TYPE_USHORT, size, 1, offset);
data = dataArray;
}
+ /**
+ * Creates a new data buffer backed by the specified data banks.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferUShort(short[][] dataArray, int size)
{
super(TYPE_USHORT, size, dataArray.length);
@@ -86,6 +122,17 @@ public final class DataBufferUShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Creates a new data buffer backed by the specified data banks, with
+ * the specified offsets to the first element in each bank.
+ *
+ * @param dataArray the data banks.
+ * @param size the number of elements in the data bank.
+ * @param offsets the offsets to the first element in each data bank.
+ *
+ * @throws NullPointerException if <code>dataArray</code> is
+ * <code>null</code>.
+ */
public DataBufferUShort(short[][] dataArray, int size, int[] offsets)
{
super(TYPE_USHORT, size, dataArray.length, offsets);
@@ -93,37 +140,87 @@ public final class DataBufferUShort extends DataBuffer
data = bankData[0];
}
+ /**
+ * Returns the first data bank.
+ *
+ * @return The first data bank.
+ */
public short[] getData()
{
return data;
}
+ /**
+ * Returns a data bank.
+ *
+ * @param bank the bank index.
+ * @return A data bank.
+ */
public short[] getData(int bank)
{
return bankData[bank];
}
+ /**
+ * Returns the array underlying this <code>DataBuffer</code>.
+ *
+ * @return The data banks.
+ */
public short[][] getBankData()
{
return bankData;
}
+ /**
+ * Returns an element from the first data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int i)
{
return data[i+offset] & 0xffff; // get unsigned short as int
}
+ /**
+ * Returns an element from a particular data bank. The offset (specified in
+ * the constructor) is added to <code>i</code> before accessing the
+ * underlying data array.
+ *
+ * @param bank the bank index.
+ * @param i the element index.
+ * @return The element.
+ */
public int getElem(int bank, int i)
{
// get unsigned short as int
return bankData[bank][i+offsets[bank]] & 0xffff;
}
+ /**
+ * Sets an element in the first data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int i, int val)
{
data[i+offset] = (short) val;
}
+ /**
+ * Sets an element in a particular data bank. The offset (specified in the
+ * constructor) is added to <code>i</code> before updating the underlying
+ * data array.
+ *
+ * @param bank the data bank index.
+ * @param i the element index.
+ * @param val the new element value.
+ */
public void setElem(int bank, int i, int val)
{
bankData[bank][i+offsets[bank]] = (short) val;
diff --git a/java/awt/image/DirectColorModel.java b/java/awt/image/DirectColorModel.java
index 3ac43cf25..7fa6e8974 100644
--- a/java/awt/image/DirectColorModel.java
+++ b/java/awt/image/DirectColorModel.java
@@ -1,4 +1,5 @@
-/* Copyright (C) 1999, 2000, 2002 Free Software Foundation
+/* DirectColorModel.java --
+ Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -37,13 +38,14 @@ exception statement from your version. */
package java.awt.image;
+import gnu.java.awt.Buffers;
+
import java.awt.Point;
import java.awt.Transparency;
import java.awt.color.ColorSpace;
-import gnu.java.awt.Buffers;
/**
- * @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
+ * @author Rolf W. Rasmussen (rolfwr@ii.uib.no)
* @author C. Brian Jones (cbj@gnu.org)
* @author Mark Benvenuto (mcb54@columbia.edu)
*/
@@ -162,7 +164,7 @@ public class DirectColorModel extends PackedColorModel
return extractAndScaleSample(pixel, 3);
}
- private final int extractAndNormalizeSample(int pixel, int component)
+ private int extractAndNormalizeSample(int pixel, int component)
{
int value = extractAndScaleSample(pixel, component);
if (hasAlpha() && isAlphaPremultiplied())
@@ -170,7 +172,7 @@ public class DirectColorModel extends PackedColorModel
return value;
}
- private final int extractAndScaleSample(int pixel, int component)
+ private int extractAndScaleSample(int pixel, int component)
{
int field = pixel & getMask(component);
int to8BitShift =
@@ -303,7 +305,7 @@ public class DirectColorModel extends PackedColorModel
* @param highBit the position of the most significant bit in the
* val parameter.
*/
- private final int valueToField(int val, int component, int highBit)
+ private int valueToField(int val, int component, int highBit)
{
int toFieldShift =
getComponentSize(component) + shifts[component] - highBit;
@@ -317,7 +319,7 @@ public class DirectColorModel extends PackedColorModel
* Converts a 16 bit value to the correct field bits based on the
* information derived from the field masks.
*/
- private final int value16ToField(int val, int component)
+ private int value16ToField(int val, int component)
{
int toFieldShift = getComponentSize(component) + shifts[component] - 16;
return (toFieldShift>0) ?
diff --git a/java/awt/image/IndexColorModel.java b/java/awt/image/IndexColorModel.java
index 9ceb0bf09..8bc8b9dd1 100644
--- a/java/awt/image/IndexColorModel.java
+++ b/java/awt/image/IndexColorModel.java
@@ -38,7 +38,29 @@ exception statement from your version. */
package java.awt.image;
+import java.awt.color.ColorSpace;
+import java.math.BigInteger;
+
/**
+ * Color model similar to pseudo visual in X11.
+ *
+ * This color model maps linear pixel values to actual RGB and alpha colors.
+ * Thus, pixel values are indexes into the color map. Each color component is
+ * an 8-bit unsigned value.
+ *
+ * The IndexColorModel supports a map of valid pixels, allowing the
+ * representation of holes in the the color map. The valid map is represented
+ * as a BigInteger where each bit indicates the validity of the map entry with
+ * the same index.
+ *
+ * Colors can have alpha components for transparency support. If alpha
+ * component values aren't given, color values are opaque. The model also
+ * supports a reserved pixel value to represent completely transparent colors,
+ * no matter what the actual color component values are.
+ *
+ * IndexColorModel supports anywhere from 1 to 16 bit index values. The
+ * allowed transfer types are DataBuffer.TYPE_BYTE and DataBuffer.TYPE_USHORT.
+ *
* @author C. Brian Jones (cbj@gnu.org)
*/
public class IndexColorModel extends ColorModel
@@ -47,6 +69,7 @@ public class IndexColorModel extends ColorModel
private boolean opaque;
private int trans = -1;
private int[] rgb;
+ private BigInteger validBits = new BigInteger("0");
/**
* Each array much contain <code>size</code> elements. For each
@@ -127,6 +150,10 @@ public class IndexColorModel extends ColorModel
| (blues[i] & 0xff));
}
}
+
+ // Generate a bigint with 1's for every pixel
+ validBits.setBit(size);
+ validBits.subtract(new BigInteger("1"));
}
/**
@@ -167,6 +194,79 @@ public class IndexColorModel extends ColorModel
map_size = size;
opaque = !hasAlpha;
this.trans = trans;
+ // Generate a bigint with 1's for every pixel
+ validBits.setBit(size);
+ validBits.subtract(new BigInteger("1"));
+ }
+
+ /**
+ * Each array much contain <code>size</code> elements. For each
+ * array, the i-th color is described by reds[i], greens[i],
+ * blues[i], alphas[i], unless alphas is not specified, then all the
+ * colors are opaque except for the transparent color.
+ *
+ * @param bits the number of bits needed to represent <code>size</code> colors
+ * @param size the number of colors in the color map
+ * @param cmap packed color components
+ * @param start the offset of the first color component in <code>cmap</code>
+ * @param hasAlpha <code>cmap</code> has alpha values
+ * @param trans the index of the transparent color
+ * @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
+ */
+ public IndexColorModel (int bits, int size, byte[] cmap, int start,
+ boolean hasAlpha, int trans, int transferType)
+ {
+ super(bits * 4, // total bits, sRGB, four channels
+ nArray(bits, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT, transferType);
+ if (transferType != DataBuffer.TYPE_BYTE
+ && transferType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException();
+ map_size = size;
+ opaque = !hasAlpha;
+ this.trans = trans;
+ // Generate a bigint with 1's for every pixel
+ validBits.setBit(size);
+ validBits.subtract(new BigInteger("1"));
+ }
+
+ /**
+ * Construct an IndexColorModel using a colormap with holes.
+ *
+ * The IndexColorModel is built from the array of ints defining the
+ * colormap. Each element contains red, green, blue, and alpha
+ * components. The ColorSpace is sRGB. The transparency value is
+ * automatically determined.
+ *
+ * This constructor permits indicating which colormap entries are valid,
+ * using the validBits argument. Each entry in cmap is valid if the
+ * corresponding bit in validBits is set.
+ *
+ * @param bits the number of bits needed to represent <code>size</code> colors
+ * @param size the number of colors in the color map
+ * @param cmap packed color components
+ * @param start the offset of the first color component in <code>cmap</code>
+ * @param transferType DataBuffer.TYPE_BYTE or DataBuffer.TYPE_USHORT
+ */
+ public IndexColorModel (int bits, int size, int[] cmap, int start,
+ int transferType, BigInteger validBits)
+ {
+ super(bits * 4, // total bits, sRGB, four channels
+ nArray(bits, 4), // bits for each channel
+ ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB
+ true, // has alpha
+ false, // not premultiplied
+ TRANSLUCENT, transferType);
+ if (transferType != DataBuffer.TYPE_BYTE
+ && transferType != DataBuffer.TYPE_USHORT)
+ throw new IllegalArgumentException();
+ map_size = size;
+ opaque = false;
+ this.trans = -1;
+ this.validBits = validBits;
}
public final int getMapSize ()
@@ -279,11 +379,79 @@ public class IndexColorModel extends ColorModel
return 0;
}
- //pixel_bits is number of bits to be in generated mask
+ /**
+ * Get the RGB color values of all pixels in the map using the default
+ * RGB color model.
+ *
+ * @param rgb The destination array.
+ */
+ public final void getRGBs (int[] rgb)
+ {
+ System.arraycopy(this.rgb, 0, rgb, 0, map_size);
+ }
+
+ //pixel_bits is number of bits to be in generated mask
private int generateMask (int offset)
{
return (((2 << pixel_bits ) - 1) << (pixel_bits * offset));
}
+ /** Return true if pixel is valid, false otherwise. */
+ public boolean isValid(int pixel)
+ {
+ return validBits.testBit(pixel);
+ }
+
+ /** Return true if all pixels are valid, false otherwise. */
+ public boolean isValid()
+ {
+ // Generate a bigint with 1's for every pixel
+ BigInteger allbits = new BigInteger("0");
+ allbits.setBit(map_size);
+ allbits.subtract(new BigInteger("1"));
+ return allbits.equals(validBits);
+ }
+
+ /**
+ * Returns a BigInteger where each bit represents an entry in the color
+ * model. If the bit is on, the entry is valid.
+ */
+ public BigInteger getValidPixels()
+ {
+ return validBits;
+ }
+
+ /**
+ * Construct a BufferedImage with rgb pixel values from a Raster.
+ *
+ * Constructs a new BufferedImage in which each pixel is an RGBA int from
+ * a Raster with index-valued pixels. If this model has no alpha component
+ * or transparent pixel, the type of the new BufferedImage is TYPE_INT_RGB.
+ * Otherwise the type is TYPE_INT_ARGB. If forceARGB is true, the type is
+ * forced to be TYPE_INT_ARGB no matter what.
+ *
+ * @param raster The source of pixel values.
+ * @param forceARGB True if type must be TYPE_INT_ARGB.
+ * @return New BufferedImage with RBGA int pixel values.
+ */
+ public BufferedImage convertToIntDiscrete(Raster raster, boolean forceARGB)
+ {
+ int type = forceARGB ? BufferedImage.TYPE_INT_ARGB
+ : ((opaque && trans == -1) ? BufferedImage.TYPE_INT_RGB :
+ BufferedImage.TYPE_INT_ARGB);
+
+ // FIXME: assuming that raster has only 1 band since pixels are supposed
+ // to be int indexes.
+ // FIXME: it would likely be more efficient to fetch a complete array,
+ // but it would take much more memory.
+ // FIXME: I'm not sure if transparent pixels or alpha values need special
+ // handling here.
+ BufferedImage im = new BufferedImage(raster.width, raster.height, type);
+ for (int x = raster.minX; x < raster.width + raster.minX; x++)
+ for (int y = raster.minY; y < raster.height + raster.minY; y++)
+ im.setRGB(x, y, rgb[raster.getSample(x, y, 0)]);
+
+ return im;
+ }
}
diff --git a/java/awt/image/MemoryImageSource.java b/java/awt/image/MemoryImageSource.java
index 1228ed78f..8de4b842a 100644
--- a/java/awt/image/MemoryImageSource.java
+++ b/java/awt/image/MemoryImageSource.java
@@ -1,5 +1,5 @@
/* MemoryImageSource.java -- Java class for providing image data
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.awt.image;
-import java.awt.Image;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
diff --git a/java/awt/image/MultiPixelPackedSampleModel.java b/java/awt/image/MultiPixelPackedSampleModel.java
new file mode 100644
index 000000000..0525d37bd
--- /dev/null
+++ b/java/awt/image/MultiPixelPackedSampleModel.java
@@ -0,0 +1,387 @@
+/* Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.awt.image;
+
+import gnu.java.awt.Buffers;
+
+/**
+ * MultiPixelPackedSampleModel provides a single band model that supports
+ * multiple pixels in a single unit. Pixels have 2^n bits and 2^k pixels fit
+ * per data element.
+ *
+ * @author Jerry Quinn <jlquinn@optonline.net>
+ */
+public class MultiPixelPackedSampleModel extends SampleModel
+{
+ private int scanlineStride;
+ private int[] bitMasks;
+ private int[] bitOffsets;
+ private int[] sampleSize;
+ private int dataBitOffset;
+ private int elemBits;
+ private int numberOfBits;
+ private int numElems;
+
+ public MultiPixelPackedSampleModel(int dataType, int w, int h,
+ int numberOfBits)
+ {
+ this(dataType, w, h, 0, numberOfBits, 0);
+ }
+
+ public MultiPixelPackedSampleModel(int dataType, int w, int h,
+ int numberOfBits, int scanlineStride,
+ int dataBitOffset)
+ {
+ super(dataType, w, h, 1);
+
+ switch (dataType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ elemBits = 8;
+ break;
+ case DataBuffer.TYPE_USHORT:
+ elemBits = 16;
+ break;
+ case DataBuffer.TYPE_INT:
+ elemBits = 32;
+ break;
+ default:
+ throw new IllegalArgumentException("MultiPixelPackedSampleModel"
+ + " unsupported dataType");
+ }
+
+ this.dataBitOffset = dataBitOffset;
+
+ this.numberOfBits = numberOfBits;
+ if (numberOfBits > elemBits)
+ throw new RasterFormatException("MultiPixelPackedSampleModel pixel size"
+ + " larger than dataType");
+ switch (numberOfBits)
+ {
+ case 1: case 2: case 4: case 8: case 16: case 32: break;
+ default:
+ throw new RasterFormatException("MultiPixelPackedSampleModel pixel"
+ + " size not 2^n bits");
+ }
+ numElems = elemBits / numberOfBits;
+
+ // Compute scan line large enough for w pixels.
+ if (scanlineStride == 0)
+ scanlineStride = ((dataBitOffset + w * numberOfBits) / elemBits) + 1;
+ this.scanlineStride = scanlineStride;
+
+
+ sampleSize = new int[1];
+ sampleSize[0] = numberOfBits;
+
+ bitMasks = new int[numElems];
+ bitOffsets = new int[numElems];
+ for (int i=0; i < numElems; i++)
+ {
+ bitOffsets[i] = numberOfBits * i;
+ bitMasks[i] = ((1 << numberOfBits) - 1) << bitOffsets[i];
+ }
+ }
+
+ public SampleModel createCompatibleSampleModel(int w, int h)
+ {
+ /* FIXME: We can avoid recalculation of bit offsets and sample
+ sizes here by passing these from the current instance to a
+ special private constructor. */
+ return new MultiPixelPackedSampleModel(dataType, w, h, numberOfBits);
+ }
+
+
+ /**
+ * Creates a DataBuffer for holding pixel data in the format and
+ * layout described by this SampleModel. The returned buffer will
+ * consist of one single bank.
+ */
+ public DataBuffer createDataBuffer()
+ {
+ int size;
+
+ // FIXME: The comment refers to SinglePixelPackedSampleModel. See if the
+ // same can be done for MultiPixelPackedSampleModel.
+ // We can save (scanlineStride - width) pixels at the very end of
+ // the buffer. The Sun reference implementation (J2SE 1.3.1 and
+ // 1.4.1_01) seems to do this; tested with Mauve test code.
+ size = scanlineStride * height;
+
+ return Buffers.createBuffer(getDataType(), size);
+ }
+
+
+ public int getNumDataElements()
+ {
+ return 1;
+ }
+
+ public int[] getSampleSize()
+ {
+ return sampleSize;
+ }
+
+ public int getSampleSize(int band)
+ {
+ return sampleSize[0];
+ }
+
+ public int getOffset(int x, int y)
+ {
+ return scanlineStride * y + ((dataBitOffset + x*numberOfBits) / elemBits);
+ }
+
+ public int getBitOffset(int x)
+ {
+ return (dataBitOffset + x*numberOfBits) % elemBits;
+ }
+
+ public int getDataBitOffset()
+ {
+ return dataBitOffset;
+ }
+
+ public int getScanlineStride()
+ {
+ return scanlineStride;
+ }
+
+ public int getPixelBitStride()
+ {
+ return numberOfBits;
+ }
+
+
+ public SampleModel createSubsetSampleModel(int[] bands)
+ {
+ int numBands = bands.length;
+ if (numBands != 1)
+ throw new RasterFormatException("MultiPixelPackedSampleModel only"
+ + " supports one band");
+
+ return new MultiPixelPackedSampleModel(dataType, width, height,
+ numberOfBits, scanlineStride,
+ dataBitOffset);
+ }
+
+ /**
+ * Extract one pixel and return in an array of transfer type.
+ *
+ * Extracts the pixel at x, y from data and stores into the 0th index of the
+ * array obj, since there is only one band. If obj is null, a new array of
+ * getTransferType() is created.
+ *
+ * @param x The x-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param y The y-coordinate of the pixel rectangle to store in <code>obj</code>.
+ * @param obj The primitive array to store the pixels into or null to force creation.
+ * @param data The DataBuffer that is the source of the pixel data.
+ * @return The primitive array containing the pixel data.
+ * @see java.awt.image.SampleModel#getDataElements(int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public Object getDataElements(int x, int y, Object obj,
+ DataBuffer data)
+ {
+ int pixel = getSample(x, y, 0, data);
+ switch (getTransferType())
+ {
+ case DataBuffer.TYPE_BYTE:
+ if (obj == null) obj = new byte[1];
+ ((byte[])obj)[0] = (byte)pixel;
+ return obj;
+ case DataBuffer.TYPE_USHORT:
+ if (obj == null) obj = new short[1];
+ ((short[])obj)[0] = (short)pixel;
+ return obj;
+ case DataBuffer.TYPE_INT:
+ if (obj == null) obj = new int[1];
+ ((int[])obj)[0] = pixel;
+ return obj;
+ default:
+ // Seems like the only sensible thing to do.
+ throw new ClassCastException();
+ }
+ }
+
+ public int[] getPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ if (iArray == null) iArray = new int[1];
+ iArray[0] = getSample(x, y, 0, data);
+
+ return iArray;
+ }
+
+ public int[] getPixels(int x, int y, int w, int h, int[] iArray,
+ DataBuffer data)
+ {
+ int offset = getOffset(x, y);
+ if (iArray == null) iArray = new int[w*h];
+ int outOffset = 0;
+ for (y=0; y<h; y++)
+ {
+ int lineOffset = offset;
+ for (x=0; x<w;)
+ {
+ int samples = data.getElem(lineOffset++);
+ for (int b=0; b<numElems && x<w; b++)
+ {
+ iArray[outOffset++] = (samples & bitMasks[b]) >>> bitOffsets[b];
+ x++;
+ }
+ }
+ offset += scanlineStride;
+ }
+ return iArray;
+ }
+
+ public int getSample(int x, int y, int b, DataBuffer data)
+ {
+ int pos =
+ ((dataBitOffset + x * numberOfBits) % elemBits) / numberOfBits;
+ int offset = getOffset(x, y);
+ int samples = data.getElem(offset);
+ return (samples & bitMasks[pos]) >>> bitOffsets[pos];
+ }
+
+ /**
+ * Set the pixel at x, y to the value in the first element of the primitive
+ * array obj.
+ *
+ * @param x The x-coordinate of the data elements in <code>obj</code>.
+ * @param y The y-coordinate of the data elements in <code>obj</code>.
+ * @param obj The primitive array containing the data elements to set.
+ * @param data The DataBuffer to store the data elements into.
+ * @see java.awt.image.SampleModel#setDataElements(int, int, int, int, java.lang.Object, java.awt.image.DataBuffer)
+ */
+ public void setDataElements(int x, int y, Object obj, DataBuffer data)
+ {
+ int transferType = getTransferType();
+ if (getTransferType() != data.getDataType())
+ {
+ throw new IllegalArgumentException("transfer type ("+
+ getTransferType()+"), "+
+ "does not match data "+
+ "buffer type (" +
+ data.getDataType() +
+ ").");
+ }
+
+ int offset = getOffset(x, y);
+
+ try
+ {
+ switch (transferType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ {
+ DataBufferByte out = (DataBufferByte) data;
+ byte[] in = (byte[]) obj;
+ out.getData()[offset] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_USHORT:
+ {
+ DataBufferUShort out = (DataBufferUShort) data;
+ short[] in = (short[]) obj;
+ out.getData()[offset] = in[0];
+ return;
+ }
+ case DataBuffer.TYPE_INT:
+ {
+ DataBufferInt out = (DataBufferInt) data;
+ int[] in = (int[]) obj;
+ out.getData()[offset] = in[0];
+ return;
+ }
+ default:
+ throw new ClassCastException("Unsupported data type");
+ }
+ }
+ catch (ArrayIndexOutOfBoundsException aioobe)
+ {
+ String msg = "While writing data elements" +
+ ", x="+x+", y="+y+
+ ", width="+width+", height="+height+
+ ", scanlineStride="+scanlineStride+
+ ", offset="+offset+
+ ", data.getSize()="+data.getSize()+
+ ", data.getOffset()="+data.getOffset()+
+ ": " +
+ aioobe;
+ throw new ArrayIndexOutOfBoundsException(msg);
+ }
+ }
+
+ public void setPixel(int x, int y, int[] iArray, DataBuffer data)
+ {
+ setSample(x, y, 0, iArray[0], data);
+ }
+
+ public void setSample(int x, int y, int b, int s, DataBuffer data)
+ {
+ int bitpos =
+ ((dataBitOffset + x * numberOfBits) % elemBits) / numberOfBits;
+ int offset = getOffset(x, y);
+
+ s = s << bitOffsets[bitpos];
+ s = s & bitMasks[bitpos];
+
+ int sample = data.getElem(offset);
+ sample |= s;
+ data.setElem(offset, sample);
+ }
+
+ /**
+ * Creates a String with some information about this SampleModel.
+ * @return A String describing this SampleModel.
+ * @see java.lang.Object#toString()
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer();
+ result.append(getClass().getName());
+ result.append("[");
+ result.append("scanlineStride=").append(scanlineStride);
+ for(int i=0; i < bitMasks.length; i+=1)
+ {
+ result.append(", mask[").append(i).append("]=0x").append(Integer.toHexString(bitMasks[i]));
+ }
+
+ result.append("]");
+ return result.toString();
+ }
+}
diff --git a/java/awt/image/PackedColorModel.java b/java/awt/image/PackedColorModel.java
index 2d8b0e1ab..1f18cf68e 100644
--- a/java/awt/image/PackedColorModel.java
+++ b/java/awt/image/PackedColorModel.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,11 +34,13 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.image;
+import gnu.java.awt.BitMaskExtent;
+
import java.awt.Point;
import java.awt.color.ColorSpace;
-import gnu.java.awt.BitMaskExtent;
/**
* @author Rolf W. Rasmussen <rolfwr@ii.uib.no>
diff --git a/java/awt/image/PixelGrabber.java b/java/awt/image/PixelGrabber.java
index fd5c24a86..da50d1f70 100644
--- a/java/awt/image/PixelGrabber.java
+++ b/java/awt/image/PixelGrabber.java
@@ -1,39 +1,39 @@
/* PixelGrabber.java -- retrieve a subset of an image's data
- Copyright (C) 1999, 2003 Free Software Foundation, Inc.
-
- This file is part of GNU Classpath.
-
- GNU Classpath is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- GNU Classpath is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with GNU Classpath; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA.
-
- Linking this library statically or dynamically with other modules is
- making a combined work based on this library. Thus, the terms and
- conditions of the GNU General Public License cover the whole
- combination.
-
- As a special exception, the copyright holders of this library give you
- permission to link this library with independent modules to produce an
- executable, regardless of the license terms of these independent
- modules, and to copy and distribute the resulting executable under
- terms of your choice, provided that you also meet, for each linked
- independent module, the terms and conditions of the license of that
- module. An independent module is a module which is not derived from
- or based on this library. If you modify this library, you may extend
- this exception to your version of the library, but you are not
- obligated to do so. If you do not wish to do so, delete this
- exception statement from your version. */
+ Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
package java.awt.image;
diff --git a/java/awt/image/Raster.java b/java/awt/image/Raster.java
index 4fd194e2a..0db5aa10f 100644
--- a/java/awt/image/Raster.java
+++ b/java/awt/image/Raster.java
@@ -154,6 +154,35 @@ public class Raster
return createWritableRaster(sm, location);
}
+ public static WritableRaster createPackedRaster(int dataType,
+ int w, int h,
+ int bands, int bitsPerBand,
+ Point location)
+ {
+ if (bands <= 0 || (bands * bitsPerBand > getTypeBits(dataType)))
+ throw new IllegalArgumentException();
+
+ SampleModel sm;
+
+ if (bands == 1)
+ sm = new MultiPixelPackedSampleModel(dataType, w, h, bitsPerBand);
+ else
+ {
+ int[] bandMasks = new int[bands];
+ int mask = 0x1;
+ for (int bits = bitsPerBand; --bits != 0;)
+ mask = (mask << 1) | 0x1;
+ for (int i = 0; i < bands; i++)
+ {
+ bandMasks[i] = mask;
+ mask <<= bitsPerBand;
+ }
+
+ sm = new SinglePixelPackedSampleModel(dataType, w, h, bandMasks);
+ }
+ return createWritableRaster(sm, location);
+ }
+
public static WritableRaster
createInterleavedRaster(DataBuffer dataBuffer, int w, int h,
int scanlineStride, int pixelStride,
@@ -329,6 +358,11 @@ public class Raster
return height;
}
+ public final int getNumBands()
+ {
+ return numBands;
+ }
+
public final int getNumDataElements()
{
return numDataElements;
@@ -472,5 +506,24 @@ public class Raster
return result.toString();
}
-
+
+ // Map from datatype to bits
+ private static int getTypeBits(int dataType)
+ {
+ switch (dataType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ return 8;
+ case DataBuffer.TYPE_USHORT:
+ case DataBuffer.TYPE_SHORT:
+ return 16;
+ case DataBuffer.TYPE_INT:
+ case DataBuffer.TYPE_FLOAT:
+ return 32;
+ case DataBuffer.TYPE_DOUBLE:
+ return 64;
+ default:
+ return 0;
+ }
+ }
}
diff --git a/java/awt/image/RasterOp.java b/java/awt/image/RasterOp.java
index 57961808e..84d47c119 100644
--- a/java/awt/image/RasterOp.java
+++ b/java/awt/image/RasterOp.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000, 2002 Free Software Foundation
+/* Copyright (C) 2000, 2002, 2004 Free Software Foundation
This file is part of GNU Classpath.
@@ -34,11 +34,12 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.awt.image;
+import java.awt.RenderingHints;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D;
-import java.awt.RenderingHints;
public interface RasterOp {
diff --git a/java/awt/image/RescaleOp.java b/java/awt/image/RescaleOp.java
new file mode 100644
index 000000000..9235e0e14
--- /dev/null
+++ b/java/awt/image/RescaleOp.java
@@ -0,0 +1,210 @@
+/* Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.awt.image;
+
+import java.awt.RenderingHints;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+import java.util.Arrays;
+
+/**
+ * @author Jerry Quinn <jlquinn@optonline.net>
+ *
+ */
+public class RescaleOp implements BufferedImageOp, RasterOp
+{
+ private float[] scale;
+ private float[] offsets;
+ private RenderingHints hints = null;
+
+ public RescaleOp(float[] scaleFactors,
+ float[] offsets,
+ RenderingHints hints)
+ {
+ this.scale = scaleFactors;
+ this.offsets = offsets;
+ this.hints = hints;
+ }
+
+ public RescaleOp(float scaleFactor,
+ float offset,
+ RenderingHints hints)
+ {
+ scale = new float[]{ scaleFactor };
+ offsets = new float[]{offset};
+ this.hints = hints;
+ }
+
+ public final float[] getScaleFactors(float[] scaleFactors)
+ {
+ if (scaleFactors == null)
+ scaleFactors = new float[scale.length];
+ System.arraycopy(scale, 0, scaleFactors, 0, scale.length);
+ return scaleFactors;
+ }
+
+ public final float[] getOffsets(float[] offsets)
+ {
+ if (offsets == null)
+ offsets = new float[this.offsets.length];
+ System.arraycopy(this.offsets, 0, offsets, 0, this.offsets.length);
+ return offsets;
+ }
+
+ public final int getNumFactors() { return scale.length; }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getRenderingHints()
+ */
+ public RenderingHints getRenderingHints() { return hints; }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#filter(java.awt.image.BufferedImage, java.awt.image.BufferedImage)
+ */
+ public BufferedImage filter(BufferedImage src, BufferedImage dst) {
+ // TODO Make sure premultiplied alpha is handled correctly.
+ // TODO See that color conversion is handled.
+ // TODO figure out how to use rendering hints.
+ if (scale.length != offsets.length)
+ throw new IllegalArgumentException();
+
+ ColorModel scm = src.getColorModel();
+ if (dst == null) dst = createCompatibleDestImage(src, null);
+
+ WritableRaster wsrc = src.getRaster();
+ WritableRaster wdst = dst.getRaster();
+
+ // Share constant across colors except alpha
+ if (scale.length == 1 || scale.length == scm.getNumColorComponents())
+ {
+ // Construct a raster that doesn't include an alpha band.
+ int[] subbands = new int[scm.getNumColorComponents()];
+ for (int i=0; i < subbands.length; i++) subbands[i] = i;
+ wsrc =
+ wsrc.createWritableChild(wsrc.minX, wsrc.minY, wsrc.width, wsrc.height,
+ wsrc.minX, wsrc.minY, subbands);
+ }
+ // else all color bands
+
+ filter(wsrc, wdst);
+ return dst;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#filter(java.awt.image.Raster, java.awt.image.WritableRaster)
+ */
+ public WritableRaster filter(Raster src, WritableRaster dest) {
+ if (dest == null) dest = src.createCompatibleWritableRaster();
+
+ // Required sanity checks
+ if (src.numBands != dest.numBands || scale.length != offsets.length)
+ throw new IllegalArgumentException();
+ if (scale.length != 1 && scale.length != src.numBands)
+ throw new IllegalArgumentException();
+
+ // Create scaling arrays if needed
+ float[] lscale = scale;
+ float[] loff = offsets;
+ if (scale.length == 1)
+ {
+ lscale = new float[src.numBands];
+ Arrays.fill(lscale, scale[0]);
+ loff = new float[src.numBands];
+ Arrays.fill(loff, offsets[0]);
+ }
+
+ // TODO The efficiency here can be improved for various data storage
+ // patterns, aka SampleModels.
+ float[] pixel = new float[src.numBands];
+ for (int y = src.minY; y < src.height- src.minY; y++)
+ for (int x = src.minX; x < src.width - src.minX; x++)
+ {
+ src.getPixel(x, y, pixel);
+ for (int b = 0; b < src.numBands; b++)
+ pixel[b] = pixel[b] * lscale[b] + loff[b];
+ dest.setPixel(x, y, pixel);
+ }
+ return dest;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#createCompatibleDestImage(java.awt.image.BufferedImage, java.awt.image.ColorModel)
+ */
+ public BufferedImage createCompatibleDestImage(BufferedImage src,
+ ColorModel dstCM)
+ {
+ if (dstCM == null) dstCM = src.getColorModel();
+ WritableRaster wr = src.getRaster().createCompatibleWritableRaster();
+ BufferedImage image
+ = new BufferedImage(dstCM, wr, src.isPremultiplied, null);
+ return image;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#createCompatibleDestRaster(java.awt.image.Raster)
+ */
+ public WritableRaster createCompatibleDestRaster(Raster src)
+ {
+ return src.createCompatibleWritableRaster();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getBounds2D(java.awt.image.BufferedImage)
+ */
+ public Rectangle2D getBounds2D(BufferedImage src)
+ {
+ return src.getRaster().getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.RasterOp#getBounds2D(java.awt.image.Raster)
+ */
+ public Rectangle2D getBounds2D(Raster src)
+ {
+ return src.getBounds();
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.image.BufferedImageOp#getPoint2D(java.awt.geom.Point2D, java.awt.geom.Point2D)
+ */
+ public Point2D getPoint2D(Point2D src, Point2D dst) {
+ if (dst == null) dst = (Point2D) src.clone();
+ else dst.setLocation(src);
+ return dst;
+ }
+
+}
diff --git a/java/awt/image/SinglePixelPackedSampleModel.java b/java/awt/image/SinglePixelPackedSampleModel.java
index 578500dbd..9f49d836d 100644
--- a/java/awt/image/SinglePixelPackedSampleModel.java
+++ b/java/awt/image/SinglePixelPackedSampleModel.java
@@ -59,6 +59,16 @@ public class SinglePixelPackedSampleModel extends SampleModel
int scanlineStride, int[] bitMasks)
{
super(dataType, w, h, bitMasks.length);
+
+ switch (dataType)
+ {
+ case DataBuffer.TYPE_BYTE:
+ case DataBuffer.TYPE_USHORT:
+ case DataBuffer.TYPE_INT:
+ break;
+ default:
+ throw new IllegalArgumentException("SinglePixelPackedSampleModel unsupported dataType");
+ }
this.scanlineStride = scanlineStride;
this.bitMasks = bitMasks;
diff --git a/java/awt/peer/MenuBarPeer.java b/java/awt/peer/MenuBarPeer.java
index 38f57ecdb..6018c41b3 100644
--- a/java/awt/peer/MenuBarPeer.java
+++ b/java/awt/peer/MenuBarPeer.java
@@ -43,7 +43,6 @@ import java.awt.Menu;
public interface MenuBarPeer extends MenuComponentPeer
{
void addHelpMenu(Menu menu);
- void addMenu(Menu menu);
void delMenu(int index);
} // interface MenuBarPeer
diff --git a/java/io/DeleteFileHelper.java b/java/io/DeleteFileHelper.java
index 4445c983e..b4e986d56 100644
--- a/java/io/DeleteFileHelper.java
+++ b/java/io/DeleteFileHelper.java
@@ -47,7 +47,7 @@ import java.util.ArrayList;
* @author Michael Koch (konqueror@gmx.de)
* @author Andrew John Hughes (gnu_andrew@member.fsf.org)
*/
-public final class DeleteFileHelper extends Thread
+final class DeleteFileHelper extends Thread
{
private static ArrayList<File> filesToDelete;
@@ -67,7 +67,8 @@ public final class DeleteFileHelper extends Thread
}
catch (IllegalStateException e)
{
- // Shutdown is already in progress, so we can't register ours.
+ // Shutdown is already in progress, so we can't
+ // register ours.
}
return null;
diff --git a/java/io/ObjectInputStream.java b/java/io/ObjectInputStream.java
index 9d5dfca64..c71f9ceee 100644
--- a/java/io/ObjectInputStream.java
+++ b/java/io/ObjectInputStream.java
@@ -51,7 +51,6 @@ import java.util.Arrays;
import java.util.Hashtable;
import java.util.Vector;
-
/**
* @author Tom Tromey (tromey@redhat.com)
* @author Jeroen Frijters (jeroen@frijters.net)
@@ -307,6 +306,9 @@ public class ObjectInputStream extends InputStream
Object obj = newObject(clazz, osc.firstNonSerializableParent);
int handle = assignNewHandle(obj);
+ Object prevObject = this.currentObject;
+ ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
+
this.currentObject = obj;
ObjectStreamClass[] hierarchy =
inputGetObjectStreamClasses(clazz);
@@ -354,8 +356,8 @@ public class ObjectInputStream extends InputStream
}
}
- this.currentObject = null;
- this.currentObjectStreamClass = null;
+ this.currentObject = prevObject;
+ this.currentObjectStreamClass = prevObjectStreamClass;
ret_val = processResolution(osc, obj, handle);
break;
@@ -1795,7 +1797,8 @@ public class ObjectInputStream extends InputStream
*/
private static native ClassLoader currentClassLoader (SecurityManager sm);
- private void callReadMethod (Method readObject, Class klass, Object obj) throws IOException
+ private void callReadMethod (Method readObject, Class klass, Object obj)
+ throws ClassNotFoundException, IOException
{
try
{
@@ -1809,6 +1812,8 @@ public class ObjectInputStream extends InputStream
throw (RuntimeException) exception;
if (exception instanceof IOException)
throw (IOException) exception;
+ if (exception instanceof ClassNotFoundException)
+ throw (ClassNotFoundException) exception;
throw new IOException("Exception thrown from readObject() on " +
klass + ": " + exception.getClass().getName());
diff --git a/java/io/ObjectOutputStream.java b/java/io/ObjectOutputStream.java
index d86b26f16..ca6a1541a 100644
--- a/java/io/ObjectOutputStream.java
+++ b/java/io/ObjectOutputStream.java
@@ -338,6 +338,8 @@ public class ObjectOutputStream extends OutputStream
if (obj instanceof Serializable)
{
+ Object prevObject = this.currentObject;
+ ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass;
currentObject = obj;
ObjectStreamClass[] hierarchy =
ObjectStreamClass.getObjectStreamClasses(clazz);
@@ -366,8 +368,8 @@ public class ObjectOutputStream extends OutputStream
}
}
- currentObject = null;
- currentObjectStreamClass = null;
+ this.currentObject = prevObject;
+ this.currentObjectStreamClass = prevObjectStreamClass;
currentPutField = null;
break;
}
diff --git a/java/lang/Comparable.java b/java/lang/Comparable.java
index d8b7b2a50..c8d8073d9 100644
--- a/java/lang/Comparable.java
+++ b/java/lang/Comparable.java
@@ -52,18 +52,19 @@ package java.lang;
*
* <p>Lists, arrays, and sets of objects that implement this interface can
* be sorted automatically, without the need for an explicit
- * {@link Comparator}. Note that <code>e1.compareTo(null)</code> should
- * throw an Exception; as should comparison between incompatible classes.
+ * {@link java.util.Comparator}. Note that <code>e1.compareTo(null)</code>
+ * should throw an Exception; as should comparison between incompatible
+ * classes.
*
* @author Geoff Berry
* @author Warren Levy <warrenl@cygnus.com>
- * @see Comparator
- * @see Collections#sort(List)
- * @see Arrays#sort(Object[])
- * @see SortedSet
- * @see SortedMap
- * @see TreeSet
- * @see TreeMap
+ * @see java.util.Comparator
+ * @see java.util.Collections#sort(java.util.List)
+ * @see java.util.Arrays#sort(Object[])
+ * @see java.util.SortedSet
+ * @see java.util.SortedMap
+ * @see java.util.TreeSet
+ * @see java.util.TreeMap
* @since 1.2
* @status updated to 1.5
*/
diff --git a/java/lang/Runtime.java b/java/lang/Runtime.java
index 44fa10bc2..52c46602c 100644
--- a/java/lang/Runtime.java
+++ b/java/lang/Runtime.java
@@ -664,19 +664,25 @@ public class Runtime
*/
public void load(String filename)
{
+ SecurityManager sm = securityManager; // Be thread-safe!
+ if (sm != null)
+ sm.checkLink(filename);
if (loadLib(filename) == 0)
throw new UnsatisfiedLinkError("Could not load library " + filename);
}
- // Private version of load(String) that doesn't throw Exception on
- // load error, but it does do security checks (which can throw
- // SecurityExceptions). Convenience method for early bootstrap
- // process.
- private int loadLib(String filename)
+ /**
+ * Do a security check on the filename and then load the native library.
+ *
+ * @param filename the file to load
+ * @return 0 on failure, nonzero on success
+ * @throws SecurityException if file read permission is denied
+ */
+ private static int loadLib(String filename)
{
SecurityManager sm = securityManager; // Be thread-safe!
if (sm != null)
- sm.checkLink(filename);
+ sm.checkRead(filename);
return VMRuntime.nativeLoad(filename);
}
@@ -702,6 +708,10 @@ public class Runtime
*/
public void loadLibrary(String libname)
{
+ SecurityManager sm = securityManager; // Be thread-safe!
+ if (sm != null)
+ sm.checkLink(libname);
+
String filename;
ClassLoader cl = VMSecurityManager.currentClassLoader();
if (cl != null)
@@ -709,15 +719,15 @@ public class Runtime
filename = cl.findLibrary(libname);
if (filename != null)
{
- // Use loadLib so no UnsatisfiedLinkError are thrown.
if (loadLib(filename) != 0)
return;
+ else
+ throw new UnsatisfiedLinkError("Could not load library " + filename);
}
}
filename = System.mapLibraryName(libname);
for (int i = 0; i < libpath.length; i++)
- // Use loadLib so no UnsatisfiedLinkError are thrown.
if (loadLib(libpath[i] + filename) != 0)
return;
diff --git a/java/lang/StackTraceElement.java b/java/lang/StackTraceElement.java
index d9e8a31b7..e1e07f3fb 100644
--- a/java/lang/StackTraceElement.java
+++ b/java/lang/StackTraceElement.java
@@ -77,7 +77,7 @@ public class StackTraceElement implements Serializable
*
* @serial the enclosing class, if known
*/
- private final String className;
+ private final String declaringClass;
/**
* The method name in the class, null if unknown.
@@ -106,7 +106,7 @@ public class StackTraceElement implements Serializable
{
this.fileName = fileName;
this.lineNumber = lineNumber;
- this.className = className;
+ this.declaringClass = className;
this.methodName = methodName;
this.isNative = isNative;
}
@@ -142,7 +142,7 @@ public class StackTraceElement implements Serializable
*/
public String getClassName()
{
- return className;
+ return declaringClass;
}
/**
@@ -183,9 +183,9 @@ public class StackTraceElement implements Serializable
public String toString()
{
StringBuffer sb = new StringBuffer();
- if (className != null)
+ if (declaringClass != null)
{
- sb.append(className);
+ sb.append(declaringClass);
if (methodName != null)
sb.append('.');
}
@@ -217,7 +217,7 @@ public class StackTraceElement implements Serializable
StackTraceElement e = (StackTraceElement) o;
return equals(fileName, e.fileName)
&& lineNumber == e.lineNumber
- && equals(className, e.className)
+ && equals(declaringClass, e.declaringClass)
&& equals(methodName, e.methodName);
}
@@ -230,7 +230,7 @@ public class StackTraceElement implements Serializable
*/
public int hashCode()
{
- return hashCode(fileName) ^ lineNumber ^ hashCode(className)
+ return hashCode(fileName) ^ lineNumber ^ hashCode(declaringClass)
^ hashCode(methodName);
}
diff --git a/java/lang/System.java b/java/lang/System.java
index 49e9ee0a4..115f6b6a8 100644
--- a/java/lang/System.java
+++ b/java/lang/System.java
@@ -624,6 +624,8 @@ public final class System
* @throws NullPointerException
* @throws SecurityException if permission is denied
* @since 1.5
+ * @specnote This method was deprecated in some JDK releases, but
+ * was restored in 1.5.
*/
public static String getenv(String name)
{
diff --git a/java/lang/Throwable.java b/java/lang/Throwable.java
index 0d7a9466a..5d29684fb 100644
--- a/java/lang/Throwable.java
+++ b/java/lang/Throwable.java
@@ -402,7 +402,7 @@ public class Throwable implements Serializable
private static class StaticData
{
- private final static String nl;
+ final static String nl;
static
{
diff --git a/java/net/Inet4Address.java b/java/net/Inet4Address.java
index 5b8ddc171..54643fb2e 100644
--- a/java/net/Inet4Address.java
+++ b/java/net/Inet4Address.java
@@ -55,6 +55,9 @@ import java.util.Arrays;
*/
public final class Inet4Address extends InetAddress
{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
static final long serialVersionUID = 3286316764910316507L;
/**
diff --git a/java/net/Socket.java b/java/net/Socket.java
index 8855958cf..80caced4e 100644
--- a/java/net/Socket.java
+++ b/java/net/Socket.java
@@ -479,7 +479,8 @@ public class Socket
/**
* Returns the local address to which this socket is bound. If this socket
- * is not connected, then <code>null</code> is returned.
+ * is not connected, then a wildcard address, for which
+ * @see isAnyLocalAddress() is <code>true</code>, is returned.
*
* @return The local address
*
@@ -488,7 +489,7 @@ public class Socket
public InetAddress getLocalAddress()
{
if (! isBound())
- return null;
+ return InetAddress.ANY_IF;
InetAddress addr = null;
diff --git a/java/net/URL.java b/java/net/URL.java
index 92ae1143a..e8899a5fd 100644
--- a/java/net/URL.java
+++ b/java/net/URL.java
@@ -407,6 +407,7 @@ public final class URL implements Serializable
host = context.host;
port = context.port;
file = context.file;
+ userInfo = context.userInfo;
if (file == null || file.length() == 0)
file = "/";
authority = context.authority;
@@ -421,6 +422,7 @@ public final class URL implements Serializable
host = context.host;
port = context.port;
file = context.file;
+ userInfo = context.userInfo;
if (file == null || file.length() == 0)
file = "/";
authority = context.authority;
@@ -622,6 +624,8 @@ public final class URL implements Serializable
*/
public String getUserInfo()
{
+ if (userInfo != null)
+ return userInfo;
int at = (host == null) ? -1 : host.indexOf('@');
return at < 0 ? null : host.substring(0, at);
}
diff --git a/java/net/URLClassLoader.java b/java/net/URLClassLoader.java
index 5c7b682b1..901a81fa4 100644
--- a/java/net/URLClassLoader.java
+++ b/java/net/URLClassLoader.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.net;
import java.io.ByteArrayOutputStream;
@@ -59,7 +60,6 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.jar.Manifest;
-
/**
* A secure class loader that can load classes and resources from
* multiple locations. Given an array of <code>URL</code>s this class
@@ -656,11 +656,12 @@ public class URLClassLoader extends SecureClassLoader
if (loader == null)
{
String file = newUrl.getFile();
+ String protocol = newUrl.getProtocol();
// Check that it is not a directory
if (! (file.endsWith("/") || file.endsWith(File.separator)))
loader = new JarURLLoader(this, newUrl);
- else if ("file".equals(newUrl.getProtocol()))
+ else if ("file".equals(protocol))
loader = new FileURLLoader(this, newUrl);
else
loader = new RemoteURLLoader(this, newUrl);
@@ -811,14 +812,18 @@ public class URLClassLoader extends SecureClassLoader
// And finally construct the class!
SecurityManager sm = System.getSecurityManager();
if (sm != null && securityContext != null)
- return (Class) AccessController.doPrivileged(new PrivilegedAction()
- {
- public Object run()
+ {
+ return (Class)AccessController.doPrivileged
+ (new PrivilegedAction()
{
- return defineClass(className, classData, 0,
- classData.length, source);
- }
- }, securityContext);
+ public Object run()
+ {
+ return defineClass(className, classData,
+ 0, classData.length,
+ source);
+ }
+ }, securityContext);
+ }
else
return defineClass(className, classData, 0, classData.length, source);
}
@@ -955,13 +960,17 @@ public class URLClassLoader extends SecureClassLoader
// If the file end in / it must be an directory.
if (file.endsWith("/") || file.endsWith(File.separator))
- // Grant permission to read everything in that directory and
- // all subdirectories.
- permissions.add(new FilePermission(file + "-", "read"));
+ {
+ // Grant permission to read everything in that directory and
+ // all subdirectories.
+ permissions.add(new FilePermission(file + "-", "read"));
+ }
else
- // It is a 'normal' file.
- // Grant permission to access that file.
- permissions.add(new FilePermission(file, "read"));
+ {
+ // It is a 'normal' file.
+ // Grant permission to access that file.
+ permissions.add(new FilePermission(file, "read"));
+ }
}
else
{
diff --git a/java/net/URLConnection.java b/java/net/URLConnection.java
index a4b8a9dc3..c9919e043 100644
--- a/java/net/URLConnection.java
+++ b/java/net/URLConnection.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package java.net;
import java.io.IOException;
@@ -49,7 +50,6 @@ import java.util.Date;
import java.util.Locale;
import java.util.Map;
-
/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
@@ -84,8 +84,8 @@ import java.util.Map;
* by the actual content handlers as described in the description of that
* method.
*
- * @author Aaron M. Renn <arenn@urbanophile.com>
- * @author Warren Levy <warrenl@cygnus.com>
+ * @author Aaron M. Renn (arenn@urbanophile.com)
+ * @author Warren Levy (warrenl@cygnus.com)
*/
public abstract class URLConnection
{
@@ -160,13 +160,12 @@ public abstract class URLConnection
* This is the URL associated with this connection
*/
protected URL url;
-
private static SimpleDateFormat[] dateFormats;
private static boolean dateformats_initialized;
/* Cached ParsePosition, used when parsing dates. */
private ParsePosition position;
-
+
/**
* Creates a URL connection to a given URL. A real connection is not made.
* Use #connect to do this.
@@ -363,7 +362,7 @@ public abstract class URLConnection
{
if (! dateformats_initialized)
initializeDateFormats();
-
+
if (position == null)
position = new ParsePosition(0);
@@ -404,63 +403,46 @@ public abstract class URLConnection
}
/**
- * This method returns the content of the document pointed to by the URL
- * as an Object. The type of object depends on the MIME type of the
- * object and particular content hander loaded. Most text type content
- * handlers will return a subclass of InputStream. Images usually return
- * a class that implements ImageProducer. There is not guarantee what
- * type of object will be returned, however.
- * <p>
- * This class first determines the MIME type of the content, then creates
- * a ContentHandler object to process the input. If the ContentHandlerFactory
- * is set, then that object is called to load a content handler, otherwise
- * a class called gnu.java.net.content.&lt;content_type&gt; is tried.
- * The default class will also be used if the content handler factory returns
- * a null content handler.
- *
- * @exception IOException If an error occurs
+ * This method returns the content of the document pointed to by the
+ * URL as an Object. The type of object depends on the MIME type of
+ * the object and particular content hander loaded. Most text type
+ * content handlers will return a subclass of
+ * <code>InputStream</code>. Images usually return a class that
+ * implements <code>ImageProducer</code>. There is not guarantee
+ * what type of object will be returned, however.
+ *
+ * <p>This class first determines the MIME type of the content, then
+ * creates a ContentHandler object to process the input. If the
+ * <code>ContentHandlerFactory</code> is set, then that object is
+ * called to load a content handler, otherwise a class called
+ * gnu.java.net.content.&lt;content_type&gt; is tried. If this
+ * handler does not exist, the method will simple return the
+ * <code>InputStream</code> returned by
+ * <code>getInputStream()</code>. Note that the default
+ * implementation of <code>getInputStream()</code> throws a
+ * <code>UnknownServiceException</code> so subclasses are encouraged
+ * to override this method.</p>
+ *
+ * @exception IOException If an error with the connection occurs.
* @exception UnknownServiceException If the protocol does not support the
- * content type
+ * content type at all.
*/
public Object getContent() throws IOException
{
- // connect();
- String type = getContentType();
-
- // First try the factory
- ContentHandler ch = null;
+ if (!connected)
+ connect();
- if (factory != null)
- ch = factory.createContentHandler(type);
+ // FIXME: Doc indicates that other criteria should be applied as
+ // heuristics to determine the true content type, e.g. see
+ // guessContentTypeFromName() and guessContentTypeFromStream methods
+ // as well as FileNameMap class & fileNameMap field & get/set methods.
+ String type = getContentType();
+ ContentHandler ch = getContentHandler(type);
if (ch != null)
return ch.getContent(this);
- // Then try our default class
- try
- {
- Class cls =
- Class.forName("gnu.java.net.content." + type.replace('/', '.'));
-
- Object obj = cls.newInstance();
-
- if (! (obj instanceof ContentHandler))
- throw new UnknownServiceException(type);
-
- ch = (ContentHandler) obj;
- return ch.getContent(this);
- }
- catch (ClassNotFoundException e)
- {
- }
- catch (InstantiationException e)
- {
- }
- catch (IllegalAccessException e)
- {
- }
-
- throw new UnknownServiceException(type);
+ return getInputStream();
}
/**
@@ -926,7 +908,7 @@ public abstract class URLConnection
public static String guessContentTypeFromStream(InputStream is)
throws IOException
{
- return ("application/octet-stream");
+ return "application/octet-stream";
}
/**
@@ -957,9 +939,9 @@ public abstract class URLConnection
*
* @since 1.2
*/
- public static void setFileNameMap(FileNameMap map)
+ public static synchronized void setFileNameMap(FileNameMap map)
{
- // Throw an exception if an extant security mgr precludes
+ // Throw an exception if an extant security manager precludes
// setting the factory.
SecurityManager s = System.getSecurityManager();
if (s != null)
@@ -968,6 +950,53 @@ public abstract class URLConnection
fileNameMap = map;
}
+ private ContentHandler getContentHandler(String contentType)
+ {
+ // No content type so just handle it as the default.
+ if (contentType == null || contentType.equals(""))
+ return null;
+
+ ContentHandler handler = null;
+
+ // If a non-default factory has been set, use it.
+ if (factory != null)
+ handler = factory.createContentHandler(contentType);
+
+ // Then try our default class.
+ try
+ {
+ String typeClass = contentType.replace('/', '.');
+
+ // Deal with "Content-Type: text/html; charset=ISO-8859-1".
+ int parameterBegin = typeClass.indexOf(';');
+ if (parameterBegin >= 1)
+ typeClass = typeClass.substring(0, parameterBegin);
+
+ Class cls = Class.forName("gnu.java.net.content." + typeClass);
+ Object obj = cls.newInstance();
+
+ if (obj instanceof ContentHandler)
+ {
+ handler = (ContentHandler) obj;
+ return handler;
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ // Ignore.
+ }
+ catch (InstantiationException e)
+ {
+ // Ignore.
+ }
+ catch (IllegalAccessException e)
+ {
+ // Ignore.
+ }
+
+ return handler;
+ }
+
// We don't put these in a static initializer, because it creates problems
// with initializer co-dependency: SimpleDateFormat's constructors eventually
// depend on URLConnection (via the java.text.*Symbols classes).
diff --git a/java/nio/ByteBuffer.java b/java/nio/ByteBuffer.java
index 378e58827..e502e0031 100644
--- a/java/nio/ByteBuffer.java
+++ b/java/nio/ByteBuffer.java
@@ -260,11 +260,27 @@ public abstract class ByteBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with <code>int</code> arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data. Note that the hashcode is dependent
+ * on buffer content, and therefore is not useful if the buffer
+ * content may change.
+ *
+ * @return the hash code
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ int hashCode = get(position()) + 31;
+ int multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
+ }
+ return hashCode;
}
/**
diff --git a/java/nio/CharBuffer.java b/java/nio/CharBuffer.java
index 4ef257bed..700c56750 100644
--- a/java/nio/CharBuffer.java
+++ b/java/nio/CharBuffer.java
@@ -297,11 +297,25 @@ public abstract class CharBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with int arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data. Note that the hashcode is dependent
+ * on buffer content, and therefore is not useful if the buffer
+ * content may change.
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ int hashCode = get(position()) + 31;
+ int multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
+ }
+ return hashCode;
}
/**
diff --git a/java/nio/DoubleBuffer.java b/java/nio/DoubleBuffer.java
index 10055cd08..dd16ee049 100644
--- a/java/nio/DoubleBuffer.java
+++ b/java/nio/DoubleBuffer.java
@@ -243,11 +243,27 @@ public abstract class DoubleBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with <code>long</code> arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data, in Double.doubleToLongBits() form
+ * Note that the hashcode is dependent on buffer content,
+ * and therefore is not useful if the buffer content may change.
+ *
+ * @return the hash code (casted to int)
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ long hashCode = Double.doubleToLongBits(get(position())) + 31;
+ long multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (Double.doubleToLongBits(get(i)) + 30)*multiplier;
+ }
+ return ((int)hashCode);
}
/**
diff --git a/java/nio/FloatBuffer.java b/java/nio/FloatBuffer.java
index 6d1950352..2ead8cbc4 100644
--- a/java/nio/FloatBuffer.java
+++ b/java/nio/FloatBuffer.java
@@ -243,11 +243,27 @@ public abstract class FloatBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with <code>int</code> arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data, in Float.floatToIntBits() form
+ * Note that the hashcode is dependent on buffer content,
+ * and therefore is not useful if the buffer content may change.
+ *
+ * @return the hash code
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ int hashCode = Float.floatToIntBits(get(position())) + 31;
+ int multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (Float.floatToIntBits(get(i)) + 30)*multiplier;
+ }
+ return hashCode;
}
/**
diff --git a/java/nio/IntBuffer.java b/java/nio/IntBuffer.java
index 68a71db3b..814e0414b 100644
--- a/java/nio/IntBuffer.java
+++ b/java/nio/IntBuffer.java
@@ -243,11 +243,27 @@ public abstract class IntBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with <code>int</code> arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data. Note that the hashcode is dependent
+ * on buffer content, and therefore is not useful if the buffer
+ * content may change.
+ *
+ * @return the hash code
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ int hashCode = get(position()) + 31;
+ int multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
+ }
+ return hashCode;
}
/**
diff --git a/java/nio/LongBuffer.java b/java/nio/LongBuffer.java
index c4066b1d3..6e9ef34e8 100644
--- a/java/nio/LongBuffer.java
+++ b/java/nio/LongBuffer.java
@@ -243,11 +243,27 @@ public abstract class LongBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with <code>long</code> arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data. Note that the hashcode is dependent
+ * on buffer content, and therefore is not useful if the buffer
+ * content may change.
+ *
+ * @return the hash code (casted to int)
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ long hashCode = get(position()) + 31;
+ long multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
+ }
+ return ((int)hashCode);
}
/**
diff --git a/java/nio/ShortBuffer.java b/java/nio/ShortBuffer.java
index 083039101..db03076b6 100644
--- a/java/nio/ShortBuffer.java
+++ b/java/nio/ShortBuffer.java
@@ -243,11 +243,27 @@ public abstract class ShortBuffer extends Buffer
/**
* Calculates a hash code for this buffer.
+ *
+ * This is done with <code>int</code> arithmetic,
+ * where ** represents exponentiation, by this formula:<br>
+ * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
+ * (s[limit()-1]+30)*31**(limit()-1)</code>.
+ * Where s is the buffer data. Note that the hashcode is dependent
+ * on buffer content, and therefore is not useful if the buffer
+ * content may change.
+ *
+ * @return the hash code
*/
public int hashCode ()
{
- // FIXME: Check what SUN calculates here.
- return super.hashCode ();
+ int hashCode = get(position()) + 31;
+ int multiplier = 1;
+ for (int i = position() + 1; i < limit(); ++i)
+ {
+ multiplier *= 31;
+ hashCode += (get(i) + 30)*multiplier;
+ }
+ return hashCode;
}
/**
diff --git a/java/security/BasicPermission.java b/java/security/BasicPermission.java
index b5ad225c7..446b9033f 100644
--- a/java/security/BasicPermission.java
+++ b/java/security/BasicPermission.java
@@ -81,9 +81,8 @@ public abstract class BasicPermission extends java.security.Permission
private static final long serialVersionUID = 6279438298436773498L;
/**
- * Create a new instance with the specified permission name. If the name
- * is empty, or contains an illegal wildcard character, an exception is
- * thrown.
+ * Create a new instance with the specified permission name. If the
+ * name is empty an exception is thrown.
*
* @param name the name of this permission
* @throws NullPointerException if name is null
@@ -92,12 +91,11 @@ public abstract class BasicPermission extends java.security.Permission
public BasicPermission(String name)
{
super(name);
- if (name.indexOf("*") != -1)
- {
- if ((! name.endsWith(".*") && ! name.equals("*"))
- || name.indexOf("*") != name.lastIndexOf("*"))
- throw new IllegalArgumentException("Bad wildcard: " + name);
- }
+
+ // This routine used to check for illegal wildcards, but no such
+ // requirement exists in the specification and Sun's runtime
+ // doesn't appear to do it.
+
if ("".equals(name))
throw new IllegalArgumentException("Empty name");
}
diff --git a/java/security/cert/X509CRLSelector.java b/java/security/cert/X509CRLSelector.java
new file mode 100644
index 000000000..a59791e67
--- /dev/null
+++ b/java/security/cert/X509CRLSelector.java
@@ -0,0 +1,445 @@
+/* X509CRLSelector.java -- selects X.509 CRLs by criteria.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.security.cert;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import java.math.BigInteger;
+
+import java.security.AccessController;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.security.auth.x500.X500Principal;
+
+import gnu.java.security.action.GetPropertyAction;
+import gnu.java.security.der.DERReader;
+import gnu.java.security.der.DERValue;
+
+/**
+ * A class for matching X.509 certificate revocation lists by criteria.
+ *
+ * <p>Use of this class requires extensive knowledge of the Internet
+ * Engineering Task Force's Public Key Infrastructure (X.509). The primary
+ * document describing this standard is <a
+ * href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280: Internet X.509
+ * Public Key Infrastructure Certificate and Certificate Revocation List
+ * (CRL) Profile</a>.
+ *
+ * <p>Note that this class is not thread-safe. If multiple threads will
+ * use or modify this class then they need to synchronize on the object.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class X509CRLSelector implements CRLSelector, Cloneable
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private static final String CRL_NUMBER_ID = "2.5.29.20";
+
+ private List issuerNames;
+ private BigInteger maxCrlNumber;
+ private BigInteger minCrlNumber;
+ private Date date;
+ private X509Certificate cert;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates a new CRL selector with no criteria enabled; i.e., every CRL
+ * will be matched.
+ */
+ public X509CRLSelector()
+ {
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Add an issuer name to the set of issuer names criteria, as the DER
+ * encoded form.
+ *
+ * @param name The name to add, as DER bytes.
+ * @throws IOException If the argument is not a valid DER-encoding.
+ */
+ public void addIssuerName(byte[] name) throws IOException
+ {
+ X500Principal p = null;
+ try
+ {
+ p = new X500Principal(name);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed name");
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ if (issuerNames == null)
+ issuerNames = new LinkedList();
+ issuerNames.add(p);
+ }
+
+ /**
+ * Add an issuer name to the set of issuer names criteria, as a
+ * String representation.
+ *
+ * @param name The name to add.
+ * @throws IOException If the argument is not a valid name.
+ */
+ public void addIssuerName(String name) throws IOException
+ {
+ X500Principal p = null;
+ try
+ {
+ p = new X500Principal(name);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed name: " + name);
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ if (issuerNames == null)
+ issuerNames = new LinkedList();
+ issuerNames.add(p);
+ }
+
+ /**
+ * Sets the issuer names criterion. Pass <code>null</code> to clear this
+ * value. CRLs matched by this selector must have an issuer name in this
+ * set.
+ *
+ * @param names The issuer names.
+ * @throws IOException If any of the elements in the collection is not
+ * a valid name.
+ */
+ public void setIssuerNames(Collection names) throws IOException
+ {
+ if (names == null)
+ {
+ issuerNames = null;
+ return;
+ }
+ List l = new ArrayList(names.size());
+ for (Iterator it = names.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (o instanceof X500Principal)
+ l.add(o);
+ else if (o instanceof String)
+ {
+ try
+ {
+ l.add(new X500Principal((String) o));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed name: " + o);
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ }
+ else if (o instanceof byte[])
+ {
+ try
+ {
+ l.add(new X500Principal((byte[]) o));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed name");
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ }
+ else if (o instanceof InputStream)
+ {
+ try
+ {
+ l.add(new X500Principal((InputStream) o));
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed name");
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ }
+ else
+ throw new IOException("not a valid name: " +
+ (o != null ? o.getClass().getName() : "null"));
+
+ }
+ issuerNames = l;
+ }
+
+ /**
+ * Returns the set of issuer names that are matched by this selector,
+ * or <code>null</code> if this criteria is not set. The returned
+ * collection is not modifiable.
+ *
+ * @return The set of issuer names.
+ */
+ public Collection getIssuerNames()
+ {
+ if (issuerNames != null)
+ return Collections.unmodifiableList(issuerNames);
+ else
+ return null;
+ }
+
+ /**
+ * Returns the maximum value of the CRLNumber extension present in
+ * CRLs matched by this selector, or <code>null</code> if this
+ * criteria is not set.
+ *
+ * @return The maximum CRL number.
+ */
+ public BigInteger getMaxCRL()
+ {
+ return maxCrlNumber;
+ }
+
+ /**
+ * Returns the minimum value of the CRLNumber extension present in
+ * CRLs matched by this selector, or <code>null</code> if this
+ * criteria is not set.
+ *
+ * @return The minimum CRL number.
+ */
+ public BigInteger getMinCRL()
+ {
+ return minCrlNumber;
+ }
+
+ /**
+ * Sets the maximum value of the CRLNumber extension present in CRLs
+ * matched by this selector. Specify <code>null</code> to clear this
+ * criterion.
+ *
+ * @param maxCrlNumber The maximum CRL number.
+ */
+ public void setMaxCRLNumber(BigInteger maxCrlNumber)
+ {
+ this.maxCrlNumber = maxCrlNumber;
+ }
+
+ /**
+ * Sets the minimum value of the CRLNumber extension present in CRLs
+ * matched by this selector. Specify <code>null</code> to clear this
+ * criterion.
+ *
+ * @param minCrlNumber The minimum CRL number.
+ */
+ public void setMinCRLNumber(BigInteger minCrlNumber)
+ {
+ this.minCrlNumber = minCrlNumber;
+ }
+
+ /**
+ * Returns the date when this CRL must be valid; that is, the date
+ * must be after the thisUpdate date, but before the nextUpdate date.
+ * Returns <code>null</code> if this criterion is not set.
+ *
+ * @return The date.
+ */
+ public Date getDateAndTime()
+ {
+ return date != null ? (Date) date.clone() : null;
+ }
+
+ /**
+ * Sets the date at which this CRL must be valid. Specify
+ * <code>null</code> to clear this criterion.
+ *
+ * @param date The date.
+ */
+ public void setDateAndTime(Date date)
+ {
+ this.date = date != null ? (Date) date.clone() : null;
+ }
+
+ /**
+ * Returns the certificate being checked, or <code>null</code> if this
+ * value is not set.
+ *
+ * @return The certificate.
+ */
+ public X509Certificate getCertificateChecking()
+ {
+ return cert;
+ }
+
+ /**
+ * Sets the certificate being checked. This is not a criterion, but
+ * info used by certificate store implementations to aid in searching.
+ *
+ * @param cert The certificate.
+ */
+ public void setCertificateChecking(X509Certificate cert)
+ {
+ this.cert = cert;
+ }
+
+ /**
+ * Returns a string representation of this selector. The string will
+ * only describe the enabled criteria, so if none are enabled this will
+ * return a string that contains little else besides the class name.
+ *
+ * @return The string.
+ */
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer(X509CRLSelector.class.getName());
+ GetPropertyAction getProp = new GetPropertyAction("line.separator");
+ String nl = (String) AccessController.doPrivileged(getProp);
+ String eol = ";" + nl;
+
+ str.append(" {").append(nl);
+ if (issuerNames != null)
+ str.append(" issuer names = ").append(issuerNames).append(eol);
+ if (maxCrlNumber != null)
+ str.append(" max CRL = ").append(maxCrlNumber).append(eol);
+ if (minCrlNumber != null)
+ str.append(" min CRL = ").append(minCrlNumber).append(eol);
+ if (date != null)
+ str.append(" date = ").append(date).append(eol);
+ if (cert != null)
+ str.append(" certificate = ").append(cert).append(eol);
+ str.append("}").append(nl);
+ return str.toString();
+ }
+
+ /**
+ * Checks a CRL against the criteria of this selector, returning
+ * <code>true</code> if the given CRL matches all the criteria.
+ *
+ * @param _crl The CRL being checked.
+ * @return True if the CRL matches, false otherwise.
+ */
+ public boolean match(CRL _crl)
+ {
+ if (!(_crl instanceof X509CRL))
+ return false;
+ X509CRL crl = (X509CRL) _crl;
+ if (issuerNames != null)
+ {
+ if (!issuerNames.contains(crl.getIssuerX500Principal()))
+ return false;
+ }
+ BigInteger crlNumber = null;
+ if (maxCrlNumber != null)
+ {
+ byte[] b = crl.getExtensionValue(CRL_NUMBER_ID);
+ if (b == null)
+ return false;
+ try
+ {
+ DERValue val = DERReader.read(b);
+ if (!(val.getValue() instanceof BigInteger))
+ return false;
+ crlNumber = (BigInteger) val.getValue();
+ }
+ catch (IOException ioe)
+ {
+ return false;
+ }
+ if (maxCrlNumber.compareTo(crlNumber) < 0)
+ return false;
+ }
+ if (minCrlNumber != null)
+ {
+ if (crlNumber == null)
+ {
+ byte[] b = crl.getExtensionValue(CRL_NUMBER_ID);
+ if (b == null)
+ return false;
+ try
+ {
+ DERValue val = DERReader.read(b);
+ if (!(val.getValue() instanceof BigInteger))
+ return false;
+ crlNumber = (BigInteger) val.getValue();
+ }
+ catch (IOException ioe)
+ {
+ return false;
+ }
+ }
+ if (minCrlNumber.compareTo(crlNumber) > 0)
+ return false;
+ }
+ if (date != null)
+ {
+ if (date.compareTo(crl.getThisUpdate()) < 0 ||
+ date.compareTo(crl.getNextUpdate()) > 0)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Returns a copy of this object.
+ *
+ * @return The copy.
+ */
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException shouldNotHappen)
+ {
+ throw new Error(shouldNotHappen);
+ }
+ }
+}
diff --git a/java/security/cert/X509CertSelector.java b/java/security/cert/X509CertSelector.java
new file mode 100644
index 000000000..c7914c140
--- /dev/null
+++ b/java/security/cert/X509CertSelector.java
@@ -0,0 +1,1111 @@
+/* X509CertSelector.java -- selects X.509 certificates by criteria.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.security.cert;
+
+import java.io.IOException;
+
+import java.math.BigInteger;
+
+import java.security.AccessController;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.spec.X509EncodedKeySpec;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.security.auth.x500.X500Principal;
+
+import gnu.java.security.OID;
+import gnu.java.security.action.GetPropertyAction;
+
+/**
+ * A concrete implementation of {@link CertSelector} for X.509 certificates,
+ * which allows a number of criteria to be set when accepting certificates,
+ * from validity dates, to issuer and subject distinguished names, to some
+ * of the various X.509 extensions.
+ *
+ * <p>Use of this class requires extensive knowledge of the Internet
+ * Engineering Task Force's Public Key Infrastructure (X.509). The primary
+ * document describing this standard is <a
+ * href="http://www.ietf.org/rfc/rfc3280.txt">RFC 3280: Internet X.509
+ * Public Key Infrastructure Certificate and Certificate Revocation List
+ * (CRL) Profile</a>.
+ *
+ * <p>Note that this class is not thread-safe. If multiple threads will
+ * use or modify this class then they need to synchronize on the object.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class X509CertSelector implements CertSelector, Cloneable
+{
+
+ // Constants and fields.
+ // -------------------------------------------------------------------------
+
+ private static final String AUTH_KEY_ID = "2.5.29.35";
+ private static final String SUBJECT_KEY_ID = "2.5.29.14";
+ private static final String NAME_CONSTRAINTS_ID = "2.5.29.30";
+
+ private int basicConstraints;
+ private X509Certificate cert;
+ private BigInteger serialNo;
+ private X500Principal issuer;
+ private X500Principal subject;
+ private byte[] subjectKeyId;
+ private byte[] authKeyId;
+ private boolean[] keyUsage;
+ private Date certValid;
+ private OID sigId;
+ private PublicKey subjectKey;
+ private X509EncodedKeySpec subjectKeySpec;
+ private Set keyPurposeSet;
+ private List altNames;
+ private boolean matchAllNames;
+ private byte[] nameConstraints;
+ private Set policy;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates a new X.509 certificate selector. The new selector will be
+ * empty, and will accept any certificate (provided that it is an
+ * {@link X509Certificate}).
+ */
+ public X509CertSelector()
+ {
+ basicConstraints = -1;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the certificate criterion, or <code>null</code> if this value
+ * was not set.
+ *
+ * @return The certificate.
+ */
+ public X509Certificate getCertificate()
+ {
+ return cert;
+ }
+
+ /**
+ * Sets the certificate criterion. If set, only certificates that are
+ * equal to the certificate passed here will be accepted.
+ *
+ * @param cert The certificate.
+ */
+ public void setCertificate(X509Certificate cert)
+ {
+ this.cert = cert;
+ }
+
+ /**
+ * Returns the serial number criterion, or <code>null</code> if this
+ * value was not set.
+ *
+ * @return The serial number.
+ */
+ public BigInteger getSerialNumber()
+ {
+ return serialNo;
+ }
+
+ /**
+ * Sets the serial number of the desired certificate. Only certificates that
+ * contain this serial number are accepted.
+ *
+ * @param serialNo The serial number.
+ */
+ public void setSerialNumber(BigInteger serialNo)
+ {
+ this.serialNo = serialNo;
+ }
+
+ /**
+ * Returns the issuer criterion as a string, or <code>null</code> if this
+ * value was not set.
+ *
+ * @return The issuer.
+ */
+ public String getIssuerAsString()
+ {
+ if (issuer != null)
+ return issuer.getName();
+ else
+ return null;
+ }
+
+ /**
+ * Returns the issuer criterion as a sequence of DER bytes, or
+ * <code>null</code> if this value was not set.
+ *
+ * @return The issuer.
+ */
+ public byte[] getIssuerAsBytes() throws IOException
+ {
+ if (issuer != null)
+ return issuer.getEncoded();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the issuer, specified as a string representation of the issuer's
+ * distinguished name. Only certificates issued by this issuer will
+ * be accepted.
+ *
+ * @param name The string representation of the issuer's distinguished name.
+ * @throws IOException If the given name is incorrectly formatted.
+ */
+ public void setIssuer(String name) throws IOException
+ {
+ if (name != null)
+ {
+ try
+ {
+ issuer = new X500Principal(name);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ throw new IOException(iae.getMessage());
+ }
+ }
+ else
+ issuer = null;
+ }
+
+ /**
+ * Sets the issuer, specified as the DER encoding of the issuer's
+ * distinguished name. Only certificates issued by this issuer will
+ * be accepted.
+ *
+ * @param name The DER encoding of the issuer's distinguished name.
+ * @throws IOException If the given name is incorrectly formatted.
+ */
+ public void setIssuer(byte[] name) throws IOException
+ {
+ if (name != null)
+ {
+ try
+ {
+ issuer = new X500Principal(name);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ throw new IOException(iae.getMessage());
+ }
+ }
+ else
+ issuer = null;
+ }
+
+ /**
+ * Returns the subject criterion as a string, of <code>null</code> if
+ * this value was not set.
+ *
+ * @return The subject.
+ */
+ public String getSubjectAsString()
+ {
+ if (subject != null)
+ return subject.getName();
+ else
+ return null;
+ }
+
+ /**
+ * Returns the subject criterion as a sequence of DER bytes, or
+ * <code>null</code> if this value is not set.
+ *
+ * @return The subject.
+ */
+ public byte[] getSubjectAsBytes() throws IOException
+ {
+ if (subject != null)
+ return subject.getEncoded();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the subject, specified as a string representation of the
+ * subject's distinguished name. Only certificates with the given
+ * subject will be accepted.
+ *
+ * @param name The string representation of the subject's distinguished name.
+ * @throws IOException If the given name is incorrectly formatted.
+ */
+ public void setSubject(String name) throws IOException
+ {
+ if (name != null)
+ {
+ try
+ {
+ subject = new X500Principal(name);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ throw new IOException(iae.getMessage());
+ }
+ }
+ else
+ subject = null;
+ }
+
+ /**
+ * Sets the subject, specified as the DER encoding of the subject's
+ * distinguished name. Only certificates with the given subject will
+ * be accepted.
+ *
+ * @param name The DER encoding of the subject's distinguished name.
+ * @throws IOException If the given name is incorrectly formatted.
+ */
+ public void setSubject(byte[] name) throws IOException
+ {
+ if (name != null)
+ {
+ try
+ {
+ subject = new X500Principal(name);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ throw new IOException(iae.getMessage());
+ }
+ }
+ else
+ subject = null;
+ }
+
+ /**
+ * Returns the subject key identifier criterion, or <code>null</code> if
+ * this value was not set. Note that the byte array is cloned to prevent
+ * modification.
+ *
+ * @return The subject key identifier.
+ */
+ public byte[] getSubjectKeyIdentifier()
+ {
+ if (subjectKeyId != null)
+ return (byte[]) subjectKeyId.clone();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the subject key identifier criterion, or <code>null</code> to clear
+ * this criterion. Note that the byte array is cloned to prevent modification.
+ *
+ * @param subjectKeyId The subject key identifier.
+ */
+ public void setSubjectKeyIdentifier(byte[] subjectKeyId)
+ {
+ this.subjectKeyId = subjectKeyId != null ? (byte[]) subjectKeyId.clone() :
+ null;
+ }
+
+ /**
+ * Returns the authority key identifier criterion, or <code>null</code> if
+ * this value was not set. Note that the byte array is cloned to prevent
+ * modification.
+ *
+ * @return The authority key identifier.
+ */
+ public byte[] getAuthorityKeyIdentifier()
+ {
+ if (authKeyId != null)
+ return (byte[]) authKeyId.clone();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the authority key identifier criterion, or <code>null</code> to clear
+ * this criterion. Note that the byte array is cloned to prevent modification.
+ *
+ * @param subjectKeyId The subject key identifier.
+ */
+ public void setAuthorityKeyIdentifier(byte[] authKeyId)
+ {
+ this.authKeyId = authKeyId != null ? (byte[]) authKeyId.clone() : null;
+ }
+
+ /**
+ * Returns the date at which certificates must be valid, or <code>null</code>
+ * if this criterion was not set.
+ *
+ * @return The target certificate valitity date.
+ */
+ public Date getCertificateValid()
+ {
+ if (certValid != null)
+ return (Date) certValid.clone();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the date at which certificates must be valid. Specify
+ * <code>null</code> to clear this criterion.
+ *
+ * @param certValid The certificate validity date.
+ */
+ public void setCertificateValid(Date certValid)
+ {
+ this.certValid = certValid != null ? (Date) certValid.clone() : null;
+ }
+
+ /**
+ * This method, and its related X.509 certificate extension &mdash; the
+ * private key usage period &mdash; is not supported under the Internet
+ * PKI for X.509 certificates (PKIX), described in RFC 3280. As such, this
+ * method is not supported either.
+ *
+ * <p>Do not use this method. It is not deprecated, as it is not deprecated
+ * in the Java standard, but it is basically a no-operation and simply
+ * returns <code>null</code>.
+ *
+ * @return Null.
+ */
+ public Date getPrivateKeyValid()
+ {
+ return null;
+ }
+
+ /**
+ * This method, and its related X.509 certificate extension &mdash; the
+ * private key usage period &mdash; is not supported under the Internet
+ * PKI for X.509 certificates (PKIX), described in RFC 3280. As such, this
+ * method is not supported either.
+ *
+ * <p>Do not use this method. It is not deprecated, as it is not deprecated
+ * in the Java standard, but it is basically a no-operation.
+ *
+ * @param UNUSED Is silently ignored.
+ */
+ public void setPrivateKeyValid(Date UNUSED)
+ {
+ }
+
+ /**
+ * Returns the public key algorithm ID that matching certificates must have,
+ * or <code>null</code> if this criterion was not set.
+ *
+ * @return The public key algorithm ID.
+ */
+ public String getSubjectPublicKeyAlgID()
+ {
+ return String.valueOf(sigId);
+ }
+
+ /**
+ * Sets the public key algorithm ID that matching certificates must have.
+ * Specify <code>null</code> to clear this criterion.
+ *
+ * @param sigId The public key ID.
+ * @throws IOException If the specified ID is not a valid object identifier.
+ */
+ public void setSubjectPublicKeyAlgID(String sigId) throws IOException
+ {
+ if (sigId != null)
+ {
+ try
+ {
+ OID oid = new OID(sigId);
+ int[] comp = oid.getIDs();
+ if (!checkOid(comp))
+ throw new IOException("malformed OID: " + sigId);
+ this.sigId = oid;
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed OID: " + sigId);
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ }
+ else
+ this.sigId = null;
+ }
+
+ /**
+ * Returns the subject public key criterion, or <code>null</code> if this
+ * value is not set.
+ *
+ * @return The subject public key.
+ */
+ public PublicKey getSubjectPublicKey()
+ {
+ return subjectKey;
+ }
+
+ /**
+ * Sets the subject public key criterion as an opaque representation.
+ * Specify <code>null</code> to clear this criterion.
+ *
+ * @param key The public key.
+ */
+ public void setSubjectPublicKey(PublicKey key)
+ {
+ this.subjectKey = key;
+ if (key == null)
+ {
+ subjectKeySpec = null;
+ return;
+ }
+ try
+ {
+ KeyFactory enc = KeyFactory.getInstance("X.509");
+ subjectKeySpec = (X509EncodedKeySpec)
+ enc.getKeySpec(key, X509EncodedKeySpec.class);
+ }
+ catch (Exception x)
+ {
+ subjectKey = null;
+ subjectKeySpec = null;
+ }
+ }
+
+ /**
+ * Sets the subject public key criterion as a DER-encoded key. Specify
+ * <code>null</code> to clear this value.
+ *
+ * @param key The DER-encoded key bytes.
+ * @throws IOException If the argument is not a valid DER-encoded key.
+ */
+ public void setSubjectPublicKey(byte[] key) throws IOException
+ {
+ if (key == null)
+ {
+ subjectKey = null;
+ subjectKeySpec = null;
+ return;
+ }
+ try
+ {
+ subjectKeySpec = new X509EncodedKeySpec(key);
+ KeyFactory enc = KeyFactory.getInstance("X.509");
+ subjectKey = enc.generatePublic(subjectKeySpec);
+ }
+ catch (Exception x)
+ {
+ subjectKey = null;
+ subjectKeySpec = null;
+ IOException ioe = new IOException(x.getMessage());
+ ioe.initCause(x);
+ throw ioe;
+ }
+ }
+
+ /**
+ * Returns the public key usage criterion, or <code>null</code> if this
+ * value is not set. Note that the array is cloned to prevent modification.
+ *
+ * @return The public key usage.
+ */
+ public boolean[] getKeyUsage()
+ {
+ if (keyUsage != null)
+ return (boolean[]) keyUsage.clone();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the public key usage criterion. Specify <code>null</code> to clear
+ * this value.
+ *
+ * @param keyUsage The public key usage.
+ */
+ public void setKeyUsage(boolean[] keyUsage)
+ {
+ this.keyUsage = keyUsage != null ? (boolean[]) keyUsage.clone() : null;
+ }
+
+ /**
+ * Returns the set of extended key purpose IDs, as an unmodifiable set
+ * of OID strings. Returns <code>null</code> if this criterion is not
+ * set.
+ *
+ * @return The set of key purpose OIDs (strings).
+ */
+ public Set getExtendedKeyUsage()
+ {
+ if (keyPurposeSet != null)
+ return Collections.unmodifiableSet(keyPurposeSet);
+ else
+ return null;
+ }
+
+ /**
+ * Sets the extended key usage criterion, as a set of OID strings. Specify
+ * <code>null</code> to clear this value.
+ *
+ * @param keyPurposeSet The set of key purpose OIDs.
+ * @throws IOException If any element of the set is not a valid OID string.
+ */
+ public void setExtendedKeyUsage(Set keyPurposeSet) throws IOException
+ {
+ if (keyPurposeSet == null)
+ {
+ this.keyPurposeSet = null;
+ return;
+ }
+ Set s = new HashSet();
+ for (Iterator it = keyPurposeSet.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (!(o instanceof String))
+ throw new IOException("not a string: " + o);
+ try
+ {
+ OID oid = new OID((String) o);
+ int[] comp = oid.getIDs();
+ if (!checkOid(comp))
+ throw new IOException("malformed OID: " + o);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ IOException ioe = new IOException("malformed OID: " + o);
+ ioe.initCause(iae);
+ throw ioe;
+ }
+ }
+ this.keyPurposeSet = s;
+ }
+
+ /**
+ * Returns whether or not all specified alternative names must match.
+ * If false, a certificate is considered a match if <em>one</em> of the
+ * specified alternative names matches.
+ *
+ * @return true if all names must match.
+ */
+ public boolean getMatchAllSubjectAltNames()
+ {
+ return matchAllNames;
+ }
+
+ /**
+ * Sets whether or not all subject alternative names must be matched.
+ * If false, then a certificate will be considered a match if one
+ * alternative name matches.
+ *
+ * @param matchAllNames Whether or not all alternative names must be
+ * matched.
+ */
+ public void setMatchAllSubjectAltNames(boolean matchAllNames)
+ {
+ this.matchAllNames = matchAllNames;
+ }
+
+ /**
+ * Sets the subject alternative names critertion. Each element of the
+ * argument must be a {@link java.util.List} that contains exactly two
+ * elements: the first an {@link Integer}, representing the type of
+ * name, and the second either a {@link String} or a byte array,
+ * representing the name itself.
+ *
+ * @param altNames The alternative names.
+ * @throws IOException If any element of the argument is invalid.
+ */
+ public void setSubjectAlternativeNames(Collection altNames)
+ throws IOException
+ {
+ if (altNames == null)
+ {
+ this.altNames = null;
+ return;
+ }
+ List l = new ArrayList(altNames.size());
+ for (Iterator it = altNames.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (!(o instanceof List) || ((List) o).size() != 2 ||
+ !(((List) o).get(0) instanceof Integer) ||
+ !(((List) o).get(1) instanceof String) ||
+ !(((List) o).get(1) instanceof byte[]))
+ throw new IOException("illegal alternative name: " + o);
+ Integer i = (Integer) ((List) o).get(0);
+ if (i.intValue() < 0 || i.intValue() > 8)
+ throw new IOException("illegal alternative name: " + o +
+ ", bad id: " + i);
+ l.add(new ArrayList((List) o));
+ }
+ this.altNames = l;
+ }
+
+ /**
+ * Add a name to the subject alternative names criterion.
+ *
+ * @param id The type of name this is. Must be in the range [0,8].
+ * @param name The name.
+ * @throws IOException If the id is out of range, or if the name
+ * is null.
+ */
+ public void addSubjectAlternativeName(int id, String name)
+ throws IOException
+ {
+ if (id < 0 || id > 8 || name == null)
+ throw new IOException("illegal alternative name");
+ if (altNames == null)
+ altNames = new LinkedList();
+ ArrayList l = new ArrayList(2);
+ l.add(new Integer(id));
+ l.add(name);
+ altNames.add(l);
+ }
+
+ /**
+ * Add a name, as DER-encoded bytes, to the subject alternative names
+ * criterion.
+ *
+ * @param id The type of name this is.
+ */
+ public void addSubjectAlternativeName(int id, byte[] name)
+ throws IOException
+ {
+ if (id < 0 || id > 8 || name == null)
+ throw new IOException("illegal alternative name");
+ if (altNames == null)
+ altNames = new LinkedList();
+ ArrayList l = new ArrayList(2);
+ l.add(new Integer(id));
+ l.add(name);
+ altNames.add(l);
+ }
+
+ /**
+ * Returns the name constraints criterion, or <code>null</code> if this
+ * value is not set. Note that the byte array is cloned to prevent
+ * modification.
+ *
+ * @return The name constraints.
+ */
+ public byte[] getNameConstraints()
+ {
+ if (nameConstraints != null)
+ return (byte[]) nameConstraints.clone();
+ else
+ return null;
+ }
+
+ /**
+ * Sets the name constraints criterion; specify <code>null</code> to
+ * clear this criterion. Note that if non-null, the argument will be
+ * cloned to prevent modification.
+ *
+ * @param nameConstraints The new name constraints.
+ * @throws IOException If the argument is not a valid DER-encoded
+ * name constraints.
+ */
+ public void setNameConstraints(byte[] nameConstraints)
+ throws IOException
+ {
+ // FIXME check if the argument is valid.
+ this.nameConstraints = nameConstraints != null
+ ? (byte[]) nameConstraints.clone() : null;
+ }
+
+ /**
+ * Returns the basic constraints criterion, or -1 if this value is not set.
+ *
+ * @return The basic constraints.
+ */
+ public int getBasicConstraints()
+ {
+ return basicConstraints;
+ }
+
+ /**
+ * Sets the basic constraints criterion. Specify -1 to clear this parameter.
+ *
+ * @param basicConstraints The new basic constraints value.
+ */
+ public void setBasicConstraints(int basicConstraints)
+ {
+ if (basicConstraints < -1)
+ basicConstraints = -1;
+ this.basicConstraints = basicConstraints;
+ }
+
+ // The last two criteria not yet implemented are certificate policies
+ // and path-to-names. Both of these are somewhat advanced extensions
+ // (you could probably count the applications that actually use them
+ // on one hand), and they both have no support in the X509Certificate
+ // class.
+ //
+ // Not having support in X509Certificate is not always a problem; for
+ // example, we can compare DER-encoded values as byte arrays for some
+ // extensions. We can't, however, compare them if they are specified
+ // in a set (as policies are). We need to parse the actual value in the
+ // certificate, and check it against the specified set.
+
+ // FIXME
+// public void setPolicy(Set policy) throws IOException
+// {
+// if (policy != null)
+// {
+// for (Iterator it = policy.iterator(); it.hasNext(); )
+// try
+// {
+// OID oid = new OID((String) it.next());
+// int[] i = oid.getIDs();
+// if (!checkOid(i))
+// throw new IOException("invalid OID");
+// }
+// catch (Exception x)
+// {
+// throw new IOException("invalid OID");
+// }
+// }
+// this.policy = policy != null ? new HashSet(policy) : null;
+// }
+
+ // FIXME
+// public void setPathToNames(Collection names) throws IOException
+// {
+// if (names == null)
+// {
+// this.names = null;
+// return;
+// }
+// for (Iterator it = names.iterator(); it.hasNext(); )
+// {
+// try
+// {
+// List l = (List) it.next();
+// if (l.get(1) instanceof String)
+// addPathToName(((Integer)l.get(0)).intValue(), (String)l.get(1));
+// else
+// addPathToName(((Integer)l.get(0)).intValue(), (byte[])l.get(1));
+// }
+// catch (Exception x)
+// {
+// this.names = null;
+// throw new IOException("invalid names");
+// }
+// }
+// }
+
+ // FIXME
+// public void addPathToName(int id, String name) throws IOException
+// {
+// }
+
+ // FIXME
+// public void addPathToName(int id, byte[] name) throws IOException
+// {
+// }
+
+ // FIXME
+// public Collection getSubjectAlternativeNames()
+// {
+// return null;
+// }
+
+ // FIXME
+// public Set getPolicy()
+// {
+// return null;
+// }
+
+ // FIXME
+// public Collection getPathToNames()
+// {
+// return null;
+// }
+
+ /**
+ * Match a certificate. This method will check the given certificate
+ * against all the enabled criteria of this selector, and will return
+ * <code>true</code> if the given certificate matches.
+ *
+ * @param certificate The certificate to check.
+ * @return true if the certificate matches all criteria.
+ */
+ public boolean match(Certificate certificate)
+ {
+ if (!(certificate instanceof X509Certificate))
+ return false;
+ X509Certificate cert = (X509Certificate) certificate;
+ if (this.cert != null)
+ {
+ try
+ {
+ byte[] e1 = this.cert.getEncoded();
+ byte[] e2 = cert.getEncoded();
+ if (!Arrays.equals(e1, e2))
+ return false;
+ }
+ catch (CertificateEncodingException cee)
+ {
+ return false;
+ }
+ }
+ if (serialNo != null)
+ {
+ if (!serialNo.equals(cert.getSerialNumber()))
+ return false;
+ }
+ if (certValid != null)
+ {
+ try
+ {
+ cert.checkValidity(certValid);
+ }
+ catch (CertificateException ce)
+ {
+ return false;
+ }
+ }
+ if (issuer != null)
+ {
+ if (!issuer.equals(cert.getIssuerX500Principal()))
+ return false;
+ }
+ if (subject != null)
+ {
+ if (!subject.equals(cert.getSubjectX500Principal()))
+ return false;
+ }
+ if (sigId != null)
+ {
+ if (!sigId.equals(cert.getSigAlgOID()))
+ return false;
+ }
+ if (subjectKeyId != null)
+ {
+ byte[] b = cert.getExtensionValue(SUBJECT_KEY_ID);
+ if (!Arrays.equals(b, subjectKeyId))
+ return false;
+ }
+ if (authKeyId != null)
+ {
+ byte[] b = cert.getExtensionValue(AUTH_KEY_ID);
+ if (!Arrays.equals(b, authKeyId))
+ return false;
+ }
+ if (keyUsage != null)
+ {
+ boolean[] b = cert.getKeyUsage();
+ if (!Arrays.equals(b, keyUsage))
+ return false;
+ }
+ if (basicConstraints >= 0)
+ {
+ if (cert.getBasicConstraints() != basicConstraints)
+ return false;
+ }
+ if (keyPurposeSet != null)
+ {
+ List kp = null;
+ try
+ {
+ kp = cert.getExtendedKeyUsage();
+ }
+ catch (CertificateParsingException cpe)
+ {
+ return false;
+ }
+ if (kp == null)
+ return false;
+ for (Iterator it = keyPurposeSet.iterator(); it.hasNext(); )
+ {
+ if (!kp.contains(it.next()))
+ return false;
+ }
+ }
+ if (altNames != null)
+ {
+ Collection an = null;
+ try
+ {
+ an = cert.getSubjectAlternativeNames();
+ }
+ catch (CertificateParsingException cpe)
+ {
+ return false;
+ }
+ if (an == null)
+ return false;
+ int match = 0;
+ for (Iterator it = altNames.iterator(); it.hasNext(); )
+ {
+ List l = (List) it.next();
+ Integer id = (Integer) l.get(0);
+ String s = null;
+ byte[] b = null;
+ if (l.get(1) instanceof String)
+ s = (String) l.get(1);
+ else if (l.get(1) instanceof byte[])
+ b = (byte[]) l.get(1);
+ else
+ return false;
+ for (Iterator it2 = an.iterator(); it2.hasNext(); )
+ {
+ Object o = it2.next();
+ if (!(o instanceof List))
+ continue;
+ List l2 = (List) o;
+ if (l2.size() != 2)
+ continue;
+ if (!id.equals(l2.get(0)))
+ continue;
+ if (s != null && (l2.get(1) instanceof String) &&
+ s.equals(l2.get(1)))
+ match++;
+ else if (b != null && (l2.get(1) instanceof byte[]) &&
+ Arrays.equals(b, (byte[]) l2.get(1)))
+ match++;
+ }
+ if (match == 0 || (matchAllNames && match != altNames.size()))
+ return false;
+ }
+ }
+ if (nameConstraints != null)
+ {
+ byte[] nc = cert.getExtensionValue(NAME_CONSTRAINTS_ID);
+ if (!Arrays.equals(nameConstraints, nc))
+ return false;
+ }
+
+ // FIXME check policies.
+ // FIXME check path-to-names.
+
+ return true;
+ }
+
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer(X509CertSelector.class.getName());
+ GetPropertyAction getProp = new GetPropertyAction("line.separator");
+ String nl = (String) AccessController.doPrivileged(getProp);
+ String eol = ";" + nl;
+ str.append(" {").append(nl);
+ if (cert != null)
+ str.append(" certificate = ").append(cert).append(eol);
+ if (basicConstraints >= 0)
+ str.append(" basic constraints = ").append(basicConstraints).append(eol);
+ if (serialNo != null)
+ str.append(" serial number = ").append(serialNo).append(eol);
+ if (certValid != null)
+ str.append(" valid date = ").append(certValid).append(eol);
+ if (issuer != null)
+ str.append(" issuer = ").append(issuer).append(eol);
+ if (subject != null)
+ str.append(" subject = ").append(subject).append(eol);
+ if (sigId != null)
+ str.append(" signature OID = ").append(sigId).append(eol);
+ if (subjectKey != null)
+ str.append(" subject public key = ").append(subjectKey).append(eol);
+ if (subjectKeyId != null)
+ {
+ str.append(" subject key ID = ");
+ for (int i = 0; i < subjectKeyId.length; i++)
+ {
+ str.append(Character.forDigit((subjectKeyId[i] & 0xF0) >>> 8, 16));
+ str.append(Character.forDigit((subjectKeyId[i] & 0x0F), 16));
+ if (i < subjectKeyId.length - 1)
+ str.append(':');
+ }
+ str.append(eol);
+ }
+ if (authKeyId != null)
+ {
+ str.append(" authority key ID = ");
+ for (int i = 0; i < authKeyId.length; i++)
+ {
+ str.append(Character.forDigit((authKeyId[i] & 0xF0) >>> 8, 16));
+ str.append(Character.forDigit((authKeyId[i] & 0x0F), 16));
+ if (i < authKeyId.length - 1)
+ str.append(':');
+ }
+ str.append(eol);
+ }
+ if (keyUsage != null)
+ {
+ str.append(" key usage = ");
+ for (int i = 0; i < keyUsage.length; i++)
+ str.append(keyUsage[i] ? '1' : '0');
+ str.append(eol);
+ }
+ if (keyPurposeSet != null)
+ str.append(" key purpose = ").append(keyPurposeSet).append(eol);
+ if (altNames != null)
+ str.append(" alternative names = ").append(altNames).append(eol);
+ if (nameConstraints != null)
+ str.append(" name constraints = <blob of data>").append(eol);
+ str.append("}").append(nl);
+ return str.toString();
+ }
+
+ public Object clone()
+ {
+ try
+ {
+ return super.clone();
+ }
+ catch (CloneNotSupportedException shouldNotHappen)
+ {
+ throw new Error(shouldNotHappen);
+ }
+ }
+
+ // Own methods.
+ // -------------------------------------------------------------------------
+
+ private static boolean checkOid(int[] oid)
+ {
+ return (oid != null && oid.length > 2 &&
+ (oid[0] >= 0 && oid[0] <= 2) && (oid[1] >= 0 && oid[1] <= 39));
+ }
+}
diff --git a/java/text/Format.java b/java/text/Format.java
index 7bc389eb7..6f15dc044 100644
--- a/java/text/Format.java
+++ b/java/text/Format.java
@@ -60,6 +60,9 @@ import java.io.Serializable;
*/
public abstract class Format implements Serializable, Cloneable
{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
static final long serialVersionUID = -299282585814624189L;
public static class Field extends AttributedCharacterIterator.Attribute
diff --git a/java/text/MessageFormat.java b/java/text/MessageFormat.java
index b12341255..1c681795f 100644
--- a/java/text/MessageFormat.java
+++ b/java/text/MessageFormat.java
@@ -165,7 +165,7 @@ public class MessageFormat extends Format
super("");
}
- private Field(String s)
+ protected Field(String s)
{
super(s);
}
diff --git a/java/util/Arrays.java b/java/util/Arrays.java
index b51a28b4b..e99c2c0e8 100644
--- a/java/util/Arrays.java
+++ b/java/util/Arrays.java
@@ -1020,7 +1020,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -1184,7 +1184,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -1348,7 +1348,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -1524,7 +1524,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -1700,7 +1700,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -1866,7 +1866,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -2036,7 +2036,7 @@ public class Arrays
/**
* Performs a recursive modified quicksort.
*
- * @param a the array to sort
+ * @param array the array to sort
* @param from the start index (inclusive)
* @param count the number of elements to sort
*/
@@ -2418,6 +2418,7 @@ public class Arrays
* with the supplied element.
*
* @param index The index at which to place the new object.
+ * @param element The new object.
* @return The object replaced by this operation.
*/
public E set(int index, E element)
@@ -2489,7 +2490,7 @@ public class Arrays
* is shrunk or enlarged to the size of the
* internal array, and filled with its objects.
*
- * @param The array to fill with the objects in this list.
+ * @param array The array to fill with the objects in this list.
* @return The array containing the objects in this list,
* which may or may not be == to array.
*/
diff --git a/java/util/Calendar.java b/java/util/Calendar.java
index fc49bf556..aa47d307d 100644
--- a/java/util/Calendar.java
+++ b/java/util/Calendar.java
@@ -42,6 +42,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
+import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/**
@@ -437,6 +438,16 @@ public abstract class Calendar
return getInstance(TimeZone.getDefault(), locale);
}
+ /**
+ * Cache of locale->calendar-class mappings. This avoids having to do a ResourceBundle
+ * lookup for every getInstance call.
+ */
+ private static HashMap cache = new HashMap();
+
+ /** Preset argument types for calendar-class constructor lookup. */
+ private static Class[] ctorArgTypes
+ = new Class[] {TimeZone.class, Locale.class};
+
/**
* Creates a calendar representing the actual time, using the given
* time zone and locale.
@@ -445,29 +456,58 @@ public abstract class Calendar
*/
public static synchronized Calendar getInstance(TimeZone zone, Locale locale)
{
- String calendarClassName = null;
- ResourceBundle rb = getBundle(locale);
- calendarClassName = rb.getString("calendarClass");
- if (calendarClassName != null)
+ Class calendarClass = (Class) cache.get(locale);
+ Throwable exception = null;
+
+ try
{
- try
+ if (calendarClass == null)
{
- Class calendarClass = Class.forName(calendarClassName);
- if (Calendar.class.isAssignableFrom(calendarClass))
+ ResourceBundle rb = getBundle(locale);
+ String calendarClassName = rb.getString("calendarClass");
+
+ if (calendarClassName != null)
{
- return (Calendar) calendarClass.getConstructor(
- new Class[] { TimeZone.class, Locale.class}
- ).newInstance(new Object[] {zone, locale} );
+ calendarClass = Class.forName(calendarClassName);
+ if (Calendar.class.isAssignableFrom(calendarClass))
+ cache.put(locale, calendarClass);
}
}
- catch (ClassNotFoundException ex) {}
- catch (IllegalAccessException ex) {}
- catch (NoSuchMethodException ex) {}
- catch (InstantiationException ex) {}
- catch (InvocationTargetException ex) {}
- // XXX should we ignore these errors or throw an exception ?
+
+ // GregorianCalendar is by far the most common case. Optimize by
+ // avoiding reflection.
+ if (calendarClass == GregorianCalendar.class)
+ return new GregorianCalendar(zone, locale);
+
+ if (Calendar.class.isAssignableFrom(calendarClass))
+ {
+ Constructor ctor = calendarClass.getConstructor(ctorArgTypes);
+ return (Calendar) ctor.newInstance(new Object[] {zone, locale});
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ exception = ex;
+ }
+ catch (IllegalAccessException ex)
+ {
+ exception = ex;
+ }
+ catch (NoSuchMethodException ex)
+ {
+ exception = ex;
+ }
+ catch (InstantiationException ex)
+ {
+ exception = ex;
+ }
+ catch (InvocationTargetException ex)
+ {
+ exception = ex;
}
- return new GregorianCalendar(zone, locale);
+
+ throw new RuntimeException("Error instantiating calendar for locale " +
+ locale, exception);
}
/**
diff --git a/java/util/Collections.java b/java/util/Collections.java
index 1b14c5db5..d4926272e 100644
--- a/java/util/Collections.java
+++ b/java/util/Collections.java
@@ -576,14 +576,26 @@ public class Collections
{
ListIterator<T> itr = ((List<T>) l).listIterator();
int i = 0;
+ T o = itr.next(); // Assumes list is not empty (see isSequential)
+ boolean forward = true;
while (low <= hi)
{
pos = (low + hi) >> 1;
if (i < pos)
- for ( ; i != pos; i++, itr.next());
+ {
+ if (!forward)
+ itr.next(); // Changing direction first.
+ for ( ; i != pos; i++, o = itr.next());
+ forward = true;
+ }
else
- for ( ; i != pos; i--, itr.previous());
- final int d = compare(key, itr.next(), c);
+ {
+ if (forward)
+ itr.previous(); // Changing direction first.
+ for ( ; i != pos; i--, o = itr.previous());
+ forward = false;
+ }
+ final int d = compare(key, o, c);
if (d == 0)
return pos;
else if (d < 0)
@@ -1117,6 +1129,8 @@ public class Collections
public static void rotate(List<? super Object> list, int distance)
{
int size = list.size();
+ if (size == 0)
+ return;
distance %= size;
if (distance == 0)
return;
@@ -1711,10 +1725,10 @@ public class Collections
{
T[] a = (T[]) l.toArray();
Arrays.sort(a, c);
- ListIterator<T> i = l.listIterator(a.length);
- for (int pos = a.length; --pos >= 0; )
+ ListIterator<T> i = l.listIterator();
+ for (int pos = 0, alen = a.length; pos < alen; pos++)
{
- i.previous();
+ i.next();
i.set(a[pos]);
}
}
diff --git a/java/util/TimeZone.java b/java/util/TimeZone.java
index cc3c7a3d2..1e06e5356 100644
--- a/java/util/TimeZone.java
+++ b/java/util/TimeZone.java
@@ -38,9 +38,7 @@ exception statement from your version. */
package java.util;
-import gnu.classpath.Configuration;
-import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.text.DateFormatSymbols;
@@ -90,14 +88,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
/**
* Tries to get the default TimeZone for this system if not already
* set. It will call <code>getDefaultTimeZone(String)</code> with
- * the result of
- * <code>System.getProperty("user.timezone")</code>,
- * <code>System.getenv("TZ")</code>,
- * <code>readTimeZoneFile("/etc/timezone")</code>,
- * <code>readtzFile("/etc/localtime")</code> and
- * <code>getDefaultTimeZoneId()</code>
- * till a supported TimeZone is found.
- * If every method fails GMT is returned.
+ * the result of <code>System.getProperty("user.timezone")</code>.
+ * If that fails it calls <code>VMTimeZone.getDefaultTimeZoneId()</code>.
+ * If that also fails GMT is returned.
*/
private static synchronized TimeZone defaultZone()
{
@@ -109,11 +102,6 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
{
public Object run()
{
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javautil");
- }
-
TimeZone zone = null;
// Prefer System property user.timezone.
@@ -121,37 +109,9 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
if (tzid != null && !tzid.equals(""))
zone = getDefaultTimeZone(tzid);
- // See if TZ environment variable is set and accessible.
- if (zone == null)
- {
- tzid = System.getenv("TZ");
- if (tzid != null && !tzid.equals(""))
- zone = getDefaultTimeZone(tzid);
- }
-
- // Try to parse /etc/timezone.
+ // Try platfom specific way.
if (zone == null)
- {
- tzid = readTimeZoneFile("/etc/timezone");
- if (tzid != null && !tzid.equals(""))
- zone = getDefaultTimeZone(tzid);
- }
-
- // Try to parse /etc/localtime
- if (zone == null)
- {
- tzid = readtzFile("/etc/localtime");
- if (tzid != null && !tzid.equals(""))
- zone = getDefaultTimeZone(tzid);
- }
-
- // Try some system specific way
- if (zone == null)
- {
- tzid = getDefaultTimeZoneId();
- if (tzid != null && !tzid.equals(""))
- zone = getDefaultTimeZone(tzid);
- }
+ zone = VMTimeZone.getDefaultTimeZoneId();
// Fall back on GMT.
if (zone == null)
@@ -843,238 +803,6 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
}
/**
- * This method returns a time zone id string which is in the form
- * (standard zone name) or (standard zone name)(GMT offset) or
- * (standard zone name)(GMT offset)(daylight time zone name). The
- * GMT offset can be in seconds, or where it is evenly divisible by
- * 3600, then it can be in hours. The offset must be the time to
- * add to the local time to get GMT. If a offset is given and the
- * time zone observes daylight saving then the (daylight time zone
- * name) must also be given (otherwise it is assumed the time zone
- * does not observe any daylight savings).
- * <p>
- * The result of this method is given to getDefaultTimeZone(String)
- * which tries to map the time zone id to a known TimeZone. See
- * that method on how the returned String is mapped to a real
- * TimeZone object.
- */
- private static native String getDefaultTimeZoneId();
-
- /**
- * Tries to read the time zone name from a file. Only the first
- * consecutive letters, digits, slashes, dashes and underscores are
- * read from the file. If the file cannot be read or an IOException
- * occurs null is returned.
- * <p>
- * The /etc/timezone file is not standard, but a lot of systems have
- * it. If it exist the first line always contains a string
- * describing the timezone of the host of domain. Some systems
- * contain a /etc/TIMEZONE file which is used to set the TZ
- * environment variable (which is checked before /etc/timezone is
- * read).
- */
- private static String readTimeZoneFile(String file)
- {
- File f = new File(file);
- if (!f.exists())
- return null;
-
- InputStreamReader isr = null;
- try
- {
- FileInputStream fis = new FileInputStream(f);
- BufferedInputStream bis = new BufferedInputStream(fis);
- isr = new InputStreamReader(bis);
-
- StringBuffer sb = new StringBuffer();
- int i = isr.read();
- while (i != -1)
- {
- char c = (char) i;
- if (Character.isLetter(c) || Character.isDigit(c)
- || c == '/' || c == '-' || c == '_')
- {
- sb.append(c);
- i = isr.read();
- }
- else
- break;
- }
- return sb.toString();
- }
- catch (IOException ioe)
- {
- // Parse error, not a proper tzfile.
- return null;
- }
- finally
- {
- try
- {
- if (isr != null)
- isr.close();
- }
- catch (IOException ioe)
- {
- // Error while close, nothing we can do.
- }
- }
- }
-
- /**
- * Tries to read a file as a "standard" tzfile and return a time
- * zone id string as expected by <code>getDefaultTimeZone(String)</code>.
- * If the file doesn't exist, an IOException occurs or it isn't a tzfile
- * that can be parsed null is returned.
- * <p>
- * The tzfile structure (as also used by glibc) is described in the Olson
- * tz database archive as can be found at
- * <code>ftp://elsie.nci.nih.gov/pub/</code>.
- * <p>
- * At least the following platforms support the tzdata file format
- * and /etc/localtime (GNU/Linux, Darwin, Solaris and FreeBSD at
- * least). Some systems (like Darwin) don't start the file with the
- * required magic bytes 'TZif', this implementation can handle
- * that).
- */
- private static String readtzFile(String file)
- {
- File f = new File(file);
- if (!f.exists())
- return null;
-
- DataInputStream dis = null;
- try
- {
- FileInputStream fis = new FileInputStream(f);
- BufferedInputStream bis = new BufferedInputStream(fis);
- dis = new DataInputStream(bis);
-
- // Make sure we are reading a tzfile.
- byte[] tzif = new byte[4];
- dis.readFully(tzif);
- if (tzif[0] == 'T' && tzif[1] == 'Z'
- && tzif[2] == 'i' && tzif[3] == 'f')
- // Reserved bytes, ttisgmtcnt, ttisstdcnt and leapcnt
- skipFully(dis, 16 + 3 * 4);
- else
- // Darwin has tzdata files that don't start with the TZif marker
- skipFully(dis, 16 + 3 * 4 - 4);
-
- int timecnt = dis.readInt();
- int typecnt = dis.readInt();
- if (typecnt > 0)
- {
- int charcnt = dis.readInt();
- // Transition times plus indexed transition times.
- skipFully(dis, timecnt * (4 + 1));
-
- // Get last gmt_offset and dst/non-dst time zone names.
- int abbrind = -1;
- int dst_abbrind = -1;
- int gmt_offset = 0;
- while (typecnt-- > 0)
- {
- // gmtoff
- int offset = dis.readInt();
- int dst = dis.readByte();
- if (dst == 0)
- {
- abbrind = dis.readByte();
- gmt_offset = offset;
- }
- else
- dst_abbrind = dis.readByte();
- }
-
- // gmt_offset is the offset you must add to UTC/GMT to
- // get the local time, we need the offset to add to
- // the local time to get UTC/GMT.
- gmt_offset *= -1;
-
- // Turn into hours if possible.
- if (gmt_offset % 3600 == 0)
- gmt_offset /= 3600;
-
- if (abbrind >= 0)
- {
- byte[] names = new byte[charcnt];
- dis.readFully(names);
- int j = abbrind;
- while (j < charcnt && names[j] != 0)
- j++;
-
- String zonename = new String(names, abbrind, j - abbrind,
- "ASCII");
-
- String dst_zonename;
- if (dst_abbrind >= 0)
- {
- j = dst_abbrind;
- while (j < charcnt && names[j] != 0)
- j++;
- dst_zonename = new String(names, dst_abbrind,
- j - dst_abbrind, "ASCII");
- }
- else
- dst_zonename = "";
-
- // Only use gmt offset when necessary.
- // Also special case GMT+/- timezones.
- String offset_string;
- if ("".equals(dst_zonename)
- && (gmt_offset == 0
- || zonename.startsWith("GMT+")
- || zonename.startsWith("GMT-")))
- offset_string = "";
- else
- offset_string = Integer.toString(gmt_offset);
-
- String id = zonename + offset_string + dst_zonename;
-
- return id;
- }
- }
-
- // Something didn't match while reading the file.
- return null;
- }
- catch (IOException ioe)
- {
- // Parse error, not a proper tzfile.
- return null;
- }
- finally
- {
- try
- {
- if (dis != null)
- dis.close();
- }
- catch(IOException ioe)
- {
- // Error while close, nothing we can do.
- }
- }
- }
-
- /**
- * Skips the requested number of bytes in the given InputStream.
- * Throws EOFException if not enough bytes could be skipped.
- * Negative numbers of bytes to skip are ignored.
- */
- private static void skipFully(InputStream is, long l) throws IOException
- {
- while (l > 0)
- {
- long k = is.skip(l);
- if (k <= 0)
- throw new EOFException();
- l -= k;
- }
- }
-
- /**
* Maps a time zone name (with optional GMT offset and daylight time
* zone name) to one of the known time zones. This method called
* with the result of <code>System.getProperty("user.timezone")</code>
@@ -1111,7 +839,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
* The standard time zone name for The Netherlands is "Europe/Amsterdam",
* but can also be given as "CET-1CEST".
*/
- private static TimeZone getDefaultTimeZone(String sysTimeZoneId)
+ static TimeZone getDefaultTimeZone(String sysTimeZoneId)
{
// First find start of GMT offset info and any Daylight zone name.
int startGMToffset = 0;
@@ -1119,7 +847,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
for (int i = 0; i < sysTimeZoneIdLength && startGMToffset == 0; i++)
{
char c = sysTimeZoneId.charAt(i);
- if (c == '+' || c == '-' || Character.isDigit(c))
+ if (Character.isDigit(c))
+ startGMToffset = i;
+ else if ((c == '+' || c == '-')
+ && i + 1 < sysTimeZoneIdLength
+ && Character.isDigit(sysTimeZoneId.charAt(i + 1)))
startGMToffset = i;
}
@@ -1152,7 +884,7 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
// Offset could be in hours or seconds. Convert to millis.
// The offset is given as the time to add to local time to get GMT
// we need the time to add to GMT to get localtime.
- if (gmtOffset < 24)
+ if (Math.abs(gmtOffset) < 24)
gmtOffset *= 60 * 60;
gmtOffset *= -1000;
}
diff --git a/java/util/TreeMap.java b/java/util/TreeMap.java
index e03887833..9ab90f77e 100644
--- a/java/util/TreeMap.java
+++ b/java/util/TreeMap.java
@@ -130,7 +130,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
/**
* The root node of this TreeMap.
*/
- private transient Node root = nil;
+ private transient Node root;
/**
* The size of this TreeMap. Package visible for use by nested classes.
@@ -213,6 +213,7 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
public TreeMap(Comparator<? super K> c)
{
comparator = c;
+ fabricateTree(0);
}
/**
@@ -851,7 +852,11 @@ public class TreeMap<K, V> extends AbstractMap<K, V>
private void fabricateTree(final int count)
{
if (count == 0)
- return;
+ {
+ root = nil;
+ size = 0;
+ return;
+ }
// We color every row of nodes black, except for the overflow nodes.
// I believe that this is the optimal arrangement. We construct the tree
diff --git a/javax/crypto/BadPaddingException.java b/javax/crypto/BadPaddingException.java
new file mode 100644
index 000000000..d15224f3e
--- /dev/null
+++ b/javax/crypto/BadPaddingException.java
@@ -0,0 +1,79 @@
+/* BadPaddingException -- Signals bad padding bytes on decryption.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * This exception is thrown during decryption when the decrypted input
+ * does not have the proper padding bytes that are expected by the padding
+ * mechanism.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class BadPaddingException extends GeneralSecurityException
+{
+
+ // Constant.
+ // ------------------------------------------------------------------------
+
+ /** Serialization constant. */
+ private static final long serialVersionUID = -5315033893984728443L;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates a new bad padding exception with no detail message.
+ */
+ public BadPaddingException()
+ {
+ super();
+ }
+
+ /**
+ * Creates a new bad padding exception with a detail message.
+ *
+ * @param message The detail message.
+ */
+ public BadPaddingException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/crypto/Cipher.java b/javax/crypto/Cipher.java
new file mode 100644
index 000000000..d768d6ad7
--- /dev/null
+++ b/javax/crypto/Cipher.java
@@ -0,0 +1,1097 @@
+/* Cipher.java -- Interface to a cryptographic cipher.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.security.spec.AlgorithmParameterSpec;
+
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+
+import gnu.java.security.Engine;
+
+/**
+ * <p>This class implements a cryptographic cipher for transforming
+ * data.</p>
+ *
+ * <p>Ciphers cannot be instantiated directly; rather one of the
+ * <code>getInstance</code> must be used to instantiate a given
+ * <i>transformation</i>, optionally with a specific provider.</p>
+ *
+ * <p>A transformation is of the form:</p>
+ *
+ * <ul>
+ * <li><i>algorithm</i>/<i>mode</i>/<i>padding</i>, or</li>
+ * <li><i>algorithm</i>
+ * </ul>
+ *
+ * <p>where <i>algorithm</i> is the base name of a cryptographic cipher
+ * (such as "AES"), <i>mode</i> is the abbreviated name of a block
+ * cipher mode (such as "CBC" for cipher block chaining mode), and
+ * <i>padding</i> is the name of a padding scheme (such as
+ * "PKCS5Padding"). If only the algorithm name is supplied, then the
+ * provider-specific default mode and padding will be used.</p>
+ *
+ * <p>An example transformation is:</p>
+ *
+ * <blockquote><code>Cipher c =
+ * Cipher.getInstance("AES/CBC/PKCS5Padding");</code></blockquote>
+ *
+ * <p>Finally, when requesting a block cipher in stream cipher mode
+ * (such as <acronym title="Advanced Encryption Standard">AES</acronym>
+ * in OFB or CFB mode) the number of bits to be processed
+ * at a time may be specified by appending it to the name of the mode;
+ * e.g. <code>"AES/OFB8/NoPadding"</code>. If no such number is
+ * specified a provider-specific default value is used.</p>
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @see java.security.KeyGenerator
+ * @see javax.crypto.SecretKey
+ */
+public class Cipher
+{
+
+ // Constants and variables.
+ // ------------------------------------------------------------------------
+
+ private static final String SERVICE = "Cipher";
+
+ /**
+ * The decryption operation mode.
+ */
+ public static final int DECRYPT_MODE = 2;
+
+ /**
+ * The encryption operation mode.
+ */
+ public static final int ENCRYPT_MODE = 1;
+
+ /**
+ * Constant for when the key to be unwrapped is a private key.
+ */
+ public static final int PRIVATE_KEY = 2;
+
+ /**
+ * Constant for when the key to be unwrapped is a public key.
+ */
+ public static final int PUBLIC_KEY = 1;
+
+ /**
+ * Constant for when the key to be unwrapped is a secret key.
+ */
+ public static final int SECRET_KEY = 3;
+
+ /**
+ * The key unwrapping operation mode.
+ */
+ public static final int UNWRAP_MODE = 4;
+
+ /**
+ * The key wrapping operation mode.
+ */
+ public static final int WRAP_MODE = 3;
+
+ /**
+ * The uninitialized state. This state signals that any of the
+ * <code>init</code> methods have not been called, and therefore no
+ * transformations can be done.
+ */
+ private static final int INITIAL_STATE = 0;
+
+ /** The underlying cipher service provider interface. */
+ private CipherSpi cipherSpi;
+
+ /** The provider from which this instance came. */
+ private Provider provider;
+
+ /** The transformation requested. */
+ private String transformation;
+
+ /** Our current state (encrypting, wrapping, etc.) */
+ private int state;
+
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * <p>Creates a new cipher instance for the given transformation.</p>
+ *
+ * <p>The installed providers are tried in order for an
+ * implementation, and the first appropriate instance is returned. If
+ * no installed provider can provide the implementation, an
+ * appropriate exception is thrown.</p>
+ *
+ * @param transformation The transformation to create.
+ * @return An appropriate cipher for this transformation.
+ * @throws java.security.NoSuchAlgorithmException If no installed
+ * provider can supply the appropriate cipher or mode.
+ * @throws javax.crypto.NoSuchPaddingException If no installed
+ * provider can supply the appropriate padding.
+ */
+ public static final Cipher getInstance(String transformation)
+ throws NoSuchAlgorithmException, NoSuchPaddingException
+ {
+ Provider[] providers = Security.getProviders();
+ NoSuchPaddingException ex = null;
+ String msg = "";
+ for (int i = 0; i < providers.length; i++)
+ {
+ try
+ {
+ return getInstance(transformation, providers[i]);
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ msg = nsae.getMessage();
+ ex = null;
+ }
+ catch (NoSuchPaddingException nspe)
+ {
+ ex = nspe;
+ }
+ }
+ if (ex != null)
+ {
+ throw ex;
+ }
+ throw new NoSuchAlgorithmException(msg);
+ }
+
+ /**
+ * <p>Creates a new cipher instance for the given transformation and
+ * the named provider.</p>
+ *
+ * @param transformation The transformation to create.
+ * @param provider The name of the provider to use.
+ * @return An appropriate cipher for this transformation.
+ * @throws java.security.NoSuchAlgorithmException If the provider cannot
+ * supply the appropriate cipher or mode.
+ * @throws java.security.NoSuchProviderException If the named provider
+ * is not installed.
+ * @throws javax.crypto.NoSuchPaddingException If the provider cannot
+ * supply the appropriate padding.
+ */
+ public static final Cipher getInstance(String transformation, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException,
+ NoSuchPaddingException
+ {
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(transformation, p);
+ }
+
+ /**
+ * Creates a new cipher instance for the given transform and the given
+ * provider.
+ *
+ * @param transformation The transformation to create.
+ * @param provider The provider to use.
+ * @return An appropriate cipher for this transformation.
+ * @throws java.security.NoSuchAlgorithmException If the given
+ * provider cannot supply the appropriate cipher or mode.
+ * @throws javax.crypto.NoSuchPaddingException If the given
+ * provider cannot supply the appropriate padding scheme.
+ */
+ public static final Cipher getInstance(String transformation, Provider provider)
+ throws NoSuchAlgorithmException, NoSuchPaddingException
+ {
+ CipherSpi result = null;
+ String key = null;
+ String alg = null, mode = null, pad = null;
+ String msg = "";
+ if (transformation.indexOf('/') < 0)
+ {
+ try
+ {
+ result = (CipherSpi) Engine.getInstance(SERVICE, transformation,
+ provider);
+ return new Cipher(result, provider, transformation);
+ }
+ catch (Exception e)
+ {
+ msg = e.getMessage();
+ }
+ }
+ else
+ {
+ StringTokenizer tok = new StringTokenizer(transformation, "/");
+ if (tok.countTokens() != 3)
+ {
+ throw new NoSuchAlgorithmException("badly formed transformation");
+ }
+ alg = tok.nextToken();
+ mode = tok.nextToken();
+ pad = tok.nextToken();
+ try
+ {
+ result = (CipherSpi) Engine.getInstance(SERVICE, transformation,
+ provider);
+ return new Cipher(result, provider, transformation);
+ }
+ catch (Exception e)
+ {
+ msg = e.getMessage();
+ }
+ try
+ {
+ result = (CipherSpi) Engine.getInstance(SERVICE, alg + '/' + mode,
+ provider);
+ result.engineSetPadding(pad);
+ return new Cipher(result, provider, transformation);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof NoSuchPaddingException)
+ {
+ throw (NoSuchPaddingException) e;
+ }
+ msg = e.getMessage();
+ }
+ try
+ {
+ result = (CipherSpi) Engine.getInstance(SERVICE, alg + "//" + pad,
+ provider);
+ result.engineSetMode(mode);
+ return new Cipher(result, provider, transformation);
+ }
+ catch (Exception e)
+ {
+ msg = e.getMessage();
+ }
+ try
+ {
+ result = (CipherSpi) Engine.getInstance(SERVICE, alg, provider);
+ result.engineSetMode(mode);
+ result.engineSetPadding(pad);
+ return new Cipher(result, provider, transformation);
+ }
+ catch (Exception e)
+ {
+ if (e instanceof NoSuchPaddingException)
+ {
+ throw (NoSuchPaddingException) e;
+ }
+ msg = e.getMessage();
+ }
+ }
+ throw new NoSuchAlgorithmException(transformation + ": " + msg);
+ }
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a cipher.
+ *
+ * @param cipherSpi The underlying implementation of the cipher.
+ * @param provider The provider of this cipher implementation.
+ * @param transformation The transformation this cipher performs.
+ */
+ protected
+ Cipher(CipherSpi cipherSpi, Provider provider, String transformation)
+ {
+ this.cipherSpi = cipherSpi;
+ this.provider = provider;
+ this.transformation = transformation;
+ state = INITIAL_STATE;
+ }
+
+ // Public instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the name that this cipher instance was created with; this is
+ * equivalent to the "transformation" argument given to any of the
+ * {@link #getInstance()} methods.
+ *
+ * @return The cipher name.
+ */
+ public final String getAlgorithm()
+ {
+ return transformation;
+ }
+
+ /**
+ * Return the size of blocks, in bytes, that this cipher processes.
+ *
+ * @return The block size.
+ */
+ public final int getBlockSize()
+ {
+ if (cipherSpi != null)
+ {
+ return cipherSpi.engineGetBlockSize();
+ }
+ return 1;
+ }
+
+ /**
+ * Return the currently-operating {@link ExemptionMechanism}.
+ *
+ * @return null, currently.
+ */
+ public final ExemptionMechanism getExemptionMechanism()
+ {
+ return null;
+ }
+
+ /**
+ * Return the <i>initialization vector</i> that this instance was
+ * initialized with.
+ *
+ * @return The IV.
+ */
+ public final byte[] getIV()
+ {
+ if (cipherSpi != null)
+ {
+ return cipherSpi.engineGetIV();
+ }
+ return null;
+ }
+
+ /**
+ * Return the {@link java.security.AlgorithmParameters} that this
+ * instance was initialized with.
+ *
+ * @return The parameters.
+ */
+ public final AlgorithmParameters getParameters()
+ {
+ if (cipherSpi != null) {
+ return cipherSpi.engineGetParameters();
+ }
+ return null;
+ }
+
+ /**
+ * Return this cipher's provider.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Finishes a multi-part transformation, and returns the final
+ * transformed bytes.
+ *
+ * @return The final transformed bytes.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized, or if a <tt>doFinal</tt> call has already
+ * been made.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input is not a multiple of this cipher's
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is
+ * decrypting and the padding bytes do not match this
+ * instance's padding scheme.
+ */
+ public final byte[] doFinal()
+ throws IllegalStateException, IllegalBlockSizeException, BadPaddingException
+ {
+ return doFinal(new byte[0], 0, 0);
+ }
+
+ /**
+ * Finishes a multi-part transformation or does an entire
+ * transformation on the input, and returns the transformed bytes.
+ *
+ * @param input The final input bytes.
+ * @return The final transformed bytes.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized, or if a <tt>doFinal</tt> call has already
+ * been made.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input is not a multiple of this cipher's
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is
+ * decrypting and the padding bytes do not match this
+ * instance's padding scheme.
+ */
+ public final byte[] doFinal(byte[] input)
+ throws IllegalStateException, IllegalBlockSizeException, BadPaddingException
+ {
+ return doFinal(input, 0, input.length);
+ }
+
+ /**
+ * Finishes a multi-part transformation or does an entire
+ * transformation on the input, and returns the transformed bytes.
+ *
+ * @param input The final input bytes.
+ * @param inputOffset The index in the input bytes to start.
+ * @param inputLength The number of bytes to read from the input.
+ * @return The final transformed bytes.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized, or if a <tt>doFinal</tt> call has already
+ * been made.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input is not a multiple of this cipher's
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is
+ * decrypting and the padding bytes do not match this
+ * instance's padding scheme.
+ */
+ public final byte[] doFinal(byte[] input, int inputOffset, int inputLength)
+ throws IllegalStateException, IllegalBlockSizeException, BadPaddingException
+ {
+ if (cipherSpi == null)
+ {
+ byte[] b = new byte[inputLength];
+ System.arraycopy(input, inputOffset, b, 0, inputLength);
+ return b;
+ }
+ if (state != ENCRYPT_MODE && state != DECRYPT_MODE)
+ {
+ throw new IllegalStateException("neither encrypting nor decrypting");
+ }
+ state = INITIAL_STATE;
+ return cipherSpi.engineDoFinal(input, inputOffset, inputLength);
+ }
+
+ /**
+ * Finishes a multi-part transformation and stores the transformed
+ * bytes into the given array.
+ *
+ * @param output The destination for the transformed bytes.
+ * @param outputOffset The offset in <tt>output</tt> to start storing
+ * bytes.
+ * @return The number of bytes placed into the output array.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized, or if a <tt>doFinal</tt> call has already
+ * been made.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input is not a multiple of this cipher's
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is
+ * decrypting and the padding bytes do not match this
+ * instance's padding scheme.
+ * @throws javax.crypto.ShortBufferException If the output array is
+ * not large enough to hold the transformed bytes.
+ */
+ public final int doFinal(byte[] output, int outputOffset)
+ throws IllegalStateException, IllegalBlockSizeException, BadPaddingException,
+ ShortBufferException
+ {
+ if (cipherSpi == null)
+ {
+ return 0;
+ }
+ if (state != ENCRYPT_MODE && state != DECRYPT_MODE)
+ {
+ throw new IllegalStateException("neither encrypting nor decrypting");
+ }
+ state = INITIAL_STATE;
+ return cipherSpi.engineDoFinal(new byte[0], 0, 0, output, outputOffset);
+ }
+
+ /**
+ * Finishes a multi-part transformation or transforms a portion of a
+ * byte array, and stores the result in the given byte array.
+ *
+ * @param input The input bytes.
+ * @param inputOffset The index in <tt>input</tt> to start.
+ * @param inputLength The number of bytes to transform.
+ * @param output The output buffer.
+ * @param outputOffset The index in <tt>output</tt> to start.
+ * @return The number of bytes placed into the output array.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized, or if a <tt>doFinal</tt> call has already
+ * been made.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input is not a multiple of this cipher's
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is
+ * decrypting and the padding bytes do not match this
+ * instance's padding scheme.
+ * @throws javax.crypto.ShortBufferException If the output array is
+ * not large enough to hold the transformed bytes.
+ */
+ public final int doFinal(byte[] input, int inputOffset, int inputLength,
+ byte[] output, int outputOffset)
+ throws IllegalStateException, IllegalBlockSizeException, BadPaddingException,
+ ShortBufferException
+ {
+ if (cipherSpi == null)
+ {
+ if (inputLength > output.length - outputOffset)
+ {
+ throw new ShortBufferException();
+ }
+ System.arraycopy(input, inputOffset, output, outputOffset, inputLength);
+ return inputLength;
+ }
+ if (state != ENCRYPT_MODE && state != DECRYPT_MODE)
+ {
+ throw new IllegalStateException("neither encrypting nor decrypting");
+ }
+ state = INITIAL_STATE;
+ return cipherSpi.engineDoFinal(input, inputOffset, inputLength,
+ output, outputOffset);
+ }
+
+ public final int doFinal(byte[] input, int inputOffset, int inputLength,
+ byte[] output)
+ throws IllegalStateException, IllegalBlockSizeException, BadPaddingException,
+ ShortBufferException
+ {
+ return doFinal(input, inputOffset, inputLength, output, 0);
+ }
+
+ /**
+ * Returns the size an output buffer needs to be if this cipher is
+ * updated with a number of bytes.
+ *
+ * @param inputLength The input length.
+ * @return The output length given this input length.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized, or if a <tt>doFinal</tt> call has already
+ * been made.
+ */
+ public final int getOutputSize(int inputLength) throws IllegalStateException
+ {
+ if (cipherSpi == null)
+ {
+ return inputLength;
+ }
+ if (state != ENCRYPT_MODE && state != DECRYPT_MODE)
+ {
+ throw new IllegalStateException("neither encrypting nor decrypting");
+ }
+ return cipherSpi.engineGetOutputSize(inputLength);
+ }
+
+ /**
+ * <p>Initialize this cipher with the public key from the given
+ * certificate.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>As per the Java 1.4 specification, if <code>cert</code> is an
+ * instance of an {@link java.security.cert.X509Certificate} and its
+ * <i>key usage</i> extension field is incompatible with
+ * <code>opmode</code> then an {@link
+ * java.security.InvalidKeyException} is thrown.</p>
+ *
+ * <p>If this cipher requires any random bytes (for example for an
+ * initilization vector) than the {@link java.security.SecureRandom}
+ * with the highest priority is used as the source of these bytes.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param certificate The certificate.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the certificate's public key, or if the
+ * public key cannot be used as described above.
+ */
+ public final void init(int opmode, Certificate certificate)
+ throws InvalidKeyException
+ {
+ init(opmode, certificate, new SecureRandom());
+ }
+
+ /**
+ * <p>Initialize this cipher with the supplied key.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>If this cipher requires any random bytes (for example for an
+ * initilization vector) than the {@link java.security.SecureRandom}
+ * with the highest priority is used as the source of these bytes.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param key The key.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the given key.
+ */
+ public final void init(int opmode, Key key) throws InvalidKeyException
+ {
+ state = opmode;
+ if (cipherSpi != null)
+ {
+ cipherSpi.engineInit(opmode, key, new SecureRandom());
+ }
+ }
+
+ /**
+ * <p>Initialize this cipher with the public key from the given
+ * certificate and the specified source of randomness.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>As per the Java 1.4 specification, if <code>cert</code> is an
+ * instance of an {@link java.security.cert.X509Certificate} and its
+ * <i>key usage</i> extension field is incompatible with
+ * <code>opmode</code> then an {@link
+ * java.security.InvalidKeyException} is thrown.</p>
+ *
+ * <p>If this cipher requires any random bytes (for example for an
+ * initilization vector) than the {@link java.security.SecureRandom}
+ * with the highest priority is used as the source of these bytes.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param certificate The certificate.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the certificate's public key, or if the
+ * public key cannot be used as described above.
+ */
+ public final void
+ init(int opmode, Certificate certificate, SecureRandom random)
+ throws InvalidKeyException
+ {
+ if (certificate instanceof X509Certificate)
+ {
+ boolean[] keyInfo = ((X509Certificate) certificate).getKeyUsage();
+ if (keyInfo != null)
+ {
+ switch (opmode)
+ {
+ case DECRYPT_MODE:
+ if (!keyInfo[3])
+ {
+ throw new InvalidKeyException(
+ "the certificate's key cannot be used for transforming data");
+ }
+ if (keyInfo[7])
+ {
+ throw new InvalidKeyException(
+ "the certificate's key can only be used for encryption");
+ }
+ break;
+
+ case ENCRYPT_MODE:
+ if (!keyInfo[3])
+ {
+ throw new InvalidKeyException(
+ "the certificate's key cannot be used for transforming data");
+ }
+ if (keyInfo[8])
+ {
+ throw new InvalidKeyException(
+ "the certificate's key can only be used for decryption");
+ }
+ break;
+
+ case UNWRAP_MODE:
+ if (!keyInfo[2] || keyInfo[7])
+ {
+ throw new InvalidKeyException(
+ "the certificate's key cannot be used for key unwrapping");
+ }
+ break;
+
+ case WRAP_MODE:
+ if (!keyInfo[2] || keyInfo[8])
+ {
+ throw new InvalidKeyException(
+ "the certificate's key cannot be used for key wrapping");
+ }
+ break;
+ }
+ }
+ }
+ init(opmode, certificate.getPublicKey(), random);
+ }
+
+ /**
+ * <p>Initialize this cipher with the supplied key and source of
+ * randomness.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param key The key.
+ * @param random The source of randomness to use.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the given key.
+ */
+ public final void init(int opmode, Key key, SecureRandom random)
+ throws InvalidKeyException
+ {
+ state = opmode;
+ if (cipherSpi != null)
+ {
+ cipherSpi.engineInit(opmode, key, random);
+ }
+ }
+
+ /**
+ * <p>Initialize this cipher with the supplied key and parameters.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>If this cipher requires any random bytes (for example for an
+ * initilization vector) then the {@link java.security.SecureRandom}
+ * with the highest priority is used as the source of these bytes.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param key The key.
+ * @param params The algorithm parameters to initialize this instance
+ * with.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the given key.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inappropriate for this cipher.
+ */
+ public final void init(int opmode, Key key, AlgorithmParameters params)
+ throws InvalidKeyException, InvalidAlgorithmParameterException
+ {
+ init(opmode, key, params, new SecureRandom());
+ }
+
+ /**
+ * <p>Initialize this cipher with the supplied key and parameters.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>If this cipher requires any random bytes (for example for an
+ * initilization vector) then the {@link java.security.SecureRandom}
+ * with the highest priority is used as the source of these bytes.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param key The key.
+ * @param params The algorithm parameters to initialize this instance
+ * with.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the given key.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inappropriate for this cipher.
+ */
+ public final void init(int opmode, Key key, AlgorithmParameterSpec params)
+ throws InvalidKeyException, InvalidAlgorithmParameterException
+ {
+ init(opmode, key, params, new SecureRandom());
+ }
+
+ /**
+ * <p>Initialize this cipher with the supplied key, parameters, and
+ * source of randomness.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param key The key.
+ * @param params The algorithm parameters to initialize this instance
+ * with.
+ * @param random The source of randomness to use.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the given key.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inappropriate for this cipher.
+ */
+ public final void init(int opmode, Key key, AlgorithmParameters params,
+ SecureRandom random)
+ throws InvalidKeyException, InvalidAlgorithmParameterException
+ {
+ state = opmode;
+ if (cipherSpi != null)
+ {
+ cipherSpi.engineInit(opmode, key, params, random);
+ }
+ }
+
+ /**
+ * <p>Initialize this cipher with the supplied key, parameters, and
+ * source of randomness.</p>
+ *
+ * <p>The cipher will be initialized for encryption, decryption, key
+ * wrapping, or key unwrapping, depending upon whether the
+ * <code>opmode</code> argument is {@link #ENCRYPT_MODE}, {@link
+ * #DECRYPT_MODE}, {@link #WRAP_MODE}, or {@link #UNWRAP_MODE},
+ * respectively.</p>
+ *
+ * <p>A call to any of the <code>init</code> methods overrides the
+ * state of the instance, and is equivalent to creating a new instance
+ * and calling its <code>init</code> method.</p>
+ *
+ * @param opmode The operation mode to use.
+ * @param key The key.
+ * @param params The algorithm parameters to initialize this instance
+ * with.
+ * @param random The source of randomness to use.
+ * @throws java.security.InvalidKeyException If the underlying cipher
+ * instance rejects the given key.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inappropriate for this cipher.
+ */
+ public final void init(int opmode, Key key, AlgorithmParameterSpec params,
+ SecureRandom random)
+ throws InvalidKeyException, InvalidAlgorithmParameterException
+ {
+ state = opmode;
+ if (cipherSpi != null)
+ {
+ cipherSpi.engineInit(opmode, key, params, random);
+ }
+ }
+
+ /**
+ * Unwrap a previously-wrapped key.
+ *
+ * @param wrappedKey The wrapped key.
+ * @param wrappedKeyAlgorithm The algorithm with which the key was
+ * wrapped.
+ * @param wrappedKeyType The type of key (public, private, or
+ * secret) that this wrapped key respresents.
+ * @return The unwrapped key.
+ * @throws java.lang.IllegalStateException If this instance has not be
+ * initialized for unwrapping.
+ * @throws java.security.InvalidKeyException If <code>wrappedKey</code>
+ * is not a wrapped key, if the algorithm cannot unwrap this
+ * key, or if the unwrapped key's type differs from the
+ * specified type.
+ * @throws java.security.NoSuchAlgorithmException If
+ * <code>wrappedKeyAlgorithm</code> is not a valid algorithm
+ * name.
+ */
+ public final Key unwrap(byte[] wrappedKey, String wrappedKeyAlgorithm,
+ int wrappedKeyType)
+ throws IllegalStateException, InvalidKeyException, NoSuchAlgorithmException
+ {
+ if (cipherSpi == null)
+ {
+ return null;
+ }
+ if (state != UNWRAP_MODE)
+ {
+ throw new IllegalStateException("instance is not for unwrapping");
+ }
+ return cipherSpi.engineUnwrap(wrappedKey, wrappedKeyAlgorithm,
+ wrappedKeyType);
+ }
+
+ /**
+ * Continue a multi-part transformation on an entire byte array,
+ * returning the transformed bytes.
+ *
+ * @param input The input bytes.
+ * @return The transformed bytes.
+ * @throws java.lang.IllegalStateException If this cipher was not
+ * initialized for encryption or decryption.
+ */
+ public final byte[] update(byte[] input) throws IllegalStateException
+ {
+ return update(input, 0, input.length);
+ }
+
+ /**
+ * Continue a multi-part transformation on part of a byte array,
+ * returning the transformed bytes.
+ *
+ * @param input The input bytes.
+ * @param inputOffset The index in the input to start.
+ * @param inputLength The number of bytes to transform.
+ * @return The transformed bytes.
+ * @throws java.lang.IllegalStateException If this cipher was not
+ * initialized for encryption or decryption.
+ */
+ public final byte[] update(byte[] input, int inputOffset, int inputLength)
+ throws IllegalStateException
+ {
+ if (cipherSpi == null)
+ {
+ byte[] b = new byte[inputLength];
+ System.arraycopy(input, inputOffset, b, 0, inputLength);
+ return b;
+ }
+ if (state != ENCRYPT_MODE && state != DECRYPT_MODE)
+ {
+ throw new IllegalStateException(
+ "cipher is not for encrypting or decrypting");
+ }
+ return cipherSpi.engineUpdate(input, inputOffset, inputLength);
+ }
+
+ /**
+ * Continue a multi-part transformation on part of a byte array,
+ * placing the transformed bytes into the given array.
+ *
+ * @param input The input bytes.
+ * @param inputOffset The index in the input to start.
+ * @param inputLength The number of bytes to transform.
+ * @param output The output byte array.
+ * @return The number of transformed bytes.
+ * @throws java.lang.IllegalStateException If this cipher was not
+ * initialized for encryption or decryption.
+ * @throws javax.security.ShortBufferException If there is not enough
+ * room in the output array to hold the transformed bytes.
+ */
+ public final int update(byte[] input, int inputOffset, int inputLength,
+ byte[] output)
+ throws IllegalStateException, ShortBufferException
+ {
+ return update(input, inputOffset, inputLength, output, 0);
+ }
+
+ /**
+ * Continue a multi-part transformation on part of a byte array,
+ * placing the transformed bytes into the given array.
+ *
+ * @param input The input bytes.
+ * @param inputOffset The index in the input to start.
+ * @param inputLength The number of bytes to transform.
+ * @param output The output byte array.
+ * @param outputOffset The index in the output array to start.
+ * @return The number of transformed bytes.
+ * @throws java.lang.IllegalStateException If this cipher was not
+ * initialized for encryption or decryption.
+ * @throws javax.security.ShortBufferException If there is not enough
+ * room in the output array to hold the transformed bytes.
+ */
+ public final int update(byte[] input, int inputOffset, int inputLength,
+ byte[] output, int outputOffset)
+ throws IllegalStateException, ShortBufferException
+ {
+ if (cipherSpi == null)
+ {
+ if (inputLength > output.length - outputOffset)
+ {
+ throw new ShortBufferException();
+ }
+ System.arraycopy(input, inputOffset, output, outputOffset, inputLength);
+ return inputLength;
+ }
+ if (state != ENCRYPT_MODE && state != DECRYPT_MODE)
+ {
+ throw new IllegalStateException(
+ "cipher is not for encrypting or decrypting");
+ }
+ return cipherSpi.engineUpdate(input, inputOffset, inputLength,
+ output, outputOffset);
+ }
+
+ /**
+ * Wrap a key.
+ *
+ * @param key The key to wrap.
+ * @return The wrapped key.
+ * @throws java.lang.IllegalStateException If this instance was not
+ * initialized for key wrapping.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the key is not a multiple of the block size.
+ * @throws java.security.InvalidKeyException If this instance cannot
+ * wrap this key.
+ */
+ public final byte[] wrap(Key key)
+ throws IllegalStateException, IllegalBlockSizeException, InvalidKeyException
+ {
+ if (cipherSpi == null)
+ {
+ return null;
+ }
+ if (state != WRAP_MODE)
+ {
+ throw new IllegalStateException("instance is not for key wrapping");
+ }
+ return cipherSpi.engineWrap(key);
+ }
+}
diff --git a/javax/crypto/CipherInputStream.java b/javax/crypto/CipherInputStream.java
new file mode 100644
index 000000000..c01cb47ac
--- /dev/null
+++ b/javax/crypto/CipherInputStream.java
@@ -0,0 +1,383 @@
+/* CipherInputStream.java -- Filters input through a cipher.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.io.FilterInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * This is an {@link java.io.InputStream} that filters its data
+ * through a {@link Cipher} before returning it. The <code>Cipher</code>
+ * argument must have been initialized before it is passed to the
+ * constructor.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class CipherInputStream extends FilterInputStream
+{
+
+ // Constants and variables.
+ // ------------------------------------------------------------------------
+
+ /**
+ * The underlying {@link Cipher} instance.
+ */
+ private Cipher cipher;
+
+ /**
+ * Data that has been transformed but not read.
+ */
+ private byte[] outBuffer;
+
+ /**
+ * The offset into {@link #outBuffer} where valid data starts.
+ */
+ private int outOffset;
+
+ /**
+ * The number of valid bytes in the {@link #outBuffer}.
+ */
+ private int outLength;
+
+ /**
+ * Byte buffer that is filled with raw data from the underlying input
+ * stream.
+ */
+ private byte[][] inBuffer;
+
+ /**
+ * The amount of bytes in inBuffer[0] that may be input to the cipher.
+ */
+ private int inLength;
+
+ /**
+ * We set this when the cipher block size is 1, meaning that we can
+ * transform any amount of data.
+ */
+ private boolean isStream;
+
+ private static final int VIRGIN = 0; // I am born.
+ private static final int LIVING = 1; // I am nailed to the hull.
+ private static final int DYING = 2; // I am eaten by sharks.
+ private static final int DEAD = 3;
+ private int state;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates a new input stream with a source input stream and cipher.
+ *
+ * @param in The underlying input stream.
+ * @param cipher The cipher to filter data through.
+ */
+ public CipherInputStream(InputStream in, Cipher cipher)
+ {
+ this(in);
+ this.cipher = cipher;
+ if (!(isStream = cipher.getBlockSize() == 1))
+ {
+ inBuffer = new byte[2][];
+ inBuffer[0] = new byte[cipher.getBlockSize()];
+ inBuffer[1] = new byte[cipher.getBlockSize()];
+ inLength = 0;
+ outBuffer = new byte[cipher.getBlockSize()];
+ outOffset = outLength = 0;
+ state = VIRGIN;
+ }
+ }
+
+ /**
+ * Creates a new input stream without a cipher. This constructor is
+ * <code>protected</code> because this class does not work without an
+ * underlying cipher.
+ *
+ * @param in The underlying input stream.
+ */
+ protected CipherInputStream(InputStream in)
+ {
+ super(in);
+ }
+
+ // Instance methods overriding java.io.FilterInputStream.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the number of bytes available without blocking. The value
+ * returned by this method is never greater than the underlying
+ * cipher's block size.
+ *
+ * @return The number of bytes immediately available.
+ * @throws java.io.IOException If an I/O exception occurs.
+ */
+ public int available() throws IOException
+ {
+ if (isStream)
+ return super.available();
+ return outLength - outOffset;
+ }
+
+ /**
+ * Close this input stream. This method merely calls the {@link
+ * java.io.InputStream#close()} method of the underlying input stream.
+ *
+ * @throws java.io.IOException If an I/O exception occurs.
+ */
+ public void close() throws IOException
+ {
+ super.close();
+ }
+
+ /**
+ * Read a single byte from this input stream; returns -1 on the
+ * end-of-file.
+ *
+ * @return The byte read, or -1 if there are no more bytes.
+ * @throws java.io.IOExcpetion If an I/O exception occurs.
+ */
+ public int read() throws IOException
+ {
+ if (isStream)
+ {
+ byte[] buf = new byte[1];
+ int in = super.read();
+ if (in == -1)
+ return -1;
+ buf[0] = (byte) in;
+ try
+ {
+ cipher.update(buf, 0, 1, buf, 0);
+ }
+ catch (ShortBufferException shouldNotHappen)
+ {
+ throw new IOException(shouldNotHappen.getMessage());
+ }
+ return buf[0] & 0xFF;
+ }
+ if (state == DEAD) return -1;
+ if (available() == 0) nextBlock();
+ if (state == DEAD) return -1;
+ return outBuffer[outOffset++] & 0xFF;
+ }
+
+ /**
+ * Read bytes into an array, returning the number of bytes read or -1
+ * on the end-of-file.
+ *
+ * @param buf The byte array to read into.
+ * @param off The offset in <code>buf</code> to start.
+ * @param len The maximum number of bytes to read.
+ * @return The number of bytes read, or -1 on the end-of-file.
+ * @throws java.io.IOException If an I/O exception occurs.
+ */
+ public int read(byte[] buf, int off, int len) throws IOException
+ {
+ if (isStream)
+ {
+ len = super.read(buf, off, len);
+ try
+ {
+ cipher.update(buf, off, len, buf, off);
+ }
+ catch (ShortBufferException shouldNotHappen)
+ {
+ throw new IOException(shouldNotHappen.getMessage());
+ }
+ return len;
+ }
+
+ int count = 0;
+ while (count < len)
+ {
+ if (available() == 0)
+ nextBlock();
+ if (state == DEAD)
+ {
+ if (count > 0) return count;
+ else return -1;
+ }
+ int l = Math.min(available(), len - count);
+ System.arraycopy(outBuffer, outOffset, buf, count+off, l);
+ count += l;
+ outOffset = outLength = 0;
+ }
+ return count;
+ }
+
+ /**
+ * Read bytes into an array, returning the number of bytes read or -1
+ * on the end-of-file.
+ *
+ * @param buf The byte arry to read into.
+ * @return The number of bytes read, or -1 on the end-of-file.
+ * @throws java.io.IOException If an I/O exception occurs.
+ */
+ public int read(byte[] buf) throws IOException
+ {
+ return read(buf, 0, buf.length);
+ }
+
+ /**
+ * Skip a number of bytes. This class only supports skipping as many
+ * bytes as are returned by {@link #available()}, which is the number
+ * of transformed bytes currently in this class's internal buffer.
+ *
+ * @param bytes The number of bytes to skip.
+ * @return The number of bytes skipped.
+ */
+ public long skip(long bytes) throws IOException
+ {
+ if (isStream)
+ {
+ return super.skip(bytes);
+ }
+ long ret = 0;
+ if (bytes > 0 && available() > 0)
+ {
+ ret = available();
+ outOffset = outLength = 0;
+ }
+ return ret;
+ }
+
+ /**
+ * Returns whether or not this input stream supports the {@link
+ * #mark(long)} and {@link #reset()} methods; this input stream does
+ * not, however, and invariably returns <code>false</code>.
+ *
+ * @return <code>false</code>
+ */
+ public boolean markSupported()
+ {
+ return false;
+ }
+
+ /**
+ * Set the mark. This method is unsupported and is empty.
+ *
+ * @param mark Is ignored.
+ */
+ public void mark(long mark)
+ {
+ }
+
+ /**
+ * Reset to the mark. This method is unsupported and is empty.
+ */
+ public void reset() throws IOException
+ {
+ throw new IOException("reset not supported");
+ }
+
+ // Own methods.
+ // -------------------------------------------------------------------------
+
+ private void nextBlock() throws IOException
+ {
+ byte[] temp = inBuffer[0];
+ inBuffer[0] = inBuffer[1];
+ inBuffer[1] = temp;
+ int count = 0;
+ boolean eof = false;
+
+ if (state == VIRGIN || state == LIVING)
+ {
+ do
+ {
+ int l = in.read(inBuffer[1], count, inBuffer[1].length - count);
+ if (l == -1)
+ {
+ eof = true;
+ break;
+ }
+ count += l;
+ }
+ while (count < inBuffer[1].length);
+ }
+
+ try
+ {
+ switch (state)
+ {
+ case VIRGIN:
+ state = LIVING;
+ nextBlock();
+ break;
+ case LIVING:
+ if (eof)
+ {
+ if (count > 0)
+ {
+ outOffset = cipher.update(inBuffer[0], 0, inLength, outBuffer, 0);
+ state = DYING;
+ }
+ else
+ {
+ outOffset = cipher.doFinal(inBuffer[0], 0, inLength, outBuffer, 0);
+ state = DEAD;
+ }
+ }
+ else
+ {
+ outOffset = cipher.update(inBuffer[0], 0, inLength, outBuffer, 0);
+ }
+ break;
+ case DYING:
+ outOffset = cipher.doFinal(inBuffer[0], 0, inLength, outBuffer, 0);
+ state = DEAD;
+ break;
+ case DEAD:
+ }
+ }
+ catch (ShortBufferException sbe)
+ {
+ throw new IOException(sbe.toString());
+ }
+ catch (BadPaddingException bpe)
+ {
+ throw new IOException(bpe.toString());
+ }
+ catch (IllegalBlockSizeException ibse)
+ {
+ throw new IOException(ibse.toString());
+ }
+ inLength = count;
+ }
+}
diff --git a/javax/crypto/CipherOutputStream.java b/javax/crypto/CipherOutputStream.java
new file mode 100644
index 000000000..7eb09c1d0
--- /dev/null
+++ b/javax/crypto/CipherOutputStream.java
@@ -0,0 +1,268 @@
+/* CipherOutputStream.java -- Filters output through a cipher.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.io.FilterOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * A filtered output stream that transforms data written to it with a
+ * {@link Cipher} before sending it to the underlying output stream.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class CipherOutputStream extends FilterOutputStream
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ /** The underlying cipher. */
+ private Cipher cipher;
+
+ private byte[][] inBuffer;
+
+ private int inLength;
+
+ private byte[] outBuffer;
+
+ private static final int FIRST_TIME = 0;
+ private static final int SECOND_TIME = 1;
+ private static final int SEASONED = 2;
+ private int state;
+
+ /** True if the cipher is a stream cipher (blockSize == 1) */
+ private boolean isStream;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new cipher output stream. The cipher argument must have
+ * already been initialized.
+ *
+ * @param out The sink for transformed data.
+ * @param cipher The cipher to transform data with.
+ */
+ public CipherOutputStream(OutputStream out, Cipher cipher)
+ {
+ super(out);
+ if (cipher != null)
+ {
+ this.cipher = cipher;
+ if (!(isStream = cipher.getBlockSize() == 1))
+ {
+ inBuffer = new byte[2][];
+ inBuffer[0] = new byte[cipher.getBlockSize()];
+ inBuffer[1] = new byte[cipher.getBlockSize()];
+ inLength = 0;
+ state = FIRST_TIME;
+ }
+ }
+ else
+ this.cipher = new NullCipher();
+ }
+
+ /**
+ * Create a cipher output stream with no cipher.
+ *
+ * @param out The sink for transformed data.
+ */
+ protected CipherOutputStream(OutputStream out)
+ {
+ super(out);
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Close this output stream, and the sink output stream.
+ *
+ * <p>This method will first invoke the {@link Cipher#doFinal()}
+ * method of the underlying {@link Cipher}, and writes the output of
+ * that method to the sink output stream.
+ *
+ * @throws java.io.IOException If an I/O error occurs, or if an error
+ * is caused by finalizing the transformation.
+ */
+ public void close() throws IOException
+ {
+ try
+ {
+ int len;
+ if (state != FIRST_TIME)
+ {
+ len = cipher.update(inBuffer[0], 0, inBuffer[0].length, outBuffer);
+ out.write(outBuffer, 0, len);
+ }
+ len = cipher.doFinal(inBuffer[0], 0, inLength, outBuffer);
+ out.write(outBuffer, 0, len);
+ }
+ catch (javax.crypto.IllegalBlockSizeException ibse)
+ {
+ throw new IOException(ibse.toString());
+ }
+ catch (javax.crypto.BadPaddingException bpe)
+ {
+ throw new IOException(bpe.toString());
+ }
+ catch (ShortBufferException sbe)
+ {
+ throw new IOException(sbe.toString());
+ }
+ out.flush();
+ out.close();
+ }
+
+ /**
+ * Flush any pending output.
+ *
+ * @throws java.io.IOException If an I/O error occurs.
+ */
+ public void flush() throws IOException
+ {
+ out.flush();
+ }
+
+ /**
+ * Write a single byte to the output stream.
+ *
+ * @param b The next byte.
+ * @throws java.io.IOException If an I/O error occurs, or if the
+ * underlying cipher is not in the correct state to transform
+ * data.
+ */
+ public void write(int b) throws IOException
+ {
+ if (isStream)
+ {
+ byte[] buf = new byte[] { (byte) b };
+ try
+ {
+ cipher.update(buf, 0, 1, buf, 0);
+ }
+ catch (ShortBufferException sbe)
+ {
+ throw new IOException(sbe.toString());
+ }
+ out.write(buf);
+ return;
+ }
+ inBuffer[1][inLength++] = (byte) b;
+ if (inLength == inBuffer[1].length)
+ process();
+ }
+
+ /**
+ * Write a byte array to the output stream.
+ *
+ * @param buf The next bytes.
+ * @throws java.io.IOException If an I/O error occurs, or if the
+ * underlying cipher is not in the correct state to transform
+ * data.
+ */
+ public void write(byte[] buf) throws IOException
+ {
+ write(buf, 0, buf.length);
+ }
+
+ /**
+ * Write a portion of a byte array to the output stream.
+ *
+ * @param buf The next bytes.
+ * @param off The offset in the byte array to start.
+ * @param len The number of bytes to write.
+ * @throws java.io.IOException If an I/O error occurs, or if the
+ * underlying cipher is not in the correct state to transform
+ * data.
+ */
+ public void write(byte[] buf, int off, int len) throws IOException
+ {
+ if (isStream)
+ {
+ out.write(cipher.update(buf, off, len));
+ return;
+ }
+ int count = 0;
+ while (count < len)
+ {
+ int l = Math.min(inBuffer[1].length - inLength, len - count);
+ System.arraycopy(buf, off+count, inBuffer[1], inLength, l);
+ count += l;
+ inLength += l;
+ if (inLength == inBuffer[1].length)
+ process();
+ }
+ }
+
+ // Own method.
+ // -------------------------------------------------------------------------
+
+ private void process() throws IOException
+ {
+ if (state == SECOND_TIME)
+ {
+ state = SEASONED;
+ }
+ else
+ {
+ byte[] temp = inBuffer[0];
+ inBuffer[0] = inBuffer[1];
+ inBuffer[1] = temp;
+ }
+ if (state == FIRST_TIME)
+ {
+ inLength = 0;
+ state = SECOND_TIME;
+ return;
+ }
+ try
+ {
+ cipher.update(inBuffer[0], 0, inBuffer[0].length, outBuffer);
+ }
+ catch (ShortBufferException sbe)
+ {
+ throw new IOException(sbe.toString());
+ }
+ out.write(outBuffer);
+ inLength = 0;
+ }
+}
diff --git a/javax/crypto/CipherSpi.java b/javax/crypto/CipherSpi.java
new file mode 100644
index 000000000..06ea534f4
--- /dev/null
+++ b/javax/crypto/CipherSpi.java
@@ -0,0 +1,398 @@
+/* CipherSpi.java -- The cipher service provider interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * <p>This class represents the <i>Service Provider Interface</i>
+ * (<b>SPI</b>) for cryptographic ciphers.</p>
+ *
+ * <p>Providers of cryptographic ciphers must subclass this for every
+ * cipher they implement, implementing the abstract methods as
+ * appropriate, then provide an entry that points to the subclass in
+ * their implementation of {@link java.security.Provider}.</p>
+ *
+ * <p>CipherSpi objects are instantiated along with {@link Cipher}s when
+ * the {@link Cipher#getInstance(java.lang.String)} methods are invoked.
+ * Particular ciphers are referenced by a <i>transformation</i>, which
+ * is a String consisting of the cipher's name or the ciper's name
+ * followed by a mode and a padding. Transformations all follow the
+ * general form:</p>
+ *
+ * <ul>
+ * <li><i>algorithm</i>, or</li>
+ * <li><i>algorithm</i>/<i>mode</i>/<i>padding</i>
+ * </ul>
+ *
+ * <p>Cipher names in the master {@link java.security.Provider} class
+ * may be:</p>
+ *
+ * <ol>
+ * <li>The algorithm's name, which uses a pluggable mode and padding:
+ * <code>Cipher.<i>algorithm</i></code></li>
+ * <li>The algorithm's name and the mode, which uses pluggable padding:
+ * <code>Cipher.<i>algorithm</i>/<i>mode</i></code></li>
+ * <li>The algorithm's name and the padding, which uses a pluggable
+ * mode: <code>Cipher.<i>algorithm</i>//<i>padding</i></code></li>
+ * <li>The algorihtm's name, the mode, and the padding:
+ * <code>Cipher.<i>algorithm</i>/<i>mode</i>/<i>padding</i></code></li>
+ * </ol>
+ *
+ * <p>When any {@link Cipher#getInstance(java.lang.String)} method is
+ * invoked, the following happens if the transformation is simply
+ * <i>algorithm</i>:</p>
+ *
+ * <ol>
+ * <li>If the provider defines a <code>CipherSpi</code> implementation
+ * for "<i>algorithm</i>", return it. Otherwise throw a {@link
+ * java.security.NoSuchAlgorithmException}.</li>
+ * </ol>
+ *
+ * <p>If the transformation is of the form
+ * <i>algorithm</i>/<i>mode</i>/<i>padding</i>:</p>
+ *
+ * <ol>
+ * <li>If the provider defines a <code>CipherSpi</code> subclass for
+ * "<i>algorithm</i>/<i>mode</i>/<i>padding</i>", return it. Otherwise
+ * go to step 2.</li>
+ *
+ * <li>If the provider defines a <code>CipherSpi</code> subclass for
+ * "<i>algorithm</i>/<i>mode</i>", instatiate it, call {@link
+ * #engineSetPadding(java.lang.String)} for the padding name, and return
+ * it. Otherwise go to step 3.</li>
+ *
+ * <li>If the provider defines a <code>CipherSpi</code> subclass for
+ * "<i>algorithm</i>//<i>padding</i>", instatiate it, call {@link
+ * #engineSetMode(java.lang.String)} for the mode name, and return
+ * it. Otherwise go to step 4.</li>
+ *
+ * <li>If the provider defines a <code>CipherSpi</code> subclass for
+ * "<i>algorithm</i>", instatiate it, call {@link
+ * #engineSetMode(java.lang.String)} for the mode name, call {@link
+ * #engineSetPadding(java.lang.String)} for the padding name, and return
+ * it. Otherwise throw a {@link java.security.NoSuchAlgorithmException}.</li>
+ * </ol>
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public abstract class CipherSpi
+{
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new CipherSpi.
+ */
+ public CipherSpi()
+ {
+ }
+
+ // Abstract methods to be implemented by providers.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Finishes a multi-part transformation or transforms a portion of a
+ * byte array, and returns the transformed bytes.
+ *
+ * @param input The input bytes.
+ * @param inputOffset The index in the input at which to start.
+ * @param inputLength The number of bytes to transform.
+ * @return The transformed bytes in a new array.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input size is not a multiple of the
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is being
+ * used for decryption and the padding is not appropriate for
+ * this instance's padding scheme.
+ */
+ protected abstract byte[]
+ engineDoFinal(byte[] input, int inputOffset, int inputLength)
+ throws IllegalBlockSizeException, BadPaddingException;
+
+ /**
+ * Finishes a multi-part transformation or transforms a portion of a
+ * byte array, and stores the transformed bytes in the supplied array.
+ *
+ * @param input The input bytes.
+ * @param inputOffset The index in the input at which to start.
+ * @param inputLength The number of bytes to transform.
+ * @param output The output byte array.
+ * @param outputOffset The index in the output array at which to start.
+ * @return The number of transformed bytes stored in the output array.
+ * @throws javax.crypto.IllegalBlockSizeException If this instance has
+ * no padding and the input size is not a multiple of the
+ * block size.
+ * @throws javax.crypto.BadPaddingException If this instance is being
+ * used for decryption and the padding is not appropriate for
+ * this instance's padding scheme.
+ * @throws javax.crypto.ShortBufferException If there is not enough
+ * space in the output array for the transformed bytes.
+ */
+ protected abstract int
+ engineDoFinal(byte[] input, int inputOffset, int inputLength,
+ byte[] output, int outputOffset)
+ throws IllegalBlockSizeException, BadPaddingException, ShortBufferException;
+
+ /**
+ * Returns the block size of the underlying cipher.
+ *
+ * @return The block size.
+ */
+ protected abstract int engineGetBlockSize();
+
+ /**
+ * Returns the initializaiton vector this cipher was initialized with,
+ * if any.
+ *
+ * @return The IV, or null if this cipher uses no IV or if this
+ * instance has not been initialized yet.
+ */
+ protected abstract byte[] engineGetIV();
+
+ /**
+ * <p>Return the length of the given key in bits.</p>
+ *
+ * <p>For compatibility this method is not declared
+ * <code>abstract</code>, and the default implementation will throw an
+ * {@link java.lang.UnsupportedOperationException}. Concrete
+ * subclasses should override this method to return the correct
+ * value.</p>
+ *
+ * @param key The key to get the size for.
+ * @return The size of the key, in bits.
+ * @throws java.security.InvalidKeyException If the key's length
+ * cannot be determined by this implementation.
+ */
+ protected int engineGetKeySize(Key key) throws InvalidKeyException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * <p>Returns the size, in bytes, an output buffer must be for a call
+ * to {@link #engineUpdate(byte[],int,int,byte[],int)} or {@link
+ * #engineDoFinal(byte[],int,int,byte[],int)} to succeed.</p>
+ *
+ * <p>The actual output length may be smaller than the value returned
+ * by this method, as it considers the padding length as well. The
+ * length considered is the argument plus the length of any buffered,
+ * unprocessed bytes.</p>
+ *
+ * @param inputLength The input length, in bytes.
+ * @return The size an output buffer must be.
+ */
+ protected abstract int engineGetOutputSize(int inputLength);
+
+ /**
+ * Returns the parameters that this cipher is using. This may be the
+ * parameters used to initialize this cipher, or it may be parameters
+ * that have been initialized with random values.
+ *
+ * @return This cipher's parameters, or <code>null</code> if this
+ * cipher does not use parameters.
+ */
+ protected abstract AlgorithmParameters engineGetParameters();
+
+ /**
+ * Initializes this cipher with an operation mode, key, and source of
+ * randomness. If this cipher requires any other initializing data,
+ * for example an initialization vector, then it should generate it
+ * from the provided source of randomness.
+ *
+ * @param opmode The operation mode, one of {@link
+ * Cipher#DECRYPT_MODE}, {@link Cipher#ENCRYPT_MODE}, {@link
+ * Cipher#UNWRAP_MODE}, or {@link Cipher#WRAP_MODE}.
+ * @param key The key to initialize this cipher with.
+ * @param random The source of random bytes to use.
+ * @throws java.security.InvalidKeyException If the given key is not
+ * acceptable for this implementation.
+ */
+ protected abstract void engineInit(int opmode, Key key, SecureRandom random)
+ throws InvalidKeyException;
+
+ /**
+ * Initializes this cipher with an operation mode, key, parameters,
+ * and source of randomness. If this cipher requires any other
+ * initializing data, for example an initialization vector, then it should
+ * generate it from the provided source of randomness.
+ *
+ * @param opmode The operation mode, one of {@link
+ * Cipher#DECRYPT_MODE}, {@link Cipher#ENCRYPT_MODE}, {@link
+ * Cipher#UNWRAP_MODE}, or {@link Cipher#WRAP_MODE}.
+ * @param key The key to initialize this cipher with.
+ * @param params The algorithm parameters to initialize with.
+ * @param random The source of random bytes to use.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * given parameters are not appropriate for this
+ * implementation.
+ * @throws java.security.InvalidKeyException If the given key is not
+ * acceptable for this implementation.
+ */
+ protected abstract void
+ engineInit(int opmode, Key key, AlgorithmParameters params,
+ SecureRandom random)
+ throws InvalidAlgorithmParameterException, InvalidKeyException;
+
+ /**
+ * Initializes this cipher with an operation mode, key, parameters,
+ * and source of randomness. If this cipher requires any other
+ * initializing data, for example an initialization vector, then it should
+ * generate it from the provided source of randomness.
+ *
+ * @param opmode The operation mode, one of {@link
+ * Cipher#DECRYPT_MODE}, {@link Cipher#ENCRYPT_MODE}, {@link
+ * Cipher#UNWRAP_MODE}, or {@link Cipher#WRAP_MODE}.
+ * @param key The key to initialize this cipher with.
+ * @param params The algorithm parameters to initialize with.
+ * @param random The source of random bytes to use.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * given parameters are not appropriate for this
+ * implementation.
+ * @throws java.security.InvalidKeyException If the given key is not
+ * acceptable for this implementation.
+ */
+ protected abstract void
+ engineInit(int opmode, Key key, AlgorithmParameterSpec params,
+ SecureRandom random)
+ throws InvalidAlgorithmParameterException, InvalidKeyException;
+
+ /**
+ * Set the mode in which this cipher is to run.
+ *
+ * @param mode The name of the mode to use.
+ * @throws java.security.NoSuchAlgorithmException If the mode is
+ * not supported by this cipher's provider.
+ */
+ protected abstract void engineSetMode(String mode)
+ throws NoSuchAlgorithmException;
+
+ /**
+ * Set the method with which the input is to be padded.
+ *
+ * @param padding The name of the padding to use.
+ * @throws javax.crypto.NoSuchPaddingException If the padding is not
+ * supported by this cipher's provider.
+ */
+ protected abstract void engineSetPadding(String padding)
+ throws NoSuchPaddingException;
+
+ /**
+ * <p>Unwraps a previously-wrapped key.</p>
+ *
+ * <p>For compatibility this method is not declared
+ * <code>abstract</code>, and the default implementation will throw an
+ * {@link java.lang.UnsupportedOperationException}.</p>
+ *
+ * @param wrappedKey The wrapped key.
+ * @param wrappedKeyAlgorithm The name of the algorithm used to wrap
+ * this key.
+ * @param wrappedKeyType The type of wrapped key; one of
+ * {@link Cipher#PRIVATE_KEY},
+ * {@link Cipher#PUBLIC_KEY}, or
+ * {@link Cipher#SECRET_KEY}.
+ * @return The unwrapped key.
+ * @throws java.security.InvalidKeyException If the key cannot be
+ * unwrapped, or if <code>wrappedKeyType</code> is an
+ * inappropriate type for the unwrapped key.
+ * @throws java.security.NoSuchAlgorithmException If the
+ * <code>wrappedKeyAlgorithm</code> is unknown.
+ */
+ protected Key engineUnwrap(byte[] wrappedKey, String wrappedKeyAlgorithm,
+ int wrappedKeyType)
+ throws InvalidKeyException, NoSuchAlgorithmException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Continue with a multi-part transformation, returning a new array of
+ * the transformed bytes.
+ *
+ * @param input The next input bytes.
+ * @param inputOffset The index in the input array from which to start.
+ * @param inputLength The number of bytes to input.
+ * @return The transformed bytes.
+ */
+ protected abstract byte[]
+ engineUpdate(byte[] input, int inputOffset, int inputLength);
+
+ /**
+ * Continue with a multi-part transformation, storing the transformed
+ * bytes into the specified array.
+ *
+ * @param input The next input bytes.
+ * @param inputOffset The index in the input from which to start.
+ * @param inputLength The number of bytes to input.
+ * @param output The output buffer.
+ * @param outputOffset The index in the output array from which to start.
+ * @return The transformed bytes.
+ * @throws javax.crypto.ShortBufferException If there is not enough
+ * space in the output array to store the transformed bytes.
+ */
+ protected abstract int
+ engineUpdate(byte[] input, int inputOffset, int inputLength,
+ byte[] output, int outputOffset)
+ throws ShortBufferException;
+
+ /**
+ * <p>Wrap a key.</p>
+ *
+ * <p>For compatibility this method is not declared
+ * <code>abstract</code>, and the default implementation will throw an
+ * {@link java.lang.UnsupportedOperationException}.</p>
+ *
+ * @param key The key to wrap.
+ * @return The wrapped key.
+ * @throws java.security.InvalidKeyException If the key cannot be
+ * wrapped.
+ */
+ protected byte[] engineWrap(Key key) throws InvalidKeyException, IllegalBlockSizeException
+ {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/javax/crypto/EncryptedPrivateKeyInfo.java b/javax/crypto/EncryptedPrivateKeyInfo.java
new file mode 100644
index 000000000..b64fbd6af
--- /dev/null
+++ b/javax/crypto/EncryptedPrivateKeyInfo.java
@@ -0,0 +1,284 @@
+/* EncryptedPrivateKeyInfo.java -- As in PKCS #8.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import gnu.java.security.OID;
+import gnu.java.security.der.DER;
+import gnu.java.security.der.DERReader;
+import gnu.java.security.der.DERValue;
+
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import java.security.AlgorithmParameters;
+import java.security.NoSuchAlgorithmException;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+
+/**
+ * An implementation of the <code>EncryptedPrivateKeyInfo</code> ASN.1
+ * type as specified in <a
+ * href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-8/">PKCS #8 -
+ * Private-Key Information Syntax Standard</a>.
+ *
+ * <p>The ASN.1 type <code>EncryptedPrivateKeyInfo</code> is:
+ *
+ * <blockquote>
+ * <pre>EncryptedPrivateKeyInfo ::= SEQUENCE {
+ * encryptionAlgorithm EncryptionAlgorithmIdentifier,
+ * encryptedData EncryptedData }
+ *
+ * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
+ *
+ * EncrytpedData ::= OCTET STRING
+ *
+ * AlgorithmIdentifier ::= SEQUENCE {
+ * algorithm OBJECT IDENTIFIER,
+ * parameters ANY DEFINED BY algorithm OPTIONAL }</pre>
+ * </blockquote>
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see java.security.spec.PKCS8EncodedKeySpec
+ */
+public class EncryptedPrivateKeyInfo
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ /** The encrypted data. */
+ private byte[] encryptedData;
+
+ /** The encoded, encrypted key. */
+ private byte[] encoded;
+
+ /** The OID of the encryption algorithm. */
+ private OID algOid;
+
+ /** The encryption algorithm's parameters. */
+ private AlgorithmParameters params;
+
+ /** The encoded ASN.1 algorithm parameters. */
+ private byte[] encodedParams;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new <code>EncryptedPrivateKeyInfo</code> object from raw
+ * encrypted data and the parameters used for encryption.
+ *
+ * <p>The <code>encryptedData</code> array is cloned.
+ *
+ * @param params The encryption algorithm parameters.
+ * @param encryptedData The encrypted key data.
+ * @throws java.lang.IllegalArgumentException If the
+ * <code>encryptedData</code> array is empty (zero-length).
+ * @throws java.security.NoSuchAlgorithmException If the algorithm
+ * specified in the parameters is not supported.
+ * @throws java.lang.NullPointerException If <code>encryptedData</code>
+ * is null.
+ */
+ public EncryptedPrivateKeyInfo(AlgorithmParameters params,
+ byte[] encryptedData)
+ throws IllegalArgumentException, NoSuchAlgorithmException
+ {
+ if (encryptedData.length == 0)
+ {
+ throw new IllegalArgumentException("0-length encryptedData");
+ }
+ this.params = params;
+ algOid = new OID(params.getAlgorithm());
+ this.encryptedData = (byte[]) encryptedData.clone();
+ }
+
+ /**
+ * Create a new <code>EncryptedPrivateKeyInfo</code> from an encoded
+ * representation, parsing the ASN.1 sequence.
+ *
+ * @param encoded The encoded info.
+ * @throws java.io.IOException If parsing the encoded data fails.
+ * @throws java.lang.NullPointerException If <code>encoded</code> is
+ * null.
+ */
+ public EncryptedPrivateKeyInfo(byte[] encoded)
+ throws IOException
+ {
+ this.encoded = (byte[]) encoded.clone();
+ decode();
+ }
+
+ /**
+ * Create a new <code>EncryptedPrivateKeyInfo</code> from the cipher
+ * name and the encrytpedData.
+ *
+ * <p>The <code>encryptedData</code> array is cloned.
+ *
+ * @param algName The name of the algorithm (as an object identifier).
+ * @param encryptedData The encrypted key data.
+ * @throws java.lang.IllegalArgumentException If the
+ * <code>encryptedData</code> array is empty (zero-length).
+ * @throws java.security.NoSuchAlgorithmException If algName is not
+ * the name of a supported algorithm.
+ * @throws java.lang.NullPointerException If <code>encryptedData</code>
+ * is null.
+ */
+ public EncryptedPrivateKeyInfo(String algName, byte[] encryptedData)
+ throws IllegalArgumentException, NoSuchAlgorithmException,
+ NullPointerException
+ {
+ if (encryptedData.length == 0)
+ {
+ throw new IllegalArgumentException("0-length encryptedData");
+ }
+ this.algOid = new OID(algName);
+ this.encryptedData = (byte[]) encryptedData.clone();
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the name of the cipher used to encrypt this key.
+ *
+ * @return The algorithm name.
+ */
+ public String getAlgName()
+ {
+ return algOid.toString();
+ }
+
+ public AlgorithmParameters getAlgParameters()
+ {
+ if (params == null && encodedParams != null)
+ {
+ try
+ {
+ params = AlgorithmParameters.getInstance(getAlgName());
+ params.init(encodedParams);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ catch (IOException ignore)
+ {
+ }
+ }
+ return params;
+ }
+
+ public synchronized byte[] getEncoded() throws IOException
+ {
+ if (encoded == null) encode();
+ return (byte[]) encoded.clone();
+ }
+
+ public byte[] getEncryptedData()
+ {
+ return encryptedData;
+ }
+
+ public PKCS8EncodedKeySpec getKeySpec(Cipher cipher)
+ throws InvalidKeySpecException
+ {
+ try
+ {
+ return new PKCS8EncodedKeySpec(cipher.doFinal(encryptedData));
+ }
+ catch (Exception x)
+ {
+ throw new InvalidKeySpecException(x.toString());
+ }
+ }
+
+ // Own methods.
+ // -------------------------------------------------------------------------
+
+ private void decode() throws IOException
+ {
+ DERReader der = new DERReader(encoded);
+ DERValue val = der.read();
+ if (val.getTag() != DER.SEQUENCE)
+ throw new IOException("malformed EncryptedPrivateKeyInfo");
+ val = der.read();
+ if (val.getTag() != DER.SEQUENCE)
+ throw new IOException("malformed AlgorithmIdentifier");
+ int algpLen = val.getLength();
+ DERValue oid = der.read();
+ if (oid.getTag() != DER.OBJECT_IDENTIFIER)
+ throw new IOException("malformed AlgorithmIdentifier");
+ algOid = (OID) oid.getValue();
+ if (algpLen == 0)
+ {
+ val = der.read();
+ if (val.getTag() != 0)
+ {
+ encodedParams = val.getEncoded();
+ der.read();
+ }
+ }
+ else if (oid.getEncodedLength() < val.getLength())
+ {
+ val = der.read();
+ encodedParams = val.getEncoded();
+ }
+ val = der.read();
+ if (val.getTag() != DER.OCTET_STRING)
+ throw new IOException("malformed AlgorithmIdentifier");
+ encryptedData = (byte[]) val.getValue();
+ }
+
+ private void encode() throws IOException
+ {
+ List algId = new ArrayList(2);
+ algId.add(new DERValue(DER.OBJECT_IDENTIFIER, algOid));
+ getAlgParameters();
+ if (params != null)
+ {
+ algId.add(DERReader.read(params.getEncoded()));
+ }
+ List epki = new ArrayList(2);
+ epki.add(new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, algId));
+ epki.add(new DERValue(DER.OCTET_STRING, encryptedData));
+ encoded = new DERValue(DER.CONSTRUCTED|DER.SEQUENCE, epki).getEncoded();
+ }
+}
diff --git a/javax/crypto/ExemptionMechanism.java b/javax/crypto/ExemptionMechanism.java
new file mode 100644
index 000000000..7fa658e9e
--- /dev/null
+++ b/javax/crypto/ExemptionMechanism.java
@@ -0,0 +1,226 @@
+/* ExemptionMechanism.java -- Generic crypto-weakening mechanism.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import gnu.java.security.Engine;
+
+/**
+ * An exemption mechanism, which will conditionally allow cryptography
+ * where it is not normally allowed, implements things such as <i>key
+ * recovery</i>, <i>key weakening</i>, or <i>key escrow</i>.
+ *
+ * <p><b>Implementation note</b>: this class is present for
+ * API-compatibility only; it is not actually used anywhere in this library
+ * and this library does not, in general, support crypto weakening.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class ExemptionMechanism
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------------
+
+ private static final String SERVICE = "ExemptionMechanism";
+ private ExemptionMechanismSpi emSpi;
+ private Provider provider;
+ private String mechanism;
+ private boolean virgin;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ protected ExemptionMechanism(ExemptionMechanismSpi emSpi, Provider provider,
+ String mechanism)
+ {
+ this.emSpi = emSpi;
+ this.provider = provider;
+ this.mechanism = mechanism;
+ virgin = true;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ public static final ExemptionMechanism getInstance(String mechanism)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ String msg = "";
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(mechanism, provs[i]);
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ msg = nsae.getMessage();
+ }
+ }
+ throw new NoSuchAlgorithmException(msg);
+ }
+
+ public static final ExemptionMechanism getInstance(String mechanism,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(mechanism, p);
+ }
+
+ public static final ExemptionMechanism getInstance(String mechanism,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new ExemptionMechanism((ExemptionMechanismSpi)
+ Engine.getInstance(SERVICE, mechanism, provider),
+ provider, mechanism);
+ }
+ catch (InvocationTargetException ite)
+ {
+ if (ite.getCause() instanceof NoSuchAlgorithmException)
+ throw (NoSuchAlgorithmException) ite.getCause();
+ else
+ throw new NoSuchAlgorithmException(mechanism);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(mechanism);
+ }
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ public final byte[] genExemptionBlob()
+ throws IllegalStateException, ExemptionMechanismException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return emSpi.engineGenExemptionBlob();
+ }
+
+ public final int genExemptionBlob(byte[] output)
+ throws IllegalStateException, ExemptionMechanismException,
+ ShortBufferException
+ {
+ return genExemptionBlob(output, 0);
+ }
+
+ public final int genExemptionBlob(byte[] output, int outputOffset)
+ throws IllegalStateException, ExemptionMechanismException,
+ ShortBufferException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return emSpi.engineGenExemptionBlob(output, outputOffset);
+ }
+
+ public final String getName()
+ {
+ return mechanism;
+ }
+
+ public final int getOutputSize(int inputLength) throws IllegalStateException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return emSpi.engineGetOutputSize(inputLength);
+ }
+
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ public final void init(Key key)
+ throws ExemptionMechanismException, InvalidKeyException
+ {
+ emSpi.engineInit(key);
+ virgin = false;
+ }
+
+ public final void init(Key key, AlgorithmParameters params)
+ throws ExemptionMechanismException, InvalidAlgorithmParameterException,
+ InvalidKeyException
+ {
+ emSpi.engineInit(key, params);
+ virgin = false;
+ }
+
+ public final void init(Key key, AlgorithmParameterSpec params)
+ throws ExemptionMechanismException, InvalidAlgorithmParameterException,
+ InvalidKeyException
+ {
+ emSpi.engineInit(key, params);
+ virgin = false;
+ }
+
+ public final boolean isCryptoAllowed(Key key)
+ throws ExemptionMechanismException
+ {
+ return true;
+ }
+}
diff --git a/javax/crypto/ExemptionMechanismException.java b/javax/crypto/ExemptionMechanismException.java
new file mode 100644
index 000000000..42e1c5e9b
--- /dev/null
+++ b/javax/crypto/ExemptionMechanismException.java
@@ -0,0 +1,81 @@
+/* ExemptionMechanismException -- An error in an exemption mechanism.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with GNU Classpath; if not, write to the
+
+ Free Software Foundation, Inc.,
+ 59 Temple Place, Suite 330,
+ Boston, MA 02111-1307
+ USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module. An
+independent module is a module which is not derived from or based on
+this library. If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your
+version. */
+
+
+package javax.crypto;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * Signals a general exception in an {@link ExemptionMechanism}.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class ExemptionMechanismException extends GeneralSecurityException
+{
+
+ // Constant.
+ // ------------------------------------------------------------------------
+
+ /** Compatible with JDK1.4. */
+ private static final long serialVersionUID = 1572699429277957109L;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new exception with no detail message.
+ */
+ public ExemptionMechanismException()
+ {
+ super();
+ }
+
+ /**
+ * Create a new exception with a detail message.
+ *
+ * @param message The detail message.
+ */
+ public ExemptionMechanismException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/crypto/ExemptionMechanismSpi.java b/javax/crypto/ExemptionMechanismSpi.java
new file mode 100644
index 000000000..78997ee07
--- /dev/null
+++ b/javax/crypto/ExemptionMechanismSpi.java
@@ -0,0 +1,149 @@
+/* ExemptionMechanismSpi.java -- Exemption mechanism service provider interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for the {@link
+ * ExemptionMechanism} class.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public abstract class ExemptionMechanismSpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new exemption mechanism SPI.
+ */
+ public ExemptionMechanismSpi()
+ {
+ }
+
+ // Abstract instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return a key blob for the key that this mechanism was initialized
+ * with.
+ *
+ * @return The key blob.
+ * @throws javax.crypto.ExemptionMechanismException If generating the
+ * blob fails.
+ */
+ protected abstract byte[] engineGenExemptionBlob()
+ throws ExemptionMechanismException;
+
+ /**
+ * Generate a key blob for the key that this mechanism was initialized
+ * with, storing it into the given byte array.
+ *
+ * @param output The destination for the key blob.
+ * @param outputOffset The index in the output array to start.
+ * @return The size of the key blob.
+ * @throws javax.crypto.ExemptionMechanismException If generating the
+ * blob fails.
+ * @throws javax.crypto.ShortBufferException If the output array is
+ * not large enough for the key blob.
+ */
+ protected abstract int engineGenExemptionBlob(byte[] output, int outputOffset)
+ throws ExemptionMechanismException, ShortBufferException;
+
+ /**
+ * Get the size of the output blob given an input key size. The actual
+ * blob may be shorter than the value returned by this method. Both
+ * values are in bytes.
+ *
+ * @param inputLength The input size.
+ * @return The output size.
+ */
+ protected abstract int engineGetOutputSize(int inputLength);
+
+ /**
+ * Initialize this mechanism with a key.
+ *
+ * @param key The key.
+ * @throws javax.crypto.ExemptionMechanismException If generating the
+ * blob fails.
+ * @throws java.security.InvalidKeyException If the supplied key
+ * cannot be used.
+ */
+ protected abstract void engineInit(Key key)
+ throws ExemptionMechanismException, InvalidKeyException;
+
+ /**
+ * Initialize this mechanism with a key and parameters.
+ *
+ * @param key The key.
+ * @param params The parameters.
+ * @throws javax.crypto.ExemptionMechanismException If generating the
+ * blob fails.
+ * @throws java.security.InvalidAlgorithmParameterExceptin If the
+ * supplied parameters are inappropriate.
+ * @throws java.security.InvalidKeyException If the supplied key
+ * cannot be used.
+ */
+ protected abstract void engineInit(Key key, AlgorithmParameters params)
+ throws ExemptionMechanismException, InvalidAlgorithmParameterException,
+ InvalidKeyException;
+
+ /**
+ * Initialize this mechanism with a key and parameters.
+ *
+ * @param key The key.
+ * @param params The parameters.
+ * @throws javax.crypto.ExemptionMechanismException If generating the
+ * blob fails.
+ * @throws java.security.InvalidAlgorithmParameterExceptin If the
+ * supplied parameters are inappropriate.
+ * @throws java.security.InvalidKeyException If the supplied key
+ * cannot be used.
+ */
+ protected abstract void engineInit(Key key, AlgorithmParameterSpec params)
+ throws ExemptionMechanismException, InvalidAlgorithmParameterException,
+ InvalidKeyException;
+}
diff --git a/native/jni/java-util/java_util_TimeZone.c b/javax/crypto/IllegalBlockSizeException.java
index 1c8cf5d2f..1e442833c 100644
--- a/native/jni/java-util/java_util_TimeZone.c
+++ b/javax/crypto/IllegalBlockSizeException.java
@@ -1,5 +1,5 @@
-/* TimeZone.c - Native methods for java.util.TimeZone
- Copyright (C) 1999 Free Software Foundation, Inc.
+/* IllegalBlockSizeException.java -- Signals illegal block sizes.
+ Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -35,44 +35,37 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-/* do not move; needed here because of some macro definitions */
-#include "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <jni.h>
+package javax.crypto;
-#include "target_native.h"
-#include "target_native_misc.h"
+import java.security.GeneralSecurityException;
-#include "java_util_TimeZone.h"
-
-/*
- * This method returns a time zone string that is used by the static
- * initializer in java.util.TimeZone to create the default timezone
- * instance. This is a key into the timezone table used by
- * that class.
+/**
+ * This exception is thrown when finishing encryption without padding or
+ * decryption and the input is not a multiple of the cipher's block
+ * size.
*
- * Class: java_util_TimeZone
- * Method: getDefaultTimeZoneId
- * Signature: ()Ljava/lang/String;
+ * @author Casey Marshall (csm@gnu.org)
*/
-JNIEXPORT jstring JNICALL
-Java_java_util_TimeZone_getDefaultTimeZoneId(JNIEnv *env, jclass clazz)
+public class IllegalBlockSizeException extends GeneralSecurityException
{
-#ifdef HAVE_TZNAME
- char buffer[128];
- int result;
- jstring retval;
- TARGET_NATIVE_MISC_GET_TIMEZONE_STRING(buffer,sizeof(buffer),result);
+ // Constant.
+ // ------------------------------------------------------------------------
- retval = (*env)->NewStringUTF(env, buffer);
-
- return(retval);
-#else
- return(0); /* added this statement (crashes without..:-) --Fridi. */
-#endif /* HAVE_TZNAME */
-}
+ /** Serialization constant. */
+ private static final long serialVersionUID = -1965144811953540392L;
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ public IllegalBlockSizeException()
+ {
+ super();
+ }
+
+ public IllegalBlockSizeException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/crypto/KeyAgreement.java b/javax/crypto/KeyAgreement.java
new file mode 100644
index 000000000..6f6ed34e0
--- /dev/null
+++ b/javax/crypto/KeyAgreement.java
@@ -0,0 +1,373 @@
+/* KeyAgreement.java -- Engine for key agreement methods.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import gnu.java.security.Engine;
+
+/**
+ * Key agreement is a method in which two or more parties may agree on a
+ * secret key for symmetric cryptography or message authentication
+ * without transmitting any secrets in the clear. Key agreement
+ * algorithms typically use a public/private <i>key pair</i>, and the
+ * public key (along with some additional information) is sent across
+ * untrusted networks.
+ *
+ * <p>The most common form of key agreement used today is the
+ * <i>Diffie-Hellman key exchange algorithm</i>, described in <a
+ * href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-3/">PKCS #3 -
+ * Diffie Hellman Key Agreement Standard</a>.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see KeyGenerator
+ * @see SecretKey
+ */
+public class KeyAgreement
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ private static final String SERVICE = "KeyAgreement";
+
+ /** The underlying key agreement implementation. */
+ private KeyAgreementSpi kaSpi;
+
+ /** The provider of this implementation. */
+ private Provider provider;
+
+ /** The name of this instance's algorithm. */
+ private String algorithm;
+
+ /** Singnals whether or not this instance has been initialized. */
+ private boolean virgin;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ protected KeyAgreement(KeyAgreementSpi kaSpi, Provider provider,
+ String algorithm)
+ {
+ this.kaSpi = kaSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ virgin = true;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get an implementation of an algorithm from the first provider that
+ * implements it.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @return The proper KeyAgreement instacne, if found.
+ * @throws java.security.NoSuchAlgorithmException If the specified
+ * algorithm is not implemented by any installed provider.
+ */
+ public static final KeyAgreement getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ String msg = algorithm;
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ msg = nsae.getMessage();
+ }
+ }
+ throw new NoSuchAlgorithmException(msg);
+ }
+
+ /**
+ * Get an implementation of an algorithm from a named provider.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @param provider The name of the provider from which to get the
+ * implementation.
+ * @return The proper KeyAgreement instance, if found.
+ * @throws java.security.NoSuchAlgorithmException If the named provider
+ * does not implement the algorithm.
+ * @throws java.security.NoSuchProviderException If the named provider
+ * does not exist.
+ */
+ public static final KeyAgreement getInstance(String algorithm,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Get an implementation of an algorithm from a specific provider.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @param provider The provider from which to get the implementation.
+ * @return The proper KeyAgreement instance, if found.
+ * @throws java.security.NoSuchAlgorithmException If this provider
+ * does not implement the algorithm.
+ */
+ public static final KeyAgreement getInstance(String algorithm,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new KeyAgreement((KeyAgreementSpi)
+ Engine.getInstance(SERVICE, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ if (ite.getCause() == null)
+ throw new NoSuchAlgorithmException(algorithm);
+ if (ite.getCause() instanceof NoSuchAlgorithmException)
+ throw (NoSuchAlgorithmException) ite.getCause();
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Do a phase in the key agreement. The number of times this method is
+ * called depends upon the algorithm and the number of parties
+ * involved, but must be called at least once with the
+ * <code>lastPhase</code> flag set to <code>true</code>.
+ *
+ * @param key The key for this phase.
+ * @param lastPhase Should be <code>true</code> if this will be the
+ * last phase before generating the shared secret.
+ * @return The intermediate result, or <code>null</code> if there is
+ * no intermediate result.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized.
+ * @throws java.security.InvalidKeyException If the key is
+ * inappropriate for this algorithm.
+ */
+ public final Key doPhase(Key key, boolean lastPhase)
+ throws IllegalStateException, InvalidKeyException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return kaSpi.engineDoPhase(key, lastPhase);
+ }
+
+ /**
+ * Generate the shared secret in a new byte array.
+ *
+ * @return The shared secret.
+ * @throws java.lang.IllegalStateException If this instnace has not
+ * been initialized, or if not enough calls to
+ * <code>doPhase</code> have been made.
+ */
+ public final byte[] generateSecret() throws IllegalStateException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return kaSpi.engineGenerateSecret();
+ }
+
+ /**
+ * Generate the shared secret and store it into the supplied array.
+ *
+ * @param sharedSecret The array in which to store the secret.
+ * @param offset The index in <code>sharedSecret</code> to start
+ * storing data.
+ * @return The length of the shared secret, in bytes.
+ * @throws java.lang.IllegalStateException If this instnace has not
+ * been initialized, or if not enough calls to
+ * <code>doPhase</code> have been made.
+ * @throws javax.crypto.ShortBufferException If the supplied array is
+ * not large enough to store the result.
+ */
+ public final int generateSecret(byte[] sharedSecret, int offset)
+ throws IllegalStateException, ShortBufferException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return kaSpi.engineGenerateSecret(sharedSecret, offset);
+ }
+
+ /**
+ * Generate the shared secret and return it as an appropriate {@link
+ * SecretKey}.
+ *
+ * @param algorithm The secret key's algorithm.
+ * @return The shared secret as a secret key.
+ * @throws java.lang.IllegalStateException If this instnace has not
+ * been initialized, or if not enough calls to
+ * <code>doPhase</code> have been made.
+ * @throws java.security.InvalidKeyException If the shared secret
+ * cannot be used to make a {@link SecretKey}.
+ * @throws java.security.NoSuchAlgorithmException If the specified
+ * algorithm does not exist.
+ */
+ public final SecretKey generateSecret(String algorithm)
+ throws IllegalStateException, InvalidKeyException, NoSuchAlgorithmException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ return kaSpi.engineGenerateSecret(algorithm);
+ }
+
+ /**
+ * Return the name of this key-agreement algorithm.
+ *
+ * @return The algorithm name.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Return the provider of the underlying implementation.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Initialize this key agreement with a key. This method will use the
+ * highest-priority {@link java.security.SecureRandom} as its source
+ * of randomness.
+ *
+ * @param key The key, usually the user's private key.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * not appropriate.
+ */
+ public final void init(Key key) throws InvalidKeyException
+ {
+ init(key, new SecureRandom());
+ }
+
+ /**
+ * Initialize this key agreement with a key and a source of
+ * randomness.
+ *
+ * @param key The key, usually the user's private key.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * not appropriate.
+ */
+ public final void init(Key key, SecureRandom random)
+ throws InvalidKeyException
+ {
+ kaSpi.engineInit(key, random);
+ virgin = false; // w00t!
+ }
+
+ /**
+ * Initialize this key agreement with a key and parameters. This
+ * method will use the highest-priority {@link
+ * java.security.SecureRandom} as its source of randomness.
+ *
+ * @param key The key, usually the user's private key.
+ * @param params The algorithm parameters.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are not appropriate.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * not appropriate.
+ */
+ public final void init(Key key, AlgorithmParameterSpec params)
+ throws InvalidAlgorithmParameterException, InvalidKeyException
+ {
+ init(key, params, new SecureRandom());
+ }
+
+ /**
+ * Initialize this key agreement with a key, parameters, and source of
+ * randomness.
+ *
+ * @param key The key, usually the user's private key.
+ * @param params The algorithm parameters.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are not appropriate.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * not appropriate.
+ */
+ public final void init(Key key, AlgorithmParameterSpec params,
+ SecureRandom random)
+ throws InvalidAlgorithmParameterException, InvalidKeyException
+ {
+ kaSpi.engineInit(key, params, random);
+ virgin = false; // w00t!
+ }
+}
diff --git a/javax/crypto/KeyAgreementSpi.java b/javax/crypto/KeyAgreementSpi.java
new file mode 100644
index 000000000..231f11279
--- /dev/null
+++ b/javax/crypto/KeyAgreementSpi.java
@@ -0,0 +1,160 @@
+/* KeyAgreementSpi.java -- The key agreement service provider interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * This is the <i>Service Provider Interface</i> (<b>SPI</b>) for the
+ * {@link javax.crypto.KeyAgreement} class.
+ *
+ * <p>Providers wishing to implement a key agreement algorithm must
+ * subclass this and provide an appropriate implementation for all the
+ * abstract methods below, and provide an appropriate entry in the
+ * master {@link java.security.Provider} class (the service name for key
+ * agreement algorithms is <code>"KeyAgreement"</code>).
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see KeyAgreement
+ * @see SecretKey
+ */
+public abstract class KeyAgreementSpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new KeyAgreementSpi instance.
+ */
+ public KeyAgreementSpi()
+ {
+ }
+
+ // Abstract instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Do a phase in the key agreement.
+ *
+ * @param key The key to use for this phase.
+ * @param lastPhase <code>true</code> if this call should be the last
+ * phase.
+ * @return The intermediate result, or <code>null</code> if there is
+ * no intermediate result.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * not appropriate.
+ */
+ protected abstract Key engineDoPhase(Key key, boolean lastPhase)
+ throws IllegalStateException, InvalidKeyException;
+
+ /**
+ * Generate the shared secret in a new byte array.
+ *
+ * @return The shared secret in a new byte array.
+ * @throws java.lang.IllegalStateException If this key agreement is
+ * not ready to generate the secret.
+ */
+ protected abstract byte[] engineGenerateSecret()
+ throws IllegalStateException;
+
+ /**
+ * Generate the shared secret, storing it into the specified array.
+ *
+ * @param sharedSecret The byte array in which to store the secret.
+ * @param offset The offset into the byte array to start.
+ * @return The size of the shared secret.
+ * @throws java.lang.IllegalStateException If this key agreement is
+ * not ready to generate the secret.
+ * @throws javax.crypto.ShortBufferException If there is not enough
+ * space in the supplied array for the shared secret.
+ */
+ protected abstract int engineGenerateSecret(byte[] sharedSecret, int offset)
+ throws IllegalStateException, ShortBufferException;
+
+ /**
+ * Generate the shared secret and return it as a {@link SecretKey}.
+ *
+ * @param algorithm The algorithm with which to generate the secret key.
+ * @return The shared secret as a secret key.
+ * @throws java.lang.IllegalStateException If this key agreement is
+ * not ready to generate the secret.
+ * @throws java.security.InvalidKeyException If the shared secret
+ * cannot be made into a {@link SecretKey}.
+ * @throws java.security.NoSuchAlgorithmException If
+ * <code>algorithm</code> cannot be found.
+ */
+ protected abstract SecretKey engineGenerateSecret(String algorithm)
+ throws IllegalStateException, InvalidKeyException, NoSuchAlgorithmException;
+
+ /**
+ * Initialize this key agreement with a key, parameters, and source of
+ * randomness.
+ *
+ * @param key The key to initialize with, usually a private key.
+ * @param params The parameters to initialize with.
+ * @param random The source of randomness to use.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inappropriate.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * inappropriate.
+ */
+ protected abstract void engineInit(Key key, AlgorithmParameterSpec params,
+ SecureRandom random)
+ throws InvalidAlgorithmParameterException, InvalidKeyException;
+
+ /**
+ * Initialize this key agreement with a key and source of randomness.
+ *
+ * @param key The key to initialize with, usually a private key.
+ * @param random The source of randomness to use.
+ * @throws java.security.InvalidKeyException If the supplied key is
+ * inappropriate.
+ */
+ protected abstract void engineInit(Key key, SecureRandom random)
+ throws InvalidKeyException;
+}
diff --git a/javax/crypto/KeyGenerator.java b/javax/crypto/KeyGenerator.java
new file mode 100644
index 000000000..35753b036
--- /dev/null
+++ b/javax/crypto/KeyGenerator.java
@@ -0,0 +1,284 @@
+/* KeyGenerator.java -- Interface to a symmetric key generator.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import gnu.java.security.Engine;
+
+/**
+ * A generic producer of keys for symmetric cryptography. The keys
+ * returned may be simple wrappers around byte arrays, or, if the
+ * target cipher requires them, more complex objects.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see Cipher
+ * @see Mac
+ */
+public class KeyGenerator
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------------
+
+ private static final String SERVICE = "KeyGenerator";
+
+ /** The underlying generator implementation. */
+ private KeyGeneratorSpi kgSpi;
+
+ /** The provider of the implementation. */
+ private Provider provider;
+
+ /** The name of the algorithm. */
+ private String algorithm;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new key generator.
+ *
+ * @param kgSpi The underlying generator.
+ * @param provider The provider of this implementation.
+ * @param algorithm The algorithm's name.
+ */
+ protected KeyGenerator(KeyGeneratorSpi kgSpi, Provider provider,
+ String algorithm)
+ {
+ this.kgSpi = kgSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new key generator, returning the first available
+ * implementation.
+ *
+ * @param algorithm The generator algorithm name.
+ * @throws java.security.NoSuchAlgorithmException If the specified
+ * algorithm does not exist.
+ */
+ public static final KeyGenerator getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ String msg = algorithm;
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ msg = nsae.getMessage();
+ }
+ }
+ throw new NoSuchAlgorithmException(msg);
+ }
+
+ /**
+ * Create a new key generator from the named provider.
+ *
+ * @param algorithm The generator algorithm name.
+ * @param provider The name of the provider to use.
+ * @return An appropriate key generator, if found.
+ * @throws java.security.NoSuchAlgorithmException If the specified
+ * algorithm is not implemented by the named provider.
+ * @throws java.security.NoSuchProviderException If the named provider
+ * does not exist.
+ */
+ public static final KeyGenerator getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Create a new key generator from the supplied provider.
+ *
+ * @param algorithm The generator algorithm name.
+ * @param provider The provider to use.
+ * @return An appropriate key generator, if found.
+ * @throws java.security.NoSuchAlgorithmException If the specified
+ * algorithm is not implemented by the provider.
+ */
+ public static final KeyGenerator getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new KeyGenerator((KeyGeneratorSpi)
+ Engine.getInstance(SERVICE, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ if (ite.getCause() == null)
+ throw new NoSuchAlgorithmException(algorithm);
+ if (ite.getCause() instanceof NoSuchAlgorithmException)
+ throw (NoSuchAlgorithmException) ite.getCause();
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Generate a key.
+ *
+ * @return The new key.
+ */
+ public final SecretKey generateKey()
+ {
+ return kgSpi.engineGenerateKey();
+ }
+
+ /**
+ * Return the name of this key generator.
+ *
+ * @return The algorithm name.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Return the provider of the underlying implementation.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Initialize this key generator with a set of parameters; the
+ * highest-priority {@link java.security.SecureRandom} implementation
+ * will be used.
+ *
+ * @param params The algorithm parameters.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inapproprate.
+ */
+ public final void init(AlgorithmParameterSpec params)
+ throws InvalidAlgorithmParameterException
+ {
+ init(params, new SecureRandom());
+ }
+
+ /**
+ * Initialize this key generator with a set of parameters and a source
+ * of randomness.
+ *
+ * @param params The algorithm parameters.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * supplied parameters are inapproprate.
+ */
+ public final void init(AlgorithmParameterSpec params, SecureRandom random)
+ throws InvalidAlgorithmParameterException
+ {
+ kgSpi.engineInit(params, random);
+ }
+
+ /**
+ * Initialize this key generator with a key size (in bits); the
+ * highest-priority {@link java.security.SecureRandom} implementation
+ * will be used.
+ *
+ * @param keySize The target key size, in bits.
+ * @throws java.security.InvalidParameterException If the
+ * key size is unsupported.
+ */
+ public final void init(int keySize)
+ {
+ init(keySize, new SecureRandom());
+ }
+
+ /**
+ * Initialize this key generator with a key size (in bits) and a
+ * source of randomness.
+ *
+ * @param keySize The target key size, in bits.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * key size is unsupported.
+ */
+ public final void init(int keySize, SecureRandom random)
+ {
+ kgSpi.engineInit(keySize, random);
+ }
+
+ /**
+ * Initialize this key generator with a source of randomness. The
+ * implementation-specific default parameters (such as key size) will
+ * be used.
+ *
+ * @param random The source of randomness.
+ */
+ public final void init(SecureRandom random)
+ {
+ kgSpi.engineInit(random);
+ }
+}
diff --git a/javax/crypto/KeyGeneratorSpi.java b/javax/crypto/KeyGeneratorSpi.java
new file mode 100644
index 000000000..fcf229b95
--- /dev/null
+++ b/javax/crypto/KeyGeneratorSpi.java
@@ -0,0 +1,112 @@
+/* KeyGeneratorSpi.java -- The key generator service provider interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for the {@link
+ * KeyGenerator} class.
+ *
+ * <p>Providers wishing to implement a key generator must subclass this
+ * and provide an appropriate implementation for all the abstract
+ * methods below, and provide an appropriate entry in the master {@link
+ * java.security.Provider} class (the service name for key generators is
+ * <code>"KeyGenerator"</code>).
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see KeyGenerator
+ */
+public abstract class KeyGeneratorSpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /** Create a new key generator SPI. */
+ public KeyGeneratorSpi()
+ {
+ }
+
+ // Abstract instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Generate a key, returning it as a {@link SecretKey}.
+ *
+ * @return The generated key.
+ */
+ protected abstract SecretKey engineGenerateKey();
+
+ /**
+ * Initialize this key generator with parameters and a source of
+ * randomness.
+ *
+ * @param params The parameters.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * parameters are inappropriate for this instance.
+ */
+ protected abstract void engineInit(AlgorithmParameterSpec params,
+ SecureRandom random)
+ throws InvalidAlgorithmParameterException;
+
+ /**
+ * Initialize this key generator with a key size (in bits) and a
+ * source of randomness.
+ *
+ * @param keySize The target key size, in bits.
+ * @param random The source of randomness.
+ * @throws java.security.InvalidParameterException If the
+ * key size is illogical or unsupported.
+ */
+ protected abstract void engineInit(int keySize, SecureRandom random);
+
+ /**
+ * Initialize this key generator with a source of randomness; the
+ * implementation should use reasonable default parameters (such as
+ * generated key size).
+ *
+ * @param random The source of randomness.
+ */
+ protected abstract void engineInit(SecureRandom random);
+}
diff --git a/javax/crypto/Mac.java b/javax/crypto/Mac.java
new file mode 100644
index 000000000..55f5be61b
--- /dev/null
+++ b/javax/crypto/Mac.java
@@ -0,0 +1,414 @@
+/* Mac.java -- The message authentication code interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.spec.AlgorithmParameterSpec;
+
+import gnu.java.security.Engine;
+
+/**
+ * This class implements a "message authentication code" (MAC), a method
+ * to ensure the integrity of data transmitted between two parties who
+ * share a common secret key.
+ *
+ * <p>The best way to describe a MAC is as a <i>keyed one-way hash
+ * function</i>, which looks like:
+ *
+ * <blockquote><p><code>D = MAC(K, M)</code></blockquote>
+ *
+ * <p>where <code>K</code> is the key, <code>M</code> is the message,
+ * and <code>D</code> is the resulting digest. One party will usually
+ * send the concatenation <code>M || D</code> to the other party, who
+ * will then verify <code>D</code> by computing <code>D'</code> in a
+ * similar fashion. If <code>D == D'</code>, then the message is assumed
+ * to be authentic.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class Mac implements Cloneable
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ private static final String SERVICE = "Mac";
+
+ /** The underlying MAC implementation. */
+ private MacSpi macSpi;
+
+ /** The provider we got our implementation from. */
+ private Provider provider;
+
+ /** The name of the algorithm. */
+ private String algorithm;
+
+ /** Whether or not we've been initialized. */
+ private boolean virgin;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates a new Mac instance.
+ *
+ * @param macSpi The underlying MAC implementation.
+ * @param provider The provider of this implementation.
+ * @param algorithm The name of this MAC algorithm.
+ */
+ protected Mac(MacSpi macSpi, Provider provider, String algorithm)
+ {
+ this.macSpi = macSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ virgin = true;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get an instance of the named algorithm from the first provider with
+ * an appropriate implementation.
+ *
+ * @param algorithm The name of the algorithm.
+ * @return An appropriate Mac instance, if the specified algorithm
+ * is implemented by a provider.
+ * @throws java.security.NoSuchAlgorithmException If no implementation
+ * of the named algorithm is installed.
+ */
+ public static final Mac getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ String msg = "";
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ msg = nsae.getMessage();
+ }
+ }
+ throw new NoSuchAlgorithmException(msg);
+ }
+
+ /**
+ * Get an instance of the named algorithm from the named provider.
+ *
+ * @param algorithm The name of the algorithm.
+ * @param provider The name of the provider.
+ * @return An appropriate Mac instance, if the specified algorithm is
+ * implemented by the named provider.
+ * @throws java.security.NoSuchAlgorithmException If the named provider
+ * has no implementation of the algorithm.
+ * @throws java.security.NoSuchProviderException If the named provider
+ * does not exist.
+ */
+ public static final Mac getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Get an instance of the named algorithm from a provider.
+ *
+ * @param algorithm The name of the algorithm.
+ * @param provider The provider.
+ * @return An appropriate Mac instance, if the specified algorithm is
+ * implemented by the provider.
+ * @throws java.security.NoSuchAlgorithmException If the provider
+ * has no implementation of the algorithm.
+ */
+ public static final Mac getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new Mac((MacSpi) Engine.getInstance(SERVICE, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ if (ite.getCause() == null)
+ throw new NoSuchAlgorithmException(algorithm);
+ if (ite.getCause() instanceof NoSuchAlgorithmException)
+ throw (NoSuchAlgorithmException) ite.getCause();
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Finishes the computation of a MAC and returns the digest.
+ *
+ * <p>After this method succeeds, it may be used again as just after a
+ * call to <code>init</code>, and can compute another MAC using the
+ * same key and parameters.
+ *
+ * @return The message authentication code.
+ * @throws java.lang.IllegalStateException If this instnace has not
+ * been initialized.
+ */
+ public final byte[] doFinal() throws IllegalStateException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ byte[] digest = macSpi.engineDoFinal();
+ reset();
+ return digest;
+ }
+
+ /**
+ * Finishes the computation of a MAC with a final byte array (or
+ * computes a MAC over those bytes only) and returns the digest.
+ *
+ * <p>After this method succeeds, it may be used again as just after a
+ * call to <code>init</code>, and can compute another MAC using the
+ * same key and parameters.
+ *
+ * @param input The bytes to add.
+ * @return The message authentication code.
+ * @throws java.lang.IllegalStateException If this instnace has not
+ * been initialized.
+ */
+ public final byte[] doFinal(byte[] input) throws IllegalStateException
+ {
+ update(input);
+ byte[] digest = macSpi.engineDoFinal();
+ reset();
+ return digest;
+ }
+
+ /**
+ * Finishes the computation of a MAC and places the result into the
+ * given array.
+ *
+ * <p>After this method succeeds, it may be used again as just after a
+ * call to <code>init</code>, and can compute another MAC using the
+ * same key and parameters.
+ *
+ * @param output The destination for the result.
+ * @param outOffset The index in the output array to start.
+ * @return The message authentication code.
+ * @throws java.lang.IllegalStateException If this instnace has not
+ * been initialized.
+ * @throws javax.crypto.ShortBufferException If <code>output</code> is
+ * not large enough to hold the result.
+ */
+ public final void doFinal(byte[] output, int outOffset)
+ throws IllegalStateException, ShortBufferException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ if (output.length - outOffset < getMacLength())
+ {
+ throw new ShortBufferException();
+ }
+ byte[] mac = macSpi.engineDoFinal();
+ System.arraycopy(mac, 0, output, outOffset, getMacLength());
+ reset();
+ }
+
+ /**
+ * Returns the name of this MAC algorithm.
+ *
+ * @return The MAC name.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Get the size of the MAC. This is the size of the array returned by
+ * {@link #doFinal()} and {@link #doFinal(byte[])}, and the minimum
+ * number of bytes that must be available in the byte array passed to
+ * {@link #doFinal(byte[],int)}.
+ *
+ * @return The MAC length.
+ */
+ public int getMacLength()
+ {
+ return macSpi.engineGetMacLength();
+ }
+
+ /**
+ * Get the provider of the underlying implementation.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Initialize this MAC with a key and no parameters.
+ *
+ * @param key The key to initialize this instance with.
+ * @throws java.security.InvalidKeyException If the key is
+ * unacceptable.
+ */
+ public final void init(Key key) throws InvalidKeyException
+ {
+ try
+ {
+ init(key, null);
+ }
+ catch (InvalidAlgorithmParameterException iape)
+ {
+ throw new IllegalArgumentException(algorithm + " needs parameters");
+ }
+ }
+
+ /**
+ * Initialize this MAC with a key and parameters.
+ *
+ * @param key The key to initialize this instance with.
+ * @param params The algorithm-specific parameters.
+ * @throws java.security.InvalidAlgorithmParameterException If the
+ * algorithm parameters are unacceptable.
+ * @throws java.security.InvalidKeyException If the key is
+ * unacceptable.
+ */
+ public final void init(Key key, AlgorithmParameterSpec params)
+ throws InvalidAlgorithmParameterException, InvalidKeyException
+ {
+ macSpi.engineInit(key, params);
+ virgin = false; // w00t!
+ }
+
+ /**
+ * Reset this instance. A call to this method returns this instance
+ * back to the state it was in just after it was initialized.
+ */
+ public final void reset()
+ {
+ macSpi.engineReset();
+ }
+
+ /**
+ * Update the computation with a single byte.
+ *
+ * @param input The next byte.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized.
+ */
+ public final void update(byte input) throws IllegalStateException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ macSpi.engineUpdate(input);
+ }
+
+ /**
+ * Update the computation with a byte array.
+ *
+ * @param input The next bytes.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized.
+ */
+ public final void update(byte[] input) throws IllegalStateException
+ {
+ update(input, 0, input.length);
+ }
+
+ /**
+ * Update the computation with a portion of a byte array.
+ *
+ * @param input The next bytes.
+ * @param offset The index in <code>input</code> to start.
+ * @param length The number of bytes to update.
+ * @throws java.lang.IllegalStateException If this instance has not
+ * been initialized.
+ */
+ public final void update(byte[] input, int offset, int length)
+ throws IllegalStateException
+ {
+ if (virgin)
+ {
+ throw new IllegalStateException("not initialized");
+ }
+ macSpi.engineUpdate(input, offset, length);
+ }
+
+ /**
+ * Clone this instance, if the underlying implementation supports it.
+ *
+ * @return A clone of this instance.
+ * @throws java.lang.CloneNotSupportedException If the underlying
+ * implementation is not cloneable.
+ */
+ public Object clone() throws CloneNotSupportedException
+ {
+ Mac result = new Mac((MacSpi) macSpi.clone(), provider, algorithm);
+ result.virgin = virgin;
+ return result;
+ }
+}
diff --git a/javax/crypto/MacSpi.java b/javax/crypto/MacSpi.java
new file mode 100644
index 000000000..d96182a91
--- /dev/null
+++ b/javax/crypto/MacSpi.java
@@ -0,0 +1,145 @@
+/* MacSpi.java -- The MAC service provider interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * This is the <i>Service Provider Interface</i> (<b>SPI</b>) for the
+ * {@link Mac} class.
+ *
+ * <p>Providers wishing to implement a Mac must subclass this class and
+ * provide appropriate implementations of all its abstract methods,
+ * then provide an entry pointing to this implementation in the master
+ * {@link java.security.Provider} class.
+ *
+ * <p>Implementations may optionally implement the {@link
+ * java.lang.Cloneable} interface.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public abstract class MacSpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new MacSpi instance.
+ */
+ public MacSpi()
+ {
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns a clone of this instance if cloning is supported.
+ *
+ * @return A clone of this instance.
+ * @throws java.lang.CloneNotSupportedException If this instance does
+ * not support cloneing.
+ */
+ public Object clone() throws CloneNotSupportedException
+ {
+ return super.clone();
+ }
+
+ // Abstract instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Finalize the computation of this MAC and return the result as a
+ * byte array.
+ *
+ * @return The MAC.
+ */
+ protected abstract byte[] engineDoFinal();
+
+ /**
+ * Return the total length, in bytes, of the computed MAC (the length
+ * of the byte array returned by {@link #doFinal()}.
+ *
+ * @return The MAC length.
+ */
+ protected abstract int engineGetMacLength();
+
+ /**
+ * Initialize (or re-initialize) this instance.
+ *
+ * @param key The key to use.
+ * @param params The parameters to use.
+ * @throws java.security.InvalidAlgorithmParameterException If this
+ * instance rejects the specified parameters.
+ * @throws java.security.InvalidKeyException If this instance rejects
+ * the specified key.
+ */
+ protected abstract void engineInit(Key key, AlgorithmParameterSpec params)
+ throws InvalidAlgorithmParameterException, InvalidKeyException;
+
+ /**
+ * Reset this instance. After this method succeeds, the state of this
+ * instance should be the same as it was before any data was input
+ * (possibly after a call to {@link
+ * #init(java.security.Key,java.security.spec.AlgorithmParameterSpec)},
+ * possibly not).
+ */
+ protected abstract void engineReset();
+
+ /**
+ * Update this MAC with a single byte.
+ *
+ * @param input The next byte.
+ */
+ protected abstract void engineUpdate(byte input);
+
+ /**
+ * Update this MAC with a portion of a byte array.
+ *
+ * @param input The next bytes.
+ * @param offset The index in <code>input</code> at which to start.
+ * @param length The number of bytes to update.
+ */
+ protected abstract void engineUpdate(byte[] input, int offset, int length);
+}
diff --git a/javax/crypto/NoSuchPaddingException.java b/javax/crypto/NoSuchPaddingException.java
new file mode 100644
index 000000000..3acd7ae68
--- /dev/null
+++ b/javax/crypto/NoSuchPaddingException.java
@@ -0,0 +1,71 @@
+/* NoSuchPaddingException.java -- Signals an unknown padding scheme.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * This exception is thrown when a particular padding scheme is
+ * requested but is not available.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class NoSuchPaddingException extends GeneralSecurityException
+{
+
+ // Constant.
+ // ------------------------------------------------------------------------
+
+ /** Serialization constant. */
+ private static final long serialVersionUID = -4572885201200175466L;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ public NoSuchPaddingException()
+ {
+ super();
+ }
+
+ public NoSuchPaddingException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/crypto/NullCipher.java b/javax/crypto/NullCipher.java
new file mode 100644
index 000000000..95f3a8e8f
--- /dev/null
+++ b/javax/crypto/NullCipher.java
@@ -0,0 +1,62 @@
+/* NullCipher.java -- The identity cipher.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+/**
+ * Trivial subclass of Cipher that implements the <i>identity
+ * transformation</i>, where the input is always copied to the output
+ * unchanged. Null ciphers can be instantiated with the public
+ * constructor.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class NullCipher extends Cipher
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new identity cipher.
+ */
+ public NullCipher()
+ {
+ super(new NullCipherImpl(), null, "NULL");
+ }
+}
diff --git a/javax/crypto/NullCipherImpl.java b/javax/crypto/NullCipherImpl.java
new file mode 100644
index 000000000..b203d24bf
--- /dev/null
+++ b/javax/crypto/NullCipherImpl.java
@@ -0,0 +1,127 @@
+/* NullCipherImpl.java -- implementation of NullCipher.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.AlgorithmParameters;
+import java.security.Key;
+import java.security.SecureRandom;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * Implementation of the identity cipher.
+ */
+final class NullCipherImpl extends CipherSpi
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ NullCipherImpl()
+ {
+ super();
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ protected void engineSetMode(String mode) { }
+ protected void engineSetPadding(String padding) { }
+
+ protected int engineGetBlockSize()
+ {
+ return 1;
+ }
+
+ protected int engineGetOutputSize(int inputLen)
+ {
+ return inputLen;
+ }
+
+ protected byte[] engineGetIV()
+ {
+ return null;
+ }
+
+ protected AlgorithmParameters engineGetParameters()
+ {
+ return null;
+ }
+
+ protected void engineInit(int mode, Key key, SecureRandom random) { }
+ protected void engineInit(int mode, Key key, AlgorithmParameterSpec spec, SecureRandom random) { }
+ protected void engineInit(int mode, Key key, AlgorithmParameters params, SecureRandom random) { }
+
+ protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen)
+ {
+ if (input == null)
+ return new byte[0];
+ if (inputOffset < 0 || inputLen < 0 || inputOffset + inputLen > input.length)
+ throw new ArrayIndexOutOfBoundsException();
+ byte[] output = new byte[inputLen];
+ System.arraycopy(input, inputOffset, output, 0, inputLen);
+ return output;
+ }
+
+ protected int engineUpdate(byte[] input, int inputOffset, int inputLen,
+ byte[] output, int outputOffset)
+ throws ShortBufferException
+ {
+ if (input == null)
+ return 0;
+ if (inputOffset < 0 || inputLen < 0 || inputOffset + inputLen > input.length
+ || outputOffset < 0)
+ throw new ArrayIndexOutOfBoundsException();
+ if (output.length - outputOffset < inputLen)
+ throw new ShortBufferException();
+ System.arraycopy(input, inputOffset, output, outputOffset, inputLen);
+ return inputLen;
+ }
+
+ protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen)
+ {
+ return engineUpdate(input, inputOffset, inputLen);
+ }
+
+ protected int engineDoFinal(byte[] input, int inputOffset, int inputLen,
+ byte[] output, int outputOffset)
+ throws ShortBufferException
+ {
+ return engineUpdate(input, inputOffset, inputLen, output, outputOffset);
+ }
+}
diff --git a/javax/crypto/SealedObject.java b/javax/crypto/SealedObject.java
new file mode 100644
index 000000000..9bbbe29be
--- /dev/null
+++ b/javax/crypto/SealedObject.java
@@ -0,0 +1,355 @@
+/* SealedObject.java -- An encrypted Serializable object.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import java.security.AlgorithmParameters;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.Key;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+
+/**
+ * This class allows any {@link java.io.Serializable} object to be
+ * stored in an encrypted form.
+ *
+ * <p>When the sealed object is ready to be unsealed (and deserialized)
+ * the caller may use either
+ *
+ * <ol>
+ * <li>{@link #getObject(javax.crypto.Cipher)}, which uses an
+ * already-initialized {@link javax.crypto.Cipher}.<br>
+ * <br>
+ * or,</li>
+ *
+ * <li>{@link #getObject(java.security.Key)} or {@link
+ * #getObject(java.security.Key,java.lang.String)}, which will
+ * initialize a new cipher instance with the {@link #encodedParams} that
+ * were stored with this sealed object (this is so parameters, such as
+ * the IV, don't need to be known by the one unsealing the object).</li>
+ * </ol>
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class SealedObject implements Serializable
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------------
+
+ /** The encoded algorithm parameters. */
+ protected byte[] encodedParams;
+
+ /** The serialized, encrypted object. */
+ private byte[] encryptedContent;
+
+ /** The algorithm used to seal the object. */
+ private String sealAlg;
+
+ /** The parameter type. */
+ private String paramsAlg;
+
+ /** The cipher that decrypts when this object is unsealed. */
+ private transient Cipher sealCipher;
+
+ /** Compatible with JDK1.4. */
+ private static final long serialVersionUID = 4482838265551344752L;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new sealed object from a {@link java.io.Serializable}
+ * object and a cipher.
+ *
+ * @param object The object to seal.
+ * @param cipher The cipher to encrypt with.
+ * @throws java.io.IOException If serializing the object fails.
+ * @throws javax.crypto.IllegalBlockSizeException If the cipher has no
+ * padding and the size of the serialized representation of the
+ * object is not a multiple of the cipher's block size.
+ */
+ public SealedObject(Serializable object, Cipher cipher)
+ throws IOException, IllegalBlockSizeException
+ {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(object);
+ oos.flush();
+ try
+ {
+ encryptedContent = cipher.doFinal(baos.toByteArray());
+ }
+ catch (IllegalStateException ise)
+ {
+ throw new IOException("cipher not in proper state");
+ }
+ catch (BadPaddingException bpe)
+ {
+ throw new IOException(
+ "encrypting but got javax.crypto.BadPaddingException");
+ }
+ sealAlg = cipher.getAlgorithm();
+ encodedParams = cipher.getParameters().getEncoded();
+ paramsAlg = cipher.getParameters().getAlgorithm();
+ }
+
+ /**
+ * Create a new sealed object from another sealed object.
+ *
+ * @param so The other sealed object.
+ */
+ protected SealedObject(SealedObject so)
+ {
+ this.encodedParams = (byte[]) so.encodedParams.clone();
+ this.encryptedContent = (byte[]) so.encryptedContent.clone();
+ this.sealAlg = so.sealAlg;
+ this.paramsAlg = so.paramsAlg;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the name of the algorithm used to seal this object.
+ *
+ * @return The algorithm's name.
+ */
+ public final String getAlgorithm()
+ {
+ return sealAlg;
+ }
+
+ /**
+ * Unseal and deserialize this sealed object with a specified (already
+ * initialized) cipher.
+ *
+ * @param cipher The cipher to decrypt with.
+ * @return The original object.
+ * @throws java.io.IOException If reading fails.
+ * @throws java.lang.ClassNotFoundException If deserialization fails.
+ * @throws javax.crypto.IllegalBlockSizeException If the cipher has no
+ * padding and the encrypted data is not a multiple of the
+ * cipher's block size.
+ * @throws javax.crypto.BadPaddingException If the padding bytes are
+ * incorrect.
+ */
+ public final Object getObject(Cipher cipher)
+ throws IOException, ClassNotFoundException, IllegalBlockSizeException,
+ BadPaddingException
+ {
+ sealCipher = cipher;
+ return unseal();
+ }
+
+ /**
+ * Unseal and deserialize this sealed object with the specified key.
+ *
+ * @param key The key to decrypt with.
+ * @return The original object.
+ * @throws java.io.IOException If reading fails.
+ * @throws java.lang.ClassNotFoundException If deserialization fails.
+ * @throws java.security.InvalidKeyException If the supplied key
+ * cannot be used to unseal this object.
+ * @throws java.security.NoSuchAlgorithmException If the algorithm
+ * used to originally seal this object is not available.
+ */
+ public final Object getObject(Key key)
+ throws IOException, ClassNotFoundException, InvalidKeyException,
+ NoSuchAlgorithmException
+ {
+ try
+ {
+ if (sealCipher == null)
+ sealCipher = Cipher.getInstance(sealAlg);
+ }
+ catch (NoSuchPaddingException nspe)
+ {
+ throw new NoSuchAlgorithmException(nspe.getMessage());
+ }
+ AlgorithmParameters params = null;
+ if (encodedParams != null)
+ {
+ params = AlgorithmParameters.getInstance(paramsAlg);
+ params.init(encodedParams);
+ }
+ try
+ {
+ sealCipher.init(Cipher.DECRYPT_MODE, key, params);
+ return unseal();
+ }
+ catch (InvalidAlgorithmParameterException iape)
+ {
+ throw new IOException("bad parameters");
+ }
+ catch (IllegalBlockSizeException ibse)
+ {
+ throw new IOException("illegal block size");
+ }
+ catch (BadPaddingException bpe)
+ {
+ throw new IOException("bad padding");
+ }
+ }
+
+ /**
+ * Unseal and deserialize this sealed object with the specified key,
+ * using a cipher from the named provider.
+ *
+ * @param key The key to decrypt with.
+ * @param provider The name of the provider to use.
+ * @return The original object.
+ * @throws java.io.IOException If reading fails.
+ * @throws java.lang.ClassNotFoundException If deserialization fails.
+ * @throws java.security.InvalidKeyException If the supplied key
+ * cannot be used to unseal this object.
+ * @throws java.security.NoSuchAlgorithmException If the algorithm
+ * used to originally seal this object is not available from
+ * the named provider.
+ * @throws java.security.NoSuchProviderException If the named provider
+ * does not exist.
+ */
+ public final Object getObject(Key key, String provider)
+ throws IOException, ClassNotFoundException, InvalidKeyException,
+ NoSuchAlgorithmException, NoSuchProviderException
+ {
+ try
+ {
+ sealCipher = Cipher.getInstance(sealAlg, provider);
+ }
+ catch (NoSuchPaddingException nspe)
+ {
+ throw new NoSuchAlgorithmException(nspe.getMessage());
+ }
+ AlgorithmParameters params = null;
+ if (encodedParams != null)
+ {
+ params = AlgorithmParameters.getInstance(paramsAlg, provider);
+ params.init(encodedParams);
+ }
+ try
+ {
+ sealCipher.init(Cipher.DECRYPT_MODE, key, params);
+ return unseal();
+ }
+ catch (InvalidAlgorithmParameterException iape)
+ {
+ throw new IOException("bad parameters");
+ }
+ catch (IllegalBlockSizeException ibse)
+ {
+ throw new IOException("illegal block size");
+ }
+ catch (BadPaddingException bpe)
+ {
+ throw new IOException("bad padding");
+ }
+ }
+
+ // Own methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Deserialize this object.
+ *
+ * @param ois The input stream.
+ * @throws java.io.IOException If reading fails.
+ * @throws java.lang.ClassNotFoundException If reading fails.
+ */
+ private void readObject(ObjectInputStream ois)
+ throws IOException, ClassNotFoundException
+ {
+ encodedParams = (byte[]) ois.readObject();
+ encryptedContent = (byte[]) ois.readObject();
+ sealAlg = (String) ois.readObject();
+ paramsAlg = (String) ois.readObject();
+ }
+
+ /**
+ * Serialize this object.
+ *
+ * @param oos The output stream.
+ * @throws java.io.IOException If writing fails.
+ */
+ private void writeObject(ObjectOutputStream oos)
+ throws IOException
+ {
+ oos.writeObject(encodedParams);
+ oos.writeObject(encryptedContent);
+ oos.writeObject(sealAlg);
+ oos.writeObject(paramsAlg);
+ }
+
+ /**
+ * Unseal this object, returning it.
+ *
+ * @return The unsealed, deserialized Object.
+ * @throws java.io.IOException If reading fails.
+ * @throws java.io.ClassNotFoundException If reading fails.
+ * @throws javax.crypto.IllegalBlockSizeException If the cipher has no
+ * padding and the encrypted data is not a multiple of the
+ * cipher's block size.
+ * @throws javax.crypto.BadPaddingException If the padding bytes are
+ * incorrect.
+ */
+ private Object unseal()
+ throws IOException, ClassNotFoundException, IllegalBlockSizeException,
+ BadPaddingException
+ {
+ ByteArrayInputStream bais = null;
+ try
+ {
+ bais = new ByteArrayInputStream(sealCipher.doFinal(encryptedContent));
+ }
+ catch (IllegalStateException ise)
+ {
+ throw new IOException("cipher not initialized");
+ }
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ }
+}
diff --git a/javax/crypto/SecretKey.java b/javax/crypto/SecretKey.java
new file mode 100644
index 000000000..85529b94d
--- /dev/null
+++ b/javax/crypto/SecretKey.java
@@ -0,0 +1,67 @@
+/* SecretKey.java -- A key for symmetric cryptography.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License along
+with GNU Classpath; if not, write to the
+
+ Free Software Foundation, Inc.,
+ 59 Temple Place, Suite 330,
+ Boston, MA 02111-1307
+ USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under terms
+of your choice, provided that you also meet, for each linked independent
+module, the terms and conditions of the license of that module. An
+independent module is a module which is not derived from or based on
+this library. If you modify this library, you may extend this exception
+to your version of the library, but you are not obligated to do so. If
+you do not wish to do so, delete this exception statement from your
+version. */
+
+
+package javax.crypto;
+
+import java.security.Key;
+
+/**
+ * A secret key for symmetric cryptography.
+ *
+ * <p>This interface defines no new methods over {@link
+ * java.security.Key}, but rather is intended to be a <i>marker
+ * interface</i> and to provide type safety for secret keys.</p>
+ *
+ * <p>The format of secret keys should be <code>RAW</code>, as returned
+ * by {@link java.security.Key#getFormat()}.</p>
+ *
+ * <p>Concrete implementations of this interface should override the
+ * {@link java.lang.Object#equals} and {@link java.lang.Object#hashCode}
+ * methods of {@link java.lang.Object} to use the actual key data rather
+ * than the identity-based default methods.</p>
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @see javax.crypto.SecretKeyFactory
+ * @see javax.crypto.Cipher
+ */
+public interface SecretKey extends Key
+{
+}
diff --git a/javax/crypto/SecretKeyFactory.java b/javax/crypto/SecretKeyFactory.java
new file mode 100644
index 000000000..92f18ec66
--- /dev/null
+++ b/javax/crypto/SecretKeyFactory.java
@@ -0,0 +1,249 @@
+/* SecretKeyFactory.java -- Factory for creating secret keys.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+import java.security.spec.KeySpec;
+import java.security.spec.InvalidKeySpecException;
+
+import gnu.java.security.Engine;
+
+/**
+ * A secret key factory translates {@link SecretKey} objects to and from
+ * {@link java.security.spec.KeySpec} objects, and can translate between
+ * different vendors' representations of {@link SecretKey} objects (for
+ * security or semantics; whichever applies).
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see SecretKey
+ */
+public class SecretKeyFactory
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------------
+
+ private static final String SERVICE = "SecretKeyFactory";
+
+ /** The underlying factory implementation. */
+ private SecretKeyFactorySpi skfSpi;
+
+ /** The provider of the implementation. */
+ private Provider provider;
+
+ /** The name of the algorithm. */
+ private String algorithm;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new secret key factory.
+ *
+ * @param skfSpi The underlying factory implementation.
+ * @param provider The provider.
+ * @param algorithm The algorithm name.
+ */
+ protected SecretKeyFactory(SecretKeyFactorySpi skfSpi, Provider provider,
+ String algorithm)
+ {
+ this.skfSpi = skfSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new secret key factory from the first appropriate
+ * instance.
+ *
+ * @param algorithm The algorithm name.
+ * @return The appropriate key factory, if found.
+ * @throws java.security.NoSuchAlgorithmException If no provider
+ * implements the specified algorithm.
+ */
+ public static final SecretKeyFactory getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException nsae)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+
+ /**
+ * Create a new secret key factory from the named provider.
+ *
+ * @param algorithm The algorithm name.
+ * @param provider The provider name.
+ * @return The appropriate key factory, if found.
+ * @throws java.security.NoSuchAlgorithmException If the named
+ * provider does not implement the algorithm.
+ * @throws java.security.NoSuchProviderException If the named provider
+ * does not exist.
+ */
+ public static final SecretKeyFactory getInstance(String algorithm,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Create a new secret key factory from the specified provider.
+ *
+ * @param algorithm The algorithm name.
+ * @param provider The provider.
+ * @return The appropriate key factory, if found.
+ * @throws java.security.NoSuchAlgorithmException If the provider
+ * does not implement the algorithm.
+ */
+ public static final SecretKeyFactory getInstance(String algorithm,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new SecretKeyFactory((SecretKeyFactorySpi)
+ Engine.getInstance(SERVICE, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ if (ite.getCause() == null)
+ throw new NoSuchAlgorithmException(algorithm);
+ if (ite.getCause() instanceof NoSuchAlgorithmException)
+ throw (NoSuchAlgorithmException) ite.getCause();
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Generate a secret key from a key specification, if possible.
+ *
+ * @param keySpec The key specification.
+ * @return The secret key.
+ * @throws java.security.InvalidKeySpecException If the key specification
+ * cannot be transformed into a secret key.
+ */
+ public final SecretKey generateSecret(KeySpec keySpec)
+ throws InvalidKeySpecException
+ {
+ return skfSpi.engineGenerateSecret(keySpec);
+ }
+
+ /**
+ * Get the algorithm name.
+ *
+ * @return The algorithm name.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Get the key specification from a secret key.
+ *
+ * @param key The secret key.
+ * @param keySpec The target key specification class.
+ * @return The key specification.
+ * @throws java.security.spec.InvalidKeySpecException If the secret key cannot
+ * be transformed into the specified key specification.
+ */
+ public final KeySpec getKeySpec(SecretKey key, Class keySpec)
+ throws InvalidKeySpecException
+ {
+ return skfSpi.engineGetKeySpec(key, keySpec);
+ }
+
+ /**
+ * Get the provider of this implementation.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Translate a secret key into another form.
+ *
+ * @param key The key to translate.
+ * @return The translated key.
+ * @throws java.security.InvalidKeyException If the argument cannot be
+ * translated.
+ */
+ public final SecretKey translateKey(SecretKey key)
+ throws InvalidKeyException
+ {
+ return skfSpi.engineTranslateKey(key);
+ }
+}
diff --git a/javax/crypto/SecretKeyFactorySpi.java b/javax/crypto/SecretKeyFactorySpi.java
new file mode 100644
index 000000000..7b4763dff
--- /dev/null
+++ b/javax/crypto/SecretKeyFactorySpi.java
@@ -0,0 +1,108 @@
+/* SecretKeyFactorySpi.java -- Secret key factory service provider interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.InvalidKeyException;
+import java.security.spec.KeySpec;
+import java.security.spec.InvalidKeySpecException;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for the {@link
+ * SecretKeyFactory} class.
+ *
+ * <p>Providers wishing to implement a secret key factory must
+ * subclass this and provide an appropriate implementation for all the
+ * abstract methods below, and provide an appropriate entry in the
+ * master {@link java.security.Provider} class (the service name for
+ * secret key factories is <code>"SecretKeyFactory"</code>).
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see SecretKeyFactory
+ */
+public abstract class SecretKeyFactorySpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new secret key factory SPI.
+ */
+ public SecretKeyFactorySpi()
+ {
+ }
+
+ // Abstract instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Translate a {@link java.security.KeySpec} into a {@link SecretKey}.
+ *
+ * @param keySpec The key specification.
+ * @return The secret key.
+ * @throws java.security.spec.InvalidKeySpecException If the key specification
+ * cannot be translated into a secret key.
+ */
+ protected abstract SecretKey engineGenerateSecret(KeySpec keySpec)
+ throws InvalidKeySpecException;
+
+ /**
+ * Translate a {@link SecretKey} into a {@link java.security.KeySpec}.
+ *
+ * @param key The secret key.
+ * @param keySpec The desired key specification class.
+ * @return The key specification.
+ * @throws java.security.spec.InvalidKeySpecException If the secret key cannot
+ * be translated into the desired key specification.
+ */
+ protected abstract KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
+ throws InvalidKeySpecException;
+
+ /**
+ * Translate a secret key into a different representation.
+ *
+ * @param key The secret key to translate.
+ * @return The translated key.
+ * @throws java.security.InvalidKeyException If the specified secret
+ * key cannot be translated.
+ */
+ protected abstract SecretKey engineTranslateKey(SecretKey key)
+ throws InvalidKeyException;
+}
diff --git a/javax/crypto/ShortBufferException.java b/javax/crypto/ShortBufferException.java
new file mode 100644
index 000000000..5b5bf5437
--- /dev/null
+++ b/javax/crypto/ShortBufferException.java
@@ -0,0 +1,70 @@
+/* ShortBufferException.java -- Signals a short output buffer.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * This exception is thrown on an attempt to transform bytes into a
+ * buffer that is too short to contain the data.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class ShortBufferException extends GeneralSecurityException
+{
+
+ // Constant.
+ // ------------------------------------------------------------------------
+
+ /** Serialization constant. */
+ private static final long serialVersionUID = 8427718640832943747L;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ public ShortBufferException()
+ {
+ super();
+ }
+
+ public ShortBufferException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/crypto/interfaces/DHKey.java b/javax/crypto/interfaces/DHKey.java
new file mode 100644
index 000000000..d5d827946
--- /dev/null
+++ b/javax/crypto/interfaces/DHKey.java
@@ -0,0 +1,61 @@
+/* DHKey.java -- General interface for a Diffie-Hellman key.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.interfaces;
+
+import javax.crypto.spec.DHParameterSpec;
+
+/**
+ * This interface marks public/private keys in the Diffie-Hellman key
+ * exchange algorithm. Implementations of Diffie-Hellman keys should
+ * implement this interface, and applications can safely cast keys that
+ * are known to be Diffie-Hellman keys to this interface.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public interface DHKey
+{
+ /**
+ * Returns the Diffie-Hellman parameters for this key, which includes
+ * the generator and the prime.
+ *
+ * @return The Diffie-Hellman parameters.
+ */
+ DHParameterSpec getParams();
+}
diff --git a/javax/crypto/interfaces/DHPrivateKey.java b/javax/crypto/interfaces/DHPrivateKey.java
new file mode 100644
index 000000000..63b9c15c4
--- /dev/null
+++ b/javax/crypto/interfaces/DHPrivateKey.java
@@ -0,0 +1,70 @@
+/* DHPrivateKey.java -- A Diffie-Hellman private key.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.interfaces;
+
+import java.math.BigInteger;
+import java.security.PrivateKey;
+
+/**
+ * This interface marks a private key in the Diffie-Hellman key exchange
+ * algorithm. It should be treated with as much care as any {@link
+ * java.security.PrivateKey}.
+ *
+ * <p>Implementations of Diffie-Hellman private keys should implement
+ * this interface. Applications that know a particular key is a
+ * Diffie-Hellman private key can safely cast it to this interface.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see DHKey
+ * @see DHPublicKey
+ */
+public interface DHPrivateKey extends DHKey, PrivateKey
+{
+
+ /** Compatible with JDK1.4. */
+ static final long serialVersionUID = 2211791113380396553L;
+
+ /**
+ * Returns the private value <i>x</i>.
+ *
+ * @return The private value <i>x</i>.
+ */
+ BigInteger getX();
+}
diff --git a/javax/crypto/interfaces/DHPublicKey.java b/javax/crypto/interfaces/DHPublicKey.java
new file mode 100644
index 000000000..5e0b35bf0
--- /dev/null
+++ b/javax/crypto/interfaces/DHPublicKey.java
@@ -0,0 +1,69 @@
+/* DHPublicKey.java -- A Diffie-Hellman public key.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.interfaces;
+
+import java.math.BigInteger;
+import java.security.PublicKey;
+
+/**
+ * This interface marks a public key in the Diffie-Hellman key-exchange
+ * algorithm.
+ *
+ * <p>Implementations of Diffie-Hellman public keys should implement
+ * this interface. Applications that know that a particular key is a
+ * Diffie-Hellman public key it can be safely cast to this interface.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see DHKey
+ * @see DHPrivateKey
+ */
+public interface DHPublicKey extends DHKey, PublicKey
+{
+
+ /** Compatible with JDK1.4. */
+ static final long serialVersionUID = -6628103563352519193L;
+
+ /**
+ * Get the public value <i>y</i>.
+ *
+ * @return The public value <i>y</i>.
+ */
+ BigInteger getY();
+}
diff --git a/javax/crypto/interfaces/PBEKey.java b/javax/crypto/interfaces/PBEKey.java
new file mode 100644
index 000000000..533491898
--- /dev/null
+++ b/javax/crypto/interfaces/PBEKey.java
@@ -0,0 +1,91 @@
+/* PBEKey.java -- A key derived from a password.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.interfaces;
+
+import javax.crypto.SecretKey;
+
+/**
+ * Interface to a password-derived key for password-based encryption
+ * (PBE). Applications working with a {@link javax.crypto.SecretKey}
+ * that is known to be a password-based key can safely cast such keys to
+ * this interface.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public interface PBEKey extends SecretKey
+{
+
+ /** Compatible with JDK1.4. */
+ static final long serialVersionUID = -1430015993304333921L;
+
+ /**
+ * Retruns the iteration count, or 0 if not specified.
+ *
+ * @return The iteration count.
+ */
+ int getIterationCount();
+
+ /**
+ * Returns a copy of the password as a character array. It is the
+ * caller's responsibility to zero-out the password when it is no
+ * longer in use.
+ *
+ * <p>Although it is not specified in the documentation,
+ * implementations should not copy or clone the password array, but
+ * rather return the reference to the array itself, so the caller has
+ * the ability to erase the password.
+ *
+ * @return The password.
+ */
+ char[] getPassword();
+
+ /**
+ * Returns a copy of the salt. It is the caller's responsibility to
+ * zero-out the salt when it is no longer in use.
+ *
+ * <p>Although it is not specified in the documentation,
+ * implementations should not copy or clone the salt array, but
+ * rather return the reference to the array itself, so the caller has
+ * the ability to erase the salt.
+ *
+ * @return The salt.
+ */
+ byte[] getSalt();
+}
diff --git a/javax/crypto/interfaces/package.html b/javax/crypto/interfaces/package.html
new file mode 100644
index 000000000..ade7507af
--- /dev/null
+++ b/javax/crypto/interfaces/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.crypto.interfaces package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.crypto.interfaces</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/crypto/package.html b/javax/crypto/package.html
new file mode 100644
index 000000000..e5a68ed12
--- /dev/null
+++ b/javax/crypto/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.crypto package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.crypto</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/crypto/spec/DESKeySpec.java b/javax/crypto/spec/DESKeySpec.java
new file mode 100644
index 000000000..7423c969b
--- /dev/null
+++ b/javax/crypto/spec/DESKeySpec.java
@@ -0,0 +1,220 @@
+/* DESKeySpec -- Keys for DES.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.InvalidKeyException;
+import java.security.spec.KeySpec;
+
+/**
+ * This class is a transparent wrapper for DES keys, which are arrays
+ * of 8 bytes.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class DESKeySpec implements KeySpec
+{
+
+ // Constants.
+ // ------------------------------------------------------------------------
+
+ /**
+ * The length of a DES key, in bytes.
+ */
+ public static final int DES_KEY_LEN = 8;
+
+ /**
+ * The key bytes.
+ */
+ private byte[] key;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new DES key spec, copying the first 8 bytes from the
+ * byte array.
+ *
+ * @param key The key bytes.
+ * @throws java.security.InvalidKeyException If there are less than 8
+ * bytes in the array.
+ */
+ public DESKeySpec(byte[] key) throws InvalidKeyException
+ {
+ this(key, 0);
+ }
+
+ /**
+ * Create a new DES key spec, starting at <code>offset</code> in
+ * the byte array. The first 8 bytes starting at <code>offset</code>
+ * are copied.
+ *
+ * @param key The key bytes.
+ * @param offset The offset into the byte array at which to begin.
+ * @throws java.security.InvalidKeyException If there are less than 8
+ * bytes starting at <code>offset</code>.
+ */
+ public DESKeySpec(byte[] key, int offset) throws InvalidKeyException
+ {
+ if (key.length - offset < DES_KEY_LEN)
+ {
+ throw new InvalidKeyException("DES keys must be 8 bytes long");
+ }
+ this.key = new byte[DES_KEY_LEN];
+ System.arraycopy(key, offset, this.key, 0, DES_KEY_LEN);
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns whether or not the given key is <i>parity adjusted</i>;
+ * i.e. every byte in the key has an odd number of "1" bits.
+ *
+ * @param key The key bytes, considered between <code>[offset,
+ * offset+7]</code>
+ * @param offset The offset into the byte array at which to begin.
+ * @return True if all bytes have an odd number of "1" bits.
+ * @throws java.security.InvalidKeyException If there are not enough
+ * bytes in the array.
+ */
+ public static boolean isParityAdjusted(byte[] key, int offset)
+ throws InvalidKeyException
+ {
+ if (key.length - offset < DES_KEY_LEN)
+ {
+ throw new InvalidKeyException("DES keys must be 8 bytes long");
+ }
+ boolean parity = false;
+ boolean oddbits = false;
+ for (int i = 0; i < DES_KEY_LEN; i++)
+ {
+ oddbits = false;
+ for (int j = 0; j < 8; j++)
+ {
+ oddbits ^= (key[i+offset] & 1 << j) != 0;
+ }
+ parity &= oddbits;
+ }
+ return parity;
+ }
+
+ /**
+ * One-half of the weak and semiweak DES keys (the other half are the
+ * complements of these).
+ */
+ private static final byte[][] WEAK_KEYS = new byte[][] {
+ { 0, 0, 0, 0, 0, 0, 0, 0 }, // 0000 0000 0000 0000
+ { -1, -1, -1, -1, 0, 0, 0, 0 }, // ffff ffff 0000 0000
+ { 1, 1, 1, 1, 1, 1, 1, 1 }, // 0101 0101 0101 0101
+ { 31, 31, 31, 31, 14, 14, 14, 14 }, // 1f1f 1f1f 0e0e 0e0e
+ { 1, -2, 1, -2, 1, -2, 1, -2 }, // 01fe 01fe 01fe 01fe
+ { 31, -32, 31, -32, -32, 31, -32, 31 }, // 1fe0 1fe0 0e1f 0e1f
+ { 1, -32, 1, -32, 1, -15, 1, -15 }, // 01e0 01e0 01f1 01f1
+ { 31, -2, 31, -2, 14, -2, 14, -2 }, // 1ffe 1ffe 0efe 0efe
+ { 1, 31, 1, 31, 1, 14, 1, 14 }, // 011f 011f 010e 010e
+ { -32, -2, -32, -2, -15, -2, -15, -2 }, // e0fe e0fe f1fe f1fe
+ };
+
+ /**
+ * Tests if the bytes between <code>[offset, offset+7]</code>
+ * constitute a weak or semi-weak DES key.
+ *
+ * @param key The key bytes to check.
+ * @param offset The offset in the byte array to start.
+ * @return true If the key bytes are a weak key.
+ */
+ public static boolean isWeak(byte[] key, int offset)
+ throws InvalidKeyException
+ {
+ if (key.length - offset < DES_KEY_LEN)
+ {
+ throw new InvalidKeyException("DES keys must be 8 bytes long");
+ }
+ for (int i = 0; i < WEAK_KEYS.length; i++)
+ {
+ if (equalsOrComplementEquals(key, offset, WEAK_KEYS[i]))
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method returns true if the first 8 bytes starting at
+ * <code>off</code> in <code>a</code> equal the first 8 bytes in
+ * <code>b</code>, or equal the <i>complement</i> of the first 8 bytes
+ * in <code>b</code>.
+ *
+ * @param a The first byte array.
+ * @param off The index into the first byte array.
+ * @param b The second byte array.
+ * @return <code>a == b || a == ~b</code>
+ */
+ private static boolean equalsOrComplementEquals(byte[] a, int off, byte[] b)
+ {
+ boolean result = true;
+ for (int i = 0; i < DES_KEY_LEN; i++)
+ {
+ result &= a[off+i] == b[i];
+ }
+ if (result) return true;
+ result = true;
+ for (int i = 0; i < DES_KEY_LEN; i++)
+ {
+ result &= a[off+i] == (~b[i]);
+ }
+ return result;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the key as a byte array. This method does not copy the byte
+ * array.
+ *
+ * @return The key bytes.
+ */
+ public byte[] getKey()
+ {
+ return key;
+ }
+}
diff --git a/javax/crypto/spec/DESedeKeySpec.java b/javax/crypto/spec/DESedeKeySpec.java
new file mode 100644
index 000000000..d455163bc
--- /dev/null
+++ b/javax/crypto/spec/DESedeKeySpec.java
@@ -0,0 +1,151 @@
+/* DESedeKeySpec.java -- Keys for triple-DES.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.InvalidKeyException;
+import java.security.spec.KeySpec;
+
+/**
+ * This class is a transparent wrapper for DES-EDE (Triple-DES) keys,
+ * which are arrays of 24 bytes.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class DESedeKeySpec implements KeySpec
+{
+
+ // Constants.
+ // ------------------------------------------------------------------------
+
+ /**
+ * The length of a triple-DES key, in bytes.
+ */
+ public static final int DES_EDE_KEY_LEN = 24;
+
+ /**
+ * The key bytes.
+ */
+ private byte[] key;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new DES-EDE key spec, copying the first 24 bytes from the
+ * byte array.
+ *
+ * @param key The key bytes.
+ * @throws java.security.InvalidKeyException If there are less than 24
+ * bytes in the array.
+ */
+ public DESedeKeySpec(byte[] key) throws InvalidKeyException
+ {
+ this(key, 0);
+ }
+
+ /**
+ * Create a new DES-EDE key spec, starting at <code>offset</code> in
+ * the byte array. The first 24 bytes starting at <code>offset</code>
+ * are copied.
+ *
+ * @param key The key bytes.
+ * @param offset The offset into the byte array at which to begin.
+ * @throws java.security.InvalidKeyException If there are less than 24
+ * bytes starting at <code>offset</code>.
+ */
+ public DESedeKeySpec(byte[] key, int offset) throws InvalidKeyException
+ {
+ if (key.length - offset < DES_EDE_KEY_LEN)
+ {
+ throw new InvalidKeyException("DES-EDE keys must be 24 bytes long");
+ }
+ this.key = new byte[DES_EDE_KEY_LEN];
+ System.arraycopy(key, offset, this.key, 0, DES_EDE_KEY_LEN);
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns whether or not the given key is <i>parity adjusted</i>;
+ * i.e. every byte in the key has an odd number of "1" bits.
+ *
+ * @param key The key bytes, considered between <code>[offset,
+ * offset+23]</code>
+ * @param offset The offset into the byte array at which to begin.
+ * @return True if all bytes have an odd number of "1" bits.
+ * @throws java.security.InvalidKeyException If there are not enough
+ * bytes in the array.
+ */
+ public static boolean isParityAdjusted(byte[] key, int offset)
+ throws InvalidKeyException
+ {
+ if (key.length - offset < DES_EDE_KEY_LEN)
+ {
+ throw new InvalidKeyException("DES-EDE keys must be 24 bytes long");
+ }
+ boolean parity = false;
+ boolean oddbits = false;
+ for (int i = 0; i < DES_EDE_KEY_LEN; i++)
+ {
+ oddbits = false;
+ for (int j = 0; j < 8; j++)
+ {
+ oddbits ^= (key[i+offset] & 1 << j) != 0;
+ }
+ parity &= oddbits;
+ }
+ return parity;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the key as a byte array. This method does not copy the byte
+ * array.
+ *
+ * @return The key bytes.
+ */
+ public byte[] getKey()
+ {
+ return key;
+ }
+}
diff --git a/javax/crypto/spec/DHGenParameterSpec.java b/javax/crypto/spec/DHGenParameterSpec.java
new file mode 100644
index 000000000..67392a50f
--- /dev/null
+++ b/javax/crypto/spec/DHGenParameterSpec.java
@@ -0,0 +1,100 @@
+/* DHGenParameterSpec.java -- Diffie-Hellman parameter generator spec.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * This class represents the parameters needed for generating
+ * Diffie-Hellman parameters.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see DHParameterSpec
+ */
+public class DHGenParameterSpec implements AlgorithmParameterSpec
+{
+
+ // Variables.
+ // ------------------------------------------------------------------------
+
+ /** The length of the prime, in bits. */
+ private int primeSize;
+
+ /** The length of the exponent, in bits. */
+ private int exponentSize;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new Diffie-Hellman parameter generator spec.
+ *
+ * @param primeSize The size of the prime, in bits.
+ * @param exponentSize The size of the exponent, in bits.
+ */
+ public DHGenParameterSpec(int primeSize, int exponentSize)
+ {
+ this.primeSize = primeSize;
+ this.exponentSize = exponentSize;
+ }
+
+ // Intance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the size of the exponent, in bits.
+ *
+ * @return The exponent size.
+ */
+ public int getExponentSize()
+ {
+ return exponentSize;
+ }
+
+ /**
+ * Get the size of the prime, in bits.
+ *
+ * @return The prime size.
+ */
+ public int getPrimeSize()
+ {
+ return primeSize;
+ }
+}
diff --git a/javax/crypto/spec/DHParameterSpec.java b/javax/crypto/spec/DHParameterSpec.java
new file mode 100644
index 000000000..e66f632e8
--- /dev/null
+++ b/javax/crypto/spec/DHParameterSpec.java
@@ -0,0 +1,135 @@
+/* DHParameterSpec.java -- Parameters for Diffie-Hellman keys.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.math.BigInteger;
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * The base set of parameters necessary to perform Diffie-Hellman key
+ * exchange. Each party in the key exchange shares these parameters.
+ *
+ * <p>Each set of parameters consists of a <i>base generator</i>
+ * <code>g</code>, a <i>prime modulus</i> <code>p</code>, and an
+ * optional length, in bits, of the private exponent.
+ *
+ * <p>See <a href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-3/">PKCS
+ * #3 - Diffie-Hellman Key Agreement Standard</a> for more information.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see javax.crypto.KeyAgreement
+ */
+public class DHParameterSpec implements AlgorithmParameterSpec
+{
+
+ // Variables.
+ // ------------------------------------------------------------------------
+
+ /** The base generator g. */
+ private BigInteger g;
+
+ /** The prime modulus p. */
+ private BigInteger p;
+
+ /** The length, in bits, of the private exponent. */
+ private int l;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new set of Diffie-Hellman parameters.
+ *
+ * @param p The prime modulus.
+ * @param g The base generator.
+ */
+ public DHParameterSpec(BigInteger p, BigInteger g)
+ {
+ this(p, g, 0);
+ }
+
+ /**
+ * Create a new set of Diffie-Hellman parameters.
+ *
+ * @param p The prime modulus.
+ * @param g The base generator.
+ * @param l The size of the private exponent, in bits.
+ */
+ public DHParameterSpec(BigInteger p, BigInteger g, int l)
+ {
+ this.p = p;
+ this.g = g;
+ this.l = l;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the base generator, <i>g</i>.
+ *
+ * @return The base generator <i>g</i>.
+ */
+ public BigInteger getG()
+ {
+ return g;
+ }
+
+ /**
+ * Get the length of the private exponent, in bits.
+ *
+ * @return The length of the private exponent, in bits, or 0 if this
+ * has not been explicitly set.
+ */
+ public int getL()
+ {
+ return l;
+ }
+
+ /**
+ * Get the prime modulus, <i>p</i>.
+ *
+ * @return The prime modulus, <i>p</i>.
+ */
+ public BigInteger getP()
+ {
+ return p;
+ }
+}
diff --git a/javax/crypto/spec/DHPrivateKeySpec.java b/javax/crypto/spec/DHPrivateKeySpec.java
new file mode 100644
index 000000000..8a4a790a1
--- /dev/null
+++ b/javax/crypto/spec/DHPrivateKeySpec.java
@@ -0,0 +1,115 @@
+/* DHPrivateKeySpec.java -- Wrapper for Diffie-Hellman private keys.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.math.BigInteger;
+import java.security.spec.KeySpec;
+
+/**
+ * A wrapper for Diffie-Hellman private key data.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see DHPublicKeySpec
+ */
+public class DHPrivateKeySpec implements KeySpec
+{
+
+ // Variables.
+ // ------------------------------------------------------------------------
+
+ /** The base generator. */
+ private BigInteger g;
+
+ /** The prime modulus. */
+ private BigInteger p;
+
+ /** The private exponent. */
+ private BigInteger x;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new Diffie-Hellman private key spec.
+ *
+ * @param x The private exponent.
+ * @param p The prime modulus.
+ * @param g The base generator.
+ */
+ public DHPrivateKeySpec(BigInteger x, BigInteger p, BigInteger g)
+ {
+ this.x = x;
+ this.p = p;
+ this.g = g;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the base generator.
+ *
+ * @return The base generator.
+ */
+ public BigInteger getG()
+ {
+ return g;
+ }
+
+ /**
+ * Get the prime modulus.
+ *
+ * @return The prime modulus.
+ */
+ public BigInteger getP()
+ {
+ return p;
+ }
+
+ /**
+ * Get the private exponent.
+ *
+ * @return The private exponent.
+ */
+ public BigInteger getX()
+ {
+ return x;
+ }
+}
diff --git a/javax/crypto/spec/DHPublicKeySpec.java b/javax/crypto/spec/DHPublicKeySpec.java
new file mode 100644
index 000000000..723dfefa4
--- /dev/null
+++ b/javax/crypto/spec/DHPublicKeySpec.java
@@ -0,0 +1,115 @@
+/* DHPublicKeySpec.java -- Wrapper for Diffie-Hellman public keys.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.math.BigInteger;
+import java.security.spec.KeySpec;
+
+/**
+ * A wrapper for Diffie-Hellman public key data.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see DHPrivateKeySpec
+ */
+public class DHPublicKeySpec implements KeySpec
+{
+
+ // Variables.
+ // ------------------------------------------------------------------------
+
+ /** The base generator. */
+ private BigInteger g;
+
+ /** The prime modulus. */
+ private BigInteger p;
+
+ /** The public value. */
+ private BigInteger y;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new Diffie-Hellman public key spec.
+ *
+ * @param y The public value.
+ * @param p The prime modulus.
+ * @param g The base generator.
+ */
+ public DHPublicKeySpec(BigInteger y, BigInteger p, BigInteger g)
+ {
+ this.y = y;
+ this.p = p;
+ this.g = g;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the base generator.
+ *
+ * @return The base generator.
+ */
+ public BigInteger getG()
+ {
+ return g;
+ }
+
+ /**
+ * Get the prime modulus.
+ *
+ * @return The prime modulus.
+ */
+ public BigInteger getP()
+ {
+ return p;
+ }
+
+ /**
+ * Get the public value.
+ *
+ * @return The public value.
+ */
+ public BigInteger getY()
+ {
+ return y;
+ }
+}
diff --git a/javax/crypto/spec/IvParameterSpec.java b/javax/crypto/spec/IvParameterSpec.java
new file mode 100644
index 000000000..1c09c7665
--- /dev/null
+++ b/javax/crypto/spec/IvParameterSpec.java
@@ -0,0 +1,96 @@
+/* IvParameterSpec.java -- A simple wrapper for initialization vectors.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * A wrapper for an initialization vector. An initialization vector is
+ * necessary for any cipher in any <i>feedback mode</i>, e.g. CBC.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ */
+public class IvParameterSpec implements AlgorithmParameterSpec
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ /** The IV. */
+ private byte[] iv;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new initialization vector spec from an entire byte array.
+ *
+ * @param iv The IV bytes.
+ */
+ public IvParameterSpec(byte[] iv)
+ {
+ this(iv, 0, iv.length);
+ }
+
+ /**
+ * Create a new initialization vector spec from part of a byte array.
+ *
+ * @param iv The IV bytes.
+ * @param off The offset into the IV bytes.
+ * @param len The number of IV bytes.
+ */
+ public IvParameterSpec(byte[] iv, int off, int len)
+ {
+ this.iv = new byte[len];
+ System.arraycopy(iv, off, this.iv, 0, len);
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the IV. This method does not copy the byte array.
+ *
+ * @return The IV.
+ */
+ public byte[] getIV()
+ {
+ return iv;
+ }
+}
diff --git a/javax/crypto/spec/PBEKeySpec.java b/javax/crypto/spec/PBEKeySpec.java
new file mode 100644
index 000000000..7a8c224cc
--- /dev/null
+++ b/javax/crypto/spec/PBEKeySpec.java
@@ -0,0 +1,176 @@
+/* PBEKeySpec.java -- Wrapper for password-based keys.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.KeySpec;
+
+/**
+ * A wrapper for a password-based key, used for password-based
+ * encryption (PBE).
+ *
+ * <p>Examples of password-based encryption algorithms include:
+ *
+ * <ul>
+ * <li><a href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/">PKCS #5
+ * - Password-Based Cryptography Standard</a></li>
+ * <li><a href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-12/">PKCS
+ * #12 - Personal Information Exchange Syntax Standard</a></li>
+ * </ul>
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ * @see javax.crypto.SecretKeyFactory
+ * @see PBEParameterSpec
+ */
+public class PBEKeySpec implements KeySpec
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ /** The iteration count. */
+ private int iterationCount;
+
+ /** The generated key length. */
+ private int keyLength;
+
+ /** The password. */
+ private char[] password;
+
+ /** The salt. */
+ private byte[] salt;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new PBE key spec with just a password.
+ *
+ * @param password The password char array.
+ */
+ public PBEKeySpec(char[] password)
+ {
+ this(password, null, 0, 0);
+ }
+
+ /**
+ * Create a PBE key spec with a password, salt, and iteration count.
+ *
+ * @param password The password char array.
+ * @param salt The salt bytes.
+ * @param iterationCount The iteration count.
+ */
+ public PBEKeySpec(char[] password, byte[] salt, int iterationCount)
+ {
+ this(password, salt, iterationCount, 0);
+ }
+
+ /**
+ * Create a PBE key spec with a password, salt, iteration count, and
+ * key length.
+ *
+ * @param password The password char array.
+ * @param salt The salt bytes.
+ * @param iterationCount The iteration count.
+ * @param keyLength The generated key length.
+ */
+ public PBEKeySpec(char[] password, byte[] salt, int iterationCount,
+ int keyLength)
+ {
+ this.password = password;
+ this.salt = salt;
+ this.iterationCount = iterationCount;
+ this.keyLength = keyLength;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Clear the password array by filling it with null characters.
+ */
+ public final void clearPassword()
+ {
+ if (password == null) return;
+ for (int i = 0; i < password.length; i++)
+ {
+ password[i] = '\u0000';
+ }
+ }
+
+ /**
+ * Get the iteration count, or 0 if it has not been specified.
+ *
+ * @return The iteration count, or 0 if it has not been specified.
+ */
+ public final int getIterationCount()
+ {
+ return iterationCount;
+ }
+
+ /**
+ * Get the generated key length, or 0 if it has not been specified.
+ *
+ * @return The key length, or 0 if it has not been specified.
+ */
+ public final int getKeyLength()
+ {
+ return keyLength;
+ }
+
+ /**
+ * Get the password character array.
+ *
+ * @return The password.
+ */
+ public final char[] getPassword()
+ {
+ return password;
+ }
+
+ /**
+ * Get the salt bytes.
+ *
+ * @return The salt.
+ */
+ public final byte[] getSalt()
+ {
+ return salt;
+ }
+}
diff --git a/javax/crypto/spec/PBEParameterSpec.java b/javax/crypto/spec/PBEParameterSpec.java
new file mode 100644
index 000000000..f45c866c9
--- /dev/null
+++ b/javax/crypto/spec/PBEParameterSpec.java
@@ -0,0 +1,100 @@
+/* PBEParameterSpec.java -- A wrapper for PBE parameters.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * A wrapper for the parameters used in <a
+ * href="http://www.rsasecurity.com/rsalabs/pkcs/pkcs-5/">PKCS #5 -
+ * Password-Based Cryptography Standard</a>.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class PBEParameterSpec implements AlgorithmParameterSpec
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ /** The iteration count. */
+ private int iterationCount;
+
+ /** The salt. */
+ private byte[] salt;
+
+ // Constructor.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Creates a new password-based encryption parameter specification.
+ *
+ * @param salt The salt.
+ * @param iterationCount The iteration count.
+ */
+ public PBEParameterSpec(byte[] salt, int iterationCount)
+ {
+ this.salt = salt;
+ this.iterationCount = iterationCount;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the iteration count.
+ *
+ * @return The iteration count.
+ */
+ public int getIterationCount()
+ {
+ return iterationCount;
+ }
+
+ /**
+ * Get the salt.
+ *
+ * @return The salt.
+ */
+ public byte[] getSalt()
+ {
+ return salt;
+ }
+}
diff --git a/javax/crypto/spec/RC2ParameterSpec.java b/javax/crypto/spec/RC2ParameterSpec.java
new file mode 100644
index 000000000..ec9cde71c
--- /dev/null
+++ b/javax/crypto/spec/RC2ParameterSpec.java
@@ -0,0 +1,166 @@
+/* RC2ParameterSpec.java -- Wrapper for RC2 parameters.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * A wrapper for parameters for the <a
+ * href="http://www.rsasecurity.com/rsalabs/faq/3-6-2.html">RC2</a>
+ * block cipher ("RC" means either "Rivest Cipher" or "Ron's Code",
+ * depending upon who you ask and when).
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class RC2ParameterSpec implements AlgorithmParameterSpec
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------------
+
+ /** The length of an RC2 IV, in bytes. */
+ private static final int RC2_IV_LENGTH = 8;
+
+ /** The effective key length, in bits. */
+ private int effectiveKeyBits;
+
+ /** The initialization vector. */
+ private byte[] iv;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create RC2 parameters without an IV.
+ *
+ * @param effectiveKeyBits The number of effective key bits.
+ */
+ public RC2ParameterSpec(int effectiveKeyBits)
+ {
+ this.effectiveKeyBits = effectiveKeyBits;
+ }
+
+ /**
+ * Create RC2 parameters with an IV.
+ *
+ * @param effectiveKeyBits The number of effective key bits.
+ * @param iv The IV; the first eight bytes of this array
+ * are used.
+ */
+ public RC2ParameterSpec(int effectiveKeyBits, byte[] iv)
+ {
+ this(effectiveKeyBits, iv, 0);
+ }
+
+ /**
+ * Create RC2 parameters with an IV.
+ *
+ * @param effectiveKeyBits The number of effective key bits.
+ * @param iv The IV; the first eight bytes of this array
+ * after <code>offset</code> are used.
+ * @param offset From whence to start in the array.
+ */
+ public RC2ParameterSpec(int effectiveKeyBits, byte[] iv, int offset)
+ {
+ if (iv.length - offset < RC2_IV_LENGTH)
+ {
+ throw new IllegalArgumentException("IV too short");
+ }
+ this.effectiveKeyBits = effectiveKeyBits;
+ this.iv = new byte[RC2_IV_LENGTH];
+ System.arraycopy(iv, offset, this.iv, 0, RC2_IV_LENGTH);
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Get the number of effective key bits.
+ *
+ * @return The numer of effective key bits.
+ */
+ public int getEffectiveKeyBits()
+ {
+ return effectiveKeyBits;
+ }
+
+ /**
+ * Return the initialization vector, or <code>null</code> if none was
+ * specified.
+ *
+ * @return The IV, or null.
+ */
+ public byte[] getIV()
+ {
+ return iv;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ byte[] oiv = ((RC2ParameterSpec) o).getIV();
+ if (iv != oiv)
+ {
+ if (iv == null || oiv == null) return false;
+ if (iv.length != oiv.length) return false;
+ for (int i = 0; i < iv.length; i++)
+ {
+ if (iv[i] != oiv[i])
+ {
+ return false;
+ }
+ }
+ }
+ return effectiveKeyBits == ((RC2ParameterSpec) o).getEffectiveKeyBits();
+ }
+
+ public int hashCode()
+ {
+ int code = effectiveKeyBits;
+ if (iv != null)
+ {
+ for (int i = 0; i < RC2_IV_LENGTH; i++)
+ {
+ code += iv[i];
+ }
+ }
+ return code;
+ }
+}
diff --git a/javax/crypto/spec/RC5ParameterSpec.java b/javax/crypto/spec/RC5ParameterSpec.java
new file mode 100644
index 000000000..e7549dd63
--- /dev/null
+++ b/javax/crypto/spec/RC5ParameterSpec.java
@@ -0,0 +1,202 @@
+/* RC5ParameterSpec.java -- parameters for RC5.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * A wrapper for parameters to the <a
+ * href="http://www.rsasecurity.com/rsalabs/faq/3-6-4.html">RC5</a>
+ * block cipher.
+ *
+ * @author Casey Marshall (csm@gnu.org)
+ * @since 1.4
+ */
+public class RC5ParameterSpec implements AlgorithmParameterSpec
+{
+
+ // Fields.
+ // ------------------------------------------------------------------------
+
+ /** The IV. */
+ private byte[] iv;
+
+ /** The number of rounds. */
+ private int rounds;
+
+ /** The version number. */
+ private int version;
+
+ /** The word size, in bits. */
+ private int wordSize;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create RC5 parameters without an IV.
+ *
+ * @param version The version number.
+ * @param rounds The number of rounds.
+ * @param wordSize The size of a word, in bits.
+ */
+ public RC5ParameterSpec(int version, int rounds, int wordSize)
+ {
+ this.version = version;
+ this.rounds = rounds;
+ this.wordSize = wordSize;
+ }
+
+ /**
+ * Create RC5 parameters with an IV. The bytes in <code>iv</code> in
+ * the range <code>[0, 2*(wordSize/8)-1]</code> are used.
+ *
+ * @param version The version number.
+ * @param rounds The number of rounds.
+ * @param wordSize The size of a word, in bits.
+ * @param iv The IV data.
+ */
+ public RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv)
+ {
+ this(version, rounds, wordSize, iv, 0);
+ }
+
+ /**
+ * Create RC5 parameters with an IV. The bytes in <code>iv</code> in
+ * the range <code>[off, off+2*(wordSize/8)-1]</code> are used.
+ *
+ * @param version The version number.
+ * @param rounds The number of rounds.
+ * @param wordSize The size of a word, in bits.
+ * @param iv The IV data.
+ * @param off From where in the array the IV starts.
+ */
+ public
+ RC5ParameterSpec(int version, int rounds, int wordSize, byte[] iv, int off)
+ {
+ this(version, rounds, wordSize);
+ int ivLength = 2 * (wordSize / 8);
+ if (off < 0)
+ throw new IllegalArgumentException();
+ if (iv.length - off < ivLength)
+ {
+ throw new IllegalArgumentException("IV too short");
+ }
+ this.iv = new byte[ivLength];
+ System.arraycopy(iv, off, this.iv, 0, ivLength);
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the initializaiton vector, or <code>null</code> if none was
+ * specified.
+ *
+ * @return The IV, or null.
+ */
+ public byte[] getIV()
+ {
+ return iv;
+ }
+
+ /**
+ * Get the number of rounds.
+ *
+ * @return The number of rounds.
+ */
+ public int getRounds()
+ {
+ return rounds;
+ }
+
+ /**
+ * Get the version number.
+ *
+ * @return The version number.
+ */
+ public int getVersion()
+ {
+ return version;
+ }
+
+ /**
+ * Get the word size, in bits.
+ *
+ * @return The word size, in bits.
+ */
+ public int getWordSize()
+ {
+ return wordSize;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ byte[] oiv = ((RC5ParameterSpec) o).getIV();
+ if (iv != oiv)
+ {
+ if (iv == null || oiv == null) return false;
+ if (iv.length != oiv.length) return false;
+ for (int i = 0; i < iv.length; i++)
+ {
+ if (iv[i] != oiv[i])
+ {
+ return false;
+ }
+ }
+ }
+ return rounds == ((RC5ParameterSpec) o).getRounds()
+ && version == ((RC5ParameterSpec) o).getVersion()
+ && wordSize == ((RC5ParameterSpec) o).getWordSize();
+ }
+
+ public int hashCode()
+ {
+ int code = rounds + version + wordSize;
+ if (iv != null)
+ {
+ for (int i = 0; i < iv.length; i++)
+ {
+ code += iv[i];
+ }
+ }
+ return code;
+ }
+}
diff --git a/javax/crypto/spec/SecretKeySpec.java b/javax/crypto/spec/SecretKeySpec.java
new file mode 100644
index 000000000..6d9f4b8fe
--- /dev/null
+++ b/javax/crypto/spec/SecretKeySpec.java
@@ -0,0 +1,154 @@
+/* SecretKeySpec.java -- Wrapper for secret keys.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.crypto.spec;
+
+import java.security.spec.KeySpec;
+import javax.crypto.SecretKey;
+
+/**
+ * This is a simple wrapper around a raw byte array, for ciphers that do
+ * not require any key parameters other than the bytes themselves.
+ *
+ * <p>Since this class implements {@link javax.crypto.SecretKey}, which
+ * in turn extends {@link java.security.Key}, so instances of this class
+ * may be passed directly to the <code>init()</code> methods of {@link
+ * javax.crypto.Cipher}.
+ *
+ * @see javax.crypto.SecretKey
+ * @see javax.crypto.SecretKeyFactory
+ */
+public class SecretKeySpec implements KeySpec, SecretKey
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------------
+
+ /** Compatible with JDK1.4. */
+ private static final long serialVersionUID = 6577238317307289933L;
+
+ /** The key bytes. */
+ private byte[] key;
+
+ /** The algorithm's name. */
+ private String algorithm;
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create a new secret key spec from an entire byte array.
+ *
+ * @param key The key material.
+ * @param algorithm The name of the algorithm using this key.
+ */
+ public SecretKeySpec(byte[] key, String algorithm)
+ {
+ this(key, 0, key.length, algorithm);
+ }
+
+ /**
+ * Create a new secret key spec from part of a byte array.
+ *
+ * @param key The key material.
+ * @param off The offset at which key material begins.
+ * @param len The length of key material.
+ * @param algorithm The name of the algorithm using this key.
+ */
+ public SecretKeySpec(byte[] key, int off, int len, String algorithm)
+ {
+ this.key = new byte[len];
+ this.algorithm = algorithm;
+ System.arraycopy(key, off, this.key, 0, len);
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Return the name of the algorithm associated with this secret key.
+ *
+ * @return The algorithm's name.
+ */
+ public String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Return the key as a byte array.
+ *
+ * @return The key material.
+ */
+ public byte[] getEncoded()
+ {
+ return key;
+ }
+
+ /**
+ * This key's format, which is always "RAW".
+ *
+ * @return "RAW"
+ */
+ public String getFormat()
+ {
+ return "RAW";
+ }
+
+ public boolean equals(Object o)
+ {
+ byte[] okey = ((SecretKeySpec) o).getEncoded();
+ if (key.length != okey.length) return false;
+ for (int i = 0; i < key.length; i++)
+ {
+ if (key[i] != okey[i])
+ return false;
+ }
+ return algorithm.equals(((SecretKeySpec) o).getAlgorithm());
+ }
+
+ public int hashCode()
+ {
+ int code = 0;
+ for (int i = 0; i < key.length; i++)
+ {
+ code ^= (key[i] & 0xff) << (i << 3 & 31);
+ }
+ return code ^ algorithm.hashCode();
+ }
+}
diff --git a/javax/crypto/spec/package.html b/javax/crypto/spec/package.html
new file mode 100644
index 000000000..12b2d02a5
--- /dev/null
+++ b/javax/crypto/spec/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.crypto.spec package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.crypto.spec</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/naming/CompoundName.java b/javax/naming/CompoundName.java
index 4908d1bed..17f2aab7e 100644
--- a/javax/naming/CompoundName.java
+++ b/javax/naming/CompoundName.java
@@ -55,6 +55,8 @@ import java.util.Vector;
* direction is never described. If it means that the CompoundName
* can only have a single element, then the Enumeration-based
* constructor ought to throw InvalidNameException.
+ *
+ * @since 1.3
*/
public class CompoundName implements Name, Cloneable, Serializable
{
@@ -158,7 +160,7 @@ public class CompoundName implements Name, Cloneable, Serializable
i += special.length ();
continue;
}
- else if (special == separator)
+ else if (direction != FLAT && special == separator)
{
elts.add (new_element.toString ());
new_element.setLength (0);
diff --git a/javax/net/ServerSocketFactory.java b/javax/net/ServerSocketFactory.java
new file mode 100644
index 000000000..d20c7fbe9
--- /dev/null
+++ b/javax/net/ServerSocketFactory.java
@@ -0,0 +1,122 @@
+/* ServerSocketFactory.java -- factory for server sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
+import java.security.Security;
+
+/**
+ * A factory for server sockets. The purpose of this class is to serve
+ * as the superclass of server socket factories that produce server
+ * sockets of a particular type, such as <i>Secure Socket Layer</i>
+ * (<b>SSL</b>) server sockets.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public abstract class ServerSocketFactory
+{
+
+ // Constructors.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Default 0-argument constructor.
+ */
+ protected ServerSocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns the default server socket factory. The type of factory
+ * returned may depend upon the installation.
+ *
+ * @return The default server socket factory.
+ */
+ public static synchronized ServerSocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("gnu.defaultServerSocketFactory");
+ if (s != null)
+ {
+ Class c = Class.forName(s);
+ return (ServerSocketFactory) c.newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ return new VanillaServerSocketFactory();
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------------
+
+ /**
+ * Create an unbound server socket.
+ *
+ * @return The new server socket.
+ * @throws IOException If a networking error occurs.
+ */
+ public ServerSocket createServerSocket() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Create a server socket bound to the given port.
+ *
+ * @param port The port to bind the server socket to.
+ * @return A server socket bound to <i>port</i>.
+ * @throws IOException If a networking error occurs.
+ */
+ public abstract ServerSocket createServerSocket(int port) throws IOException;
+
+ public abstract ServerSocket createServerSocket(int port, int backlog) throws IOException;
+
+ public abstract ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddress) throws IOException;
+}
diff --git a/javax/net/SocketFactory.java b/javax/net/SocketFactory.java
new file mode 100644
index 000000000..9e236d2df
--- /dev/null
+++ b/javax/net/SocketFactory.java
@@ -0,0 +1,157 @@
+/* SocketFactory.java -- factory for client sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+import java.security.Security;
+
+/**
+ * A factory for client sockets. The purpose of this class is to serve
+ * as the superclass of server socket factories that produce client
+ * sockets of a particular type, such as <i>Secure Socket Layer</i>
+ * (<b>SSL</b>) sockets.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public abstract class SocketFactory
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Default 0-arguments constructor.
+ */
+ protected SocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the default socket factory. The type of factory
+ * returned may depend upon the installation.
+ *
+ * @return The default socket factory.
+ */
+ public static synchronized SocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("gnu.defaultSocketFactory");
+ if (s != null)
+ {
+ Class c = Class.forName(s);
+ return (SocketFactory) c.newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ return new VanillaSocketFactory();
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns an unbound client socket.
+ *
+ * @return The new, unbound socket.
+ */
+ public Socket createSocket() throws IOException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * Creates a socket connected to a given host on a given port.
+ *
+ * @param host The hostname to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ * @throws UnknownHostException If <i>host</i> cannot be resolved.
+ */
+ public abstract Socket createSocket(String host, int port) throws IOException, UnknownHostException;
+
+ /**
+ * Creates a socket connected to a given host on a given port,
+ * connecting locally to the interface with the given address and port.
+ *
+ * @param host The hostname to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @param localHost The address of the local interface to bind to.
+ * @param localPort The local port to bind to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ * @throws UnknownHostException If <i>host</i> cannot be resolved.
+ */
+ public abstract Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException, UnknownHostException;
+
+ /**
+ * Creates a socket connected to a given host on a given port.
+ *
+ * @param host The host address to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ */
+ public abstract Socket createSocket(InetAddress host, int port) throws IOException;
+
+ /**
+ * Creates a socket connected to a given host on a given port,
+ * connecting locally to the interface with the given address and port.
+ *
+ * @param host The host address to connect to.
+ * @param port The port on <i>host</i> to connect to.
+ * @param localHost The address of the local interface to bind to.
+ * @param localPort The local port to bind to.
+ * @return A socket connected to <i>host</i> on <i>port</i>.
+ * @throws IOException If a network error occurs.
+ */
+ public abstract Socket createSocket(InetAddress hast, int port, InetAddress localHost, int localPort) throws IOException;
+}
diff --git a/gnu/java/net/content/text/plain.java b/javax/net/VanillaServerSocketFactory.java
index a4ff3cd2f..e52ecba9e 100644
--- a/gnu/java/net/content/text/plain.java
+++ b/javax/net/VanillaServerSocketFactory.java
@@ -1,5 +1,5 @@
-/* plain.java -- Content Handler for text/plain type
- Copyright (C) 1998 Free Software Foundation, Inc.
+/* VanillaServerSocketFactory.java -- trivial socket factory.
+ Copyright (C) 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -7,7 +7,7 @@ GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
-
+
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
@@ -36,54 +36,47 @@ obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-package gnu.java.net.content.text;
+package javax.net;
-import java.net.ContentHandler;
-import java.net.URLConnection;
import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
/**
- * This class is the ContentHandler for the text/plain MIME type. It
- * simply returns an InputStream object of the text being read.
- *
- * @version 0.1
- *
- * @author Aaron M. Renn (arenn@urbanophile.com)
- */
-public class plain extends ContentHandler
+ * A trivial server socket factory.
+ */
+class VanillaServerSocketFactory extends ServerSocketFactory
{
-/*************************************************************************/
+ // Constructor.
+ // ------------------------------------------------------------------
-/*
- * Constructors
- */
+ VanillaServerSocketFactory()
+ {
+ super();
+ }
-/**
- * Default do nothing constructor
- */
-public
-plain()
-{
- ;
-}
+ // Instance methods.
+ // ------------------------------------------------------------------
-/*************************************************************************/
+ public ServerSocket createServerSocket() throws IOException
+ {
+ return new ServerSocket();
+ }
-/**
- * Returns an InputStream as the content for this object
- *
- * @param url_con The URLConnection to get the content of
- *
- * @return An InputStream for that connection
- *
- * @exception IOException If an error occurs
- */
-public Object
-getContent(URLConnection url_con) throws IOException
-{
- return(url_con.getInputStream());
-}
+ public ServerSocket createServerSocket(int port) throws IOException
+ {
+ return new ServerSocket(port);
+ }
-} // class plain
+ public ServerSocket createServerSocket(int port, int backlog) throws IOException
+ {
+ return new ServerSocket(port, backlog);
+ }
+ public ServerSocket createServerSocket(int port, int backlog, InetAddress bindAddress) throws IOException
+ {
+ return new ServerSocket(port, backlog, bindAddress);
+ }
+}
diff --git a/javax/net/VanillaSocketFactory.java b/javax/net/VanillaSocketFactory.java
new file mode 100644
index 000000000..ace849293
--- /dev/null
+++ b/javax/net/VanillaSocketFactory.java
@@ -0,0 +1,88 @@
+/* VanillaSocketFactory.java -- trivial socket factory.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+/**
+ * A trivial client socket factory.
+ */
+class VanillaSocketFactory extends SocketFactory
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ VanillaSocketFactory()
+ {
+ super();
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------
+
+ public Socket createSocket() throws IOException
+ {
+ return new Socket();
+ }
+
+ public Socket createSocket(String host, int port) throws IOException, UnknownHostException
+ {
+ return new Socket(host, port);
+ }
+
+ public Socket createSocket(String host, int port, InetAddress localAddr, int localPort) throws IOException, UnknownHostException
+ {
+ return new Socket(host, port, localAddr, localPort);
+ }
+
+ public Socket createSocket(InetAddress address, int port) throws IOException
+ {
+ return new Socket(address, port);
+ }
+
+ public Socket createSocket(InetAddress address, int port, InetAddress localAddr, int localPort) throws IOException
+ {
+ return new Socket(address, port, localAddr, localPort);
+ }
+}
diff --git a/javax/net/package.html b/javax/net/package.html
new file mode 100644
index 000000000..7d295da8e
--- /dev/null
+++ b/javax/net/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.net package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.net</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/net/ssl/HandshakeCompletedEvent.java b/javax/net/ssl/HandshakeCompletedEvent.java
new file mode 100644
index 000000000..6171ebc48
--- /dev/null
+++ b/javax/net/ssl/HandshakeCompletedEvent.java
@@ -0,0 +1,152 @@
+/* HandshakeCompletedEvent.java -- SSL handshake completed.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.Certificate;
+import javax.security.cert.X509Certificate;
+
+/**
+ * An event raised by a SSLSocket and passed to the {@link
+ * HandshakeCompletedListener#handshakeCompleted(HandshakeCompletedEvent)}
+ * method of all registered listeners when a SSL handshake in a SSL
+ * protocol is completed.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public class HandshakeCompletedEvent extends java.util.EventObject
+{
+
+ // Fields.
+ // -------------------------------------------------------------------
+
+ /** Serialization constant. */
+ private static final long serialVersionUID = 7914963744257769778L;
+
+ /** The session. */
+ private transient final SSLSession session;
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Creates a new handshake completed event.
+ *
+ * @param socket The socket (also the source) creating this event.
+ * @param session The associated session object.
+ * @throws NullPointerException If <i>session</i> is null.
+ */
+ public HandshakeCompletedEvent(SSLSocket socket, SSLSession session)
+ {
+ super(socket);
+ if (session == null)
+ throw new NullPointerException();
+ this.session = session;
+ }
+
+ // Instance methods.
+ // --------------------------------------------------------------------
+
+ /**
+ * Returns the name of the cipher that was negotiated in this
+ * connection.
+ *
+ * @return The negotiated cipher name.
+ */
+ public String getCipherSuite()
+ {
+ if (session != null)
+ return session.getCipherSuite();
+ return null;
+ }
+
+ /**
+ * Returns the local certificates being used in this connection.
+ *
+ * @return The local certificates.
+ */
+ public Certificate[] getLocalCertificates()
+ {
+ if (session != null)
+ return session.getLocalCertificates();
+ return null;
+ }
+
+ /**
+ * Returns the peer's certificates being used in this connection.
+ *
+ * @return The peer's certificates.
+ * @throws SSLPeerUnverifiedException If the peer has not been
+ * verified.
+ */
+ public Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException
+ {
+ if (session != null)
+ return session.getPeerCertificates();
+ return null;
+ }
+
+ public X509Certificate[] getPeerCertificateChain() throws SSLPeerUnverifiedException
+ {
+ if (session != null)
+ return session.getPeerCertificateChain();
+ return null;
+ }
+
+ /**
+ * Returns the SSL session object associated with this connection.
+ *
+ * @return The session object.
+ */
+ public SSLSession getSession()
+ {
+ return session;
+ }
+
+ /**
+ * Returns the socket over which this connection is being
+ * negotiated. This method is equivalent to the {@link
+ * java.util.EventObject#getSource()} method.
+ *
+ * @return The socket.
+ */
+ public SSLSocket getSocket()
+ {
+ return (SSLSocket) getSource();
+ }
+}
diff --git a/javax/net/ssl/HandshakeCompletedListener.java b/javax/net/ssl/HandshakeCompletedListener.java
new file mode 100644
index 000000000..5b79bf973
--- /dev/null
+++ b/javax/net/ssl/HandshakeCompletedListener.java
@@ -0,0 +1,57 @@
+/* HandshakeCompletedListener.java -- listens for handshake events.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An event listener that waits to be notified of {@link
+ * HandshakeCompletedEvent} objects created when handshake phase of
+ * the SSL protocol is completed for a particular connection.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public interface HandshakeCompletedListener extends java.util.EventListener
+{
+
+ /**
+ * Called when the handshake phase of the SSL protocol completes.
+ *
+ * @param event The event describing the new connection.
+ */
+ void handshakeCompleted(HandshakeCompletedEvent event);
+}
diff --git a/javax/net/ssl/HostnameVerifier.java b/javax/net/ssl/HostnameVerifier.java
new file mode 100644
index 000000000..a45648eff
--- /dev/null
+++ b/javax/net/ssl/HostnameVerifier.java
@@ -0,0 +1,64 @@
+/* HostnameVerifier.java -- verifies disparate hostnames.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * The interface for classes that perform hostname verification for cases
+ * when the hostname used to begin the connection (such as in a URL)
+ * does not match the hostname used in the SSL handshake.
+ * Implementations of this interface should provide an implementation
+ * of the {@link #verify(java.lang.String,javax.net.ssl.SSLSession)}
+ * method that accepts or rejects hostnames as appropriate.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public interface HostnameVerifier
+{
+
+ /**
+ * Verifies a hostname given a particular SSL session. This method
+ * should return <code>true</code> if the hostname is an accepted
+ * alias for the hostname negotiated in the SSL handshake.
+ *
+ * @param hostname The hostname in question.
+ * @param session The current SSL session.
+ * @return <code>true</code> if the hostname is acceptable.
+ */
+ boolean verify(String hostname, SSLSession session);
+}
diff --git a/javax/net/ssl/HttpsURLConnection.java b/javax/net/ssl/HttpsURLConnection.java
new file mode 100644
index 000000000..a7b86c184
--- /dev/null
+++ b/javax/net/ssl/HttpsURLConnection.java
@@ -0,0 +1,256 @@
+/* HttpsURLConnection.java -- an HTTPS connection.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.security.cert.Certificate;
+
+/**
+ * A URL connection that connects via the <i>Secure Socket Layer</i>
+ * (<b>SSL</b>) for HTTPS connections.
+ *
+ * <p>This class may be used in the same way as {@link
+ * HttpURLConnection}, and it will transparently negotiate the SSL
+ * connection.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public abstract class HttpsURLConnection extends HttpURLConnection
+{
+
+ // Fields.
+ // ------------------------------------------------------------------
+
+ /** The default verifier. */
+ private static HostnameVerifier defaultVerifier;
+
+ /** The default factory. */
+ private static SSLSocketFactory defaultFactory;
+
+ /**
+ * The hostname verifier used for this connection.
+ */
+ protected HostnameVerifier hostnameVerifier;
+
+ /**
+ * This connection's socket factory.
+ */
+ private SSLSocketFactory factory;
+
+ // Static initializer.
+ // ------------------------------------------------------------------
+
+ static {
+ defaultVerifier = new TrivialHostnameVerifier();
+ try
+ {
+ defaultFactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
+ }
+ catch (Throwable t)
+ {
+ t.printStackTrace();
+ }
+ }
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Creates a new HTTPS URL connection.
+ *
+ * @param url The URL of the connection being established.
+ * @throws IOException If the connection cannot be established.
+ */
+ protected HttpsURLConnection(URL url) throws IOException
+ {
+ super(url);
+ hostnameVerifier = defaultVerifier;
+ factory = defaultFactory;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Returns the default hostname verifier used in all new
+ * connections.
+ *
+ * @return The default hostname verifier.
+ */
+ public static HostnameVerifier getDefaultHostnameVerifier()
+ {
+ return defaultVerifier;
+ }
+
+ /**
+ * Sets the default hostname verifier to be used in all new
+ * connections.
+ *
+ * @param newDefault The new default hostname verifier.
+ * @throws IllegalArgumentException If <i>newDefault</i> is null.
+ * @throws SecurityException If there is a security manager
+ * currently installed and the caller does not have the {@link
+ * SSLPermission} "setHostnameVerifier".
+ */
+ public static void setDefaultHostnameVerifier(HostnameVerifier newDefault)
+ {
+ if (newDefault == null)
+ throw new IllegalArgumentException("default verifier cannot be null");
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission(new SSLPermission("setHostnameVerifier"));
+ defaultVerifier = newDefault;
+ }
+
+ /**
+ * Returns the default SSL socket factory used in all new
+ * connections.
+ *
+ * @return The default SSL socket factory.
+ */
+ public static SSLSocketFactory getDefaultSSLSocketFactory()
+ {
+ return defaultFactory;
+ }
+
+ /**
+ * Sets the default SSL socket factory to be used in all new
+ * connections.
+ *
+ * @param newDefault The new socket factory.
+ * @throws IllegalArgumentException If <i>newDefault</i> is null.
+ * @throws SecurityException If there is a security manager
+ * installed and a call to {@link
+ * SecurityManager#checkSetFactory()} fails.
+ */
+ public static void setDefaultSSLSocketFactory(SSLSocketFactory newDefault)
+ {
+ if (newDefault == null)
+ throw new IllegalArgumentException("default factory cannot be null");
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkSetFactory();
+ defaultFactory = newDefault;
+ }
+
+ // Instance methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Returns the current hostname verifier for this instance.
+ *
+ * @return The hostname verifier.
+ */
+ public HostnameVerifier getHostnameVerifier()
+ {
+ return hostnameVerifier;
+ }
+
+ /**
+ * Sets the hostname verifier for this instance.
+ *
+ * @param hostnameVerifier The new verifier.
+ * @throws IllegalArgumentException If <i>hostnameVerifier</i> is
+ * null.
+ */
+ public void setHostnameVerifier(HostnameVerifier hostnameVerifier)
+ {
+ if (hostnameVerifier == null)
+ throw new IllegalArgumentException("verifier cannot be null");
+ this.hostnameVerifier = hostnameVerifier;
+ }
+
+ /**
+ * Returns the current SSL socket factory for this instance.
+ *
+ * @return The current SSL socket factory.
+ */
+ public SSLSocketFactory getSSLSocketFactory()
+ {
+ return factory;
+ }
+
+ /**
+ * Sets the SSL socket factory for this instance.
+ *
+ * @param factory The new factory.
+ * @throws IllegalArgumentException If <i>factory</i> is null.
+ */
+ public void setSSLSocketFactory(SSLSocketFactory factory)
+ {
+ if (factory == null)
+ throw new IllegalArgumentException("factory cannot be null");
+ this.factory = factory;
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the cipher name negotiated for this connection.
+ *
+ * @return The cipher name.
+ * @throws IllegalStateException If the connection has not yet been
+ * established.
+ */
+ public abstract String getCipherSuite();
+
+ /**
+ * Returns the certificates used on the local side in this
+ * connection.
+ *
+ * @return The local certificates.
+ * @throws IllegalStateException If the connection has not yet been
+ * established.
+ */
+ public abstract Certificate[] getLocalCertificates();
+
+ /**
+ * Returns the certificates sent by the other party.
+ *
+ * @return The peer's certificates.
+ * @throws IllegalStateException If the connection has not yet been
+ * established.
+ * @throws SSLPeerUnverifiedException If the peer could not be
+ * verified.
+ */
+ public abstract Certificate[] getServerCertificates() throws SSLPeerUnverifiedException;
+}
diff --git a/javax/net/ssl/KeyManager.java b/javax/net/ssl/KeyManager.java
new file mode 100644
index 000000000..083f3f592
--- /dev/null
+++ b/javax/net/ssl/KeyManager.java
@@ -0,0 +1,51 @@
+/* KeyManager.java -- marker interface for key manager classes.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A marker interface for objects that serve as key managers in SSL
+ * communications. Key managers typically keep track of the public
+ * certificates and private keys when authenticating the local host to
+ * remote host, and thus is typically used in SSL servers.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public interface KeyManager
+{
+}
diff --git a/javax/net/ssl/KeyManagerFactory.java b/javax/net/ssl/KeyManagerFactory.java
new file mode 100644
index 000000000..a166f60aa
--- /dev/null
+++ b/javax/net/ssl/KeyManagerFactory.java
@@ -0,0 +1,281 @@
+/* KeyManagerFactory.java -- factory for key managers.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+import java.security.Security;
+import java.security.UnrecoverableKeyException;
+
+import gnu.java.security.Engine;
+
+/**
+ * A class that creates key manager implementations based on a
+ * requested algorithm.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public class KeyManagerFactory
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------
+
+ /** The service name for key manager factories. */
+ private static final String KEY_MANAGER_FACTORY = "KeyManagerFactory";
+
+ /** The system default trust manager algorithm. */
+ private static final String DEFAULT_ALGORITHM = "JessieX509";
+
+ /** The underlying engine. */
+ private final KeyManagerFactorySpi kmfSpi;
+
+ /** The provider of this implementation. */
+ private final Provider provider;
+
+ /** The name of this algorithm. */
+ private final String algorithm;
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Create a new key manager factory.
+ *
+ * @param kmfSpi The underlying engine.
+ * @param provider The engine's provider.
+ * @param algorithm The name of this algorithm.
+ */
+ protected KeyManagerFactory(KeyManagerFactorySpi kmfSpi,
+ Provider provider, String algorithm)
+ {
+ this.kmfSpi = kmfSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Get the default algorithm name. This value may be specified at
+ * run-time via the security property
+ * "ssl.KeyManagerFactory.algorithm". If this property is
+ * not specified, this method returns "JessieX509".
+ *
+ * @return The default key manager factory algorithm's name.
+ */
+ public static final String getDefaultAlgorithm()
+ {
+ String alg = null;
+ try
+ {
+ alg = (String) AccessController.doPrivileged(
+ new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty("ssl.KeyManagerFactory.algorithm");
+ }
+ }
+ );
+ }
+ catch (SecurityException se)
+ {
+ }
+ if (alg == null)
+ alg = DEFAULT_ALGORITHM;
+ return alg;
+ }
+
+ /**
+ * Get an instance of the named key manager factory, from the first
+ * provider that implements it.
+ *
+ * @param algorithm The type of key manager factory to get.
+ * @return An appropriate implementation of that algoritm.
+ * @throws NoSuchAlgorithmException If no provider implements the
+ * requested algorithm.
+ */
+ public static final KeyManagerFactory getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+
+ /**
+ * Get an instance of the named key manager factory, from the named
+ * provider.
+ *
+ * @param algorithm The type of key manager factory to get.
+ * @param provider The name of the provider to get the
+ * implementation from.
+ * @return An appropriate implementation of that algorithm.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the requested algorithm.
+ * @throws NoSuchProviderException If the named provider does not
+ * exist.
+ */
+ public static final KeyManagerFactory getInstance(String algorithm, String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("provider is null");
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ throw new NoSuchProviderException(provider);
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Get an instance of the named key manager factory, from the given
+ * provider.
+ *
+ * @param algorithm The type of key manager factory to get.
+ * @param provider The provider to get the implementation from.
+ * @return An appropriate implementation of that algorithm.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the requested algorithm.
+ * @throws IllegalArgumentException If <i>provider</i> is null.
+ */
+ public static final KeyManagerFactory getInstance(String algorithm, Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ if (provider == null)
+ throw new IllegalArgumentException("provider is null");
+ try
+ {
+ return new KeyManagerFactory((KeyManagerFactorySpi)
+ Engine.getInstance(KEY_MANAGER_FACTORY, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the name of this key manager factory algorithm.
+ *
+ * @return The name of this key manager factory algorithm.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Get an array of key managers appropriate for this algorithm, with
+ * the most preferred manager first.
+ *
+ * @return The array of key managers.
+ */
+ public final KeyManager[] getKeyManagers()
+ {
+ return kmfSpi.engineGetKeyManagers();
+ }
+
+ /**
+ * Returns the provider of this implementation.
+ *
+ * @return The provider of this implementation.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Initialize this instance with an implementation-dependent
+ * parameter object.
+ *
+ * @param params The parameters to initialize with.
+ * @throws InvalidAlgorithmParameterException If the specified
+ * parameters are inappropriate.
+ */
+ public final void init(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException
+ {
+ kmfSpi.engineInit(params);
+ }
+
+ /**
+ * Initialize this instance with a key store and a password for
+ * private key entries.
+ *
+ * @param store The key store to read.
+ * @param passwd The password protecting private keys in the store.
+ * @throws KeyStoreException If an error occurs reading the keys.
+ * @throws NoSuchAlgorithmException If an algorithm (such as a
+ * certificate algorithm) is not available.
+ * @throws UnrecoverableKeyException If the password is incorrect.
+ */
+ public final void init(KeyStore store, char[] passwd)
+ throws KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException
+ {
+ kmfSpi.engineInit(store, passwd);
+ }
+}
diff --git a/javax/net/ssl/KeyManagerFactorySpi.java b/javax/net/ssl/KeyManagerFactorySpi.java
new file mode 100644
index 000000000..3ed978f35
--- /dev/null
+++ b/javax/net/ssl/KeyManagerFactorySpi.java
@@ -0,0 +1,102 @@
+/* KeyManagerFactorySpi.java -- SPI for key manager factories.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for key manager
+ * factories.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public abstract class KeyManagerFactorySpi
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ public KeyManagerFactorySpi()
+ {
+ super();
+ }
+
+ // Abstract methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Engine method for retrieving this factory's key managers.
+ *
+ * @return The key managers.
+ */
+ protected abstract KeyManager[] engineGetKeyManagers();
+
+ /**
+ * Engine method for initializing this factory with some
+ * algorithm-specific parameters.
+ *
+ * @param params The factory parameters.
+ * @throws InvalidAlgorithmParameterException If the supplied parameters
+ * are inappropriate for this instance.
+ */
+ protected abstract void engineInit(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException;
+
+ /**
+ * Engine method for initializing this factory with a key store and a
+ * password for private keys. Either parameter may be <code>null</code>,
+ * in which case some default parameters (possibly derived from system
+ * properties) should be used.
+ *
+ * @param store The key store.
+ * @param passwd The private key password.
+ * @throws KeyStoreException If the key store cannot be accessed.
+ * @throws NoSuchAlgorithmException If some of the data from the key
+ * store cannot be retrieved.
+ * @throws UnrecoverableKeyException If a private key cannot be retrieved,
+ * likely from a wrong password.
+ */
+ protected abstract void engineInit(KeyStore store, char[] passwd)
+ throws KeyStoreException, NoSuchAlgorithmException,
+ UnrecoverableKeyException;
+}
diff --git a/javax/net/ssl/ManagerFactoryParameters.java b/javax/net/ssl/ManagerFactoryParameters.java
new file mode 100644
index 000000000..6d3e008de
--- /dev/null
+++ b/javax/net/ssl/ManagerFactoryParameters.java
@@ -0,0 +1,50 @@
+/* ManagerFactoryParameters.java -- marker interface for manager parameters.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A marker interface for classes that serve as key or trust manager
+ * parameters, used to initialize instances of {@link
+ * KeyManagerFactory} or {@link TrustManagerFactory}.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public interface ManagerFactoryParameters
+{
+}
diff --git a/javax/net/ssl/SSLContext.java b/javax/net/ssl/SSLContext.java
new file mode 100644
index 000000000..45e01c3c7
--- /dev/null
+++ b/javax/net/ssl/SSLContext.java
@@ -0,0 +1,269 @@
+/* SSLContext.java -- an SSL protocol context.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Provider;
+import java.security.SecureRandom;
+import java.security.Security;
+
+import gnu.java.security.Engine;
+
+/**
+ * A "meta-factory" for protocol-specific socket and server socket
+ * factories. This class serves as a clearinghouse for socket
+ * factories and cached session contexts for a particular protocol,
+ * such as SSLv3.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public class SSLContext
+{
+
+ // Constants and fields.
+ // ------------------------------------------------------------------
+
+ /** Service name for SSL contexts. */
+ private static final String SSL_CONTEXT = "SSLContext";
+
+ /** The underlying engine. */
+ private final SSLContextSpi ctxSpi;
+
+ /** The provider of the engine class. */
+ private final Provider provider;
+
+ /** The protocal name. */
+ private final String protocol;
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ /**
+ * Create a new SSL context.
+ *
+ * @param ctxSpi The context engine.
+ * @param provider The provider of the implementation.
+ * @param protocol The name of the SSL protocol.
+ */
+ protected SSLContext(SSLContextSpi ctxSpi, Provider provider,
+ String protocol)
+ {
+ this.ctxSpi = ctxSpi;
+ this.provider = provider;
+ this.protocol = protocol;
+ }
+
+ // Class methods.
+ // ------------------------------------------------------------------
+
+ /**
+ * Get an instance of a context for the specified protocol from the
+ * first provider that implements it.
+ *
+ * @param protocol The name of the protocol to get a context for.
+ * @return The new context.
+ * @throws NoSuchAlgorithm If no provider implements the given
+ * protocol.
+ */
+ public static final SSLContext getInstance(String protocol)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(protocol, provs[i]);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(protocol);
+ }
+
+ /**
+ * Get an instance of a context for the specified protocol from the
+ * named provider.
+ *
+ * @param protocol The name of the protocol to get a context for.
+ * @param provider The name of the provider to get the
+ * implementation from.
+ * @return The new context.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the given protocol.
+ * @throws NoSuchProviderException If the named provider does not
+ * exist.
+ * @throws IllegalArgumentException If <i>provider</i> is null.
+ */
+ public static final SSLContext getInstance(String protocol,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ if (provider == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(protocol, p);
+ }
+
+ /**
+ * Get an instance of a context for the specified protocol from the
+ * specified provider.
+ *
+ * @param protocol The name of the protocol to get a context for.
+ * @param provider The name of the provider to get the
+ * implementation from.
+ * @return The new context.
+ * @throws NoSuchAlgorithmException If the provider does not
+ * implement the given protocol.
+ * @throws IllegalArgumentException If <i>provider</i> is null.
+ */
+ public static final SSLContext getInstance(String protocol,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ try
+ {
+ return new SSLContext((SSLContextSpi)
+ Engine.getInstance(SSL_CONTEXT, protocol, provider),
+ provider, protocol);
+ }
+ catch (InvocationTargetException ite)
+ {
+ ite.printStackTrace();
+ throw new NoSuchAlgorithmException();
+ }
+ catch (ClassCastException cce)
+ {
+ cce.printStackTrace();
+ throw new NoSuchAlgorithmException();
+ }
+ }
+
+ // Instance methods.
+ // -----------------------------------------------------------------
+
+ /**
+ * Returns the set of SSL contexts available for client connections.
+ *
+ * @return The set of SSL contexts available for client connections.
+ */
+ public final SSLSessionContext getClientSessionContext()
+ {
+ return ctxSpi.engineGetClientSessionContext();
+ }
+
+ /**
+ * Returns the protocol name of this context.
+ *
+ * @return The protocol name of this context.
+ */
+ public final String getProtocol()
+ {
+ return protocol;
+ }
+
+ /**
+ * Returns the provider of this implementation.
+ *
+ * @return The provider of this implementation.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Returns the set of SSL contexts available for server connections.
+ *
+ * @return The set of SSL contexts available for server connections.
+ */
+ public final SSLSessionContext getServerSessionContext()
+ {
+ return ctxSpi.engineGetServerSessionContext();
+ }
+
+ /**
+ * Returns the factory for server SSL sockets.
+ *
+ * @return The factory for server SSL sockets.
+ */
+ public final SSLServerSocketFactory getServerSocketFactory()
+ {
+ return ctxSpi.engineGetServerSocketFactory();
+ }
+
+ /**
+ * Returns the factory for client SSL sockets.
+ *
+ * @return The factory for client SSL sockets.
+ */
+ public final SSLSocketFactory getSocketFactory()
+ {
+ return ctxSpi.engineGetSocketFactory();
+ }
+
+ /**
+ * Initializes this context and prepares it for producing socket
+ * factories. All of the parameters are optional; default values are
+ * used if left unspecified.
+ *
+ * @param keyManagers The set of key managers to use.
+ * @param trustManagers The set of trust managers to use.
+ * @param random A source of random bits to use.
+ * @throws KeyManagementException If initialization fails.
+ */
+ public final void init(KeyManager[] keyManagers,
+ TrustManager[] trustManagers,
+ SecureRandom random)
+ throws KeyManagementException
+ {
+ ctxSpi.engineInit(keyManagers, trustManagers, random);
+ }
+}
diff --git a/javax/net/ssl/SSLContextSpi.java b/javax/net/ssl/SSLContextSpi.java
new file mode 100644
index 000000000..ecac1cbc5
--- /dev/null
+++ b/javax/net/ssl/SSLContextSpi.java
@@ -0,0 +1,109 @@
+/* SSLContextSpi.java -- SPI for SSL contexts.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.KeyManagementException;
+import java.security.SecureRandom;
+
+/**
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for SSLContext
+ * objects.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public abstract class SSLContextSpi
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Create a new SSLContextSpi.
+ */
+ public SSLContextSpi()
+ {
+ super();
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------
+
+ /**
+ * Returns the set of SSL sessions available for client connections.
+ *
+ * @return The set of SSL sessions available for client connections.
+ */
+ protected abstract SSLSessionContext engineGetClientSessionContext();
+
+ /**
+ * Returns the set of SSL sessions available for server connections.
+ *
+ * @return The set of SSL sessions available for server connections.
+ */
+ protected abstract SSLSessionContext engineGetServerSessionContext();
+
+ /**
+ * Returns the SSL server socket factory.
+ *
+ * @return The SSL server socket factory.
+ */
+ protected abstract SSLServerSocketFactory engineGetServerSocketFactory();
+
+ /**
+ * Returns the SSL client socket factory.
+ *
+ * @return The SSL client socket factory.
+ */
+ protected abstract SSLSocketFactory engineGetSocketFactory();
+
+ /**
+ * Initialize this context with key and trust managers, and a source
+ * of randomness. All of the parameters are optional.
+ *
+ * @param keyManagers The set of key managers.
+ * @param trustManagers The set of trust managers.
+ * @param random The source of randomness.
+ * @throws KeyManagementException If this context cannot be
+ * initialized with these parameters.
+ */
+ protected abstract void engineInit(KeyManager[] keyManagers,
+ TrustManager[] trustManagers,
+ SecureRandom random)
+ throws KeyManagementException;
+}
diff --git a/javax/net/ssl/SSLException.java b/javax/net/ssl/SSLException.java
new file mode 100644
index 000000000..0a33b458f
--- /dev/null
+++ b/javax/net/ssl/SSLException.java
@@ -0,0 +1,59 @@
+/* SSLException.java -- generic SSL exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+
+/**
+ * The superclass of all possible SSL exceptions. Usually, a specific
+ * exception is thrown instead of this exception.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public class SSLException extends IOException
+{
+
+ // Constructor.
+ // ------------------------------------------------------------------
+
+ public SSLException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/net/ssl/SSLHandshakeException.java b/javax/net/ssl/SSLHandshakeException.java
new file mode 100644
index 000000000..c0f2c5cbb
--- /dev/null
+++ b/javax/net/ssl/SSLHandshakeException.java
@@ -0,0 +1,51 @@
+/* SSLHandshakeException.java -- exception in SSL handshake.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception that signals an error in the SSL handshake phase.
+ */
+public class SSLHandshakeException extends SSLException
+{
+
+ public SSLHandshakeException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/net/ssl/SSLKeyException.java b/javax/net/ssl/SSLKeyException.java
new file mode 100644
index 000000000..c60cac19f
--- /dev/null
+++ b/javax/net/ssl/SSLKeyException.java
@@ -0,0 +1,52 @@
+/* SSLKeyException.java -- exception in using a key in SSL.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception signaling a problem using a public or private key in
+ * an SSL communication.
+ */
+public class SSLKeyException extends SSLException
+{
+
+ public SSLKeyException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/net/ssl/SSLPeerUnverifiedException.java b/javax/net/ssl/SSLPeerUnverifiedException.java
new file mode 100644
index 000000000..1b3acbc24
--- /dev/null
+++ b/javax/net/ssl/SSLPeerUnverifiedException.java
@@ -0,0 +1,51 @@
+/* SSLPeerUnverifiedException.java -- unverified peer exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception thrown when the remote peer could not be verified.
+ */
+public class SSLPeerUnverifiedException extends SSLException
+{
+
+ public SSLPeerUnverifiedException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/net/ssl/SSLPermission.java b/javax/net/ssl/SSLPermission.java
new file mode 100644
index 000000000..3771eaf98
--- /dev/null
+++ b/javax/net/ssl/SSLPermission.java
@@ -0,0 +1,66 @@
+/* SSLPermission.java -- SSL permission class.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.BasicPermission;
+
+/**
+ * A permission used for accessing SSL classes.
+ */
+public class SSLPermission extends BasicPermission
+{
+
+ // Constant.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -3456898025505876775L;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public SSLPermission(String name)
+ {
+ super(name);
+ }
+
+ public SSLPermission(String name, String actions)
+ {
+ super(name, actions);
+ }
+}
diff --git a/javax/net/ssl/SSLProtocolException.java b/javax/net/ssl/SSLProtocolException.java
new file mode 100644
index 000000000..16a1457ab
--- /dev/null
+++ b/javax/net/ssl/SSLProtocolException.java
@@ -0,0 +1,53 @@
+/* SSLProtocolException.java -- exception in SSL protocol.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * An exception thrown when a fatal protocol error is encountered. This
+ * exception usually indicates some serious problem with the local or
+ * remote SSL implementation.
+ */
+public class SSLProtocolException extends SSLException
+{
+
+ public SSLProtocolException(String message)
+ {
+ super(message);
+ }
+}
diff --git a/javax/net/ssl/SSLServerSocket.java b/javax/net/ssl/SSLServerSocket.java
new file mode 100644
index 000000000..fee99f48e
--- /dev/null
+++ b/javax/net/ssl/SSLServerSocket.java
@@ -0,0 +1,188 @@
+/* SSLServerSocket.java -- a server socket for SSL connections.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+
+import java.net.InetAddress;
+import java.net.ServerSocket;
+
+/**
+ * A server socket that allows clients to connect via the SSL protocol.
+ */
+public abstract class SSLServerSocket extends ServerSocket
+{
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ protected SSLServerSocket() throws IOException
+ {
+ super();
+ //super(0);
+ //throw new UnsupportedOperationException("1.4 socket methods not enabled");
+ }
+
+ protected SSLServerSocket(int port) throws IOException
+ {
+ super(port);
+ }
+
+ protected SSLServerSocket(int port, int backlog) throws IOException
+ {
+ super(port, backlog);
+ }
+
+ protected SSLServerSocket(int port, int backlog, InetAddress bindAddress)
+ throws IOException
+ {
+ super(port, backlog, bindAddress);
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the list of cihper suites that are currently enabled in this
+ * server socket. Sockets accepted by this server socket will only have
+ * these suites enabled.
+ *
+ * @return The enabled cipher suites.
+ */
+ public abstract String[] getEnabledCipherSuites();
+
+ /**
+ * Sets the list enabled cipher suites.
+ *
+ * @param suites The cipher suites to enable.
+ */
+ public abstract void setEnabledCipherSuites(String[] suites);
+
+ /**
+ * Returns the list of enabled protocols, such as "SSLv3" and "TLSv1".
+ *
+ * @return The enabled protocols.
+ */
+ public abstract String[] getEnabledProtocols();
+
+ /**
+ * Sets the list of enabled protocols.
+ *
+ * @param protocols The list of protocols to enable.
+ */
+ public abstract void setEnabledProtocols(String[] protocols);
+
+ /**
+ * Returns whether or not sessions will be created, i.e., whether or not
+ * this server socket will allow SSL session resumption.
+ *
+ * @return True if sessions will be created.
+ */
+ public abstract boolean getEnableSessionCreation();
+
+ /**
+ * Sets whether or not sessions will be created.
+ *
+ * @param enabled The new enabled value.
+ */
+ public abstract void setEnableSessionCreation(boolean enabled);
+
+ /**
+ * Returns whether or not this server socket will require clients to
+ * authenticate themselves, such as through a certificate.
+ *
+ * @return True if clients must authenticate themselves.
+ */
+ public abstract boolean getNeedClientAuth();
+
+ /**
+ * Enabled or disables the requirement that clients authenticate themselves.
+ * When this is set to <code>true</code>, connections will be rejected if
+ * connecting clients do not provide proper authentication.
+ *
+ * @param needAuth The new need auth value.
+ */
+ public abstract void setNeedClientAuth(boolean needAuth);
+
+ /**
+ * Returns whether or not sockets accepted by this server socket will do
+ * their handshake as the client-side. The default is false.
+ *
+ * @return True if client mode will be used.
+ */
+ public abstract boolean getUseClientMode();
+
+ /**
+ * Sets whether or not sockets accepted by this server socket will be
+ * created in client mode.
+ *
+ * @param clientMode The new client mode value.
+ */
+ public abstract void setUseClientMode(boolean clientMode);
+
+ /**
+ * Returns whether or not this socket will ask for, but not require, that
+ * connecting clients authenticate themselves. Clients that do not
+ * provide authentication they will still be allowed to connect.
+ *
+ * @return True if this server socket wants client authentication.
+ */
+ public abstract boolean getWantClientAuth();
+
+ /**
+ * Sets whether or not this server socket will want client authentication.
+ *
+ * @param wantAuth The new want auth value.
+ */
+ public abstract void setWantClientAuth(boolean wantAuth);
+
+ /**
+ * Returns a list of cipher suites that this server socket supports.
+ *
+ * @return The list of supported suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+
+ /**
+ * Returns a list of SSL protocols supported by this server socket.
+ *
+ * @return The list of supported protocols.
+ */
+ public abstract String[] getSupportedProtocols();
+}
diff --git a/javax/net/ssl/SSLServerSocketFactory.java b/javax/net/ssl/SSLServerSocketFactory.java
new file mode 100644
index 000000000..ef82d1462
--- /dev/null
+++ b/javax/net/ssl/SSLServerSocketFactory.java
@@ -0,0 +1,172 @@
+/* SSLServerSocketFactory.java -- factory for SSL server sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.KeyStore;
+import java.security.Security;
+import javax.net.ServerSocketFactory;
+
+/**
+ * A server socket factory for <i>Secure Socket Layer</i> (<b>SSL</b>)
+ * server sockets.
+ */
+public abstract class SSLServerSocketFactory extends ServerSocketFactory
+{
+
+ // Field.
+ // -------------------------------------------------------------------------
+
+ private static SSLContext context;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ protected SSLServerSocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns a default implementation of a SSL server socket factory.
+ *
+ * <p>To control the class that gets returned by this method, set the
+ * security property "ssl.ServerSocketFactory.provider" to the class
+ * name of a concrete implementation of this class. If not set, a
+ * system-dependent implementation will be used.</p>
+ *
+ * <p>The implementation returned is created by the first implementation
+ * of the {@link SSLContext} class found, which is initialized with
+ * default parameters. To control the key and trust manager factory
+ * algorithms used as defaults, set the security properties
+ * "ssl.keyManagerFactory.algorithm" and "ssl.trustManagerFactory.algorithm"
+ * to the appropriate names.</p>
+ *
+ * <p>Using this method is not recommended. Instead, use the methods of
+ * {@link SSLContext}, which provide much better control over the
+ * creation of server socket factories.</p>
+ *
+ * @return The default server socket factory.
+ * @throws RuntimeException If no default can be created.
+ */
+ public static synchronized ServerSocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("ssl.ServerSocketFactory.provider");
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ if (s != null && cl != null)
+ {
+ return (ServerSocketFactory) cl.loadClass(s).newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ if (context == null)
+ {
+ KeyManager[] km = null;
+ TrustManager[] tm = null;
+
+ // 1. Determine which algorithms to use for the key and trust
+ // manager factories.
+ String kmAlg = KeyManagerFactory.getDefaultAlgorithm();
+ String tmAlg = TrustManagerFactory.getDefaultAlgorithm();
+ // 2. Try to initialize the factories with default parameters.
+ try
+ {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(kmAlg);
+ kmf.init(null, null);
+ km = kmf.getKeyManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+ try
+ {
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlg);
+ tmf.init((KeyStore) null);
+ tm = tmf.getTrustManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+
+ // 3. Create and initialize a context.
+ try
+ {
+ context = SSLContext.getInstance("SSLv3");
+ context.init(km, tm, null);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("error instantiating default server socket factory: "
+ + ex.toString());
+ }
+ }
+ try
+ {
+ return context.getServerSocketFactory();
+ }
+ catch (Exception e)
+ {
+ }
+ throw new RuntimeException("no SSLSocketFactory implementation available");
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the list of cipher suites that will be enabled in server sockets
+ * created by this factory.
+ *
+ * @return The default cipher suites.
+ */
+ public abstract String[] getDefaultCipherSuites();
+
+ /**
+ * Returns the list of all cipher suites supported by this factory.
+ *
+ * @return The list of supported cipher suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+}
diff --git a/javax/net/ssl/SSLSession.java b/javax/net/ssl/SSLSession.java
new file mode 100644
index 000000000..14797f083
--- /dev/null
+++ b/javax/net/ssl/SSLSession.java
@@ -0,0 +1,168 @@
+/* SSLSession.java -- an SSL session.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.Certificate;
+import javax.security.cert.X509Certificate;
+
+/**
+ * An SSL session is a mechanism through which connections can be established
+ * by re-using previously negotiated handshakes.
+ */
+public interface SSLSession
+{
+
+ /**
+ * Returns this session's cihper suite.
+ *
+ * @return The cipher suite.
+ */
+ String getCipherSuite();
+
+ /**
+ * Returns the time in milliseconds since midnight GMT, 1 January 1970, that
+ * this session was created.
+ *
+ * @return The creation time.
+ */
+ long getCreationTime();
+
+ /**
+ * Returns this session's unique identifier, a arbitrary byte array of up
+ * to 32 bytes.
+ *
+ * @return The session identifier.
+ */
+ byte[] getId();
+
+ /**
+ * Returns the last time this session was accessed.
+ *
+ * @return The lest time this session was accessed.
+ */
+ long getLastAccessedTime();
+
+ /**
+ * Returns the chain of certificates that the local side used in the
+ * handshake, or null if none were used.
+ *
+ * @return The local certificate chain.
+ */
+ Certificate[] getLocalCertificates();
+
+ /**
+ * Returns the chain of certificates that the remote side used in
+ * the handshake, or null if none were used.
+ *
+ * @return The peer's certificate chain.
+ * @throws SSLPeerUnverifiedException If the identity of the peer has
+ * not been verified.
+ */
+ Certificate[] getPeerCertificates() throws SSLPeerUnverifiedException;
+
+ /**
+ * Returns the chain of certificates that the remote side used in
+ * the handshake, or null if none were used.
+ *
+ * @return The peer's certificate chain.
+ * @throws SSLPeerUnverifiedException If the identity of the peer has
+ * not been verified.
+ */
+ X509Certificate[] getPeerCertificateChain()
+ throws SSLPeerUnverifiedException;
+
+ /**
+ * Returns the remote host's name.
+ *
+ * @return The name of the remote host.
+ */
+ String getPeerHost();
+
+ /**
+ * Returns the protocol this session uses.
+ *
+ * @return The protocol.
+ */
+ String getProtocol();
+
+ /**
+ * Returns this session's session context object.
+ *
+ * @return The session context.
+ * @throws SecurityException If the caller does not have the
+ * {@link SSLPermission} "getSessionContext".
+ */
+ SSLSessionContext getSessionContext();
+
+ /**
+ * Returns the names of all values bound to this session.
+ *
+ * @return The list of bound names.
+ */
+ String[] getValueNames();
+
+ /**
+ * Returns the object bound to the given name.
+ *
+ * @param name The name of the value to get.
+ * @return The object bound by that name, or null.
+ */
+ Object getValue(String name);
+
+ /**
+ * Invalidates this session, ensuring that it will not be continued by
+ * another socket.
+ */
+ void invalidate();
+
+ /**
+ * Binds a value to this session, with the given name.
+ *
+ * @param name The name to bind the object with.
+ * @param value The value to bind.
+ */
+ void putValue(String name, Object value);
+
+ /**
+ * Un-binds a value.
+ *
+ * @param name The name of the value to un-bind.
+ */
+ void removeValue(String name);
+}
diff --git a/javax/net/ssl/SSLSessionBindingEvent.java b/javax/net/ssl/SSLSessionBindingEvent.java
new file mode 100644
index 000000000..e0d27efa6
--- /dev/null
+++ b/javax/net/ssl/SSLSessionBindingEvent.java
@@ -0,0 +1,94 @@
+/* SSLSessionBindingEvent.java -- SSL binding event.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.util.EventObject;
+
+/**
+ * An event raised by {@link SSLSession} objects when objects are bound to
+ * them.
+ */
+public class SSLSessionBindingEvent extends EventObject
+{
+
+ // Fields.
+ // -------------------------------------------------------------------
+
+ private static final long serialVersionUID = 3989172637106345L;
+
+ private final String name;
+
+ // Constructor.
+ // -------------------------------------------------------------------
+
+ /**
+ * Creates a new binding event.
+ *
+ * @param session The session being bound to.
+ * @param name The name the object was bound under.
+ */
+ public SSLSessionBindingEvent(SSLSession session, String name)
+ {
+ super(session);
+ this.name = name;
+ }
+
+ // Instance methods.
+ // --------------------------------------------------------------------
+
+ /**
+ * Returns the name the object was bound under.
+ *
+ * @return The name.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Returns the session that the object was bound to.
+ *
+ * @return The session.
+ */
+ public SSLSession getSession()
+ {
+ return (SSLSession) getSource();
+ }
+}
diff --git a/javax/net/ssl/SSLSessionBindingListener.java b/javax/net/ssl/SSLSessionBindingListener.java
new file mode 100644
index 000000000..2e2432d4a
--- /dev/null
+++ b/javax/net/ssl/SSLSessionBindingListener.java
@@ -0,0 +1,65 @@
+/* SSLSessionBindingListener.java -- listener for SSL bindings.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.util.EventListener;
+
+/**
+ * An event listener interface that should be notified when it is bound or
+ * unbound to a {@link SSLSession}.
+ */
+public interface SSLSessionBindingListener extends EventListener
+{
+
+ /**
+ * This method is called of all objects when they are bound to an SSL
+ * session.
+ *
+ * @param event The binding event.
+ */
+ void valueBound(SSLSessionBindingEvent event);
+
+ /**
+ * This method is called of all objects when they are unbound to an SSL
+ * session.
+ *
+ * @param event The binding event.
+ */
+ void valueUnbound(SSLSessionBindingEvent event);
+}
diff --git a/javax/net/ssl/SSLSessionContext.java b/javax/net/ssl/SSLSessionContext.java
new file mode 100644
index 000000000..0cbdeed9d
--- /dev/null
+++ b/javax/net/ssl/SSLSessionContext.java
@@ -0,0 +1,103 @@
+/* SSLSessionContext.java -- collection of SSL sessions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.util.Enumeration;
+
+/**
+ * A collection of saved SSL sessions, with thier corresponding session
+ * IDs.
+ *
+ * @author Casey Marshall (rsdio@metastatic.org)
+ */
+public interface SSLSessionContext
+{
+
+ /**
+ * Returns an enumeration of all saved session IDs. Every element in
+ * the returned enumeration is a byte array.
+ *
+ * @return The session IDs.
+ */
+ Enumeration getIds();
+
+ /**
+ * Gets the session specified by its ID, or <code>null</code> if there
+ * is no session, or if it has expired.
+ *
+ * @param sessionId The ID of the session to get.
+ * @return The session, or <code>null</code>.
+ */
+ SSLSession getSession(byte[] sessionId);
+
+ /**
+ * Returns the maximum number of sessions that may be cached by this
+ * session context.
+ *
+ * @return The maximum number of sessions that may be cached.
+ */
+ int getSessionCacheSize();
+
+ /**
+ * Returns the period of time (in seconds) that a session may be cached
+ * for before becoming invalid.
+ *
+ * @return The time a session may be valid.
+ */
+ int getSessionTimeout();
+
+ /**
+ * Sets the maximum number of sessions that may be cached by this
+ * session context. A cache size of 0 means no limit.
+ *
+ * @param size The new cache size.
+ * @throws IllegalArgumentException If <code>size</code> is negative.
+ */
+ void setSessionCacheSize(int size);
+
+ /**
+ * Sets the period of time (in seconds) that a session may be cached
+ * for before becoming invalid. A timeout of 0 means that sessions
+ * never expire.
+ *
+ * @param seconds The new timeout.
+ * @throws IllegalArgumentException If <code>seconds</code> is negative.
+ */
+ void setSessionTimeout(int seconds);
+}
diff --git a/javax/net/ssl/SSLSocket.java b/javax/net/ssl/SSLSocket.java
new file mode 100644
index 000000000..8b943b9d6
--- /dev/null
+++ b/javax/net/ssl/SSLSocket.java
@@ -0,0 +1,229 @@
+/* SSLSocket.java -- an SSL client socket.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+
+/**
+ * A socket that communicates over the secure socket layer protocol.
+ */
+public abstract class SSLSocket extends Socket
+{
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ protected SSLSocket()
+ {
+ super();
+ }
+
+ protected SSLSocket(String host, int port)
+ throws IOException, UnknownHostException
+ {
+ super(host, port);
+ }
+
+ protected SSLSocket(InetAddress address, int port) throws IOException
+ {
+ super(address, port);
+ }
+
+ protected SSLSocket(String host, int port,
+ InetAddress localAddr, int localPort)
+ throws IOException, UnknownHostException
+ {
+ super(host, port, localAddr, localPort);
+ }
+
+ protected SSLSocket(InetAddress address, int port,
+ InetAddress localAddr, int localPort)
+ throws IOException
+ {
+ super(address, port, localAddr, localPort);
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Adds a handshake completed listener that wants to be notified when the
+ * SSL handshake completes.
+ *
+ * @param listener The listener to add.
+ */
+ public abstract void
+ addHandshakeCompletedListener(HandshakeCompletedListener listener);
+
+ /**
+ * Removes a handshake listener from this socket.
+ *
+ * @param listener The listener to remove.
+ */
+ public abstract void
+ removeHandshakeCompletedListener(HandshakeCompletedListener listener);
+
+ /**
+ * Returns the list of currently enabled cipher suites.
+ *
+ * @return The list of enabled cipher suites.
+ */
+ public abstract String[] getEnabledCipherSuites();
+
+ /**
+ * Sets the list of enabled cipher suites.
+ *
+ * @param suites The list of suites to enable.
+ */
+ public abstract void setEnabledCipherSuites(String[] suites);
+
+ /**
+ * Returns the list of enabled SSL protocols.
+ *
+ * @return The list of enabled protocols.
+ */
+ public abstract String[] getEnabledProtocols();
+
+ /**
+ * Sets the list of enabled SSL protocols.
+ *
+ * @param protocols The list of protocols to enable.
+ */
+ public abstract void setEnabledProtocols(String[] protocols);
+
+ /**
+ * Returns whether or not sessions will be created by this socket, and thus
+ * allow sessions to be continued later.
+ *
+ * @return Whether or not sessions will be created.
+ */
+ public abstract boolean getEnableSessionCreation();
+
+ /**
+ * Sets whether or not sessions will be created by this socket.
+ *
+ * @param enable The new value.
+ */
+ public abstract void setEnableSessionCreation(boolean enable);
+
+ /**
+ * Returns whether or not this socket will require connecting clients to
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @return Whether or not this socket requires client authentication.
+ */
+ public abstract boolean getNeedClientAuth();
+
+ /**
+ * Sets whether or not this socket will require connecting clients to
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @param needAuth The new need auth value.
+ */
+ public abstract void setNeedClientAuth(boolean needAuth);
+
+ /**
+ * Returns this socket's session object.
+ *
+ * @return The session.
+ */
+ public abstract SSLSession getSession();
+
+ /**
+ * Returns the list of cipher suites supported by this socket.
+ *
+ * @return The list of supported cipher suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+
+ /**
+ * Returns the list of protocols supported by this socket.
+ *
+ * @return The list of supported protocols.
+ */
+ public abstract String[] getSupportedProtocols();
+
+ /**
+ * Returns whether or not this socket will connect in client mode.
+ *
+ * @return True if this is a client socket.
+ */
+ public abstract boolean getUseClientMode();
+
+ /**
+ * Sets whether or not this socket will connect in client mode.
+ *
+ * @param clientMode The new value.
+ */
+ public abstract void setUseClientMode(boolean clientMode);
+
+ /**
+ * Returns whether or not this socket will request that connecting clients
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @return The want client auth value.
+ */
+ public abstract boolean getWantClientAuth();
+
+ /**
+ * Sets whether or not this socket will request that connecting clients
+ * authenticate themselves. This value only applies to sockets in server
+ * mode.
+ *
+ * @param wantAuth The new want auth value.
+ */
+ public abstract void setWantClientAuth(boolean wantAuth);
+
+ /**
+ * Explicitly begins the handshake, or, if the handshake has already
+ * completed, requests that the handshake be repeated.
+ *
+ * <p>The handshake will begin implicitly when any attempt to read or
+ * write to the socket is made.</p>
+ *
+ * @throws IOException If an I/O or SSL error occurs.
+ */
+ public abstract void startHandshake() throws IOException;
+}
diff --git a/javax/net/ssl/SSLSocketFactory.java b/javax/net/ssl/SSLSocketFactory.java
new file mode 100644
index 000000000..181ab18a1
--- /dev/null
+++ b/javax/net/ssl/SSLSocketFactory.java
@@ -0,0 +1,192 @@
+/* SSLSocketFactory.java -- factory for SSL client sockets.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.io.IOException;
+import java.net.Socket;
+import java.security.AccessController;
+import java.security.KeyStore;
+import java.security.PrivilegedAction;
+import java.security.Security;
+import javax.net.SocketFactory;
+
+/**
+ * A socket factory for creating <i>Secure Socket Layer</i> (<b>SSL</b>)
+ * sockets.
+ */
+public abstract class SSLSocketFactory extends SocketFactory
+{
+
+ // Constants.
+ // -------------------------------------------------------------------------
+
+ private static SSLContext context;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public SSLSocketFactory()
+ {
+ super();
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns a default implementation of a SSL socket factory.
+ *
+ * <p>To control the class that gets returned by this method, set the
+ * security property "ssl.SocketFactory.provider" to the class
+ * name of a concrete implementation of this class. If not set, a
+ * system-dependent implementation will be used.</p>
+ *
+ * <p>The implementation returned is created by the first implementation
+ * of the {@link SSLContext} class found, which is initialized with
+ * default parameters. To control the key and trust manager factory
+ * algorithms used as defaults, set the security properties
+ * "ssl.keyManagerFactory.algorithm" and "ssl.trustManagerFactory.algorithm"
+ * to the appropriate names.</p>
+ *
+ * <p>Using this method is not recommended. Instead, use the methods of
+ * {@link SSLContext}, which provide much better control over the
+ * creation of socket factories.</p>
+ *
+ * @return The default socket factory.
+ * @throws RuntimeException If no default can be created.
+ */
+ public static synchronized SocketFactory getDefault()
+ {
+ try
+ {
+ String s = Security.getProperty("ssl.SocketFactory.provider");
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ if (s != null && cl != null)
+ {
+ return (SocketFactory) cl.loadClass(s).newInstance();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ if (context == null)
+ {
+ KeyManager[] km = null;
+ TrustManager[] tm = null;
+
+ // 1. Determine which algorithms to use for the key and trust
+ // manager factories.
+ String kmAlg = KeyManagerFactory.getDefaultAlgorithm();
+ String tmAlg = TrustManagerFactory.getDefaultAlgorithm();
+
+ // 2. Try to initialize the factories with default parameters.
+ try
+ {
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance(kmAlg);
+ kmf.init(null, null);
+ km = kmf.getKeyManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+ try
+ {
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance(tmAlg);
+ tmf.init((KeyStore) null);
+ tm = tmf.getTrustManagers();
+ }
+ catch (Exception ex)
+ {
+ }
+
+ // 3. Create and initialize a context.
+ try
+ {
+ context = SSLContext.getInstance("SSLv3");
+ context.init(km, tm, null);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("error instantiating default socket factory: "
+ + ex.toString());
+ }
+ }
+ try
+ {
+ return context.getSocketFactory();
+ }
+ catch (Exception e)
+ {
+ }
+ throw new RuntimeException("no SSLSocketFactory implementation available");
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates a SSL socket wrapped around an existing socket.
+ *
+ * @param socket The socket to wrap.
+ * @param host The host the socket is connected to.
+ * @param port The port the socket is connected to.
+ * @param autoClose Whether or not the wrapped socket should be closed
+ * automatically.
+ * @return The new SSL socket.
+ * @throws IOException If the socket could not be created.
+ */
+ public abstract Socket createSocket(Socket socket, String host,
+ int port, boolean autoClose)
+ throws IOException;
+
+ /**
+ * Returns the list of cipher suites that will be enabled in sockets
+ * created by this factory.
+ *
+ * @return The default cipher suites.
+ */
+ public abstract String[] getDefaultCipherSuites();
+
+ /**
+ * Returns the list of all cipher suites supported by this factory.
+ *
+ * @return The list of supported cipher suites.
+ */
+ public abstract String[] getSupportedCipherSuites();
+}
diff --git a/javax/net/ssl/TrivialHostnameVerifier.java b/javax/net/ssl/TrivialHostnameVerifier.java
new file mode 100644
index 000000000..e4e2befc0
--- /dev/null
+++ b/javax/net/ssl/TrivialHostnameVerifier.java
@@ -0,0 +1,51 @@
+/* TrivialHostnameVerifier.java -- non-verifing verifier.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A hostname verifier that always rejects mismatched hostnames.
+ */
+class TrivialHostnameVerifier implements HostnameVerifier
+{
+
+ public boolean verify(String hostname, SSLSession session)
+ {
+ return false;
+ }
+}
diff --git a/javax/net/ssl/TrustManager.java b/javax/net/ssl/TrustManager.java
new file mode 100644
index 000000000..f90629ab4
--- /dev/null
+++ b/javax/net/ssl/TrustManager.java
@@ -0,0 +1,47 @@
+/* TrustManager.java -- marker interface for trust managers.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+/**
+ * A marker interface for classes that establish the trust of remote
+ * hosts.
+ */
+public interface TrustManager
+{
+}
diff --git a/javax/net/ssl/TrustManagerFactory.java b/javax/net/ssl/TrustManagerFactory.java
new file mode 100644
index 000000000..84059c896
--- /dev/null
+++ b/javax/net/ssl/TrustManagerFactory.java
@@ -0,0 +1,279 @@
+/* TrustManagerFactory.java -- factory for trust managers.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.lang.reflect.InvocationTargetException;
+
+import java.security.AccessController;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PrivilegedAction;
+import java.security.Provider;
+import java.security.Security;
+
+import gnu.java.security.Engine;
+
+/**
+ * A factory for creating trust manager objects.
+ */
+public class TrustManagerFactory
+{
+
+ // Constants and fields.
+ // -------------------------------------------------------------------------
+
+ /** The service name for trust manager factories. */
+ private static final String TRUST_MANAGER_FACTORY = "TrustManagerFactory";
+
+ /** The system default trust manager algorithm. */
+ private static final String DEFAULT_ALGORITHM = "JessieX509";
+
+ /** The underlying engine class. */
+ private final TrustManagerFactorySpi tmfSpi;
+
+ /** The provider of the engine class. */
+ private final Provider provider;
+
+ /** The name of this trust manager algorithm. */
+ private final String algorithm;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates a new trust manager factory.
+ *
+ * @param tmfSpi The underlying engine class.
+ * @param provider The provider of the engine class.
+ * @param algorithm The trust manager algorithm name.
+ */
+ protected TrustManagerFactory(TrustManagerFactorySpi tmfSpi,
+ Provider provider, String algorithm)
+ {
+ this.tmfSpi = tmfSpi;
+ this.provider = provider;
+ this.algorithm = algorithm;
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns an instance of a trust manager factory for the given algorithm
+ * from the first provider that implements it.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @return The instance of the trust manager factory.
+ * @throws NoSuchAlgorithmException If no provider implements the given
+ * algorithm.
+ */
+ public static final TrustManagerFactory getInstance(String algorithm)
+ throws NoSuchAlgorithmException
+ {
+ Provider[] provs = Security.getProviders();
+ for (int i = 0; i < provs.length; i++)
+ {
+ try
+ {
+ return getInstance(algorithm, provs[i]);
+ }
+ catch (NoSuchAlgorithmException ignore)
+ {
+ }
+ }
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+
+ /**
+ * Returns an instance of a trust manager factory for the given algorithm
+ * from the named provider.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @param provider The name of the provider to get the instance from.
+ * @return The instance of the trust manager factory.
+ * @throws NoSuchAlgorithmException If the provider does not implement the
+ * given algorithm.
+ * @throws NoSuchProviderException If there is no such named provider.
+ * @throws IllegalArgumentException If the provider argument is null.
+ */
+ public static final TrustManagerFactory getInstance(String algorithm,
+ String provider)
+ throws NoSuchAlgorithmException, NoSuchProviderException
+ {
+ if (provider == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ Provider p = Security.getProvider(provider);
+ if (p == null)
+ {
+ throw new NoSuchProviderException(provider);
+ }
+ return getInstance(algorithm, p);
+ }
+
+ /**
+ * Returns an instance of a trust manager factory for the given algorithm
+ * from the specified provider.
+ *
+ * @param algorithm The name of the algorithm to get.
+ * @param provider The provider to get the instance from.
+ * @return The instance of the trust manager factory.
+ * @throws NoSuchAlgorithmException If the provider does not implement the
+ * given algorithm.
+ * @throws IllegalArgumentException If the provider argument is null.
+ */
+ public static final TrustManagerFactory getInstance(String algorithm,
+ Provider provider)
+ throws NoSuchAlgorithmException
+ {
+ if (provider == null)
+ {
+ throw new IllegalArgumentException();
+ }
+ try
+ {
+ return new TrustManagerFactory((TrustManagerFactorySpi)
+ Engine.getInstance(TRUST_MANAGER_FACTORY, algorithm, provider),
+ provider, algorithm);
+ }
+ catch (InvocationTargetException ite)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ catch (ClassCastException cce)
+ {
+ throw new NoSuchAlgorithmException(algorithm);
+ }
+ }
+
+ /**
+ * Returns the default algorithm for trust manager factories. The value
+ * returned is either the value of the security property
+ * "ssl.TrustManagerFactory.algorithm" if it is set, or the value "JessieX509"
+ * if not.
+ *
+ * @return The default algorithm name.
+ * @see Security.getProperty(java.lang.String)
+ */
+ public static final String getDefaultAlgorithm()
+ {
+ String alg = null;
+ try
+ {
+ alg = (String) AccessController.doPrivileged(
+ new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty("ssl.TrustManagerFactory.algorithm");
+ }
+ }
+ );
+ }
+ catch (SecurityException se)
+ {
+ }
+ if (alg == null)
+ alg = DEFAULT_ALGORITHM;
+ return alg;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the name of this trust manager algorithm.
+ *
+ * @return The algorithm name.
+ */
+ public final String getAlgorithm()
+ {
+ return algorithm;
+ }
+
+ /**
+ * Returns the provider of the underlying implementation.
+ *
+ * @return The provider.
+ */
+ public final Provider getProvider()
+ {
+ return provider;
+ }
+
+ /**
+ * Returns the trust managers created by this factory.
+ *
+ * @return The trust managers.
+ */
+ public final TrustManager[] getTrustManagers()
+ {
+ return tmfSpi.engineGetTrustManagers();
+ }
+
+ /**
+ * Initialize this instance with some algorithm-specific parameters.
+ *
+ * @param params The parameters.
+ * @throws InvalidAlgorithmParameterException If the supplied parameters
+ * are inappropriate for this instance.
+ */
+ public final void init(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException
+ {
+ tmfSpi.engineInit(params);
+ }
+
+ /**
+ * Initialize this instance with a key store. The key store may be null,
+ * in which case a default will be used.
+ *
+ * @param store The key store.
+ * @throws KeyStoreException If there is a problem reading from the
+ * key store.
+ */
+ public final void init(KeyStore store) throws KeyStoreException
+ {
+ tmfSpi.engineInit(store);
+ }
+}
diff --git a/javax/net/ssl/TrustManagerFactorySpi.java b/javax/net/ssl/TrustManagerFactorySpi.java
new file mode 100644
index 000000000..389e02325
--- /dev/null
+++ b/javax/net/ssl/TrustManagerFactorySpi.java
@@ -0,0 +1,88 @@
+/* TrustManagerFactorySpi.java -- SPI for trust manager factories.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.InvalidAlgorithmParameterException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+
+/**
+ * The <i>service provider interface</i> (<b>SPI</b>) for trust managers.
+ */
+public abstract class TrustManagerFactorySpi
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public TrustManagerFactorySpi()
+ {
+ super();
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Engine method that returns the trust managers created by this factory.
+ *
+ * @return The trust managers.
+ */
+ protected abstract TrustManager[] engineGetTrustManagers();
+
+ /**
+ * Engine method that initializes this factory with some algorithm-specific
+ * parameters.
+ *
+ * @param params The parameters.
+ * @throws InvalidAlgorithmParameterException If the given parameters are
+ * inappropriate.
+ */
+ protected abstract void engineInit(ManagerFactoryParameters params)
+ throws InvalidAlgorithmParameterException;
+
+ /**
+ * Engine method that initializes this factory with a key store. The key
+ * store parameter may be null, in which case some default should be used.
+ *
+ * @param store The key store.
+ * @throws KeyStoreException If a problem occurs reading from the key store.
+ */
+ protected abstract void engineInit(KeyStore store) throws KeyStoreException;
+}
diff --git a/javax/net/ssl/X509KeyManager.java b/javax/net/ssl/X509KeyManager.java
new file mode 100644
index 000000000..d5c00b62c
--- /dev/null
+++ b/javax/net/ssl/X509KeyManager.java
@@ -0,0 +1,108 @@
+/* X509KeyManager.java -- X.509 key manager interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.net.Socket;
+
+import java.security.Principal;
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+
+/**
+ * A key manager for X.509 certificates and their associated private keys.
+ */
+public interface X509KeyManager extends KeyManager
+{
+
+ /**
+ * Choose an alias for client-side authentication.
+ *
+ * @param keyTypes A list of acceptable key types.
+ * @param issuers A list of acceptable certificate issuers.
+ * @param socket The connecting socket.
+ * @return The chosen alias.
+ */
+ String chooseClientAlias(String[] keyTypes, Principal[] issuers,
+ Socket socket);
+
+ /**
+ * Choose an alias for server-side authentication.
+ *
+ * @param keyType The desired certificate type.
+ * @param issuers A list of acceptable certificate issuers.
+ * @param socket The connecting socket.
+ * @return The chosen alias.
+ */
+ String chooseServerAlias(String keyType, Principal[] issuers,
+ Socket socket);
+
+ /**
+ * Gets the X.509 certificate chain associated with the given alias.
+ *
+ * @param alias The alias.
+ * @return The certificate chain.
+ */
+ X509Certificate[] getCertificateChain(String alias);
+
+ /**
+ * Returns all client aliases that support the given key type.
+ *
+ * @param keyType The desired key type.
+ * @param issuers A list of acceptable certificate issuers.
+ * @return The (possibly empty) list of aliases.
+ */
+ String[] getClientAliases(String keyType, Principal[] issuers);
+
+ /**
+ * Gets the private key associated with the given alias.
+ *
+ * @param alias The alias.
+ * @return The private key.
+ */
+ PrivateKey getPrivateKey(String alias);
+
+ /**
+ * Returns all server aliases that support the given key type.
+ *
+ * @param keyType The desired key type.
+ * @param issuers A list of acceptable certificate issuers.
+ * @return The (possibly empty) list of aliases.
+ */
+ String[] getServerAliases(String keyType, Principal[] issuers);
+}
diff --git a/javax/net/ssl/X509TrustManager.java b/javax/net/ssl/X509TrustManager.java
new file mode 100644
index 000000000..b63e0a830
--- /dev/null
+++ b/javax/net/ssl/X509TrustManager.java
@@ -0,0 +1,76 @@
+/* X509TrustManager.java -- X.509 trust manager interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+/**
+ * A trust manager for dealing with X.509 certificates.
+ */
+public interface X509TrustManager extends TrustManager
+{
+
+ /**
+ * Checks if a certificate chain sent by the client is trusted.
+ *
+ * @param chain The certificate chain to check.
+ * @param authType The authentication type.
+ * @throws CertificateException If the client's certificates are not trusted.
+ */
+ void checkClientTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException;
+
+ /**
+ * Checks if a certificate chain sent by the server is trusted.
+ *
+ * @param chain The certificate chain to check.
+ * @param authType The authentication type.
+ * @throws CertificateException If the server's certificates are not trusted.
+ */
+ void checkServerTrusted(X509Certificate[] chain, String authType)
+ throws CertificateException;
+
+ /**
+ * Returns the list of trusted issuer certificates currently in use.
+ *
+ * @return The list of trusted issuer certificates.
+ */
+ X509Certificate[] getAcceptedIssuers();
+}
diff --git a/javax/net/ssl/package.html b/javax/net/ssl/package.html
new file mode 100644
index 000000000..a2edfc44a
--- /dev/null
+++ b/javax/net/ssl/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.net.ssl package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.net.ssl</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/rmi/CORBA/Stub.java b/javax/rmi/CORBA/Stub.java
index 0ea10c9ee..9e0edc847 100644
--- a/javax/rmi/CORBA/Stub.java
+++ b/javax/rmi/CORBA/Stub.java
@@ -50,6 +50,11 @@ import java.rmi.RemoteException;
public abstract class Stub extends ObjectImpl
implements Serializable
{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = 1087775603798577179L;
+
private transient StubDelegate delegate;
protected Stub()
diff --git a/javax/security/auth/AuthPermission.java b/javax/security/auth/AuthPermission.java
new file mode 100644
index 000000000..b4ffa15a9
--- /dev/null
+++ b/javax/security/auth/AuthPermission.java
@@ -0,0 +1,146 @@
+/* AuthPermission.java -- permissions related to authentication.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+import java.security.BasicPermission;
+
+/**
+ * <p>A permission controlling access to authentication service. The
+ * <i>actions</i> field of auth permission objects is ignored; the whole
+ * of the permission is defined by the <i>target</i>.</p>
+ *
+ * <p>The authentication permission targets recognized are:</p>
+ *
+ * <dl>
+ * <dt><code>doAs</code></dt>
+ *
+ * <dd><p>Allows access to the {@link
+ * Subject#doAs(javax.security.auth.Subject java.security.PrivilegedAction)}
+ * methods.</p></dd>
+ *
+ * <dt><code>doAsPrivileged</code></dt>
+ *
+ * <dd><p>Allows access to the {@link
+ * Subject#doAsPrivileged(javax.security.auth.Subject,
+ * java.security.PrivilegedAction, java.security.AccessControlContext)}
+ * methods.</p></dd>
+ *
+ * <dt><code>getSubject</code></dt>
+ *
+ * <dd><p>Allows access to the {@link Subject} associated with a
+ * thread.</p></dd>
+ *
+ * <dt><code>getSubjectFromDomainCombiner</code></dt>
+ *
+ * <dd><p>Allows access to the {@link Subject} associated with a
+ * {@link SubjectDomainCombiner}.</p></dd>
+ *
+ * <dt><code>setReadOnly</code></dt>
+ *
+ * <dd><p>Allows a {@link Subject} to be marked as read-only.</p></dd>
+ *
+ * <dt><code>modifyPrincipals</code></dt>
+ *
+ * <dd><p>Allows the set of principals of a subject to be modified.</p></dd>
+ *
+ * <dt><code>modifyPublicCredentials</code></dt>
+ *
+ * <dd><p>Allows the set of public credentials of a subject to be
+ * modified.</p></dd>
+ *
+ * <dt><code>modifyPrivateCredentials</code></dt>
+ *
+ * <dd><p>Allows the set of private credentials of a subject to be
+ * modified.</p></dd>
+ *
+ * <dt><code>refreshCredential</code></dt>
+ *
+ * <dd><p>Allows a {@link Refreshable} credential to be refreshed.</p></dd>
+ *
+ * <dt><code>destroyCredential</code></dt>
+ *
+ * <dd><p>Allows a {@link Destroyable} credential to be destroyed.</p></dd>
+ *
+ * <dt><code>createLoginContext.<i>name</i></code></dt>
+ *
+ * <dd><p>Allows a {@link javax.security.auth.login.LoginContext} for the
+ * given <i>name</i>. <i>name</i> can also be a wildcard (<code>'*'</code>),
+ * which allows the creation of a context with any name.</p></dd>
+ *
+ * <dt><code>getLoginConfiguration</code></dt>
+ *
+ * <dd><p>Allows the system-wide login {@link
+ * javax.security.auth.login.Configuration} to be retrieved.</p></dd>
+ *
+ * <dt><code>setLoginConfiguration</code></dt>
+ *
+ * <dd><p>Allows the system-wide login {@link
+ * javax.security.auth.login.Configuration} to be set.</p></dd>
+ *
+ * <dt><code>refreshLoginConfiguration</code></dt>
+ *
+ * <dd><p>Allows the system-wide login {@link
+ * javax.security.auth.login.Configuration} to be refreshed.</p></dd>
+ * </dl>
+ */
+public final class AuthPermission extends BasicPermission
+{
+
+ /**
+ * Creates a new authentication permission for the given target name.
+ *
+ * @param name The target name.
+ */
+ public AuthPermission (String name)
+ {
+ super (name);
+ }
+
+ /**
+ * Creates a new authentication permission for the given target name.
+ * The actions list is not used by this class.
+ *
+ * @param name The target name.
+ * @param actions The action list.
+ */
+ public AuthPermission (String name, String actions)
+ {
+ super (name, actions);
+ }
+}
diff --git a/javax/security/auth/DestroyFailedException.java b/javax/security/auth/DestroyFailedException.java
new file mode 100644
index 000000000..00bbd8966
--- /dev/null
+++ b/javax/security/auth/DestroyFailedException.java
@@ -0,0 +1,67 @@
+/* DestroyFailedException.java -- signals an object could not be destroyed.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+/**
+ * An exception thrown when the {@link Destroyable#destroy()} method
+ * fails for a credential.
+ *
+ * @see Destroyable
+ */
+public class DestroyFailedException extends Exception
+{
+
+ /**
+ * Creates a new DestroyFailedException with no detail message.
+ */
+ public DestroyFailedException()
+ {
+ super();
+ }
+
+ /**
+ * Creates a new DestroyFailedException with a detail message.
+ *
+ * @param message The detail message.
+ */
+ public DestroyFailedException (String message)
+ {
+ super (message);
+ }
+}
diff --git a/javax/security/auth/Destroyable.java b/javax/security/auth/Destroyable.java
new file mode 100644
index 000000000..484bece8d
--- /dev/null
+++ b/javax/security/auth/Destroyable.java
@@ -0,0 +1,64 @@
+/* Destroyable.java -- an immutable object that may be destroyed.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+/**
+ * An interface for objects that are immutable but whose sensitive
+ * data may be wiped out.
+ */
+public interface Destroyable
+{
+
+ /**
+ * Destroy this object, clearing all sensitive fields appropriately.
+ *
+ * @throws DestroyFailedException If this object could not be
+ * destroyed.
+ * @throws SecurityException If the caller does not have permission
+ * to destroy this object.
+ */
+ void destroy() throws DestroyFailedException;
+
+ /**
+ * Tells whether or not this object has been destroyed.
+ *
+ * @return True if this object has been destroyed.
+ */
+ boolean isDestroyed();
+}
diff --git a/javax/security/auth/Policy.java b/javax/security/auth/Policy.java
new file mode 100644
index 000000000..2234d8573
--- /dev/null
+++ b/javax/security/auth/Policy.java
@@ -0,0 +1,79 @@
+/* Policy.java -- deprecated precursor to java.security.Policy.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+import java.security.CodeSource;
+import java.security.PermissionCollection;
+
+/**
+ * @deprecated The classes java.security.Policy and
+ * java.security.ProtectionDomain provide the functionality of this class.
+ */
+public abstract class Policy
+{
+
+ private static Policy policy;
+
+ protected Policy()
+ {
+ }
+
+ public static synchronized Policy getPolicy()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("getPolicy"));
+ }
+ return policy;
+ }
+
+ public static synchronized void setPolicy (Policy p)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("setPolicy"));
+ }
+ policy = p;
+ }
+
+ public abstract PermissionCollection getPermissions (Subject subject, CodeSource source);
+ public abstract void refresh();
+}
diff --git a/javax/security/auth/PrivateCredentialPermission.java b/javax/security/auth/PrivateCredentialPermission.java
new file mode 100644
index 000000000..cc370ae17
--- /dev/null
+++ b/javax/security/auth/PrivateCredentialPermission.java
@@ -0,0 +1,326 @@
+/* PrivateCredentialPermission.java -- permissions governing private credentials.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+import java.io.Serializable;
+
+import java.security.Permission;
+import java.security.PermissionCollection;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ * A permission governing access to a private credential. The action of this
+ * permission is always "read" -- meaning that the private credential
+ * information can be read from an object.
+ *
+ * <p>The target of this permission is formatted as follows:</p>
+ *
+ * <p><code>CredentialClassName ( PrinicpalClassName PrincipalName )*</code></p>
+ *
+ * <p><i>CredentialClassName</i> is either the name of a private credential
+ * class name, or a wildcard character (<code>'*'</code>).
+ * <i>PrinicpalClassName</i> is the class name of a principal object, and
+ * <i>PrincipalName</i> is a string representing the principal, or the
+ * wildcard character.</p>
+ */
+public class PrivateCredentialPermission extends Permission
+ implements Serializable
+{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = 5284372143517237068L;
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial The credential class name.
+ */
+ private final String credentialClass;
+
+ /**
+ * @serial The principals, a set of CredOwner objects (an undocumented
+ * inner class of this class).
+ */
+ private final Set principals;
+
+ /**
+ * @serial Who knows?
+ */
+ private final boolean testing;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Create a new private credential permission.
+ *
+ * @param name The permission target name.
+ * @param actions The list of actions, which, for this class, must be
+ * <code>"read"</code>.
+ */
+ public PrivateCredentialPermission (final String name, String actions)
+ {
+ super(name);
+ actions = actions.trim().toLowerCase();
+ if (!"read".equals (actions))
+ {
+ throw new IllegalArgumentException("actions must be \"read\"");
+ }
+ StringTokenizer st = new StringTokenizer (name, " \"'");
+ principals = new HashSet();
+ if (st.countTokens() < 3 || (st.countTokens() & 1) == 0)
+ {
+ throw new IllegalArgumentException ("badly formed credential name");
+ }
+ credentialClass = st.nextToken();
+ while (st.hasMoreTokens())
+ {
+ principals.add (new CredOwner (st.nextToken(), st.nextToken()));
+ }
+ testing = false; // WTF ever.
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ public boolean equals (Object o)
+ {
+ if (! (o instanceof PrivateCredentialPermission))
+ {
+ return false;
+ }
+ PrivateCredentialPermission that = (PrivateCredentialPermission) o;
+ if (!that.getActions().equals (getActions()))
+ {
+ return false;
+ }
+ if (!that.getCredentialClass().equals (getCredentialClass()))
+ {
+ return false;
+ }
+
+ final String[][] principals = getPrincipals();
+ final String[][] that_principals = that.getPrincipals();
+ if (that_principals == null)
+ {
+ return false;
+ }
+ if (that_principals.length != principals.length)
+ {
+ return false;
+ }
+ for (int i = 0; i < principals.length; i++)
+ {
+ if (!principals[i][0].equals (that_principals[i][0]) ||
+ !principals[i][1].equals (that_principals[i][1]))
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Returns the actions this permission encompasses. For private credential
+ * permissions, this is always the string <code>"read"</code>.
+ *
+ * @return The list of actions.
+ */
+ public String getActions()
+ {
+ return "read";
+ }
+
+ /**
+ * Returns the credential class name that was embedded in this permission's
+ * target name.
+ *
+ * @return The credential class name.
+ */
+ public String getCredentialClass()
+ {
+ return credentialClass;
+ }
+
+ /**
+ * Returns the principal list that was embedded in this permission's target
+ * name.
+ *
+ * <p>Each element of the returned array is a pair; the first element is the
+ * principal class name, and the second is the principal name.
+ *
+ * @return The principal list.
+ */
+ public String[][] getPrincipals()
+ {
+ String[][] ret = new String[principals.size()][];
+ Iterator it = principals.iterator();
+ for (int i = 0; i < principals.size() && it.hasNext(); i++)
+ {
+ CredOwner co = (CredOwner) it.next();
+ ret[i] = new String[] { co.getPrincipalClass(), co.getPrincipalName() };
+ }
+ return ret;
+ }
+
+ public int hashCode()
+ {
+ return credentialClass.hashCode() + principals.hashCode();
+ }
+
+ /**
+ * Test if this permission implies another. This method returns true if:
+ *
+ * <ol>
+ * <li><i>p</i> is an instance of PrivateCredentialPermission</li>.
+ * <li>The credential class name of this instance matches that of <i>p</i>,
+ * and one of the principals of <i>p</i> is contained in the principals of
+ * this class. Thus,
+ * <ul>
+ * <li><code>[ * P "foo" ] implies [ C P "foo" ]</code></li>
+ * <li><code>[ C P1 "foo" ] implies [ C P1 "foo" P2 "bar" ]</code></li>
+ * <li><code>[ C P1 "*" ] implies [ C P1 "foo" ]</code></li>
+ * </ul>
+ * </ol>
+ *
+ * @param p The permission to check.
+ * @return True if this permission implies <i>p</i>.
+ */
+ public boolean implies (Permission p)
+ {
+ if (! (p instanceof PrivateCredentialPermission))
+ {
+ return false;
+ }
+ PrivateCredentialPermission that = (PrivateCredentialPermission) p;
+ if (!credentialClass.equals ("*")
+ && !credentialClass.equals (that.getCredentialClass()))
+ {
+ return false;
+ }
+ String[][] principals = getPrincipals();
+ String[][] that_principals = that.getPrincipals();
+ if (that_principals == null)
+ {
+ return false;
+ }
+ for (int i = 0; i < principals.length; i++)
+ {
+ for (int j = 0; j < that_principals.length; j++)
+ {
+ if (principals[i][0].equals (that_principals[j][0]) &&
+ (principals[i][1].equals ("*") ||
+ principals[i][1].equals (that_principals[j][1])))
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method is not necessary for this class, thus it always returns null.
+ *
+ * @return null.
+ */
+ public PermissionCollection newPermissionCollection()
+ {
+ return null;
+ }
+
+ // Inner class.
+ // -------------------------------------------------------------------------
+
+ /**
+ * An undocumented inner class present for serialization compatibility.
+ */
+ private static class CredOwner implements Serializable
+ {
+
+ // Fields.
+ // -----------------------------------------------------------------------
+
+ private final String principalClass;
+ private final String principalName;
+
+ // Constructor.
+ // -----------------------------------------------------------------------
+
+ CredOwner (final String principalClass, final String principalName)
+ {
+ this.principalClass = principalClass;
+ this.principalName = principalName;
+ }
+
+ // Instance methods.
+ // -----------------------------------------------------------------------
+
+ public boolean equals (Object o)
+ {
+ if (!(o instanceof CredOwner))
+ {
+ return false;
+ }
+ return principalClass.equals (((CredOwner) o).getPrincipalClass()) &&
+ principalName.equals (((CredOwner) o).getPrincipalName());
+ }
+
+ public int hashCode()
+ {
+ return principalClass.hashCode() + principalName.hashCode();
+ }
+
+ public String getPrincipalClass()
+ {
+ return principalClass;
+ }
+
+ public String getPrincipalName()
+ {
+ return principalName;
+ }
+ }
+}
diff --git a/javax/security/auth/RefreshFailedException.java b/javax/security/auth/RefreshFailedException.java
new file mode 100644
index 000000000..5be9ab75e
--- /dev/null
+++ b/javax/security/auth/RefreshFailedException.java
@@ -0,0 +1,63 @@
+/* RefreshFailedException.java -- signals a failed refresh.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+/**
+ * A signal that a call to {@link Refreshable#refresh()} failed.
+ */
+public class RefreshFailedException extends Exception
+{
+
+ /**
+ * Create a new RefreshFailedException with no detail message.
+ */
+ public RefreshFailedException()
+ {
+ }
+
+ /**
+ * Create a new RefreshFailedException with a detail message.
+ *
+ * @param message The detail message.
+ */
+ public RefreshFailedException (String message)
+ {
+ super (message);
+ }
+}
diff --git a/javax/security/auth/Refreshable.java b/javax/security/auth/Refreshable.java
new file mode 100644
index 000000000..b3ceded41
--- /dev/null
+++ b/javax/security/auth/Refreshable.java
@@ -0,0 +1,65 @@
+/* Refreshable.java -- an object whose state may be refreshed.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+/**
+ * An object whose internal state may be <em>refreshed:</em> as in a
+ * credential object with a expiry date.
+ */
+public interface Refreshable
+{
+
+ /**
+ * Tells whether or not this object is current. Refreshable objects that
+ * are not current may need to be refreshed.
+ *
+ * @return Whether this object is current.
+ */
+ boolean isCurrent();
+
+ /**
+ * Refresh this object. The process involved in refreshing an object is
+ * per-implementation dependent.
+ *
+ * @throws RefreshFailedException If refreshing this object fails.
+ * @throws SecurityException If the caller does not have permission to
+ * refresh, or to take the steps involved in refreshing, this object.
+ */
+ void refresh() throws RefreshFailedException;
+}
diff --git a/javax/security/auth/Subject.java b/javax/security/auth/Subject.java
new file mode 100644
index 000000000..264a41c05
--- /dev/null
+++ b/javax/security/auth/Subject.java
@@ -0,0 +1,559 @@
+/* Subject.java -- a single entity in the system.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.DomainCombiner;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
+import java.util.AbstractSet;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Set;
+
+/**
+ *
+ */
+public final class Subject implements Serializable
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -8308522755600156056L;
+
+ /**
+ * @serial The set of principals. The type of this field is SecureSet, a
+ * private inner class.
+ */
+ private final Set principals;
+
+ /**
+ * @serial The read-only flag.
+ */
+ private boolean readOnly;
+
+ private transient final SecureSet pubCred;
+ private transient final SecureSet privCred;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public Subject()
+ {
+ principals = new SecureSet (this, SecureSet.PRINCIPALS);
+ pubCred = new SecureSet (this, SecureSet.PUBLIC_CREDENTIALS);
+ privCred = new SecureSet (this, SecureSet.PRIVATE_CREDENTIALS);
+ readOnly = false;
+ }
+
+ public Subject (final boolean readOnly, final Set principals,
+ final Set pubCred, final Set privCred)
+ {
+ if (principals == null || pubCred == null || privCred == null)
+ {
+ throw new NullPointerException();
+ }
+ this.principals = new SecureSet (this, SecureSet.PRINCIPALS, principals);
+ this.pubCred = new SecureSet (this, SecureSet.PUBLIC_CREDENTIALS, pubCred);
+ this.privCred = new SecureSet (this, SecureSet.PRIVATE_CREDENTIALS, privCred);
+ this.readOnly = readOnly;
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Returns the subject associated with the given {@link
+ * AccessControlContext}.</p>
+ *
+ * <p>All this method does is retrieve the Subject object from the supplied
+ * context's {@link DomainCombiner}, if any, and if it is an instance of
+ * a {@link SubjectDomainCombiner}.
+ *
+ * @param context The context to retrieve the subject from.
+ * @return The subject assoctiated with the context, or <code>null</code>
+ * if there is none.
+ * @throws NullPointerException If <i>subject</i> is null.
+ * @throws SecurityException If the caller does not have permission to get
+ * the subject (<code>"getSubject"</code> target of {@link AuthPermission}.
+ */
+ public static Subject getSubject (final AccessControlContext context)
+ {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("getSubject"));
+ }
+ DomainCombiner dc = context.getDomainCombiner();
+ if (!(dc instanceof SubjectDomainCombiner))
+ {
+ return null;
+ }
+ return ((SubjectDomainCombiner) dc).getSubject();
+ }
+
+ /**
+ * <p>Run a method as another subject. This method will obtain the current
+ * {@link AccessControlContext} for this thread, then creates another with
+ * a {@link SubjectDomainCombiner} with the given subject. The supplied
+ * action will then be run with the modified context.</p>
+ *
+ * @param subject The subject to run as.
+ * @param action The action to run.
+ * @return The value returned by the privileged action.
+ * @throws SecurityException If the caller is not allowed to run under a
+ * different identity (<code>"doAs"</code> target of {@link AuthPermission}.
+ */
+ public static Object doAs (final Subject subject, final PrivilegedAction action)
+ {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("doAs"));
+ }
+ AccessControlContext context =
+ new AccessControlContext (AccessController.getContext(),
+ new SubjectDomainCombiner (subject));
+ return AccessController.doPrivileged (action, context);
+ }
+
+ /**
+ * <p>Run a method as another subject. This method will obtain the current
+ * {@link AccessControlContext} for this thread, then creates another with
+ * a {@link SubjectDomainCombiner} with the given subject. The supplied
+ * action will then be run with the modified context.</p>
+ *
+ * @param subject The subject to run as.
+ * @param action The action to run.
+ * @return The value returned by the privileged action.
+ * @throws SecurityException If the caller is not allowed to run under a
+ * different identity (<code>"doAs"</code> target of {@link AuthPermission}.
+ * @throws PrivilegedActionException If the action throws an exception.
+ */
+ public static Object doAs (final Subject subject,
+ final PrivilegedExceptionAction action)
+ throws PrivilegedActionException
+ {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("doAs"));
+ }
+ AccessControlContext context =
+ new AccessControlContext (AccessController.getContext(),
+ new SubjectDomainCombiner(subject));
+ return AccessController.doPrivileged (action, context);
+ }
+
+ /**
+ * <p>Run a method as another subject. This method will create a new
+ * {@link AccessControlContext} derived from the given one, with a
+ * {@link SubjectDomainCombiner} with the given subject. The supplied
+ * action will then be run with the modified context.</p>
+ *
+ * @param subject The subject to run as.
+ * @param action The action to run.
+ * @param acc The context to use.
+ * @return The value returned by the privileged action.
+ * @throws SecurityException If the caller is not allowed to run under a
+ * different identity (<code>"doAsPrivileged"</code> target of {@link
+ * AuthPermission}.
+ */
+ public static Object doAsPrivileged (final Subject subject,
+ final PrivilegedAction action,
+ final AccessControlContext acc)
+ {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("doAsPrivileged"));
+ }
+ AccessControlContext context =
+ new AccessControlContext (acc, new SubjectDomainCombiner (subject));
+ return AccessController.doPrivileged (action, context);
+ }
+
+ /**
+ * <p>Run a method as another subject. This method will create a new
+ * {@link AccessControlContext} derived from the given one, with a
+ * {@link SubjectDomainCombiner} with the given subject. The supplied
+ * action will then be run with the modified context.</p>
+ *
+ * @param subject The subject to run as.
+ * @param action The action to run.
+ * @param acc The context to use.
+ * @return The value returned by the privileged action.
+ * @throws SecurityException If the caller is not allowed to run under a
+ * different identity (<code>"doAsPrivileged"</code> target of
+ * {@link AuthPermission}.
+ * @throws PrivilegedActionException If the action throws an exception.
+ */
+ public static Object doAsPrivileged (final Subject subject,
+ final PrivilegedExceptionAction action,
+ final AccessControlContext acc)
+ throws PrivilegedActionException
+ {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("doAsPrivileged"));
+ }
+ AccessControlContext context =
+ new AccessControlContext (acc, new SubjectDomainCombiner (subject));
+ return AccessController.doPrivileged (action, context);
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ public boolean equals (Object o)
+ {
+ if (!(o instanceof Subject))
+ {
+ return false;
+ }
+ Subject that = (Subject) o;
+ return principals.containsAll (that.getPrincipals()) &&
+ pubCred.containsAll (that.getPublicCredentials()) &&
+ privCred.containsAll (that.getPrivateCredentials());
+ }
+
+ public Set getPrincipals()
+ {
+ return principals;
+ }
+
+ public Set getPrincipals(Class clazz)
+ {
+ HashSet result = new HashSet (principals.size());
+ for (Iterator it = principals.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (o != null && clazz.isAssignableFrom (o.getClass()))
+ {
+ result.add(o);
+ }
+ }
+ return Collections.unmodifiableSet (result);
+ }
+
+ public Set getPrivateCredentials()
+ {
+ return privCred;
+ }
+
+ public Set getPrivateCredentials (Class clazz)
+ {
+ HashSet result = new HashSet (privCred.size());
+ for (Iterator it = privCred.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (o != null && clazz.isAssignableFrom (o.getClass()))
+ {
+ result.add(o);
+ }
+ }
+ return Collections.unmodifiableSet (result);
+ }
+
+ public Set getPublicCredentials()
+ {
+ return pubCred;
+ }
+
+ public Set getPublicCredentials (Class clazz)
+ {
+ HashSet result = new HashSet (pubCred.size());
+ for (Iterator it = pubCred.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (o != null && clazz.isAssignableFrom (o.getClass()))
+ {
+ result.add(o);
+ }
+ }
+ return Collections.unmodifiableSet (result);
+ }
+
+ public int hashCode()
+ {
+ return principals.hashCode() + privCred.hashCode() + pubCred.hashCode();
+ }
+
+ /**
+ * <p>Returns whether or not this subject is read-only.</p>
+ *
+ * @return True is this subject is read-only.
+ */
+ public boolean isReadOnly()
+ {
+ return readOnly;
+ }
+
+ /**
+ * <p>Marks this subject as read-only.</p>
+ *
+ * @throws SecurityException If the caller does not have permission to
+ * set this subject as read-only (<code>"setReadOnly"</code> target of
+ * {@link AuthPermission}.
+ */
+ public void setReadOnly()
+ {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("setReadOnly"));
+ }
+ readOnly = true;
+ }
+
+ public String toString()
+ {
+ return Subject.class.getName() + " [ principals=" + principals +
+ ", private credentials=" + privCred + ", public credentials=" +
+ pubCred + ", read-only=" + readOnly + " ]";
+ }
+
+ // Inner class.
+ // -------------------------------------------------------------------------
+
+ /**
+ * An undocumented inner class that is used for sets in the parent class.
+ */
+ private static class SecureSet extends AbstractSet implements Serializable
+ {
+
+ // Fields.
+ // -----------------------------------------------------------------------
+
+ private static final long serialVersionUID = 7911754171111800359L;
+
+ static final int PRINCIPALS = 0;
+ static final int PUBLIC_CREDENTIALS = 1;
+ static final int PRIVATE_CREDENTIALS = 2;
+
+ private final Subject subject;
+ private final LinkedList elements;
+ private transient final int type;
+
+ // Constructors.
+ // -----------------------------------------------------------------------
+
+ SecureSet (final Subject subject, final int type, final Collection elements)
+ {
+ this (subject, type);
+ for (Iterator it = elements.iterator(); it.hasNext(); )
+ {
+ Object o = it.next();
+ if (type == PRINCIPALS && !(o instanceof Principal))
+ {
+ throw new IllegalArgumentException(o+" is not a Principal");
+ }
+ if (!elements.contains (o))
+ {
+ elements.add (o);
+ }
+ }
+ }
+
+ SecureSet (final Subject subject, final int type)
+ {
+ this.subject = subject;
+ this.type = type;
+ this.elements = new LinkedList();
+ }
+
+ // Instance methods.
+ // -----------------------------------------------------------------------
+
+ public synchronized int size()
+ {
+ return elements.size();
+ }
+
+ public Iterator iterator()
+ {
+ return elements.iterator();
+ }
+
+ public synchronized boolean add(Object element)
+ {
+ if (subject.isReadOnly())
+ {
+ throw new IllegalStateException ("subject is read-only");
+ }
+ final SecurityManager sm = System.getSecurityManager();
+ switch (type)
+ {
+ case PRINCIPALS:
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("modifyPrincipals"));
+ }
+ if (!(element instanceof Principal))
+ {
+ throw new IllegalArgumentException ("element is not a Principal");
+ }
+ break;
+
+ case PUBLIC_CREDENTIALS:
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("modifyPublicCredentials"));
+ }
+ break;
+
+ case PRIVATE_CREDENTIALS:
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("modifyPrivateCredentials"));
+ }
+ break;
+
+ default:
+ throw new Error ("this statement should be unreachable");
+ }
+
+ if (elements.contains (element))
+ {
+ return false;
+ }
+
+ return elements.add (element);
+ }
+
+ public synchronized boolean remove (final Object element)
+ {
+ if (subject.isReadOnly())
+ {
+ throw new IllegalStateException ("subject is read-only");
+ }
+ final SecurityManager sm = System.getSecurityManager();
+ switch (type)
+ {
+ case PRINCIPALS:
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("modifyPrincipals"));
+ }
+ if (!(element instanceof Principal))
+ {
+ throw new IllegalArgumentException ("element is not a Principal");
+ }
+ break;
+
+ case PUBLIC_CREDENTIALS:
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("modifyPublicCredentials"));
+ }
+ break;
+
+ case PRIVATE_CREDENTIALS:
+ if (sm != null)
+ {
+ sm.checkPermission (new AuthPermission ("modifyPrivateCredentials"));
+ }
+ break;
+
+ default:
+ throw new Error("this statement should be unreachable");
+ }
+
+ return elements.remove(element);
+ }
+
+ public synchronized boolean contains (final Object element)
+ {
+ return elements.remove (element);
+ }
+
+ public boolean removeAll (final Collection c)
+ {
+ if (subject.isReadOnly())
+ {
+ throw new IllegalStateException ("subject is read-only");
+ }
+ return super.removeAll (c);
+ }
+
+ public boolean retainAll (final Collection c)
+ {
+ if (subject.isReadOnly())
+ {
+ throw new IllegalStateException ("subject is read-only");
+ }
+ return super.retainAll (c);
+ }
+
+ public void clear()
+ {
+ if (subject.isReadOnly())
+ {
+ throw new IllegalStateException ("subject is read-only");
+ }
+ elements.clear();
+ }
+
+ private synchronized void writeObject (ObjectOutputStream out)
+ throws IOException
+ {
+ throw new UnsupportedOperationException ("FIXME: determine serialization");
+ }
+
+ private void readObject (ObjectInputStream in)
+ throws ClassNotFoundException, IOException
+ {
+ throw new UnsupportedOperationException ("FIXME: determine serialization");
+ }
+ }
+}
diff --git a/javax/security/auth/SubjectDomainCombiner.java b/javax/security/auth/SubjectDomainCombiner.java
new file mode 100644
index 000000000..194e1130a
--- /dev/null
+++ b/javax/security/auth/SubjectDomainCombiner.java
@@ -0,0 +1,96 @@
+/* SubjectDomainCombiner.java -- domain combiner for Subjects.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth;
+
+import java.security.DomainCombiner;
+import java.security.Principal;
+import java.security.ProtectionDomain;
+
+import java.util.LinkedList;
+
+public class SubjectDomainCombiner implements DomainCombiner
+{
+
+ // Field.
+ // -------------------------------------------------------------------------
+
+ private final Subject subject;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public SubjectDomainCombiner (final Subject subject)
+ {
+ this.subject = subject;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ public ProtectionDomain[] combine (final ProtectionDomain[] current,
+ final ProtectionDomain[] assigned)
+ {
+ LinkedList domains = new LinkedList();
+ Principal[] principals =
+ (Principal[]) subject.getPrincipals().toArray (new Principal[0]);
+ if (current != null)
+ {
+ for (int i = 0; i < current.length; i++)
+ {
+ domains.add (new ProtectionDomain (current[i].getCodeSource(),
+ current[i].getPermissions(),
+ current[i].getClassLoader(),
+ principals));
+ }
+ }
+ if (assigned != null)
+ {
+ for (int i = 0; i < assigned.length; i++)
+ {
+ domains.add (assigned[i]);
+ }
+ }
+ return (ProtectionDomain[]) domains.toArray (new ProtectionDomain[domains.size()]);
+ }
+
+ public Subject getSubject()
+ {
+ return subject;
+ }
+}
diff --git a/javax/security/auth/callback/Callback.java b/javax/security/auth/callback/Callback.java
new file mode 100644
index 000000000..124c36dfd
--- /dev/null
+++ b/javax/security/auth/callback/Callback.java
@@ -0,0 +1,65 @@
+/* Callback.java -- marker interface for callback classes
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+/**
+ * <p>Implementations of this interface are passed to a {@link CallbackHandler},
+ * allowing underlying security services the ability to interact with a calling
+ * application to retrieve specific authentication data such as usernames and
+ * passwords, or to display certain information, such as error and warning
+ * messages.</p>
+ *
+ * <p><code>Callback</code> implementations do not retrieve or display the
+ * information requested by underlying security services. <code>Callback</code>
+ * implementations simply provide the means to pass such requests to
+ * applications, and for applications, if appropriate, to return requested
+ * information back to the underlying security services.</p>
+ *
+ * @see CallbackHandler
+ * @see ChoiceCallback
+ * @see ConfirmationCallback
+ * @see LanguageCallback
+ * @see NameCallback
+ * @see PasswordCallback
+ * @see TextInputCallback
+ * @see TextOutputCallback
+ * @version $Revision: 1.1.2.1 $
+ */
+public interface Callback {
+}
diff --git a/javax/security/auth/callback/CallbackHandler.java b/javax/security/auth/callback/CallbackHandler.java
new file mode 100644
index 000000000..051088e28
--- /dev/null
+++ b/javax/security/auth/callback/CallbackHandler.java
@@ -0,0 +1,156 @@
+/* CallbackHandler.java -- base interface for callback handlers.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.IOException;
+
+/**
+ * <p>An application implements a <code>CallbackHandler</code> and passes it to
+ * underlying security services so that they may interact with the application
+ * to retrieve specific authentication data, such as usernames and passwords, or
+ * to display certain information, such as error and warning messages.</p>
+ *
+ * <p><code>CallbackHandler</code>s are implemented in an application-dependent
+ * fashion. For example, implementations for an application with a graphical
+ * user interface (GUI) may pop up windows to prompt for requested information
+ * or to display error messages. An implementation may also choose to obtain
+ * requested information from an alternate source without asking the end user.</p>
+ *
+ * <p>Underlying security services make requests for different types of
+ * information by passing individual Callbacks to the <code>CallbackHandler</code>.
+ * The <code>CallbackHandler</code> implementation decides how to retrieve and
+ * display information depending on the {@link Callback}s passed to it. For
+ * example, if the underlying service needs a username and password to
+ * authenticate a user, it uses a {@link NameCallback} and
+ * {@link PasswordCallback}. The <code>CallbackHandler</code> can then choose
+ * to prompt for a username and password serially, or to prompt for both in a
+ * single window.</p>
+ *
+ * <p>A default <code>CallbackHandler</code> class implementation may be
+ * specified in the <code>auth.login.defaultCallbackHandler</code> security
+ * property. The security property can be set in the Java security properties
+ * file located in the file named
+ * <code>&lt;JAVA_HOME>/lib/security/java.security</code>, where
+ * <code>&lt;JAVA_HOME></code> refers to the directory where the SDK was
+ * installed.</p>
+ *
+ * <p>If the security property is set to the fully qualified name of a
+ * <code>CallbackHandler</code> implementation class, then a
+ * <code>LoginContext</code>will load the specified <code>CallbackHandler</code>
+ * and pass it to the underlying <code>LoginModules</code>. The
+ * <code>LoginContext</code> only loads the default handler if one was not
+ * provided.</p>
+ *
+ * <p>All default handler implementations must provide a public zero-argument
+ * constructor.</p>
+ *
+ * @version $Revision: 1.1.2.1 $
+ */
+public interface CallbackHandler
+{
+
+ /**
+ * <p>Retrieve or display the information requested in the provided
+ * {@link Callback}s.</p>
+ *
+ * <p>The <code>handle()</code> method implementation checks the instance(s)
+ * of the {@link Callback} object(s) passed in to retrieve or display the
+ * requested information. The following example is provided to help
+ * demonstrate what an <code>handle()</code> method implementation might look
+ * like. This example code is for guidance only. Many details, including
+ * proper error handling, are left out for simplicity.</p>
+ *
+ * <pre>
+ *public void handle(Callback[] callbacks)
+ *throws IOException, UnsupportedCallbackException {
+ * for (int i = 0; i < callbacks.length; i++) {
+ * if (callbacks[i] instanceof TextOutputCallback) {
+ * // display the message according to the specified type
+ * TextOutputCallback toc = (TextOutputCallback)callbacks[i];
+ * switch (toc.getMessageType()) {
+ * case TextOutputCallback.INFORMATION:
+ * System.out.println(toc.getMessage());
+ * break;
+ * case TextOutputCallback.ERROR:
+ * System.out.println("ERROR: " + toc.getMessage());
+ * break;
+ * case TextOutputCallback.WARNING:
+ * System.out.println("WARNING: " + toc.getMessage());
+ * break;
+ * default:
+ * throw new IOException("Unsupported message type: "
+ * + toc.getMessageType());
+ * }
+ * } else if (callbacks[i] instanceof NameCallback) {
+ * // prompt the user for a username
+ * NameCallback nc = (NameCallback)callbacks[i];
+ * // ignore the provided defaultName
+ * System.err.print(nc.getPrompt());
+ * System.err.flush();
+ * nc.setName((new BufferedReader(
+ * new InputStreamReader(System.in))).readLine());
+ * } else if (callbacks[i] instanceof PasswordCallback) {
+ * // prompt the user for sensitive information
+ * PasswordCallback pc = (PasswordCallback)callbacks[i];
+ * System.err.print(pc.getPrompt());
+ * System.err.flush();
+ * pc.setPassword(readPassword(System.in));
+ * } else {
+ * throw new UnsupportedCallbackException(
+ * callbacks[i], "Unrecognized Callback");
+ * }
+ * }
+ *}
+ *
+ * // Reads user password from given input stream.
+ *private char[] readPassword(InputStream in) throws IOException {
+ * // insert code to read a user password from the input stream
+ *}
+ * </pre>
+ *
+ * @param callbacks an array of {@link Callback} objects provided by an
+ * underlying security service which contains the information requested to
+ * be retrieved or displayed.
+ * @throws IOException if an input or output error occurs.
+ * @throws UnsupportedCallbackException if the implementation of this method
+ * does not support one or more of the Callbacks specified in the
+ * <code>callbacks</code> parameter.
+ */
+ void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException;
+}
diff --git a/javax/security/auth/callback/ChoiceCallback.java b/javax/security/auth/callback/ChoiceCallback.java
new file mode 100644
index 000000000..7bb14c37a
--- /dev/null
+++ b/javax/security/auth/callback/ChoiceCallback.java
@@ -0,0 +1,237 @@
+/* ChoiceCallback.java -- callback for a choice of values.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+
+/**
+ * Underlying security services instantiate and pass a
+ * <code>ChoiceCallback</code> to the <code>handle()</code> method of a
+ * {@link CallbackHandler} to display a list of choices and to retrieve the
+ * selected choice(s).
+ *
+ * @see CallbackHandler
+ * @version $Revision: 1.1.2.1 $
+ */
+public class ChoiceCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String prompt;
+
+ /**
+ * @serial the list of choices.
+ * @since 1.4
+ */
+ private String[] choices;
+
+ /**
+ * @serial the choice to be used as the default choice.
+ * @since 1.4
+ */
+ private int defaultChoice;
+
+ /**
+ * @serial whether multiple selections are allowed from the list of choices.
+ * @since 1.4
+ */
+ private boolean multipleSelectionsAllowed;
+
+ /**
+ * @serial the selected choices, represented as indexes into the choices list.
+ * @since 1.4
+ */
+ private int[] selections;
+
+ // Constructor(s)
+ //--------------------------------------------------------------------------
+
+ /**
+ * Construct a <code>ChoiceCallback</code> with a prompt, a list of choices,
+ * a default choice, and a boolean specifying whether or not multiple
+ * selections from the list of choices are allowed.
+ *
+ * @param prompt the prompt used to describe the list of choices.
+ * @param choices the list of choices.
+ * @param defaultChoice the choice to be used as the default choice when the
+ * list of choices are displayed. This value is represented as an index into
+ * the <code>choices</code> array.
+ * @param multipleSelectionsAllowed boolean specifying whether or not
+ * multiple selections can be made from the list of choices.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>,
+ * if <code>prompt</code> has a length of <code>0</code>, if <code>choices</code>
+ * is <code>null</code>, if <code>choices</code> has a length of <code>0</code>,
+ * if any element from <code>choices</code> is <code>null</code>, if any
+ * element from <code>choices</code> has a length of <code>0</code> or if
+ * <code>defaultChoice</code> does not fall within the array boundaries of
+ * <code>choices</code>.
+ */
+ public ChoiceCallback(String prompt, String[] choices, int defaultChoice,
+ boolean multipleSelectionsAllowed)
+ {
+ super();
+
+ setPrompt(prompt);
+ setChoices(choices);
+ if (defaultChoice < 0 || defaultChoice >= this.choices.length)
+ {
+ throw new IllegalArgumentException("default choice is out of bounds");
+ }
+ this.defaultChoice = defaultChoice;
+ this.multipleSelectionsAllowed = multipleSelectionsAllowed;
+ }
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the prompt.
+ *
+ * @return the prompt.
+ */
+ public String getPrompt()
+ {
+ return prompt;
+ }
+
+ /**
+ * Get the list of choices.
+ *
+ * @return the list of choices.
+ */
+ public String[] getChoices()
+ {
+ return choices;
+ }
+
+ /**
+ * Get the defaultChoice.
+ *
+ * @return the defaultChoice, represented as an index into the choices list.
+ */
+ public int getDefaultChoice()
+ {
+ return defaultChoice;
+ }
+
+ /**
+ * Get the boolean determining whether multiple selections from the choices
+ * list are allowed.
+ *
+ * @return whether multiple selections are allowed.
+ */
+ public boolean allowMultipleSelections()
+ {
+ return multipleSelectionsAllowed;
+ }
+
+ /**
+ * Set the selected choice.
+ *
+ * @param selection the selection represented as an index into the choices
+ * list.
+ * @see #getSelectedIndexes()
+ */
+ public void setSelectedIndex(int selection)
+ {
+ this.selections = new int[1];
+ this.selections[0] = selection;
+ }
+
+ /**
+ * Set the selected choices.
+ *
+ * @param selections the selections represented as indexes into the choices
+ * list.
+ * @throws UnsupportedOperationException if multiple selections are not
+ * allowed, as determined by <code>allowMultipleSelections</code>.
+ * @see #getSelectedIndexes()
+ */
+ public void setSelectedIndexes(int[] selections)
+ {
+ if (!multipleSelectionsAllowed)
+ {
+ throw new UnsupportedOperationException("not allowed");
+ }
+
+ this.selections = selections;
+ }
+
+ /**
+ * Get the selected choices.
+ *
+ * @return the selected choices, represented as indexes into the choices list.
+ * @see #setSelectedIndexes(int[])
+ */
+ public int[] getSelectedIndexes()
+ {
+ return selections;
+ }
+
+ private void setPrompt(String prompt) throws IllegalArgumentException
+ {
+ if ((prompt == null) || (prompt.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid prompt");
+ }
+ this.prompt = prompt;
+ }
+
+ private void setChoices(String[] choices) throws IllegalArgumentException
+ {
+ if (choices == null || choices.length == 0)
+ {
+ throw new IllegalArgumentException("invalid choices");
+ }
+ for (int i = 0; i < choices.length; i++)
+ {
+ if (choices[i] == null || choices[i].length() == 0)
+ {
+ throw new IllegalArgumentException("invalid choice at index #"+i);
+ }
+ }
+ this.choices = choices;
+ }
+}
diff --git a/javax/security/auth/callback/ConfirmationCallback.java b/javax/security/auth/callback/ConfirmationCallback.java
new file mode 100644
index 000000000..5f13bc093
--- /dev/null
+++ b/javax/security/auth/callback/ConfirmationCallback.java
@@ -0,0 +1,506 @@
+/* ConfirmationCallback.java -- callback for confirmations.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+
+/**
+ * Underlying security services instantiate and pass a
+ * <code>ConfirmationCallback</code> to the <code>handle()</code> method of a
+ * {@link CallbackHandler} to ask for YES/NO, OK/CANCEL, YES/NO/CANCEL or other
+ * similar confirmations.
+ *
+ * @see CallbackHandler
+ * @version $Revision: 1.1.2.1 $
+ */
+public class ConfirmationCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Unspecified option type.</p>
+ *
+ * <p>The <code>getOptionType</code> method returns this value if this
+ * <code>ConfirmationCallback</code> was instantiated with <code>options</code>
+ * instead of an <code>optionType</code>.</p>
+ */
+ public static final int UNSPECIFIED_OPTION = -1;
+
+ /**
+ * <p>YES/NO confirmation option.</p>
+ *
+ * <p>An underlying security service specifies this as the <code>optionType</code>
+ * to a <code>ConfirmationCallback</code> constructor if it requires a
+ * confirmation which can be answered with either <code>YES</code> or
+ * <code>NO</code>.</p>
+ */
+ public static final int YES_NO_OPTION = 0;
+
+ /**
+ * <p>YES/NO/CANCEL confirmation confirmation option.</p>
+ *
+ * <p>An underlying security service specifies this as the <code>optionType</code>
+ * to a <code>ConfirmationCallback</code> constructor if it requires a
+ * confirmation which can be answered with either <code>YES</code>,
+ * <code>NO</code> or <code>CANCEL</code>.
+ */
+ public static final int YES_NO_CANCEL_OPTION = 1;
+
+ /**
+ * <p>OK/CANCEL confirmation confirmation option.</p>
+ *
+ * <p>An underlying security service specifies this as the <code>optionType</code>
+ * to a <code>ConfirmationCallback</code> constructor if it requires a
+ * confirmation which can be answered with either <code>OK</code> or
+ * <code>CANCEL</code>.</p>
+ */
+ public static final int OK_CANCEL_OPTION = 2;
+
+ /**
+ * <p>YES option.</p>
+ *
+ * <p>If an <code>optionType</code> was specified to this
+ * <code>ConfirmationCallback</code>, this option may be specified as a
+ * <code>defaultOption</code> or returned as the selected index.</p>
+ */
+ public static final int YES = 0;
+
+ /**
+ * <p>NO option.</p>
+ *
+ * <p>If an <code>optionType</code> was specified to this
+ * <code>ConfirmationCallback</code>, this option may be specified as a
+ * <code>defaultOption</code> or returned as the selected index.</p>
+ */
+ public static final int NO = 1;
+
+ /**
+ * <p>CANCEL option.</p>
+ *
+ * <p>If an <code>optionType</code> was specified to this
+ * <code>ConfirmationCallback</code>, this option may be specified as a
+ * <code>defaultOption</code> or returned as the selected index.</p>
+ */
+ public static final int CANCEL = 2;
+
+ /**
+ * <p>OK option.</p>
+ *
+ * <p>If an <code>optionType</code> was specified to this
+ * <code>ConfirmationCallback</code>, this option may be specified as a
+ * <code>defaultOption</code> or returned as the selected index.</p>
+ */
+ public static final int OK = 3;
+
+ /** INFORMATION message type. */
+ public static final int INFORMATION = 0;
+
+ /** WARNING message type. */
+ public static final int WARNING = 1;
+
+ /** ERROR message type. */
+ public static final int ERROR = 2;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String prompt;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private int messageType;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private int optionType;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private int defaultOption;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String[] options = null;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private int selection;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Construct a <code>ConfirmationCallback</code> with a message type, an
+ * option type and a default option.</p>
+ *
+ * <p>Underlying security services use this constructor if they require
+ * either a YES/NO, YES/NO/CANCEL or OK/CANCEL confirmation.</p>
+ *
+ * @param messageType the message type (INFORMATION, WARNING or ERROR).
+ * @param optionType the option type (YES_NO_OPTION, YES_NO_CANCEL_OPTION or
+ * OK_CANCEL_OPTION).
+ * @param defaultOption the default option from the provided optionType (YES,
+ * NO, CANCEL or OK).
+ * @throws IllegalArgumentException if <code>messageType</code> is not either
+ * <code>INFORMATION</code>, <code>WARNING</code>, or <code>ERROR</code>, if
+ * <code>optionType</code> is not either <code>YES_NO_OPTION</code>,
+ * <code>YES_NO_CANCEL_OPTION</code>, or <code>OK_CANCEL_OPTION</code>, or if
+ * <code>defaultOption</code> does not correspond to one of the options in
+ * <code>optionType</code>.
+ */
+ public ConfirmationCallback(int messageType, int optionType, int defaultOption)
+ throws IllegalArgumentException
+ {
+ super();
+
+ setMessageType(messageType);
+ setOptionType(optionType, defaultOption);
+ this.defaultOption = defaultOption;
+ }
+
+ /**
+ * <p>Construct a <code>ConfirmationCallback</code> with a message type, a
+ * list of options and a default option.</p>
+ *
+ * <p>Underlying security services use this constructor if they require a
+ * confirmation different from the available preset confirmations provided
+ * (for example, CONTINUE/ABORT or STOP/GO). The confirmation options are
+ * listed in the <code>options</code> array, and are displayed by the
+ * {@link CallbackHandler} implementation in a manner consistent with the
+ * way preset options are displayed.</p>
+ *
+ * @param messageType the message type (INFORMATION, WARNING or ERROR).
+ * @param options the list of confirmation options.
+ * @param defaultOption the default option, represented as an index into the
+ * <code>options</code> array.
+ * @throws IllegalArgumentException if <code>messageType</code> is not either
+ * <code>INFORMATION</code>, <code>WARNING</code>, or <code>ERROR</code>, if
+ * <code>options</code> is <code>null</code>, if <code>options</code> has a
+ * length of <code>0</code>, if any element from <code>options</code> is
+ * <code>null</code>, if any element from <code>options</code> has a length
+ * of <code>0</code>, or if <code>defaultOption</code> does not lie within
+ * the array boundaries of <code>options</code>.
+ */
+ public ConfirmationCallback(int messageType, String[] options, int defaultOption)
+ {
+ super();
+
+ setMessageType(messageType);
+ setOptions(options, defaultOption);
+ this.defaultOption = defaultOption;
+ }
+
+ /**
+ * <p>Construct a <code>ConfirmationCallback</code> with a prompt, message
+ * type, an option type and a default option.</p>
+ *
+ * <p>Underlying security services use this constructor if they require
+ * either a YES/NO, YES/NO/CANCEL or OK/CANCEL confirmation.</p>
+ *
+ * @param prompt the prompt used to describe the list of options.
+ * @param messageType the message type (INFORMATION, WARNING or ERROR).
+ * @param optionType the option type (YES_NO_OPTION, YES_NO_CANCEL_OPTION or
+ * OK_CANCEL_OPTION).
+ * @param defaultOption the default option from the provided optionType (YES,
+ * NO, CANCEL or OK).
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>,
+ * if <code>prompt</code> has a length of <code>0</code>, if
+ * <code>messageType</code> is not either <ode>INFORMATION</code>,
+ * <code>WARNING</code>, or <code>ERROR</code>, if <code>optionType</code> is
+ * not either <code>YES_NO_OPTION</code>, <code>YES_NO_CANCEL_OPTION</code>,
+ * or <code>OK_CANCEL_OPTION</code>, or if <code>defaultOption</code> does
+ * not correspond to one of the options in <code>optionType</code>.
+ */
+ public ConfirmationCallback(String prompt, int messageType, int optionType,
+ int defaultOption)
+ {
+ super();
+
+ setPrompt(prompt);
+ setMessageType(messageType);
+ setOptionType(optionType, defaultOption);
+ this.defaultOption = defaultOption;
+ }
+
+ /**
+ * <p>Construct a <code>ConfirmationCallback</code> with a prompt, message
+ * type, a list of options and a default option.</p>
+ *
+ * <p>Underlying security services use this constructor if they require a
+ * confirmation different from the available preset confirmations provided
+ * (for example, CONTINUE/ABORT or STOP/GO). The confirmation options are
+ * listed in the <code>options</code> array, and are displayed by the
+ * {@link CallbackHandler} implementation in a manner consistent with the
+ * way preset options are displayed.</p>
+ *
+ * @param prompt the prompt used to describe the list of options.
+ * @param messageType the message type (INFORMATION, WARNING or ERROR).
+ * @param options the list of confirmation options.
+ * @param defaultOption the default option, represented as an index into the
+ * <code>options</code> array.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>,
+ * if <code>prompt</code> has a length of <code>0</code>, if
+ * <code>messageType</code> is not either <ode>INFORMATION</code>,
+ * <code>WARNING</code>, or <code>ERROR</code>, if <code>options</code> is
+ * <code>null</code>, if <code>options</code> has a length of <code>0</code>,
+ * if any element from <code>options</code> is <code>null</code>, if any
+ * element from <code>options</code> has a length of <code>0</code>, or if
+ * <code>defaultOption</code> does not lie within the array boundaries of
+ * <code>options</code>.
+ */
+ public ConfirmationCallback(String prompt, int messageType, String[] options,
+ int defaultOption)
+ {
+ super();
+
+ setPrompt(prompt);
+ setMessageType(messageType);
+ setOptions(options, defaultOption);
+ this.defaultOption = defaultOption;
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the prompt.
+ *
+ * @return the prompt, or <code>null</code> if this
+ * <code>ConfirmationCallback</code> was instantiated without a prompt.
+ */
+ public String getPrompt()
+ {
+ return prompt;
+ }
+
+ /**
+ * Get the message type.
+ *
+ * @return the message type (INFORMATION, WARNING or ERROR).
+ */
+ public int getMessageType()
+ {
+ return messageType;
+ }
+
+ /**
+ * <p>Get the option type.</p>
+ *
+ * <p>If this method returns {@link #UNSPECIFIED_OPTION}, then this
+ * <code>ConfirmationCallback</code> was instantiated with <code>options</code>
+ * instead of an <code>optionType</code>. In this case, invoke the
+ * {@link #getOptions()} method to determine which confirmation options to
+ * display.</p>
+ *
+ * @return the option type (YES_NO_OPTION, YES_NO_CANCEL_OPTION or
+ * OK_CANCEL_OPTION), or UNSPECIFIED_OPTION if this
+ * <code>ConfirmationCallback</code> was instantiated with <code>options</code>
+ * instead of an <code>optionType</code>.
+ */
+ public int getOptionType()
+ {
+ if (options != null)
+ {
+ return UNSPECIFIED_OPTION;
+ }
+ return optionType;
+ }
+
+ /**
+ * Get the confirmation options.
+ *
+ * @return the list of confirmation options, or <code>null</code> if this
+ * <code>ConfirmationCallback</code> was instantiated with an
+ * <code>optionType</code> instead of <code>options</code>.
+ */
+ public String[] getOptions()
+ {
+ return options;
+ }
+
+ /**
+ * Get the default option.
+ *
+ * @return the default option, represented as <code>YES</code>, <code>NO</code>,
+ * <code>OK</code> or <code>CANCEL</code> if an <code>optionType</code> was
+ * specified to the constructor of this <code>ConfirmationCallback</code>.
+ * Otherwise, this method returns the default option as an index into the
+ * <code>options</code> array specified to the constructor of this
+ * <code>ConfirmationCallback</code>.
+ */
+ public int getDefaultOption()
+ {
+ return defaultOption;
+ }
+
+ /**
+ * Set the selected confirmation option.
+ *
+ * @param selection the selection represented as <code>YES</code>,
+ * <code>NO</code>, <code>OK</code> or <code>CANCEL</code> if an
+ * <code>optionType</code> was specified to the constructor of this
+ * <code>ConfirmationCallback</code>. Otherwise, the <code>selection</code>
+ * represents the index into the <code>options</code> array specified to the
+ * constructor of this <code>ConfirmationCallback</code>.
+ * @see #getSelectedIndex()
+ */
+ public void setSelectedIndex(int selection)
+ {
+ if (options != null)
+ {
+ setOptions(options, selection);
+ }
+ else
+ {
+ setOptionType(optionType, selection);
+ }
+ }
+
+ /**
+ * Get the selected confirmation option.
+ *
+ * @return the selected confirmation option represented as <code>YES</code>,
+ * <code>NO</code>, <code>OK</code> or <code>CANCEL</code> if an
+ * <code>optionType</code> was specified to the constructor of this
+ * <code>ConfirmationCallback</code>. Otherwise, this method returns the
+ * selected confirmation option as an index into the <code>options</code>
+ * array specified to the constructor of this <code>ConfirmationCallback</code>.
+ * @see #setSelectedIndex(int)
+ */
+ public int getSelectedIndex()
+ {
+ return this.selection;
+ }
+
+ private void setMessageType(int messageType) throws IllegalArgumentException
+ {
+ switch (messageType)
+ {
+ case INFORMATION:
+ case WARNING:
+ case ERROR: this.messageType = messageType; break;
+ default: throw new IllegalArgumentException("illegal message type");
+ }
+ }
+
+ private void setOptionType(int optionType, int selectedOption)
+ throws IllegalArgumentException
+ {
+ switch (optionType)
+ {
+ case YES_NO_OPTION:
+ this.optionType = optionType;
+ switch (selectedOption)
+ {
+ case YES:
+ case NO: this.selection = selectedOption; break;
+ default: throw new IllegalArgumentException("invalid option");
+ }
+ break;
+ case YES_NO_CANCEL_OPTION:
+ this.optionType = optionType;
+ switch (selectedOption)
+ {
+ case YES:
+ case NO:
+ case CANCEL: this.selection = selectedOption; break;
+ default: throw new IllegalArgumentException("invalid option");
+ }
+ break;
+ case OK_CANCEL_OPTION:
+ this.optionType = optionType;
+ switch (selectedOption)
+ {
+ case OK:
+ case CANCEL: this.selection = selectedOption; break;
+ default: throw new IllegalArgumentException("invalid option");
+ }
+ break;
+ default:
+ throw new IllegalArgumentException("illegal option type");
+ }
+ }
+
+ private void setOptions(String[] options, int selectedOption)
+ throws IllegalArgumentException
+ {
+ if ((selectedOption < 0) || (selectedOption > options.length - 1))
+ {
+ throw new IllegalArgumentException("invalid selection");
+ }
+ if ((options == null) || (options.length == 0))
+ {
+ throw new IllegalArgumentException("options is null or empty");
+ }
+ for (int i = 0; i < options.length; i++)
+ {
+ if ((options[i] == null) || (options[i].length() == 0))
+ {
+ throw new IllegalArgumentException("options[" + i + "] is null or empty");
+ }
+ }
+ this.options = options;
+ this.selection = selectedOption;
+ }
+
+ private void setPrompt(String prompt) throws IllegalArgumentException
+ {
+ if ((prompt == null) || (prompt.length() == 0))
+ {
+ throw new IllegalArgumentException("prompt is null or empty");
+ }
+ this.prompt = prompt;
+ }
+}
diff --git a/javax/security/auth/callback/LanguageCallback.java b/javax/security/auth/callback/LanguageCallback.java
new file mode 100644
index 000000000..309c49d75
--- /dev/null
+++ b/javax/security/auth/callback/LanguageCallback.java
@@ -0,0 +1,101 @@
+/* LanguageCallback.java -- callback for language choices.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+import java.util.Locale;
+
+/**
+ * Underlying security services instantiate and pass a <code>LanguageCallback</code>
+ * to the <code>handle()</code> method of a {@link CallbackHandler} to retrieve
+ * the {@link Locale} used for localizing text.
+ *
+ * @see CallbackHandler
+ * @version $Revision: 1.1.2.1 $
+ */
+public class LanguageCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private Locale locale;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /** Construct a <code>LanguageCallback</code>. */
+ public LanguageCallback()
+ {
+ super();
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Set the retrieved Locale.
+ *
+ * @param locale the retrieved Locale.
+ * @see #getLocale()
+ */
+ public void setLocale(Locale locale)
+ {
+ this.locale = locale;
+ }
+
+ /**
+ * Get the retrieved Locale.
+ *
+ * @return the retrieved Locale, or <code>null</code> if no Locale could be
+ * retrieved.
+ * @see #setLocale(Locale)
+ */
+ public Locale getLocale()
+ {
+ return locale;
+ }
+}
diff --git a/javax/security/auth/callback/NameCallback.java b/javax/security/auth/callback/NameCallback.java
new file mode 100644
index 000000000..05c22da28
--- /dev/null
+++ b/javax/security/auth/callback/NameCallback.java
@@ -0,0 +1,179 @@
+/* NameCallback.java -- callback for user names.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+
+/**
+ * Underlying security services instantiate and pass a <code>NameCallback</code>
+ * to the <code>handle()</code> method of a {@link CallbackHandler} to retrieve
+ * name information.
+ *
+ * @see CallbackHandler
+ * @version $Revision: 1.1.2.1 $
+ */
+public class NameCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String prompt;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String defaultName;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String inputName;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Construct a <code>NameCallback</code> with a prompt.
+ *
+ * @param prompt the prompt used to request the name.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or if <code>prompt</code> has a length of <code>0</code>.
+ */
+ public NameCallback(String prompt)
+ {
+ super();
+
+ setPrompt(prompt);
+ }
+
+ /**
+ * Construct a <code>NameCallback</code> with a prompt and default name.
+ *
+ * @param prompt the prompt used to request the information.
+ * @param defaultName the name to be used as the default name displayed with
+ * the prompt.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or if <code>prompt</code> has a length of <code>0</code>, if
+ * <code>defaultName</code> is <code>null</code>, or if <code>defaultName</code>
+ * has a length of <code>0</code>.
+ */
+ public NameCallback(String prompt, String defaultName)
+ throws IllegalArgumentException
+ {
+ super();
+
+ setPrompt(prompt);
+ setDefaultName(defaultName);
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the prompt.
+ *
+ * @return the prompt.
+ */
+ public String getPrompt()
+ {
+ return prompt;
+ }
+
+ /**
+ * Get the default name.
+ *
+ * @return the default name, or <code>null</code> if this
+ * <code>NameCallback</code> was not instantiated with a
+ * <code>defaultName</code>.
+ */
+ public String getDefaultName()
+ {
+ return defaultName;
+ }
+
+ /**
+ * Set the retrieved name.
+ *
+ * @param name the retrieved name (which may be <code>null</code>).
+ * @see #getName()
+ */
+ public void setName(String name)
+ {
+ this.inputName = name;
+ }
+
+ /**
+ * Get the retrieved name.
+ *
+ * @return the retrieved name (which may be <code>null</code>)
+ * @see #setName(String)
+ */
+ public String getName()
+ {
+ return inputName;
+ }
+
+ private void setPrompt(String prompt) throws IllegalArgumentException
+ {
+ if ((prompt == null) || (prompt.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid prompt");
+ }
+ this.prompt = prompt;
+ }
+
+ private void setDefaultName(String defaultName) throws IllegalArgumentException
+ {
+ if ((defaultName == null) || (defaultName.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid default name");
+ }
+ this.defaultName = defaultName;
+ }
+}
diff --git a/javax/security/auth/callback/PasswordCallback.java b/javax/security/auth/callback/PasswordCallback.java
new file mode 100644
index 000000000..ead618a25
--- /dev/null
+++ b/javax/security/auth/callback/PasswordCallback.java
@@ -0,0 +1,169 @@
+/* PasswordCallback.java -- callback for passwords.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+
+/**
+ * Underlying security services instantiate and pass a <code>PasswordCallback</code>
+ * to the <code>handle()</code> method of a {@link CallbackHandler} to retrieve
+ * password information.
+ *
+ * @see CallbackHandler,
+ * @version $Revision: 1.1.2.1 $
+ */
+public class PasswordCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String prompt;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private boolean echoOn;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private char[] inputPassword;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Construct a <code>PasswordCallback</code> with a prompt and a boolean
+ * specifying whether the password should be displayed as it is being typed.
+ *
+ * @param prompt the prompt used to request the password.
+ * @param echoOn <code>true</code> if the password should be displayed as it
+ * is being typed.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or if <code>prompt</code> has a length of <code>0</code>.
+ */
+ public PasswordCallback(String prompt, boolean echoOn)
+ {
+ super();
+
+ setPrompt(prompt);
+ this.echoOn = echoOn;
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the prompt.
+ *
+ * @return the prompt.
+ */
+ public String getPrompt()
+ {
+ return prompt;
+ }
+
+ /**
+ * Return whether the password should be displayed as it is being typed.
+ *
+ * @return the whether the password should be displayed as it is being typed.
+ */
+ public boolean isEchoOn()
+ {
+ return echoOn;
+ }
+
+ /**
+ * <p>Set the retrieved password.</p>
+ *
+ * <p>This method makes a copy of the input password before storing it.</p>
+ *
+ * @param password the retrieved password, which may be <code>null</code>.
+ * @see #getPassword()
+ */
+ public void setPassword(char[] password)
+ {
+ inputPassword = (password == null ? null : (char[]) password.clone());
+ }
+
+ /**
+ * <p>Get the retrieved password.</p>
+ *
+ * <p>This method returns a copy of the retrieved password.</p>
+ *
+ * @return the retrieved password, which may be <code>null</code>.
+ * @see #setPassword(char[])
+ */
+ public char[] getPassword()
+ {
+ return (inputPassword == null ? null : (char[]) inputPassword.clone());
+ }
+
+ /** Clear the retrieved password. */
+ public void clearPassword()
+ {
+ if (inputPassword != null)
+ {
+ for (int i = 0; i < inputPassword.length; i++)
+ {
+ inputPassword[i] = '\0';
+ }
+ inputPassword = null;
+ }
+ }
+
+ private void setPrompt(String prompt) throws IllegalArgumentException
+ {
+ if ((prompt == null) || (prompt.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid prompt");
+ }
+ this.prompt = prompt;
+ }
+}
diff --git a/javax/security/auth/callback/TextInputCallback.java b/javax/security/auth/callback/TextInputCallback.java
new file mode 100644
index 000000000..ebd2d4911
--- /dev/null
+++ b/javax/security/auth/callback/TextInputCallback.java
@@ -0,0 +1,178 @@
+/* TextInputCallback.java -- callbacks for user input.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+
+/**
+ * Underlying security services instantiate and pass a <code>TextInputCallback</code>
+ * to the <code>handle()</code> method of a {@link CallbackHandler} to retrieve
+ * generic text information.
+ *
+ * @see CallbackHandler
+ * @version $Revision: 1.1.2.1 $
+ */
+public class TextInputCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String prompt;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String defaultText;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String inputText;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Construct a <code>TextInputCallback</code> with a prompt.
+ *
+ * @param prompt the prompt used to request the information.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or if <code>prompt</code> has a length of <code>0</code>.
+ */
+ public TextInputCallback(String prompt) throws IllegalArgumentException
+ {
+ super();
+
+ setPrompt(prompt);
+ }
+
+ /**
+ * Construct a <code>TextInputCallback</code> with a prompt and default
+ * input value.
+ *
+ * @param prompt the prompt used to request the information.
+ * @param defaultText the text to be used as the default text displayed with
+ * the prompt.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>,
+ * if <code>prompt</code> has a length of <code>0</code>, if
+ * <code>defaultText</code> is <code>null</code> or if <code>defaultText</code>
+ * has a length of <code>0</code>.
+ */
+ public TextInputCallback(String prompt, String defaultText)
+ throws IllegalArgumentException
+ {
+ super();
+
+ setPrompt(prompt);
+ setDefaultText(defaultText);
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the prompt.
+ *
+ * @return the prompt.
+ */
+ public String getPrompt()
+ {
+ return prompt;
+ }
+
+ /**
+ * Get the default text.
+ *
+ * @return the default text, or <code>null</code> if this
+ * <code>TextInputCallback</code> was not instantiated with
+ * <code>defaultText</code>.
+ */
+ public String getDefaultText()
+ {
+ return defaultText;
+ }
+
+ /**
+ * Set the retrieved text.
+ *
+ * @param text the retrieved text, which may be <code>null</code>.
+ */
+ public void setText(String text)
+ {
+ this.inputText = text;
+ }
+
+ /**
+ * Get the retrieved text.
+ *
+ * @return the retrieved text, which may be <code>null</code>.
+ */
+ public String getText()
+ {
+ return inputText;
+ }
+
+ private void setPrompt(String prompt) throws IllegalArgumentException
+ {
+ if ((prompt == null) || (prompt.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid prompt");
+ }
+ this.prompt = prompt;
+ }
+
+ private void setDefaultText(String defaultText) throws IllegalArgumentException
+ {
+ if ((defaultText == null) || (defaultText.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid default text");
+ }
+ this.defaultText = defaultText;
+ }
+}
diff --git a/javax/security/auth/callback/TextOutputCallback.java b/javax/security/auth/callback/TextOutputCallback.java
new file mode 100644
index 000000000..243ea4d73
--- /dev/null
+++ b/javax/security/auth/callback/TextOutputCallback.java
@@ -0,0 +1,141 @@
+/* TextOutputCallback.java -- callback for text output.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+import java.io.Serializable;
+
+/**
+ * <p>Underlying security services instantiate and pass a
+ * <code>TextOutputCallback</code> to the <code>handle()</code> method of a
+ * {@link CallbackHandler} to display information messages, warning messages and
+ * error messages.</p>
+ *
+ * @see CallbackHandler
+ * @version $Revision: 1.1.2.1 $
+ */
+public class TextOutputCallback implements Callback, Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /** Information message */
+ public static final int INFORMATION = 0;
+
+ /** Warning message */
+ public static final int WARNING = 1;
+
+ /** Error message */
+ public static final int ERROR = 2;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private int messageType;
+
+ /**
+ * @serial
+ * @since 1.4
+ */
+ private String message;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Construct a <code>TextOutputCallback</code> with a message type and
+ * message to be displayed.</p>
+ *
+ * @param messageType the message type (INFORMATION, WARNING or ERROR).
+ * @param message the message to be displayed.
+ * @throws IllegalArgumentException if <code>messageType</code> is not either
+ * <code>INFORMATION</code>, <code>WARNING</code> or <code>ERROR</code>, if
+ * <code>message</code> is <code>null</code>, or if <code>message</code> has
+ * a length of <code>0</code>.
+ */
+ public TextOutputCallback(int messageType, String message)
+ throws IllegalArgumentException
+ {
+ switch (messageType)
+ {
+ case INFORMATION:
+ case WARNING:
+ case ERROR: this.messageType = messageType; break;
+ default: throw new IllegalArgumentException("invalid message type");
+ }
+
+ setMessage(message);
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Returns the message's <code>messageType</code>.</p>
+ *
+ * @return the message type (INFORMATION, WARNING or ERROR).
+ */
+ public int getMessageType()
+ {
+ return messageType;
+ }
+
+ /**
+ * <p>Returns the <code>message</code> to be displayed.</p>
+ *
+ * @return the message to be displayed.
+ */
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private void setMessage(String message) throws IllegalArgumentException
+ {
+ if ((message == null) || (message.length() == 0))
+ {
+ throw new IllegalArgumentException("invalid message");
+ }
+ this.message = message;
+ }
+}
diff --git a/javax/security/auth/callback/UnsupportedCallbackException.java b/javax/security/auth/callback/UnsupportedCallbackException.java
new file mode 100644
index 000000000..d4d6c5759
--- /dev/null
+++ b/javax/security/auth/callback/UnsupportedCallbackException.java
@@ -0,0 +1,102 @@
+/* UnsupportedCallbackException.java -- signals an unsupported callback type.
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.callback;
+
+/**
+ * Signals that a {@link CallbackHandler} does not recognize a particular
+ * {@link Callback}.
+ *
+ * @version $Revision: 1.1.2.1 $
+ */
+public class UnsupportedCallbackException extends Exception
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /** @serial */
+ private Callback callback;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructs an <code>UnsupportedCallbackException</code> with no detail
+ * message.
+ *
+ * @param callback the unrecognized {@link Callback}.
+ */
+ public UnsupportedCallbackException(Callback callback)
+ {
+ super();
+
+ this.callback = callback;
+ }
+
+ /**
+ * Constructs an <code>UnsupportedCallbackException</code> with the specified
+ * detail message. A detail message is a {@link String} that describes this
+ * particular exception.
+ *
+ * @param callback the unrecognized {@link Callback}.
+ * @param msg the detail message.
+ */
+ public UnsupportedCallbackException(Callback callback, String msg)
+ {
+ super(msg);
+
+ this.callback = callback;
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Get the unrecognized {@link Callback}.
+ *
+ * @return the unrecognized {@link Callback}.
+ */
+ public Callback getCallback()
+ {
+ return this.callback;
+ }
+}
diff --git a/javax/security/auth/callback/package.html b/javax/security/auth/callback/package.html
new file mode 100644
index 000000000..2d1c84cef
--- /dev/null
+++ b/javax/security/auth/callback/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.security.auth.callback package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.security.auth.callback</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/security/auth/login/AccountExpiredException.java b/javax/security/auth/login/AccountExpiredException.java
new file mode 100644
index 000000000..e8e331347
--- /dev/null
+++ b/javax/security/auth/login/AccountExpiredException.java
@@ -0,0 +1,64 @@
+/* AccountExpiredException.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+/**
+ * An exception that signals that an attempt was made to login to an account
+ * that has expired.
+ */
+public class AccountExpiredException extends LoginException
+{
+
+ // Constant.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -6064064890162661560L;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public AccountExpiredException()
+ {
+ }
+
+ public AccountExpiredException (String message)
+ {
+ super (message);
+ }
+}
diff --git a/javax/security/auth/login/AppConfigurationEntry.java b/javax/security/auth/login/AppConfigurationEntry.java
new file mode 100644
index 000000000..1879a68c1
--- /dev/null
+++ b/javax/security/auth/login/AppConfigurationEntry.java
@@ -0,0 +1,135 @@
+/* AppConfigurationEntry.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+public class AppConfigurationEntry
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private final String loginModuleName;
+ private final LoginModuleControlFlag controlFlag;
+ private final Map options;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public AppConfigurationEntry (final String loginModuleName,
+ final LoginModuleControlFlag controlFlag,
+ final Map options)
+ {
+ if (loginModuleName == null || loginModuleName.length() == 0)
+ throw new IllegalArgumentException ("module name cannot be null nor empty");
+ if (LoginModuleControlFlag.OPTIONAL != controlFlag &&
+ LoginModuleControlFlag.REQUIRED != controlFlag &&
+ LoginModuleControlFlag.REQUISITE != controlFlag &&
+ LoginModuleControlFlag.SUFFICIENT != controlFlag)
+ throw new IllegalArgumentException ("invalid controlFlag");
+ if (options == null)
+ throw new IllegalArgumentException ("options cannot be null");
+ this.loginModuleName = loginModuleName;
+ this.controlFlag = controlFlag;
+ this.options = Collections.unmodifiableMap (new HashMap (options));
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ public LoginModuleControlFlag getControlFlag()
+ {
+ return controlFlag;
+ }
+
+ public String getLoginModuleName()
+ {
+ return loginModuleName;
+ }
+
+ public Map getOptions()
+ {
+ return options;
+ }
+
+ // Inner class.
+ // -------------------------------------------------------------------------
+
+ public static class LoginModuleControlFlag
+ {
+
+ // Constants.
+ // -----------------------------------------------------------------------
+
+ public static final LoginModuleControlFlag OPTIONAL = new LoginModuleControlFlag();
+ public static final LoginModuleControlFlag REQUIRED = new LoginModuleControlFlag();
+ public static final LoginModuleControlFlag REQUISITE = new LoginModuleControlFlag();
+ public static final LoginModuleControlFlag SUFFICIENT = new LoginModuleControlFlag();
+
+ // Constructor.
+ // -----------------------------------------------------------------------
+
+ private LoginModuleControlFlag()
+ {
+ }
+
+ // Instance methods.
+ // -----------------------------------------------------------------------
+
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer (LoginModuleControlFlag.class.getName());
+ buf.append ('.');
+ if (this == OPTIONAL)
+ buf.append ("OPTIONAL");
+ else if (this == REQUIRED)
+ buf.append ("REQUIRED");
+ else if (this == REQUISITE)
+ buf.append ("REQUISITE");
+ else if (this == SUFFICIENT)
+ buf.append ("SUFFICIENT");
+ else
+ buf.append ("HARVEY_THE_RABBIT");
+ return buf.toString();
+ }
+ }
+}
diff --git a/javax/security/auth/login/Configuration.java b/javax/security/auth/login/Configuration.java
new file mode 100644
index 000000000..4a55013ca
--- /dev/null
+++ b/javax/security/auth/login/Configuration.java
@@ -0,0 +1,109 @@
+/* Configuration.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.Security;
+
+import javax.security.auth.AuthPermission;
+
+public abstract class Configuration
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private static Configuration config;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ protected Configuration()
+ {
+ }
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ public static synchronized Configuration getConfiguration()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission (new AuthPermission ("getLoginConfiguration"));
+ if (config == null)
+ {
+ String conf = (String) AccessController.doPrivileged
+ (new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return Security.getProperty ("login.configuration.provider");
+ }
+ });
+ try
+ {
+ if (conf != null)
+ config = (Configuration) Class.forName (conf).newInstance();
+ else
+ config = new NullConfiguration();
+ }
+ catch (Exception x)
+ {
+ config = new NullConfiguration();
+ }
+ }
+ return config;
+ }
+
+ public static synchronized void setConfiguration (Configuration config)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPermission (new AuthPermission ("setLoginConfiguration"));
+ Configuration.config = config;
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ public abstract AppConfigurationEntry[] getAppConfigurationEntry (String applicationName);
+
+ public abstract void refresh();
+}
diff --git a/javax/security/auth/login/CredentialExpiredException.java b/javax/security/auth/login/CredentialExpiredException.java
new file mode 100644
index 000000000..df643ba69
--- /dev/null
+++ b/javax/security/auth/login/CredentialExpiredException.java
@@ -0,0 +1,64 @@
+/* CredentialExpiredException.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+/**
+ * An exception that signals an attempt to login with a credential that
+ * has expired.
+ */
+public class CredentialExpiredException extends LoginException
+{
+
+ // Constant.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -5344739593859737937L;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public CredentialExpiredException()
+ {
+ }
+
+ public CredentialExpiredException (String message)
+ {
+ super (message);
+ }
+}
diff --git a/javax/security/auth/login/FailedLoginException.java b/javax/security/auth/login/FailedLoginException.java
new file mode 100644
index 000000000..384ade084
--- /dev/null
+++ b/javax/security/auth/login/FailedLoginException.java
@@ -0,0 +1,63 @@
+/* FailedLoginException.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+/**
+ * An exception that signals that an attempt to login was unsuccessful.
+ */
+public class FailedLoginException extends LoginException
+{
+
+ // Constant.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = 802556922354616286L;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public FailedLoginException()
+ {
+ }
+
+ public FailedLoginException (String message)
+ {
+ super (message);
+ }
+}
diff --git a/javax/security/auth/login/LoginContext.java b/javax/security/auth/login/LoginContext.java
new file mode 100644
index 000000000..da88e8412
--- /dev/null
+++ b/javax/security/auth/login/LoginContext.java
@@ -0,0 +1,44 @@
+/* LoginContext.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+public class LoginContext
+{
+
+}
diff --git a/javax/security/auth/login/LoginException.java b/javax/security/auth/login/LoginException.java
new file mode 100644
index 000000000..878120381
--- /dev/null
+++ b/javax/security/auth/login/LoginException.java
@@ -0,0 +1,65 @@
+/* LoginException.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * A general exception during authentication and authorization.
+ */
+public class LoginException extends GeneralSecurityException
+{
+
+ // Constant.
+ // -------------------------------------------------------------------------
+
+ private static final long serialVersionUID = -4679091624035232488L;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public LoginException()
+ {
+ }
+
+ public LoginException (String message)
+ {
+ super (message);
+ }
+}
diff --git a/javax/security/auth/login/NullConfiguration.java b/javax/security/auth/login/NullConfiguration.java
new file mode 100644
index 000000000..e1c99037f
--- /dev/null
+++ b/javax/security/auth/login/NullConfiguration.java
@@ -0,0 +1,64 @@
+/* NullConfiguration.java -- no-op default login configuration.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.login;
+
+import javax.security.auth.AuthPermission;
+
+final class NullConfiguration extends Configuration
+{
+
+ // Contructor.
+ // -------------------------------------------------------------------------
+
+ NullConfiguration()
+ {
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ public AppConfigurationEntry[] getAppConfigurationEntry (String applicationName)
+ {
+ return null;
+ }
+
+ public void refresh()
+ {
+ }
+}
diff --git a/javax/security/auth/login/package.html b/javax/security/auth/login/package.html
new file mode 100644
index 000000000..4b887f0bd
--- /dev/null
+++ b/javax/security/auth/login/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.security.auth.login package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.security.auth.login</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/security/auth/package.html b/javax/security/auth/package.html
new file mode 100644
index 000000000..a81188d19
--- /dev/null
+++ b/javax/security/auth/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.security.auth package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.security.auth</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/security/auth/x500/X500PrivateCredential.java b/javax/security/auth/x500/X500PrivateCredential.java
new file mode 100644
index 000000000..fb3a5ef40
--- /dev/null
+++ b/javax/security/auth/x500/X500PrivateCredential.java
@@ -0,0 +1,148 @@
+/* X500PrivateCredential.java -- certificate and private key pair.
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.auth.x500;
+
+import java.security.PrivateKey;
+import java.security.cert.X509Certificate;
+import javax.security.auth.Destroyable;
+
+/**
+ * A pairing of a {@link X509Certificate} and its corresponding {@link
+ * PrivateKey}, with an optional keystore alias.
+ */
+public final class X500PrivateCredential implements Destroyable
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private PrivateKey key;
+ private X509Certificate certificate;
+ private String alias;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates a new private credential with no associated keystore alias.
+ *
+ * @param certificate The X.509 certificate.
+ * @param key The private key.
+ * @throws IllegalArgumentException If either parameter is null.
+ */
+ public X500PrivateCredential (X509Certificate certificate, PrivateKey key)
+ {
+ if (certificate == null || key == null)
+ throw new IllegalArgumentException();
+ this.certificate = certificate;
+ this.key = key;
+ }
+
+ /**
+ * Creates a new private credential with a keystore alias.
+ *
+ * @param certificate The X.509 certificate.
+ * @param key The private key.
+ * @param alias The keystore alias for this credential.
+ * @throws IllegalArgumentException If any parameter is null.
+ */
+ public X500PrivateCredential (X509Certificate certificate, PrivateKey key,
+ String alias)
+ {
+ this (certificate, key);
+ if (alias == null)
+ throw new IllegalArgumentException();
+ this.alias = alias;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the certificate of this credential.
+ *
+ * @return The certificate of this credential.
+ */
+ public X509Certificate getCertificate()
+ {
+ return certificate;
+ }
+
+ /**
+ * Returns the private key of this credential.
+ *
+ * @return The private key of this credential.
+ */
+ public PrivateKey getPrivateKey()
+ {
+ return key;
+ }
+
+ /**
+ * Returns the keystore alias of this credential, or null if not present.
+ *
+ * @return The keystore alias, or null.
+ */
+ public String getAlias()
+ {
+ return alias;
+ }
+
+ /**
+ * Destroy the sensitive data of this credential, setting the certificate,
+ * private key, and keystore alias to null.
+ */
+ public void destroy()
+ {
+ certificate = null;
+ key = null;
+ alias = null;
+ }
+
+ /**
+ * Tells whether or not this credential has been destroyed, and that
+ * the certificate and private key fields are null.
+ *
+ * @return True if this object has been destroyed.
+ */
+ public boolean isDestroyed()
+ {
+ return certificate == null && key == null;
+ }
+}
diff --git a/javax/security/cert/Certificate.java b/javax/security/cert/Certificate.java
new file mode 100644
index 000000000..8090817fc
--- /dev/null
+++ b/javax/security/cert/Certificate.java
@@ -0,0 +1,176 @@
+/* Certificate.java -- base class of public-key certificates.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PublicKey;
+import java.security.SignatureException;
+
+import java.util.Arrays;
+import java.util.zip.Adler32;
+
+/**
+ * <p>The base class for public-key certificates.</p>
+ *
+ * <p><b>This class is deprecated in favor of the {@link
+ * java.security.cert.Certificate} class. It should not be used in new
+ * applications.</b></p>
+ */
+public abstract class Certificate
+{
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ public Certificate()
+ {
+ super();
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Tests if this certificate equals another.</p>
+ *
+ * @param other The object to test.
+ * @return True if the certificates are equal.
+ */
+ public boolean equals(Object other)
+ {
+ if (other == null || !(other instanceof Certificate))
+ {
+ return false;
+ }
+ if (other == this)
+ {
+ return true;
+ }
+ try
+ {
+ return Arrays.equals(getEncoded(), ((Certificate) other).getEncoded());
+ }
+ catch (CertificateEncodingException cee)
+ {
+ return false;
+ }
+ }
+
+ /**
+ * <p>Computes a hash code for this certificate.</p>
+ *
+ * @return The hash code.
+ */
+ public int hashCode()
+ {
+ try
+ {
+ Adler32 csum = new Adler32();
+ csum.update(getEncoded());
+ return (int) csum.getValue();
+ }
+ catch (CertificateEncodingException cee)
+ {
+ return 0;
+ }
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Return the encoded form of this certificate.</p>
+ *
+ * @return The encoded form.
+ * @throws CertificateEncodingException If the certificate could not be
+ * encoded.
+ */
+ public abstract byte[] getEncoded() throws CertificateEncodingException;
+
+ /**
+ * <p>Verifies the signature of this certificate.</p>
+ *
+ * @param key The signer's public key.
+ * @throws CertificateException
+ * @throws NoSuchAlgorithmException If the algorithm used to sign the
+ * certificate is not available.
+ * @throws InvalidKeyException If the supplied key is not appropriate for the
+ * certificate's signature algorithm.
+ * @throws NoSuchProviderException
+ * @throws SignatureException If the signature could not be verified.
+ */
+ public abstract void verify(PublicKey key)
+ throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException;
+
+ /**
+ * <p>Verifies the signature of this certificate, using the specified security
+ * provider.</p>
+ *
+ * @param key The signer's public key.
+ * @param sigProvider The name of the signature provider.
+ * @throws CertificateException
+ * @throws NoSuchAlgorithmException If the algorithm used to sign the
+ * certificate is not available.
+ * @throws InvalidKeyException If the supplied key is not appropriate for the
+ * certificate's signature algorithm.
+ * @throws NoSuchProviderException If <i>sigProvider</i> is not the name of an
+ * installed provider.
+ * @throws SignatureException If the signature could not be verified.
+ */
+ public abstract void verify(PublicKey key, String sigProvider)
+ throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException;
+
+ /**
+ * <p>Returns a printable representation of this certificate.</p>
+ *
+ * @return The string.
+ */
+ public abstract String toString();
+
+ /**
+ * <p>Returns this certificate's public key.</p>
+ *
+ * @return The public key.
+ */
+ public abstract PublicKey getPublicKey();
+}
diff --git a/javax/security/cert/CertificateEncodingException.java b/javax/security/cert/CertificateEncodingException.java
new file mode 100644
index 000000000..81c85dd9f
--- /dev/null
+++ b/javax/security/cert/CertificateEncodingException.java
@@ -0,0 +1,60 @@
+/* CertificateEncodingException.java -- certificate encoding exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+/**
+ * <p>Signals a problem when encoding certificates.</p>
+ *
+ * <p><b>This class is deprecated in favor of the {@link
+ * java.security.cert.CertificateEncodingException} class. It should not be used
+ * in new applications.</b></p>
+ */
+public class CertificateEncodingException extends CertificateException
+{
+
+ public CertificateEncodingException()
+ {
+ super();
+ }
+
+ public CertificateEncodingException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/javax/security/cert/CertificateException.java b/javax/security/cert/CertificateException.java
new file mode 100644
index 000000000..4e79a3120
--- /dev/null
+++ b/javax/security/cert/CertificateException.java
@@ -0,0 +1,60 @@
+/* CertificateException.java -- certificate exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+/**
+ * <p>Signals a generic problem with certificates.</p>
+ *
+ * <p><b>This class is deprecated in favor of the {@link
+ * java.security.cert.CertificateException} class. It should not be used in new
+ * applications.</b></p>
+ */
+public class CertificateException extends Exception
+{
+
+ public CertificateException()
+ {
+ super();
+ }
+
+ public CertificateException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/javax/security/cert/CertificateExpiredException.java b/javax/security/cert/CertificateExpiredException.java
new file mode 100644
index 000000000..53b0cc007
--- /dev/null
+++ b/javax/security/cert/CertificateExpiredException.java
@@ -0,0 +1,60 @@
+/* CertificateExpiredException.java -- certificate expired exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+/**
+ * <p>Signals that a certificate has expired.</p>
+ *
+ * <p><b>This class is deprecated in favor of the {@link
+ * java.security.cert.CertificateExpiredException} class. It should not be used
+ * in new applications.</b></p>
+ */
+public class CertificateExpiredException extends CertificateException
+{
+
+ public CertificateExpiredException()
+ {
+ super();
+ }
+
+ public CertificateExpiredException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/javax/security/cert/CertificateNotYetValidException.java b/javax/security/cert/CertificateNotYetValidException.java
new file mode 100644
index 000000000..56c8aeb7f
--- /dev/null
+++ b/javax/security/cert/CertificateNotYetValidException.java
@@ -0,0 +1,60 @@
+/* CertificateNotYetValidException.java -- certificate not yet valid exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+/**
+ * <p>Signals that a certificate is not yet valid.</p>
+ *
+ * <p><b>This class is deprecated in favor of the {@link
+ * java.security.cert.CertificateNotYetValidException} class. It should not be
+ * used in new applications.</b></p>
+ */
+public class CertificateNotYetValidException extends CertificateException
+{
+
+ public CertificateNotYetValidException()
+ {
+ super();
+ }
+
+ public CertificateNotYetValidException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/javax/security/cert/CertificateParsingException.java b/javax/security/cert/CertificateParsingException.java
new file mode 100644
index 000000000..17012e2f1
--- /dev/null
+++ b/javax/security/cert/CertificateParsingException.java
@@ -0,0 +1,59 @@
+/* CertificateParsingException.java -- certificate parsing exception.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+/**
+ * <p>Signals a parsing error when decoding a certificate.</p>
+ *
+ * <p><b>This class is deprecated. It should not be used in new
+ * applications.</b></p>
+ */
+public class CertificateParsingException extends CertificateException
+{
+
+ public CertificateParsingException()
+ {
+ super();
+ }
+
+ public CertificateParsingException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/javax/security/cert/X509CertBridge.java b/javax/security/cert/X509CertBridge.java
new file mode 100644
index 000000000..1c075d6d5
--- /dev/null
+++ b/javax/security/cert/X509CertBridge.java
@@ -0,0 +1,203 @@
+/* X509CertBridge.java -- bridge between JDK and JSSE cert APIs.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+import java.math.BigInteger;
+
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.PublicKey;
+import java.security.Principal;
+import java.security.SignatureException;
+
+import java.util.Date;
+
+/**
+ * <p>An implementation of the {@link X509Certificate} class that delegates
+ * calls to a {@link java.security.cert.X509Certificate}.</p>
+ */
+final class X509CertBridge extends X509Certificate
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private java.security.cert.X509Certificate cert;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ X509CertBridge(java.security.cert.X509Certificate cert)
+ {
+ this.cert = cert;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ public byte[] getEncoded() throws CertificateEncodingException
+ {
+ try
+ {
+ return cert.getEncoded();
+ }
+ catch (java.security.cert.CertificateEncodingException cee)
+ {
+ throw new CertificateEncodingException(cee.getMessage());
+ }
+ }
+
+ public void verify(PublicKey key)
+ throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException
+ {
+ try
+ {
+ cert.verify(key);
+ }
+ catch (java.security.cert.CertificateException ce)
+ {
+ throw new CertificateException(ce.getMessage());
+ }
+ }
+
+ public void verify(PublicKey key, String sigProvider)
+ throws CertificateException, NoSuchAlgorithmException, InvalidKeyException,
+ NoSuchProviderException, SignatureException
+ {
+ try
+ {
+ cert.verify(key, sigProvider);
+ }
+ catch (java.security.cert.CertificateException ce)
+ {
+ throw new CertificateException(ce.getMessage());
+ }
+ }
+
+ public String toString()
+ {
+ return cert.toString();
+ }
+
+ public PublicKey getPublicKey()
+ {
+ return cert.getPublicKey();
+ }
+
+ public void checkValidity()
+ throws CertificateExpiredException, CertificateNotYetValidException
+ {
+ try
+ {
+ cert.checkValidity();
+ }
+ catch (java.security.cert.CertificateExpiredException cee)
+ {
+ throw new CertificateExpiredException(cee.getMessage());
+ }
+ catch (java.security.cert.CertificateNotYetValidException cnyve)
+ {
+ throw new CertificateNotYetValidException(cnyve.getMessage());
+ }
+ }
+
+ public void checkValidity(Date date)
+ throws CertificateExpiredException, CertificateNotYetValidException
+ {
+ try
+ {
+ cert.checkValidity(date);
+ }
+ catch (java.security.cert.CertificateExpiredException cee)
+ {
+ throw new CertificateExpiredException(cee.getMessage());
+ }
+ catch (java.security.cert.CertificateNotYetValidException cnyve)
+ {
+ throw new CertificateNotYetValidException(cnyve.getMessage());
+ }
+ }
+
+ public int getVersion()
+ {
+ return cert.getVersion();
+ }
+
+ public BigInteger getSerialNumber()
+ {
+ return cert.getSerialNumber();
+ }
+
+ public Principal getIssuerDN()
+ {
+ return cert.getIssuerDN();
+ }
+
+ public Principal getSubjectDN()
+ {
+ return cert.getSubjectDN();
+ }
+
+ public Date getNotBefore()
+ {
+ return cert.getNotBefore();
+ }
+
+ public Date getNotAfter()
+ {
+ return cert.getNotAfter();
+ }
+
+ public String getSigAlgName()
+ {
+ return cert.getSigAlgName();
+ }
+
+ public String getSigAlgOID()
+ {
+ return cert.getSigAlgOID();
+ }
+
+ public byte[] getSigAlgParams()
+ {
+ return cert.getSigAlgParams();
+ }
+}
diff --git a/javax/security/cert/X509Certificate.java b/javax/security/cert/X509Certificate.java
new file mode 100644
index 000000000..2bf0b4e94
--- /dev/null
+++ b/javax/security/cert/X509Certificate.java
@@ -0,0 +1,191 @@
+/* X509Certificate.java -- base class of X.509 certificates.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.cert;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+
+import java.math.BigInteger;
+
+import java.security.NoSuchAlgorithmException;
+import java.security.Principal;
+import java.security.cert.CertificateFactory;
+
+import java.util.Date;
+
+/**
+ * <p>The base class of all X.509 certificates.</p>
+ *
+ * <p><b>This class is deprecated in favor of the {@link
+ * java.security.cert.X509Certificate} class. It should not be used in new
+ * applications.</b></p>
+ */
+public abstract class X509Certificate extends Certificate
+{
+
+ // Class methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Get an instance of X509Certificate for the given encoded bytes.</p>
+ *
+ * @param encoded The encoded certificate.
+ * @return An instance of X509Certificate.
+ * @throws CertificateException If the encoded certificate cannot be parsed.
+ */
+ public static X509Certificate getInstance(byte[] encoded)
+ throws CertificateException
+ {
+ return getInstance(new ByteArrayInputStream(encoded));
+ }
+
+ /**
+ * <p>Get an instance of X509Certificate for the given encoded stream.</p>
+ *
+ * @param encoded The encoded certificate stream..
+ * @return An instance of X509Certificate.
+ * @throws CertificateException If the encoded certificate cannot be parsed.
+ */
+ public static X509Certificate getInstance(InputStream encoded)
+ throws CertificateException
+ {
+ try
+ {
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ return new X509CertBridge((java.security.cert.X509Certificate)
+ cf.generateCertificate(encoded));
+ }
+ catch (java.security.cert.CertificateException ce)
+ {
+ throw new CertificateException(ce.getMessage());
+ }
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Check if this certificate is valid now.</p>
+ *
+ * @throws CertificateExpiredException If the certificate has expired.
+ * @throws CertificateNotYetValidException If the certificate is not yet valid.
+ * @see #checkValidity(java.util.Date)
+ */
+ public abstract void checkValidity()
+ throws CertificateExpiredException, CertificateNotYetValidException;
+
+ /**
+ * <p>Check if this certificate is valid for the given date.</p>
+ *
+ * @param date The date to check.
+ * @throws CertificateExpiredException If the certificate has expired.
+ * @throws CertificateNotYetValidException If the certificate is not yet valid.
+ */
+ public abstract void checkValidity(Date date)
+ throws CertificateExpiredException, CertificateNotYetValidException;
+
+ /**
+ * <p>Returns the X.509 version number.</p>
+ *
+ * @return The version number.
+ */
+ public abstract int getVersion();
+
+ /**
+ * <p>Returns this certificate's serial number.</p>
+ *
+ * @return The serial number.
+ */
+ public abstract BigInteger getSerialNumber();
+
+ /**
+ * <p>Returns the distinguished name of this certificate's issuer.</p>
+ *
+ * @return The issuer's distinguished name.
+ */
+ public abstract Principal getIssuerDN();
+
+ /**
+ * <p>Returns the distinguished name of this certificate's subject.</p>
+ *
+ * @return The subject's distinguished name.
+ */
+ public abstract Principal getSubjectDN();
+
+ /**
+ * <p>Returns the <i>not before</i> portion of this certificate's validity
+ * period.</p>
+ *
+ * @return The not before date.
+ */
+ public abstract Date getNotBefore();
+
+ /**
+ * <p>Returns the <i>not after</i> portion of this certificate's validity
+ * period.</p>
+ *
+ * @return The not after date.
+ */
+ public abstract Date getNotAfter();
+
+ /**
+ * <p>Returns the name of this certificate's signature algorithm.</p>
+ *
+ * @return The name of the signature algorithm.
+ */
+ public abstract String getSigAlgName();
+
+ /**
+ * <p>Returns the object identifier (OID) of this certificate's signature
+ * algorithm. The returned string is a sequence of integers separated by
+ * periods.</p>
+ *
+ * @return The signature OID.
+ */
+ public abstract String getSigAlgOID();
+
+ /**
+ * <p>Returns the signature parameters. The returned byte array contains the
+ * raw DER-encoded parameters.</p>
+ *
+ * @return The signature parameters.
+ */
+ public abstract byte[] getSigAlgParams();
+}
diff --git a/javax/security/cert/package.html b/javax/security/cert/package.html
new file mode 100644
index 000000000..cccdf5f80
--- /dev/null
+++ b/javax/security/cert/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.security.cert package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.security.cert</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/security/package.html b/javax/security/package.html
new file mode 100644
index 000000000..619654641
--- /dev/null
+++ b/javax/security/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.security package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.security</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/security/sasl/AuthenticationException.java b/javax/security/sasl/AuthenticationException.java
new file mode 100644
index 000000000..1af2eb30a
--- /dev/null
+++ b/javax/security/sasl/AuthenticationException.java
@@ -0,0 +1,105 @@
+/* AuthenticationException.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpathis free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpathis distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+/**
+ * <p>This exception is thrown by a SASL mechanism implementation to indicate
+ * that the SASL exchange has failed due to reasons related to authentication,
+ * such as an invalid identity, passphrase, or key.</p>
+ *
+ * <p>Note that the lack of an <code>AuthenticationException</code> does not
+ * mean that the failure was not due to an authentication error. A SASL
+ * mechanism implementation might throw the more general {@link SaslException}
+ * instead of <code>AuthenticationException</code> if it is unable to determine
+ * the nature of the failure, or if does not want to disclose the nature of the
+ * failure, for example, due to security reasons.</p>
+ */
+public class AuthenticationException extends SaslException
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructs a new instance of <code>AuthenticationException</code>. The
+ * root exception and the detailed message are <code>null</code>.
+ */
+ public AuthenticationException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs a new instance of <code>AuthenticationException</code> with a
+ * detailed message. The root exception is <code>null</code>.
+ *
+ * @param detail a possibly <code>null</code> string containing details of
+ * the exception.
+ * @see Throwable#getMessage()
+ */
+ public AuthenticationException(String detail)
+ {
+ super(detail);
+ }
+
+ /**
+ * Constructs a new instance of <code>AuthenticationException</code> with a
+ * detailed message and a root exception.
+ *
+ * @param detail a possibly <code>null</code> string containing details of
+ * the exception.
+ * @param ex a possibly <code>null</code> root exception that caused this
+ * exception.
+ * @see Throwable#getMessage()
+ * @see SaslException#getCause()
+ */
+ public AuthenticationException(String detail, Throwable ex)
+ {
+ super(detail, ex);
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+}
diff --git a/javax/security/sasl/AuthorizeCallback.java b/javax/security/sasl/AuthorizeCallback.java
new file mode 100644
index 000000000..77fe78698
--- /dev/null
+++ b/javax/security/sasl/AuthorizeCallback.java
@@ -0,0 +1,171 @@
+/* AuthorizeCallback.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpathis free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpathis distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import javax.security.auth.callback.Callback;
+
+/**
+ * This callback is used by {@link SaslServer} to determine whether one entity
+ * (identified by an authenticated authentication ID) can act on behalf of
+ * another entity (identified by an authorization ID).
+ */
+public class AuthorizeCallback implements Callback
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /** @serial The (authenticated) authentication id to check. */
+ private String authenticationID = null;
+
+ /** @serial The authorization id to check. */
+ private String authorizationID = null;
+
+ /**
+ * @serial The id of the authorized entity. If null, the id of the authorized
+ * entity is authorizationID.
+ */
+ private String authorizedID = null;
+
+ /**
+ * @serial A flag indicating whether the authentication id is allowed to act
+ * on behalf of the authorization id.
+ */
+ private boolean authorized = false;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructs an instance of <code>AuthorizeCallback</code>.
+ *
+ * @param authnID the (authenticated) authentication ID.
+ * @param authzID the authorization ID.
+ */
+ public AuthorizeCallback(String authnID, String authzID)
+ {
+ super();
+
+ this.authenticationID = authnID;
+ this.authorizationID = authzID;
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the authentication ID to check.
+ *
+ * @return the authentication ID to check
+ */
+ public String getAuthenticationID()
+ {
+ return authenticationID;
+ }
+
+ /**
+ * Returns the authorization ID to check.
+ *
+ * @return the authorization ID to check.
+ */
+ public String getAuthorizationID()
+ {
+ return authorizationID;
+ }
+
+ /**
+ * Determines if the identity represented by authentication ID is allowed to
+ * act on behalf of the authorization ID.
+ *
+ * @return <code>true</code> if authorization is allowed; <code>false</code>
+ * otherwise.
+ * @see #setAuthorized(boolean)
+ * @see #getAuthorizedID()
+ */
+ public boolean isAuthorized()
+ {
+ return authorized;
+ }
+
+ /**
+ * Sets if authorization is allowed or not.
+ *
+ * @param authorized <code>true</code> if authorization is allowed;
+ * <code>false</code> otherwise.
+ * @see #isAuthorized()
+ * @see #setAuthorizedID(String)
+ */
+ public void setAuthorized(boolean authorized)
+ {
+ this.authorized = authorized;
+ }
+
+ /**
+ * Returns the ID of the authorized user.
+ *
+ * @return the ID of the authorized user. <code>null</code> means the
+ * authorization failed.
+ * @see #setAuthorized(boolean)
+ * @see #setAuthorizedID(String)
+ */
+ public String getAuthorizedID()
+ {
+ if (!authorized)
+ {
+ return null;
+ }
+ return (authorizedID != null ? authorizedID : authorizationID);
+ }
+
+ /**
+ * Sets the ID of the authorized entity. Called by handler only when the ID
+ * is different from {@link #getAuthorizationID()}. For example, the ID might
+ * need to be canonicalized for the environment in which it will be used.
+ *
+ * @see #setAuthorized(boolean)
+ * @see #getAuthorizedID()
+ */
+ public void setAuthorizedID(String id)
+ {
+ this.authorizedID = id;
+ }
+}
diff --git a/javax/security/sasl/RealmCallback.java b/javax/security/sasl/RealmCallback.java
new file mode 100644
index 000000000..49bc08ae2
--- /dev/null
+++ b/javax/security/sasl/RealmCallback.java
@@ -0,0 +1,75 @@
+/* RealmCallback.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import javax.security.auth.callback.TextInputCallback;
+
+/**
+ * This callback is used by {@link SaslClient} and {@link SaslServer} to
+ * retrieve realm information.
+ */
+public class RealmCallback extends TextInputCallback
+{
+
+ /**
+ * Constructs a <code>RealmCallback</code> with a prompt.
+ *
+ * @param prompt the non-null prompt to use to request the realm information.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or empty.
+ */
+ public RealmCallback(String prompt)
+ {
+ super(prompt);
+ }
+
+ /**
+ * Constructs a <code>RealmCallback</code> with a prompt and default realm
+ * information.
+ *
+ * @param prompt the non-null prompt to use to request the realm information.
+ * @param defaultRealmInfo the non-null default realm information to use.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or empty, or if <code>defaultRealm</code> is empty or <code>null</code>.
+ */
+ public RealmCallback(String prompt, String defaultRealmInfo)
+ {
+ super(prompt, defaultRealmInfo);
+ }
+}
diff --git a/javax/security/sasl/RealmChoiceCallback.java b/javax/security/sasl/RealmChoiceCallback.java
new file mode 100644
index 000000000..2e0040761
--- /dev/null
+++ b/javax/security/sasl/RealmChoiceCallback.java
@@ -0,0 +1,71 @@
+/* RealmChoiceCallback.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import javax.security.auth.callback.ChoiceCallback;
+
+/**
+ * This callback is used by {@link SaslClient} and {@link SaslServer} to obtain
+ * a realm given a list of realm choices.
+ */
+public class RealmChoiceCallback extends ChoiceCallback
+{
+
+ /**
+ * Constructs a <code>RealmChoiceCallback</code> with a prompt, a list of
+ * choices and a default choice.
+ *
+ * @param prompt the non-null prompt to use to request the realm.
+ * @param choices the non-null list of realms to choose from.
+ * @param defaultChoice the choice to be used as the default when the list of
+ * choices is displayed. It is an index into the <code>choices</code> array.
+ * @param multiple <code>true</code> if multiple choices allowed;
+ * <code>false</code> otherwise.
+ * @throws IllegalArgumentException if <code>prompt</code> is <code>null</code>
+ * or empty, if <code>choices</code> has a length of <code>0</code>, if any
+ * element from <code>choices</code> is <code>null</code> or empty, or if
+ * <code>defaultChoice</code> does not fall within the array boundary of
+ * <code>choices</code>.
+ */
+ public RealmChoiceCallback(String prompt, String[] choices, int defaultChoice,
+ boolean multiple)
+ {
+ super(prompt, choices, defaultChoice, multiple);
+ }
+}
diff --git a/javax/security/sasl/Sasl.java b/javax/security/sasl/Sasl.java
new file mode 100644
index 000000000..2174692f4
--- /dev/null
+++ b/javax/security/sasl/Sasl.java
@@ -0,0 +1,691 @@
+/* Sasl.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Vector;
+import java.security.Security;
+import java.security.Provider;
+
+import javax.security.auth.callback.CallbackHandler;
+
+/**
+ * <p>A static class for creating SASL clients and servers.</p>
+ *
+ * <p>This class defines the policy of how to locate, load, and instantiate SASL
+ * clients and servers.</p>
+ *
+ * <p>For example, an application or library gets a SASL client instance by
+ * doing something like:</p>
+ *
+ * <pre>
+ *SaslClient sc =
+ * Sasl.createSaslClient(mechanisms, authorizationID, protocol,
+ * serverName, props, callbackHandler);
+ * </pre>
+ *
+ * <p>It can then proceed to use the instance to create an authenticated
+ * connection.</p>
+ *
+ * <p>Similarly, a server gets a SASL server instance by using code that looks
+ * as follows:</p>
+ *
+ * <pre>
+ *SaslServer ss =
+ * Sasl.createSaslServer(mechanism, protocol, serverName, props,
+ * callbackHandler);
+ * </pre>
+ */
+public class Sasl
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>The name of a property that specifies the quality-of-protection to use.
+ * The property contains a comma-separated, ordered list of quality-of-
+ * protection values that the client or server is willing to support. A qop
+ * value is one of:</p>
+ *
+ * <ul>
+ * <li><code>"auth"</code> - authentication only,</li>
+ * <li><code>"auth-int"</code> - authentication plus integrity
+ * protection,</li>
+ * <li><code>"auth-conf"</code> - authentication plus integrity and
+ * confidentiality protection.</li>
+ * </ul>
+ *
+ * <p>The order of the list specifies the preference order of the client or
+ * server.</p>
+ *
+ * <p>If this property is absent, the default qop is <code>"auth"</code>.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.qop"</code>.</p>
+ */
+ public static final String QOP = "javax.security.sasl.qop";
+
+ /**
+ * <p>The name of a property that specifies the cipher strength to use. The
+ * property contains a comma-separated, ordered list of cipher strength
+ * values that the client or server is willing to support. A strength value
+ * is one of:</p>
+ *
+ * <ul>
+ * <li><code>"low"</code>,</li>
+ * <li><code>"medium"</code>,</li>
+ * <li><code>"high"</code>.</li>
+ * </ul>
+ *
+ * <p>The order of the list specifies the preference order of the client or
+ * server. An implementation should allow configuration of the meaning of
+ * these values. An application may use the Java Cryptography Extension (JCE)
+ * with JCE-aware mechanisms to control the selection of cipher suites that
+ * match the strength values.</p>
+ *
+ * <p>If this property is absent, the default strength is
+ * <code>"high,medium,low"</code>.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.strength"</code>.
+ * </p>
+ */
+ public static final String STRENGTH = "javax.security.sasl.strength";
+
+ /**
+ * <p>The name of a property that specifies whether the server must authenticate
+ * to the client. The property contains <code>"true"</code> if the server
+ * must authenticate the to client; <code>"false"</code> otherwise. The
+ * default is <code>"false"</code>.</p>
+ *
+ * <p>The value of this constant is
+ * <code>"javax.security.sasl.server.authentication"</code>.</p>
+ */
+ public static final String SERVER_AUTH = "javax.security.sasl.server.authentication";
+
+ /**
+ * <p>The name of a property that specifies the maximum size of the receive
+ * buffer in bytes of {@link SaslClient}/{@link SaslServer}. The property
+ * contains the string representation of an integer.</p>
+ *
+ * <p>If this property is absent, the default size is defined by the
+ * mechanism.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.maxbuffer"</code>.
+ * </p>
+ */
+ public static final String MAX_BUFFER = "javax.security.sasl.maxbuffer";
+
+ /**
+ * <p>The name of a property that specifies the maximum size of the raw send
+ * buffer in bytes of {@link SaslClient}/{@link SaslServer}. The property
+ * contains the string representation of an integer. The value of this
+ * property is negotiated between the client and server during the
+ * authentication exchange.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.rawsendsize"</code>.
+ * </p>
+ */
+ public static final String RAW_SEND_SIZE = "javax.security.sasl.rawsendsize";
+
+ /**
+ * <p>The name of a property that specifies whether mechanisms susceptible
+ * to simple plain passive attacks (e.g., "PLAIN") are not permitted. The
+ * property contains <code>"true"</code> if such mechanisms are not
+ * permitted; <code>"false"</code> if such mechanisms are permitted. The
+ * default is <code>"false"</code>.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.policy.noplaintext"</code>.
+ * </p>
+ */
+ public static final String POLICY_NOPLAINTEXT = "javax.security.sasl.policy.noplaintext";
+
+ /**
+ * <p>The name of a property that specifies whether mechanisms susceptible to
+ * active (non-dictionary) attacks are not permitted. The property contains
+ * <code>"true"</code> if mechanisms susceptible to active attacks are not
+ * permitted; <code>"false"</code> if such mechanisms are permitted. The
+ * default is <code>"false"</code>.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.policy.noactive"</code>.
+ * </p>
+ */
+ public static final String POLICY_NOACTIVE = "javax.security.sasl.policy.noactive";
+
+ /**
+ * <p>The name of a property that specifies whether mechanisms susceptible to
+ * passive dictionary attacks are not permitted. The property contains
+ * <code>"true"</code> if mechanisms susceptible to dictionary attacks are
+ * not permitted; <code>"false"</code> if such mechanisms are permitted. The
+ * default is <code>"false"</code>.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.policy.nodictionary"</code>.
+ * </p>
+ */
+ public static final String POLICY_NODICTIONARY = "javax.security.sasl.policy.nodictionary";
+
+ /**
+ * <p>The name of a property that specifies whether mechanisms that accept
+ * anonymous login are not permitted. The property contains <code>"true"</code>
+ * if mechanisms that accept anonymous login are not permitted; <code>"false"
+ * </code> if such mechanisms are permitted. The default is <code>"false"</code>.
+ * </p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.policy.noanonymous"</code>.
+ * </p>
+ */
+ public static final String POLICY_NOANONYMOUS = "javax.security.sasl.policy.noanonymous";
+
+ /**
+ * The name of a property that specifies whether mechanisms that implement
+ * forward secrecy between sessions are required. Forward secrecy means that
+ * breaking into one session will not automatically provide information for
+ * breaking into future sessions. The property contains <code>"true"</code>
+ * if mechanisms that implement forward secrecy between sessions are
+ * required; <code>"false"</code> if such mechanisms are not required. The
+ * default is <code>"false"</code>.</p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.policy.forward"</code>.
+ * </p>
+ */
+ public static final String POLICY_FORWARD_SECRECY = "javax.security.sasl.policy.forward";
+
+ /**
+ * The name of a property that specifies whether mechanisms that pass client
+ * credentials are required. The property contains <code>"true"</code> if
+ * mechanisms that pass client credentials are required; <code>"false"</code>
+ * if such mechanisms are not required. The default is <code>"false"</code>.
+ * </p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.policy.credentials"</code>.
+ * </p>
+ */
+ public static final String POLICY_PASS_CREDENTIALS = "javax.security.sasl.policy.credentials";
+
+ /**
+ * <p>The name of a property that specifies whether to reuse previously
+ * authenticated session information. The property contains <code>"true"</code>
+ * if the mechanism implementation may attempt to reuse previously
+ * authenticated session information; it contains <code>"false"</code> if the
+ * implementation must not reuse previously authenticated session information.
+ * A setting of <code>"true"</code> serves only as a hint; it does not
+ * necessarily entail actual reuse because reuse might not be possible due to
+ * a number of reasons, including, but not limited to, lack of mechanism
+ * support for reuse, expiration of reusable information, and the peer's
+ * refusal to support reuse. The property's default value is <code>"false"</code>.
+ * </p>
+ *
+ * <p>The value of this constant is <code>"javax.security.sasl.reuse"</code>.
+ * Note that all other parameters and properties required to create a SASL
+ * client/server instance must be provided regardless of whether this
+ * property has been supplied. That is, you cannot supply any less
+ * information in anticipation of reuse. Mechanism implementations that
+ * support reuse might allow customization of its implementation for factors
+ * such as cache size, timeouts, and criteria for reuseability. Such
+ * customizations are implementation-dependent.</p>
+ */
+ public static final String REUSE = "javax.security.sasl.reuse";
+
+ private static final String CLIENT_FACTORY_SVC = "SaslClientFactory.";
+ private static final String SERVER_FACTORY_SVC = "SaslServerFactory.";
+ private static final String ALIAS = "Alg.Alias.";
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ private Sasl()
+ {
+ super();
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Creates a {@link SaslClient} for the specified mechanism.</p>
+ *
+ * <p>This method uses the JCA Security Provider Framework, described in the
+ * "Java Cryptography Architecture API Specification &amp; Reference", for
+ * locating and selecting a {@link SaslClient} implementation.</p>
+ *
+ * <p>First, it obtains an ordered list of {@link SaslClientFactory}
+ * instances from the registered security providers for the
+ * <code>"SaslClientFactory"</code> service and the specified mechanism. It
+ * then invokes <code>createSaslClient()</code> on each factory instance on
+ * the list until one produces a non-null {@link SaslClient} instance. It
+ * returns the non-null {@link SaslClient} instance, or <code>null</code> if
+ * the search fails to produce a non-null {@link SaslClient} instance.</p>
+ *
+ * <p>A security provider for <code>SaslClientFactory</code> registers with
+ * the JCA Security Provider Framework keys of the form:</p>
+ *
+ * <pre>
+ * SaslClientFactory.mechanism_name
+ * </pre>
+ *
+ * <p>and values that are class names of implementations of {@link
+ * SaslClientFactory}.</p>
+ *
+ * <p>For example, a provider that contains a factory class,
+ * <code>com.wiz.sasl.digest.ClientFactory</code>, that supports the
+ * <code>"DIGEST-MD5"</code> mechanism would register the following entry
+ * with the JCA:</p>
+ *
+ * <pre>
+ * SaslClientFactory.DIGEST-MD5 com.wiz.sasl.digest.ClientFactory
+ * </pre>
+ *
+ * <p>See the "Java Cryptography Architecture API Specification &amp;
+ * Reference" for information about how to install and configure security
+ * service providers.</p>
+ *
+ * @param mechanisms the non-null list of mechanism names to try. Each is the
+ * IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5").
+ * @param authorizationID the possibly <code>null</code> protocol-dependent
+ * identification to be used for authorization. If <code>null</code> or
+ * empty, the server derives an authorization ID from the client's
+ * authentication credentials. When the SASL authentication completes
+ * successfully, the specified entity is granted access.
+ * @param protocol the non-null string name of the protocol for which the
+ * authentication is being performed (e.g. "ldap").
+ * @param serverName the non-null fully-qualified host name of the server to
+ * authenticate to.
+ * @param props the possibly null set of properties used to select the SASL
+ * mechanism and to configure the authentication exchange of the selected
+ * mechanism. For example, if props contains the {@link Sasl#POLICY_NOPLAINTEXT}
+ * property with the value <code>"true"</code>, then the selected SASL
+ * mechanism must not be susceptible to simple plain passive attacks. In
+ * addition to the standard properties declared in this class, other,
+ * possibly mechanism-specific, properties can be included. Properties not
+ * relevant to the selected mechanism are ignored.
+ * @param cbh the possibly <code>null</code> callback handler to used by the
+ * SASL mechanisms to get further information from the application/library to
+ * complete the authentication. For example, a SASL mechanism might require
+ * the authentication ID, password and realm from the caller. The
+ * authentication ID is requested by using a
+ * {@link javax.security.auth.callback.NameCallback}. The password is
+ * requested by using a {@link javax.security.auth.callback.PasswordCallback}.
+ * The realm is requested by using a {@link RealmChoiceCallback} if there is
+ * a list of realms to choose from, and by using a {@link RealmCallback} if
+ * the realm must be entered.
+ * @return a possibly <code>null</code> {@link SaslClient} created using the
+ * parameters supplied. If <code>null</code>, the method could not find a
+ * {@link SaslClientFactory} that will produce one.
+ * @throws SaslException if a {@link SaslClient} cannot be created because
+ * of an error.
+ */
+ public static SaslClient createSaslClient(String[] mechanisms,
+ String authorizationID,
+ String protocol,
+ String serverName, Map props,
+ CallbackHandler cbh)
+ throws SaslException
+ {
+ if (mechanisms == null)
+ {
+ return null;
+ }
+ Provider[] providers = Security.getProviders();
+ if (providers == null || providers.length == 0)
+ {
+ return null;
+ }
+
+ SaslClient result = null;
+ SaslClientFactory factory = null;
+ String m, clazz = null, upper, alias;
+ int j;
+ Provider p;
+ for (int i = 0; i < mechanisms.length; i++)
+ {
+ m = mechanisms[i];
+ if (m == null)
+ continue;
+ for (j = 0; j < providers.length; j++)
+ {
+ p = providers[j];
+ if (p != null)
+ {
+ // try the name as is
+ clazz = p.getProperty(CLIENT_FACTORY_SVC + m);
+ if (clazz == null) // try all uppercase
+ {
+ upper = m.toUpperCase();
+ clazz = p.getProperty(CLIENT_FACTORY_SVC + upper);
+ if (clazz == null) // try if it's an alias
+ {
+ alias = p.getProperty(ALIAS + CLIENT_FACTORY_SVC + m);
+ if (alias == null) // try all-uppercase alias name
+ {
+ alias = p.getProperty(ALIAS + CLIENT_FACTORY_SVC + upper);
+ if (alias == null) // spit the dummy
+ continue;
+ }
+ clazz = p.getProperty(CLIENT_FACTORY_SVC + alias);
+ }
+ }
+ if (clazz == null)
+ continue;
+ else
+ clazz = clazz.trim();
+ }
+
+ try
+ {
+ result = null;
+ factory = (SaslClientFactory) Class.forName(clazz).newInstance();
+ result = factory.createSaslClient(mechanisms, authorizationID,
+ protocol, serverName, props, cbh);
+ }
+ catch (ClassCastException ignored) // ignore instantiation exceptions
+ {
+ }
+ catch (ClassNotFoundException ignored)
+ {
+ }
+ catch (InstantiationException ignored)
+ {
+ }
+ catch (IllegalAccessException ignored)
+ {
+ }
+ if (result != null)
+ return result;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Gets an enumeration of known factories for producing a {@link SaslClient}
+ * instance. This method uses the same sources for locating factories as
+ * <code>createSaslClient()</code>.
+ *
+ * @return a non-null {@link Enumeration} of known factories for producing a
+ * {@link SaslClient} instance.
+ * @see #createSaslClient(String[],String,String,String,Map,CallbackHandler)
+ */
+ public static Enumeration getSaslClientFactories()
+ {
+ Vector result = new Vector();
+ HashSet names = new HashSet();
+ Provider[] providers = Security.getProviders();
+ Iterator it;
+ if (providers == null)
+ {
+ Provider p;
+ String key;
+ for (int i = 0; i < providers.length; i++)
+ {
+ p = providers[i];
+ for (it = p.keySet().iterator(); it.hasNext(); )
+ {
+ key = (String) it.next();
+ // add key's binding (a) it is a class of a client factory,
+ // and (b) the key does not include blanks
+ if (key.startsWith(CLIENT_FACTORY_SVC) && key.indexOf(" ") == -1)
+ {
+ names.add(p.getProperty(key));
+ break;
+ }
+ }
+ }
+ }
+ // we have the factory class names in names; instantiate and enumerate
+ String c;
+ for (it = names.iterator(); it.hasNext(); )
+ {
+ c = (String) it.next();
+ try
+ {
+ SaslClientFactory f = (SaslClientFactory) Class.forName(c).newInstance();
+ if (f != null)
+ result.add(f);
+ } catch (ClassCastException ignored) { // ignore instantiation exceptions
+ } catch (ClassNotFoundException ignored) {
+ } catch (InstantiationException ignored) {
+ } catch (IllegalAccessException ignored) {
+ }
+ }
+
+ return result.elements();
+ }
+
+ /**
+ * <p>Creates a {@link SaslServer} for the specified mechanism.</p>
+ *
+ * <p>This method uses the JCA Security Provider Framework, described in the
+ * "Java Cryptography Architecture API Specification &amp; Reference", for
+ * locating and selecting a SaslServer implementation.</p>
+ *
+ * <p>First, it obtains an ordered list of {@link SaslServerFactory}
+ * instances from the registered security providers for the
+ * <code>"SaslServerFactory"</code> service and the specified mechanism. It
+ * then invokes <code>createSaslServer()</code> on each factory instance on
+ * the list until one produces a non-null {@link SaslServer} instance. It
+ * returns the non-null {@link SaslServer} instance, or <code>null</code> if
+ * the search fails to produce a non-null {@link SaslServer} instance.</p>
+ *
+ * <p>A security provider for {@link SaslServerFactory} registers with the
+ * JCA Security Provider Framework keys of the form:</p>
+ *
+ * <pre>
+ * SaslServerFactory.mechanism_name
+ * </pre>
+ *
+ * <p>and values that are class names of implementations of {@link
+ * SaslServerFactory}.</p>
+ *
+ * <p>For example, a provider that contains a factory class,
+ * <code>com.wiz.sasl.digest.ServerFactory</code>, that supports the
+ * <code>"DIGEST-MD5"</code> mechanism would register the following entry
+ * with the JCA:</p>
+ *
+ * <pre>
+ * SaslServerFactory.DIGEST-MD5 com.wiz.sasl.digest.ServerFactory
+ * </pre></p>
+ *
+ * <p>See the "Java Cryptography Architecture API Specification &amp;
+ * Reference" for information about how to install and configure security
+ * service providers.</p>
+ *
+ * @param mechanism the non-null mechanism name. It must be an
+ * IANA-registered name of a SASL mechanism. (e.g. "GSSAPI", "CRAM-MD5").
+ * @param protocol the non-null string name of the protocol for which the
+ * authentication is being performed (e.g. "ldap").
+ * @param serverName the non-null fully qualified host name of the server.
+ * @param props the possibly <code>null</code> set of properties used to
+ * select the SASL mechanism and to configure the authentication exchange of
+ * the selected mechanism. For example, if props contains the {@link
+ * Sasl#POLICY_NOPLAINTEXT} property with the value <code>"true"</code>, then
+ * the selected SASL mechanism must not be susceptible to simple plain
+ * passive attacks. In addition to the standard properties declared in this
+ * class, other, possibly mechanism-specific, properties can be included.
+ * Properties not relevant to the selected mechanism are ignored.
+ * @param cbh the possibly <code>null</code> callback handler to used by the
+ * SASL mechanisms to get further information from the application/library to
+ * complete the authentication. For example, a SASL mechanism might require
+ * the authentication ID, password and realm from the caller. The
+ * authentication ID is requested by using a
+ * {@link javax.security.auth.callback.NameCallback}. The password is
+ * requested by using a {@link javax.security.auth.callback.PasswordCallback}.
+ * The realm is requested by using a {@link RealmChoiceCallback} if there is
+ * a list of realms to choose from, and by using a {@link RealmCallback} if
+ * the realm must be entered.
+ * @return a possibly <code>null</code> {@link SaslServer} created using the
+ * parameters supplied. If <code>null</code>, the method cannot find a
+ * {@link SaslServerFactory} instance that will produce one.
+ * @throws SaslException if a {@link SaslServer} instance cannot be created
+ * because of an error.
+ */
+ public static SaslServer createSaslServer(String mechanism, String protocol,
+ String serverName,
+ Map props, CallbackHandler cbh)
+ throws SaslException
+ {
+ if (mechanism == null)
+ return null;
+ Provider[] providers = Security.getProviders();
+ if (providers == null || providers.length == 0)
+ return null;
+
+ SaslServer result = null;
+ SaslServerFactory factory = null;
+ String clazz = null, upper, alias = null;
+ int j;
+ Provider p;
+ for (j = 0; j < providers.length; j++)
+ {
+ p = providers[j];
+ if (p != null)
+ {
+ // try the name as is
+ clazz = p.getProperty(SERVER_FACTORY_SVC + mechanism);
+ if (clazz == null) // try all uppercase
+ {
+ upper = mechanism.toUpperCase();
+ clazz = p.getProperty(SERVER_FACTORY_SVC + upper);
+ if (clazz == null) // try if it's an alias
+ {
+ alias = p.getProperty(ALIAS + SERVER_FACTORY_SVC + mechanism);
+ if (alias == null) // try all-uppercase alias name
+ {
+ alias = p.getProperty(ALIAS + SERVER_FACTORY_SVC + upper);
+ if (alias == null) // spit the dummy
+ continue;
+ }
+ }
+ clazz = p.getProperty(SERVER_FACTORY_SVC + alias);
+ }
+ }
+ if (clazz == null)
+ continue;
+ else
+ clazz = clazz.trim();
+
+ try
+ {
+ result = null;
+ factory = (SaslServerFactory) Class.forName(clazz).newInstance();
+ result =
+ factory.createSaslServer(mechanism, protocol, serverName, props, cbh);
+ }
+ catch (ClassCastException ignored) // ignore instantiation exceptions
+ {
+ }
+ catch (ClassNotFoundException ignored)
+ {
+ }
+ catch (InstantiationException ignored)
+ {
+ }
+ catch (IllegalAccessException ignored)
+ {
+ }
+ if (result != null)
+ return result;
+ }
+ return null;
+ }
+
+ /**
+ * Gets an enumeration of known factories for producing a {@link SaslServer}
+ * instance. This method uses the same sources for locating factories as
+ * <code>createSaslServer()</code>.
+ *
+ * @return a non-null {@link Enumeration} of known factories for producing a
+ * {@link SaslServer} instance.
+ * @see #createSaslServer(String,String,String,Map,CallbackHandler)
+ */
+ public static Enumeration getSaslServerFactories()
+ {
+ Vector result = new Vector();
+ HashSet names = new HashSet();
+ Provider[] providers = Security.getProviders();
+ Iterator it;
+ if (providers == null)
+ {
+ Provider p;
+ String key;
+ for (int i = 0; i < providers.length; i++)
+ {
+ p = providers[i];
+ for (it = p.keySet().iterator(); it.hasNext(); )
+ {
+ key = (String) it.next();
+ // add key's binding (a) it is a class of a server factory,
+ // and (b) the key does not include blanks
+ if (key.startsWith(SERVER_FACTORY_SVC) && key.indexOf(" ") == -1)
+ {
+ names.add(p.getProperty(key));
+ break;
+ }
+ }
+ }
+ }
+ // we have the factory class names in names; instantiate and enumerate
+ String c;
+ for (it = names.iterator(); it.hasNext(); )
+ {
+ c = (String) it.next();
+ try
+ {
+ SaslServerFactory f = (SaslServerFactory) Class.forName(c).newInstance();
+ if (f != null)
+ result.add(f);
+ }
+ catch (ClassCastException ignored) // ignore instantiation exceptions
+ {
+ }
+ catch (ClassNotFoundException ignored)
+ {
+ }
+ catch (InstantiationException ignored)
+ {
+ }
+ catch (IllegalAccessException ignored)
+ {
+ }
+ }
+
+ return result.elements();
+ }
+}
diff --git a/javax/security/sasl/SaslClient.java b/javax/security/sasl/SaslClient.java
new file mode 100644
index 000000000..c55efabf0
--- /dev/null
+++ b/javax/security/sasl/SaslClient.java
@@ -0,0 +1,231 @@
+/* SaslClient.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpathis free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpathis distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+/**
+ * <p>Performs SASL authentication as a client.</p>
+ *
+ * <p>A protocol library such as one for LDAP gets an instance of this class in
+ * order to perform authentication defined by a specific SASL mechanism.
+ * Invoking methods on the <code>SaslClient</code> instance process challenges
+ * and create responses according to the SASL mechanism implemented by the
+ * <code>SaslClient</code>. As the authentication proceeds, the instance
+ * encapsulates the state of a SASL client's authentication exchange.</p>
+ *
+ * <p>Here's an example of how an LDAP library might use a <code>SaslClient</code>.
+ * It first gets an instance of a SaslClient:</p>
+ * <pre>
+ *SaslClient sc =
+ * Sasl.createSaslClient(mechanisms, authorizationID, protocol,
+ * serverName, props, callbackHandler);
+ * </pre>
+ *
+ * <p>It can then proceed to use the client for authentication. For example, an
+ * LDAP library might use the client as follows:</p>
+ * <pre>
+ * // Get initial response and send to server
+ *byte[] response = sc.hasInitialResponse()
+ * ? sc.evaluateChallenge(new byte[0]) : null;
+ *LdapResult res = ldap.sendBindRequest(dn, sc.getName(), response);
+ *while (!sc.isComplete()
+ * && ((res.status == SASL_BIND_IN_PROGRESS) || (res.status == SUCCESS))) {
+ * response = sc.evaluateChallenge( res.getBytes() );
+ * if (res.status == SUCCESS) {
+ * // we're done; don't expect to send another BIND
+ * if ( response != null ) {
+ * throw new SaslException(
+ * "Protocol error: attempting to send response after completion");
+ * }
+ * break;
+ * }
+ * res = ldap.sendBindRequest(dn, sc.getName(), response);
+ *}
+ *if (sc.isComplete() && (res.status == SUCCESS) ) {
+ * String qop = (String)sc.getNegotiatedProperty(Sasl.QOP);
+ * if ((qop != null)
+ * && (qop.equalsIgnoreCase("auth-int")
+ * || qop.equalsIgnoreCase("auth-conf"))) {
+ * // Use SaslClient.wrap() and SaslClient.unwrap() for future
+ * // communication with server
+ * ldap.in = new SecureInputStream(sc, ldap.in);
+ * ldap.out = new SecureOutputStream(sc, ldap.out);
+ * }
+ *}
+ * </pre>
+ *
+ * <p>If the mechanism has an initial response, the library invokes
+ * {@link #evaluateChallenge(byte[])} with an empty challenge to get the initial
+ * response. Protocols such as IMAP4, which do not include an initial response
+ * with their first authentication command to the server, initiate the
+ * authentication without first calling {@link #hasInitialResponse()} or
+ * {@link #evaluateChallenge(byte[])}. When the server responds to the command,
+ * it sends an initial challenge. For a SASL mechanism in which the client sends
+ * data first, the server should have issued a challenge with no data. This will
+ * then result in a call (on the client) to {@link #evaluateChallenge(byte[])}
+ * with an empty challenge.</p>
+ *
+ * @see Sasl
+ * @see SaslClientFactory
+ * @version $Revision: 1.3.2.1 $
+ */
+public interface SaslClient
+{
+
+ /**
+ * Returns the IANA-registered mechanism name of this SASL client. (e.g.
+ * "CRAM-MD5", "GSSAPI").
+ *
+ * @return a non-null string representing the IANA-registered mechanism name.
+ */
+ String getMechanismName();
+
+ /**
+ * Determines if this mechanism has an optional initial response. If
+ * <code>true</code>, caller should call {@link #evaluateChallenge(byte[])}
+ * with an empty array to get the initial response.
+ *
+ * @return <code>true</code> if this mechanism has an initial response.
+ */
+ boolean hasInitialResponse();
+
+ /**
+ * Evaluates the challenge data and generates a response. If a challenge is
+ * received from the server during the authentication process, this method is
+ * called to prepare an appropriate next response to submit to the server.
+ *
+ * @param challenge the non-null challenge sent from the server. The
+ * challenge array may have zero length.
+ * @return the possibly <code>null</code> reponse to send to the server. It
+ * is <code>null</code> if the challenge accompanied a "SUCCESS" status and
+ * the challenge only contains data for the client to update its state and no
+ * response needs to be sent to the server. The response is a zero-length
+ * byte array if the client is to send a response with no data.
+ * @throws SaslException if an error occurred while processing the challenge
+ * or generating a response.
+ */
+ byte[] evaluateChallenge(byte[] challenge) throws SaslException;
+
+ /**
+ * Determines if the authentication exchange has completed. This method may
+ * be called at any time, but typically, it will not be called until the
+ * caller has received indication from the server (in a protocol-specific
+ * manner) that the exchange has completed.
+ *
+ * @return <code>true</code> if the authentication exchange has completed;
+ * <code>false</code> otherwise.
+ */
+ boolean isComplete();
+
+ /**
+ * <p>Unwraps a byte array received from the server. This method can be
+ * called only after the authentication exchange has completed (i.e., when
+ * {@link #isComplete()} returns <code>true</code>) and only if the
+ * authentication exchange has negotiated integrity and/or privacy as the
+ * quality of protection; otherwise, an {@link IllegalStateException} is
+ * thrown.</p>
+ *
+ * <p><code>incoming</code> is the contents of the SASL buffer as defined in
+ * RFC 2222 without the leading four octet field that represents the length.
+ * <code>offset</code> and <code>len</code> specify the portion of incoming
+ * to use.</p>
+ *
+ * @param incoming a non-null byte array containing the encoded bytes from
+ * the server.
+ * @param offset the starting position at <code>incoming</code> of the bytes
+ * to use.
+ * @param len the number of bytes from <code>incoming</code> to use.
+ * @return a non-null byte array containing the decoded bytes.
+ * @throws SaslException if <code>incoming</code> cannot be successfully
+ * unwrapped.
+ * @throws IllegalStateException if the authentication exchange has not
+ * completed, or if the negotiated quality of protection has neither
+ * integrity nor privacy.
+ */
+ byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException;
+
+ /**
+ * <p>Wraps a byte array to be sent to the server. This method can be called
+ * only after the authentication exchange has completed (i.e., when
+ * {@link #isComplete()} returns <code>true</code>) and only if the
+ * authentication exchange has negotiated integrity and/or privacy as the
+ * quality of protection; otherwise, an {@link IllegalStateException} is
+ * thrown.</p>
+ *
+ * <p>The result of this method will make up the contents of the SASL buffer
+ * as defined in RFC 2222 without the leading four octet field that
+ * represents the length. <code>offset</code> and <code>len</code> specify
+ * the portion of <code>outgoing</code> to use.</p>
+ *
+ * @param outgoing a non-null byte array containing the bytes to encode.
+ * @param offset the starting position at <code>outgoing</code> of the bytes
+ * to use.
+ * @param len the number of bytes from <code>outgoing</code> to use.
+ * @return a non-null byte array containing the encoded bytes.
+ * @throws SaslException if <code>outgoing</code> cannot be successfully
+ * wrapped.
+ * @throws IllegalStateException if the authentication exchange has not
+ * completed, or if the negotiated quality of protection has neither
+ * integrity nor privacy.
+ */
+ byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException;
+
+ /**
+ * Retrieves the negotiated property. This method can be called only after
+ * the authentication exchange has completed (i.e., when {@link #isComplete()}
+ * returns <code>true</code>); otherwise, an {@link IllegalStateException} is
+ * thrown.
+ *
+ * @param propName the non-null property name.
+ * @return the value of the negotiated property. If <code>null</code>, the
+ * property was not negotiated or is not applicable to this mechanism.
+ * @throws IllegalStateException if this authentication exchange has not
+ * completed.
+ */
+ Object getNegotiatedProperty(String propName) throws SaslException;
+
+ /**
+ * Disposes of any system resources or security-sensitive information the
+ * <code>SaslClient</code> might be using. Invoking this method invalidates
+ * the <code>SaslClient</code> instance. This method is idempotent.
+ *
+ * @throws SaslException if a problem was encountered while disposing of the
+ * resources.
+ */
+ void dispose() throws SaslException;
+}
diff --git a/javax/security/sasl/SaslClientFactory.java b/javax/security/sasl/SaslClientFactory.java
new file mode 100644
index 000000000..0d760112a
--- /dev/null
+++ b/javax/security/sasl/SaslClientFactory.java
@@ -0,0 +1,117 @@
+/* SaslClientFactory.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import java.util.Map;
+
+import javax.security.auth.callback.CallbackHandler;
+
+/**
+ * <p>An interface for creating instances of {@link SaslClient}. A class that
+ * implements this interface must be thread-safe and handle multiple
+ * simultaneous requests. It must also have a public constructor that accepts
+ * no arguments.</p>
+ *
+ * <p>This interface is not normally accessed directly by a client, which will
+ * use the {@link Sasl} static methods to create a client instance instead.
+ * However, a particular environment may provide and install a new or different
+ * <code>SaslClientFactory</code>.</p>
+ *
+ * @see SaslClient
+ * @see Sasl
+ * @version $Revision: 1.3.2.1 $
+ */
+public interface SaslClientFactory
+{
+
+ /**
+ * Creates a {@link SaslClient} using the parameters supplied.
+ *
+ * @param mechanisms the non-null list of mechanism names to try. Each is the
+ * IANA-registered name of a SASL mechanism (e.g. "GSSAPI", "CRAM-MD5").
+ * @param authorizationID the possibly null protocol-dependent identification
+ * to be used for authorization. If <code>null</code> or empty, the server
+ * derives an authorization ID from the client's authentication credentials.
+ * When the SASL authentication completes successfully, the specified entity
+ * is granted access.
+ * @param protocol the non-null string name of the protocol for which the
+ * authentication is being performed (e.g. "ldap").
+ * @param serverName the non-null fully qualified host name of the server to
+ * authenticate to.
+ * @param props the possibly <code>null</code> set of properties used to
+ * select the SASL mechanism and to configure the authentication exchange of
+ * the selected mechanism. See the {@link Sasl} class for a list of standard
+ * properties. Other, possibly mechanism-specific, properties can be included.
+ * Properties not relevant to the selected mechanism are ignored.
+ * @param cbh the possibly <code>null</code> callback handler to used by the
+ * SASL mechanisms to get further information from the application/library to
+ * complete the authentication. For example, a SASL mechanism might require
+ * the authentication ID, password and realm from the caller. The
+ * authentication ID is requested by using a
+ * {@link javax.security.auth.callback.NameCallback}. The password is
+ * requested by using a {@link javax.security.auth.callback.PasswordCallback}.
+ * The realm is requested by using a {@link RealmChoiceCallback} if there is
+ * a list of realms to choose from, and by using a {@link RealmCallback} if
+ * the realm must be entered.
+ * @return a possibly <code>null</code> {@link SaslClient} created using the
+ * parameters supplied. If <code>null</code>, this factory cannot produce a
+ * {@link SaslClient} using the parameters supplied.
+ * @throws SaslException if a {@link SaslClient} instance cannot be created
+ * because of an error.
+ */
+ SaslClient createSaslClient(String[] mechanisms, String authorizationID,
+ String protocol, String serverName, Map props,
+ CallbackHandler cbh)
+ throws SaslException;
+
+ /**
+ * Returns an array of names of mechanisms that match the specified mechanism
+ * selection policies.
+ *
+ * @param props the possibly <code>null</code> set of properties used to
+ * specify the security policy of the SASL mechanisms. For example, if props
+ * contains the {@link Sasl#POLICY_NOPLAINTEXT} property with the value
+ * <code>"true"</code>, then the factory must not return any SASL mechanisms
+ * that are susceptible to simple plain passive attacks. See the {@link Sasl}
+ * class for a complete list of policy properties. Non-policy related
+ * properties, if present in props, are ignored.
+ * @return a non-null array containing IANA-registered SASL mechanism names.
+ */
+ String[] getMechanismNames(Map props);
+}
diff --git a/javax/security/sasl/SaslException.java b/javax/security/sasl/SaslException.java
new file mode 100644
index 000000000..bff950c82
--- /dev/null
+++ b/javax/security/sasl/SaslException.java
@@ -0,0 +1,185 @@
+/* SaslException.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+
+/**
+ * This class represents an error that has occurred when using SASL.
+ *
+ * @version $Revision: 1.3.2.1 $
+ */
+public class SaslException extends IOException implements Serializable
+{
+
+ // Constants and variables
+ // -------------------------------------------------------------------------
+
+ /**
+ * @serial The possibly null root cause exception.
+ */
+ private Throwable _exception = null;
+
+ // Constructor(s)
+ // -------------------------------------------------------------------------
+
+ /**
+ * Constructs a new instance of <code>SaslException</code>. The root
+ * exception and the detailed message are null.
+ */
+ public SaslException()
+ {
+ super();
+ }
+
+ /**
+ * Constructs a new instance of <code>SaslException</code> with a detailed
+ * message. The <code>root</code> exception is <code>null</code>.
+ *
+ * @param detail a possibly null string containing details of the exception.
+ * @see Throwable#getMessage()
+ */
+ public SaslException(String detail)
+ {
+ super(detail);
+ }
+
+ /**
+ * Constructs a new instance of <code>SaslException</code> with a detailed
+ * message and a root exception. For example, a <code>SaslException</code>
+ * might result from a problem with the callback handler, which might throw a
+ * {@link javax.security.auth.callback.UnsupportedCallbackException} if it
+ * does not support the requested callback, or throw an {@link IOException}
+ * if it had problems obtaining data for the callback. The
+ * <code>SaslException</code>'s root exception would be then be the exception
+ * thrown by the callback handler.
+ *
+ * @param detail a possibly <code>null</code> string containing details of
+ * the exception.
+ * @param ex a possibly <code>null</code> root exception that caused this
+ * exception.
+ * @see Throwable#getMessage()
+ * @see #getCause()
+ */
+ public SaslException(String detail, Throwable ex)
+ {
+ super(detail);
+ _exception = ex;
+ }
+
+ // Class methods
+ // -------------------------------------------------------------------------
+
+ // Instance methods
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the cause of this throwable or <code>null</code> if the cause is
+ * nonexistent or unknown. The cause is the throwable that caused this
+ * exception to be thrown.
+ *
+ * @return the possibly <code>null</code> exception that caused this exception.
+ */
+ public Throwable getCause()
+ {
+ return _exception;
+ }
+
+ /**
+ * Prints this exception's stack trace to <code>System.err</code>. If this
+ * exception has a root exception; the stack trace of the root exception is
+ * also printed to <code>System.err</code>.
+ */
+ public void printStackTrace()
+ {
+ super.printStackTrace();
+ if (_exception != null)
+ _exception.printStackTrace();
+ }
+
+ /**
+ * Prints this exception's stack trace to a print stream. If this exception
+ * has a root exception; the stack trace of the root exception is also
+ * printed to the print stream.
+ *
+ * @param ps the non-null print stream to which to print.
+ */
+ public void printStackTrace(PrintStream ps)
+ {
+ super.printStackTrace(ps);
+ if (_exception != null)
+ _exception.printStackTrace(ps);
+ }
+
+ /**
+ * Prints this exception's stack trace to a print writer. If this exception
+ * has a root exception; the stack trace of the root exception is also
+ * printed to the print writer.
+ *
+ * @param pw the non-null print writer to use for output.
+ */
+ public void printStackTrace(PrintWriter pw)
+ {
+ super.printStackTrace(pw);
+ if (_exception != null)
+ _exception.printStackTrace(pw);
+ }
+
+ /**
+ * Returns the string representation of this exception. The string
+ * representation contains this exception's class name, its detailed
+ * messsage, and if it has a root exception, the string representation of the
+ * root exception. This string representation is meant for debugging and not
+ * meant to be interpreted programmatically.
+ *
+ * @return the non-null string representation of this exception.
+ * @see Throwable#getMessage()
+ */
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer(this.getClass().getName())
+ .append(": ").append(super.toString());
+ if (_exception != null)
+ sb.append("; caused by: ").append(_exception.toString());
+ return sb.toString();
+ }
+}
diff --git a/javax/security/sasl/SaslServer.java b/javax/security/sasl/SaslServer.java
new file mode 100644
index 000000000..7fd61185f
--- /dev/null
+++ b/javax/security/sasl/SaslServer.java
@@ -0,0 +1,226 @@
+/* SasServer.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+/**
+ * <p>Performs SASL authentication as a server.</p>
+ *
+ * <p>A server such as an LDAP server gets an instance of this class in order to
+ * perform authentication defined by a specific SASL mechanism. Invoking methods
+ * on the <code>SaslServer</code> instance generates challenges corresponding to
+ * the SASL mechanism implemented by the <code>SaslServer</code> instance. As
+ * the authentication proceeds, the instance encapsulates the state of a SASL
+ * server's authentication exchange.</p>
+ *
+ * <p>Here's an example of how an LDAP server might use a <code>SaslServer</code>
+ * instance. It first gets an instance of a <code>SaslServer</code> for the SASL
+ * mechanism requested by the client:</p>
+ *
+ * <pre>
+ *SaslServer ss =
+ * Sasl.createSaslServer(mechanism, "ldap", myFQDN, props, callbackHandler);
+ * </pre>
+ *
+ * <p>It can then proceed to use the server for authentication. For example,
+ * suppose the LDAP server received an LDAP BIND request containing the name of
+ * the SASL mechanism and an (optional) initial response. It then might use the
+ * server as follows:</p>
+ *
+ * <pre>
+ *while (!ss.isComplete()) {
+ * try {
+ * byte[] challenge = ss.evaluateResponse(response);
+ * if (ss.isComplete()) {
+ * status = ldap.sendBindResponse(mechanism, challenge, SUCCESS);
+ * } else {
+ * status = ldap.sendBindResponse(mechanism, challenge, SASL_BIND_IN_PROGRESS);
+ * response = ldap.readBindRequest();
+ * }
+ * } catch (SaslException x) {
+ * status = ldap.sendErrorResponse(x);
+ * break;
+ * }
+ *}
+ *if (ss.isComplete() && (status == SUCCESS)) {
+ * String qop = (String) sc.getNegotiatedProperty(Sasl.QOP);
+ * if (qop != null
+ * && (qop.equalsIgnoreCase("auth-int")
+ * || qop.equalsIgnoreCase("auth-conf"))) {
+ * // Use SaslServer.wrap() and SaslServer.unwrap() for future
+ * // communication with client
+ * ldap.in = new SecureInputStream(ss, ldap.in);
+ * ldap.out = new SecureOutputStream(ss, ldap.out);
+ * }
+ *}
+ * </pre>
+ *
+ * @see Sasl
+ * @see SaslServerFactory
+ * @version $Revision: 1.3.2.1 $
+ */
+public interface SaslServer
+{
+
+ /**
+ * Returns the IANA-registered mechanism name of this SASL server (e.g.
+ * "CRAM-MD5", "GSSAPI").
+ *
+ * @return a non-null string representing the IANA-registered mechanism name.
+ */
+ String getMechanismName();
+
+ /**
+ * Evaluates the response data and generates a challenge. If a response is
+ * received from the client during the authentication process, this method is
+ * called to prepare an appropriate next challenge to submit to the client.
+ * The challenge is <code>null</code> if the authentication has succeeded and
+ * no more challenge data is to be sent to the client. It is non-null if the
+ * authentication must be continued by sending a challenge to the client, or
+ * if the authentication has succeeded but challenge data needs to be
+ * processed by the client. {@link #isComplete()} should be called after each
+ * call to <code>evaluateResponse()</code>,to determine if any further
+ * response is needed from the client.
+ *
+ * @param response the non-null (but possibly empty) response sent by the
+ * client.
+ * @return the possibly <code>null</code> challenge to send to the client.
+ * It is <code>null</code> if the authentication has succeeded and there is
+ * no more challenge data to be sent to the client.
+ * @throws SaslException if an error occurred while processing the response
+ * or generating a challenge.
+ */
+ byte[] evaluateResponse(byte[] response) throws SaslException;
+
+ /**
+ * Determines if the authentication exchange has completed. This method is
+ * typically called after each invocation of {@link #evaluateResponse(byte[])}
+ * to determine whether the authentication has completed successfully or
+ * should be continued.
+ *
+ * @return <code>true</code> if the authentication exchange has completed;
+ * <code>false</code> otherwise.
+ */
+ boolean isComplete();
+
+ /**
+ * Reports the authorization ID in effect for the client of this session This
+ * method can only be called if {@link #isComplete()} returns <code>true</code>.
+ *
+ * @return the authorization ID of the client.
+ * @throws IllegalStateException if this authentication session has not
+ * completed.
+ */
+ String getAuthorizationID();
+
+ /**
+ * <p>Unwraps a byte array received from the client. This method can be called
+ * only after the authentication exchange has completed (i.e., when
+ * {@link #isComplete()} returns <code>true</code>) and only if the
+ * authentication exchange has negotiated integrity and/or privacy as the
+ * quality of protection; otherwise, an {@link IllegalStateException} is
+ * thrown.</p>
+ *
+ * <p><code>incoming</code> is the contents of the SASL buffer as defined in
+ * RFC 2222 without the leading four octet field that represents the length.
+ * <code>offset</code> and <code>len</code> specify the portion of incoming
+ * to use.</p>
+ *
+ * @param incoming a non-null byte array containing the encoded bytes from
+ * the client.
+ * @param offset the starting position at <code>incoming</code> of the bytes
+ * to use.
+ * @param len the number of bytes from <code>incoming</code> to use.
+ * @return a non-null byte array containing the decoded bytes.
+ * @throws SaslException if <code>incoming</code> cannot be successfully
+ * unwrapped.
+ * @throws IllegalStateException if the authentication exchange has not
+ * completed, or if the negotiated quality of protection has neither
+ * integrity nor privacy.
+ */
+ byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException;
+
+ /**
+ * <p>Wraps a byte array to be sent to the client. This method can be called
+ * only after the authentication exchange has completed (i.e., when
+ * {@link #isComplete()} returns <code>true</code>) and only if the
+ * authentication exchange has negotiated integrity and/or privacy as the
+ * quality of protection; otherwise, an {@link IllegalStateException} is
+ * thrown.</p>
+ *
+ * <p>The result of this method will make up the contents of the SASL buffer
+ * as defined in RFC 2222 without the leading four octet field that
+ * represents the length. <code>offset</code> and <code>len</code> specify
+ * the portion of <code>outgoing</code> to use.
+ *
+ * @param outgoing a non-null byte array containing the bytes to encode.
+ * @param offset the starting position at <code>outgoing</code> of the bytes
+ * to use.
+ * @param len the number of bytes from <code>outgoing</code> to use.
+ * @return a non-null byte array containing the encoded bytes.
+ * @throws SaslException if <code>outgoing</code> cannot be successfully
+ * wrapped.
+ * @throws IllegalStateException if the authentication exchange has not
+ * completed, or if the negotiated quality of protection has neither
+ * integrity nor privacy.
+ */
+ byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException;
+
+ /**
+ * Retrieves the negotiated property. This method can be called only after
+ * the authentication exchange has completed (i.e., when
+ * {@link #isComplete()} returns <code>true</code>); otherwise, an
+ * {@link IllegalStateException} is thrown.
+ *
+ * @return the value of the negotiated property. If <code>null</code>, the
+ * property was not negotiated or is not applicable to this mechanism.
+ * @throws IllegalStateException if this authentication exchange has not
+ * completed.
+ */
+ Object getNegotiatedProperty(String propName) throws SaslException;
+
+ /**
+ * Disposes of any system resources or security-sensitive information the
+ * <code>SaslServer</code> might be using. Invoking this method invalidates
+ * the <code>SaslServer</code> instance. This method is idempotent.
+ *
+ * @throws SaslException if a problem was encountered while disposing of the
+ * resources.
+ */
+ void dispose() throws SaslException;
+}
diff --git a/javax/security/sasl/SaslServerFactory.java b/javax/security/sasl/SaslServerFactory.java
new file mode 100644
index 000000000..43b52a035
--- /dev/null
+++ b/javax/security/sasl/SaslServerFactory.java
@@ -0,0 +1,114 @@
+/* SaslServerFactory.java
+ Copyright (C) 2003, Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307 USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.security.sasl;
+
+import java.util.Map;
+
+import javax.security.auth.callback.CallbackHandler;
+
+/**
+ * <p>An interface for creating instances of {@link SaslServer}. A class that
+ * implements this interface must be thread-safe and handle multiple
+ * simultaneous requests. It must also have a public constructor that accepts
+ * no arguments.</p>
+ *
+ * This interface is not normally accessed directly by a server, which will use
+ * the {@link Sasl} static methods to create a {@link SaslServer} instance
+ * instead. However, a particular environment may provide and install a new or
+ * different <code>SaslServerFactory</code>.</p>
+ *
+ * @see SaslServer
+ * @see Sasl
+ * @version $Revision: 1.3.2.1 $
+ */
+public interface SaslServerFactory
+{
+
+ /**
+ * Creates a {@link SaslServer} instance using the parameters supplied. It
+ * returns <code>null</code> if no {@link SaslServer} instance can be created
+ * using the parameters supplied. Throws {@link SaslException} if it cannot
+ * create a {@link SaslServer} because of an error.
+ *
+ * @param mechanism the non-null IANA-registered name of a SASL mechanism
+ * (e.g. "GSSAPI", "CRAM-MD5").
+ * @param protocol the non-null string name of the protocol for which the
+ * authentication is being performed (e.g. "ldap").
+ * @param serverName the non-null fully qualified host name of the server to
+ * authenticate to.
+ * @param props the possibly null set of properties used to select the SASL
+ * mechanism and to configure the authentication exchange of the selected
+ * mechanism. See the {@link Sasl} class for a list of standard properties.
+ * Other, possibly mechanism-specific, properties can be included. Properties
+ * not relevant to the selected mechanism are ignored.
+ * @param cbh the possibly null callback handler to used by the SASL
+ * mechanisms to get further information from the application/library to
+ * complete the authentication. For example, a SASL mechanism might require
+ * the authentication ID, password and realm from the caller. The
+ * authentication ID is requested by using a
+ * {@link javax.security.auth.callback.NameCallback}. The password is
+ * requested by using a {@link javax.security.auth.callback.PasswordCallback}.
+ * The realm is requested by using a {@link RealmChoiceCallback} if there is
+ * a list of realms to choose from, and by using a {@link RealmCallback} if
+ * the realm must be entered.
+ * @return a possibly null {@link SaslServer} created using the parameters
+ * supplied. If <code>null</code> is returned, it means that this factory
+ * cannot produce a {@link SaslServer} using the parameters supplied.
+ * @throws SaslException if a SaslServer instance cannot be created because
+ * of an error.
+ */
+ SaslServer createSaslServer(String mechanism, String protocol,
+ String serverName, Map props, CallbackHandler cbh)
+ throws SaslException;
+
+ /**
+ * Returns an array of names of mechanisms that match the specified mechanism
+ * selection policies.
+ *
+ * @param props the possibly <code>null</code> set of properties used to
+ * specify the security policy of the SASL mechanisms. For example, if props
+ * contains the {@link Sasl#POLICY_NOPLAINTEXT} property with the value
+ * <code>"true"</code>, then the factory must not return any SASL mechanisms
+ * that are susceptible to simple plain passive attacks. See the {@link Sasl}
+ * class for a complete list of policy properties. Non-policy related
+ * properties, if present in props, are ignored.
+ * @return a non-null array containing IANA-registered SASL mechanism names.
+ */
+ String[] getMechanismNames(Map props);
+}
diff --git a/javax/security/sasl/package.html b/javax/security/sasl/package.html
new file mode 100644
index 000000000..e5627d2c8
--- /dev/null
+++ b/javax/security/sasl/package.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<!-- package.html - describes classes in javax.security.sasl package.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. -->
+
+<html>
+<head><title>GNU Classpath - javax.security.sasl</title></head>
+
+<body>
+<p></p>
+
+</body>
+</html>
diff --git a/javax/swing/AbstractButton.java b/javax/swing/AbstractButton.java
index f6aec1623..bd0d4dd37 100644
--- a/javax/swing/AbstractButton.java
+++ b/javax/swing/AbstractButton.java
@@ -234,13 +234,13 @@ public abstract class AbstractButton extends JComponent
/** The time in miliseconds in which clicks get coalesced into a single
* <code>ActionEvent</code>. */
long multiClickThreshhold;
-
+
/** Listener the button uses to receive PropertyChangeEvents from its
Action. */
PropertyChangeListener actionPropertyChangeListener;
/** ChangeEvent that is fired to button's ChangeEventListeners */
- private ChangeEvent changeEvent = new ChangeEvent(this);
+ protected ChangeEvent changeEvent = new ChangeEvent(this);
/** Fired in a PropertyChangeEvent when the "borderPainted" property changes. */
public static final String BORDER_PAINTED_CHANGED_PROPERTY = "borderPainted";
@@ -299,9 +299,9 @@ public abstract class AbstractButton extends JComponent
/** Fired in a PropertyChangeEvent when the "verticalTextPosition" property changes. */
public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY = "verticalTextPosition";
- /**
+ /**
* A Java Accessibility extension of the AbstractButton.
- */
+ */
protected abstract class AccessibleAbstractButton
extends AccessibleJComponent implements AccessibleAction, AccessibleValue,
AccessibleText
@@ -433,7 +433,7 @@ public abstract class AbstractButton extends JComponent
}
public String getSelectedText()
- {
+ {
return null; // TODO
}
@@ -441,34 +441,6 @@ public abstract class AbstractButton extends JComponent
{
return null; // TODO
}
- }
-
- /**
- * Helper class used to subscribe to FocusEvents received by the button.
- */
- private class ButtonFocusListener implements FocusListener
- {
- /**
- * Possibly repaint the model in response to loss of focus.
- *
- * @param event The loss-of-focus event
- */
- public void focusLost(FocusEvent event)
- {
- if (AbstractButton.this.isFocusPainted())
- AbstractButton.this.repaint();
- }
-
- /**
- * Possibly repaint the button in response to acquisition of focus.
- *
- * @param event The gained-focus event
- */
- public void focusGained(FocusEvent event)
- {
- if (AbstractButton.this.isFocusPainted())
- AbstractButton.this.repaint();
- }
}
/**
@@ -552,12 +524,12 @@ public abstract class AbstractButton extends JComponent
borderPainted = true;
contentAreaFilled = true;
- iconTextGap = 4;
+ focusPainted = true;
+ setFocusable(true);
setAlignmentX(LEFT_ALIGNMENT);
setAlignmentY(CENTER_ALIGNMENT);
- addFocusListener(new ButtonFocusListener());
setDisplayedMnemonicIndex(-1);
}
@@ -718,11 +690,8 @@ public abstract class AbstractButton extends JComponent
/**
* Calls {@link ChangeEvent.stateChanged} on each {@link ChangeListener}
* in the button's listener list.
- *
- * @param e The event signifying a change in one of the (non-bound)
- * properties of the button's model.
*/
- public void fireStateChanged(ChangeEvent e)
+ public void fireStateChanged()
{
ChangeListener[] listeners = getChangeListeners();
@@ -812,8 +781,8 @@ public abstract class AbstractButton extends JComponent
{
if (index < -1 || (text != null && index >= text.length()))
throw new IllegalArgumentException();
- else
- mnemonicIndex = index;
+
+ mnemonicIndex = index;
}
/**
@@ -919,14 +888,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setHorizontalAlignment(int a)
{
+ if (horizontalAlignment == a)
+ return;
+
int old = horizontalAlignment;
horizontalAlignment = a;
- if (old != a)
- {
- firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
- revalidate();
- repaint();
- }
+ firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
+ revalidate();
+ repaint();
}
/**
@@ -956,14 +925,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setHorizontalTextPosition(int t)
{
+ if (horizontalTextPosition == t)
+ return;
+
int old = horizontalTextPosition;
horizontalTextPosition = t;
- if (old != t)
- {
- firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
- revalidate();
- repaint();
- }
+ firePropertyChange(HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
+ revalidate();
+ repaint();
}
/**
@@ -991,14 +960,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setVerticalAlignment(int a)
{
+ if (verticalAlignment == a)
+ return;
+
int old = verticalAlignment;
verticalAlignment = a;
- if (old != a)
- {
- firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
- revalidate();
- repaint();
- }
+ firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a);
+ revalidate();
+ repaint();
}
/**
@@ -1028,14 +997,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setVerticalTextPosition(int t)
{
+ if (verticalTextPosition == t)
+ return;
+
int old = verticalTextPosition;
verticalTextPosition = t;
- if (old != t)
- {
- firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
- revalidate();
- repaint();
- }
+ firePropertyChange(VERTICAL_TEXT_POSITION_CHANGED_PROPERTY, old, t);
+ revalidate();
+ repaint();
}
/**
@@ -1059,14 +1028,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setBorderPainted(boolean b)
{
+ if (borderPainted == b)
+ return;
+
boolean old = borderPainted;
- borderPainted = b;
- if (b != old)
- {
- firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
- revalidate();
- repaint();
- }
+ borderPainted = b;
+ firePropertyChange(BORDER_PAINTED_CHANGED_PROPERTY, old, b);
+ revalidate();
+ repaint();
}
/**
@@ -1105,10 +1074,7 @@ public abstract class AbstractButton extends JComponent
action.removePropertyChangeListener(actionPropertyChangeListener);
actionPropertyChangeListener = null;
}
-
-
- }
-
+ }
Action old = action;
action = a;
@@ -1139,14 +1105,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setIcon(Icon i)
{
- if (default_icon != i)
- {
+ if (default_icon == i)
+ return;
+
Icon old = default_icon;
default_icon = i;
firePropertyChange(ICON_CHANGED_PROPERTY, old, i);
revalidate();
repaint();
- }
}
/**
@@ -1190,14 +1156,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setText(String t)
{
+ if (text == t)
+ return;
+
String old = text;
text = t;
- if (t != old)
- {
- firePropertyChange(TEXT_CHANGED_PROPERTY, old, t);
- revalidate();
- repaint();
- }
+ firePropertyChange(TEXT_CHANGED_PROPERTY, old, t);
+ revalidate();
+ repaint();
}
/**
@@ -1207,14 +1173,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setIconTextGap(int i)
{
+ if (iconTextGap == i)
+ return;
+
int old = iconTextGap;
iconTextGap = i;
- if (old != i)
- {
- fireStateChanged(new ChangeEvent(this));
- revalidate();
- repaint();
- }
+ fireStateChanged();
+ revalidate();
+ repaint();
}
/**
@@ -1234,7 +1200,7 @@ public abstract class AbstractButton extends JComponent
*
* @return The current "margin" property
*/
- public Insets getMargin()
+ public Insets getMargin()
{
return margin;
}
@@ -1248,15 +1214,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setMargin(Insets m)
{
+ if (margin == m)
+ return;
+
Insets old = margin;
margin = m;
- if (m != old)
- {
- firePropertyChange(MARGIN_CHANGED_PROPERTY, old, m);
- revalidate();
+ firePropertyChange(MARGIN_CHANGED_PROPERTY, old, m);
+ revalidate();
repaint();
}
- }
/**
* Return the button's "pressedIcon" property. The look and feel class
@@ -1281,15 +1247,15 @@ public abstract class AbstractButton extends JComponent
*/
public void setPressedIcon(Icon pressedIcon)
{
+ if (pressed_icon == pressedIcon)
+ return;
+
Icon old = pressed_icon;
pressed_icon = pressedIcon;
- if (pressed_icon != old)
- {
- firePropertyChange(PRESSED_ICON_CHANGED_PROPERTY, old, pressed_icon);
+ firePropertyChange(PRESSED_ICON_CHANGED_PROPERTY, old, pressed_icon);
revalidate();
repaint();
}
- }
/**
* Return the button's "disabledIcon" property. The look and feel class
@@ -1350,15 +1316,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setFocusPainted(boolean p)
{
+ if (focusPainted == p)
+ return;
+
boolean old = focusPainted;
focusPainted = p;
-
- if (old != focusPainted)
- {
- firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, p);
- revalidate();
- repaint();
- }
+ firePropertyChange(FOCUS_PAINTED_CHANGED_PROPERTY, old, p);
+ revalidate();
+ repaint();
}
/**
@@ -1581,7 +1546,7 @@ public abstract class AbstractButton extends JComponent
{
public void stateChanged(ChangeEvent e)
{
- AbstractButton.this.fireStateChanged(e);
+ AbstractButton.this.fireStateChanged();
AbstractButton.this.repaint();
}
};
@@ -1639,13 +1604,13 @@ public abstract class AbstractButton extends JComponent
getModel().setArmed(true);
getModel().setPressed(true);
try
- {
+ {
java.lang.Thread.sleep(pressTime);
- }
+ }
catch (java.lang.InterruptedException e)
- {
+ {
// probably harmless
- }
+ }
getModel().setPressed(false);
getModel().setArmed(false);
}
@@ -1671,22 +1636,20 @@ public abstract class AbstractButton extends JComponent
* <code>true</code>. This icon can be <code>null</code>, in which case
* it is synthesized from the button's selected icon.
*
- * @param disabledSelectedIcon The new disabled selected icon
+ * @param icon The new disabled selected icon
*/
- public void setDisabledSelectedIcon(Icon disabledSelectedIcon)
+ public void setDisabledSelectedIcon(Icon icon)
{
+ if (disabledSelectedIcon == icon)
+ return;
+
Icon old = disabledSelectedIcon;
- disabledSelectedIcon = disabledSelectedIcon;
- if (old != disabledSelectedIcon)
- {
- firePropertyChange(DISABLED_SELECTED_ICON_CHANGED_PROPERTY, old,
- disabledSelectedIcon);
- revalidate();
- repaint();
- }
+ disabledSelectedIcon = icon;
+ firePropertyChange(DISABLED_SELECTED_ICON_CHANGED_PROPERTY, old, icon);
+ revalidate();
+ repaint();
}
-
/**
* Return the button's rollover icon. The look and feel class should
* paint this icon when the "rolloverEnabled" property of the button is
@@ -1708,15 +1671,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setRolloverIcon(Icon r)
{
+ if (rolloverIcon == r)
+ return;
+
Icon old = rolloverIcon;
rolloverIcon = r;
- if (old != rolloverIcon)
- {
- firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old,
- rolloverIcon);
- revalidate();
- repaint();
- }
+ firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old, rolloverIcon);
+ revalidate();
+ repaint();
}
/**
@@ -1742,18 +1704,16 @@ public abstract class AbstractButton extends JComponent
*/
public void setRolloverSelectedIcon(Icon r)
{
+ if (rolloverSelectedIcon == r)
+ return;
+
Icon old = rolloverSelectedIcon;
rolloverSelectedIcon = r;
- if (old != rolloverSelectedIcon)
- {
- firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old,
- rolloverSelectedIcon);
- revalidate();
- repaint();
- }
+ firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old, r);
+ revalidate();
+ repaint();
}
-
/**
* Return the button's selected icon. The look and feel class should
* paint this icon when the "selected" property of the button's model is
@@ -1779,15 +1739,14 @@ public abstract class AbstractButton extends JComponent
*/
public void setSelectedIcon(Icon s)
{
+ if (selectedIcon == s)
+ return;
+
Icon old = selectedIcon;
selectedIcon = s;
- if (old != selectedIcon)
- {
- firePropertyChange(SELECTED_ICON_CHANGED_PROPERTY, old,
- selectedIcon);
- revalidate();
- repaint();
- }
+ firePropertyChange(SELECTED_ICON_CHANGED_PROPERTY, old, s);
+ revalidate();
+ repaint();
}
/**
@@ -1804,9 +1763,9 @@ public abstract class AbstractButton extends JComponent
Object[] objs = new Object[1];
objs[0] = getText();
return objs;
- }
+ }
else
- {
+ {
return null;
}
}
@@ -1827,9 +1786,9 @@ public abstract class AbstractButton extends JComponent
*/
public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
int h)
- {
+ {
return current_icon == img;
- }
+ }
/**
* Returns the value of the button's "contentAreaFilled" property. This
@@ -1841,9 +1800,9 @@ public abstract class AbstractButton extends JComponent
* @return The current value of the "contentAreaFilled" property
*/
public boolean isContentAreaFilled()
- {
+ {
return contentAreaFilled;
- }
+ }
/**
* Sets the value of the button's "contentAreaFilled" property. This
@@ -1855,16 +1814,16 @@ public abstract class AbstractButton extends JComponent
* @param b The new value of the "contentAreaFilled" property
*/
public void setContentAreaFilled(boolean b)
- {
+ {
+ if (contentAreaFilled == b)
+ return;
+
boolean old = contentAreaFilled;
contentAreaFilled = b;
- if (b != old)
- {
- firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
- revalidate();
- repaint();
- }
- }
+ firePropertyChange(CONTENT_AREA_FILLED_CHANGED_PROPERTY, old, b);
+ revalidate();
+ repaint();
+ }
/**
* Paints the button's border, if the button's "borderPainted" property is
@@ -1873,10 +1832,10 @@ public abstract class AbstractButton extends JComponent
* @param g The graphics context used to paint the border
*/
protected void paintBorder(Graphics g)
- {
+ {
if (isBorderPainted())
super.paintBorder(g);
- }
+ }
/**
* Returns a string, used only for debugging, which identifies or somehow
@@ -1889,7 +1848,6 @@ public abstract class AbstractButton extends JComponent
return "AbstractButton";
}
-
/**
* Set the "UI" property of the button, which is a look and feel class
* responsible for handling the button's input events and painting it.
@@ -1897,9 +1855,9 @@ public abstract class AbstractButton extends JComponent
* @param ui The new "UI" property
*/
public void setUI(ButtonUI ui)
- {
+ {
super.setUI(ui);
- }
+ }
/**
* Set the "UI" property of the button, which is a look and feel class
@@ -1910,7 +1868,7 @@ public abstract class AbstractButton extends JComponent
public ButtonUI getUI()
{
return (ButtonUI) ui;
- }
+ }
/**
* Set the "UI" property to a class constructed, via the {@link
diff --git a/javax/swing/AbstractSpinnerModel.java b/javax/swing/AbstractSpinnerModel.java
new file mode 100644
index 000000000..d2d345b8e
--- /dev/null
+++ b/javax/swing/AbstractSpinnerModel.java
@@ -0,0 +1,115 @@
+/* AbstractSpinnerModel.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.util.EventListener;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+
+/**
+ * AbstractSpinnerModel
+ * @author Ka-Hing Cheung
+ * @version 1.0
+ */
+public abstract class AbstractSpinnerModel implements SpinnerModel
+{
+ private ChangeEvent changeEvent = new ChangeEvent(this);
+
+ protected EventListenerList listenerList = new EventListenerList();
+
+ /**
+ * Creates an <code>AbstractSpinnerModel</code>.
+ */
+ public AbstractSpinnerModel()
+ {
+ }
+
+ /**
+ * Adds a <code>ChangeListener</code>.
+ *
+ * @param listener the listener to add
+ */
+ public void addChangeListener(ChangeListener listener)
+ {
+ listenerList.add(ChangeListener.class, listener);
+ }
+
+ /**
+ * Gets all the listeners that are of a particular type.
+ *
+ * @param c the type of listener
+ * @return the listeners that are of the specific type
+ */
+ public EventListener[] getListeners(Class c)
+ {
+ return listenerList.getListeners(c);
+ }
+
+ /**
+ * Gets all the <code>ChangeListener</code>s.
+ *
+ * @return all the <code>ChangeListener</code>s
+ */
+ public ChangeListener[] getChangeListeners()
+ {
+ return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
+ }
+
+ /**
+ * Remove a particular listener.
+ *
+ * @param listener the listener to remove
+ */
+ public void removeChangeListener(ChangeListener listener)
+ {
+ listenerList.remove(ChangeListener.class, listener);
+ }
+
+ /**
+ * Fires a <code>ChangeEvent</code> to all the <code>ChangeListener</code>s
+ * added to this model
+ */
+ protected void fireStateChanged()
+ {
+ ChangeListener[] listeners = getChangeListeners();
+
+ for(int i = 0; i < listeners.length; ++i)
+ listeners[i].stateChanged(changeEvent);
+ }
+}
diff --git a/javax/swing/ActionMap.java b/javax/swing/ActionMap.java
index 1b1f8401c..ddfacae54 100644
--- a/javax/swing/ActionMap.java
+++ b/javax/swing/ActionMap.java
@@ -86,7 +86,7 @@ public class ActionMap
{
Object result = actionMap.get(key);
- if (result == null)
+ if (result == null && parent != null)
result = parent.get(key);
return (Action) result;
diff --git a/javax/swing/Box.java b/javax/swing/Box.java
index 01f4d52a6..26588a564 100644
--- a/javax/swing/Box.java
+++ b/javax/swing/Box.java
@@ -178,7 +178,7 @@ public class Box extends JComponent implements Accessible
*/
public Box(int axis)
{
- setLayout(new BoxLayout(this, axis));
+ super.setLayout(new BoxLayout(this, axis));
}
/**
diff --git a/javax/swing/ButtonGroup.java b/javax/swing/ButtonGroup.java
index 8202fa6cb..5f6a28d86 100644
--- a/javax/swing/ButtonGroup.java
+++ b/javax/swing/ButtonGroup.java
@@ -42,19 +42,18 @@ import java.util.Enumeration;
import java.util.Vector;
-public class ButtonGroup
- implements Serializable
+/**
+ * DOCUMENT ME!
+ */
+public class ButtonGroup implements Serializable
{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = 4259076101881721375L;
- /**
- * The buttons added to this button group.
- */
+ /** The buttons added to this button group. */
protected Vector buttons = new Vector();
- /**
- * The currently selected button model.
- */
+ /** The currently selected button model. */
ButtonModel sel;
/**
@@ -99,17 +98,24 @@ public class ButtonGroup
/**
* Returns the currently selected button model.
*
- * @return the currently selected button model,
- * null if none was selected yet
+ * @return the currently selected button model, null if none was selected
+ * yet
*/
public ButtonModel getSelection()
{
return sel;
}
+ /**
+ * DOCUMENT ME!
+ *
+ * @param m DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
AbstractButton FindButton(ButtonModel m)
{
- for (int i = 0;i < buttons.size(); i++)
+ for (int i = 0; i < buttons.size(); i++)
{
AbstractButton a = (AbstractButton) buttons.get(i);
if (a.getModel() == m)
@@ -119,46 +125,40 @@ public class ButtonGroup
}
/**
- * Sets the currently selected button model. Only one button of a group
- * can be selected at a time.
+ * Sets the currently selected button model. Only one button of a group can
+ * be selected at a time.
*
* @param m the model to select
* @param b true if this button is to be selected, false otherwise
*/
public void setSelected(ButtonModel m, boolean b)
{
- if ((m == sel) && (b == true))
- {
- // clicked on same item twice.
- System.out.println("PRESSED TWICE:" + m + ", sel=" + sel);
- return;
- }
+ if ((sel != m || b) && (! b || sel == m))
+ return;
- if (sel != null)
+ if (b && sel != m)
{
- System.out.println("DESELECTING: " + sel);
- sel.setSelected(! b);
-
- AbstractButton but = FindButton(sel);
- if (but != null)
- {
- System.out.println("REPAINT-REQUEST: " + but.text);
- //but.revalidate();
- but.repaint();
- }
+ ButtonModel old = sel;
+ sel = m;
+
+ if (old != null)
+ old.setSelected(false);
+ AbstractButton button = FindButton(old);
+ if (button != null)
+ button.repaint();
}
- else
- System.out.println("NO SELECTION YET");
-
- sel = m;
+ else if (! b && sel == m)
+ m.setSelected(true);
}
/**
- * Checks if the given <code>ButtonModel</code> is selected
- * in this button group.
+ * Checks if the given <code>ButtonModel</code> is selected in this button
+ * group.
+ *
+ * @param m DOCUMENT ME!
*
- * @return true of given <code>ButtonModel</code> is selected,
- * false otherwise
+ * @return true of given <code>ButtonModel</code> is selected, false
+ * otherwise
*/
public boolean isSelected(ButtonModel m)
{
diff --git a/javax/swing/ComboBoxEditor.java b/javax/swing/ComboBoxEditor.java
index 8559217b6..30813175a 100644
--- a/javax/swing/ComboBoxEditor.java
+++ b/javax/swing/ComboBoxEditor.java
@@ -42,49 +42,56 @@ import java.awt.event.ActionListener;
/**
* ComboBoxEditor
- * @author Andrew Selkirk
- * @version 1.0
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
+ * @version 1.0
*/
-public interface ComboBoxEditor {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getEditorComponent
- * @returns Component
- */
- Component getEditorComponent();
-
- /**
- * setItem
- * @param item TODO
- */
- void setItem(Object item);
-
- /**
- * getItem
- * @returns Object
- */
- Object getItem();
-
- /**
- * selectAll
- */
- void selectAll();
-
- /**
- * addActionListener
- * @param listener TODO
- */
- void addActionListener(ActionListener listener);
-
- /**
- * removeActionListener
- * @param listener TODO
- */
- void removeActionListener(ActionListener listener);
-
-
+public interface ComboBoxEditor
+{
+ /**
+ * This method returns component that will be used by the combo box to
+ * display/edit currently selected item in the combo box.
+ *
+ * @return Component that will be used by the combo box to display/edit
+ * currently selected item
+ */
+ Component getEditorComponent();
+
+ /**
+ * Sets item that should be editted when any editting operation is performed
+ * by the user. The value is always equal to the currently selected value
+ * in the combo box. Thus, whenever a different value is selected from the
+ * combo box list then this method should be called to change editting item
+ * to the new selected item.
+ *
+ * @param selectedItem item that is currently selected in the combo box
+ */
+ void setItem(Object item);
+
+ /**
+ * This method returns item that is currently editable.
+ *
+ * @return Item in the combo box that is currently editable
+ */
+ Object getItem();
+
+ /**
+ * selectAll
+ */
+ void selectAll();
+
+ /**
+ * This method adds specified ActionListener to this ComboBoxEditor.
+ *
+ * @param listener
+ */
+ void addActionListener(ActionListener listener);
+
+ /**
+ * This method removes given ActionListener from this ComboBoxEditor.
+ *
+ * @param listener TODO
+ */
+ void removeActionListener(ActionListener listener);
} // ComboBoxEditor
diff --git a/javax/swing/ComboBoxModel.java b/javax/swing/ComboBoxModel.java
index b3b2112b5..c3b59bda6 100644
--- a/javax/swing/ComboBoxModel.java
+++ b/javax/swing/ComboBoxModel.java
@@ -37,28 +37,32 @@ exception statement from your version. */
package javax.swing;
+
/**
- * ComboBoxModel
- * @author Andrew Selkirk
- * @version 1.0
+ * ComboBoxModel is a data model for JComboBox. This model keeps
+ * track of elements contained in the JComboBox as well as the current
+ * combo box selection. Whenever selection in the JComboBox changes, the
+ * ComboBoxModel should fire ListDataEvents to ComboBox's ListDataListeners.
+ *
+ * @author Andrew Selkirk
+ * @version 1.0
*/
-public interface ComboBoxModel extends ListModel {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * setSelectedItem
- * @param item TODO
- */
- void setSelectedItem(Object item);
-
- /**
- * getSelectedItem
- * @returns Object
- */
- Object getSelectedItem();
-
+public interface ComboBoxModel extends ListModel
+{
+ /**
+ * This method sets the selected item in the combo box. Class
+ * implementing this interface should fire ListDataEvents to
+ * all registered ListDataListeners to indicated that the
+ * selection has changed.
+ *
+ * @param item item in the combo box that should be selected
+ */
+ void setSelectedItem(Object item);
+ /**
+ * The method returns currently selected item in the combo box
+ *
+ * @returns item that is currently selected in the combo box.
+ */
+ Object getSelectedItem();
} // ComboBoxModel
diff --git a/javax/swing/DebugGraphics.java b/javax/swing/DebugGraphics.java
index a3c3d39da..6aa80adf5 100644
--- a/javax/swing/DebugGraphics.java
+++ b/javax/swing/DebugGraphics.java
@@ -48,678 +48,740 @@ import java.awt.image.ImageObserver;
import java.io.PrintStream;
import java.text.AttributedCharacterIterator;
+
/**
* DebugGraphics
* @author Andrew Selkirk
* @version 1.0
*/
-public class DebugGraphics extends Graphics {
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * graphics
- */
- Graphics graphics;
-
- /**
- * buffer
- */
- Image buffer;
-
- /**
- * debugOptions
- */
- int debugOptions;
-
- /**
- * graphicsID
- */
- int graphicsID;
-
- /**
- * xOffset
- */
- int xOffset;
-
- /**
- * yOffset
- */
- int yOffset;
-
- /**
- * LOG_OPTION
- */
- public static final int LOG_OPTION = 1;
-
- /**
- * FLASH_OPTION
- */
- public static final int FLASH_OPTION = 2;
-
- /**
- * BUFFERED_OPTION
- */
- public static final int BUFFERED_OPTION = 4;
-
- /**
- * NONE_OPTION
- */
- public static final int NONE_OPTION = -1;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DebugGraphics
- */
- public DebugGraphics() {
- // TODO
- } // DebugGraphics()
-
- /**
- * Constructor DebugGraphics
- * @param graphics TODO
- * @param component TODO
- */
- public DebugGraphics(Graphics graphics, JComponent component) {
- // TODO
- } // DebugGraphics()
-
- /**
- * Constructor DebugGraphics
- * @param graphics TODO
- */
- public DebugGraphics(Graphics graphics) {
- // TODO
- } // DebugGraphics()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * setColor
- * @param value0 TODO
- */
- public void setColor(Color color) {
- // TODO
- } // setColor()
-
- /**
- * create
- * @returns Graphics
- */
- public Graphics create() {
- return null; // TODO
- } // create()
-
- /**
- * create
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @returns Graphics
- */
- public Graphics create(int valx, int y, int w, int h) {
- return null; // TODO
- } // create()
-
- /**
- * flashColor
- * @returns Color
- */
- public static Color flashColor() {
- return null; // TODO
- } // flashColor()
-
- /**
- * setFlashColor
- * @param color TODO
- */
- public static void setFlashColor(Color color) {
- // TODO
- } // setFlashColor()
-
- /**
- * flashTime
- * @returns int
- */
- public static int flashTime() {
- return 0; // TODO
- } // flashTime()
-
- /**
- * setFlashTime
- * @param time TODO
- */
- public static void setFlashTime(int time) {
- // TODO
- } // setFlashTime()
-
- /**
- * flashCount
- * @returns int
- */
- public static int flashCount() {
- return 0; // TODO
- } // flashCount()
-
- /**
- * setFlashCount
- * @param count TODO
- */
- public static void setFlashCount(int count) {
- // TODO
- } // setFlashCount()
-
- /**
- * logStream
- * @returns PrintStream
- */
- public static PrintStream logStream() {
- return null; // TODO
- } // logStream()
-
- /**
- * setLogStream
- * @param stream TODO
- */
- public static void setLogStream(PrintStream stream) {
- // TODO
- } // setLogStream()
-
- /**
- * getFont
- * @returns Font
- */
- public Font getFont() {
- return null; // TODO
- } // getFont()
-
- /**
- * setFont
- * @param font TODO
- */
- public void setFont(Font font) {
- // TODO
- } // setFont()
-
- /**
- * getColor
- * @returns Color
- */
- public Color getColor() {
- return null; // TODO
- } // getColor()
-
- /**
- * getFontMetrics
- * @returns FontMetrics
- */
- public FontMetrics getFontMetrics() {
- return null; // TODO
- } // getFontMetrics()
-
- /**
- * getFontMetrics
- * @param font TODO
- * @returns FontMetrics
- */
- public FontMetrics getFontMetrics(Font font) {
- return null; // TODO
- } // getFontMetrics()
-
- /**
- * translate
- * @param x TODO
- * @param y TODO
- */
- public void translate(int x, int y) {
- // TODO
- } // translate()
-
- /**
- * setPaintMode
- */
- public void setPaintMode() {
- // TODO
- } // setPaintMode()
-
- /**
- * setXORMode
- * @param color TODO
- */
- public void setXORMode(Color color) {
- // TODO
- } // setXORMode()
-
- /**
- * getClipBounds
- * @returns Rectangle
- */
- public Rectangle getClipBounds() {
- return null; // TODO
- } // getClipBounds()
-
- /**
- * clipRect
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- * @param value3 TODO
- */
- public void clipRect(int value0, int value1, int value2, int value3) {
- // TODO
- } // clipRect()
-
- /**
- * setClip
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void setClip(int x, int y, int w, int h) {
- // TODO
- } // setClip()
-
- /**
- * getClip
- * @returns Shape
- */
- public Shape getClip() {
- return null; // TODO
- } // getClip()
-
- /**
- * setClip
- * @param shape TODO
- */
- public void setClip(Shape shape) {
- // TODO
- } // setClip()
-
- /**
- * drawRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param valh TODO
- */
- public void drawRect(int x, int y, int w, int h) {
- // TODO
- } // drawRect()
-
- /**
- * fillRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void fillRect(int x, int y, int w, int h) {
- // TODO
- } // fillRect()
-
- /**
- * clearRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void clearRect(int x, int y, int w, int h) {
- // TODO
- } // clearRect()
-
- /**
- * drawRoundRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param arcWidth TODO
- * @param arcHeight TODO
- */
- public void drawRoundRect(int x, int y, int w, int h,
- int arcWidth, int arcHeight) {
- // TODO
- } // drawRoundRect()
-
- /**
- * fillRoundRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param arcWidth TODO
- * @param arcHeight TODO
- */
- public void fillRoundRect(int x, int y, int w, int h,
- int arcWidth, int arcHeight) {
- // TODO
- } // fillRoundRect()
-
- /**
- * drawLine
- * @param x1 TODO
- * @param y1 TODO
- * @param x2 TODO
- * @param y2 TODO
- */
- public void drawLine(int x1, int y1, int x2, int y2) {
- // TODO
- } // drawLine()
-
- /**
- * draw3DRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param raised TODO
- */
- public void draw3DRect(int x, int y, int w, int h, boolean raised) {
- // TODO
- } // draw3DRect()
-
- /**
- * fill3DRect
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param raised TODO
- */
- public void fill3DRect(int x, int y, int w, int h, boolean raised) {
- // TODO
- } // fill3DRect()
-
- /**
- * drawOval
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void drawOval(int x, int y, int w, int h) {
- // TODO
- } // drawOval()
-
- /**
- * fillOval
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- */
- public void fillOval(int x, int y, int w, int h) {
- // TODO
- } // fillOval()
-
- /**
- * drawArc
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param startAngle TODO
- * @param arcAngle TODO
- */
- public void drawArc(int x, int y, int w, int h,
- int startAngle, int arcAngle) {
- // TODO
- } // drawArc()
-
- /**
- * fillArc
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param startAngle TODO
- * @param arcAngle TODO
- */
- public void fillArc(int x, int y, int w, int h,
- int startAngle, int arcAngle) {
- // TODO
- } // fillArc()
-
- /**
- * drawPolyline
- * @param xpoints TODO
- * @param ypoints TODO
- * @param npoints TODO
- */
- public void drawPolyline(int[] xpoints, int[] ypoints, int npoints) {
- // TODO
- } // drawPolyline()
-
- /**
- * drawPolygon
- * @param xpoints TODO
- * @param ypoints TODO
- * @param npoints TODO
- */
- public void drawPolygon(int[] xpoints, int[] ypoints, int npoints) {
- // TODO
- } // drawPolygon()
-
- /**
- * fillPolygon
- * @param xpoints TODO
- * @param ypoints TODO
- * @param npoints TODO
- */
- public void fillPolygon(int[] xpoints, int[] ypoints, int npoints) {
- // TODO
- } // fillPolygon()
-
- /**
- * drawString
- * @param string TODO
- * @param x TODO
- * @param y TODO
- */
- public void drawString(String string, int s, int y) {
- // TODO
- } // drawString()
-
- /**
- * drawString
- * @param iterator TODO
- * @param x TODO
- * @param y TODO
- */
- public void drawString(AttributedCharacterIterator iterator,
- int x, int y) {
- // TODO
- } // drawString()
-
- /**
- * drawBytes
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @param x TODO
- * @param y TODO
- */
- public void drawBytes(byte[] data, int offset, int length,
- int x, int y) {
- // TODO
- } // drawBytes()
-
- /**
- * drawChars
- * @param data TODO
- * @param offset TODO
- * @param length TODO
- * @param value3 TODO
- * @param value4 TODO
- */
- public void drawChars(char[] data, int offset, int value2,
- int x, int y) {
- // TODO
- } // drawChars()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y,
- ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y, int w,
- int h, ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param background TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y,
- Color background, ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param background TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int x, int y, int w, int h,
- Color background, ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param dx1 TODO
- * @param dy1 TODO
- * @param dx2 TODO
- * @param dy2 TODO
- * @param sx1 TODO
- * @param sy1 TODO
- * @param sx2 TODO
- * @param sy2 TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int dx1, int dy1,
- int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
- ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * drawImage
- * @param image TODO
- * @param dx1 TODO
- * @param dy1 TODO
- * @param dx2 TODO
- * @param dy2 TODO
- * @param sx1 TODO
- * @param sy1 TODO
- * @param sx2 TODO
- * @param sy2 TODO
- * @param background TODO
- * @param observer TODO
- * @returns boolean
- */
- public boolean drawImage(Image image, int dx1, int dy1,
- int dx2, int dy2, int sx1, int sy1, int sx2, int sy2,
- Color background, ImageObserver observer) {
- return false; // TODO
- } // drawImage()
-
- /**
- * copyArea
- * @param x TODO
- * @param y TODO
- * @param w TODO
- * @param h TODO
- * @param destx TODO
- * @param desty TODO
- */
- public void copyArea(int x, int y, int w, int h,
- int destx, int desty) {
- // TODO
- } // copyArea()
-
- /**
- * dispose
- */
- public void dispose() {
- // TODO
- } // dispose()
-
- /**
- * isDrawingBuffer
- * @returns boolean
- */
- public boolean isDrawingBuffer() {
- return false; // TODO
- } // isDrawingBuffer()
-
- /**
- * toShortString
- * @returns String
- */
- String toShortString() {
- return null; // TODO
- } // toShortString()
-
- /**
- * setDebugOptions
- * @param options TODO
- */
- public void setDebugOptions(int options) {
- // TODO
- } // setDebugOptions()
-
- /**
- * getDebugOptions
- * @returns int
- */
- public int getDebugOptions() {
- return 0; // TODO
- } // getDebugOptions()
-
-
-} // DebugGraphics
+public class DebugGraphics extends Graphics
+{
+
+ /**
+ * graphics
+ */
+ Graphics graphics;
+
+ /**
+ * buffer
+ */
+ Image buffer;
+
+ /**
+ * debugOptions
+ */
+ int debugOptions;
+
+ /**
+ * graphicsID
+ */
+ int graphicsID;
+
+ /**
+ * xOffset
+ */
+ int xOffset;
+
+ /**
+ * yOffset
+ */
+ int yOffset;
+
+ /**
+ * LOG_OPTION
+ */
+ public static final int LOG_OPTION = 1;
+
+ /**
+ * FLASH_OPTION
+ */
+ public static final int FLASH_OPTION = 2;
+
+ /**
+ * BUFFERED_OPTION
+ */
+ public static final int BUFFERED_OPTION = 4;
+
+ /**
+ * NONE_OPTION
+ */
+ public static final int NONE_OPTION = -1;
+
+ /**
+ * Creates a <code>DebugGraphics</code> object.
+ */
+ public DebugGraphics()
+ {
+ // TODO
+ }
+
+ /**
+ * Constructor DebugGraphics
+ * @param graphics TODO
+ * @param component TODO
+ */
+ public DebugGraphics(Graphics graphics, JComponent component)
+ {
+ // TODO
+ }
+
+ /**
+ * Constructor DebugGraphics
+ * @param graphics TODO
+ */
+ public DebugGraphics(Graphics graphics)
+ {
+ // TODO
+ }
+
+ /**
+ * setColor
+ * @param value0 TODO
+ */
+ public void setColor(Color color)
+ {
+ // TODO
+ }
+
+ /**
+ * create
+ *
+ * @return Graphics
+ */
+ public Graphics create()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * create
+ *
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @returns Graphics
+ */
+ public Graphics create(int valx, int y, int w, int h)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * flashColor
+ *
+ * @return Color
+ */
+ public static Color flashColor()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setFlashColor
+ *
+ * @param color the color to use for flashing
+ */
+ public static void setFlashColor(Color color)
+ {
+ // TODO
+ }
+
+ /**
+ * flashTime
+ *
+ * @return The time in milliseconds
+ */
+ public static int flashTime()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * setFlashTime
+ *
+ * @param time The time in milliseconds
+ */
+ public static void setFlashTime(int time)
+ {
+ // TODO
+ }
+
+ /**
+ * flashCount
+ * @returns int
+ */
+ public static int flashCount()
+ {
+ return 0; // TODO
+ }
+
+ /**
+ * setFlashCount
+ *
+ * @param count The number of flashes
+ */
+ public static void setFlashCount(int count)
+ {
+ // TODO
+ }
+
+ /**
+ * logStream
+ *
+ * @return The <code>PrintStream</code> to write logging messages to
+ */
+ public static PrintStream logStream()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setLogStream
+ *
+ * @param stream The currently set <code>PrintStream</code>.
+ */
+ public static void setLogStream(PrintStream stream)
+ {
+ // TODO
+ }
+
+ /**
+ * getFont
+ * @returns Font
+ */
+ public Font getFont()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setFont
+ *
+ * @param font The font to use for drawing text
+ */
+ public void setFont(Font font)
+ {
+ // TODO
+ }
+
+ /**
+ * getColor
+ * @returns Color
+ */
+ public Color getColor()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getFontMetrics
+ * @returns FontMetrics
+ */
+ public FontMetrics getFontMetrics()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getFontMetrics
+ * @param font TODO
+ * @returns FontMetrics
+ */
+ public FontMetrics getFontMetrics(Font font)
+ {
+ return null; // TODO
+ }
+
+ /**
+ * translate
+ *
+ * @param x TODO
+ * @param y TODO
+ */
+ public void translate(int x, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * setPaintMode
+ */
+ public void setPaintMode()
+ {
+ // TODO
+ }
+
+ /**
+ * setXORMode
+ *
+ * @param color TODO
+ */
+ public void setXORMode(Color color)
+ {
+ // TODO
+ }
+
+ /**
+ * getClipBounds
+ * @returns Rectangle
+ */
+ public Rectangle getClipBounds()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * clipRect
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ * @param value3 TODO
+ */
+ public void clipRect(int value0, int value1, int value2, int value3)
+ {
+ // TODO
+ }
+
+ /**
+ * setClip
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void setClip(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * getClip
+ * @returns Shape
+ */
+ public Shape getClip()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * setClip
+ * @param shape TODO
+ */
+ public void setClip(Shape shape)
+ {
+ // TODO
+ }
+
+ /**
+ * drawRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param valh TODO
+ */
+ public void drawRect(int x, int y, int w, int h)
+ {
+ // TODO
+ } // drawRect()
+
+ /**
+ * fillRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void fillRect(int x, int y, int w, int h)
+ {
+ // TODO
+ } // fillRect()
+
+ /**
+ * clearRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void clearRect(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * drawRoundRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param arcWidth TODO
+ * @param arcHeight TODO
+ */
+ public void drawRoundRect(int x, int y, int w, int h, int arcWidth,
+ int arcHeight)
+ {
+ // TODO
+ }
+
+ /**
+ * fillRoundRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param arcWidth TODO
+ * @param arcHeight TODO
+ */
+ public void fillRoundRect(int x, int y, int w, int h, int arcWidth,
+ int arcHeight)
+ {
+ // TODO
+ }
+
+ /**
+ * drawLine
+ * @param x1 TODO
+ * @param y1 TODO
+ * @param x2 TODO
+ * @param y2 TODO
+ */
+ public void drawLine(int x1, int y1, int x2, int y2)
+ {
+ // TODO
+ }
+
+ /**
+ * draw3DRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param raised TODO
+ */
+ public void draw3DRect(int x, int y, int w, int h, boolean raised)
+ {
+ // TODO
+ }
+
+ /**
+ * fill3DRect
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param raised TODO
+ */
+ public void fill3DRect(int x, int y, int w, int h, boolean raised)
+ {
+ // TODO
+ }
+
+ /**
+ * drawOval
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void drawOval(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * fillOval
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ */
+ public void fillOval(int x, int y, int w, int h)
+ {
+ // TODO
+ }
+
+ /**
+ * drawArc
+ *
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param startAngle TODO
+ * @param arcAngle TODO
+ */
+ public void drawArc(int x, int y, int w, int h, int startAngle, int arcAngle)
+ {
+ // TODO
+ }
+
+ /**
+ * fillArc
+ *
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param startAngle TODO
+ * @param arcAngle TODO
+ */
+ public void fillArc(int x, int y, int w, int h, int startAngle, int arcAngle)
+ {
+ // TODO
+ }
+
+ /**
+ * drawPolyline
+ * @param xpoints TODO
+ * @param ypoints TODO
+ * @param npoints TODO
+ */
+ public void drawPolyline(int[] xpoints, int[] ypoints, int npoints)
+ {
+ // TODO
+ }
+
+ /**
+ * drawPolygon
+ *
+ * @param xpoints TODO
+ * @param ypoints TODO
+ * @param npoints TODO
+ */
+ public void drawPolygon(int[] xpoints, int[] ypoints, int npoints)
+ {
+ // TODO
+ }
+
+ /**
+ * fillPolygon
+ *
+ * @param xpoints TODO
+ * @param ypoints TODO
+ * @param npoints TODO
+ */
+ public void fillPolygon(int[] xpoints, int[] ypoints, int npoints)
+ {
+ // TODO
+ }
+
+ /**
+ * drawString
+ *
+ * @param string TODO
+ * @param x TODO
+ * @param y TODO
+ */
+ public void drawString(String string, int s, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * drawString
+ *
+ * @param iterator TODO
+ * @param x TODO
+ * @param y TODO
+ */
+ public void drawString(AttributedCharacterIterator iterator, int x, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * drawBytes
+ *
+ * @param data TODO
+ * @param offset TODO
+ * @param length TODO
+ * @param x TODO
+ * @param y TODO
+ */
+ public void drawBytes(byte[] data, int offset, int length, int x, int y)
+ {
+ // TODO
+ }
+
+ /**
+ * drawChars
+ * @param data TODO
+ * @param offset TODO
+ * @param length TODO
+ * @param value3 TODO
+ * @param value4 TODO
+ */
+ public void drawChars(char[] data, int offset, int value2, int x, int y)
+ {
+ // TODO
+ } // drawChars()
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, int w, int h,
+ ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param background TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, Color background,
+ ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ * @param image TODO
+ * @param x TODO
+ * @param y TODO
+ * @param w TODO
+ * @param h TODO
+ * @param background TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int x, int y, int w, int h,
+ Color background, ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ *
+ * @param image The image to draw
+ * @param dx1 TODO
+ * @param dy1 TODO
+ * @param dx2 TODO
+ * @param dy2 TODO
+ * @param sx1 TODO
+ * @param sy1 TODO
+ * @param sx2 TODO
+ * @param sy2 TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
+ int sx1, int sy1, int sx2, int sy2,
+ ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * drawImage
+ *
+ * @param image The image to draw
+ * @param dx1 TODO
+ * @param dy1 TODO
+ * @param dx2 TODO
+ * @param dy2 TODO
+ * @param sx1 TODO
+ * @param sy1 TODO
+ * @param sx2 TODO
+ * @param sy2 TODO
+ * @param background TODO
+ * @param observer TODO
+ * @returns boolean
+ */
+ public boolean drawImage(Image image, int dx1, int dy1, int dx2, int dy2,
+ int sx1, int sy1, int sx2, int sy2,
+ Color background, ImageObserver observer)
+ {
+ return false; // TODO
+ }
+
+ /**
+ * copyArea
+ *
+ * @param x The x position of the source area
+ * @param y The y position of the source area
+ * @param width The width of the area
+ * @param height The height of the area
+ * @param destx The x position of the destination area
+ * @param desty The y posiiton of the destination area
+ */
+ public void copyArea(int x, int y, int w, int h, int destx, int desty)
+ {
+ // TODO
+ }
+
+ /**
+ * Releases all system resources that this <code>Graphics</code> is using.
+ */
+ public void dispose()
+ {
+ // TODO
+ }
+
+ /**
+ * isDrawingBuffer
+ *
+ * @return boolean
+ */
+ public boolean isDrawingBuffer()
+ {
+ return false; // TODO
+ }
+
+ /**
+ * toShortString
+ * @returns String
+ */
+ String toShortString()
+ {
+ return null; // TODO
+ } // toShortString()
+
+ /**
+ * setDebugOptions
+ *
+ * @param options the debug options
+ */
+ public void setDebugOptions(int options)
+ {
+ // TODO
+ }
+
+ /**
+ * getDebugOptions
+ *
+ * @return the debug options
+ */
+ public int getDebugOptions()
+ {
+ return 0; // TODO
+ }
+}
diff --git a/javax/swing/DefaultButtonModel.java b/javax/swing/DefaultButtonModel.java
index e9a1356e8..4c7c24772 100644
--- a/javax/swing/DefaultButtonModel.java
+++ b/javax/swing/DefaultButtonModel.java
@@ -1,4 +1,4 @@
-/* DefaultButtonModel.java --
+/* DefaultButtonModel.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -44,87 +44,103 @@ import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import java.io.Serializable;
import java.util.EventListener;
-
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
+
/**
* The purpose of this class is to model the dynamic state of an abstract
* button. The concrete button type holding this state may be a a "toggle"
* button (checkbox, radio button) or a "push" button (menu button, button).
- *
- * If the model is disabled, only the "selected" property can be changed.
- * An attempt to change the "armed", "rollover" or "pressed" properties
- * while the model is disabled will be blocked.
- *
- * Any successful (non-blocked) change to the model's properties will
- * trigger the firing of a ChangeEvent.
- *
- * Any change to the "selected" property will trigger the firing of an
- * ItemEvent in addition to ChangeEvent. This is true whether the model is
- * enabled or not.
- *
- * One other state change is special: the transition from "enabled, armed
- * and pressd" to "enabled, armed and not-pressed". This is considered the
- * "trailing edge" of a successful mouse click, and therefore fires an
- * ActionEvent in addition to a ChangeEvent.
+ * If the model is disabled, only the "selected" property can be changed. An
+ * attempt to change the "armed", "rollover" or "pressed" properties while
+ * the model is disabled will be blocked. Any successful (non-blocked) change
+ * to the model's properties will trigger the firing of a ChangeEvent. Any
+ * change to the "selected" property will trigger the firing of an ItemEvent
+ * in addition to ChangeEvent. This is true whether the model is enabled or
+ * not. One other state change is special: the transition from "enabled,
+ * armed and pressd" to "enabled, armed and not-pressed". This is considered
+ * the "trailing edge" of a successful mouse click, and therefore fires an
+ * ActionEvent in addition to a ChangeEvent. In all other respects this class
+ * is just a container of boolean flags.
*
- * In all other respects this class is just a container of boolean flags.
- *
- * @author Graydon Hoare (graydon@redhat.com)
+ * @author Graydon Hoare (graydon_at_redhat.com)
*/
public class DefaultButtonModel implements ButtonModel, Serializable
{
+ /** DOCUMENT ME! */
static final long serialVersionUID = -5342609566534980231L;
- /** Indicates that the button is <em>partially</em> committed to being
- pressed, but not entirely. This usually happens when a user has pressed
- but not yet released the mouse button. */
+ /**
+ * Indicates that the button is <em>partially</em> committed to being
+ * pressed, but not entirely. This usually happens when a user has pressed
+ * but not yet released the mouse button.
+ */
public static final int ARMED = 1;
- /** State constant indicating that the button is enabled. Buttons cannot
- be pressed or selected unless they are enabled. */
+ /**
+ * State constant indicating that the button is enabled. Buttons cannot be
+ * pressed or selected unless they are enabled.
+ */
public static final int ENABLED = 8;
- /** State constant indicating that the user is holding down the button.
- When this transitions from true to false, an ActionEvent may be fired,
- depending on the value of the "armed" property.*/
+ /**
+ * State constant indicating that the user is holding down the button. When
+ * this transitions from true to false, an ActionEvent may be fired,
+ * depending on the value of the "armed" property.
+ */
public static final int PRESSED = 4;
- /** State constant indicating that the mouse is currently positioned over
- the button. */
+ /**
+ * State constant indicating that the mouse is currently positioned over the
+ * button.
+ */
public static final int ROLLOVER = 16;
- /** State constant indicating that the button is selected. This constant
- is only meaningful for toggle-type buttons (radio buttons,
- checkboxes). */
+ /**
+ * State constant indicating that the button is selected. This constant is
+ * only meaningful for toggle-type buttons (radio buttons, checkboxes).
+ */
public static final int SELECTED = 2;
- /** Represents the "state properties" (armed, enabled, pressed, rollover
- and selected) by a bitwise combination of integer constants. */
+ /**
+ * Represents the "state properties" (armed, enabled, pressed, rollover and
+ * selected) by a bitwise combination of integer constants.
+ */
protected int stateMask = ENABLED;
- /** List of ItemListeners, ChangeListeners, and ActionListeners
- registered on this model. */
- protected EventListenerList listenerList = new EventListenerList();;
+ /**
+ * List of ItemListeners, ChangeListeners, and ActionListeners registered on
+ * this model.
+ */
+ protected EventListenerList listenerList = new EventListenerList();
+ ;
- /** The single ChangeEvent this model (re)uses to call its
- ChangeListeners. */
+ /** The single ChangeEvent this model (re)uses to call its ChangeListeners. */
protected ChangeEvent changeEvent = new ChangeEvent(this);
- /** The group this model belongs to. Only one button in a group may be
- selected at any given time. */
+ /**
+ * The group this model belongs to. Only one button in a group may be
+ * selected at any given time.
+ */
protected ButtonGroup group;
-
- /** The key code (one of {@link java.awt.event.KeyEvent} VK_*) used to
- press this button via a keyboard interface. */
+
+ /**
+ * The key code (one of {@link java.awt.event.KeyEvent} VK_) used to press
+ * this button via a keyboard interface.
+ */
protected int mnemonic = KeyEvent.VK_UNDEFINED;
- /** The string used as the "command" property of any ActionEvent this
- model sends. */
+ /**
+ * The string used as the "command" property of any ActionEvent this model
+ * sends.
+ */
protected String actionCommand;
+ /**
+ * Creates a new DefaultButtonModel object.
+ */
public DefaultButtonModel()
{
}
@@ -135,10 +151,10 @@ public class DefaultButtonModel implements ButtonModel, Serializable
*
* @return <code>null</code>
*/
- public Object[] getSelectedObjects()
- {
- return null;
- }
+ public Object[] getSelectedObjects()
+ {
+ return null;
+ }
/**
* Returns a specified class of listeners.
@@ -151,10 +167,10 @@ public class DefaultButtonModel implements ButtonModel, Serializable
{
return listenerList.getListeners(listenerType);
}
-
+
/**
- * Add an ActionListener to the model. Usually only called to subscribe
- * an AbstractButton's listener to the model.
+ * Add an ActionListener to the model. Usually only called to subscribe an
+ * AbstractButton's listener to the model.
*
* @param l The listener to add
*/
@@ -162,10 +178,10 @@ public class DefaultButtonModel implements ButtonModel, Serializable
{
listenerList.add(ActionListener.class, l);
}
-
+
/**
- * Remove an ActionListener to the model. Usually only called to
- * unsubscribe an AbstractButton's listener to the model.
+ * Remove an ActionListener to the model. Usually only called to unsubscribe
+ * an AbstractButton's listener to the model.
*
* @param l The listener to remove
*/
@@ -185,8 +201,8 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Add an ItemListener to the model. Usually only called to subscribe
- * an AbstractButton's listener to the model.
+ * Add an ItemListener to the model. Usually only called to subscribe an
+ * AbstractButton's listener to the model.
*
* @param l The listener to add
*/
@@ -196,8 +212,8 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Remove an ItemListener to the model. Usually only called to
- * unsubscribe an AbstractButton's listener to the model.
+ * Remove an ItemListener to the model. Usually only called to unsubscribe
+ * an AbstractButton's listener to the model.
*
* @param l The listener to remove
*/
@@ -217,8 +233,8 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Add a ChangeListener to the model. Usually only called to subscribe
- * an AbstractButton's listener to the model.
+ * Add a ChangeListener to the model. Usually only called to subscribe an
+ * AbstractButton's listener to the model.
*
* @param l The listener to add
*/
@@ -228,8 +244,8 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Remove a ChangeListener to the model. Usually only called to
- * unsubscribe an AbstractButton's listener to the model.
+ * Remove a ChangeListener to the model. Usually only called to unsubscribe
+ * an AbstractButton's listener to the model.
*
* @param l The listener to remove
*/
@@ -258,61 +274,60 @@ public class DefaultButtonModel implements ButtonModel, Serializable
public void fireItemStateChanged(ItemEvent e)
{
ItemListener[] ll = getItemListeners();
-
+
for (int i = 0; i < ll.length; i++)
ll[i].itemStateChanged(e);
}
/**
* Inform each ActionListener in the {@link listenerList} that an
- * ActionEvent has occurred. This happens in response to the any change
- * to the {@link stateMask} field which makes the enabled, armed and
- * pressed properties all simultaneously <code>true</code>.
+ * ActionEvent has occurred. This happens in response to the any change to
+ * the {@link stateMask} field which makes the enabled, armed and pressed
+ * properties all simultaneously <code>true</code>.
*
* @param e The ActionEvent to fire
*/
public void fireActionPerformed(ActionEvent e)
{
ActionListener[] ll = getActionListeners();
-
+
for (int i = 0; i < ll.length; i++)
ll[i].actionPerformed(e);
}
/**
- * Inform each ChangeListener in the {@link listenerList} that a
- * ChangeEvent has occurred. This happens in response to the any change
- * to a property of the model.
- *
- * @param event The ChangeEvent to fire
+ * Inform each ChangeListener in the {@link listenerList} that a ChangeEvent
+ * has occurred. This happens in response to the any change to a property
+ * of the model.
*/
public void fireStateChanged()
{
ChangeListener[] ll = getChangeListeners();
-
+
for (int i = 0; i < ll.length; i++)
ll[i].stateChanged(changeEvent);
}
/**
- * Helper method to fire a ChangeEvent with the model as the event's
- * source.
+ * Helper method to fire a ChangeEvent with the model as the event's source.
+ *
+ * @param stateflag DOCUMENT ME!
+ * @param b DOCUMENT ME!
*/
protected void changeState(int stateflag, boolean b)
- {
+ {
int oldstate = stateMask;
int newstate;
if (b)
newstate = oldstate | stateflag;
else
- newstate = oldstate & ~stateflag;
+ newstate = oldstate & ~ stateflag;
if (oldstate == newstate)
return;
- if ((stateflag != SELECTED)
- && (stateflag != ENABLED)
+ if ((stateflag != SELECTED) && (stateflag != ENABLED)
&& (stateMask & ENABLED) == 0)
return;
@@ -320,35 +335,38 @@ public class DefaultButtonModel implements ButtonModel, Serializable
fireStateChanged();
- if ((oldstate & SELECTED) == 0
- && (newstate & SELECTED) == SELECTED)
- fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
- null, ItemEvent.SELECTED));
+ if ((oldstate & SELECTED) == 0 && (newstate & SELECTED) == SELECTED)
+ {
+ fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+ null, ItemEvent.SELECTED));
+ if (group != null)
+ group.setSelected(this, true);
+ }
- else if ((oldstate & SELECTED) == SELECTED
- && (newstate & SELECTED) == 0)
- fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
- null, ItemEvent.DESELECTED));
-
- else if (((oldstate & ARMED) == ARMED && (oldstate & PRESSED) == PRESSED)
- &&
- ((newstate & ARMED) == ARMED && (newstate & PRESSED) == 0))
+ else if ((oldstate & SELECTED) == SELECTED && (newstate & SELECTED) == 0)
{
- fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
- actionCommand));
+ fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+ null, ItemEvent.DESELECTED));
+ if (group != null)
+ group.setSelected(this, false);
}
- }
-
+
+ else if (((oldstate & ARMED) == ARMED && (oldstate & PRESSED) == PRESSED)
+ && ((newstate & ARMED) == ARMED && (newstate & PRESSED) == 0))
+ fireActionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED,
+ actionCommand));
+ }
+
/**
* Get the value of the model's "armed" property.
- *
- * @return The current "armed" property
+ *
+ * @return The current "armed" property
*/
public boolean isArmed()
{
return (stateMask & ARMED) == ARMED;
}
-
+
/**
* Set the value of the model's "armed" property.
*
@@ -365,9 +383,9 @@ public class DefaultButtonModel implements ButtonModel, Serializable
* @return The current "enabled" property.
*/
public boolean isEnabled()
- {
+ {
return (stateMask & ENABLED) == ENABLED;
- }
+ }
/**
* Set the value of the model's "enabled" property.
@@ -385,9 +403,9 @@ public class DefaultButtonModel implements ButtonModel, Serializable
* @param p The new "pressed" property
*/
public void setPressed(boolean p)
- {
+ {
changeState(PRESSED, p);
- }
+ }
/**
* Get the value of the model's "pressed" property.
@@ -409,7 +427,6 @@ public class DefaultButtonModel implements ButtonModel, Serializable
changeState(ROLLOVER, r);
}
-
/**
* Set the value of the model's "selected" property.
*
@@ -436,9 +453,9 @@ public class DefaultButtonModel implements ButtonModel, Serializable
* @return The current "rollover" property
*/
public boolean isRollover()
- {
+ {
return (stateMask & ROLLOVER) == ROLLOVER;
- }
+ }
/**
* Get the value of the model's "mnemonic" property.
@@ -446,7 +463,7 @@ public class DefaultButtonModel implements ButtonModel, Serializable
* @return The current "mnemonic" property
*/
public int getMnemonic()
- {
+ {
return mnemonic;
}
@@ -459,15 +476,15 @@ public class DefaultButtonModel implements ButtonModel, Serializable
{
if (mnemonic != key)
{
- mnemonic = key;
- fireStateChanged();
+ mnemonic = key;
+ fireStateChanged();
}
}
-
+
/**
- * Set the value of the model's "actionCommand" property. This property
- * is used as the "command" property of the {@link ActionEvent} fired
- * from the model.
+ * Set the value of the model's "actionCommand" property. This property is
+ * used as the "command" property of the {@link ActionEvent} fired from the
+ * model.
*
* @param s The new "actionCommand" property.
*/
@@ -475,11 +492,11 @@ public class DefaultButtonModel implements ButtonModel, Serializable
{
if (actionCommand != s)
{
- actionCommand = s;
- fireStateChanged();
+ actionCommand = s;
+ fireStateChanged();
}
- }
-
+ }
+
/**
* Returns the current value of the model's "actionCommand" property.
*
@@ -491,9 +508,9 @@ public class DefaultButtonModel implements ButtonModel, Serializable
}
/**
- * Set the value of the model's "group" property. The model is said to be
- * a member of the {@link ButtonGroup} held in its "group" property, and
- * only one model in a given group can have their "selected" property be
+ * Set the value of the model's "group" property. The model is said to be a
+ * member of the {@link ButtonGroup} held in its "group" property, and only
+ * one model in a given group can have their "selected" property be
* <code>true</code> at a time.
*
* @param g The new "group" property
@@ -502,8 +519,8 @@ public class DefaultButtonModel implements ButtonModel, Serializable
{
if (group != g)
{
- group = g;
- fireStateChanged();
+ group = g;
+ fireStateChanged();
}
}
diff --git a/javax/swing/DefaultComboBoxModel.java b/javax/swing/DefaultComboBoxModel.java
index 55faf8fdf..a5546f295 100644
--- a/javax/swing/DefaultComboBoxModel.java
+++ b/javax/swing/DefaultComboBoxModel.java
@@ -38,146 +38,191 @@ exception statement from your version. */
package javax.swing;
import java.io.Serializable;
+import java.util.Arrays;
import java.util.Vector;
+
/**
- * DefaultComboBoxModel
- * @author Andrew Selkirk
- * @version 1.0
+ * DefaultComboBoxModel is a data model for JComboBox. This model keeps track
+ * of elements contained in the JComboBox as well as the current combo box
+ * selection. Whenever selection in the JComboBox changes, the ComboBoxModel
+ * will fire ListDataEvents to ComboBox's ListDataListeners.
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
+ * @version 1.0
*/
-public class DefaultComboBoxModel extends AbstractListModel
- implements MutableComboBoxModel, Serializable
+public class DefaultComboBoxModel extends AbstractListModel
+ implements MutableComboBoxModel, Serializable
{
static final long serialVersionUID = 6698657703676921904L;
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * list
- */
- private Vector list;
-
- /**
- * selectedItem
- */
- private Object selectedItem;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultComboBoxModel
- */
- public DefaultComboBoxModel() {
- // TODO
- } // DefaultComboBoxModel()
-
- /**
- * Constructor DefaultComboBoxModel
- * @param items TODO
- */
- public DefaultComboBoxModel(Object[] items) {
- // TODO
- } // DefaultComboBoxModel()
-
- /**
- * Constructor DefaultComboBoxModel
- * @param vector TODO
- */
- public DefaultComboBoxModel(Vector vector) {
- // TODO
- } // DefaultComboBoxModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * addElement
- * @param object TODO
- */
- public void addElement(Object object) {
- // TODO
- } // addElement()
-
- /**
- * removeElementAt
- * @param index TODO
- */
- public void removeElementAt(int index) {
- // TODO
- } // removeElementAt()
-
- /**
- * insertElementAt
- * @param object TODO
- * @param index TODO
- */
- public void insertElementAt(Object object, int index) {
- // TODO
- } // insertElementAt()
-
- /**
- * removeElement
- * @param object TODO
- */
- public void removeElement(Object object) {
- // TODO
- } // removeElement()
-
- /**
- * removeAllElements
- */
- public void removeAllElements() {
- // TODO
- } // removeAllElements()
-
- /**
- * getSize
- * @returns int
- */
- public int getSize() {
- return 0; // TODO
- } // getSize()
-
- /**
- * setSelectedItem
- * @param object TODO
- */
- public void setSelectedItem(Object object) {
- // TODO
- } // setSelectedItem()
-
- /**
- * getSelectedItem
- * @returns Object
- */
- public Object getSelectedItem() {
- return null; // TODO
- } // getSelectedItem()
-
- /**
- * getElementAt
- * @param index TODO
- * @returns Object
- */
- public Object getElementAt(int index) {
- return null; // TODO
- } // getElementAt()
-
- /**
- * getIndexOf
- * @param object TODO
- * @returns int
- */
- public int getIndexOf(Object object) {
- return 0; // TODO
- } // getIndexOf()
-
-
-} // DefaultComboBoxModel
+ /**
+ * List containing items in the combo box
+ */
+ private Vector list;
+
+ /**
+ * Currently selected item in the combo box list
+ */
+ private Object selectedItem = null;
+
+ /**
+ * Constructor DefaultComboBoxModel. Create empty JComboBox.
+ */
+ public DefaultComboBoxModel()
+ {
+ list = new Vector();
+ }
+
+ /**
+ * Constructs new DefaultComboBoxModel object and initializes its item list
+ * to values in the given array.
+ *
+ * @param items array containing items of the combo box.
+ */
+ public DefaultComboBoxModel(Object[] items)
+ {
+ list = new Vector(Arrays.asList(items));
+ }
+
+ /**
+ * Consturcts new DefaultComboBoxModel object and initializes its item list
+ * to values in the given vector.
+ *
+ * @param vector Vector containing items for this combo box.
+ */
+ public DefaultComboBoxModel(Vector vector)
+ {
+ this.list = vector;
+ }
+
+ /**
+ * This method adds element to the combo box list. It fires ListDataEvent
+ * indicating that component was added to the combo box to all of the
+ * JComboBox's registered ListDataListeners.
+ *
+ * @param object item to add to the combo box list
+ */
+ public void addElement(Object object)
+ {
+ list.add(object);
+ fireIntervalAdded(this, list.size(), list.size());
+ }
+
+ /**
+ * This method removes element at the specified index from the combo box
+ * list. It fires ListDataEvent indicating that component was removed from
+ * the combo box list to all of the JComboBox's registered
+ * ListDataListeners.
+ *
+ * @param index index specifying location of the element to remove in the
+ * combo box list.
+ */
+ public void removeElementAt(int index)
+ {
+ list.remove(index);
+ fireIntervalRemoved(this, index, index);
+ }
+
+ /**
+ * This method inserts given object to the combo box list at the specified
+ * index. It fires ListDataEvent indicating that component was inserted to
+ * the combo box list to all of the JComboBox's registered
+ * ListDataListeners.
+ *
+ * @param object element to insert
+ * @param index index specifing position in the list where given element
+ * should be inserted.
+ */
+ public void insertElementAt(Object object, int index)
+ {
+ list.insertElementAt(object, index);
+ fireIntervalAdded(this, index, index);
+ }
+
+ /**
+ * Removes given object from the combo box list. It fires ListDataEvent
+ * indicating that component was removed from the combo box list to all of
+ * the JComboBox's registered ListDataListeners.
+ *
+ * @param object Element that will be removed from the combo box list
+ */
+ public void removeElement(Object object)
+ {
+ int index = getIndexOf(object);
+ if (index != -1)
+ removeElementAt(index);
+ }
+
+ /**
+ * Removes all the items from the JComboBox's item list. It fires
+ * ListDataEvent indicating that all the elements were removed from the
+ * combo box list to all of the JComboBox's registered ListDataListeners.
+ */
+ public void removeAllElements()
+ {
+ int listSize = getSize();
+ list.clear();
+ fireIntervalAdded(this, 0, listSize - 1);
+ }
+
+ /**
+ * Returns number of items in the combo box list
+ *
+ * @return number of items in the combo box list
+ */
+ public int getSize()
+ {
+ return list.size();
+ }
+
+ /**
+ * Selects given object in the combo box list. This method fires
+ * ListDataEvent to all registered ListDataListeners of the JComboBox. The
+ * start and end index of the event is set to -1 to indicate combo box's
+ * selection has changed, and not its contents.
+ *
+ * @param object item to select in the JComboBox
+ */
+ public void setSelectedItem(Object object)
+ {
+ selectedItem = object;
+ fireContentsChanged(this, -1, -1);
+ }
+
+ /**
+ * Returns currently selected item in the combo box list
+ *
+ * @return currently selected item in the combo box list
+ */
+ public Object getSelectedItem()
+ {
+ return selectedItem;
+ }
+
+ /**
+ * Returns element in the combo box list located at the given index
+ *
+ * @param index specifying location of the element in the list
+ *
+ * @return return element in the combo box list located at the given index
+ */
+ public Object getElementAt(int index)
+ {
+ return list.elementAt(index);
+ }
+
+ /**
+ * Returns index of the specified object in the combo box list.
+ *
+ * @param object element to look for in the combo box list .
+ *
+ * @return Index specifying position of the specified element in combo box
+ * list.
+ */
+ public int getIndexOf(Object object)
+ {
+ return list.indexOf(object);
+ }
+}
diff --git a/javax/swing/DefaultListCellRenderer.java b/javax/swing/DefaultListCellRenderer.java
index cfb1f409d..fe4b3d070 100644
--- a/javax/swing/DefaultListCellRenderer.java
+++ b/javax/swing/DefaultListCellRenderer.java
@@ -41,16 +41,18 @@ import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serializable;
import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
/**
- * DefaultListCellRenderer
+ * DefaultListCellRenderer. This class is responsible for rendering list
+ * cells.
*
* @author Andrew Selkirk
* @version 1.0
*/
-public class DefaultListCellRenderer
- extends JLabel implements ListCellRenderer, Serializable
+public class DefaultListCellRenderer extends JLabel implements ListCellRenderer,
+ Serializable
{
static final long serialVersionUID = 7708947179685189462L;
@@ -62,19 +64,22 @@ public class DefaultListCellRenderer
}
}
- /** noFocusBorder */
- protected static Border noFocusBorder = null; // TODO
+ /**
+ * This border is used whenever renderer doesn't have a focus.
+ */
+ protected static Border noFocusBorder = new EmptyBorder(1, 1, 1, 1);
/**
* getListCellRendererComponent
*
- * @param list TODO
- * @param value TODO
- * @param index TODO
- * @param isSelected TODO
- * @param cellHasFocus TODO
+ * @param list JList list for the 'value'
+ * @param value object that should be rendered in the cell
+ * @param index index of the cell
+ * @param isSelected draw cell highlighted if isSelected is true
+ * @param cellHasFocus draw focus rectangle around cell if the cell has
+ * focus
*
- * @return Component
+ * @return Component that will be painted to the desired cell.
*/
public Component getListCellRendererComponent(JList list, Object value,
int index, boolean isSelected,
@@ -86,31 +91,87 @@ public class DefaultListCellRenderer
if (isSelected)
{
- setBackground(list.getSelectionBackground());
- setForeground(list.getSelectionForeground());
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
}
else
{
- setBackground(list.getBackground());
- setForeground(list.getForeground());
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
}
setEnabled(list.isEnabled());
setFont(list.getFont());
+
+ // Use focusCellHighlightBorder when renderer has focus and
+ // noFocusBorder otherwise
+
+ if (cellHasFocus)
+ setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
+ else
+ setBorder(noFocusBorder);
+
return this;
}
- public void validate() {}
- public void revalidate() {}
- public void repaint(long tm, int x, int y, int w, int h) {}
- public void repaint(Rectangle rect) {}
- protected void firePropertyChange(String propertyName, Object oldValue, Object newValue){}
- public void firePropertyChange(String propertyName, byte oldValue, byte newValue) {}
- public void firePropertyChange(String propertyName, char oldValue, char newValue) {}
- public void firePropertyChange(String propertyName, short oldValue, short newValue) {}
- public void firePropertyChange(String propertyName, int oldValue, int newValue) {}
- public void firePropertyChange(String propertyName, long oldValue, long newValue) {}
- public void firePropertyChange(String propertyName, float oldValue, float newValue) {}
- public void firePropertyChange(String propertyName, double oldValue, double newValue) {}
- public void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {}
+ public void validate()
+ {
+ }
+
+ public void revalidate()
+ {
+ }
+
+ public void repaint(long tm, int x, int y, int w, int h)
+ {
+ }
+
+ public void repaint(Rectangle rect)
+ {
+ }
+
+ protected void firePropertyChange(String propertyName, Object oldValue,
+ Object newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, byte oldValue,
+ byte newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, char oldValue,
+ char newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, short oldValue,
+ short newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, int oldValue,
+ int newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, long oldValue,
+ long newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, float oldValue,
+ float newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, double oldValue,
+ double newValue)
+ {
+ }
+
+ public void firePropertyChange(String propertyName, boolean oldValue,
+ boolean newValue)
+ {
+ }
}
diff --git a/javax/swing/DefaultListSelectionModel.java b/javax/swing/DefaultListSelectionModel.java
index 67ad1df41..4b8ddc355 100644
--- a/javax/swing/DefaultListSelectionModel.java
+++ b/javax/swing/DefaultListSelectionModel.java
@@ -264,7 +264,7 @@ public class DefaultListSelectionModel implements Cloneable,
{
end = i;
}
- fireSelectionValueChanged(beg, end, valueIsAdjusting);
+ fireValueChanged(beg, end, valueIsAdjusting);
}
/**
@@ -409,7 +409,7 @@ public class DefaultListSelectionModel implements Cloneable,
int hi = Math.max(index0, index1);
sel.set(lo, hi+1);
- fireSelectionValueChanged(lo, hi, valueIsAdjusting);
+ fireValueChanged(lo, hi, valueIsAdjusting);
}
@@ -429,7 +429,7 @@ public class DefaultListSelectionModel implements Cloneable,
int lo = Math.min(index0, index1);
int hi = Math.max(index0, index1);
sel.clear(lo, hi+1);
- fireSelectionValueChanged(lo, hi, valueIsAdjusting);
+ fireValueChanged(lo, hi, valueIsAdjusting);
}
/**
@@ -439,7 +439,7 @@ public class DefaultListSelectionModel implements Cloneable,
{
int sz = sel.size();
sel.clear();
- fireSelectionValueChanged(0, sz, valueIsAdjusting);
+ fireValueChanged(0, sz, valueIsAdjusting);
}
/**
@@ -460,7 +460,7 @@ public class DefaultListSelectionModel implements Cloneable,
int lo = Math.min(index0, index1);
int hi = Math.max(index0, index1);
sel.set(lo, hi+1);
- fireSelectionValueChanged(lo, hi, valueIsAdjusting);
+ fireValueChanged(lo, hi, valueIsAdjusting);
}
/**
@@ -522,8 +522,8 @@ public class DefaultListSelectionModel implements Cloneable,
* @param isAdjusting Whether this change is part of a seqence of adjustments
* made to the selection, such as during interactive scrolling
*/
- public void fireSelectionValueChanged(int firstIndex, int lastIndex,
- boolean isAdjusting)
+ protected void fireValueChanged(int firstIndex, int lastIndex,
+ boolean isAdjusting)
{
ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex,
lastIndex, isAdjusting);
diff --git a/javax/swing/InputMap.java b/javax/swing/InputMap.java
index 4655aa1c4..afabca40b 100644
--- a/javax/swing/InputMap.java
+++ b/javax/swing/InputMap.java
@@ -89,7 +89,7 @@ public class InputMap
{
Object result = inputMap.get(keystroke);
- if (result == null)
+ if (result == null && parent != null)
result = parent.get(keystroke);
return result;
}
diff --git a/javax/swing/InputVerifier.java b/javax/swing/InputVerifier.java
index a125fe435..ccd13d285 100644
--- a/javax/swing/InputVerifier.java
+++ b/javax/swing/InputVerifier.java
@@ -1,5 +1,5 @@
/* InputVerifier.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,43 +37,39 @@ exception statement from your version. */
package javax.swing;
+
/**
* InputVerifier
- * @author Andrew Selkirk
- * @version 1.0
+ * @author Andrew Selkirk
+ * @version 1.0
*/
-public abstract class InputVerifier {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor InputVerifier
- */
- public InputVerifier() {
- } // InputVerifier()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * verify
- * @param component TODO
- * @returns boolean
- */
- public abstract boolean verify(JComponent component);
-
- /**
- * shouldYieldFocus
- * @param component TODO
- * @returns boolean
- */
- public boolean shouldYieldFocus(JComponent component) {
- return verify(component);
- } // shouldYieldFocus()
-
-
-} // InputVerifier
+public abstract class InputVerifier
+{
+ /**
+ * Creates a <code>InputVerifier</code>
+ */
+ public InputVerifier()
+ {
+ }
+
+ /**
+ * verify
+ *
+ * @param component the component to verify
+ *
+ * @return <code>true</code> if valid, <code>false</code> otherwise.
+ */
+ public abstract boolean verify(JComponent component);
+
+ /**
+ * shouldYieldFocus
+ *
+ * @param component the component to verify
+ *
+ * @return <code>true</code> if valid, <code>false</code> otherwise.
+ */
+ public boolean shouldYieldFocus(JComponent component)
+ {
+ return verify(component);
+ }
+}
diff --git a/javax/swing/JApplet.java b/javax/swing/JApplet.java
index f1c3e354f..3b6cb38cf 100644
--- a/javax/swing/JApplet.java
+++ b/javax/swing/JApplet.java
@@ -1,4 +1,4 @@
-/* JApplet.java --
+/* JApplet.java --
Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
import java.applet.Applet;
@@ -49,167 +48,198 @@ import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import javax.accessibility.AccessibleContext;
-public class JApplet extends Applet implements RootPaneContainer
+
+public class JApplet extends Applet
+ implements RootPaneContainer
{
private static final long serialVersionUID = 7269359214497372587L;
+
+ public static final int HIDE_ON_CLOSE = 0;
+ public static final int EXIT_ON_CLOSE = 1;
+ public static final int DISPOSE_ON_CLOSE = 2;
+ public static final int DO_NOTHING_ON_CLOSE = 3;
+
+ private int close_action = EXIT_ON_CLOSE;
- public final static int HIDE_ON_CLOSE = 0;
- public final static int EXIT_ON_CLOSE = 1;
- public final static int DISPOSE_ON_CLOSE = 2;
- public final static int DO_NOTHING_ON_CLOSE = 3;
+ protected JRootPane rootPane;
+ protected boolean rootPaneCheckingEnabled;
- private int close_action = EXIT_ON_CLOSE;
- private boolean checking;
- protected JRootPane rootPane;
+ public JApplet()
+ {
+ frameInit();
+ }
- public JApplet()
- {
- frameInit();
- }
-
- public JApplet(String title)
- {
- frameInit();
- }
+ public JApplet(String title)
+ {
+ frameInit();
+ }
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- getRootPane(); // will do set/create
- }
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ getRootPane(); // will do set/create
+ }
public Dimension getPreferredSize()
{
Dimension d = super.getPreferredSize();
- System.out.println("JFrame.getPrefSize(): " + d + " , comp="+ getComponentCount () + ", layout=" + getLayout());
+ System.out.println("JFrame.getPrefSize(): " + d + " , comp="
+ + getComponentCount() + ", layout=" + getLayout());
return d;
}
- public void setLayout(LayoutManager manager)
- { super.setLayout(manager); }
+ public void setLayout(LayoutManager manager)
+ {
+ super.setLayout(manager);
+ }
- public void setLayeredPane(JLayeredPane layeredPane)
- { getRootPane().setLayeredPane(layeredPane); }
-
- public JLayeredPane getLayeredPane()
- { return getRootPane().getLayeredPane(); }
-
- public JRootPane getRootPane()
- {
- if (rootPane == null)
- setRootPane(createRootPane());
- return rootPane;
- }
-
- public void setRootPane(JRootPane root)
- {
- if (rootPane != null)
- remove(rootPane);
-
- rootPane = root;
- add(rootPane, BorderLayout.CENTER);
- }
-
- public JRootPane createRootPane()
- { return new JRootPane(); }
-
- public Container getContentPane()
- { return getRootPane().getContentPane(); }
-
- public void setContentPane(Container contentPane)
- { getRootPane().setContentPane(contentPane); }
-
- public Component getGlassPane()
- { return getRootPane().getGlassPane(); }
-
- public void setGlassPane(Component glassPane)
- { getRootPane().setGlassPane(glassPane); }
+ public void setLayeredPane(JLayeredPane layeredPane)
+ {
+ getRootPane().setLayeredPane(layeredPane);
+ }
+ public JLayeredPane getLayeredPane()
+ {
+ return getRootPane().getLayeredPane();
+ }
- /////////////////////////////////////////////////////////////////////////////////
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
-
- public AccessibleContext getAccessibleContext()
- { return null; }
-
- int getDefaultCloseOperation()
- { return close_action; }
-
-
- public JMenuBar getJMenuBar()
- { return getRootPane().getJMenuBar(); }
-
- public void setJMenuBar(JMenuBar menubar)
- { getRootPane().setJMenuBar(menubar); }
-
-
- protected String paramString()
- { return "JFrame"; }
-
- protected void processKeyEvent(KeyEvent e)
- { super.processKeyEvent(e); }
-
- protected void processWindowEvent(WindowEvent e)
- {
- // System.out.println("PROCESS_WIN_EV-1: " + e);
-
- // super.processWindowEvent(e);
-
- // System.out.println("PROCESS_WIN_EV-2: " + e);
- switch (e.getID())
- {
- case WindowEvent.WINDOW_CLOSING:
- {
- switch(close_action)
- {
- case EXIT_ON_CLOSE:
- {
- System.out.println("user requested exit on close");
- System.exit(1);
- break;
- }
- case DISPOSE_ON_CLOSE:
- {
- System.out.println("user requested dispose on close");
- //dispose();
- break;
- }
- case HIDE_ON_CLOSE:
-
- case DO_NOTHING_ON_CLOSE:
- break;
- }
- break;
- }
-
- case WindowEvent.WINDOW_CLOSED:
- case WindowEvent.WINDOW_OPENED:
- case WindowEvent.WINDOW_ICONIFIED:
- case WindowEvent.WINDOW_DEICONIFIED:
- case WindowEvent.WINDOW_ACTIVATED:
- case WindowEvent.WINDOW_DEACTIVATED:
- break;
- }
- }
-
-
- public void remove(Component comp)
- { getContentPane().remove(comp); }
-
+ public JRootPane getRootPane()
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
- void setDefaultCloseOperation(int operation)
- { close_action = operation; }
+ public void setRootPane(JRootPane root)
+ {
+ if (rootPane != null)
+ remove(rootPane);
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
+ public JRootPane createRootPane()
+ {
+ return new JRootPane();
+ }
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ public Container getContentPane()
+ {
+ return getRootPane().getContentPane();
+ }
+ public void setContentPane(Container contentPane)
+ {
+ getRootPane().setContentPane(contentPane);
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ public Component getGlassPane()
+ {
+ return getRootPane().getGlassPane();
+ }
+
+ public void setGlassPane(Component glassPane)
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
- public void update(Graphics g)
- { paint(g); }
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ return null;
+ }
+
+ int getDefaultCloseOperation()
+ {
+ return close_action;
+ }
+
+ public JMenuBar getJMenuBar()
+ {
+ return getRootPane().getJMenuBar();
+ }
+
+ public void setJMenuBar(JMenuBar menubar)
+ {
+ getRootPane().setJMenuBar(menubar);
+ }
+
+ protected String paramString()
+ {
+ return "JFrame";
+ }
+
+ protected void processKeyEvent(KeyEvent e)
+ {
+ super.processKeyEvent(e);
+ }
+
+ protected void processWindowEvent(WindowEvent e)
+ {
+ // System.out.println("PROCESS_WIN_EV-1: " + e);
+ // super.processWindowEvent(e);
+ // System.out.println("PROCESS_WIN_EV-2: " + e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch (close_action)
+ {
+ case EXIT_ON_CLOSE:
+ {
+ System.out.println("user requested exit on close");
+ System.exit(1);
+ break;
+ }
+ case DISPOSE_ON_CLOSE:
+ {
+ System.out.println("user requested dispose on close");
+ //dispose();
+ break;
+ }
+ case HIDE_ON_CLOSE:
+ case DO_NOTHING_ON_CLOSE:
+ break;
+ }
+ break;
+ }
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_ACTIVATED:
+ case WindowEvent.WINDOW_DEACTIVATED:
+ break;
+ }
+ }
+
+ public void remove(Component comp)
+ {
+ getContentPane().remove(comp);
+ }
+
+ void setDefaultCloseOperation(int operation)
+ {
+ close_action = operation;
+ }
+
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return rootPaneCheckingEnabled;
+ }
+
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ rootPaneCheckingEnabled = enabled;
+ }
+
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
}
diff --git a/javax/swing/JCheckBox.java b/javax/swing/JCheckBox.java
index 7c48ffac0..a8506e5f8 100644
--- a/javax/swing/JCheckBox.java
+++ b/javax/swing/JCheckBox.java
@@ -49,6 +49,9 @@ public class JCheckBox extends JToggleButton
{
private static final long serialVersionUID = -5246739313864538930L;
+ public static final String BORDER_PAINTED_FLAT_CHANGED_PROPERTY =
+ "borderPaintedFlat";
+
private boolean borderPaintedFlat;
private void init()
diff --git a/javax/swing/JColorChooser.java b/javax/swing/JColorChooser.java
index 70dde6a19..6ba70ce99 100644
--- a/javax/swing/JColorChooser.java
+++ b/javax/swing/JColorChooser.java
@@ -35,11 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
+import java.awt.AWTError;
+import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
+import java.awt.Dialog;
+import java.awt.FlowLayout;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
import java.io.ObjectOutputStream;
@@ -47,314 +52,521 @@ import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.swing.colorchooser.AbstractColorChooserPanel;
+import javax.swing.colorchooser.ColorChooserComponentFactory;
import javax.swing.colorchooser.ColorSelectionModel;
+import javax.swing.colorchooser.DefaultColorSelectionModel;
import javax.swing.plaf.ColorChooserUI;
+
/**
- * JColorChooser
- * @author Andrew Selkirk
- * @version 1.0
+ * The JColorChooser is a Swing widget that offers users different ways to
+ * select a color. By default, three different panels are presented to the
+ * user that are capable of changing the selected color. There are three ways
+ * to utilize JColorChooser. The first is to build a JColorChooser and add it
+ * to the content pane. The second is to use the createDialog method to
+ * create a JDialog that holds a JColorChooser. The third is to show a
+ * JColorChooser in a JDialog directly using the showDialog method.
*/
-public class JColorChooser extends JComponent implements Accessible {
-
+public class JColorChooser extends JComponent implements Accessible
+{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = 9168066781620640889L;
-
- //-------------------------------------------------------------
- // Classes ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * AccessibleJColorChooser
- */
- protected class AccessibleJColorChooser extends JComponent.AccessibleJComponent {
-
- private static final long serialVersionUID = -2038297864782299082L;
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor AccessibleJColorChooser
- * @param component TODO
- */
- protected AccessibleJColorChooser()
+
+ /**
+ * AccessibleJColorChooser
+ */
+ protected class AccessibleJColorChooser
+ extends JComponent.AccessibleJComponent
+ {
+ /** DOCUMENT ME! */
+ private static final long serialVersionUID = -2038297864782299082L;
+
+ /**
+ * Constructor AccessibleJColorChooser
+ */
+ protected AccessibleJColorChooser()
+ {
+ }
+
+ /**
+ * getAccessibleRole
+ *
+ * @return AccessibleRole
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.COLOR_CHOOSER;
+ } // getAccessibleRole()
+ } // AccessibleJColorChooser
+
+ /** The model used with the JColorChooser. */
+ private ColorSelectionModel selectionModel;
+
+ /** The preview panel associated with the JColorChooser. */
+ private JComponent previewPanel;
+
+ /**
+ * The set of AbstractColorChooserPanels associated with the JColorChooser.
+ */
+ private AbstractColorChooserPanel[] chooserPanels;
+
+ /** A Drag and Drop property. */
+ private boolean dragEnabled;
+
+ /**
+ * The property fired by the JColorChooser when the selectionModel property
+ * changes.
+ */
+ public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+
+ /**
+ * The property fired by the JColorChooser when the previewPanel property
+ * changes.
+ */
+ public static final String PREVIEW_PANEL_PROPERTY = "previewPanel";
+
+ /**
+ * The property fired by the JColorChooser when the chooserPanels property
+ * changes.
+ */
+ public static final String CHOOSER_PANELS_PROPERTY = "chooserPanels";
+
+ /** accessibleContext */
+ protected AccessibleContext accessibleContext;
+
+ /**
+ * This method creates a new JColorChooser with the default initial color.
+ */
+ public JColorChooser()
+ {
+ this(new DefaultColorSelectionModel());
+ } // JColorChooser()
+
+ /**
+ * This method creates a new JColorChooser with the given initial color.
+ *
+ * @param initial The initial color.
+ */
+ public JColorChooser(Color initial)
+ {
+ this(new DefaultColorSelectionModel(initial));
+ } // JColorChooser()
+
+ /**
+ * This method creates a new JColorChooser with the given model. The model
+ * will dictate what the initial color for the JColorChooser is.
+ *
+ * @param model The Model to use with the JColorChooser.
+ */
+ public JColorChooser(ColorSelectionModel model)
+ {
+ if (model == null)
+ model = new DefaultColorSelectionModel();
+ selectionModel = model;
+ updateUI();
+ } // JColorChooser()
+
+ /**
+ * This method sets the current color for the JColorChooser.
+ *
+ * @param color The new color for the JColorChooser.
+ */
+ public void setColor(Color color)
+ {
+ if (color != null)
+ selectionModel.setSelectedColor(color);
+ } // setColor()
+
+ /**
+ * This method sets the current color for the JColorChooser using RGB
+ * values.
+ *
+ * @param r The red value.
+ * @param g The green value.
+ * @param b The blue value.
+ */
+ public void setColor(int r, int g, int b)
+ {
+ selectionModel.setSelectedColor(new Color(r, g, b));
+ } // setColor()
+
+ /**
+ * This method sets the current color for the JColorChooser using the
+ * integer value. Bits 0-7 represent the blue value. Bits 8-15 represent
+ * the green value. Bits 16-23 represent the red value.
+ *
+ * @param color The new current color of the JColorChooser.
+ */
+ public void setColor(int color)
+ {
+ setColor(new Color(color, false));
+ } // setColor()
+
+ /**
+ * This method shows a JColorChooser inside a JDialog. The JDialog will
+ * block until it is hidden. The JDialog comes with three buttons: OK,
+ * Cancel, and Reset. Pressing OK or Cancel hide the JDialog. Pressing
+ * Reset will reset the JColorChooser to its initial value.
+ *
+ * @param component The Component that parents the JDialog.
+ * @param title The title displayed in the JDialog.
+ * @param initial The initial color.
+ *
+ * @return The selected color.
+ */
+ public static Color showDialog(Component component, String title,
+ Color initial)
+ {
+ JColorChooser choose = new JColorChooser(initial);
+
+ JDialog dialog = createDialog(component, title, true, choose, null, null);
+
+ dialog.getContentPane().add(choose);
+ dialog.pack();
+ dialog.show();
+
+ return choose.getColor();
+ } // showDialog()
+
+ /**
+ * This is a helper method to make the given JDialog block until it is
+ * hidden.
+ *
+ * @param dialog The JDialog to block.
+ */
+ private static void makeModal(JDialog dialog)
+ {
+ try
+ {
+ synchronized (dialog)
{
+ while (dialog.isVisible())
+ dialog.wait();
}
+ }
+ catch (InterruptedException e)
+ {
+ }
+ }
+
+ /**
+ * This is a helper method to find the first Frame or Dialog ancestor of the
+ * given Component.
+ *
+ * @param c The Component to find ancestors for.
+ *
+ * @return A Frame or Dialog ancestor. Null if none are found.
+ */
+ private static Component findParent(Component c)
+ {
+ Component parent = SwingUtilities.getAncestorOfClass(Frame.class, c);
+ if (parent != null)
+ return parent;
+ parent = SwingUtilities.getAncestorOfClass(Dialog.class, c);
+ return parent;
+ }
+
+ /**
+ * This method will take the given JColorChooser and place it in a JDialog
+ * with the given modal property. Three buttons are displayed in the
+ * JDialog: OK, Cancel and Reset. If OK or Cancel are pressed, the JDialog
+ * is hidden. If Reset is pressed, then the JColorChooser will take on its
+ * default color value. The given okListener will be registered to the OK
+ * button and the cancelListener will be registered to the Cancel button.
+ * If the modal property is set, then the JDialog will block until it is
+ * hidden.
+ *
+ * @param component The Component that will parent the JDialog.
+ * @param title The title displayed in the JDialog.
+ * @param modal The modal property.
+ * @param chooserPane The JColorChooser to place in the JDialog.
+ * @param okListener The ActionListener to register to the OK button.
+ * @param cancelListener The ActionListener to register to the Cancel
+ * button.
+ *
+ * @return A JDialog with the JColorChooser inside of it.
+ *
+ * @throws AWTError If the component is not a suitable parent.
+ */
+ public static JDialog createDialog(Component component, String title,
+ boolean modal, JColorChooser chooserPane,
+ ActionListener okListener,
+ ActionListener cancelListener)
+ {
+ Component parent = findParent(component);
+ if (parent == null)
+ throw new AWTError("No suitable parent found for Component.");
+ JDialog dialog;
+ if (parent instanceof Frame)
+ dialog = new ModalDialog((Frame) parent, title);
+ else
+ dialog = new ModalDialog((Dialog) parent, title);
+ dialog.setModal(modal);
+
+ dialog.getContentPane().setLayout(new BorderLayout());
+
+ JPanel panel = new JPanel();
+ panel.setLayout(new FlowLayout());
+
+ ActionListener al = new DefaultOKCancelListener(dialog);
+
+ JButton ok = new JButton("OK");
+ ok.addActionListener(okListener);
+ ok.addActionListener(al);
+
+ JButton cancel = new JButton("Cancel");
+ cancel.addActionListener(cancelListener);
+ cancel.addActionListener(al);
+
+ JButton reset = new JButton("Reset");
+ reset.addActionListener(new DefaultResetListener(chooserPane));
+
+ dialog.getContentPane().add(chooserPane, BorderLayout.NORTH);
+
+ panel.add(ok);
+ panel.add(cancel);
+ panel.add(reset);
+
+ dialog.getContentPane().add(panel, BorderLayout.SOUTH);
+
+ return dialog;
+ } // createDialog()
+
+ /**
+ * This method returns the UI Component used for this JColorChooser.
+ *
+ * @return The UI Component for this JColorChooser.
+ */
+ public ColorChooserUI getUI()
+ {
+ return (ColorChooserUI) ui;
+ } // getUI()
- /**
- * getAccessibleRole
- * @returns AccessibleRole
- */
- public AccessibleRole getAccessibleRole() {
- return AccessibleRole.COLOR_CHOOSER;
- } // getAccessibleRole()
-
-
- } // AccessibleJColorChooser
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * uiClassID
- */
- private static final String uiClassID = "ColorChooserUI";
-
- /**
- * selectionModel
- */
- private ColorSelectionModel selectionModel;
-
- /**
- * previewPanel
- */
- private JComponent previewPanel;
-
- /**
- * chooserPanels
- */
- private AbstractColorChooserPanel[] chooserPanels;
-
- /**
- * SELECTION_MODEL_PROPERTY
- */
- public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
-
- /**
- * PREVIEW_PANEL_PROPERTY
- */
- public static final String PREVIEW_PANEL_PROPERTY = "previewPanel";
-
- /**
- * CHOOSER_PANELS_PROPERTY
- */
- public static final String CHOOSER_PANELS_PROPERTY = "chooserPanels";
-
- /**
- * accessibleContext
- */
- protected AccessibleContext accessibleContext;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor JColorChooser
- */
- public JColorChooser() {
- // TODO
- } // JColorChooser()
-
- /**
- * Constructor JColorChooser
- * @param initial TODO
- */
- public JColorChooser(Color initial) {
- // TODO
- } // JColorChooser()
-
- /**
- * Constructor JColorChooser
- * @param model TODO
- */
- public JColorChooser(ColorSelectionModel model) {
- // TODO
- } // JColorChooser()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * writeObject
- * @param stream TODO
- * @exception IOException TODO
- */
- private void writeObject(ObjectOutputStream stream) throws IOException {
- // TODO
- } // writeObject()
-
- /**
- * setColor
- * @param color TODO
- */
- public void setColor(Color color) {
- // TODO
- } // setColor()
-
- /**
- * setColor
- * @param r TODO
- * @param g TODO
- * @param b TODO
- */
- public void setColor(int r, int g, int b) {
- // TODO
- } // setColor()
-
- /**
- * setColor
- * @param color TODO
- */
- public void setColor(int color) {
- // TODO
- } // setColor()
-
- /**
- * showDialog
- * @param component TODO
- * @param title TODO
- * @param initial TODO
- * @returns Color
- */
- public static Color showDialog(Component component, String title,
- Color initial) {
- return null; // TODO
- } // showDialog()
-
- /**
- * createDialog
- * @param component TODO
- * @param title TODO
- * @param modal TODO
- * @param chooserPane TODO
- * @param okListener TODO
- * @param cancelListener TODO
- * @returns JDialog
- */
- public static JDialog createDialog(Component component, String title,
- boolean modal, JColorChooser chooserPane,
- ActionListener okListener, ActionListener cancelListener) {
- return null; // TODO
- } // createDialog()
-
- /**
- * getUI
- * @returns ColorChooserUI
- */
- public ColorChooserUI getUI() {
- return (ColorChooserUI) ui;
- } // getUI()
-
- /**
- * setUI
- * @param ui TODO
- */
- public void setUI(ColorChooserUI ui) {
- super.setUI(ui);
- } // setUI()
-
- /**
- * updateUI
- */
- public void updateUI() {
- setUI((ColorChooserUI) UIManager.get(this));
- invalidate();
- } // updateUI()
-
- /**
- * getUIClassID
- * @returns String
- */
- public String getUIClassID() {
- return uiClassID;
- } // getUIClassID()
-
- /**
- * getColor
- * @returns Color
- */
- public Color getColor() {
- return null; // TODO
- } // getColor()
-
- /**
- * setPreviewPanel
- * @param component TODO
- */
- public void setPreviewPanel(JComponent component) {
- // TODO
- } // setPreviewPanel()
-
- /**
- * getPreviewPanel
- * @returns JComponent
- */
- public JComponent getPreviewPanel() {
- return null; // TODO
- } // getPreviewPanel()
-
- /**
- * addChooserPanel
- * @param panel TODO
- */
- public void addChooserPanel(AbstractColorChooserPanel panel) {
- // TODO
- } // addChooserPanel()
-
- /**
- * removeChooserPanel
- * @param panel TODO
- * @returns AbstractColorChooserPanel
- */
- public AbstractColorChooserPanel removeChooserPanel(
- AbstractColorChooserPanel panel) {
- return null; // TODO
- } // removeChooserPanel()
-
- /**
- * setChooserPanels
- * @param panels TODO
- */
- public void setChooserPanels(AbstractColorChooserPanel[] panels) {
- // TODO
- } // setChooserPanels()
-
- /**
- * getChooserPanels
- * @returns AbstractColorChooserPanel[]
- */
- public AbstractColorChooserPanel[] getChooserPanels() {
- return null; // TODO
- } // getChooserPanels()
-
- /**
- * getSelectionModel
- * @returns ColorSelectionModel
- */
- public ColorSelectionModel getSelectionModel() {
- return null; // TODO
- } // getSelectionModel()
-
- /**
- * setSelectionModel
- * @param model TODO
- */
- public void setSelectionModel(ColorSelectionModel model) {
- // TODO
- } // setSelectionModel()
-
- /**
- * paramString
- * @returns String
- */
- protected String paramString() {
- return null; // TODO
- } // paramString()
+ /**
+ * This method sets the UI Component used for this JColorChooser.
+ *
+ * @param ui The UI Component to use with this JColorChooser.
+ */
+ public void setUI(ColorChooserUI ui)
+ {
+ super.setUI(ui);
+ } // setUI()
+
+ /**
+ * This method resets the UI Component property to the Look and Feel
+ * default.
+ */
+ public void updateUI()
+ {
+ setUI((ColorChooserUI) UIManager.getUI(this));
+ revalidate();
+ } // updateUI()
+
+ /**
+ * This method returns a String identifier for the UI Class to be used with
+ * the JColorChooser.
+ *
+ * @return The String identifier for the UI Class.
+ */
+ public String getUIClassID()
+ {
+ return "ColorChooserUI";
+ } // getUIClassID()
+
+ /**
+ * This method returns the current color for the JColorChooser.
+ *
+ * @return The current color for the JColorChooser.
+ */
+ public Color getColor()
+ {
+ return selectionModel.getSelectedColor(); // TODO
+ } // getColor()
+
+ /**
+ * This method changes the previewPanel property for the JTabbedPane. The
+ * previewPanel is responsible for indicating the current color of the
+ * JColorChooser.
+ *
+ * @param component The Component that will act as the previewPanel.
+ */
+ public void setPreviewPanel(JComponent component)
+ {
+ if (component != previewPanel)
+ {
+ JComponent old = previewPanel;
+ previewPanel = component;
+ firePropertyChange(PREVIEW_PANEL_PROPERTY, old, previewPanel);
+ }
+ } // setPreviewPanel()
+
+ /**
+ * This method returns the current previewPanel used with this
+ * JColorChooser.
+ *
+ * @return The current previewPanel.
+ */
+ public JComponent getPreviewPanel()
+ {
+ return previewPanel; // TODO
+ } // getPreviewPanel()
+
+ /**
+ * This method adds the given AbstractColorChooserPanel to the list of the
+ * JColorChooser's chooserPanels.
+ *
+ * @param panel The AbstractColorChooserPanel to add.
+ */
+ public void addChooserPanel(AbstractColorChooserPanel panel)
+ {
+ if (panel == null)
+ return;
+ AbstractColorChooserPanel[] old = chooserPanels;
+ AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[(old == null)
+ ? 1
+ : old.length
+ + 1];
+ if (old != null)
+ System.arraycopy(old, 0, newPanels, 0, old.length);
+ newPanels[newPanels.length - 1] = panel;
+ chooserPanels = newPanels;
+ panel.installChooserPanel(this);
+ firePropertyChange(CHOOSER_PANELS_PROPERTY, old, newPanels);
+ } // addChooserPanel()
+
+ /**
+ * This method removes the given AbstractColorChooserPanel from the
+ * JColorChooser's list of chooserPanels.
+ *
+ * @param panel The AbstractColorChooserPanel to remove.
+ *
+ * @return The AbstractColorChooserPanel that was removed.
+ */
+ public AbstractColorChooserPanel removeChooserPanel(AbstractColorChooserPanel panel)
+ {
+ int index = -1;
+ for (int i = 0; i < chooserPanels.length; i++)
+ if (panel == chooserPanels[i])
+ {
+ index = i;
+ break;
+ }
+
+ if (index == -1)
+ return null;
+
+ AbstractColorChooserPanel[] old = chooserPanels;
+ if (chooserPanels.length == 1)
+ chooserPanels = null;
+ else
+ {
+ AbstractColorChooserPanel[] newPanels = new AbstractColorChooserPanel[chooserPanels.length
+ - 1];
+ System.arraycopy(chooserPanels, 0, newPanels, 0, index);
+ System.arraycopy(chooserPanels, index, newPanels, index - 1,
+ chooserPanels.length - index);
+ chooserPanels = newPanels;
+ }
+ panel.uninstallChooserPanel(this);
+ firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
+ return panel;
+ }
+
+ /**
+ * This method sets the chooserPanels property for this JColorChooser.
+ *
+ * @param panels The new set of AbstractColorChooserPanels to use.
+ */
+ public void setChooserPanels(AbstractColorChooserPanel[] panels)
+ {
+ if (panels != chooserPanels)
+ {
+ if (chooserPanels != null)
+ for (int i = 0; i < chooserPanels.length; i++)
+ if (chooserPanels[i] != null)
+ chooserPanels[i].uninstallChooserPanel(this);
+
+ AbstractColorChooserPanel[] old = chooserPanels;
+ chooserPanels = panels;
+
+ if (panels != null)
+ for (int i = 0; i < panels.length; i++)
+ if (panels[i] != null)
+ panels[i].installChooserPanel(this);
+
+ firePropertyChange(CHOOSER_PANELS_PROPERTY, old, chooserPanels);
+ }
+ } // setChooserPanels()
+
+ /**
+ * This method returns the AbstractColorChooserPanels used with this
+ * JColorChooser.
+ *
+ * @return The AbstractColorChooserPanels used with this JColorChooser.
+ */
+ public AbstractColorChooserPanel[] getChooserPanels()
+ {
+ return chooserPanels;
+ } // getChooserPanels()
+
+ /**
+ * This method returns the ColorSelectionModel used with this JColorChooser.
+ *
+ * @return The ColorSelectionModel.
+ */
+ public ColorSelectionModel getSelectionModel()
+ {
+ return selectionModel;
+ } // getSelectionModel()
+
+ /**
+ * This method sets the ColorSelectionModel to be used with this
+ * JColorChooser.
+ *
+ * @param model The ColorSelectionModel to be used with this JColorChooser.
+ *
+ * @throws AWTError If the given model is null.
+ */
+ public void setSelectionModel(ColorSelectionModel model)
+ {
+ if (model == null)
+ throw new AWTError("ColorSelectionModel is not allowed to be null.");
+ selectionModel = model;
+ } // setSelectionModel()
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public boolean getDragEnabled()
+ {
+ return dragEnabled;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param b DOCUMENT ME!
+ */
+ public void setDragEnabled(boolean b)
+ {
+ dragEnabled = b;
+ }
+
+ /**
+ * This method returns a String describing the JColorChooser.
+ *
+ * @return A String describing the JColorChooser.
+ */
+ protected String paramString()
+ {
+ return "JColorChooser";
+ } // paramString()
/**
* getAccessibleContext
+ *
* @return AccessibleContext
*/
public AccessibleContext getAccessibleContext()
@@ -364,4 +576,130 @@ public class JColorChooser extends JComponent implements Accessible {
return accessibleContext;
}
+
+ /**
+ * A helper class that hides a JDialog when the action is performed.
+ */
+ static class DefaultOKCancelListener implements ActionListener
+ {
+ /** The JDialog to hide. */
+ private JDialog dialog;
+
+ /**
+ * Creates a new DefaultOKCancelListener with the given JDialog to hide.
+ *
+ * @param dialog The JDialog to hide.
+ */
+ public DefaultOKCancelListener(JDialog dialog)
+ {
+ super();
+ this.dialog = dialog;
+ }
+
+ /**
+ * This method hides the JDialog when called.
+ *
+ * @param e The ActionEvent.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ dialog.hide();
+ }
+ }
+
+ /**
+ * This method resets the JColorChooser color to the initial color when the
+ * action is performed.
+ */
+ static class DefaultResetListener implements ActionListener
+ {
+ /** The JColorChooser to reset. */
+ private JColorChooser chooser;
+
+ /** The initial color. */
+ private Color init;
+
+ /**
+ * Creates a new DefaultResetListener with the given JColorChooser.
+ *
+ * @param chooser The JColorChooser to reset.
+ */
+ public DefaultResetListener(JColorChooser chooser)
+ {
+ super();
+ this.chooser = chooser;
+ init = chooser.getColor();
+ }
+
+ /**
+ * This method resets the JColorChooser to its initial color.
+ *
+ * @param e The ActionEvent.
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ chooser.setColor(init);
+ }
+ }
+
+ /**
+ * This is a custom JDialog that will notify when it is hidden and the modal
+ * property is set.
+ */
+ static class ModalDialog extends JDialog
+ {
+ /** The modal property. */
+ private boolean modal;
+
+ /**
+ * Creates a new ModalDialog object with the given parent and title.
+ *
+ * @param parent The parent of the JDialog.
+ * @param title The title of the JDialog.
+ */
+ public ModalDialog(Frame parent, String title)
+ {
+ super(parent, title);
+ }
+
+ /**
+ * Creates a new ModalDialog object with the given parent and title.
+ *
+ * @param parent The parent of the JDialog.
+ * @param title The title of the JDialog.
+ */
+ public ModalDialog(Dialog parent, String title)
+ {
+ super(parent, title);
+ }
+
+ /**
+ * This method sets the modal property.
+ *
+ * @param modal The modal property.
+ */
+ public void setModal(boolean modal)
+ {
+ this.modal = modal;
+ }
+
+ /**
+ * This method shows the ModalDialog.
+ */
+ public void show()
+ {
+ super.show();
+ if (modal)
+ makeModal(this);
+ }
+
+ /**
+ * This method hides the ModalDialog.
+ */
+ public synchronized void hide()
+ {
+ super.hide();
+ notifyAll();
+ }
+ }
}
diff --git a/javax/swing/JComboBox.java b/javax/swing/JComboBox.java
index b66dcb3a9..9d480dc7c 100644
--- a/javax/swing/JComboBox.java
+++ b/javax/swing/JComboBox.java
@@ -35,761 +35,958 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
+import java.awt.Component;
+import java.awt.Dimension;
import java.awt.ItemSelectable;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
+import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.util.Vector;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleAction;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleSelection;
+import javax.swing.JComponent;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import javax.swing.event.PopupMenuListener;
import javax.swing.plaf.ComboBoxUI;
+
/**
- * JComboBox
- * @author Andrew Selkirk
- * @version 1.0
+ * JComboBox. JComboBox is a container, that keeps track of elements added to
+ * it by the user. JComboBox allows user to select any item in its list and
+ * displays the selected item to the user. JComboBox also can show/hide popup
+ * menu containing its list of item whenever the mouse is pressed over it.
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
*/
-public class JComboBox extends JComponent
- implements ItemSelectable, ListDataListener, ActionListener, Accessible
+public class JComboBox extends JComponent implements ItemSelectable,
+ ListDataListener,
+ ActionListener,
+ Accessible
{
private static final long serialVersionUID = 5654585963292734470L;
/**
- * AccessibleJComboBox
+ * KeySelectionManager interface. Class implementing this interface are
+ * responsible for matching key characters typed by the user with combo
+ * box's items.
*/
- protected class AccessibleJComboBox extends AccessibleJComponent
- implements AccessibleAction, AccessibleSelection
+ public static interface KeySelectionManager
{
- private static final long serialVersionUID = 8217828307256675666L;
+ int selectionForKey(char aKey, ComboBoxModel aModel);
+ }
+
+ /**
+ * Maximum number of rows that should be visible by default in the
+ * JComboBox's popup
+ */
+ public static final int DEFAULT_MAXIMUM_ROW_COUNT = 8;
+
+ /**
+ * Fired in a PropertyChangeEvent when the 'editable' property changes.
+ */
+ public static final String EDITABLE_CHANGED_PROPERTY = "editable";
+
+ /**
+ * Fired in a PropertyChangeEvent when the 'maximumRowCount' property
+ * changes.
+ */
+ public static final String MAXIMUM_ROW_COUNT_CHANGED_PROPERTY = "maximumRowCount";
+
+ /**
+ * Fired in a PropertyChangeEvent when the 'enabled' property changes.
+ */
+ public static final String ENABLED_CHANGED_PROPERTY = "enabled";
+
+ /**
+ * Fired in a PropertyChangeEvent when the 'renderer' property changes.
+ */
+ public static final String RENDERER_CHANGED_PROPERTY = "renderer";
+
+ /**
+ * Fired in a PropertyChangeEvent when the 'editor' property changes.
+ */
+ public static final String EDITOR_CHANGED_PROPERTY = "editor";
+
+ /**
+ * Fired in a PropertyChangeEvent when the 'dataModel' property changes.
+ */
+ public static final String MODEL_CHANGED_PROPERTY = "dataModel";
+
+ /**
+ * name for the UI delegate for this combo box.
+ */
+ private static final String uiClassID = "ComboBoxUI";
+
+ /**
+ * dataModel used by JComboBox to keep track of its list data and currently
+ * selected element in the list.
+ */
+ protected ComboBoxModel dataModel;
+
+ /**
+ * Renderer renders(paints) every object in the combo box list in its
+ * associated list cell. This ListCellRenderer is used only when this
+ * JComboBox is uneditable.
+ */
+ protected ListCellRenderer renderer;
+
+ /**
+ * editor that is responsible for editting an object in a combo box list
+ */
+ protected ComboBoxEditor editor;
+
+ /**
+ * Number of rows that will be visible in the JComboBox's popup.
+ */
+ protected int maximumRowCount;
+
+ /**
+ * This field indicates if textfield of this JComboBox is editable or not.
+ */
+ protected boolean isEditable;
+
+ /**
+ * This field is reference to the current selection of the combo box.
+ */
+ protected Object selectedItemReminder;
+
+ /**
+ * keySelectionManager
+ */
+ protected KeySelectionManager keySelectionManager;
+
+ /**
+ * This actionCommand is used in ActionEvent that is fired to JComboBox's
+ * ActionListeneres.
+ */
+ protected String actionCommand;
+
+ /**
+ * This property indicates if heavyweight popup or lightweight popup will be
+ * used to diplay JComboBox's elements.
+ */
+ protected boolean lightWeightPopupEnabled;
+
+ /**
+ * The action taken when new item is selected in the JComboBox
+ */
+ private Action action;
+
+ /**
+ * since 1.4 If this field is set then comboBox's display area for the
+ * selected item will be set by default to this value.
+ */
+ private Object prototypeDisplayValue;
+
+ /**
+ * Constructs JComboBox object with specified data model for it. The first
+ * item in the specified data model is selected by default.
+ *
+ * @param model Data model that will be used by this JComboBox to keep track
+ * of its list of items.
+ */
+ public JComboBox(ComboBoxModel model)
+ {
+ setEditable(false);
+ setEnabled(true);
+ setMaximumRowCount(DEFAULT_MAXIMUM_ROW_COUNT);
+ setModel(model);
+ setActionCommand("comboBoxChanged");
+
+ // by default set selected item to the first element in the combo box
+ if (getItemCount() != 0)
+ setSelectedItem(getItemAt(0));
+
+ lightWeightPopupEnabled = true;
+ isEditable = false;
+
+ updateUI();
+ }
+
+ /**
+ * Constructs JComboBox with specified list of items.
+ *
+ * @param itemArray array containing list of items for this JComboBox
+ */
+ public JComboBox(Object[] itemArray)
+ {
+ this(new DefaultComboBoxModel(itemArray));
+ }
+
+ /**
+ * Constructs JComboBox object with specified list of items.
+ *
+ * @param itemVector vector containing list of items for this JComboBox.
+ */
+ public JComboBox(Vector itemVector)
+ {
+ this(new DefaultComboBoxModel(itemVector));
+ }
+
+ /**
+ * Constructor. Creates new empty JComboBox. ComboBox's data model is set to
+ * DefaultComboBoxModel.
+ */
+ public JComboBox()
+ {
+ this(new DefaultComboBoxModel());
+ }
+
+ private void writeObject(ObjectOutputStream stream) throws IOException
+ {
+ }
+
+ /**
+ * This method returns true JComboBox is editable and false otherwise
+ *
+ * @return boolean true if JComboBox is editable and false otherwise
+ */
+ public boolean isEditable()
+ {
+ return isEditable;
+ }
- /**
- * Constructor AccessibleJComboBox
- * @param component TODO
+ /*
+ * This method adds ancestor listener to this JComboBox.
+ */
+ protected void installAncestorListener()
+ {
+ /* FIXME: Need to implement.
+ *
+ * Need to add ancestor listener to this JComboBox. This listener
+ * should close combo box's popup list of items whenever it
+ * receives an AncestorEvent.
*/
- protected AccessibleJComboBox()
- {
- }
+ }
+
+ /**
+ * Set the "UI" property of the combo box, which is a look and feel class
+ * responsible for handling comboBox's input events and painting it.
+ *
+ * @param ui The new "UI" property
+ */
+ public void setUI(ComboBoxUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ /**
+ * This method sets this comboBox's UI to the UIManager's default for the
+ * current look and feel.
+ */
+ public void updateUI()
+ {
+ setUI((ComboBoxUI) UIManager.getUI(this));
+ invalidate();
+ }
+
+ /**
+ * This method returns the String identifier for the UI class to the used
+ * with the JComboBox.
+ *
+ * @return The String identifier for the UI class.
+ */
+ public String getUIClassID()
+ {
+ return uiClassID;
+ }
+
+ /**
+ * This method returns the UI used to display the JComboBox.
+ *
+ * @return The UI used to display the JComboBox.
+ */
+ public ComboBoxUI getUI()
+ {
+ return (ComboBoxUI) ui;
+ }
+
+ /**
+ * Set the data model for this JComboBox. This un-registers all listeners
+ * associated with the current model, and re-registers them with the new
+ * model.
+ *
+ * @param newDataModel The new data model for this JComboBox
+ */
+ public void setModel(ComboBoxModel newDataModel)
+ {
+ if (this.dataModel == newDataModel)
+ return;
+
+ if (this.dataModel != null)
+ // remove all listeners currently registered with the model.
+ dataModel.removeListDataListener(this);
+
+ ComboBoxModel oldDataModel = this.dataModel;
+ this.dataModel = newDataModel;
+
+ if (this.dataModel != null)
+ // register all listeners with the new data model
+ dataModel.addListDataListener(this);
+
+ firePropertyChange(MODEL_CHANGED_PROPERTY, oldDataModel, this.dataModel);
+ }
+
+ /**
+ * This method returns data model for this comboBox.
+ *
+ * @return ComboBoxModel containing items for this combo box.
+ */
+ public ComboBoxModel getModel()
+ {
+ return dataModel;
+ }
+
+ /**
+ * This method sets JComboBox's popup to be either lightweight or
+ * heavyweight. If 'enabled' is true then lightweight popup is used and
+ * heavyweight otherwise. By default lightweight popup is used to display
+ * this JComboBox's elements.
+ *
+ * @param enabled indicates if lightweight popup or heavyweight popup should
+ * be used to display JComboBox's elements.
+ */
+ public void setLightWeightPopupEnabled(boolean enabled)
+ {
+ this.lightWeightPopupEnabled = enabled;
+ }
+
+ /**
+ * This method returns whether popup menu that is used to display list of
+ * combo box's item is lightWeight or not.
+ *
+ * @return boolean true if popup menu is lightweight and false otherwise.
+ */
+ public boolean isLightWeightPopupEnabled()
+ {
+ return lightWeightPopupEnabled;
+ }
+
+ /**
+ * This method sets editability of the combo box. If combo box is editable
+ * the user can choose component from the combo box list by typing
+ * component's name in the editor(JTextfield by default). Otherwise if not
+ * editable, the user should use the list to choose the component. This
+ * method fires PropertyChangeEvents to JComboBox's registered
+ * PropertyChangeListeners to indicate that 'editable' property of the
+ * JComboBox has changed.
+ *
+ * @param editable indicates if the JComboBox's textfield should be editable
+ * or not.
+ */
+ public void setEditable(boolean editable)
+ {
+ if (this.isEditable != editable)
+ {
+ this.isEditable = editable;
+ firePropertyChange(EDITABLE_CHANGED_PROPERTY, ! isEditable, isEditable);
+ }
+ }
+
+ /**
+ * Sets number of rows that should be visible in this JComboBox's popup. If
+ * this JComboBox's popup has more elements that maximum number or rows
+ * then popup will have a scroll pane to allow users to view other
+ * elements.
+ *
+ * @param rowCount number of rows that will be visible in JComboBox's popup.
+ */
+ public void setMaximumRowCount(int rowCount)
+ {
+ if (maximumRowCount != rowCount)
+ {
+ int oldMaximumRowCount = this.maximumRowCount;
+ this.maximumRowCount = rowCount;
+ firePropertyChange(MAXIMUM_ROW_COUNT_CHANGED_PROPERTY,
+ oldMaximumRowCount, this.maximumRowCount);
+ }
+ }
+
+ /**
+ * This method returns number of rows visible in the JComboBox's list of
+ * items.
+ *
+ * @return int maximun number of visible rows in the JComboBox's list.
+ */
+ public int getMaximumRowCount()
+ {
+ return maximumRowCount;
+ }
+
+ /**
+ * This method sets cell renderer for this JComboBox that will be used to
+ * paint combo box's items. The Renderer should only be used only when
+ * JComboBox is not editable. In the case when JComboBox is editable the
+ * editor must be used. This method also fires PropertyChangeEvent when
+ * cellRendered for this JComboBox has changed.
+ *
+ * @param aRenderer cell renderer that will be used by this JComboBox to
+ * paint its elements.
+ */
+ public void setRenderer(ListCellRenderer aRenderer)
+ {
+ if (this.renderer != aRenderer)
+ {
+ ListCellRenderer oldRenderer = this.renderer;
+ this.renderer = aRenderer;
+ firePropertyChange(RENDERER_CHANGED_PROPERTY, oldRenderer,
+ this.renderer);
+ }
+ }
+
+ /**
+ * This method returns renderer responsible for rendering selected item in
+ * the combo box
+ *
+ * @return ListCellRenderer
+ */
+ public ListCellRenderer getRenderer()
+ {
+ return renderer;
+ }
+
+ /**
+ * Sets editor for this JComboBox
+ *
+ * @param newEditor ComboBoxEditor for this JComboBox. This method fires
+ * PropertyChangeEvent when 'editor' property is changed.
+ */
+ public void setEditor(ComboBoxEditor newEditor)
+ {
+ if (editor == newEditor)
+ return;
+
+ if (editor != null)
+ editor.removeActionListener(this);
+
+ ComboBoxEditor oldEditor = editor;
+ editor = newEditor;
+
+ if (editor != null)
+ editor.addActionListener(this);
+
+ firePropertyChange(EDITOR_CHANGED_PROPERTY, oldEditor, editor);
+ }
+
+ /**
+ * Returns editor component that is responsible for displaying/editting
+ * selected item in the combo box.
+ *
+ * @return ComboBoxEditor
+ */
+ public ComboBoxEditor getEditor()
+ {
+ return editor;
+ }
+
+ /**
+ * Forces combo box to select given item
+ *
+ * @param item element in the combo box to select.
+ */
+ public void setSelectedItem(Object item)
+ {
+ dataModel.setSelectedItem(item);
+ }
+
+ /**
+ * Returns currently selected item in the combo box.
+ *
+ * @return element that is currently selected in this combo box.
+ */
+ public Object getSelectedItem()
+ {
+ Object item = dataModel.getSelectedItem();
+
+ if (item == null && getItemCount() != 0)
+ item = getItemAt(0);
+
+ return item;
+ }
- /**
- * getAccessibleChildrenCount
- * @returns int
- */
- public int getAccessibleChildrenCount() {
- return 0; // TODO
- } // getAccessibleChildrenCount()
-
- /**
- * getAccessibleChild
- * @param value0 TODO
- * @returns Accessible
- */
- public Accessible getAccessibleChild(int value0) {
- return null; // TODO
- } // getAccessibleChild()
-
- /**
- * getAccessibleSelection
- * @returns AccessibleSelection
- */
- public AccessibleSelection getAccessibleSelection() {
- return null; // TODO
- } // getAccessibleSelection()
-
- /**
- * getAccessibleSelection
- * @param value0 TODO
- * @returns Accessible
- */
- public Accessible getAccessibleSelection(int value0) {
- return null; // TODO
- } // getAccessibleSelection()
-
- /**
- * isAccessibleChildSelected
- * @param value0 TODO
- * @returns boolean
- */
- public boolean isAccessibleChildSelected(int value0) {
- return false; // TODO
- } // isAccessibleChildSelected()
-
- /**
- * getAccessibleRole
- * @returns AccessibleRole
- */
- public AccessibleRole getAccessibleRole() {
- return AccessibleRole.COMBO_BOX;
- } // getAccessibleRole()
-
- /**
- * getAccessibleAction
- * @returns AccessibleAction
- */
- public AccessibleAction getAccessibleAction() {
- return null; // TODO
- } // getAccessibleAction()
-
- /**
- * getAccessibleActionDescription
- * @param value0 TODO
- * @returns String
- */
- public String getAccessibleActionDescription(int value0) {
- return null; // TODO
- } // getAccessibleActionDescription()
-
- /**
- * getAccessibleActionCount
- * @returns int
- */
- public int getAccessibleActionCount() {
- return 0; // TODO
- } // getAccessibleActionCount()
-
- /**
- * doAccessibleAction
- * @param value0 TODO
- * @returns boolean
- */
- public boolean doAccessibleAction(int value0) {
- return false; // TODO
- } // doAccessibleAction()
-
- /**
- * getAccessibleSelectionCount
- * @returns int
- */
- public int getAccessibleSelectionCount() {
- return 0; // TODO
- } // getAccessibleSelectionCount()
-
- /**
- * addAccessibleSelection
- * @param value0 TODO
- */
- public void addAccessibleSelection(int value0) {
- // TODO
- } // addAccessibleSelection()
-
- /**
- * removeAccessibleSelection
- * @param value0 TODO
- */
- public void removeAccessibleSelection(int value0) {
- // TODO
- } // removeAccessibleSelection()
-
- /**
- * clearAccessibleSelection
- */
- public void clearAccessibleSelection() {
- // TODO
- } // clearAccessibleSelection()
-
- /**
- * selectAllAccessibleSelection
- */
- public void selectAllAccessibleSelection() {
- // TODO
- } // selectAllAccessibleSelection()
-
-
- } // AccessibleJComboBox
-
- /**
- * KeySelectionManager
- */
- public static interface KeySelectionManager {
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * selectionForKey
- * @param value0 TODO
- * @param value1 TODO
- * @returns int
- */
- int selectionForKey(char value0, ComboBoxModel value1);
-
-
- } // KeySelectionManager
-
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * uiClassID
- */
- private static final String uiClassID = "ComboBoxUI";
-
- /**
- * dataModel
- */
- protected ComboBoxModel dataModel;
-
- /**
- * renderer
- */
- protected ListCellRenderer renderer;
-
- /**
- * editor
- */
- protected ComboBoxEditor editor;
-
- /**
- * maximumRowCount
- */
- protected int maximumRowCount;
-
- /**
- * isEditable
- */
- protected boolean isEditable;
-
- /**
- * selectedItemReminder
- */
- protected Object selectedItemReminder;
-
- /**
- * keySelectionManager
- */
- protected JComboBox.KeySelectionManager keySelectionManager;
-
- /**
- * actionCommand
- */
- protected String actionCommand;
-
- /**
- * lightWeightPopupEnabled
- */
- protected boolean lightWeightPopupEnabled;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor JComboBox
- * @param value0 TODO
- */
- public JComboBox(ComboBoxModel value0) {
- // TODO
- } // JComboBox()
-
- /**
- * Constructor JComboBox
- * @param value0 TODO
- */
- public JComboBox(Object[] value0) {
- // TODO
- } // JComboBox()
-
- /**
- * Constructor JComboBox
- * @param value0 TODO
- */
- public JComboBox(Vector value0) {
- // TODO
- } // JComboBox()
-
- /**
- * Constructor JComboBox
- */
- public JComboBox() {
- // TODO
- } // JComboBox()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * writeObject
- * @param stream TODO
- * @exception IOException TODO
- */
- private void writeObject(ObjectOutputStream stream) throws IOException {
- // TODO
- } // writeObject()
-
- /**
- * isEditable
- * @returns boolean
- */
- public boolean isEditable() {
- return false; // TODO
- } // isEditable()
-
- /**
- * installAncestorListener
- */
- protected void installAncestorListener() {
- // TODO
- } // installAncestorListener()
-
- /**
- * setUI
- * @param ui TODO
- */
- public void setUI(ComboBoxUI ui) {
- super.setUI(ui);
- } // setUI()
-
- /**
- * updateUI
- */
- public void updateUI() {
- setUI((ComboBoxUI) UIManager.get(this));
- invalidate();
- } // updateUI()
-
- /**
- * getUIClassID
- * @returns String
- */
- public String getUIClassID() {
- return uiClassID;
- } // getUIClassID()
-
- /**
- * getUI
- * @returns ComboBoxUI
- */
- public ComboBoxUI getUI() {
- return (ComboBoxUI) ui;
- } // getUI()
-
- /**
- * setModel
- * @param value0 TODO
- */
- public void setModel(ComboBoxModel value0) {
- // TODO
- } // setModel()
-
- /**
- * getModel
- * @returns ComboBoxModel
- */
- public ComboBoxModel getModel() {
- return null; // TODO
- } // getModel()
-
- /**
- * setLightWeightPopupEnabled
- * @param value0 TODO
- */
- public void setLightWeightPopupEnabled(boolean value0) {
- // TODO
- } // setLightWeightPopupEnabled()
-
- /**
- * isLightWeightPopupEnabled
- * @returns boolean
- */
- public boolean isLightWeightPopupEnabled() {
- return false; // TODO
- } // isLightWeightPopupEnabled()
-
- /**
- * setEditable
- * @param value0 TODO
- */
- public void setEditable(boolean value0) {
- // TODO
- } // setEditable()
-
- /**
- * setMaximumRowCount
- * @param value0 TODO
- */
- public void setMaximumRowCount(int value0) {
- // TODO
- } // setMaximumRowCount()
-
- /**
- * getMaximumRowCount
- * @returns int
- */
- public int getMaximumRowCount() {
- return 0; // TODO
- } // getMaximumRowCount()
-
- /**
- * setRenderer
- * @param value0 TODO
- */
- public void setRenderer(ListCellRenderer value0) {
- // TODO
- } // setRenderer()
-
- /**
- * getRenderer
- * @returns ListCellRenderer
- */
- public ListCellRenderer getRenderer() {
- return null; // TODO
- } // getRenderer()
-
- /**
- * setEditor
- * @param value0 TODO
- */
- public void setEditor(ComboBoxEditor value0) {
- // TODO
- } // setEditor()
-
- /**
- * getEditor
- * @returns ComboBoxEditor
- */
- public ComboBoxEditor getEditor() {
- return null; // TODO
- } // getEditor()
-
- /**
- * setSelectedItem
- * @param value0 TODO
- */
- public void setSelectedItem(Object value0) {
- // TODO
- } // setSelectedItem()
-
- /**
- * getSelectedItem
- * @returns Object
- */
- public Object getSelectedItem() {
- return null; // TODO
- } // getSelectedItem()
-
- /**
- * setSelectedIndex
- * @param value0 TODO
- */
- public void setSelectedIndex(int value0) {
- // TODO
- } // setSelectedIndex()
-
- /**
- * getSelectedIndex
- * @returns int
- */
- public int getSelectedIndex() {
- return 0; // TODO
- } // getSelectedIndex()
-
- /**
- * addItem
- * @param value0 TODO
- */
- public void addItem(Object value0) {
- // TODO
- } // addItem()
-
- /**
- * insertItemAt
- * @param value0 TODO
- * @param value1 TODO
- */
- public void insertItemAt(Object value0, int value1) {
- // TODO
- } // insertItemAt()
-
- /**
- * removeItem
- * @param value0 TODO
- */
- public void removeItem(Object value0) {
- // TODO
- } // removeItem()
-
- /**
- * removeItemAt
- * @param value0 TODO
- */
- public void removeItemAt(int value0) {
- // TODO
- } // removeItemAt()
-
- /**
- * removeAllItems
- */
- public void removeAllItems() {
- // TODO
- } // removeAllItems()
-
- /**
- * showPopup
- */
- public void showPopup() {
- // TODO
- } // showPopup()
-
- /**
- * hidePopup
- */
- public void hidePopup() {
- // TODO
- } // hidePopup()
-
- /**
- * setPopupVisible
- * @param value0 TODO
- */
- public void setPopupVisible(boolean value0) {
- // TODO
- } // setPopupVisible()
-
- /**
- * isPopupVisible
- * @returns boolean
- */
- public boolean isPopupVisible() {
- return false; // TODO
- } // isPopupVisible()
-
- /**
- * setActionCommand
- * @param value0 TODO
- */
- public void setActionCommand(String value0) {
- // TODO
- } // setActionCommand()
-
- /**
- * getActionCommand
- * @returns String
- */
- public String getActionCommand() {
- return null; // TODO
- } // getActionCommand()
-
- /**
- * setAction
- * @param value0 TODO
- */
- public void setAction(Action value0) {
- // TODO
- } // setAction()
-
- /**
- * isListener
- * @param value0 TODO
- * @param value1 TODO
- * @returns boolean
- */
- private boolean isListener(Class value0, ActionListener value1) {
- return false; // TODO
- } // isListener()
-
- /**
- * getAction
- * @returns Action
- */
- public Action getAction() {
- return null; // TODO
- } // getAction()
-
- /**
- * configurePropertiesFromAction
- * @param value0 TODO
- */
- protected void configurePropertiesFromAction(Action value0) {
- // TODO
- } // configurePropertiesFromAction()
-
- /**
- * createActionPropertyChangeListener
- * @param value0 TODO
- * @returns PropertyChangeListener
- */
- protected PropertyChangeListener createActionPropertyChangeListener(Action value0) {
- return null; // TODO
- } // createActionPropertyChangeListener()
-
- /**
- * fireItemStateChanged
- * @param value0 TODO
- */
- protected void fireItemStateChanged(ItemEvent value0) {
- // TODO
- } // fireItemStateChanged()
-
- /**
- * fireActionEvent
- */
- protected void fireActionEvent() {
- // TODO
- } // fireActionEvent()
-
- /**
- * selectedItemChanged
- */
- protected void selectedItemChanged() {
- // TODO
- } // selectedItemChanged()
-
- /**
- * getSelectedObjects
- * @returns Object[]
- */
- public Object[] getSelectedObjects() {
- return null; // TODO
- } // getSelectedObjects()
-
- /**
- * actionPerformed
- * @param value0 TODO
- */
- public void actionPerformed(ActionEvent value0) {
- // TODO
- } // actionPerformed()
-
- /**
- * contentsChanged
- * @param value0 TODO
- */
- public void contentsChanged(ListDataEvent value0) {
- // TODO
- } // contentsChanged()
-
- /**
- * selectWithKeyChar
- * @param value0 TODO
- * @returns boolean
- */
- public boolean selectWithKeyChar(char value0) {
- return false; // TODO
- } // selectWithKeyChar()
-
- /**
- * intervalAdded
- * @param value0 TODO
- */
- public void intervalAdded(ListDataEvent value0) {
- // TODO
- } // intervalAdded()
-
- /**
- * intervalRemoved
- * @param value0 TODO
- */
- public void intervalRemoved(ListDataEvent value0) {
- // TODO
- } // intervalRemoved()
-
- /**
- * setEnabled
- * @param value0 TODO
- */
- public void setEnabled(boolean value0) {
- // TODO
- } // setEnabled()
-
- /**
- * configureEditor
- * @param value0 TODO
- * @param value1 TODO
- */
- public void configureEditor(ComboBoxEditor value0, Object value1) {
- // TODO
- } // configureEditor()
-
- /**
- * processKeyEvent
- * @param value0 TODO
- */
- public void processKeyEvent(KeyEvent value0) {
- // TODO
- } // processKeyEvent()
-
- /**
- * isFocusTraversable
- * @returns boolean
- * @deprecated
- */
- public boolean isFocusTraversable() {
- return false; // TODO
- } // isFocusTraversable()
-
- /**
- * setKeySelectionManager
- * @param value0 TODO
- */
- public void setKeySelectionManager(KeySelectionManager value0) {
- // TODO
- } // setKeySelectionManager()
-
- /**
- * getKeySelectionManager
- * @returns JComboBox.KeySelectionManager
- */
- public JComboBox.KeySelectionManager getKeySelectionManager() {
- return null; // TODO
- } // getKeySelectionManager()
-
- /**
- * getItemCount
- * @returns int
- */
- public int getItemCount() {
- return 0; // TODO
- } // getItemCount()
-
- /**
- * getItemAt
- * @param value0 TODO
- * @returns Object
- */
- public Object getItemAt(int value0) {
- return null; // TODO
- } // getItemAt()
-
- /**
- * createDefaultKeySelectionManager
- * @returns KeySelectionManager
- */
- protected KeySelectionManager createDefaultKeySelectionManager() {
- return null; // TODO
- } // createDefaultKeySelectionManager()
-
- /**
- * paramString
- * @returns String
- */
- protected String paramString() {
- return null; // TODO
- } // paramString()
-
- /**
- * getAccessibleContext
- * @returns AccessibleContext
+ /**
+ * Forces JComboBox to select component located in the given index in the
+ * combo box.
+ *
+ * @param index index specifying location of the component that should be
+ * selected.
+ */
+ public void setSelectedIndex(int index)
+ {
+ // FIXME: if index == -1 then nothing should be selected
+ setSelectedItem(dataModel.getElementAt(index));
+ }
+
+ /**
+ * Returns index of the item that is currently selected in the combo box.
+ * If no item is currently selected, then -1 is returned.
+ *
+ * @return int index specifying location of the currently selected item in
+ * the combo box or -1 if nothing is selected in the combo box.
+ */
+ public int getSelectedIndex()
+ {
+ Object selectedItem = getSelectedItem();
+ if (selectedItem != null && (dataModel instanceof DefaultComboBoxModel))
+ return ((DefaultComboBoxModel) dataModel).getIndexOf(selectedItem);
+
+ return -1;
+ }
+
+ public Object getPrototypeDisplayValue()
+ {
+ return prototypeDisplayValue;
+ }
+
+ public void setPrototypeDisplayValue(Object prototypeDisplayValue)
+ {
+ this.prototypeDisplayValue = prototypeDisplayValue;
+ }
+
+ /**
+ * This method adds given element to this JComboBox.
+ *
+ * @param element element to add
+ */
+ public void addItem(Object element)
+ {
+ ((MutableComboBoxModel) dataModel).addElement(element);
+ }
+
+ /**
+ * Inserts given element at the specified index to this JComboBox
+ *
+ * @param element element to insert
+ * @param index position where to insert the element
+ */
+ public void insertItemAt(Object element, int index)
+ {
+ ((MutableComboBoxModel) dataModel).insertElementAt(element, index);
+ }
+
+ /**
+ * This method removes given element from this JComboBox.
+ *
+ * @param element element to remove
*/
+ public void removeItem(Object element)
+ {
+ ((MutableComboBoxModel) dataModel).removeElement(element);
+ }
+
+ /**
+ * This method remove element location in the specified index in the
+ * JComboBox.
+ *
+ * @param index index specifying position of the element to remove
+ */
+ public void removeItemAt(int index)
+ {
+ ((MutableComboBoxModel) dataModel).removeElementAt(index);
+ }
+
+ /**
+ * This method removes all elements from this JComboBox.
+ */
+ public void removeAllItems()
+ {
+ if (dataModel instanceof DefaultComboBoxModel)
+ ((DefaultComboBoxModel) dataModel).removeAllElements();
+ }
+
+ /**
+ * This method displays popup with list of combo box's items on the screen
+ */
+ public void showPopup()
+ {
+ setPopupVisible(true);
+ }
+
+ /**
+ * This method hides popup containing list of combo box's items
+ */
+ public void hidePopup()
+ {
+ setPopupVisible(false);
+ }
+
+ /**
+ * This method either displayes or hides the popup containing list of combo
+ * box's items.
+ *
+ * @param visible show popup if 'visible' is true and hide it otherwise
+ */
+ public void setPopupVisible(boolean visible)
+ {
+ getUI().setPopupVisible(this, visible);
+ }
+
+ /**
+ * Checks if popup is currently visible on the screen.
+ *
+ * @return boolean true if popup is visible and false otherwise
+ */
+ public boolean isPopupVisible()
+ {
+ return getUI().isPopupVisible(this);
+ }
+
+ /**
+ * This method sets actionCommand to the specified string. ActionEvent fired
+ * to this JComboBox registered ActionListeners will contain this
+ * actionCommand.
+ *
+ * @param aCommand new action command for the JComboBox's ActionEvent
+ */
+ public void setActionCommand(String aCommand)
+ {
+ actionCommand = aCommand;
+ }
+
+ /**
+ * Returns actionCommand associated with the ActionEvent fired by the
+ * JComboBox to its registered ActionListeners.
+ *
+ * @return String actionCommand for the ActionEvent
+ */
+ public String getActionCommand()
+ {
+ return actionCommand;
+ }
+
+ /**
+ * setAction
+ *
+ * @param a action to set
+ */
+ public void setAction(Action a)
+ {
+ Action old = action;
+ action = a;
+ configurePropertiesFromAction(action);
+ if (action != null)
+ // FIXME: remove from old action and add to new action
+ // PropertyChangeListener to listen to changes in the action
+ addActionListener(action);
+ }
+
+ /**
+ * This method returns Action that is invoked when selected item is changed
+ * in the JComboBox.
+ *
+ * @return Action
+ */
+ public Action getAction()
+ {
+ return action;
+ }
+
+ /**
+ * Configure properties of the JComboBox by reading properties of specified
+ * action. This method always sets the comboBox's "enabled" property to the
+ * value of the Action's "enabled" property.
+ *
+ * @param a An Action to configure the combo box from
+ */
+ protected void configurePropertiesFromAction(Action a)
+ {
+ if (a == null)
+ {
+ setEnabled(true);
+ setToolTipText(null);
+ }
+ else
+ {
+ setEnabled(a.isEnabled());
+ setToolTipText((String) (a.getValue(Action.SHORT_DESCRIPTION)));
+ }
+ }
+
+ /**
+ * Creates PropertyChangeListener to listen for the changes in comboBox's
+ * action properties.
+ *
+ * @param action action to listen to for property changes
+ *
+ * @return $PropertyChangeListener$ Listener that listens to changes in
+ * action properties.
+ */
+ protected PropertyChangeListener createActionPropertyChangeListener(Action action)
+ {
+ return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ Action act = (Action) (e.getSource());
+ configurePropertiesFromAction(act);
+ }
+ };
+ }
+
+ /**
+ * This method fires ItemEvent to this JComboBox's registered ItemListeners.
+ * This method is invoked when currently selected item in this combo box
+ * has changed.
+ *
+ * @param e the ItemEvent describing the change in the combo box's
+ * selection.
+ */
+ protected void fireItemStateChanged(ItemEvent e)
+ {
+ ItemListener[] ll = getItemListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].itemStateChanged(e);
+ }
+
+ /**
+ * This method fires ActionEvent to this JComboBox's registered
+ * ActionListeners. This method is invoked when user explicitly changes
+ * currently selected item.
+ */
+ protected void fireActionEvent()
+ {
+ ActionListener[] ll = getActionListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].actionPerformed(new ActionEvent(this,
+ ActionEvent.ACTION_PERFORMED,
+ actionCommand));
+ }
+
+ /**
+ * This method is invoked whenever selected item changes in the combo box's
+ * data model. It fires ItemEvent and ActionEvent to all registered
+ * ComboBox's ItemListeners and ActionListeners respectively, indicating
+ * the change.
+ */
+ protected void selectedItemChanged()
+ {
+ // Fire ItemEvent to indicated that previously selected item is now
+ // deselected
+ if (selectedItemReminder != null)
+ fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+ selectedItemReminder,
+ ItemEvent.DESELECTED));
+
+ // Fire ItemEvent to indicate that new item is selected
+ Object newSelection = getSelectedItem();
+ fireItemStateChanged(new ItemEvent(this, ItemEvent.ITEM_STATE_CHANGED,
+ newSelection, ItemEvent.SELECTED));
+
+ // Fire Action Event to JComboBox's registered listeners
+ fireActionEvent();
+
+ selectedItemReminder = newSelection;
+ }
+
+ /**
+ * Returns Object array of size 1 containing currently selected element in
+ * the JComboBox.
+ *
+ * @return Object[] Object array of size 1 containing currently selected
+ * element in the JComboBox.
+ */
+ public Object[] getSelectedObjects()
+ {
+ Object selectedObject = getSelectedItem();
+ return new Object[] { selectedObject };
+ }
+
+ /**
+ * This method handles actionEvents fired by the ComboBoxEditor. It changes
+ * this JComboBox's selection to the new value currently in the editor and
+ * hides list of combo box items.
+ *
+ * @param e the ActionEvent
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ setSelectedItem(((ComboBoxEditor) e.getSource()).getItem());
+ setPopupVisible(false);
+ }
+
+ /**
+ * This method selects item in this combo box that matches specified
+ * specified keyChar and returns true if such item is found. Otherwise
+ * false is returned.
+ *
+ * @param keyChar character indicating which item in the combo box should be
+ * selected.
+ *
+ * @return boolean true if item corresponding to the specified keyChar
+ * exists in the combo box. Otherwise false is returned.
+ */
+ public boolean selectWithKeyChar(char keyChar)
+ {
+ // FIXME: Need to implement
+ return false;
+ }
+
+ /**
+ * The part of implementation of ListDataListener interface. This method is
+ * invoked when some items where added to the JComboBox's data model.
+ *
+ * @param event ListDataEvent describing the change
+ */
+ public void intervalAdded(ListDataEvent event)
+ {
+ // FIXME: Need to implement
+ repaint();
+ }
+
+ /**
+ * The part of implementation of ListDataListener interface. This method is
+ * invoked when some items where removed from the JComboBox's data model.
+ *
+ * @param event ListDataEvent describing the change.
+ */
+ public void intervalRemoved(ListDataEvent event)
+ {
+ // FIXME: Need to implement
+ repaint();
+ }
+
+ /**
+ * The part of implementation of ListDataListener interface. This method is
+ * invoked when contents of the JComboBox's data model changed.
+ *
+ * @param event ListDataEvent describing the change
+ */
+ public void contentsChanged(ListDataEvent event)
+ {
+ // if first and last index of the given ListDataEvent are both -1,
+ // then it indicates that selected item in the combo box data model
+ // have changed.
+ if (event.getIndex0() == -1 && event.getIndex1() == -1)
+ selectedItemChanged();
+ }
+
+ /**
+ * This method disables or enables JComboBox. If the JComboBox is enabled,
+ * then user is able to make item choice, otherwise if JComboBox is
+ * disabled then user is not able to make a selection.
+ *
+ * @param enabled if 'enabled' is true then enable JComboBox and disable it
+ */
+ public void setEnabled(boolean enabled)
+ {
+ boolean oldEnabled = super.isEnabled();
+ if (enabled != oldEnabled)
+ {
+ super.setEnabled(enabled);
+ firePropertyChange(ENABLED_CHANGED_PROPERTY, oldEnabled,
+ (boolean) enabled);
+ }
+ }
+
+ /**
+ * This method initializes specified ComboBoxEditor to display given item.
+ *
+ * @param anEditor ComboBoxEditor to initialize
+ * @param anItem Item that should displayed in the specified editor
+ */
+ public void configureEditor(ComboBoxEditor anEditor, Object anItem)
+ {
+ anEditor.setItem(anItem);
+ }
+
+ /**
+ * This method hides combo box's popup whenever TAB key is pressed.
+ *
+ * @param e The KeyEvent indicating which key was pressed.
+ */
+ public void processKeyEvent(KeyEvent e)
+ {
+ }
+
+ /**
+ * This method always returns false to indicate that JComboBox itself is
+ * not focus traversable.
+ *
+ * @return false to indicate that JComboBox itself is not focus traversable.
+ *
+ * @deprecated
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
+ * setKeySelectionManager
+ *
+ * @param aManager
+ */
+ public void setKeySelectionManager(KeySelectionManager aManager)
+ {
+ }
+
+ /**
+ * getKeySelectionManager
+ *
+ * @return JComboBox.KeySelectionManager
+ */
+ public KeySelectionManager getKeySelectionManager()
+ {
+ return null;
+ }
+
+ /**
+ * This method returns number of elements in this JComboBox
+ *
+ * @return int number of elements in this JComboBox
+ */
+ public int getItemCount()
+ {
+ return ((DefaultComboBoxModel) dataModel).getSize();
+ }
+
+ /**
+ * Returns elements located in the combo box at the given index.
+ *
+ * @param index index specifying location of the component to return.
+ *
+ * @return component in the combo box that is located in the given index.
+ */
+ public Object getItemAt(int index)
+ {
+ return ((MutableComboBoxModel) dataModel).getElementAt(index);
+ }
+
+ /**
+ * createDefaultKeySelectionManager
+ *
+ * @return KeySelectionManager
+ */
+ protected KeySelectionManager createDefaultKeySelectionManager()
+ {
+ return null;
+ }
+
+ /**
+ * A string that describes this JComboBox. Normally only used for debugging.
+ *
+ * @return A string describing this JComboBox
+ */
+ protected String paramString()
+ {
+ return "JComboBox";
+ }
+
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
@@ -797,74 +994,180 @@ public class JComboBox extends JComponent
return accessibleContext;
}
-
+
/**
- * addActionListener
- * @param listener TODO
+ * This methods adds specified ActionListener to this JComboBox.
+ *
+ * @param listener to add
*/
- public void addActionListener (ActionListener listener)
+ public void addActionListener(ActionListener listener)
{
- listenerList.add (ActionListener.class, listener);
+ listenerList.add(ActionListener.class, listener);
}
/**
- * removeActionListener
- * @param listener TODO
+ * This method removes specified ActionListener from this JComboBox.
+ *
+ * @param listener ActionListener
*/
- public void removeActionListener (ActionListener listener)
+ public void removeActionListener(ActionListener listener)
{
- listenerList.remove (ActionListener.class, listener);
+ listenerList.remove(ActionListener.class, listener);
}
/**
+ * This method returns array of ActionListeners that are registered with
+ * this JComboBox.
+ *
* @since 1.4
*/
public ActionListener[] getActionListeners()
{
- return (ActionListener[]) getListeners (ActionListener.class);
+ return (ActionListener[]) getListeners(ActionListener.class);
}
/**
- * addItemListener
- * @param listener TODO
+ * This method registers given ItemListener with this JComboBox
+ *
+ * @param listener to remove
*/
public void addItemListener(ItemListener listener)
{
- listenerList.add (ItemListener.class, listener);
+ listenerList.add(ItemListener.class, listener);
}
/**
- * removeItemListener
- * @param listener TODO
+ * This method unregisters given ItemListener from this JComboBox
+ *
+ * @param listener to remove
*/
public void removeItemListener(ItemListener listener)
{
- listenerList.remove (ItemListener.class, listener);
+ listenerList.remove(ItemListener.class, listener);
}
/**
+ * This method returns array of ItemListeners that are registered with this
+ * JComboBox.
+ *
* @since 1.4
*/
public ItemListener[] getItemListeners()
{
- return (ItemListener[]) getListeners (ItemListener.class);
+ return (ItemListener[]) getListeners(ItemListener.class);
}
- public void addPopupMenuListener (PopupMenuListener listener)
+ /**
+ * Adds PopupMenuListener to combo box to listen to the events fired by the
+ * combo box's popup menu containing its list of items
+ *
+ * @param listener to add
+ */
+ public void addPopupMenuListener(PopupMenuListener listener)
{
- listenerList.add (PopupMenuListener.class, listener);
+ listenerList.add(PopupMenuListener.class, listener);
}
- public void removePopupMenuListener (PopupMenuListener listener)
+ /**
+ * Removes PopupMenuListener to combo box to listen to the events fired by
+ * the combo box's popup menu containing its list of items
+ *
+ * @param listener to add
+ */
+ public void removePopupMenuListener(PopupMenuListener listener)
{
- listenerList.remove (PopupMenuListener.class, listener);
+ listenerList.remove(PopupMenuListener.class, listener);
}
/**
- * @since 1.4
+ * Returns array of PopupMenuListeners that are registered with combo box.
*/
public PopupMenuListener[] getPopupMenuListeners()
{
- return (PopupMenuListener[]) getListeners (PopupMenuListener.class);
+ return (PopupMenuListener[]) getListeners(PopupMenuListener.class);
+ }
+
+ /**
+ * AccessibleJComboBox
+ */
+ protected class AccessibleJComboBox extends AccessibleJComponent
+ implements AccessibleAction, AccessibleSelection
+ {
+ private static final long serialVersionUID = 8217828307256675666L;
+
+ protected AccessibleJComboBox()
+ {
+ }
+
+ public int getAccessibleChildrenCount()
+ {
+ return 0;
+ }
+
+ public Accessible getAccessibleChild(int value0)
+ {
+ return null;
+ }
+
+ public AccessibleSelection getAccessibleSelection()
+ {
+ return null;
+ }
+
+ public Accessible getAccessibleSelection(int value0)
+ {
+ return null;
+ }
+
+ public boolean isAccessibleChildSelected(int value0)
+ {
+ return false;
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.COMBO_BOX;
+ }
+
+ public AccessibleAction getAccessibleAction()
+ {
+ return null;
+ }
+
+ public String getAccessibleActionDescription(int value0)
+ {
+ return null;
+ }
+
+ public int getAccessibleActionCount()
+ {
+ return 0;
+ }
+
+ public boolean doAccessibleAction(int value0)
+ {
+ return false;
+ }
+
+ public int getAccessibleSelectionCount()
+ {
+ return 0;
+ }
+
+ public void addAccessibleSelection(int value0)
+ {
+ }
+
+ public void removeAccessibleSelection(int value0)
+ {
+ }
+
+ public void clearAccessibleSelection()
+ {
+ }
+
+ public void selectAllAccessibleSelection()
+ {
+ }
}
}
diff --git a/javax/swing/JComponent.java b/javax/swing/JComponent.java
index 4c4559039..35b255a32 100644
--- a/javax/swing/JComponent.java
+++ b/javax/swing/JComponent.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
@@ -48,11 +49,13 @@ import java.awt.Image;
import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
+import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.geom.Rectangle2D;
import java.awt.image.ImageObserver;
@@ -315,6 +318,12 @@ public abstract class JComponent extends Container implements Serializable
* first client property.
*/
private Hashtable clientProperties;
+
+ private InputMap inputMap_whenFocused;
+ private InputMap inputMap_whenAncestorOfFocused;
+ private InputMap inputMap_whenInFocusedWindow;
+ private ActionMap actionMap;
+ private InputVerifier inputVerifier;
/**
* A lock held during recursive painting; this is used to serialize
@@ -371,6 +380,9 @@ public abstract class JComponent extends Container implements Serializable
public static final int WHEN_IN_FOCUSED_WINDOW = 2;
+ /**
+ * Creates a new <code>JComponent</code> instance.
+ */
public JComponent()
{
super();
@@ -747,18 +759,6 @@ public abstract class JComponent extends Container implements Serializable
return null;
}
- /**
- * Get the ActionListener (typically an {@link Action} object) which is
- * associated with a particular keystroke.
- *
- * @param aKeyStroke The keystroke to retrieve the action of
- *
- * @return The action associated with the specified keystroke
- */
- public ActionListener getActionForKeyStroke(KeyStroke aKeyStroke)
- {
- return null;
- }
/**
* Get the value of the {@link #alignmentX} property.
@@ -800,13 +800,15 @@ public abstract class JComponent extends Container implements Serializable
* Set the value of the {@link #border} property, revalidate
* and repaint this component.
*
- * @param border The new value of the property
+ * @param newBorder The new value of the property
*
* @see #getBorder
*/
- public void setBorder(Border border)
+ public void setBorder(Border newBorder)
{
- this.border = border;
+ Border oldBorder = border;
+ border = newBorder;
+ firePropertyChange("border", oldBorder, newBorder);
revalidate();
repaint();
}
@@ -865,24 +867,6 @@ public abstract class JComponent extends Container implements Serializable
return g;
}
- /**
- * Return the condition that determines whether a registered action
- * occurs in response to the specified keystroke.
- *
- * @param aKeyStroke The keystroke to return the condition of
- *
- * @return One of the values {@link #UNDEFINED_CONDITION}, {@link
- * #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or {@link
- * #WHEN_IN_FOCUSED_WINDOW}
- *
- * @see #registerKeyboardAction
- * @see #unregisterKeyboardAction
- * @see #resetKeyboardActiond
- */
- public int getConditionForKeyStroke(KeyStroke aKeyStroke)
- {
- return UNDEFINED_CONDITION;
- }
/**
* Get the value of the {@link #debugGraphicsOptions} property.
@@ -1039,6 +1023,45 @@ public abstract class JComponent extends Container implements Serializable
}
/**
+ * Checks if a maximum size was explicitely set on the component.
+ *
+ * @return <code>true</code> if a maximum size was set,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ public boolean isMaximumSizeSet()
+ {
+ return maximumSize != null;
+ }
+
+ /**
+ * Checks if a minimum size was explicitely set on the component.
+ *
+ * @return <code>true</code> if a minimum size was set,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ public boolean isMinimumSizeSet()
+ {
+ return minimumSize != null;
+ }
+
+ /**
+ * Checks if a preferred size was explicitely set on the component.
+ *
+ * @return <code>true</code> if a preferred size was set,
+ * <code>false</code> otherwise
+ *
+ * @since 1.3
+ */
+ public boolean isPreferredSizeSet()
+ {
+ return preferredSize != null;
+ }
+
+ /**
* Return the value of the {@link #nextFocusableComponent} property.
*
* @deprecated See {@link java.awt.FocusTraversalPolicy}
@@ -1522,6 +1545,51 @@ public abstract class JComponent extends Container implements Serializable
registerKeyboardAction(act, null, stroke, cond);
}
+ /*
+ * There is some charmingly undocumented behavior sun seems to be using
+ * to simulate the old register/unregister keyboard binding API. It's not
+ * clear to me why this matters, but we shall endeavour to follow suit.
+ *
+ * Two main thing seem to be happening when you do registerKeyboardAction():
+ *
+ * - no actionMap() entry gets created, just an entry in inputMap()
+ *
+ * - the inputMap() entry is a proxy class which invokes the the
+ * binding's actionListener as a target, and which clobbers the command
+ * name sent in the ActionEvent, providing the binding command name
+ * instead.
+ *
+ * This much you can work out just by asking the input and action maps
+ * what they contain after making bindings, and watching the event which
+ * gets delivered to the recipient. Beyond that, it seems to be a
+ * sun-private solution so I will only immitate it as much as it matters
+ * to external observers.
+ */
+
+ private static class ActionListenerProxy
+ extends AbstractAction
+ {
+ ActionListener target;
+ String bindingCommandName;
+
+ public ActionListenerProxy(ActionListener li,
+ String cmd)
+ {
+ target = li;
+ bindingCommandName = cmd;
+ }
+
+ public void actionPerformed(ActionEvent e)
+ {
+ ActionEvent derivedEvent = new ActionEvent(e.getSource(),
+ e.getID(),
+ bindingCommandName,
+ e.getModifiers());
+ target.actionPerformed(derivedEvent);
+ }
+ }
+
+
/**
* An obsolete method to register a keyboard action on this component.
* You should use <code>getInputMap</code> and <code>getActionMap</code>
@@ -1546,9 +1614,186 @@ public abstract class JComponent extends Container implements Serializable
KeyStroke stroke,
int cond)
{
+ getInputMap(cond).put(stroke, new ActionListenerProxy(act, cmd));
+ }
+
+
+
+ public final void setInputMap(int condition, InputMap map)
+ {
+ enableEvents(AWTEvent.KEY_EVENT_MASK);
+ switch (condition)
+ {
+ case WHEN_FOCUSED:
+ inputMap_whenFocused = map;
+ break;
+
+ case WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
+ inputMap_whenAncestorOfFocused = map;
+ break;
+
+ case WHEN_IN_FOCUSED_WINDOW:
+ inputMap_whenInFocusedWindow = map;
+ break;
+
+ case UNDEFINED_CONDITION:
+ default:
+ throw new IllegalArgumentException();
+ }
+ }
+
+ public final InputMap getInputMap(int condition)
+ {
+ enableEvents(AWTEvent.KEY_EVENT_MASK);
+ switch (condition)
+ {
+ case WHEN_FOCUSED:
+ if (inputMap_whenFocused == null)
+ inputMap_whenFocused = new InputMap();
+ return inputMap_whenFocused;
+
+ case WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
+ if (inputMap_whenAncestorOfFocused == null)
+ inputMap_whenAncestorOfFocused = new InputMap();
+ return inputMap_whenAncestorOfFocused;
+
+ case WHEN_IN_FOCUSED_WINDOW:
+ if (inputMap_whenInFocusedWindow == null)
+ inputMap_whenInFocusedWindow = new InputMap();
+ return inputMap_whenInFocusedWindow;
+
+ case UNDEFINED_CONDITION:
+ default:
+ return null;
+ }
+ }
+
+ public final InputMap getInputMap()
+ {
+ return getInputMap(WHEN_FOCUSED);
+ }
+
+ public final ActionMap getActionMap()
+ {
+ if (actionMap == null)
+ actionMap = new ActionMap();
+ return actionMap;
+ }
+
+ public final void setActionMap(ActionMap map)
+ {
+ actionMap = map;
+ }
+
+ /**
+ * @deprecated As of 1.3 KeyStrokes can be registered with multiple
+ * simultaneous conditions.
+ *
+ * Return the condition that determines whether a registered action
+ * occurs in response to the specified keystroke.
+ *
+ * @param aKeyStroke The keystroke to return the condition of
+ *
+ * @return One of the values {@link #UNDEFINED_CONDITION}, {@link
+ * #WHEN_ANCESTOR_OF_FOCUSED_COMPONENT}, {@link #WHEN_FOCUSED}, or {@link
+ * #WHEN_IN_FOCUSED_WINDOW}
+ *
+ * @see #registerKeyboardAction
+ * @see #unregisterKeyboardAction
+ * @see #resetKeyboardActiond
+ */
+ public int getConditionForKeyStroke(KeyStroke ks)
+ {
+ if (inputMap_whenFocused != null
+ && inputMap_whenFocused.get(ks) != null)
+ return WHEN_FOCUSED;
+ else if (inputMap_whenAncestorOfFocused != null
+ && inputMap_whenAncestorOfFocused.get(ks) != null)
+ return WHEN_ANCESTOR_OF_FOCUSED_COMPONENT;
+ else if (inputMap_whenInFocusedWindow != null
+ && inputMap_whenInFocusedWindow.get(ks) != null)
+ return WHEN_IN_FOCUSED_WINDOW;
+ else
+ return UNDEFINED_CONDITION;
+ }
+
+ /**
+ * @deprecated Use {@link #getActionMap()}
+ *
+ * Get the ActionListener (typically an {@link Action} object) which is
+ * associated with a particular keystroke.
+ *
+ * @param aKeyStroke The keystroke to retrieve the action of
+ *
+ * @return The action associated with the specified keystroke
+ */
+ public ActionListener getActionForKeyStroke(KeyStroke ks)
+ {
+ Object cmd = getInputMap().get(ks);
+ if (cmd != null)
+ {
+ if (cmd instanceof ActionListenerProxy)
+ return (ActionListenerProxy) cmd;
+ else if (cmd instanceof String)
+ return getActionMap().get(cmd);
+ }
+ return null;
+ }
+
+ /**
+ * A hook for subclasses which want to customize event processing.
+ */
+ protected void processComponentKeyEvent(KeyEvent e)
+ {
}
/**
+ * Override the default key dispatch system from Component to hook into
+ * the swing {@link InputMap} / {@link ActionMap} system.
+ *
+ * See <a
+ * href="http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html">this
+ * report</a> for more details, it's somewhat complex.
+ */
+ protected void processKeyEvent(KeyEvent e)
+ {
+ processComponentKeyEvent(e);
+
+ // FIXME: this needs to be elaborated significantly, to do all the
+ // focus / ancestor / window searching for the various binding modes.
+ if (! e.isConsumed() &&
+ processKeyBinding(KeyStroke.getKeyStrokeForEvent(e),
+ e, WHEN_FOCUSED, e.getID() == KeyEvent.KEY_PRESSED))
+ e.consume();
+ }
+
+ protected boolean processKeyBinding(KeyStroke ks,
+ KeyEvent e,
+ int condition,
+ boolean pressed)
+ {
+ if (isEnabled())
+ {
+ Action act = null;
+ InputMap map = getInputMap(condition);
+ if (map != null)
+ {
+ Object cmd = map.get(ks);
+ if (cmd != null)
+ {
+ if (cmd instanceof ActionListenerProxy)
+ act = (Action) cmd;
+ else
+ act = (Action) getActionMap().get(cmd);
+ }
+ }
+ if (act != null && act.isEnabled())
+ return SwingUtilities.notifyAction(act, ks, e, this, e.getModifiers());
+ }
+ return false;
+ }
+
+ /**
* Remove a keyboard action registry.
*
* @param stroke The keystroke to unregister
@@ -1571,6 +1816,14 @@ public abstract class JComponent extends Container implements Serializable
*/
public void resetKeyboardActions()
{
+ if (inputMap_whenFocused != null)
+ inputMap_whenFocused.clear();
+ if (inputMap_whenAncestorOfFocused != null)
+ inputMap_whenAncestorOfFocused.clear();
+ if (inputMap_whenInFocusedWindow != null)
+ inputMap_whenInFocusedWindow.clear();
+ if (actionMap != null)
+ actionMap.clear();
}
@@ -1699,11 +1952,13 @@ public abstract class JComponent extends Container implements Serializable
* Set the value of the {@link #enabled} property, revalidate
* and repaint this component.
*
- * @param e The new value of the property
+ * @param enable The new value of the property
*/
- public void setEnabled(boolean e)
+ public void setEnabled(boolean enable)
{
- super.setEnabled(e);
+ boolean oldEnabled = isEnabled();
+ super.setEnabled(enable);
+ firePropertyChange("enabeld", oldEnabled, enable);
revalidate();
repaint();
}
@@ -1755,7 +2010,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setMaximumSize(Dimension max)
{
+ Dimension oldMaximumSize = maximumSize;
maximumSize = max;
+ firePropertyChange("maximumSize", oldMaximumSize, maximumSize);
revalidate();
repaint();
}
@@ -1768,7 +2025,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setMinimumSize(Dimension min)
{
+ Dimension oldMinimumSize = minimumSize;
minimumSize = min;
+ firePropertyChange("minimumSize", oldMinimumSize, minimumSize);
revalidate();
repaint();
}
@@ -1781,7 +2040,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setPreferredSize(Dimension pref)
{
+ Dimension oldPreferredSize = preferredSize;
preferredSize = pref;
+ firePropertyChange("preferredSize", oldPreferredSize, preferredSize);
}
/**
@@ -1817,7 +2078,9 @@ public abstract class JComponent extends Container implements Serializable
*/
public void setOpaque(boolean isOpaque)
{
+ boolean oldOpaque = opaque;
opaque = isOpaque;
+ firePropertyChange("opaque", oldOpaque, opaque);
revalidate();
repaint();
}
@@ -1878,11 +2141,14 @@ public abstract class JComponent extends Container implements Serializable
if (ui != null)
ui.uninstallUI(this);
+ ComponentUI oldUI = ui;
ui = newUI;
if (ui != null)
ui.installUI(this);
+ firePropertyChange("UI", oldUI, newUI);
+
revalidate();
repaint();
}
@@ -1908,4 +2174,26 @@ public abstract class JComponent extends Container implements Serializable
{
defaultLocale = l;
}
+
+ /**
+ * Returns the currently set input verifier for this component.
+ *
+ * @return the input verifier, or <code>null</code> if none
+ */
+ public InputVerifier getInputVerifier()
+ {
+ return inputVerifier;
+ }
+
+ /**
+ * Sets the input verifier to use by this component.
+ *
+ * @param verifier the input verifier, or <code>null</code>
+ */
+ public void setInputVerifier(InputVerifier verifier)
+ {
+ InputVerifier oldVerifier = inputVerifier;
+ inputVerifier = verifier;
+ firePropertyChange("inputVerifier", oldVerifier, verifier);
+ }
}
diff --git a/javax/swing/JFrame.java b/javax/swing/JFrame.java
index 3c254ab04..830883710 100644
--- a/javax/swing/JFrame.java
+++ b/javax/swing/JFrame.java
@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing;
import java.awt.AWTEvent;
@@ -48,231 +47,232 @@ import java.awt.Graphics;
import java.awt.LayoutManager;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
-
import javax.accessibility.AccessibleContext;
+
/**
* Unlike JComponent derivatives, JFrame inherits from
* java.awt.Frame. But also lets a look-and-feel component to its work.
*
* @author Ronald Veldema (rveldema@cs.vu.nl)
*/
-public class JFrame extends Frame implements WindowConstants, RootPaneContainer
+public class JFrame extends Frame
+ implements WindowConstants, RootPaneContainer
{
private static final long serialVersionUID = -3362141868504252139L;
-
- protected AccessibleContext accessibleContext;
-
- private int close_action = HIDE_ON_CLOSE;
-
- private static boolean defaultLookAndFeelDecorated = false;
-
- public static void setDefaultLookAndFeelDecorated(boolean d)
+ private static boolean defaultLookAndFeelDecorated = false;
+ private int close_action = HIDE_ON_CLOSE;
+ protected AccessibleContext accessibleContext;
+ protected JRootPane rootPane;
+ protected boolean rootPaneCheckingEnabled;
+
+ public JFrame()
{
- defaultLookAndFeelDecorated = d;
+ super("JFrame");
+ frameInit();
}
- public static boolean isDefaultLookAndFeelDecorated()
+ public JFrame(String title)
{
- return defaultLookAndFeelDecorated;
+ super(title);
+ frameInit();
+ }
+
+ protected void frameInit()
+ {
+ super.setLayout(new BorderLayout(1, 1));
+ enableEvents(AWTEvent.WINDOW_EVENT_MASK);
+ getRootPane(); // will do set/create
}
- /***************************************************
- *
- * initia
- *
- *
- *************/
-
-
- public JFrame()
- {
- super("JFrame");
- frameInit();
- }
-
- public JFrame(String title)
- {
- super(title);
- frameInit();
- }
-
-
- /***************************************************
- *
- *
- * methods, this part is shared with JDialog, JFrame
- *
- *
- *************/
-
-
- private boolean checking;
- protected JRootPane rootPane;
-
-
- protected void frameInit()
- {
- super.setLayout(new BorderLayout(1, 1));
- enableEvents(AWTEvent.WINDOW_EVENT_MASK);
- getRootPane(); // will do set/create
- }
-
public Dimension getPreferredSize()
{
- Dimension d = super.getPreferredSize();
- return d;
+ return super.getPreferredSize();
}
public JMenuBar getJMenuBar()
- { return getRootPane().getJMenuBar(); }
-
+ {
+ return getRootPane().getJMenuBar();
+ }
+
public void setJMenuBar(JMenuBar menubar)
- { getRootPane().setJMenuBar(menubar); }
-
+ {
+ getRootPane().setJMenuBar(menubar);
+ }
- public void setLayout(LayoutManager manager)
- { super.setLayout(manager); }
+ public void setLayout(LayoutManager manager)
+ {
+ super.setLayout(manager);
+ }
+
+ public void setLayeredPane(JLayeredPane layeredPane)
+ {
+ getRootPane().setLayeredPane(layeredPane);
+ }
- public void setLayeredPane(JLayeredPane layeredPane)
- { getRootPane().setLayeredPane(layeredPane); }
-
public JLayeredPane getLayeredPane()
- { return getRootPane().getLayeredPane(); }
-
+ {
+ return getRootPane().getLayeredPane();
+ }
+
public JRootPane getRootPane()
- {
- if (rootPane == null)
- setRootPane(createRootPane());
- return rootPane;
- }
+ {
+ if (rootPane == null)
+ setRootPane(createRootPane());
+ return rootPane;
+ }
public void setRootPane(JRootPane root)
- {
- if (rootPane != null)
- remove(rootPane);
-
- rootPane = root;
- add(rootPane, BorderLayout.CENTER);
- }
+ {
+ if (rootPane != null)
+ remove(rootPane);
+
+ rootPane = root;
+ add(rootPane, BorderLayout.CENTER);
+ }
public JRootPane createRootPane()
- { return new JRootPane(); }
+ {
+ return new JRootPane();
+ }
public Container getContentPane()
- { return getRootPane().getContentPane(); }
+ {
+ return getRootPane().getContentPane();
+ }
public void setContentPane(Container contentPane)
- { getRootPane().setContentPane(contentPane); }
-
+ {
+ getRootPane().setContentPane(contentPane);
+ }
+
public Component getGlassPane()
- { return getRootPane().getGlassPane(); }
-
+ {
+ return getRootPane().getGlassPane();
+ }
+
public void setGlassPane(Component glassPane)
- { getRootPane().setGlassPane(glassPane); }
+ {
+ getRootPane().setGlassPane(glassPane);
+ }
-
- protected void addImpl(Component comp, Object constraints, int index)
- { super.addImpl(comp, constraints, index); }
+ protected void addImpl(Component comp, Object constraints, int index)
+ {
+ super.addImpl(comp, constraints, index);
+ }
+ public void remove(Component comp)
+ {
+ getContentPane().remove(comp);
+ }
- public void remove(Component comp)
- { getContentPane().remove(comp); }
-
- protected boolean isRootPaneCheckingEnabled()
- { return checking; }
+ protected boolean isRootPaneCheckingEnabled()
+ {
+ return rootPaneCheckingEnabled;
+ }
+ protected void setRootPaneCheckingEnabled(boolean enabled)
+ {
+ rootPaneCheckingEnabled = enabled;
+ }
- protected void setRootPaneCheckingEnabled(boolean enabled)
- { checking = enabled; }
+ public void update(Graphics g)
+ {
+ paint(g);
+ }
+ protected void processKeyEvent(KeyEvent e)
+ {
+ super.processKeyEvent(e);
+ }
- public void update(Graphics g)
- { paint(g); }
+ public static void setDefaultLookAndFeelDecorated(boolean decorated)
+ {
+ defaultLookAndFeelDecorated = decorated;
+ }
- protected void processKeyEvent(KeyEvent e)
- { super.processKeyEvent(e); }
+ public static boolean isDefaultLookAndFeelDecorated()
+ {
+ return defaultLookAndFeelDecorated;
+ }
- /////////////////////////////////////////////////////////////////////////////////
-
public AccessibleContext getAccessibleContext()
{
return accessibleContext;
}
-
- public int getDefaultCloseOperation()
- { return close_action; }
-
-
- protected String paramString()
- { return "JFrame"; }
+ public int getDefaultCloseOperation()
+ {
+ return close_action;
+ }
+ protected String paramString()
+ {
+ return "JFrame";
+ }
- protected void processWindowEvent(WindowEvent e)
- {
- super.processWindowEvent(e);
- switch (e.getID())
+ protected void processWindowEvent(WindowEvent e)
+ {
+ super.processWindowEvent(e);
+ switch (e.getID())
+ {
+ case WindowEvent.WINDOW_CLOSING:
+ {
+ switch (close_action)
{
- case WindowEvent.WINDOW_CLOSING:
- {
- switch(close_action)
- {
- case EXIT_ON_CLOSE:
- {
- System.exit(0);
- break;
- }
- case DISPOSE_ON_CLOSE:
- {
- dispose();
- break;
- }
- case HIDE_ON_CLOSE:
- {
- setVisible(false);
- break;
- }
- case DO_NOTHING_ON_CLOSE:
- break;
- }
- break;
- }
-
- case WindowEvent.WINDOW_CLOSED:
- case WindowEvent.WINDOW_OPENED:
- case WindowEvent.WINDOW_ICONIFIED:
- case WindowEvent.WINDOW_DEICONIFIED:
- case WindowEvent.WINDOW_ACTIVATED:
- case WindowEvent.WINDOW_DEACTIVATED:
+ case EXIT_ON_CLOSE:
+ {
+ System.exit(0);
+ break;
+ }
+ case DISPOSE_ON_CLOSE:
+ {
+ dispose();
break;
+ }
+ case HIDE_ON_CLOSE:
+ {
+ setVisible(false);
+ break;
+ }
+ case DO_NOTHING_ON_CLOSE:
+ break;
}
- }
-
- /**
- * Defines what happens when this frame is closed. Can be one off
- * <code>EXIT_ON_CLOSE</code>,
- * <code>DISPOSE_ON_CLOSE</code>,
- * <code>HIDE_ON_CLOSE</code> or
- * <code>DO_NOTHING_ON_CLOSE</code>.
- * The default is <code>HIDE_ON_CLOSE</code>.
- * When <code>EXIT_ON_CLOSE</code> is specified this method calls
- * <code>SecurityManager.checkExit(0)</code> which might throw a
- * <code>SecurityException</code>. When the specified operation is
- * not one of the above a <code>IllegalArgumentException</code> is
- * thrown.
- */
- public void setDefaultCloseOperation(int operation)
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null && operation == EXIT_ON_CLOSE)
- sm.checkExit(0);
-
- if (operation != EXIT_ON_CLOSE && operation != DISPOSE_ON_CLOSE
- && operation != HIDE_ON_CLOSE && operation != DO_NOTHING_ON_CLOSE)
- throw new IllegalArgumentException("operation = " + operation);
-
- close_action = operation;
- }
+ break;
+ }
+ case WindowEvent.WINDOW_CLOSED:
+ case WindowEvent.WINDOW_OPENED:
+ case WindowEvent.WINDOW_ICONIFIED:
+ case WindowEvent.WINDOW_DEICONIFIED:
+ case WindowEvent.WINDOW_ACTIVATED:
+ case WindowEvent.WINDOW_DEACTIVATED:
+ break;
+ }
+ }
+ /**
+ * Defines what happens when this frame is closed. Can be one off
+ * <code>EXIT_ON_CLOSE</code>,
+ * <code>DISPOSE_ON_CLOSE</code>,
+ * <code>HIDE_ON_CLOSE</code> or
+ * <code>DO_NOTHING_ON_CLOSE</code>.
+ * The default is <code>HIDE_ON_CLOSE</code>.
+ * When <code>EXIT_ON_CLOSE</code> is specified this method calls
+ * <code>SecurityManager.checkExit(0)</code> which might throw a
+ * <code>SecurityException</code>. When the specified operation is
+ * not one of the above a <code>IllegalArgumentException</code> is
+ * thrown.
+ */
+ public void setDefaultCloseOperation(int operation)
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null && operation == EXIT_ON_CLOSE)
+ sm.checkExit(0);
+
+ if (operation != EXIT_ON_CLOSE && operation != DISPOSE_ON_CLOSE
+ && operation != HIDE_ON_CLOSE && operation != DO_NOTHING_ON_CLOSE)
+ throw new IllegalArgumentException("operation = " + operation);
+
+ close_action = operation;
+ }
}
diff --git a/javax/swing/JInternalFrame.java b/javax/swing/JInternalFrame.java
index 99d552010..b044311e8 100644
--- a/javax/swing/JInternalFrame.java
+++ b/javax/swing/JInternalFrame.java
@@ -341,67 +341,67 @@ public class JInternalFrame extends JComponent implements Accessible,
* The property fired in a PropertyChangeEvent when the contentPane property
* changes.
*/
- public static String CONTENT_PANE_PROPERTY = "contentPane";
+ public static final String CONTENT_PANE_PROPERTY = "contentPane";
/**
* The property fired in a PropertyChangeEvent when the frameIcon property
* changes.
*/
- public static String FRAME_ICON_PROPERTY = "frameIcon";
+ public static final String FRAME_ICON_PROPERTY = "frameIcon";
/**
* The property fired in a PropertyChangeEvent when the glassPane property
* changes.
*/
- public static String GLASS_PANE_PROPERTY = "glassPane";
+ public static final String GLASS_PANE_PROPERTY = "glassPane";
/**
* The property fired in a PropertyChangeEvent when the closed property
* changes.
*/
- public static String IS_CLOSED_PROPERTY = "closed";
+ public static final String IS_CLOSED_PROPERTY = "closed";
/**
* The property fired in a PropertyChangeEvent when the icon property
* changes.
*/
- public static String IS_ICON_PROPERTY = "icon";
+ public static final String IS_ICON_PROPERTY = "icon";
/**
* The property fired in a PropertyChangeEvent when the maximum property
* changes.
*/
- public static String IS_MAXIMUM_PROPERTY = "maximum";
+ public static final String IS_MAXIMUM_PROPERTY = "maximum";
/**
* The property fired in a PropertyChangeEvent when the selected property
* changes.
*/
- public static String IS_SELECTED_PROPERTY = "selected";
+ public static final String IS_SELECTED_PROPERTY = "selected";
/**
* The property fired in a PropertyChangeEvent when the layeredPane property
* changes.
*/
- public static String LAYERED_PANE_PROPERTY = "layeredPane";
+ public static final String LAYERED_PANE_PROPERTY = "layeredPane";
/**
* The property fired in a PropertyChangeEvent when the jMenuBar property
* changes.
*/
- public static String MENU_BAR_PROPERTY = "jMenuBar";
+ public static final String MENU_BAR_PROPERTY = "jMenuBar";
/**
* The property fired in a PropertyChangeEvent when the rootPane property
* changes.
*/
- public static String ROOT_PANE_PROPERTY = "rootPane";
+ public static final String ROOT_PANE_PROPERTY = "rootPane";
/**
* The property fired in a PropertyChangeEvent when the title property
* changes.
*/
- public static String TITLE_PROPERTY = "title";
+ public static final String TITLE_PROPERTY = "title";
/** Whether the JInternalFrame is closable. */
protected boolean closable;
diff --git a/javax/swing/JLabel.java b/javax/swing/JLabel.java
index 0a15cfc9c..652c965e5 100644
--- a/javax/swing/JLabel.java
+++ b/javax/swing/JLabel.java
@@ -38,8 +38,9 @@ exception statement from your version. */
package javax.swing;
import java.awt.Component;
-import java.awt.Image;
import java.awt.Font;
+import java.awt.Image;
+import java.awt.event.KeyEvent;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.swing.Icon;
@@ -48,7 +49,7 @@ import javax.swing.plaf.LabelUI;
/**
* <p>
- * A swing widget that displays a text message and/or an icon.
+ * A swing widget that displays a text message and/or an icon.
* </p>
*/
public class JLabel extends JComponent implements Accessible, SwingConstants
@@ -63,10 +64,10 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
protected Component labelFor;
/** The label's text. */
- private transient String labelText;
+ private transient String text;
/** Where the label will be positioned horizontally. */
- private transient int horizontalAlignment = CENTER;
+ private transient int horizontalAlignment = LEADING;
/** Where the label text will be placed horizontally relative to the icon. */
private transient int horizontalTextPosition = TRAILING;
@@ -78,16 +79,16 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
private transient int verticalTextPosition = CENTER;
/** The icon painted when the label is enabled. */
- private transient Icon activeIcon;
+ private transient Icon icon;
/** The icon painted when the label is disabled. */
private transient Icon disabledIcon;
/** The label's mnemnonic key. */
- private transient char mnemonicKey;
+ private transient int displayedMnemonic = KeyEvent.VK_UNDEFINED;
/** The index of the menemonic character in the text. */
- private transient int underlinedChar = -1;
+ private transient int displayedMnemonicIndex = -1;
/** The gap between the icon and the text. */
private transient int iconTextGap = 4;
@@ -102,10 +103,11 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
* changes.
*/
public static final String DISPLAYED_MNEMONIC_CHANGED_PROPERTY = "displayedMnemonic";
-
+
/**
- * Fired in a PropertyChangeEvent when the "displayedMnemonicIndex"
- * property changes. */
+ * Fired in a PropertyChangeEvent when the "displayedMnemonicIndex" property
+ * changes.
+ */
public static final String DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY = "displayedMnemonicIndex";
/**
@@ -145,8 +147,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
public static final String VERTICAL_TEXT_POSITION_CHANGED_PROPERTY = "verticalTextPosition";
/**
- * Creates a new horizontally and vertically centered JLabel object with no text and no
- * icon.
+ * Creates a new horizontally and vertically centered JLabel object with no
+ * text and no icon.
*/
public JLabel()
{
@@ -154,8 +156,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
}
/**
- * Creates a new horizontally and vertically centered JLabel object with no text and the
- * given icon.
+ * Creates a new horizontally and vertically centered JLabel object with no
+ * text and the given icon.
*
* @param image The icon to use with the label.
*/
@@ -165,8 +167,9 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
}
/**
- * Creates a new vertically centered JLabel object with no text and the given icon and
- * horizontal alignment. By default, the text is TRAILING the image.
+ * Creates a new vertically centered JLabel object with no text and the
+ * given icon and horizontal alignment. By default, the text is TRAILING
+ * the image.
*
* @param image The icon to use with the label.
* @param horizontalAlignment The horizontal alignment of the label.
@@ -177,8 +180,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
}
/**
- * Creates a new horizontally and vertically centered JLabel object with no icon and the
- * given text.
+ * Creates a new horizontally and vertically centered JLabel object with no
+ * icon and the given text.
*
* @param text The text to use with the label.
*/
@@ -188,8 +191,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
}
/**
- * Creates a new vertically centered JLabel object with no icon and the given text and
- * horizontal alignment.
+ * Creates a new vertically centered JLabel object with no icon and the
+ * given text and horizontal alignment.
*
* @param text The text to use with the label.
* @param horizontalAlignment The horizontal alignment of the label.
@@ -200,8 +203,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
}
/**
- * Creates a new vertically centered JLabel object with the given text, icon, and horizontal
- * alignment.
+ * Creates a new vertically centered JLabel object with the given text,
+ * icon, and horizontal alignment.
*
* @param text The text to use with the label.
* @param icon The icon to use with the label.
@@ -209,8 +212,8 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
*/
public JLabel(String text, Icon icon, int horizontalAlignment)
{
- labelText = text;
- activeIcon = icon;
+ this.text = text;
+ this.icon = icon;
this.horizontalAlignment = horizontalAlignment;
updateUI();
}
@@ -273,24 +276,25 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
*/
public String getText()
{
- return labelText;
+ return text;
}
/**
* This method changes the "text" property. The given text will be painted
* in the label.
*
- * @param text The label's text.
+ * @param newText The label's text.
*/
- public void setText(String text)
+ public void setText(String newText)
{
- if (text != labelText)
+ if (text != newText)
{
- String oldText = labelText;
- labelText = text;
- firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, labelText);
- if (labelText != null && labelText.length() <= underlinedChar)
- setDisplayedMnemonicIndex(labelText.length() - 1);
+ String oldText = text;
+ text = newText;
+ firePropertyChange(TEXT_CHANGED_PROPERTY, oldText, newText);
+
+ if (text != null && text.length() <= displayedMnemonicIndex)
+ setDisplayedMnemonicIndex(text.length() - 1);
}
}
@@ -302,37 +306,39 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
*/
public Icon getIcon()
{
- return activeIcon;
+ return icon;
}
/**
* This method changes the "icon" property. This icon (the active icon) will
* be the one displayed when the label is enabled.
*
- * @param icon The active icon.
+ * @param newIcon The active icon.
*/
- public void setIcon(Icon icon)
+ public void setIcon(Icon newIcon)
{
- if (icon != activeIcon)
+ if (icon != newIcon)
{
- Icon oldIcon = activeIcon;
- activeIcon = icon;
- firePropertyChange(ICON_CHANGED_PROPERTY, oldIcon, activeIcon);
+ Icon oldIcon = icon;
+ icon = newIcon;
+ firePropertyChange(ICON_CHANGED_PROPERTY, oldIcon, newIcon);
}
}
/**
* This method returns the disabled icon. The disabled icon is painted when
- * the label is disabled. If the disabled icon is null and the active icon is
- * an ImageIcon, this method returns a grayed version of the icon. The grayed
- * version of the icon becomes the disabledIcon.
+ * the label is disabled. If the disabled icon is null and the active icon
+ * is an ImageIcon, this method returns a grayed version of the icon. The
+ * grayed version of the icon becomes the disabledIcon.
*
* @return The disabled icon.
*/
public Icon getDisabledIcon()
{
- if (disabledIcon == null && activeIcon instanceof ImageIcon)
- disabledIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) activeIcon).getImage()));
+ if (disabledIcon == null && icon instanceof ImageIcon)
+ disabledIcon = new ImageIcon(GrayFilter.createDisabledImage(((ImageIcon) icon)
+ .getImage()));
+
return disabledIcon;
}
@@ -340,16 +346,15 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
* This method changes the "disabledIcon" property. This icon (the disabled
* icon) will be the one displayed when the label is disabled.
*
- * @param disabledIcon The disabled icon.
+ * @param newIcon The disabled icon.
*/
- public void setDisabledIcon(Icon disabledIcon)
+ public void setDisabledIcon(Icon newIcon)
{
- if (disabledIcon != this.disabledIcon)
+ if (disabledIcon != newIcon)
{
- Icon oldDisabledIcon = this.disabledIcon;
- this.disabledIcon = disabledIcon;
- firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, oldDisabledIcon,
- this.disabledIcon);
+ Icon oldIcon = disabledIcon;
+ disabledIcon = newIcon;
+ firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, oldIcon, newIcon);
}
}
@@ -358,11 +363,19 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
* label is used as a label for another component, the label will give
* focus to that component when the mnemonic is activated.
*
- * @param key The keycode to use for the mnemonic.
+ * @param mnemonic The keycode to use for the mnemonic.
*/
- public void setDisplayedMnemonic(int key)
+ public void setDisplayedMnemonic(int mnemonic)
{
- setDisplayedMnemonic((char) key);
+ if (displayedMnemonic != mnemonic)
+ {
+ firePropertyChange(DISPLAYED_MNEMONIC_CHANGED_PROPERTY,
+ displayedMnemonic, mnemonic);
+ displayedMnemonic = mnemonic;
+
+ if (text != null)
+ setDisplayedMnemonicIndex(text.indexOf(mnemonic));
+ }
}
/**
@@ -370,19 +383,11 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
* label is used as a label for another component, the label will give
* focus to that component when the mnemonic is activated.
*
- * @param aChar The character to use for the mnemonic.
+ * @param mnemonic The character to use for the mnemonic.
*/
- public void setDisplayedMnemonic(char aChar)
+ public void setDisplayedMnemonic(char mnemonic)
{
- if (aChar != mnemonicKey)
- {
- char oldKey = mnemonicKey;
- mnemonicKey = aChar;
- firePropertyChange(DISPLAYED_MNEMONIC_CHANGED_PROPERTY, oldKey,
- mnemonicKey);
- if (labelText != null)
- setDisplayedMnemonicIndex(labelText.indexOf(mnemonicKey));
- }
+ setDisplayedMnemonic((int) mnemonic);
}
/**
@@ -392,7 +397,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
*/
public int getDisplayedMnemonic()
{
- return (int) mnemonicKey;
+ return (int) displayedMnemonic;
}
/**
@@ -401,27 +406,26 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
* no mnemonic. If the index is less than -1 or if the index is equal to
* the length, this method will throw an IllegalArgumentException.
*
- * @param index The index of the character to underline.
+ * @param newIndex The index of the character to underline.
*
* @throws IllegalArgumentException If index less than -1 or index equals
* length.
*/
- public void setDisplayedMnemonicIndex(int index)
+ public void setDisplayedMnemonicIndex(int newIndex)
throws IllegalArgumentException
{
- if (index < -1 || labelText != null && index >= labelText.length())
+ if (newIndex < -1 || (text != null && newIndex >= text.length()))
throw new IllegalArgumentException();
-
- if (labelText == null || labelText.charAt(index) != mnemonicKey)
- index = -1;
-
- if (index != underlinedChar)
- {
- int oldIndex = underlinedChar;
- underlinedChar = index;
- firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,
- oldIndex, underlinedChar);
- }
+
+ if (text == null || text.charAt(newIndex) != displayedMnemonic)
+ newIndex = -1;
+
+ if (newIndex != displayedMnemonicIndex)
+ {
+ firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,
+ displayedMnemonicIndex, newIndex);
+ displayedMnemonicIndex = newIndex;
+ }
}
/**
@@ -432,7 +436,7 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
*/
public int getDisplayedMnemonicIndex()
{
- return underlinedChar;
+ return displayedMnemonicIndex;
}
/**
@@ -490,16 +494,14 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
* This method changes the "iconTextGap" property. The iconTextGap
* determines how much space there is between the icon and the text.
*
- * @param iconTextGap The gap between the icon and the text.
+ * @param newGap The gap between the icon and the text.
*/
- public void setIconTextGap(int iconTextGap)
+ public void setIconTextGap(int newGap)
{
- if (iconTextGap != this.iconTextGap)
+ if (iconTextGap != newGap)
{
- int oldIconTextGap = this.iconTextGap;
- this.iconTextGap = iconTextGap;
- firePropertyChange(ICON_TEXT_GAP_CHANGED_PROPERTY, oldIconTextGap,
- iconTextGap);
+ firePropertyChange(ICON_TEXT_GAP_CHANGED_PROPERTY, iconTextGap, newGap);
+ iconTextGap = newGap;
}
}
@@ -632,11 +634,12 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
public boolean imageUpdate(Image img, int infoflags, int x, int y, int w,
int h)
{
- Icon currIcon = (isEnabled()) ? activeIcon : disabledIcon;
+ Icon currIcon = isEnabled() ? icon : disabledIcon;
- //Is this the correct way to check for image equality?
+ // XXX: Is this the correct way to check for image equality?
if (currIcon != null && currIcon instanceof ImageIcon)
return (((ImageIcon) currIcon).getImage() == img);
+
return false;
}
@@ -664,15 +667,14 @@ public class JLabel extends JComponent implements Accessible, SwingConstants
{
if (c != labelFor)
{
- Component oldLabelFor = labelFor;
+ firePropertyChange(LABEL_FOR_CHANGED_PROPERTY, labelFor, c);
labelFor = c;
- firePropertyChange(LABEL_FOR_CHANGED_PROPERTY, oldLabelFor, labelFor);
}
}
-
+
/**
- * This method overrides setFont so that we can call for a repaint
- * after the font is changed.
+ * This method overrides setFont so that we can call for a repaint after the
+ * font is changed.
*
* @param f The font for this label.
*/
diff --git a/javax/swing/JList.java b/javax/swing/JList.java
index 937d41cce..b7638810c 100644
--- a/javax/swing/JList.java
+++ b/javax/swing/JList.java
@@ -588,6 +588,28 @@ public class JList extends JComponent implements Accessible, Scrollable
return getUI().locationToIndex(this, r.getLocation());
}
+
+ /**
+ * Returns index of the cell to which specified location is closest to
+ * @param location for which to look for in the list
+ *
+ * @return index of the cell to which specified location is closest to.
+ */
+ public int locationToIndex(Point location) {
+ return getUI().locationToIndex(this, location);
+ }
+
+ /**
+ * Returns location of the cell located at the specified index in the list.
+ * @param index of the cell for which location will be determined
+ *
+ * @return location of the cell located at the specified index in the list.
+ */
+ public Point indexToLocation(int index){
+ //FIXME: Need to implement.
+ return null;
+ }
+
/**
* Returns the list index of the lower right or lower left corner of the
* {@link #visibleRect} property, depending on the {@link
diff --git a/javax/swing/JMenu.java b/javax/swing/JMenu.java
index 72ce22acc..7fbaba179 100644
--- a/javax/swing/JMenu.java
+++ b/javax/swing/JMenu.java
@@ -140,7 +140,8 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
*/
public JMenu(String text, boolean tearoff)
{
- throw new Error("not implemented");
+ // FIXME: tearoff not implemented
+ this(text);
}
private void writeObject(ObjectOutputStream stream) throws IOException
@@ -644,16 +645,28 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement
}
/**
+ * Returns all registered <code>MenuListener</code> objects.
+ *
+ * @return an array of listeners
+ *
+ * @since 1.4
+ */
+ public MenuListener[] getMenuListeners()
+ {
+ return (MenuListener[]) listenerList.getListeners(MenuListener.class);
+ }
+
+ /**
* This method fires MenuEvents to all menu's MenuListeners. In this case
* menuSelected() method of MenuListeners is called to indicated that the menu
* was selected.
*/
protected void fireMenuSelected()
{
- EventListener[] ll = listenerList.getListeners(MenuListener.class);
+ MenuListener[] listeners = getMenuListeners();
- for (int i = 0; i < ll.length; i++)
- ((MenuListener) ll[i]).menuSelected(menuEvent);
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].menuSelected(menuEvent);
}
/**
diff --git a/javax/swing/JPasswordField.java b/javax/swing/JPasswordField.java
index b8c88055f..710c66244 100644
--- a/javax/swing/JPasswordField.java
+++ b/javax/swing/JPasswordField.java
@@ -44,6 +44,7 @@ import javax.accessibility.AccessibleRole;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
+
/**
* JPasswordField
* @author Andrew Selkirk
@@ -75,160 +76,160 @@ public class JPasswordField extends JTextField
}
}
- /**
- * uiClassID
- */
- private static final String uiClassID = "PasswordFieldUI";
-
- /**
- * echoChar. Default is 0
- */
- private char echoChar = 0;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor JPasswordField
- */
- public JPasswordField() {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param text TODO
- */
- public JPasswordField(String text) {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param columns TODO
- */
- public JPasswordField(int columns) {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param text TODO
- * @param columns TODO
- */
- public JPasswordField(String text, int columns) {
- // TODO
- } // JPasswordField()
-
- /**
- * Constructor JPasswordField
- * @param document TODO
- * @param text TODO
- * @param columns TODO
- */
- public JPasswordField(Document document, String text, int columns) {
- // TODO
- } // JPasswordField()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * writeObject
- * @param stream TODO
- * @exception IOException TODO
- */
- private void writeObject(ObjectOutputStream stream) throws IOException {
- // TODO
- } // writeObject()
-
- /**
- * copy
- */
- public void copy() {
- // TODO
- } // copy()
-
- /**
- * getUIClassID
- * @returns String
- */
- public String getUIClassID() {
- return uiClassID;
- } // getUIClassID()
-
- /**
- * getEchoChar
- * @returns char
- */
- public char getEchoChar() {
- return echoChar;
- } // getEchoChar()
-
- /**
- * setEchoChar
- * @param echo TODO
- */
- public void setEchoChar(char echo) {
- this.echoChar = echo;
- // TODO
- } // setEchoChar()
-
- /**
- * echoCharIsSet
- * @returns boolean
- */
- public boolean echoCharIsSet() {
- return (echoChar == 0);
- } // echoCharIsSet()
-
- /**
- * cut
- */
- public void cut() {
- // TODO
- } // cut()
-
- /**
- * getText
- * @returns String
- * @deprecated
- */
- public String getText() {
- return null; // TODO
- } // getText()
-
- /**
- * getText
- * @param offset TODO
- * @param length TODO
- * @exception BadLocationException TODO
- * @returns String
- * @deprecated
- */
- public String getText(int offset, int length) throws BadLocationException {
- return null; // TODO
- } // getText()
-
- /**
- * getPassword
- * @returns char[]
- */
- public char[] getPassword() {
- return null; // TODO
- } // getPassword()
-
- /**
- * paramString
- * @returns String
- */
- protected String paramString() {
- return null; // TODO
- } // paramString()
+ /**
+ * echoChar. Default is 0.
+ */
+ private char echoChar = 0;
+
+ /**
+ * Constructor JPasswordField
+ */
+ public JPasswordField()
+ {
+ this(null, null, 0);
+ }
+
+ /**
+ * Constructor JPasswordField
+ * @param text TODO
+ */
+ public JPasswordField(String text)
+ {
+ this(null, text, 0);
+ }
+
+ /**
+ * Constructor JPasswordField
+ * @param columns TODO
+ */
+ public JPasswordField(int columns)
+ {
+ this(null, null, columns);
+ }
+
+ /**
+ * Constructor JPasswordField
+ * @param text TODO
+ * @param columns TODO
+ */
+ public JPasswordField(String text, int columns)
+ {
+ this(null, text, columns);
+ }
+
+ /**
+ * Constructor JPasswordField
+ * @param document TODO
+ * @param text TODO
+ * @param columns TODO
+ */
+ public JPasswordField(Document document, String text, int columns)
+ {
+ super(document, text, columns);
+ }
+
+ /**
+ * writeObject
+ * @param stream TODO
+ * @exception IOException TODO
+ */
+ private void writeObject(ObjectOutputStream stream) throws IOException
+ {
+ // TODO
+ }
+
+ /**
+ * getUIClassID
+ * @return String
+ */
+ public String getUIClassID()
+ {
+ return "PasswordFieldUI";
+ }
+
+ /**
+ * getEchoChar
+ * @return char
+ */
+ public char getEchoChar()
+ {
+ return echoChar;
+ }
+
+ /**
+ * setEchoChar
+ * @param echo TODO
+ */
+ public void setEchoChar(char echo)
+ {
+ this.echoChar = echo;
+ }
+
+ /**
+ * echoCharIsSet
+ * @return boolean
+ */
+ public boolean echoCharIsSet()
+ {
+ return echoChar == 0;
+ }
+
+ /**
+ * copy
+ */
+ public void copy()
+ {
+ UIManager.getLookAndFeel().provideErrorFeedback(this);
+ }
+
+ /**
+ * cut
+ */
+ public void cut()
+ {
+ UIManager.getLookAndFeel().provideErrorFeedback(this);
+ }
+
+ /**
+ * getText
+ * @return String
+ * @deprecated
+ */
+ public String getText()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getText
+ * @param offset TODO
+ * @param length TODO
+ * @return String
+ * @exception BadLocationException TODO
+ * @deprecated
+ */
+ public String getText(int offset, int length) throws BadLocationException
+ {
+ return null; // TODO
+ }
+
+ /**
+ * getPassword
+ * @return char[]
+ */
+ public char[] getPassword()
+ {
+ return null; // TODO
+ }
+
+ /**
+ * paramString
+ * @return String
+ */
+ protected String paramString()
+ {
+ return null; // TODO
+ }
/**
* getAccessibleContext
diff --git a/javax/swing/JPopupMenu.java b/javax/swing/JPopupMenu.java
index 724c3a2b4..3a51a9498 100644
--- a/javax/swing/JPopupMenu.java
+++ b/javax/swing/JPopupMenu.java
@@ -144,6 +144,9 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
/* Location of the popup */
private Point popupLocation;
+ /* Field indicating if popup menu is visible or not */
+ private boolean visible = false;
+
/* Bound Property indicating visibility of the popup menu*/
public static final String VISIBLE_CHANGED_PROPERTY = "visible";
@@ -564,7 +567,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
*/
public boolean isVisible()
{
- return super.isVisible();
+ return visible;
}
/**
@@ -577,7 +580,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
public void setVisible(boolean visible)
{
boolean old = isVisible();
- super.setVisible(visible);
+ this.visible = visible;
if (old != isVisible())
{
firePropertyChange(VISIBLE_CHANGED_PROPERTY, old, (boolean) isVisible());
@@ -615,7 +618,7 @@ public class JPopupMenu extends JComponent implements Accessible, MenuElement
.getLayeredPane();
Point p = new Point(popupLocation.x, popupLocation.y);
SwingUtilities.convertPointFromScreen(p, layeredPane);
- popup.show(p.x, p.y, size.width, size.height);
+ popup.show(p.x, p.y, size.width, size.height);
}
else
{
diff --git a/javax/swing/JRadioButton.java b/javax/swing/JRadioButton.java
index 21e545edd..fc06d15a1 100644
--- a/javax/swing/JRadioButton.java
+++ b/javax/swing/JRadioButton.java
@@ -39,56 +39,219 @@ exception statement from your version. */
package javax.swing;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.swing.plaf.ButtonUI;
+/**
+ * The <code>JRadioButton</code> component provides a visually selectable
+ * button with mutually exclusive behaviour within a <code>ButtonGroup</code>.
+ * A series of radio buttons can be used to provide options to the user,
+ * where the user can only select one of the available options. The state
+ * of the button is provided by the superclass, <code>JToggleButton</code>.
+ * <code>JRadioButton</code> adds the additional behaviour, that if two
+ * or more radio buttons are grouped together, the selection of one implies
+ * the deselection of the other buttons within the group.
+ * <p>
+ *
+ * Buttons are grouped by adding each instance to a <code>ButtonGroup</code>.
+ * The existence of such a grouping is not reflected visually, so other means
+ * should be used to denote this. For instance, the grouped buttons can be placed
+ * within the same panel, possibly with an appropriate border to denote
+ * the connection between the components.
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @author Graydon Hoare <graydon@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see JToggleButton
+ * @see ButtonGroup
+ * @since 1.2
+ */
public class JRadioButton extends JToggleButton
{
+ /**
+ * Compatible with Sun's JDK.
+ */
private static final long serialVersionUID = 7751949583255506856L;
- public JRadioButton()
- {
- this(null, null);
- }
- public JRadioButton(Action a)
- {
- this();
- setAction(a);
- }
+ /**
+ * This class provides accessibility support for the toggle button.
+ */
+ protected class AccessibleJRadioButton
+ extends AccessibleJToggleButton
+ {
- public JRadioButton(Icon icon)
- {
- this(null, icon);
- }
-
- public JRadioButton(String text)
+ /**
+ * Constructor for the accessible toggle button.
+ */
+ protected AccessibleJRadioButton()
{
- this(text, null);
+ /* Call the superclass to register for events */
+ super();
}
-
- public JRadioButton(String text, Icon icon)
+
+ /**
+ * Returns the accessible role for the toggle button.
+ *
+ * @return An instance of <code>AccessibleRole</code>, describing
+ * the role of the toggle button.
+ */
+ public AccessibleRole getAccessibleRole()
{
- super(text, icon);
- borderPainted = false;
- contentAreaFilled = false;
+ return AccessibleRole.RADIO_BUTTON;
}
+ }
+
+ /**
+ * Constructs an unselected radio button with no text or icon.
+ */
+ public JRadioButton()
+ {
+ this(null, null, false);
+ }
- public AccessibleContext getAccessibleContext()
- {
- //Gets the AccessibleContext associated with this JRadioButton.
- return null;
- }
+ /**
+ * Constructs a radio button using the labelling, state
+ * and icon specified by the supplied action.
+ *
+ * @param a the action to use to define the properties of the button.
+ */
+ public JRadioButton(Action a)
+ {
+ this();
+ setAction(a);
+ }
+
+ /**
+ * Constructs an unselected radio button with the supplied icon
+ * and no text.
+ *
+ * @param icon the icon to use.
+ */
+ public JRadioButton(Icon icon)
+ {
+ this(null, icon, false);
+ }
- public String getUIClassID()
- {
- //Returns a string that specifies the name of the Look and Feel
- //class that renders this component.
- return "RadioButtonUI";
- }
+ /**
+ * Constructs a radio button with the supplied icon and state.
+ *
+ * @param icon the icon to use.
+ * @param selected if true, the radio button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
+ public JRadioButton(Icon icon, boolean selected)
+ {
+ this(null, icon, selected);
+ }
- protected String paramString()
- {
- return "JRadioButton";
- }
+ /**
+ * Constructs an unselected radio button using the supplied text
+ * and no icon.
+ *
+ * @param text the text to use.
+ */
+ public JRadioButton(String text)
+ {
+ this(text, null, false);
+ }
+
+ /**
+ * Constructs a radio button with the supplied text and state.
+ *
+ * @param text the text to use.
+ * @param selected if true, the radio button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
+ public JRadioButton(String text, boolean selected)
+ {
+ this(text, null, selected);
+ }
+
+ /**
+ * Constructs an unselected radio button with the supplied text
+ * and icon.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ */
+ public JRadioButton(String text, Icon icon)
+ {
+ this(text, icon, false);
+ }
+
+ /**
+ * Constructs a radio button with the supplied text, icon and state.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ * @param selected if true, the radio button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
+ public JRadioButton(String text, Icon icon, boolean selected)
+ {
+ super(text, icon, selected);
+ borderPainted = false;
+ contentAreaFilled = false;
+ }
+
+ /**
+ * Returns the accessible context for this <code>JRadioButton</code>,
+ * in the form of an instance of <code>AccessibleJRadioButton</code>.
+ * The context is created, if necessary.
+ *
+ * @return the associated context
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleJRadioButton();
+ }
+ return accessibleContext;
+ }
+
+ /**
+ * Returns a string specifying the name of the Look and Feel UI class
+ * that renders this component.
+ *
+ * @return the Look and Feel UI class for <code>JRadioButton</code>s
+ * as a <code>String</code>.
+ */
+ public String getUIClassID()
+ {
+ return "RadioButtonUI";
+ }
+
+ /**
+ * Returns a string representation of this component for debugging use.
+ * Users should not depend on anything as regards the content or formatting
+ * of this string, except for the fact that the returned string may never be
+ * null (only empty).
+ *
+ * @return the component in <code>String</code> form for debugging.
+ */
+ protected String paramString()
+ {
+ return "JRadioButton";
+ }
+
+ /**
+ * This method resets the radio button's UI delegate to the default UI for
+ * the current look and feel.
+ */
+ public void updateUI()
+ {
+ /*
+ I can't see any difference between this and the superclass one,
+ but Sun reimplements it... there is no RadioButtonUI class for it
+ to be cast to.
+ */
+ setUI((ButtonUI) UIManager.getUI(this));
+ }
+
}
diff --git a/javax/swing/JRootPane.java b/javax/swing/JRootPane.java
index 5414e8a59..12df42990 100644
--- a/javax/swing/JRootPane.java
+++ b/javax/swing/JRootPane.java
@@ -63,7 +63,9 @@ public class JRootPane extends JComponent
// The class used to obtain the accessible role for this object.
protected static class AccessibleJRootPane
{
- /** DOCUMENT ME! */
+ /**
+ * For compatability with Sun's JDK
+ */
private static final long serialVersionUID = 1082432482784468088L;
/**
@@ -307,6 +309,16 @@ public class JRootPane extends JComponent
/** DOCUMENT ME! */
private static final long serialVersionUID = 8690748000348575668L;
+ public static final int NONE = 0;
+ public static final int FRAME = 1;
+ public static final int PLAIN_DIALOG = 2;
+ public static final int INFORMATION_DIALOG = 3;
+ public static final int ERROR_DIALOG = 4;
+ public static final int COLOR_CHOOSER_DIALOG = 5;
+ public static final int FILE_CHOOSER_DIALOG = 6;
+ public static final int QUESTION_DIALOG = 7;
+ public static final int WARNING_DIALOG = 8;
+
/** DOCUMENT ME! */
protected Component glassPane;
@@ -319,6 +331,8 @@ public class JRootPane extends JComponent
/** DOCUMENT ME! */
protected Container contentPane;
+ protected JButton defaultButton;
+
/**
* DOCUMENT ME!
*
@@ -539,4 +553,19 @@ public class JRootPane extends JComponent
{
return "RootPaneUI";
}
+
+ public JButton getDefaultButton()
+ {
+ return defaultButton;
+ }
+
+ public void setDefaultButton(JButton newButton)
+ {
+ if (defaultButton == newButton)
+ return;
+
+ JButton oldButton = defaultButton;
+ defaultButton = newButton;
+ firePropertyChange("defaultButton", oldButton, newButton);
+ }
}
diff --git a/javax/swing/JScrollPane.java b/javax/swing/JScrollPane.java
index 471408035..a728b0cd1 100644
--- a/javax/swing/JScrollPane.java
+++ b/javax/swing/JScrollPane.java
@@ -509,7 +509,8 @@ public class JScrollPane
else
{
// otherwise we got a change update from either the VSB or
- // HSB model, and we need to update the viewport position to
+ // HSB model, and we need to update the viewport positions of
+ // both the main viewport and any row or column headers to
// match.
int xpos = 0;
@@ -526,6 +527,20 @@ public class JScrollPane
if (vp != null
&& vp.getViewPosition() != pt)
vp.setViewPosition(pt);
+
+ pt.x = 0;
+
+ if (rowHeader != null
+ && rowHeader.getViewPosition() != pt)
+ rowHeader.setViewPosition(pt);
+
+ pt.x = xpos;
+ pt.y = 0;
+
+ if (columnHeader != null
+ && columnHeader.getViewPosition() != pt)
+ columnHeader.setViewPosition(pt);
+
}
}
};
@@ -578,7 +593,6 @@ public class JScrollPane
return new JViewport();
}
-
public String getUIClassID()
{
return "ScrollPaneUI";
@@ -590,6 +604,25 @@ public class JScrollPane
setUI(b);
}
+ /**
+ * This method returns the scrollpane's UI delegate.
+ *
+ * @return The scrollpane's UI delegate.
+ */
+ public ScrollPaneUI getUI()
+ {
+ return (ScrollPaneUI) ui;
+ }
+
+ /**
+ * This method sets the scrollpane's UI delegate.
+ *
+ * @param ui The scrollpane's UI delegate.
+ */
+ public void setUI(ScrollPaneUI ui)
+ {
+ super.setUI(ui);
+ }
class ScrollBar
extends JScrollBar
diff --git a/javax/swing/JSpinner.java b/javax/swing/JSpinner.java
new file mode 100644
index 000000000..f6f0f17d7
--- /dev/null
+++ b/javax/swing/JSpinner.java
@@ -0,0 +1,550 @@
+/* JSpinner.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.LayoutManager;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.text.DecimalFormat;
+import java.text.ParseException;
+import java.util.EventListener;
+import javax.swing.border.EtchedBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.EventListenerList;
+import javax.swing.plaf.SpinnerUI;
+
+
+/**
+ * A JSpinner is a component which typically contains a numeric value and a
+ * way to manipulate the value.
+ *
+ * @author Ka-Hing Cheung
+ * @version 1.0
+ */
+public class JSpinner extends JComponent
+{
+ /**
+ * DOCUMENT ME!
+ */
+ public static class StubEditor extends JLabel implements ChangeListener
+ {
+ /** DOCUMENT ME! */
+ private JLabel label;
+
+ /** DOCUMENT ME! */
+ private JButton up;
+
+ /** DOCUMENT ME! */
+ private JButton down;
+
+ /** DOCUMENT ME! */
+ private JSpinner spinner;
+
+ /**
+ * Creates a new StubEditor object.
+ *
+ * @param spinner DOCUMENT ME!
+ */
+ public StubEditor(JSpinner spinner)
+ {
+ this.spinner = spinner;
+ setBorder(new EtchedBorder());
+ setHorizontalAlignment(SwingConstants.TRAILING);
+ stateChanged(null); /* fill in the label */
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param evt DOCUMENT ME!
+ */
+ public void stateChanged(ChangeEvent evt)
+ {
+ setText(String.valueOf(spinner.getValue()));
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public static class DefaultEditor extends JPanel implements ChangeListener,
+ PropertyChangeListener,
+ LayoutManager
+ {
+ private JSpinner spinner;
+
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -5317788736173368172L;
+
+ /**
+ * Creates a new <code>DefaultEditor</code> object.
+ *
+ * @param spinner the <code>JSpinner</code> associated with this editor
+ */
+ public DefaultEditor(JSpinner spinner)
+ {
+ this.spinner = spinner;
+
+ spinner.addChangeListener(this);
+ }
+
+ /**
+ * Returns the <code>JSpinner</code> object for this editor.
+ */
+ public JSpinner getSpinner()
+ {
+ return spinner;
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public void commitEdit()
+ {
+ } /* TODO */
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param spinner DOCUMENT ME!
+ */
+ public void dismiss(JSpinner spinner)
+ {
+ spinner.removeChangeListener(this);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public JFormattedTextField getTextField()
+ {
+ return null;
+ } /* TODO */
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param parent DOCUMENT ME!
+ */
+ public void layoutContainer(Container parent)
+ {
+ } /* TODO */
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param parent DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ return null;
+ } /* TODO */
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param parent DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ return null;
+ } /* TODO */
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param event DOCUMENT ME!
+ */
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ } /* TODO */
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param event DOCUMENT ME!
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ } /* TODO */
+
+ /* no-ops */
+ public void removeLayoutComponent(Component child)
+ {
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param name DOCUMENT ME!
+ * @param child DOCUMENT ME!
+ */
+ public void addLayoutComponent(String name, Component child)
+ {
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ public static class NumberEditor extends DefaultEditor
+ {
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 3791956183098282942L;
+
+ /**
+ * Creates a new NumberEditor object.
+ *
+ * @param spinner DOCUMENT ME!
+ */
+ public NumberEditor(JSpinner spinner)
+ {
+ super(spinner);
+ }
+
+ /**
+ * Creates a new NumberEditor object.
+ *
+ * @param spinner DOCUMENT ME!
+ */
+ public NumberEditor(JSpinner spinner, String decimalFormatPattern)
+ {
+ super(spinner);
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public DecimalFormat getFormat()
+ {
+ return null;
+ }
+
+ public SpinnerNumberModel getModel()
+ {
+ return (SpinnerNumberModel) getSpinner().getModel();
+ }
+ }
+
+ /** DOCUMENT ME! */
+ private SpinnerModel model;
+
+ /** DOCUMENT ME! */
+ private JComponent editor;
+
+ /** DOCUMENT ME! */
+ private EventListenerList listenerList = new EventListenerList();
+
+ /** DOCUMENT ME! */
+ private ChangeListener listener = new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent evt)
+ {
+ fireStateChanged();
+ }
+ };
+
+ /**
+ * Creates a JSpinner with <code>SpinnerNumberModel</code>
+ *
+ * @see javax.swing.SpinnerNumberModel
+ */
+ public JSpinner()
+ {
+ this(new SpinnerNumberModel());
+ }
+
+ /**
+ * Creates a JSpinner with the specific model and sets the default editor
+ *
+ * @param model DOCUMENT ME!
+ */
+ public JSpinner(SpinnerModel model)
+ {
+ this.model = model;
+ model.addChangeListener(listener);
+ setEditor(createEditor(model));
+ updateUI();
+ }
+
+ /**
+ * If the editor is <code>JSpinner.DefaultEditor</code>, then forwards the
+ * call to it, otherwise do nothing.
+ *
+ * @throws ParseException DOCUMENT ME!
+ */
+ public void commitEdit() throws ParseException
+ {
+ if (editor instanceof DefaultEditor)
+ ((DefaultEditor) editor).commitEdit();
+ }
+
+ /**
+ * Gets the current editor
+ *
+ * @return the current editor
+ *
+ * @see #setEditor
+ */
+ public JComponent getEditor()
+ {
+ return editor;
+ }
+
+ /**
+ * Changes the current editor to the new editor. This methods should remove
+ * the old listeners (if any) and adds the new listeners (if any).
+ *
+ * @param editor the new editor
+ *
+ * @throws IllegalArgumentException DOCUMENT ME!
+ *
+ * @see #getEditor
+ */
+ public void setEditor(JComponent editor)
+ {
+ if (editor == null)
+ throw new IllegalArgumentException("editor may not be null");
+
+ if (this.editor instanceof DefaultEditor)
+ ((DefaultEditor) editor).dismiss(this);
+ else if (this.editor instanceof ChangeListener)
+ removeChangeListener((ChangeListener) this.editor);
+
+ if (editor instanceof ChangeListener)
+ addChangeListener((ChangeListener) editor);
+
+ this.editor = editor;
+ }
+
+ /**
+ * Gets the underly model.
+ *
+ * @return the underly model
+ */
+ public SpinnerModel getModel()
+ {
+ return model;
+ }
+
+ /**
+ * Sets a new underlying model.
+ *
+ * @param newModel the new model to set
+ *
+ * @exception IllegalArgumentException if newModel is <code>null</code>
+ */
+ public void setModel(SpinnerModel newModel)
+ {
+ if (newModel == null)
+ throw new IllegalArgumentException();
+
+ if (model == newModel)
+ return;
+
+ SpinnerModel oldModel = model;
+ model = newModel;
+ firePropertyChange("model", oldModel, newModel);
+
+ if (editor == null)
+ setEditor(createEditor(model));
+ }
+
+ /**
+ * Gets the next value without changing the current value.
+ *
+ * @return the next value
+ *
+ * @see javax.swing.SpinnerModel#getNextValue
+ */
+ public Object getNextValue()
+ {
+ return model.getNextValue();
+ }
+
+ /**
+ * Gets the previous value without changing the current value.
+ *
+ * @return the previous value
+ *
+ * @see javax.swing.SpinnerModel#getPreviousValue
+ */
+ public Object getPreviousValue()
+ {
+ return model.getPreviousValue();
+ }
+
+ /**
+ * Gets the <code>SpinnerUI</code> that handles this spinner
+ *
+ * @return the <code>SpinnerUI</code>
+ */
+ public SpinnerUI getUI()
+ {
+ return (SpinnerUI) ui;
+ }
+
+ /**
+ * Gets the current value of the spinner, according to the underly model,
+ * not the UI.
+ *
+ * @return the current value
+ *
+ * @see javax.swing.SpinnerModel#getValue
+ */
+ public Object getValue()
+ {
+ return model.getValue();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param value DOCUMENT ME!
+ */
+ public void setValue(Object value)
+ {
+ model.setValue(value);
+ }
+
+ /**
+ * This method returns a name to identify which look and feel class will be
+ * the UI delegate for this spinner.
+ *
+ * @return The UIClass identifier. "SpinnerUI"
+ */
+ public String getUIClassID()
+ {
+ return "SpinnerUI";
+ }
+
+ /**
+ * This method resets the spinner's UI delegate to the default UI for the
+ * current look and feel.
+ */
+ public void updateUI()
+ {
+ setUI((SpinnerUI) UIManager.getUI(this));
+ }
+
+ /**
+ * This method sets the spinner's UI delegate.
+ *
+ * @param ui The spinner's UI delegate.
+ */
+ public void setUI(SpinnerUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ /**
+ * Adds a <code>ChangeListener</code>
+ *
+ * @param listener the listener to add
+ */
+ public void addChangeListener(ChangeListener listener)
+ {
+ listenerList.add(ChangeListener.class, listener);
+ }
+
+ /**
+ * Remove a particular listener
+ *
+ * @param listener the listener to remove
+ */
+ public void removeChangeListener(ChangeListener listener)
+ {
+ listenerList.remove(ChangeListener.class, listener);
+ }
+
+ /**
+ * Gets all the <code>ChangeListener</code>s
+ *
+ * @return all the <code>ChangeListener</code>s
+ */
+ public ChangeListener[] getChangeListeners()
+ {
+ return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
+ }
+
+ /**
+ * Fires a <code>ChangeEvent</code> to all the <code>ChangeListener</code>s
+ * added to this <code>JSpinner</code>
+ */
+ protected void fireStateChanged()
+ {
+ ChangeEvent evt = new ChangeEvent(this);
+ ChangeListener[] listeners = getChangeListeners();
+
+ for (int i = 0; i < listeners.length; ++i)
+ listeners[i].stateChanged(evt);
+ }
+
+ /**
+ * Creates an editor for this <code>JSpinner</code>. Really, it should be a
+ * <code>JSpinner.DefaultEditor</code>, but since that should be
+ * implemented by a JFormattedTextField, and one is not written, I am just
+ * using a dummy one backed by a JLabel.
+ *
+ * @param model DOCUMENT ME!
+ *
+ * @return the default editor
+ */
+ protected JComponent createEditor(SpinnerModel model)
+ {
+ return new StubEditor(this);
+ } /* TODO */}
diff --git a/javax/swing/JTabbedPane.java b/javax/swing/JTabbedPane.java
index efe1abecc..0f3fbce8b 100644
--- a/javax/swing/JTabbedPane.java
+++ b/javax/swing/JTabbedPane.java
@@ -44,7 +44,6 @@ import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.io.Serializable;
import java.util.Vector;
-
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
@@ -79,12 +78,11 @@ public class JTabbedPane extends JComponent implements Serializable,
protected class AccessibleJTabbedPane extends JComponent.AccessibleJComponent
implements AccessibleSelection, ChangeListener
{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = 7610530885966830483L;
-
+
/**
* Creates a new AccessibleJTabbedPane object.
- *
- * @param c DOCUMENT ME!
*/
public AccessibleJTabbedPane()
{
@@ -226,12 +224,16 @@ public class JTabbedPane extends JComponent implements Serializable,
*/
protected class ModelListener implements ChangeListener, Serializable
{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = 497359819958114132L;
+ /**
+ * Creates a new ModelListener object.
+ */
protected ModelListener()
{
}
-
+
/**
* This method is called whenever the model is changed.
*
@@ -387,7 +389,8 @@ public class JTabbedPane extends JComponent implements Serializable,
return title;
}
- private static final long serialVersionUID = 1614381073220130939L;
+ /** DOCUMENT ME! */
+ private static final long serialVersionUID = 1614381073220130939L;
/**
* This method sets the title of the tab.
@@ -398,7 +401,7 @@ public class JTabbedPane extends JComponent implements Serializable,
{
title = text;
if (title != null && title.length() <= underlinedChar)
- setDisplayedMnemonicIndex(title.length() - 1);
+ setDisplayedMnemonicIndex(title.length() - 1);
}
/**
@@ -817,16 +820,21 @@ public class JTabbedPane extends JComponent implements Serializable,
* This method checks the index.
*
* @param index The index to check.
+ * @param start DOCUMENT ME!
+ * @param end DOCUMENT ME!
+ *
+ * @throws IndexOutOfBoundsException DOCUMENT ME!
*/
private void checkIndex(int index, int start, int end)
{
if (index < start || index >= end)
- throw new IndexOutOfBoundsException("Index < " + start + " || Index >= " + end);
+ throw new IndexOutOfBoundsException("Index < " + start + " || Index >= "
+ + end);
}
/**
- * This method sets the selected index. This method
- * will hide the old component and show the new component.
+ * This method sets the selected index. This method will hide the old
+ * component and show the new component.
*
* @param index The index to set it at.
*/
@@ -839,7 +847,7 @@ public class JTabbedPane extends JComponent implements Serializable,
getSelectedComponent().hide();
if (index != -1 && getComponentAt(index) != null)
getComponentAt(index).show();
- model.setSelectedIndex(index);
+ model.setSelectedIndex(index);
}
}
@@ -867,8 +875,8 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method inserts tabs into JTabbedPane. This includes
- * adding the component to the JTabbedPane and hiding it.
+ * This method inserts tabs into JTabbedPane. This includes adding the
+ * component to the JTabbedPane and hiding it.
*
* @param title The title of the tab.
* @param icon The tab's icon.
@@ -885,11 +893,11 @@ public class JTabbedPane extends JComponent implements Serializable,
// Hide the component so we don't see it. Do it before we parent it
// so we don't trigger a repaint.
if (component != null)
- {
- component.hide();
- super.add(component);
- }
-
+ {
+ component.hide();
+ super.add(component);
+ }
+
if (getSelectedIndex() == -1)
setSelectedIndex(0);
@@ -934,15 +942,14 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method adds a tab to the JTabbedPane.
- * The title of the tab is the Component's name.
- * If the Component is an instance of UIResource, it doesn't
- * add the tab and instead add the component directly to the
+ * This method adds a tab to the JTabbedPane. The title of the tab is the
+ * Component's name. If the Component is an instance of UIResource, it
+ * doesn't add the tab and instead add the component directly to the
* JTabbedPane.
*
* @param component The associated component.
*
- * @return The Component that was added.
+ * @return The Component that was added.
*/
public Component add(Component component)
{
@@ -954,17 +961,16 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method adds a tab to the JTabbedPane.
- * If the Component is an instance of UIResource, it doesn't
- * add the tab and instead add the component directly to the
- * JTabbedPane.
+ * This method adds a tab to the JTabbedPane. If the Component is an
+ * instance of UIResource, it doesn't add the tab and instead add the
+ * component directly to the JTabbedPane.
*
* @param title The title of the tab.
* @param component The associated component.
*
* @return The Component that was added.
*/
- public Component add(String title, Component component)
+ public Component add(String title, Component component)
{
if (component instanceof UIResource)
super.add(component);
@@ -974,10 +980,9 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method adds a tab to the JTabbedPane.
- * If the Component is an instance of UIResource, it doesn't
- * add the tab and instead add the component directly to the
- * JTabbedPane.
+ * This method adds a tab to the JTabbedPane. If the Component is an
+ * instance of UIResource, it doesn't add the tab and instead add the
+ * component directly to the JTabbedPane.
*
* @param component The associated component.
* @param index The index to insert the tab at.
@@ -994,12 +999,11 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method adds a tab to the JTabbedPane.
- * If the Component is an instance of UIResource, it doesn't
- * add the tab and instead add the component directly to the
- * JTabbedPane. If the constraints object is an icon, it
- * will be used as the tab's icon. If the constraints object
- * is a string, we will use it as the title.
+ * This method adds a tab to the JTabbedPane. If the Component is an
+ * instance of UIResource, it doesn't add the tab and instead add the
+ * component directly to the JTabbedPane. If the constraints object is an
+ * icon, it will be used as the tab's icon. If the constraints object is a
+ * string, we will use it as the title.
*
* @param component The associated component.
* @param constraints The constraints object.
@@ -1010,12 +1014,11 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method adds a tab to the JTabbedPane.
- * If the Component is an instance of UIResource, it doesn't
- * add the tab and instead add the component directly to the
- * JTabbedPane. If the constraints object is an icon, it
- * will be used as the tab's icon. If the constraints object
- * is a string, we will use it as the title.
+ * This method adds a tab to the JTabbedPane. If the Component is an
+ * instance of UIResource, it doesn't add the tab and instead add the
+ * component directly to the JTabbedPane. If the constraints object is an
+ * icon, it will be used as the tab's icon. If the constraints object is a
+ * string, we will use it as the title.
*
* @param component The associated component.
* @param constraints The constraints object.
@@ -1037,27 +1040,25 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * The tab and it's associated component are removed. After
- * the component has been removed from the JTabbedPane, it's
- * set visible to ensure that it can be seen.
+ * The tab and it's associated component are removed. After the component
+ * has been removed from the JTabbedPane, it's set visible to ensure that
+ * it can be seen.
*
* @param index The index of the tab to remove.
- *
- * @throws IndexOutOfBoundsException If the index is not in range.
*/
public void removeTabAt(int index)
{
checkIndex(index, 0, tabs.size());
Component c = getComponentAt(index);
- super.remove(c);
+ super.remove(index);
c.show();
tabs.remove(index);
}
/**
- * This method removes the component from the JTabbedPane. After
- * the component has been removed from the JTabbedPane, it's
- * set visible to ensure that it can be seen.
+ * This method removes the component from the JTabbedPane. After the
+ * component has been removed from the JTabbedPane, it's set visible to
+ * ensure that it can be seen.
*
* @param component The Component to remove.
*/
@@ -1071,8 +1072,8 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method removes the tab and component from the JTabbedPane.
- * It simply calls removeTabAt(int index).
+ * This method removes the tab and component from the JTabbedPane. It simply
+ * calls removeTabAt(int index).
*
* @param index The index of the tab to remove.
*/
@@ -1082,8 +1083,8 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method removes all tabs and associated components
- * from the JTabbedPane.
+ * This method removes all tabs and associated components from the
+ * JTabbedPane.
*/
public void removeAll()
{
@@ -1102,8 +1103,7 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method returns the number of runs used
- * to paint the JTabbedPane.
+ * This method returns the number of runs used to paint the JTabbedPane.
*
* @return The number of runs.
*/
@@ -1204,8 +1204,8 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method returns whether this tab is enabled.
- * Disabled tabs cannot be selected.
+ * This method returns whether this tab is enabled. Disabled tabs cannot be
+ * selected.
*
* @param index The index of the tab.
*
@@ -1244,8 +1244,7 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method returns the bounds of the tab given
- * the index.
+ * This method returns the bounds of the tab given the index.
*
* @param index The index of the tab.
*
@@ -1441,9 +1440,9 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method returns a tab index given an (x,y) location. The origin
- * of the (x,y) pair will be the JTabbedPane's top left position. The
- * tab returned will be the one that contains the point. This method is
+ * This method returns a tab index given an (x,y) location. The origin of
+ * the (x,y) pair will be the JTabbedPane's top left position. The tab
+ * returned will be the one that contains the point. This method is
* delegated to the UI.
*
* @param x The x coordinate of the point.
@@ -1470,8 +1469,8 @@ public class JTabbedPane extends JComponent implements Serializable,
}
/**
- * This method returns a string representation of this JTabbedPane. It
- * is mainly used for debugging purposes.
+ * This method returns a string representation of this JTabbedPane. It is
+ * mainly used for debugging purposes.
*
* @return A string representation of this JTabbedPane.
*/
diff --git a/javax/swing/JTable.java b/javax/swing/JTable.java
index 9a3413213..97114a97a 100644
--- a/javax/swing/JTable.java
+++ b/javax/swing/JTable.java
@@ -39,12 +39,14 @@ exception statement from your version. */
package javax.swing;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.Rectangle;
import java.util.Hashtable;
import java.util.Vector;
import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleContext;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ListSelectionEvent;
@@ -53,11 +55,14 @@ import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
+import javax.swing.plaf.TableUI;
import javax.swing.table.DefaultTableColumnModel;
+import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel;
import javax.swing.table.TableModel;
@@ -66,34 +71,259 @@ public class JTable extends JComponent
ListSelectionListener, CellEditorListener, Accessible
{
private static final long serialVersionUID = 3876025080382781659L;
+
+
+ /**
+ * When resizing columns, do not automatically change any columns. In this
+ * case the table should be enclosed in a {@link JScrollPane} in order to
+ * accomodate cases in which the table size exceeds its visible area.
+ */
+ public static final int AUTO_RESIZE_OFF = 0;
+
+ /**
+ * When resizing column <code>i</code>, automatically change only the
+ * single column <code>i+1</code> to provide or absorb excess space
+ * requirements.
+ */
+ public static final int AUTO_RESIZE_NEXT_COLUMN = 1;
+
+ /**
+ * When resizing column <code>i</code> in a table of <code>n</code>
+ * columns, automatically change all columns in the range <code>[i+1,
+ * n)</code>, uniformly, to provide or absorb excess space requirements.
+ */
+ public static final int AUTO_RESIZE_SUBSEQUENT_COLUMNS = 2;
+ /**
+ * When resizing column <code>i</code> in a table of <code>n</code>
+ * columns, automatically change all columns in the range <code>[0,
+ * n)</code> (with the exception of column i) uniformly, to provide or
+ * absorb excess space requirements.
+ */
public static final int AUTO_RESIZE_ALL_COLUMNS = 4;
+
+ /**
+ * When resizing column <code>i</code> in a table of <code>n</code>
+ * columns, automatically change column <code>n-1</code> (the last column
+ * in the table) to provide or absorb excess space requirements.
+ */
public static final int AUTO_RESIZE_LAST_COLUMN = 3;
- public static final int AUTO_RESIZE_NEXT_COLUMN = 1;
- public static final int AUTO_RESIZE_OFF = 0;
- public static final int AUTO_RESIZE_SUBSEQUENT_COLUMNS = 2;
- protected boolean autoCreateColumnsFromModel;
- protected int autoResizeMode;
- protected TableCellEditor cellEditor;
- protected boolean cellSelectionEnabled;
- protected TableColumnModel columnModel;
- protected TableModel dataModel;
+
+ /**
+ * A table mapping {@link java.lang.Class} objects to
+ * {@link TableCellEditor} objects. This table is consulted by the
+ *
+ */
protected Hashtable defaultEditorsByColumnClass;
protected Hashtable defaultRenderersByColumnClass;
protected int editingColumn;
protected int editingRow;
- protected Color gridColor;
- protected Dimension preferredViewportSize;
+
+ /**
+ * Whether or not the table should automatically compute a matching
+ * {@link TableColumnModel} and assign it to the {@link #columnModel}
+ * property when the {@link #dataModel} property is changed.
+ *
+ * @see #setModel()
+ * @see #createColumnsFromModel()
+ * @see #setColumnModel()
+ * @see #setAutoCreateColumnsFromModel()
+ * @see #getAutoCreateColumnsFromModel()
+ */
+ protected boolean autoCreateColumnsFromModel;
+
+ /**
+ * A numeric code specifying the resizing behavior of the table. Must be
+ * one of {@link #AUTO_RESIZE_ALL_COLUMNS} (the default), {@link
+ * #AUTO_RESIZE_LAST_COLUMN}, {@link #AUTO_RESIZE_NEXT_COLUMN}, {@link
+ * #AUTO_RESIZE_SUBSEQUENT_COLUMNS}, or {@link #AUTO_RESIZE_OFF}.
+ *
+ * @see #doLayout()
+ * @see #setAutoResizeMode()
+ * @see #getAutoResizeMode()
+ */
+ protected int autoResizeMode;
+
+ /**
+ * The height in pixels of any row of the table. All rows in a table are
+ * of uniform height. This differs from column width, which varies on a
+ * per-column basis, and is stored in the individual columns of the
+ * {@link #columnModel}.
+ *
+ * @see #getRowHeight()
+ * @see #setRowHeight()
+ * @see TableColumn#getWidth()
+ * @see TableColumn#setWidth()
+ */
protected int rowHeight;
+
+ /**
+ * The height in pixels of the gap left between any two rows of the table.
+ *
+ * @see #setRowMargin()
+ * @see #getRowHeight()
+ * @see #getInterCellSpacing()
+ * @see #setInterCellSpacing()
+ * @see TableColumnModel#getColumnMargin()
+ * @see TableColumnModel#setColumnMargin()
+ */
protected int rowMargin;
+
+ /**
+ * Whether or not the table should allow row selection. If the table
+ * allows both row <em>and</em> column selection, it is said to allow
+ * "cell selection". Previous versions of the JDK supported cell
+ * selection as an independent concept, but it is now represented solely
+ * in terms of simultaneous row and column selection.
+ *
+ * @see TableColumnModel#columnSelectionAllowed()
+ * @see #setRowSelectionAllowed()
+ * @see #getRowSelectionAllowed()
+ * @see #getCellSelectionEnabled()
+ * @see #setCellSelectionEnabled()
+ */
protected boolean rowSelectionAllowed;
- protected Color selectionBackground;
- protected Color selectionForeground;
+
+ /**
+ * @deprecated Use {@link #rowSelectionAllowed}, {@link
+ * #columnSelectionAllowed}, or the combined methods {@link
+ * getCellSelectionEnabled} and {@link setCellSelectionEnabled}.
+ */
+ protected boolean cellSelectionEnabled;
+
+ /**
+ * The model for data stored in the table. Confusingly, the published API
+ * requires that this field be called <code>dataModel</code>, despite its
+ * property name. The table listens to its model as a {@link
+ * TableModelListener}.
+ *
+ * @see #tableChanged()
+ * @see TableModel#addTableModelListener()
+ */
+ protected TableModel dataModel;
+
+ /**
+ * <p>A model of various aspects of the columns of the table, <em>not
+ * including</em> the data stored in them. The {@link TableColumnModel}
+ * is principally concerned with holding a set of {@link TableColumn}
+ * objects, each of which describes the display parameters of a column
+ * and the numeric index of the column from the data model which the
+ * column is presenting.</p>
+ *
+ * <p>The TableColumnModel also contains a {@link ListSelectionModel} which
+ * indicates which columns are currently selected. This selection model
+ * works in combination with the {@link selectionModel} of the table
+ * itself to specify a <em>table selection</em>: a combination of row and
+ * column selections.</p>
+ *
+ * <p>Most application programmers do not need to work with this property
+ * at all: setting {@link #autoCreateColumnsFromModel} will construct the
+ * columnModel automatically, and the table acts as a facade for most of
+ * the interesting properties of the columnModel anyways.</p>
+ *
+ * @see #setColumnModel()
+ * @see #getColumnModel()
+ */
+ protected TableColumnModel columnModel;
+
+ /**
+ * A model of the rows of this table which are currently selected. This
+ * model is used in combination with the column selection model held as a
+ * member of the {@link columnModel} property, to represent the rows and
+ * columns (or both: cells) of the table which are currently selected.
+ *
+ * @see #rowSelectionAllowed
+ * @see #setSelectionModel()
+ * @see #getSelectionModel()
+ * @see TableColumnModel#getSelectionModel()
+ * @see ListSelectionModel#addListSelectionListener()
+ */
protected ListSelectionModel selectionModel;
+
+ /**
+ * The accessibleContext property.
+ */
+ protected AccessibleContext accessibleContext;
+
+ /**
+ * The current cell editor.
+ */
+ protected TableCellEditor cellEditor;
+
+ /**
+ * Whether or not drag-and-drop is enabled on this table.
+ *
+ * @see #setDragEnabled()
+ * @see #getDragEnabled()
+ */
+ protected boolean dragEnabled;
+
+ /**
+ * The color to paint the grid lines of the table, when either {@link
+ * #showHorizontalLines} or {@link #showVerticalLines} is set.
+ *
+ * @see #setGridColor()
+ * @see #getGridColor()
+ */
+ protected Color gridColor;
+
+ /**
+ * The size this table would prefer its viewport assume, if it is
+ * contained in a {@link JScrollPane}.
+ *
+ * @see #setPreferredScrollableViewportSize()
+ * @see #getPreferredScrollableViewportSize()
+ */
+ protected Dimension preferredScrollableViewportSize;
+
+ /**
+ * The color to paint the background of selected cells. Fires a property
+ * change event with name {@link #SELECTION_BACKGROUND_CHANGED_PROPERTY}
+ * when its value changes.
+ *
+ * @see #setSelectionBackground()
+ * @see #getSelectionBackground()
+ */
+ Color selectionBackground;
+
+ /**
+ * The name carried in property change events when the {@link
+ * #selectionBackground} property changes.
+ */
+ private static final String SELECTION_BACKGROUND_CHANGED_PROPERTY = "selectionBackground";
+
+ /**
+ * The color to paint the foreground of selected cells. Fires a property
+ * change event with name {@link #SELECTION_FOREGROUND_CHANGED_PROPERTY}
+ * when its value changes.
+ *
+ * @see #setSelectionForeground()
+ * @see #getSelectionForeground()
+ */
+ Color selectionForeground;
+
+ /**
+ * The name carried in property change events when the
+ * {@link #selectionForeground} property changes.
+ */
+ private static final String SELECTION_FOREGROUND_CHANGED_PROPERTY = "selectionForeground";
+
+ /**
+ * The showHorizontalLines property.
+ */
protected boolean showHorizontalLines;
+
+ /**
+ * The showVerticalLines property.
+ */
protected boolean showVerticalLines;
+
+ /**
+ * The tableHeader property.
+ */
protected JTableHeader tableHeader;
+
/**
* Creates a new <code>JTable</code> instance.
@@ -156,8 +386,33 @@ public class JTable extends JComponent
public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm)
{
this.dataModel = dm == null ? createDefaultDataModel() : dm;
- this.columnModel = cm == null ? createDefaultColumnModel() : cm;
- this.selectionModel = sm == null ? createDefaultListSelectionModel() : sm;
+ setSelectionModel(sm == null ? createDefaultListSelectionModel() : sm);
+
+ this.columnModel = cm;
+ this.autoCreateColumnsFromModel = false;
+ if (cm == null)
+ {
+ this.autoCreateColumnsFromModel = true;
+ createColumnsFromModel();
+ }
+ this.columnModel.addColumnModelListener(this);
+
+ this.defaultRenderersByColumnClass = new Hashtable();
+ this.defaultEditorsByColumnClass = new Hashtable();
+
+ this.autoResizeMode = AUTO_RESIZE_ALL_COLUMNS;
+ this.rowHeight = 16;
+ this.rowMargin = 1;
+ this.rowSelectionAllowed = true;
+ // this.accessibleContext = new AccessibleJTable();
+ this.cellEditor = null;
+ this.dragEnabled = false;
+ this.preferredScrollableViewportSize = new Dimension(450,400);
+ this.showHorizontalLines = true;
+ this.showVerticalLines = true;
+ setInterCellSpacing(new Dimension(1,1));
+ setTableHeader(new JTableHeader(columnModel));
+ updateUI();
}
/**
@@ -178,216 +433,1159 @@ public class JTable extends JComponent
{
return new JScrollPane(table);
}
+
+ protected TableColumnModel createDefaultColumnModel()
+ {
+ return new DefaultTableColumnModel();
+ }
- public void clearSelection()
+ protected TableModel createDefaultDataModel()
{
- selectionModel.clearSelection();
+ return new DefaultTableModel();
}
+ protected ListSelectionModel createDefaultListSelectionModel()
+ {
+ return new DefaultListSelectionModel();
+ }
+
+ private void createColumnsFromModel()
+ {
+ if (dataModel == null)
+ return;
+
+ TableColumnModel cm = createDefaultColumnModel();
+
+ for (int i = 0; i < dataModel.getColumnCount(); ++i)
+ {
+ cm.addColumn(new TableColumn(i));
+ }
+ this.setColumnModel(cm);
+ }
+
+ // listener support
+
public void columnAdded (TableColumnModelEvent event)
{
- throw new Error ("Not implemented");
+ revalidate();
+ repaint();
}
public void columnMarginChanged (ChangeEvent event)
{
- throw new Error ("Not implemented");
+ revalidate();
+ repaint();
}
-
+
public void columnMoved (TableColumnModelEvent event)
{
- throw new Error ("Not implemented");
+ revalidate();
+ repaint();
}
-
+
public void columnRemoved (TableColumnModelEvent event)
{
- throw new Error ("Not implemented");
+ revalidate();
+ repaint();
}
public void columnSelectionChanged (ListSelectionEvent event)
{
- throw new Error ("Not implemented");
+ repaint();
}
-
- protected TableColumnModel createDefaultColumnModel()
+
+ public void editingCanceled (ChangeEvent event)
{
- return new DefaultTableColumnModel();
+ repaint();
}
- protected TableModel createDefaultDataModel()
+ public void editingStopped (ChangeEvent event)
{
- return new DefaultTableModel();
+ repaint();
}
- protected ListSelectionModel createDefaultListSelectionModel()
+ public void tableChanged (TableModelEvent event)
{
- return new DefaultListSelectionModel();
+ repaint();
}
- public void editingCanceled (ChangeEvent event)
+ public void valueChanged (ListSelectionEvent event)
{
- throw new Error ("Not implemented");
+ repaint();
}
- public void editingStopped (ChangeEvent event)
+
+ /**
+ * Calculate the visible rectangle for a particular row and column. The
+ * row and column are specified in visual terms; the column may not match
+ * the {@link #dataModel} column.
+ *
+ * @param row the visible row to get the cell rectangle of
+ *
+ * @param column the visible column to get the cell rectangle of, which may
+ * differ from the {@link #dataModel} column
+ *
+ * @param includeSpacing whether or not to include the cell margins in the
+ * resulting cell. If <code>false</code>, the result will only contain the
+ * inner area of the target cell, not including its margins.
+ *
+ * @return a rectangle enclosing the specified cell
+ */
+ public Rectangle getCellRect(int row,
+ int column,
+ boolean includeSpacing)
{
- throw new Error ("Not implemented");
+ int height = getHeight();
+ int width = columnModel.getColumn(column).getWidth();
+ int x_gap = columnModel.getColumnMargin();
+ int y_gap = rowMargin;
+
+ column = Math.max(0, Math.min(column, getColumnCount() - 1));
+ row = Math.max(0, Math.min(row, getRowCount() - 1));
+
+ int x = 0;
+ int y = (height + y_gap) * row;
+
+ for (int i = 0; i < column; ++i)
+ {
+ x += columnModel.getColumn(i).getWidth();
+ x += x_gap;
+ }
+
+ if (includeSpacing)
+ return new Rectangle(x, y, width, height);
+ else
+ return new Rectangle(x, y, width - x_gap, height - y_gap);
}
- public TableColumnModel getColumnModel ()
+ public void clearSelection()
{
- return columnModel;
+ selectionModel.clearSelection();
+ }
+
+ /**
+ * Get the value of the {@link #selectedRow} property by delegation to
+ * the {@link ListSelectionModel#getMinSelectionIndex} method of the
+ * {@link #selectionModel} field.
+ *
+ * @return The current value of the selectedRow property
+ */
+ public int getSelectedRow ()
+ {
+ return selectionModel.getMinSelectionIndex();
}
- public TableModel getModel()
+ /**
+ * Get the value of the {@link #selectionModel} property.
+ *
+ * @return The current value of the property
+ */
+ public ListSelectionModel getSelectionModel()
{
- return dataModel;
+ if (! rowSelectionAllowed)
+ return null;
+
+ return selectionModel;
}
- public Dimension getPreferredScrollableViewportSize ()
+ public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
{
- throw new Error ("Not implemented");
+ if (orientation == SwingConstants.VERTICAL)
+ return visibleRect.height * direction;
+ else
+ return visibleRect.width * direction;
}
- public int getScrollableBlockIncrement (Rectangle visibleRect, int orientation, int direction)
+ /**
+ * Get the value of the {@link #scrollableTracksViewportHeight} property.
+ *
+ * @return The constant value <code>false</code>
+ */
+
+ public boolean getScrollableTracksViewportHeight()
{
- throw new Error ("Not implemented");
+ return false;
}
+
+ /**
+ * Get the value of the {@link #scrollableTracksViewportWidth} property.
+ *
+ * @return <code>true</code> unless the {@link autoResizeMode} prperty is
+ * <code>AUTO_RESIZE_OFF</code>
+ */
- public boolean getScrollableTracksViewportHeight ()
+ public boolean getScrollableTracksViewportWidth()
{
- throw new Error ("Not implemented");
+ if (autoResizeMode == AUTO_RESIZE_OFF)
+ return false;
+ else
+ return true;
}
-
- public boolean getScrollableTracksViewportWidth ()
+
+ public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
{
- throw new Error ("Not implemented");
+ // FIXME: I don't exactly know what sun does here. in both cases they
+ // pick values which do *not* simply expose the next cell in a given
+ // scroll direction.
+
+ if (orientation == SwingConstants.VERTICAL)
+ return rowHeight;
+ else
+ {
+ int sum = 0;
+ for (int i = 0; i < getColumnCount(); ++i)
+ sum += columnModel.getColumn(0).getWidth();
+ return getColumnCount() == 0 ? 10 : sum / getColumnCount();
+ }
}
- public int getScrollableUnitIncrement (Rectangle visibleRect, int orientation, int direction)
+
+ public TableCellEditor getCellEditor(int row, int column)
{
- throw new Error ("Not implemented");
+ TableCellEditor editor = columnModel.getColumn(column).getCellEditor();
+
+ if (editor == null)
+ editor = getDefaultEditor(dataModel.getColumnClass(column));
+
+ return editor;
}
- public int getSelectedRow ()
+ public TableCellEditor getDefaultEditor(Class columnClass)
{
- return selectionModel.getMinSelectionIndex();
+ if (defaultEditorsByColumnClass.containsKey(columnClass))
+ return (TableCellEditor) defaultEditorsByColumnClass.get(columnClass);
+ else
+ {
+ TableCellEditor r = new DefaultCellEditor(new JTextField());
+ defaultEditorsByColumnClass.put(columnClass, r);
+ return r;
+ }
}
-
- public ListSelectionModel getSelectionModel ()
+
+
+
+ public TableCellRenderer getCellRenderer(int row, int column)
{
- if (! rowSelectionAllowed)
- return null;
+ TableCellRenderer renderer =
+ columnModel.getColumn(column).getCellRenderer();
+
+ if (renderer == null)
+ renderer = getDefaultRenderer(dataModel.getColumnClass(column));
+
+ return renderer;
+ }
- return selectionModel;
+ public TableCellRenderer getDefaultRenderer(Class columnClass)
+ {
+ if (defaultRenderersByColumnClass.containsKey(columnClass))
+ return (TableCellRenderer) defaultRenderersByColumnClass.get(columnClass);
+ else
+ {
+ TableCellRenderer r = new DefaultTableCellRenderer();
+ defaultRenderersByColumnClass.put(columnClass, r);
+ return r;
+ }
}
- public void tableChanged (TableModelEvent event)
+ public int convertColumnIndexToModel(int vc)
{
- throw new Error ("Not implemented");
+ if (vc < 0)
+ return vc;
+ else if (vc > getColumnCount())
+ return -1;
+ else
+ return columnModel.getColumn(vc).getModelIndex();
}
- public void setModel (TableModel model)
+ public int convertColumnIndexToView(int mc)
{
- if (model == null)
- throw new IllegalArgumentException();
+ if (mc < 0)
+ return mc;
+ int ncols = getColumnCount();
+ for (int vc = 0; vc < ncols; ++vc)
+ {
+ if (columnModel.getColumn(vc).getModelIndex() == mc)
+ return vc;
+ }
+ return -1;
+ }
- // FIXME: Should we deregister from old model ?
+ public Component prepareRenderer(TableCellRenderer renderer,
+ int row,
+ int column)
+ {
+ boolean rsa = getRowSelectionAllowed();
+ boolean csa = getColumnSelectionAllowed();
+ boolean rs = rsa ? getSelectionModel().isSelectedIndex(row) : false;
+ boolean cs = csa ? columnModel.getSelectionModel().isSelectedIndex(column) : false;
+ boolean isSelected = ((rsa && csa && rs && cs)
+ || (rsa && !csa && rs)
+ || (!rsa && csa && cs));
- dataModel = model;
- dataModel.addTableModelListener(this);
+ return renderer.getTableCellRendererComponent(this,
+ dataModel.getValueAt(row,
+ convertColumnIndexToView(column)),
+ isSelected,
+ false, // hasFocus
+ row, column);
}
- public void setSelectionMode (int selectionMode)
+
+ /**
+ * Get the value of the {@link #autoCreateColumnsFromModel} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getAutoCreateColumnsFromModel()
{
- throw new Error ("Not implemented");
+ return autoCreateColumnsFromModel;
}
- public void setSelectionModel (ListSelectionModel model)
+ /**
+ * Get the value of the {@link #autoResizeMode} property.
+ *
+ * @return The current value of the property
+ */
+ public int getAutoResizeMode()
{
- if (model == null)
- throw new IllegalArgumentException();
+ return autoResizeMode;
+ }
- // FIXME: Should we deregister from old model ?
-
- selectionModel = model;
- selectionModel.addListSelectionListener(this);
+ /**
+ * Get the value of the {@link #rowHeight} property.
+ *
+ * @return The current value of the property
+ */
+ public int getRowHeight()
+ {
+ return rowHeight;
}
- public void setShowGrid (boolean showGrid)
+ /**
+ * Get the value of the {@link #rowMargin} property.
+ *
+ * @return The current value of the property
+ */
+ public int getRowMargin()
{
- throw new Error ("Not implemented");
+ return rowMargin;
}
- public void valueChanged (ListSelectionEvent event)
+ /**
+ * Get the value of the {@link #rowSelectionAllowed} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getRowSelectionAllowed()
{
- throw new Error ("Not implemented");
+ return rowSelectionAllowed;
}
- public JTableHeader getTableHeader()
+ /**
+ * Get the value of the {@link #cellSelectionEnabled} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getCellSelectionEnabled()
{
- return tableHeader;
+ return getColumnSelectionAllowed() && getRowSelectionAllowed();
+ }
+
+ /**
+ * Get the value of the {@link #dataModel} property.
+ *
+ * @return The current value of the property
+ */
+ public TableModel getModel()
+ {
+ return dataModel;
+ }
+
+ /**
+ * Get the value of the {@link #columnCount} property by
+ * delegation to the @{link #dataModel} field.
+ *
+ * @return The current value of the columnCount property
+ */
+ public int getColumnCount()
+ {
+ return dataModel.getColumnCount();
+ }
+
+ /**
+ * Get the value of the {@link #rowCount} property by
+ * delegation to the @{link #dataModel} field.
+ *
+ * @return The current value of the rowCount property
+ */
+ public int getRowCount()
+ {
+ return dataModel.getRowCount();
+ }
+
+ /**
+ * Get the value of the {@link #columnModel} property.
+ *
+ * @return The current value of the property
+ */
+ public TableColumnModel getColumnModel()
+ {
+ return columnModel;
+ }
+
+ /**
+ * Get the value of the {@link #selectedColumn} property by
+ * delegation to the @{link #columnModel} field.
+ *
+ * @return The current value of the selectedColumn property
+ */
+ public int getSelectedColumn()
+ {
+ return columnModel.getSelectionModel().getMinSelectionIndex();
+ }
+
+ private static int countSelections(ListSelectionModel lsm)
+ {
+ int lo = lsm.getMinSelectionIndex();
+ int hi = lsm.getMaxSelectionIndex();
+ int sum = 0;
+ if (lo != -1 && hi != -1)
+ {
+ switch (lsm.getSelectionMode())
+ {
+ case ListSelectionModel.SINGLE_SELECTION:
+ sum = 1;
+ break;
+
+ case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
+ sum = hi - lo;
+ break;
+
+ case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:
+ for (int i = lo; i < hi; ++i)
+ if (lsm.isSelectedIndex(i))
+ ++sum;
+ break;
+ }
+ }
+ return sum;
+ }
+
+ private static int[] getSelections(ListSelectionModel lsm)
+ {
+ int sz = countSelections(lsm);
+ int [] ret = new int[sz];
+
+ int lo = lsm.getMinSelectionIndex();
+ int hi = lsm.getMaxSelectionIndex();
+ int j = 0;
+ java.util.ArrayList ls = new java.util.ArrayList();
+ if (lo != -1 && hi != -1)
+ {
+ switch (lsm.getSelectionMode())
+ {
+ case ListSelectionModel.SINGLE_SELECTION:
+ ret[0] = lo;
+ break;
+
+ case ListSelectionModel.SINGLE_INTERVAL_SELECTION:
+ for (int i = lo; i < hi; ++i)
+ ret[j++] = i;
+ break;
+
+ case ListSelectionModel.MULTIPLE_INTERVAL_SELECTION:
+ for (int i = lo; i < hi; ++i)
+ if (lsm.isSelectedIndex(i))
+ ret[j++] = i;
+ break;
+ }
+ }
+ return ret;
+ }
+
+ /**
+ * Get the value of the {@link #selectedColumnCount} property by
+ * delegation to the @{link #columnModel} field.
+ *
+ * @return The current value of the selectedColumnCount property
+ */
+ public int getSelectedColumnCount()
+ {
+ return countSelections(columnModel.getSelectionModel());
}
- public void setTableHeader(JTableHeader newHeader)
+ /**
+ * Get the value of the {@link #selectedColumns} property by
+ * delegation to the @{link #columnModel} field.
+ *
+ * @return The current value of the selectedColumns property
+ */
+ public int[] getSelectedColumns()
{
- tableHeader = newHeader;
+ return getSelections(columnModel.getSelectionModel());
}
+ /**
+ * Get the value of the {@link #columnSelectionAllowed} property.
+ *
+ * @return The current value of the columnSelectionAllowed property
+ */
public boolean getColumnSelectionAllowed()
{
- return columnModel.getColumnSelectionAllowed();
+ return getColumnModel().getColumnSelectionAllowed();
}
-
- public void setColumnSelectionAllowed(boolean flag)
+
+ /**
+ * Get the value of the {@link #selectedRowCount} property by
+ * delegation to the @{link #selectionModel} field.
+ *
+ * @return The current value of the selectedRowCount property
+ */
+ public int getSelectedRowCount()
{
- columnModel.setColumnSelectionAllowed(flag);
+ return countSelections(selectionModel);
}
- public boolean getRowSelectionAllowed()
+ /**
+ * Get the value of the {@link #selectedRows} property by
+ * delegation to the @{link #selectionModel} field.
+ *
+ * @return The current value of the selectedRows property
+ */
+ public int[] getSelectedRows()
{
- return rowSelectionAllowed;
+ return getSelections(selectionModel);
}
-
- public void setRowSelectionAllowed(boolean flag)
+
+ /**
+ * Get the value of the {@link #accessibleContext} property.
+ *
+ * @return The current value of the property
+ */
+ public AccessibleContext getAccessibleContext()
{
- rowSelectionAllowed = flag;
+ return accessibleContext;
}
- public int getAutoResizeMode()
+ /**
+ * Get the value of the {@link #cellEditor} property.
+ *
+ * @return The current value of the property
+ */
+ public TableCellEditor getCellEditor()
{
- return autoResizeMode;
+ return cellEditor;
}
- public void setAutoResizeMode(int mode)
+ /**
+ * Get the value of the {@link #dragEnabled} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getDragEnabled()
{
- autoResizeMode = mode;
+ return dragEnabled;
}
- public int getColumnCount()
+ /**
+ * Get the value of the {@link #gridColor} property.
+ *
+ * @return The current value of the property
+ */
+ public Color getGridColor()
{
- return dataModel.getColumnCount();
+ return gridColor;
}
- public int getRowCount()
+ /**
+ * Get the value of the {@link #interCellSpacing} property.
+ *
+ * @return The current value of the property
+ */
+ public Dimension getInterCellSpacing()
{
- return dataModel.getRowCount();
+ return new Dimension(columnModel.getColumnMargin(), rowMargin);
}
- public TableCellRenderer getCellRenderer(int row, int column)
+ /**
+ * Get the value of the {@link #preferredScrollableViewportSize} property.
+ *
+ * @return The current value of the property
+ */
+ public Dimension getPreferredScrollableViewportSize()
{
- TableCellRenderer renderer =
- columnModel.getColumn(column).getCellRenderer();
+ return preferredScrollableViewportSize;
+ }
+
+ /**
+ * Get the value of the {@link #selectionBackground} property.
+ *
+ * @return The current value of the property
+ */
+ public Color getSelectionBackground()
+ {
+ return selectionBackground;
+ }
+
+ /**
+ * Get the value of the {@link #selectionForeground} property.
+ *
+ * @return The current value of the property
+ */
+ public Color getSelectionForeground()
+ {
+ return selectionForeground;
+ }
+
+ /**
+ * Get the value of the {@link #showHorizontalLines} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getShowHorizontalLines()
+ {
+ return showHorizontalLines;
+ }
+
+ /**
+ * Get the value of the {@link #showVerticalLines} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getShowVerticalLines()
+ {
+ return showVerticalLines;
+ }
+
+ /**
+ * Get the value of the {@link #tableHeader} property.
+ *
+ * @return The current value of the property
+ */
+ public JTableHeader getTableHeader()
+ {
+ return tableHeader;
+ }
+
+ /**
+ * Set the value of the {@link #autoCreateColumnsFromModel} property.
+ *
+ * @param a The new value of the autoCreateColumnsFromModel property
+ */
+ public void setAutoCreateColumnsFromModel(boolean a)
+ {
+ autoCreateColumnsFromModel = a;
+ }
+
+ /**
+ * Set the value of the {@link #autoResizeMode} property.
+ *
+ * @param a The new value of the autoResizeMode property
+ */
+ public void setAutoResizeMode(int a)
+ {
+ autoResizeMode = a;
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #rowHeight} property.
+ *
+ * @param r The new value of the rowHeight property
+ */
+ public void setRowHeight(int r)
+ {
+ rowHeight = r;
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #rowMargin} property.
+ *
+ * @param r The new value of the rowMargin property
+ */
+ public void setRowMargin(int r)
+ {
+ rowMargin = r;
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #rowSelectionAllowed} property.
+ *
+ * @param r The new value of the rowSelectionAllowed property
+ */
+ public void setRowSelectionAllowed(boolean r)
+ {
+ rowSelectionAllowed = r;
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #cellSelectionEnabled} property.
+ *
+ * @param c The new value of the cellSelectionEnabled property
+ */
+ public void setCellSelectionEnabled(boolean c)
+ {
+ setColumnSelectionAllowed(c);
+ setRowSelectionAllowed(c);
+ // for backward-compatibility sake:
+ cellSelectionEnabled = true;
+ }
+
+ /**
+ * <p>Set the value of the {@link #dataModel} property.</p>
+ *
+ * <p>Unregister <code>this</code> as a {@link TableModelListener} from
+ * previous {@link #dataModel} and register it with new parameter
+ * <code>m</code>.</p>
+ *
+ * @param m The new value of the model property
+ */
+ public void setModel(TableModel m)
+ {
+ // Throw exception is m is null.
+ if (m == null)
+ throw new IllegalArgumentException();
+
+ // Don't do anything if setting the current model again.
+ if (dataModel == m)
+ return;
- if (renderer == null)
- renderer = getDefaultRenderer(dataModel.getColumnClass(column));
+ // Remove table as TableModelListener from old model.
+ if (dataModel != null)
+ dataModel.removeTableModelListener(this);
- return renderer;
+ if (m != null)
+ {
+ // Set property.
+ dataModel = m;
+
+ // Add table as TableModelListener to new model.
+ dataModel.addTableModelListener(this);
+
+ // Automatically create columns.
+ if (autoCreateColumnsFromModel)
+ createColumnsFromModel();
+ }
+
+ // Repaint table.
+ revalidate();
+ repaint();
}
- public TableCellRenderer getDefaultRenderer(Class columnClass)
+ /**
+ * <p>Set the value of the {@link #columnModel} property.</p>
+ *
+ * <p>Unregister <code>this</code> as a {@link TableColumnModelListener}
+ * from previous {@link #columnModel} and register it with new parameter
+ * <code>c</code>.</p>
+ *
+ * @param c The new value of the columnModel property
+ */
+ public void setColumnModel(TableColumnModel c)
+ {
+ if (c == null)
+ throw new IllegalArgumentException();
+ TableColumnModel tmp = columnModel;
+ if (tmp != null)
+ tmp.removeColumnModelListener(this);
+ if (c != null)
+ c.addColumnModelListener(this);
+ columnModel = c;
+ if (dataModel != null && columnModel != null)
+ {
+ int ncols = getColumnCount();
+ for (int i = 0; i < ncols; ++i)
+ columnModel.getColumn(i).setHeaderValue(dataModel.getColumnName(i));
+ }
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #columnSelectionAllowed} property.
+ *
+ * @param c The new value of the property
+ */
+ public void setColumnSelectionAllowed(boolean c)
+ {
+ getColumnModel().setColumnSelectionAllowed(c);
+ repaint();
+ }
+
+ /**
+ * <p>Set the value of the {@link #selectionModel} property.</p>
+ *
+ * <p>Unregister <code>this</code> as a {@link ListSelectionListener}
+ * from previous {@link #selectionModel} and register it with new
+ * parameter <code>s</code>.</p>
+ *
+ * @param s The new value of the selectionModel property
+ */
+ public void setSelectionModel(ListSelectionModel s)
+ {
+ if (s == null)
+ throw new IllegalArgumentException();
+ ListSelectionModel tmp = selectionModel;
+ if (tmp != null)
+ tmp.removeListSelectionListener(this);
+ if (s != null)
+ s.addListSelectionListener(this);
+ selectionModel = s;
+ }
+
+ /**
+ * Set the value of the {@link #selectionMode} property by
+ * delegation to the {@link #selectionModel} field.
+ *
+ * @param s The new value of the property
+ */
+ public void setSelectionMode(int s)
+ {
+ selectionModel.setSelectionMode(s);
+ repaint();
+ }
+
+ /**
+ * <p>Set the value of the {@link #cellEditor} property.</p>
+ *
+ * <p>Unregister <code>this</code> as a {@link CellEditorListener} from
+ * previous {@link #cellEditor} and register it with new parameter
+ * <code>c</code>.</p>
+ *
+ * @param c The new value of the cellEditor property
+ */
+ public void setCellEditor(TableCellEditor c)
+ {
+ TableCellEditor tmp = cellEditor;
+ if (tmp != null)
+ tmp.removeCellEditorListener(this);
+ if (c != null)
+ c.addCellEditorListener(this);
+ cellEditor = c;
+ }
+
+ /**
+ * Set the value of the {@link #dragEnabled} property.
+ *
+ * @param d The new value of the dragEnabled property
+ */
+ public void setDragEnabled(boolean d)
+ {
+ dragEnabled = d;
+ }
+
+ /**
+ * Set the value of the {@link #gridColor} property.
+ *
+ * @param g The new value of the gridColor property
+ */
+ public void setGridColor(Color g)
+ {
+ gridColor = g;
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #interCellSpacing} property.
+ *
+ * @param i The new value of the interCellSpacing property
+ */
+ public void setInterCellSpacing(Dimension i)
+ {
+ rowMargin = i.height;
+ columnModel.setColumnMargin(i.width);
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #preferredScrollableViewportSize} property.
+ *
+ * @param p The new value of the preferredScrollableViewportSize property
+ */
+ public void setPreferredScrollableViewportSize(Dimension p)
+ {
+ preferredScrollableViewportSize = p;
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * <p>Set the value of the {@link #selectionBackground} property.</p>
+ *
+ * <p>Fire a PropertyChangeEvent with name {@link
+ * #SELECTION_BACKGROUND_CHANGED_PROPERTY} to registered listeners, if
+ * selectionBackground changed.</p>
+ *
+ * @param s The new value of the selectionBackground property
+ */
+ public void setSelectionBackground(Color s)
+ {
+ Color tmp = selectionBackground;
+ selectionBackground = s;
+ if (((tmp == null && s != null)
+ || (s == null && tmp != null)
+ || (tmp != null && s != null && !tmp.equals(s))))
+ firePropertyChange(SELECTION_BACKGROUND_CHANGED_PROPERTY, tmp, s);
+ repaint();
+ }
+
+ /**
+ * <p>Set the value of the {@link #selectionForeground} property.</p>
+ *
+ * <p>Fire a PropertyChangeEvent with name {@link
+ * SELECTION_FOREGROUND_CHANGED_PROPERTY} to registered listeners, if
+ * selectionForeground changed.</p>
+ *
+ * @param s The new value of the selectionForeground property
+ */
+ public void setSelectionForeground(Color s)
+ {
+ Color tmp = selectionForeground;
+ selectionForeground = s;
+ if (((tmp == null && s != null)
+ || (s == null && tmp != null)
+ || (tmp != null && s != null && !tmp.equals(s))))
+ firePropertyChange(SELECTION_FOREGROUND_CHANGED_PROPERTY, tmp, s);
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #showGrid} property.
+ *
+ * @param s The new value of the showGrid property
+ */
+ public void setShowGrid(boolean s)
+ {
+ setShowVerticalLines(s);
+ setShowHorizontalLines(s);
+ }
+
+ /**
+ * Set the value of the {@link #showHorizontalLines} property.
+ *
+ * @param s The new value of the showHorizontalLines property
+ */
+ public void setShowHorizontalLines(boolean s)
+ {
+ showHorizontalLines = s;
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #showVerticalLines} property.
+ *
+ * @param s The new value of the showVerticalLines property
+ */
+ public void setShowVerticalLines(boolean s)
+ {
+ showVerticalLines = s;
+ repaint();
+ }
+
+ /**
+ * Set the value of the {@link #tableHeader} property.
+ *
+ * @param t The new value of the tableHeader property
+ */
+ public void setTableHeader(JTableHeader t)
+ {
+ if (tableHeader != null)
+ tableHeader.setTable(null);
+ tableHeader = t;
+ if (tableHeader != null)
+ tableHeader.setTable(this);
+ revalidate();
+ repaint();
+ }
+
+ protected void configureEnclosingScrollPane()
+ {
+ JScrollPane jsp = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, this);
+ if (jsp != null && tableHeader != null)
+ {
+ jsp.setColumnHeaderView(tableHeader);
+ }
+ }
+
+ protected void unconfigureEnclosingScrollPane()
+ {
+ JScrollPane jsp = (JScrollPane) SwingUtilities.getAncestorOfClass(JScrollPane.class, this);
+ if (jsp != null)
+ {
+ jsp.setColumnHeaderView(null);
+ }
+ }
+
+
+ public void addNotify()
+ {
+ super.addNotify();
+ configureEnclosingScrollPane();
+ }
+
+ public void removeNotify()
+ {
+ super.addNotify();
+ unconfigureEnclosingScrollPane();
+ }
+
+
+ /**
+ * Sun javadocs describe an unusual implementation of
+ * <code>doLayout</code> which involves some private interfaces. We try
+ * to implement the same algorithm as is documented, but using the
+ * columnModel directly. We still use a private helper method, but it has
+ * a simpler signature.
+ */
+
+ private void distributeSpill(TableColumn[] cols, int spill)
+ {
+ int MIN = 0;
+ int MAX = 0;
+ int PREF = 0;
+
+ int[] min = new int[cols.length];
+ int[] max = new int[cols.length];
+ int[] pref = new int[cols.length];
+
+ for (int i = 0; i < cols.length; ++i)
+ {
+ pref[i] = cols[i].getPreferredWidth();
+ min[i] = cols[i].getMinWidth();
+ max[i] = cols[i].getMaxWidth();
+ PREF += pref[i];
+ MIN += min[i];
+ MAX += max[i];
+ }
+
+ for (int i = 0; i < cols.length; ++i)
+ {
+ int adj = 0;
+ if (spill > 0)
+ adj = (spill * (pref[i] - min[i])) / (PREF - MIN);
+ else
+ adj = (spill * (max[i] - pref[i])) / (MAX - PREF);
+ cols[i].setWidth(pref[i] + adj);
+ }
+ }
+
+ public void doLayout()
{
- // FIXME:
- return null;
+ TableColumn resizingColumn = null;
+
+ int ncols = getColumnCount();
+ if (ncols < 1)
+ return;
+
+ int[] pref = new int[ncols];
+ int prefSum = 0;
+ int rCol = -1;
+
+ if (tableHeader != null)
+ resizingColumn = tableHeader.getResizingColumn();
+
+ for (int i = 0; i < ncols; ++i)
+ {
+ TableColumn col = columnModel.getColumn(i);
+ int p = col.getWidth();
+ pref[i] = p;
+ prefSum += p;
+ if (resizingColumn == col)
+ rCol = i;
+ }
+
+ int spill = prefSum - getWidth();
+
+ if (resizingColumn != null)
+ {
+ TableColumn col;
+ TableColumn [] cols;
+
+ switch (getAutoResizeMode())
+ {
+ case AUTO_RESIZE_LAST_COLUMN:
+ col = columnModel.getColumn(ncols-1);
+ col.setWidth(col.getPreferredWidth() + spill);
+ break;
+
+ case AUTO_RESIZE_NEXT_COLUMN:
+ col = columnModel.getColumn(ncols-1);
+ col.setWidth(col.getPreferredWidth() + spill);
+ break;
+
+ case AUTO_RESIZE_ALL_COLUMNS:
+ cols = new TableColumn[ncols];
+ for (int i = 0; i < ncols; ++i)
+ cols[i] = columnModel.getColumn(i);
+ distributeSpill(cols, spill);
+ break;
+
+ case AUTO_RESIZE_SUBSEQUENT_COLUMNS:
+ cols = new TableColumn[ncols];
+ for (int i = rCol; i < ncols; ++i)
+ cols[i] = columnModel.getColumn(i);
+ distributeSpill(cols, spill);
+ break;
+
+ case AUTO_RESIZE_OFF:
+ default:
+ }
+ }
+ else
+ {
+ TableColumn [] cols = new TableColumn[ncols];
+ for (int i = 0; i < ncols; ++i)
+ cols[i] = columnModel.getColumn(i);
+ distributeSpill(cols, spill);
+ }
}
+
+ public void sizeColumnsToFit(boolean lastColumnOnly)
+ {
+ doLayout();
+ }
+
+ public void sizeColumnsToFit(int resizingColumn)
+ {
+ doLayout();
+ }
+
+ public String getUIClassID()
+ {
+ return "TableUI";
+ }
+
+ /**
+ * This method returns the table's UI delegate.
+ *
+ * @return The table's UI delegate.
+ */
+ public TableUI getUI()
+ {
+ return (TableUI) ui;
+ }
+
+ /**
+ * This method sets the table's UI delegate.
+ *
+ * @param ui The table's UI delegate.
+ */
+ public void setUI(TableUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ public void updateUI()
+ {
+ setUI((TableUI) UIManager.getUI(this));
+ revalidate();
+ repaint();
+ }
+
}
diff --git a/javax/swing/JTextArea.java b/javax/swing/JTextArea.java
index 1ebc164ea..a1187bf6d 100644
--- a/javax/swing/JTextArea.java
+++ b/javax/swing/JTextArea.java
@@ -38,8 +38,10 @@ exception statement from your version. */
package javax.swing;
import java.awt.Dimension;
+import java.awt.FontMetrics;
import javax.swing.text.BadLocationException;
import javax.swing.text.Document;
+import javax.swing.text.Element;
import javax.swing.text.JTextComponent;
import javax.swing.text.PlainDocument;
@@ -103,13 +105,15 @@ public class JTextArea extends JTextComponent
/**
* Whether line wrapping is enabled or not.
*/
- private boolean wrapping;
+ private boolean lineWrap;
/**
* The number of characters equal to a tab within the text.
*/
private int tabSize = 8;
+ private boolean wrapStyleWord;
+
/**
* Creates a new <code>JTextArea</code> object.
*/
@@ -221,7 +225,7 @@ public class JTextArea extends JTextComponent
*/
public boolean getScrollableTracksViewportWidth()
{
- return wrapping ? true : super.getScrollableTracksViewportWidth();
+ return lineWrap ? true : super.getScrollableTracksViewportWidth();
}
/**
@@ -287,29 +291,58 @@ public class JTextArea extends JTextComponent
/**
* Checks whether line wrapping is enabled.
*
- * @return true if line wrapping is enabled, false otherwise
+ * @return <code>true</code> if line wrapping is enabled,
+ * <code>false</code> otherwise
*/
public boolean getLineWrap()
{
- return wrapping;
+ return lineWrap;
}
/**
* Enables/disables line wrapping.
*
- * @param wrapping true to enable line wrapping, false otherwise
+ * @param wrapping <code>true</code> to enable line wrapping,
+ * <code>false</code> otherwise
*/
public void setLineWrap(boolean flag)
{
- if (wrapping == flag)
+ if (lineWrap == flag)
return;
- boolean oldValue = wrapping;
- wrapping = flag;
- firePropertyChange("lineWrap", oldValue, wrapping);
+ boolean oldValue = lineWrap;
+ lineWrap = flag;
+ firePropertyChange("lineWrap", oldValue, lineWrap);
}
/**
+ * Checks whether word style wrapping is enabled.
+ *
+ * @return <code>true</code> if word style wrapping is enabled,
+ * <code>false</code> otherwise
+ */
+ public boolean getWrapStyleWord()
+ {
+ return wrapStyleWord;
+ }
+
+ /**
+ * Enables/Disables word style wrapping.
+ *
+ * @param flag <code>true</code> to enable word style wrapping,
+ * <code>false</code> otherwise
+ */
+ public void setWrapStyleWord(boolean flag)
+ {
+ if (wrapStyleWord == flag)
+ return;
+
+ boolean oldValue = wrapStyleWord;
+ wrapStyleWord = flag;
+ firePropertyChange("wrapStyleWord", oldValue, wrapStyleWord);
+ }
+
+ /**
* Returns the number of characters used for a tab.
* This defaults to 8.
*
@@ -338,6 +371,59 @@ public class JTextArea extends JTextComponent
firePropertyChange("tabSize", oldValue, tabSize);
}
+ protected int getColumnWidth()
+ {
+ FontMetrics metrics = getToolkit().getFontMetrics(getFont());
+ return metrics.charWidth('m');
+ }
+
+ public int getLineCount()
+ {
+ return getDocument().getDefaultRootElement().getElementCount();
+ }
+
+ public int getLineStartOffset(int line)
+ throws BadLocationException
+ {
+ int lineCount = getLineCount();
+
+ if (line < 0 || line > lineCount)
+ throw new BadLocationException("Non-existing line number", line);
+
+ Element lineElem = getDocument().getDefaultRootElement().getElement(line);
+ return lineElem.getStartOffset();
+ }
+
+ public int getLineEndOffset(int line)
+ throws BadLocationException
+ {
+ int lineCount = getLineCount();
+
+ if (line < 0 || line > lineCount)
+ throw new BadLocationException("Non-existing line number", line);
+
+ Element lineElem = getDocument().getDefaultRootElement().getElement(line);
+ return lineElem.getEndOffset();
+ }
+
+ public int getLineOfOffset(int offset)
+ throws BadLocationException
+ {
+ Document doc = getDocument();
+
+ if (offset < doc.getStartPosition().getOffset()
+ || offset >= doc.getEndPosition().getOffset())
+ throw new BadLocationException("offset outside of document", offset);
+
+ return doc.getDefaultRootElement().getElementIndex(offset);
+ }
+
+ protected int getRowHeight()
+ {
+ FontMetrics metrics = getToolkit().getFontMetrics(getFont());
+ return metrics.getHeight();
+ }
+
/**
* Inserts the supplied text at the specified position. Nothing
* happens in the case that the model or the supplied string is null
@@ -345,30 +431,49 @@ public class JTextArea extends JTextComponent
*
* @param string The string of text to insert.
* @param position The position at which to insert the supplied text.
- * @throws IllegalArgumentException if the position is < 0 or greater
- * than the length of the current text.
+ * @throws IllegalArgumentException if the position is &lt; 0 or greater
+ * than the length of the current text.
*/
public void insert(String string, int position)
{
- Document document;
+ // Retrieve the document model.
+ Document doc = getDocument();
- /* Retrieve the document model */
- document = getDocument();
- /* Check the model and string for validity */
- if (document == null || string == null || string.length() == 0)
- {
- return; /* Do nothing */
- }
- /* Insert the text into the model */
- try
- {
- document.insertString(position, string, null);
- }
- catch (BadLocationException exception)
- {
- throw new IllegalArgumentException("The supplied position, " +
- position + ", was invalid.");
- }
+ // Check the model and string for validity.
+ if (doc == null
+ || string == null
+ || string.length() == 0)
+ return;
+
+ // Insert the text into the model.
+ try
+ {
+ doc.insertString(position, string, null);
+ }
+ catch (BadLocationException e)
+ {
+ throw new IllegalArgumentException("The supplied position, "
+ + position + ", was invalid.");
+ }
}
+ public void replaceRange(String text, int start, int end)
+ {
+ Document doc = getDocument();
+
+ if (start > end
+ || start < doc.getStartPosition().getOffset()
+ || end >= doc.getEndPosition().getOffset())
+ throw new IllegalArgumentException();
+
+ try
+ {
+ doc.remove(start, end);
+ doc.insertString(start, text, null);
+ }
+ catch (BadLocationException e)
+ {
+ // This cannot happen as we check offset above.
+ }
+ }
}
diff --git a/javax/swing/JTextField.java b/javax/swing/JTextField.java
index 86be4b7b4..5fe104b50 100644
--- a/javax/swing/JTextField.java
+++ b/javax/swing/JTextField.java
@@ -42,6 +42,8 @@ import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import javax.accessibility.AccessibleStateSet;
import javax.swing.text.Document;
@@ -84,6 +86,16 @@ public class JTextField extends JTextComponent
private int align;
+ private int scrollOffset;
+
+ /** @since 1.3 */
+ private Action action;
+
+ /** @since 1.3 */
+ private String actionCommand;
+
+ private PropertyChangeListener actionPropertyChangeListener;
+
/**
* Creates a new instance of <code>JTextField</code>.
*/
@@ -138,9 +150,15 @@ public class JTextField extends JTextComponent
*/
public JTextField(Document doc, String text, int columns)
{
+ if (columns < 0)
+ throw new IllegalArgumentException();
+
+ this.columns = columns;
+
setDocument(doc == null ? createDefaultModel() : doc);
- setText(text);
- setColumns(columns);
+
+ if (text != null)
+ setText(text);
}
/**
@@ -236,11 +254,14 @@ public class JTextField extends JTextComponent
public void setHorizontalAlignment(int newAlign)
{
+ if (align == newAlign)
+ return;
+
int oldAlign = align;
align = newAlign;
+ firePropertyChange("horizontalAlignment", oldAlign, newAlign);
invalidate();
repaint();
- firePropertyChange("horizontalAlignment", oldAlign, newAlign);
}
public void setFont(Font newFont)
@@ -267,4 +288,134 @@ public class JTextField extends JTextComponent
return size;
}
+
+ /**
+ * Returns the scroll offset in pixels.
+ *
+ * @return the scroll offset
+ */
+ public int getScrollOffset()
+ {
+ return scrollOffset;
+ }
+
+ /**
+ * Sets the scroll offset in pixels.
+ *
+ * @param offset the scroll offset
+ */
+ public void setScrollOffset(int offset)
+ {
+ scrollOffset = offset;
+ }
+
+ public void postActionEvent()
+ {
+ ActionEvent event = new ActionEvent(this, 0, actionCommand);
+ ActionListener[] listeners = getActionListeners();
+
+ for (int index = 0; index < listeners.length; ++index)
+ listeners[index].actionPerformed(event);
+ }
+
+ /**
+ * @since 1.3
+ */
+ public Action getAction()
+ {
+ return action;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setAction(Action newAction)
+ {
+ if (action == newAction)
+ return;
+
+ if (action != null)
+ {
+ removeActionListener(action);
+ action.removePropertyChangeListener(actionPropertyChangeListener);
+ actionPropertyChangeListener = null;
+ }
+
+ Action oldAction = action;
+ action = newAction;
+
+ if (action != null)
+ {
+ addActionListener(action);
+ actionPropertyChangeListener =
+ createActionPropertyChangeListener(action);
+ action.addPropertyChangeListener(actionPropertyChangeListener);
+ }
+
+ firePropertyChange("horizontalAlignment", oldAction, newAction);
+ }
+
+ /**
+ * @since 1.3
+ */
+ public String getActionCommand()
+ {
+ return actionCommand;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setActionCommand(String command)
+ {
+ this.actionCommand = command;
+ }
+
+ /**
+ * @since 1.3
+ */
+ protected PropertyChangeListener createActionPropertyChangeListener(Action action)
+ {
+ return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ // Update properties "action" and "horizontalAlignment".
+ String name = event.getPropertyName();
+
+ if (name.equals("enabled"))
+ {
+ boolean enabled = ((Boolean) event.getNewValue()).booleanValue();
+ JTextField.this.setEnabled(enabled);
+ }
+ else if (name.equals(Action.SHORT_DESCRIPTION))
+ {
+ JTextField.this.setToolTipText((String) event.getNewValue());
+ }
+ }
+ };
+ }
+
+ /**
+ * @since 1.3
+ */
+ protected void configurePropertiesFromAction(Action action)
+ {
+ if (action != null)
+ {
+ setEnabled(action.isEnabled());
+ setToolTipText((String) action.getValue(Action.SHORT_DESCRIPTION));
+ }
+ else
+ {
+ setEnabled(true);
+ setToolTipText(null);
+ }
+ }
+
+ protected int getColumnWidth()
+ {
+ FontMetrics metrics = getToolkit().getFontMetrics(getFont());
+ return metrics.charWidth('m');
+ }
}
diff --git a/javax/swing/JToggleButton.java b/javax/swing/JToggleButton.java
index c04bcc367..de459c32f 100644
--- a/javax/swing/JToggleButton.java
+++ b/javax/swing/JToggleButton.java
@@ -38,17 +38,102 @@ exception statement from your version. */
package javax.swing;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleState;
import javax.swing.plaf.ButtonUI;
+/**
+ * The <code>JToggleButton</code> component provides a stateful button,
+ * which can be either selected or unselected. This provides the basis
+ * for the implementations of radio buttons (<code>JRadioButton</code>)
+ * and check boxes (<code>JCheckBox</code>).
+ *
+ * @author Michael Koch <konqueror@gmx.de>
+ * @author Graydon Hoare <graydon@redhat.com>
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see JRadioButton
+ * @see JCheckBox
+ * @since 1.2
+ */
public class JToggleButton extends AbstractButton implements Accessible
{
+
+ /**
+ * This class provides accessibility support for the toggle button.
+ */
+ protected class AccessibleJToggleButton
+ extends AccessibleAbstractButton
+ implements ItemListener
+ {
+
+ /**
+ * Constructor for the accessible toggle button.
+ */
+ public AccessibleJToggleButton()
+ {
+ super();
+ /* Register the accessible toggle button as a listener for item events */
+ addItemListener(this);
+ }
+ /**
+ * Returns the accessible role for the toggle button.
+ *
+ * @return An instance of <code>AccessibleRole</code>, describing
+ * the role of the toggle button.
+ */
+ public AccessibleRole getAccessibleRole()
+ {
+ return AccessibleRole.TOGGLE_BUTTON;
+ }
+
+ /**
+ * Monitors the toggle button for state changes and fires accessible
+ * property change events when they occur.
+ *
+ * @param event the event that occurred.
+ */
+ public void itemStateChanged(ItemEvent event)
+ {
+ /* Fire a state property change event as the button's state has changed */
+ if (event.getStateChange() == ItemEvent.SELECTED)
+ {
+ /* State has changed from unselected (null) to selected */
+ firePropertyChange(ACCESSIBLE_STATE_PROPERTY, null, AccessibleState.SELECTED);
+ }
+ else
+ {
+ /* State has changed from selected to unselected (null) */
+ firePropertyChange(ACCESSIBLE_STATE_PROPERTY, AccessibleState.ENABLED, null);
+ }
+ }
+
+ }
+
+ /**
+ * The model handles the storage and maintenance of the state of
+ * the toggle button. This follows the same paradigm (the MVC
+ * or Model-View-Controller design pattern) employed by
+ * other Swing components, where the data associated with a component
+ * is stored separately from the display aspects.
+ */
public static class ToggleButtonModel extends DefaultButtonModel
{
+ /**
+ * Compatible with Sun's JDK.
+ */
private static final long serialVersionUID = -1589950750899943974L;
+ /**
+ * Sets the pressed state of the button. The selected state
+ * of the button also changes follwing the button being pressed.
+ *
+ * @param b true if the button is pressed down.
+ */
public void setPressed(boolean b)
{
if (! isEnabled())
@@ -63,44 +148,97 @@ public class JToggleButton extends AbstractButton implements Accessible
}
}
-
+ /**
+ * Compatible with Sun's JDK.
+ */
private static final long serialVersionUID = -3128248873429850443L;
+ /**
+ * Constructs an unselected toggle button with no text or icon.
+ */
public JToggleButton()
{
- this(null, null);
+ this(null, null, false);
}
+
+ /**
+ * Constructs a toggle button using the labelling, state
+ * and icon specified by the supplied action.
+ *
+ * @param a the action to use to define the properties of the button.
+ */
public JToggleButton(Action a)
{
this();
setAction(a);
}
+ /**
+ * Constructs an unselected toggle button with the supplied icon
+ * and no text.
+ *
+ * @param icon the icon to use.
+ */
public JToggleButton(Icon icon)
{
- this(null, icon);
+ this(null, icon, false);
}
- public JToggleButton (Icon icon, boolean selected)
+ /**
+ * Constructs a toggle button with the supplied icon and state.
+ *
+ * @param icon the icon to use.
+ * @param selected if true, the toggle button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
+ public JToggleButton(Icon icon, boolean selected)
{
this(null, icon, selected);
}
+ /**
+ * Constructs an unselected toggle button using the supplied text
+ * and no icon.
+ *
+ * @param text the text to use.
+ */
public JToggleButton(String text)
{
- this(text, null);
+ this(text, null, false);
}
+ /**
+ * Constructs a toggle button with the supplied text and state.
+ *
+ * @param text the text to use.
+ * @param selected if true, the toggle button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
public JToggleButton(String text, boolean selected)
{
this(text, null, selected);
}
+ /**
+ * Constructs an unselected toggle button with the supplied text
+ * and icon.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ */
public JToggleButton(String text, Icon icon)
{
this(text, icon, false);
}
+ /**
+ * Constructs a toggle button with the supplied text, icon and state.
+ *
+ * @param text the text to use.
+ * @param icon the icon to use.
+ * @param selected if true, the toggle button is initially in the
+ * selected state. Otherwise, the button is unselected.
+ */
public JToggleButton (String text, Icon icon, boolean selected)
{
super(text, icon);
@@ -112,34 +250,54 @@ public class JToggleButton extends AbstractButton implements Accessible
/**
* Gets the AccessibleContext associated with this <code>JToggleButton</code>.
+ * The context is created, if necessary.
*
* @return the associated context
*/
public AccessibleContext getAccessibleContext()
{
- return null;
+ /* Create the context if this is the first request */
+ if (accessibleContext == null)
+ {
+ /* Create the context */
+ accessibleContext = new AccessibleJToggleButton();
+ }
+ return accessibleContext;
}
/**
* Returns a string that specifies the name of the Look and Feel
* class that renders this component.
+ *
+ * @return The Look and Feel UI class in <code>String</code> form.
*/
public String getUIClassID()
{
return "ToggleButtonUI";
}
+ /**
+ * Returns a textual representation of this component for debugging.
+ * Users should not depend on anything as regards the content or formatting
+ * of this string, except for the fact that the returned string may never be
+ * null (only empty).
+ *
+ * @return the component in <code>String</code> form for debugging.
+ */
protected String paramString()
{
return "JToggleButton";
}
-
+ /**
+ * This method resets the toggle button's UI delegate to the default UI for
+ * the current look and feel.
+ */
public void updateUI()
{
- ButtonUI b = (ButtonUI)UIManager.getUI(this);
- setUI(b);
+ setUI((ButtonUI)UIManager.getUI(this));
}
+
}
diff --git a/javax/swing/JTree.java b/javax/swing/JTree.java
index 4e81bff84..3ad151f1a 100644
--- a/javax/swing/JTree.java
+++ b/javax/swing/JTree.java
@@ -50,10 +50,12 @@ import javax.swing.event.TreeSelectionListener;
import javax.swing.event.TreeWillExpandListener;
import javax.swing.plaf.TreeUI;
import javax.swing.tree.ExpandVetoException;
+import javax.swing.tree.TreeCellEditor;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
+import javax.swing.tree.TreeSelectionModel;
public class JTree extends JComponent
@@ -61,11 +63,36 @@ public class JTree extends JComponent
{
private static final long serialVersionUID = 7559816092864483649L;
+ public static final String ANCHOR_SELECTION_PATH_PROPERTY = "anchorSelectionPath";
+ public static final String CELL_EDITOR_PROPERTY = "cellEditor";
+ public static final String CELL_RENDERER_PROPERTY = "cellRenderer";
+ public static final String EDITABLE_PROPERTY = "editable";
+ public static final String EXPANDS_SELECTED_PATHS_PROPERTY = "expandsSelectedPaths";
+ public static final String INVOKES_STOP_CELL_EDITING_PROPERTY = "invokesStopCellEditing";
+ public static final String LARGE_MODEL_PROPERTY = "largeModel";
+ public static final String LEAD_SELECTION_PATH_PROPERTY = "leadSelectionPath";
+ public static final String ROOT_VISIBLE_PROPERTY = "rootVisible";
+ public static final String ROW_HEIGHT_PROPERTY = "rowHeight";
+ public static final String SCROLLS_ON_EXPAND_PROPERTY = "scrollsOnExpand";
+ public static final String SELECTION_MODEL_PROPERTY = "selectionModel";
+ public static final String SHOWS_ROOT_HANDLES_PROPERTY = "showsRootHandles";
+ public static final String TOGGLE_CLICK_COUNT_PROPERTY = "toggleClickCount";
+ public static final String TREE_MODEL_PROPERTY = "model";
+ public static final String VISIBLE_ROW_COUNT_PROPERTY = "visibleRowCount";
+
+ protected TreeCellEditor cellEditor;
protected TreeCellRenderer cellRenderer;
protected boolean editable;
+ protected boolean invokesStopCellEditing;
+ protected boolean largeModel;
protected boolean rootVisible;
+ protected int rowHeight;
+ protected boolean scrollsOnExpand;
+ protected TreeSelectionModel selectionModel;
protected boolean showsRootHandles;
+ protected int toggleClickCount;
protected TreeModel treeModel;
+ protected int visibleRowCount;
/**
* Creates a new <code>JTree</code> object.
@@ -456,11 +483,21 @@ public class JTree extends JComponent
return showsRootHandles;
}
- public void setShowRootHandles(boolean flag)
+ public void setShowsRootHandles(boolean flag)
{
showsRootHandles = flag;
}
+ public TreeCellEditor getCellEditor()
+ {
+ return cellEditor;
+ }
+
+ public void setCellEditor(TreeCellEditor editor)
+ {
+ cellEditor = editor;
+ }
+
public TreeCellRenderer getCellRenderer()
{
return cellRenderer;
@@ -470,4 +507,80 @@ public class JTree extends JComponent
{
cellRenderer = newRenderer;
}
+
+ public TreeSelectionModel getSelectionModel()
+ {
+ return selectionModel;
+ }
+
+ public void setSelectionModel(TreeSelectionModel model)
+ {
+ selectionModel = model;
+ }
+
+ public int getVisibleRowCount()
+ {
+ return visibleRowCount;
+ }
+
+ public void setVisibleRowCount(int rows)
+ {
+ visibleRowCount = rows;
+ }
+
+ public boolean isLargeModel()
+ {
+ return largeModel;
+ }
+
+ public void setLargeModel(boolean large)
+ {
+ largeModel = large;
+ }
+
+ public int getRowHeight()
+ {
+ return rowHeight;
+ }
+
+ public void setRowHeight(int height)
+ {
+ rowHeight = height;
+ }
+
+ public boolean getInvokesStopCellEditing()
+ {
+ return invokesStopCellEditing;
+ }
+
+ public void setInvokesStopCellEditing(boolean invoke)
+ {
+ invokesStopCellEditing = invoke;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public int getToggleClickCount()
+ {
+ return toggleClickCount;
+ }
+
+ /**
+ * @since 1.3
+ */
+ public void setToggleClickCount(int count)
+ {
+ toggleClickCount = count;
+ }
+
+ public boolean getScrollsOnExpand()
+ {
+ return scrollsOnExpand;
+ }
+
+ public void setScrollsOnExpand(boolean scroll)
+ {
+ scrollsOnExpand = scroll;
+ }
}
diff --git a/javax/swing/JViewport.java b/javax/swing/JViewport.java
index 47ccdf709..bf95822d4 100644
--- a/javax/swing/JViewport.java
+++ b/javax/swing/JViewport.java
@@ -249,8 +249,13 @@ public class JViewport extends JComponent
public void setView(Component v)
{
- add(v);
- fireStateChanged();
+ while (getComponentCount() > 0)
+ remove(0);
+ if (v != null)
+ {
+ add(v);
+ fireStateChanged();
+ }
}
public void revalidate()
@@ -300,23 +305,11 @@ public class JViewport extends JComponent
return false;
}
- public ChangeListener[] getChangeListeners()
- {
- return (ChangeListener[]) getListeners(ChangeListener.class);
- }
-
public void paint(Graphics g)
{
paintComponent(g);
}
- void fireStateChanged()
- {
- ChangeListener[] listeners = getChangeListeners();
- for (int i = 0; i < listeners.length; ++i)
- listeners[i].stateChanged(changeEvent);
- }
-
public void addChangeListener(ChangeListener listener)
{
listenerList.add(ChangeListener.class, listener);
@@ -327,6 +320,18 @@ public class JViewport extends JComponent
listenerList.remove(ChangeListener.class, listener);
}
+ public ChangeListener[] getChangeListeners()
+ {
+ return (ChangeListener[]) getListeners(ChangeListener.class);
+ }
+
+ protected void fireStateChanged()
+ {
+ ChangeListener[] listeners = getChangeListeners();
+ for (int i = 0; i < listeners.length; ++i)
+ listeners[i].stateChanged(changeEvent);
+ }
+
/**
* This method returns the String ID of the UI class of Separator.
*
@@ -344,4 +349,24 @@ public class JViewport extends JComponent
{
setUI((ViewportUI) UIManager.getUI(this));
}
+
+ /**
+ * This method returns the viewport's UI delegate.
+ *
+ * @return The viewport's UI delegate.
+ */
+ public ViewportUI getUI()
+ {
+ return (ViewportUI) ui;
+ }
+
+ /**
+ * This method sets the viewport's UI delegate.
+ *
+ * @param ui The viewport's UI delegate.
+ */
+ public void setUI(ViewportUI ui)
+ {
+ super.setUI(ui);
+ }
}
diff --git a/javax/swing/KeyStroke.java b/javax/swing/KeyStroke.java
index ef3d78790..afdbae830 100644
--- a/javax/swing/KeyStroke.java
+++ b/javax/swing/KeyStroke.java
@@ -37,235 +37,69 @@ exception statement from your version. */
package javax.swing;
+import java.awt.AWTKeyStroke;
import java.awt.event.KeyEvent;
import java.io.Serializable;
-/**
- * KeyStroke
- * @author Andrew Selkirk
- * @version 1.0
- */
-public class KeyStroke implements Serializable
+public class KeyStroke
+ extends AWTKeyStroke
+ implements Serializable
{
static final long serialVersionUID = -9060180771037902530L;
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * keyChar
- */
- private char keyChar = 0;
-
- /**
- * keyCode
- */
- private int keyCode = 0;
-
- /**
- * modifiers
- */
- private int modifiers = 0;
-
- /**
- * onKeyRelease
- */
- private boolean onKeyRelease = false;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor KeyStroke
- */
- private KeyStroke() {
- } // KeyStroke()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * hashCode
- * @returns int
- */
- public int hashCode() {
- return 0; // TODO
- } // hashCode()
-
- /**
- * equals
- * @param object TODO
- * @returns boolean
- */
- public boolean equals(Object object) {
-
- // Variables
- KeyStroke key;
-
- if (object instanceof KeyStroke) {
- key = (KeyStroke) object;
- if (key.keyChar == keyChar &&
- key.keyCode == keyCode &&
- key.modifiers == modifiers &&
- key.onKeyRelease == onKeyRelease) {
- return true;
- } // if
- } // if
- return false;
-
- } // equals()
-
- /**
- * toString
- * @returns String
- */
- public String toString() {
- return null; // TODO
- } // toString()
-
- /**
- * getKeyStroke
- * @param keyChar TODO
- * @returns KeyStroke
- */
- public static KeyStroke getKeyStroke(char keyChar) {
-
- // Variables
- KeyStroke key;
-
- key = new KeyStroke();
- key.keyChar = keyChar;
- return key;
-
- } // getKeyStroke()
-
- /**
- * getKeyStroke - deprecated
- * @param keyChar TODO
- * @param onKeyRelease TODO
- * @returns KeyStroke
- * @deprecated Use getKeyStroke(char)
- */
- public static KeyStroke getKeyStroke(char keyChar, boolean onKeyRelease) {
- KeyStroke key = getKeyStroke(keyChar);
- key.onKeyRelease = onKeyRelease;
- return key;
- } // getKeyStroke()
-
- /**
- * getKeyStroke
- * @param keyChar TODO
- * @param modifiers TODO
- * @returns KeyStroke
- */
- public static KeyStroke getKeyStroke(Character keyChar, int modifiers) {
- KeyStroke key = getKeyStroke(keyChar.charValue());
- key.modifiers = modifiers;
- return key;
- } // getKeyStroke()
-
- /**
- * getKeyStroke
- * @param keyCode TODO
- * @param modifiers TODO
- * @param onKeyRelease TODO
- * @returns KeyStroke
- */
- public static KeyStroke getKeyStroke(int keyCode, int modifiers,
- boolean onKeyRelease) {
-
- // Variables
- KeyStroke key;
-
- key = new KeyStroke();
- key.keyCode = keyCode;
- key.modifiers = modifiers;
- key.onKeyRelease = onKeyRelease;
- return key;
-
- } // getKeyStroke()
-
- /**
- * getKeyStroke
- * @param keyCode TODO
- * @param modifiers TODO
- * @returns KeyStroke
- */
- public static KeyStroke getKeyStroke(int keyCode, int modifiers) {
- return getKeyStroke(keyCode, modifiers, false);
- } // getKeyStroke()
-
- /**
- * getKeyStroke
- * @param string TODO
- * @returns KeyStroke
- */
- public static KeyStroke getKeyStroke(String string) {
- return null; // TODO
- } // getKeyStroke()
-
- /**
- * getKeyStrokeForEvent
- * @param event TODO
- * @returns KeyStroke
- */
- public static KeyStroke getKeyStrokeForEvent(KeyEvent event) {
-
- // Variables
- int eventID;
- int eventMod;
-
- // Get Event ID
- eventID = event.getID();
- eventMod = event.getModifiersEx();
-
- // Check for KEY_TYPED event
- if (eventID == KeyEvent.KEY_TYPED) {
- return getKeyStroke(event.getKeyChar(), eventMod);
-
- // KEY_PRESSED or KEY_RELEASED event
- } else {
- return getKeyStroke(event.getKeyCode(), eventMod);
- } // if
-
- } // getKeyStrokeForEvent()
-
- /**
- * getKeyChar
- * @returns char
- */
- public char getKeyChar() {
- return keyChar;
- } // getKeyChar()
-
- /**
- * getKeyCode
- * @returns int
- */
- public int getKeyCode() {
- return keyCode;
- } // getKeyCode()
-
- /**
- * getModifiers
- * @returns int
- */
- public int getModifiers() {
- return modifiers; // TODO
- } // getModifiers()
-
- /**
- * isOnKeyRelease
- * @returns boolean
- */
- public boolean isOnKeyRelease() {
- return onKeyRelease;
- } // isOnKeyRelease()
-
-
-} // KeyStroke
+ private KeyStroke() {
+ }
+
+ protected KeyStroke(char keyChar, int keyCode, int modifiers,
+ boolean onKeyRelease)
+ {
+ super(keyChar, keyCode, modifiers, onKeyRelease);
+ }
+
+ static
+ {
+ AWTKeyStroke.registerSubclass(KeyStroke.class);
+ }
+
+ public static KeyStroke getKeyStroke(char keyChar)
+ {
+ return (KeyStroke) getAWTKeyStroke(keyChar);
+ }
+
+ /**
+ * @deprecated Use {@link #getKeyStroke(char)}
+ *
+ * This method, unlike all the other factory methods on this object,
+ * returns a non-cached, non-shared object. New code should not use it.
+ */
+ public static KeyStroke getKeyStroke(char keyChar, boolean onKeyRelease)
+ {
+ return new KeyStroke(keyChar, KeyEvent.VK_UNDEFINED, 0, onKeyRelease);
+ }
+
+ public static KeyStroke getKeyStroke(Character keyChar, int modifiers)
+ {
+ return (KeyStroke) getAWTKeyStroke(keyChar, modifiers);
+ }
+
+ public static KeyStroke getKeyStroke(int keyCode, int modifiers,
+ boolean onKeyRelease)
+ {
+ return (KeyStroke) getAWTKeyStroke(keyCode, modifiers, onKeyRelease);
+ }
+
+ public static KeyStroke getKeyStroke(int keyCode, int modifiers)
+ {
+ return (KeyStroke) getAWTKeyStroke(keyCode, modifiers);
+ }
+
+ public static KeyStroke getKeyStroke(String str)
+ {
+ return (KeyStroke) getAWTKeyStroke(str);
+ }
+
+ public static KeyStroke getKeyStrokeForEvent(KeyEvent event)
+ {
+ return (KeyStroke) getAWTKeyStrokeForEvent(event);
+ }
+
+}
diff --git a/javax/swing/MutableComboBoxModel.java b/javax/swing/MutableComboBoxModel.java
index 678aeaf6f..2c0f4149d 100644
--- a/javax/swing/MutableComboBoxModel.java
+++ b/javax/swing/MutableComboBoxModel.java
@@ -38,40 +38,46 @@ exception statement from your version. */
package javax.swing;
/**
- * MutableComboBoxModel
- * @author Andrew Selkirk
- * @version 1.0
+ * MutableComboBoxModel is interface for data model that keeps track of the
+ * components data and provides methods to insert and remove elements from
+ * it. The Classes implementing this interface should fire appropriate
+ * events indicating the undergoing change in the data model.
+ *
+ * @author Andrew Selkirk
+ * @author Olga Rodimina
+ * @version 1.0
*/
-public interface MutableComboBoxModel extends ComboBoxModel {
+public interface MutableComboBoxModel extends ComboBoxModel
+{
+ /**
+ * This method adds given object to its data model.
+ *
+ * @param object element to add to the data model.
+ */
+ void addElement(Object object);
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * addElement
- * @param object TODO
- */
- void addElement(Object object);
-
- /**
- * removeElementAt
- * @param index TODO
- */
- void removeElementAt(int index);
-
- /**
- * insertElementAt
- * @param object TODO
- * @param index TODO
- */
- void insertElementAt(Object object, int index);
-
- /**
- * removeElement
- * @param object TODO
- */
- void removeElement(Object object);
+ /**
+ * This method removes elements located at the given index in the data
+ * model.
+ *
+ * @param index index specifying location of the element to remove.
+ */
+ void removeElementAt(int index);
+ /**
+ * This method inserts givent element to the data model, at the specified
+ * index.
+ *
+ * @param object element to insert
+ * @param index index specifying the position in the data model where the
+ * given element should be inserted.
+ */
+ void insertElementAt(Object object, int index);
+ /**
+ * This method removes given element from the data model
+ *
+ * @param element to remove.
+ */
+ void removeElement(Object object);
} // MutableComboBoxModel
diff --git a/javax/swing/ScrollPaneLayout.java b/javax/swing/ScrollPaneLayout.java
index 9d2494b4c..89844ce0c 100644
--- a/javax/swing/ScrollPaneLayout.java
+++ b/javax/swing/ScrollPaneLayout.java
@@ -82,6 +82,8 @@ public class ScrollPaneLayout
public void syncWithScrollPane(JScrollPane scrollPane) {
viewport = scrollPane.getViewport();
+ rowHead = scrollPane.getRowHeader();
+ colHead = scrollPane.getColumnHeader();
vsb = scrollPane.getVerticalScrollBar();
hsb = scrollPane.getHorizontalScrollBar();
vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
@@ -389,12 +391,12 @@ public class ScrollPaneLayout
y4 = scrollPaneBounds.y + scrollPaneBounds.height;
if (colHead != null)
- y2 = colHead.getPreferredSize().height;
+ y2 = y1 + colHead.getPreferredSize().height;
else
y2 = y1;
if (rowHead != null)
- x2 = rowHead.getPreferredSize().width;
+ x2 = x1 + rowHead.getPreferredSize().width;
else
x2 = x1;
diff --git a/javax/swing/SpinnerListModel.java b/javax/swing/SpinnerListModel.java
new file mode 100644
index 000000000..4da261469
--- /dev/null
+++ b/javax/swing/SpinnerListModel.java
@@ -0,0 +1,296 @@
+/* SpinnerListModel.java -- A spinner model backed by a list or an array.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * An implementation of <code>SpinnerModel</code> which uses the values
+ * contained within a list or an array. The backing list or array is
+ * only stored as a reference within the class. As a result, changes
+ * made elsewhere to the members of the list or array are reflected by
+ * this model.
+ * <p>
+ *
+ * The model itself inherits a list of <code>ChangeListener</code>s from
+ * <code>AbstractSpinnerModel</code>. As this code is unaware of changes
+ * made to the backing list or array, it is the responsibility of the
+ * application using the model to invoke <code>fireStateChanged()</code>,
+ * in order to notify any <code>ChangeListener</code>s, when the list or array
+ * changes. The model handles notification when the reference itself
+ * is changed via <code>setList()</code> or when the current value is
+ * set directly using <code>setValue()</code>.
+ *
+ * @author Andrew John Hughes <gnu_andrew@member.fsf.org>
+ * @see SpinnerModel
+ * @see AbstractSpinnerModel
+ * @see JSpinner
+ * @since 1.4
+ */
+
+public class SpinnerListModel
+ extends AbstractSpinnerModel
+ implements Serializable
+{
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 3358804052191994516L;
+
+ /**
+ * The backing list for this model.
+ */
+ private List list;
+
+ /**
+ * The current index in the list.
+ */
+ private transient int index;
+
+ /**
+ * Constructs a default <code>SpinnerListModel</code>. This
+ * is a model backed by a list containing only the single
+ * <code>String</code> element, "empty".
+ */
+ public SpinnerListModel()
+ {
+ List defaultList;
+
+ /* Create an empty list */
+ defaultList = new ArrayList();
+ /* Add the string "empty" */
+ defaultList.add("empty");
+ /* Set the list */
+ setList(defaultList);
+ }
+
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied list.
+ * The model maintains a reference to this list, and returns
+ * consecutive elements in response to calls to <code>getNextValue()</code>.
+ * The initial value is that at position 0, so an initial call
+ * to <code>getValue()</code> returns the same as <code>list.get(0)</code>.
+ *
+ * @param list The list to use for this model.
+ * @throws IllegalArgumentException if the list is null or contains no
+ * elements.
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(List list)
+ {
+ /* Retain a reference to the valid list */
+ setList(list);
+ }
+
+ /**
+ * Constructs a <code>SpinnerListModel</code> using the supplied array.
+ * The model stores a reference to the wrapper list returned by
+ * <code>Arrays.asList()</code>. The wrapper list reflects modifications
+ * in the underlying array, so these changes will also be reflected
+ * by the model. The model produces consecutive elements from the array
+ * in response to calls to <code>getNextValue()</code>. The initial
+ * value returned by <code>getValue()</code> is the same as
+ * <code>array[0]</code>.
+ *
+ * @param array The array to use for this model.
+ * @throws IllegalArgumentException if the array is null or contains
+ * no elements.
+ * @see Arrays#asList(Object[])
+ * @see SpinnerListModel#getNextValue()
+ * @see SpinnerListModel#getValue()
+ */
+ public SpinnerListModel(Object[] array)
+ {
+ /* Check for a null or zero-sized array */
+ if (array == null || array.length == 0)
+ {
+ throw new IllegalArgumentException("The supplied array was invalid.");
+ }
+ /*
+ Retain a reference to a wrapper around the valid array
+ The array, in list form, will be tested again here, but we can't really
+ avoid this -- a null value to Arrays.asList will throw a NullPointerException
+ */
+ setList(Arrays.asList(array));
+ }
+
+ /**
+ * Returns the backing list for this model.
+ *
+ * @return The backing list.
+ */
+ public List getList()
+ {
+ return list;
+ }
+
+ /**
+ * Returns the next value from the list, which is the same as the element
+ * stored at the current index + 1. Null is returned if there are no more
+ * values to be returned (the end of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The next value from the list or null.
+ */
+ public Object getNextValue()
+ {
+ /* Check for a next value */
+ if (index < (list.size() - 1))
+ {
+ /* Return the element at the next index */
+ return list.get(index + 1);
+ }
+ else
+ {
+ /* Return null as this is the end of the list */
+ return null;
+ }
+ }
+
+ /**
+ * Returns the previous value from the list, which is the same as the element
+ * stored at the current index - 1. Null is returned if there are no more
+ * values to be returned (the start of the list has been reached). An
+ * ambiguity can occur here, as null may also be returned as a valid list
+ * element. This operation does not change the current value.
+ *
+ * @return The previous value from the list or null.
+ */
+ public Object getPreviousValue()
+ {
+ /* Check for a previous value. */
+ if (index > 0)
+ {
+ /* Return the element at the previous position */
+ return list.get(index - 1);
+ }
+ else
+ {
+ /* Return null as this is the start of the list */
+ return null;
+ }
+ }
+
+ /**
+ * Returns the current value of the model. Initially, this will
+ * be the element at position 0. On later invocations, this will
+ * be the last element returned by <code>getNextValue()</code>
+ * or <code>getPreviousValue()</code>.
+ *
+ * @return The current value.
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public Object getValue()
+ {
+ return list.get(index);
+ }
+
+ /**
+ * Changes the backing list for this model. The model only stores
+ * a reference to the list, so any changes made to the list elsewhere
+ * will be reflected in the values returned by the model. A
+ * <code>ChangeEvent</code> is fired if the list being used actually
+ * changes (i.e. the new list is not referentially equal (!=) to the
+ * old one).
+ *
+ * @param list The new list to use.
+ * @throws IllegalArgumentException if the list is null or contains
+ * no elements.
+ * @see ChangeEvent
+ */
+ public void setList(List list)
+ {
+ /* Check for null or zero size list */
+ if (list == null || list.size() == 0)
+ {
+ throw new IllegalArgumentException("The supplied list was invalid.");
+ }
+ /* Check for a change of referenced list */
+ if (this.list != list)
+ {
+ /* Store the new list */
+ this.list = list;
+ /* Notify listeners of a change */
+ fireStateChanged();
+ }
+ /* We reset the other values in either case */
+ /* Set the index to 0 */
+ index = 0;
+ }
+
+ /**
+ * Sets the current value of the model to be the one supplied.
+ * The value must exist within the backing list in order for
+ * the change to take place. Otherwise, an exception is thrown.
+ * The value used is the first occurrence of the value within
+ * the backing list. Listeners are notified of this change.
+ * Following the change, <code>getNextValue()</code> and
+ * <code>getPreviousValue()</code> return the objects following
+ * and prior to the supplied value, respectively.
+ *
+ * @param value The requested new value of the list.
+ * @throws IllegalArgumentException if the supplied value does
+ * not exist in the backing list.
+ * @see SpinnerListModel#getPreviousValue()
+ * @see SpinnerListModel#getNextValue()
+ */
+ public void setValue(Object value)
+ {
+ int valueIndex;
+
+ /* Search for the value in the list */
+ valueIndex = list.indexOf(value);
+ /* Check for the value being found */
+ if (valueIndex == -1)
+ {
+ throw new IllegalArgumentException("The supplied value does not "
+ + "exist in this list");
+ }
+ /* Make the indices match */
+ index = valueIndex;
+ /* Notify the listeners */
+ fireStateChanged();
+ }
+
+}
diff --git a/javax/swing/SpinnerNumberModel.java b/javax/swing/SpinnerNumberModel.java
new file mode 100644
index 000000000..370007cb8
--- /dev/null
+++ b/javax/swing/SpinnerNumberModel.java
@@ -0,0 +1,298 @@
+/* SpinnerNumberModel.java --
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+
+/**
+ * SpinnerNumberModel
+ *
+ * @author Ka-Hing Cheung
+ * @version 1.0
+ */
+public class SpinnerNumberModel extends AbstractSpinnerModel
+ implements Serializable
+{
+ /**
+ * For compatability with Sun's JDK
+ */
+ private static final long serialVersionUID = 7279176385485777821L;
+
+ /** DOCUMENT ME! */
+ private Number value;
+
+ /** DOCUMENT ME! */
+ private Comparable minimum;
+
+ /** DOCUMENT ME! */
+ private Comparable maximum;
+
+ /** DOCUMENT ME! */
+ private Number stepSize;
+
+ /**
+ * Creates a <code>SpinnerNumberModel</code> with initial value 0, step 1,
+ * and no maximum nor minimum.
+ */
+ public SpinnerNumberModel()
+ {
+ this(new Integer(0), null, null, new Integer(1));
+ }
+
+ /**
+ * Creates a <code>SpinnerNumberModel</code> with double precision
+ *
+ * @param value the initial value
+ * @param minimum the minimum value
+ * @param maximum the maximum value
+ * @param stepSize the step size
+ * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum does not
+ * hold
+ */
+ public SpinnerNumberModel(double value, double minimum, double maximum,
+ double stepSize)
+ {
+ this(new Double(value), new Double(minimum), new Double(maximum),
+ new Double(stepSize));
+ }
+
+ /**
+ * Creates a <code>SpinnerNumberModel</code> with integer precision
+ *
+ * @param value the initial value
+ * @param minimum the minimum value
+ * @param maximum the maximum value
+ * @param stepSize the step size
+ * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum does not
+ * hold
+ */
+ public SpinnerNumberModel(int value, int minimum, int maximum, int stepSize)
+ {
+ this(new Integer(value), new Integer(minimum), new Integer(maximum),
+ new Integer(stepSize));
+ }
+
+ /**
+ * Creates a <code>SpinnerNumberModel</code> with <code>Number</code>s and
+ * <code>Comparable</code>s.
+ *
+ * @param value the initial value
+ * @param minimum the minimum value, if null there's no minimum
+ * @param maximum the maximum value, if null there's no maximum
+ * @param stepSize the step size
+ *
+ * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum
+ * does not hold
+ */
+ public SpinnerNumberModel(Number value, Comparable minimum,
+ Comparable maximum, Number stepSize)
+ {
+ if (stepSize == null)
+ throw new IllegalArgumentException("stepSize may not be null");
+ if (value == null)
+ throw new IllegalArgumentException("value may not be null");
+ if (minimum != null)
+ {
+ if (minimum.compareTo(value) > 0)
+ throw new IllegalArgumentException("minimum is not <= value");
+ }
+ else
+ minimum = new Comparable()
+ {
+ public int compareTo(Object obj)
+ {
+ return -1;
+ }
+ };
+
+
+ if (maximum != null)
+ {
+ if (maximum.compareTo(value) < 0)
+ throw new IllegalArgumentException("maximum is not >= value");
+ }
+ else
+ maximum = new Comparable()
+ {
+ public int compareTo(Object obj)
+ {
+ return 1;
+ }
+ };
+
+
+ this.value = value;
+ this.stepSize = stepSize;
+ this.minimum = minimum;
+ this.maximum = maximum;
+ }
+
+ /**
+ * Sets the new value and fire a change event
+ *
+ * @param value the new value
+ *
+ * @throws IllegalArgumentException if minimum &lt;= value &lt;= maximum
+ * does not hold
+ */
+ public void setValue(Object value)
+ {
+ if (! (value instanceof Number))
+ throw new IllegalArgumentException("value must be a Number");
+
+ this.value = (Number) value;
+ fireStateChanged();
+ }
+
+ /**
+ * Gets the current value
+ *
+ * @return the current value
+ */
+ public Object getValue()
+ {
+ return value;
+ }
+
+ /**
+ * Gets the next value without changing the current value, or null if the
+ * current value is maximum.
+ *
+ * @return the next value
+ */
+ public Object getNextValue()
+ {
+ Number num;
+
+ if (value instanceof Double)
+ num = new Double(value.doubleValue() + stepSize.doubleValue());
+ else if (value instanceof Float)
+ num = new Double(value.floatValue() + stepSize.floatValue());
+ else if (value instanceof Long)
+ num = new Long(value.longValue() + stepSize.longValue());
+ else if (value instanceof Integer)
+ num = new Integer(value.intValue() + stepSize.intValue());
+ else if (value instanceof Short)
+ num = new Short((short) (value.shortValue() + stepSize.shortValue()));
+ else
+ num = new Byte((byte) (value.byteValue() + stepSize.byteValue()));
+
+ return maximum.compareTo(num) >= 0 ? num : null;
+ }
+
+ /**
+ * Gets the previous value without changing the current value, or null if
+ * the current value is minimum.
+ *
+ * @return the previous value
+ */
+ public Object getPreviousValue()
+ {
+ Number num;
+
+ if (value instanceof Double)
+ num = new Double(value.doubleValue() - stepSize.doubleValue());
+ else if (value instanceof Float)
+ num = new Double(value.floatValue() - stepSize.floatValue());
+ else if (value instanceof Long)
+ num = new Long(value.longValue() - stepSize.longValue());
+ else if (value instanceof Integer)
+ num = new Integer(value.intValue() - stepSize.intValue());
+ else if (value instanceof Short)
+ num = new Short((short) (value.shortValue() - stepSize.shortValue()));
+ else
+ num = new Byte((byte) (value.byteValue() - stepSize.byteValue()));
+
+ return minimum.compareTo(num) <= 0 ? num : null;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Number getNumber()
+ {
+ return value;
+ }
+
+ public Comparable getMinimum()
+ {
+ return minimum;
+ }
+
+ public void setMinimum(Comparable newMinimum)
+ {
+ if (minimum != newMinimum)
+ {
+ minimum = newMinimum;
+ fireStateChanged();
+ }
+ }
+
+ public Comparable getMaximum()
+ {
+ return maximum;
+ }
+
+ public void setMaximum(Comparable newMaximum)
+ {
+ if (maximum != newMaximum)
+ {
+ maximum = newMaximum;
+ fireStateChanged();
+ }
+ }
+
+ public Number getStepSize()
+ {
+ return stepSize;
+ }
+
+ public void setStepSize(Number newStepSize)
+ {
+ if (newStepSize == null)
+ throw new IllegalArgumentException();
+
+ if (stepSize != newStepSize)
+ {
+ stepSize = newStepSize;
+ fireStateChanged();
+ }
+ }
+}
diff --git a/javax/swing/SpringLayout.java b/javax/swing/SpringLayout.java
index 60a50525f..9d6734305 100644
--- a/javax/swing/SpringLayout.java
+++ b/javax/swing/SpringLayout.java
@@ -91,7 +91,7 @@ public class SpringLayout implements LayoutManager2
*
* @author Roman Kennke (roman@ontographics.com)
*/
- public final static class Constraints
+ public static class Constraints
{
// The constraints for each edge, and width and height.
diff --git a/javax/swing/SwingUtilities.java b/javax/swing/SwingUtilities.java
index 05a3a6191..731a7bc8d 100644
--- a/javax/swing/SwingUtilities.java
+++ b/javax/swing/SwingUtilities.java
@@ -51,9 +51,13 @@ import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.Toolkit;
import java.awt.Window;
+import java.awt.event.ActionEvent;
import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.lang.reflect.InvocationTargetException;
+import javax.swing.plaf.ActionMapUIResource;
+import javax.swing.plaf.InputMapUIResource;
/**
@@ -911,4 +915,103 @@ public class SwingUtilities implements SwingConstants
return true;
}
}
+
+ public static boolean notifyAction(Action action,
+ KeyStroke ks,
+ KeyEvent event,
+ Object sender,
+ int modifiers)
+ {
+ if (action != null && action.isEnabled())
+ {
+ String name = (String) action.getValue(Action.ACTION_COMMAND_KEY);
+ if (name == null
+ && event.getKeyChar() != KeyEvent.CHAR_UNDEFINED)
+ name = new String(new char[] {event.getKeyChar()});
+ action.actionPerformed(new ActionEvent(sender,
+ ActionEvent.ACTION_PERFORMED,
+ name, modifiers));
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * <p>Change the shared, UI-managed {@link ActionMap} for a given
+ * component. ActionMaps are arranged in a hierarchy, in order to
+ * encourage sharing of common actions between components. The hierarchy
+ * unfortunately places UI-managed ActionMaps at the <em>end</em> of the
+ * parent-pointer chain, as illustrated:</p>
+ *
+ * <pre>
+ * [{@link javax.swing.JComponent#getActionMap()}]
+ * --&gt; [{@link javax.swing.ActionMap}]
+ * parent --&gt; [{@link javax.swing.text.KeymapActionMap}]
+ * parent --&gt; [{@link javax.swing.plaf.ActionMapUIResource}]
+ * </pre>
+ *
+ * <p>Our goal with this method is to replace the first ActionMap along
+ * this chain which is an instance of {@link ActionMapUIResource}, since
+ * these are the ActionMaps which are supposed to be shared between
+ * components.</p>
+ *
+ * <p>If the provided ActionMap is <code>null</code>, we interpret the
+ * call as a request to remove the UI-managed ActionMap from the
+ * component's ActionMap parent chain.</p>
+ */
+ public static void replaceUIActionMap(JComponent component,
+ ActionMap uiActionMap)
+ {
+ ActionMap child = component.getActionMap();
+ if (child == null)
+ component.setActionMap(uiActionMap);
+ else
+ {
+ while(child.getParent() != null
+ && !(child.getParent() instanceof ActionMapUIResource))
+ child = child.getParent();
+ if (child != null)
+ child.setParent(uiActionMap);
+ }
+ }
+
+ /**
+ * <p>Change the shared, UI-managed {@link InputMap} for a given
+ * component. InputMaps are arranged in a hierarchy, in order to
+ * encourage sharing of common input mappings between components. The
+ * hierarchy unfortunately places UI-managed InputMaps at the
+ * <em>end</em> of the parent-pointer chain, as illustrated:</p>
+ *
+ * <pre>
+ * [{@link javax.swing.JComponent#getInputMap()}]
+ * --&gt; [{@link javax.swing.InputMap}]
+ * parent --&gt; [{@link javax.swing.text.KeymapWrapper}]
+ * parent --&gt; [{@link javax.swing.plaf.InputMapUIResource}]
+ * </pre>
+ *
+ * <p>Our goal with this method is to replace the first InputMap along
+ * this chain which is an instance of {@link InputMapUIResource}, since
+ * these are the InputMaps which are supposed to be shared between
+ * components.</p>
+ *
+ * <p>If the provided InputMap is <code>null</code>, we interpret the
+ * call as a request to remove the UI-managed InputMap from the
+ * component's InputMap parent chain.</p>
+ */
+ public static void replaceUIInputMap(JComponent component,
+ int condition,
+ InputMap uiInputMap)
+ {
+ InputMap child = component.getInputMap(condition);
+ if (child == null)
+ component.setInputMap(condition, uiInputMap);
+ else
+ {
+ while(child.getParent() != null
+ && !(child.getParent() instanceof InputMapUIResource))
+ child = child.getParent();
+ if (child != null)
+ child.setParent(uiInputMap);
+ }
+ }
}
diff --git a/javax/swing/Timer.java b/javax/swing/Timer.java
index 7b80c7a34..529ad1934 100644
--- a/javax/swing/Timer.java
+++ b/javax/swing/Timer.java
@@ -172,7 +172,7 @@ public class Timer implements Serializable
}
catch (Exception e)
{
- System.out.println("swing.Timer::" + e);
+// System.out.println("swing.Timer::" + e);
}
}
}
@@ -374,7 +374,7 @@ public class Timer implements Serializable
public void start()
{
if (isRunning())
- return;
+ return;
waker = new Waker();
waker.start();
}
@@ -394,7 +394,8 @@ public class Timer implements Serializable
public void stop()
{
running = false;
- waker.interrupt();
+ if (waker != null)
+ waker.interrupt();
synchronized (queueLock)
{
queue = 0;
diff --git a/javax/swing/ToolTipManager.java b/javax/swing/ToolTipManager.java
index e0a018237..3556ef005 100644
--- a/javax/swing/ToolTipManager.java
+++ b/javax/swing/ToolTipManager.java
@@ -460,6 +460,8 @@ public class ToolTipManager extends MouseAdapter implements MouseMotionListener
public void mouseMoved(MouseEvent event)
{
currentPoint = event.getPoint();
+ if (currentTip != null)
+ currentTip.setTipText(((JComponent) currentComponent).getToolTipText(event));
if (enterTimer.isRunning())
enterTimer.restart();
}
diff --git a/javax/swing/TransferHandler.java b/javax/swing/TransferHandler.java
new file mode 100644
index 000000000..e64df9c4c
--- /dev/null
+++ b/javax/swing/TransferHandler.java
@@ -0,0 +1,55 @@
+/* TransferHandler.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing;
+
+import java.io.Serializable;
+
+public class TransferHandler implements Serializable
+{
+ private static final long serialVersionUID = -7908749299918704233L;
+
+ public static final int NONE = 0;
+ public static final int COPY = 1;
+ public static final int MOVE = 2;
+ public static final int COPY_OR_MOVE = 3;
+
+ protected TransferHandler()
+ {
+ // Do nothing here.
+ }
+}
diff --git a/javax/swing/UIDefaults.java b/javax/swing/UIDefaults.java
index 44fa4f3bc..a1c90674a 100644
--- a/javax/swing/UIDefaults.java
+++ b/javax/swing/UIDefaults.java
@@ -477,7 +477,7 @@ public class UIDefaults extends Hashtable
propertyChangeSupport.addPropertyChangeListener(listener);
}
- void removePropertyChangeListener(PropertyChangeListener listener)
+ public void removePropertyChangeListener(PropertyChangeListener listener)
{
propertyChangeSupport.removePropertyChangeListener(listener);
}
diff --git a/javax/swing/UIManager.java b/javax/swing/UIManager.java
index d7ebad9a5..5d8a0f763 100644
--- a/javax/swing/UIManager.java
+++ b/javax/swing/UIManager.java
@@ -44,6 +44,7 @@ import java.awt.Font;
import java.awt.Insets;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
+import java.util.Locale;
import javax.swing.border.Border;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.metal.MetalLookAndFeel;
@@ -158,10 +159,43 @@ public class UIManager implements Serializable
}
public static LookAndFeel[] getAuxiliaryLookAndFeels()
- { return aux_installed; }
+ {
+ return aux_installed;
+ }
public static Object get(Object key)
- { return getLookAndFeel().getDefaults().get(key); }
+ {
+ return getLookAndFeel().getDefaults().get(key);
+ }
+
+ public static Object get(Object key, Locale locale)
+ {
+ return getLookAndFeel().getDefaults().get(key ,locale);
+ }
+
+ /**
+ * Returns a boolean value from the defaults table,
+ * <code>false</code> if key is not present.
+ *
+ * @since 1.4
+ */
+ public static boolean getBoolean(Object key)
+ {
+ Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key);
+ return value != null ? value.booleanValue() : false;
+ }
+
+ /**
+ * Returns a boolean value from the defaults table,
+ * <code>false</code> if key is not present.
+ *
+ * @since 1.4
+ */
+ public static boolean getBoolean(Object key, Locale locale)
+ {
+ Boolean value = (Boolean) getLookAndFeel().getDefaults().get(key, locale);
+ return value != null ? value.booleanValue() : false;
+ }
/**
* Returns a border from the defaults table.
@@ -172,6 +206,16 @@ public class UIManager implements Serializable
}
/**
+ * Returns a border from the defaults table.
+ *
+ * @since 1.4
+ */
+ public static Border getBorder(Object key, Locale locale)
+ {
+ return (Border) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Returns a drawing color from the defaults table.
*/
public static Color getColor(Object key)
@@ -180,6 +224,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns a drawing color from the defaults table.
+ */
+ public static Color getColor(Object key, Locale locale)
+ {
+ return (Color) getLookAndFeel().getDefaults().get(key);
+ }
+
+ /**
* this string can be passed to Class.forName()
*/
public static String getCrossPlatformLookAndFeelClassName()
@@ -204,6 +256,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns a dimension from the defaults table.
+ */
+ public static Dimension getDimension(Object key, Locale locale)
+ {
+ return (Dimension) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Retrieves a font from the defaults table of the current
* LookAndFeel.
*
@@ -217,6 +277,19 @@ public class UIManager implements Serializable
}
/**
+ * Retrieves a font from the defaults table of the current
+ * LookAndFeel.
+ *
+ * @param key an Object that specifies the font. Typically,
+ * this is a String such as
+ * <code>TitledBorder.font</code>.
+ */
+ public static Font getFont(Object key, Locale locale)
+ {
+ return (Font) getLookAndFeel().getDefaults().get(key ,locale);
+ }
+
+ /**
* Returns an Icon from the defaults table.
*/
public static Icon getIcon(Object key)
@@ -225,6 +298,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns an Icon from the defaults table.
+ */
+ public static Icon getIcon(Object key, Locale locale)
+ {
+ return (Icon) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Returns an Insets object from the defaults table.
*/
public static Insets getInsets(Object key)
@@ -232,6 +313,14 @@ public class UIManager implements Serializable
return (Insets) getLookAndFeel().getDefaults().getInsets(key);
}
+ /**
+ * Returns an Insets object from the defaults table.
+ */
+ public static Insets getInsets(Object key, Locale locale)
+ {
+ return (Insets) getLookAndFeel().getDefaults().getInsets(key, locale);
+ }
+
public static LookAndFeelInfo[] getInstalledLookAndFeels()
{
return installed;
@@ -245,6 +334,14 @@ public class UIManager implements Serializable
return x.intValue();
}
+ public static int getInt(Object key, Locale locale)
+ {
+ Integer x = (Integer) getLookAndFeel().getDefaults().get(key, locale);
+ if (x == null)
+ return 0;
+ return x.intValue();
+ }
+
public static LookAndFeel getLookAndFeel()
{
return look_and_feel;
@@ -268,6 +365,14 @@ public class UIManager implements Serializable
}
/**
+ * Returns a string from the defaults table.
+ */
+ public static String getString(Object key, Locale locale)
+ {
+ return (String) getLookAndFeel().getDefaults().get(key, locale);
+ }
+
+ /**
* Returns the name of the LookAndFeel class that implements the
* native systems look and feel if there is one, otherwise the name
* of the default cross platform LookAndFeel class.
diff --git a/javax/swing/colorchooser/AbstractColorChooserPanel.java b/javax/swing/colorchooser/AbstractColorChooserPanel.java
index 3fa0ad194..37d627698 100644
--- a/javax/swing/colorchooser/AbstractColorChooserPanel.java
+++ b/javax/swing/colorchooser/AbstractColorChooserPanel.java
@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing.colorchooser;
import java.awt.Color;
@@ -44,92 +43,119 @@ import javax.swing.Icon;
import javax.swing.JColorChooser;
import javax.swing.JPanel;
+
/**
* AbstractColorChooserPanel
- * @author Andrew Selkirk
- * @version 1.0
+ *
+ * @author Andrew Selkirk
+ * @version 1.0
*/
public abstract class AbstractColorChooserPanel extends JPanel
{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = -977469671210173863L;
- /**
- * chooser
- */
- private JColorChooser chooser;
-
- /**
- * Constructor AbstractColorChooserPanel
- */
- public AbstractColorChooserPanel() {
- // TODO
- } // AbstractColorChooserPanel()
-
- /**
- * getDisplayName
- * @returns String
- */
- public abstract String getDisplayName();
-
- /**
- * updateChooser
- */
- public abstract void updateChooser();
-
- /**
- * buildChooser
- */
- protected abstract void buildChooser();
-
- /**
- * getSmallDisplayIcon
- * @returns Icon
- */
- public abstract Icon getSmallDisplayIcon();
-
- /**
- * getLargeDisplayIcon
- * @returns Icon
- */
- public abstract Icon getLargeDisplayIcon();
-
- /**
- * installChooserPanel
- * @param chooser TODO
- */
- public void installChooserPanel(JColorChooser chooser) {
- // TODO
- } // installChooserPanel()
-
- /**
- * uninstallChooserPanel
- * @param chooser TODO
- */
- public void uninstallChooserPanel(JColorChooser chooser) {
- // TODO
- } // uninstallChooserPanel()
-
- /**
- * getColorSelectionModel
- * @returns ColorSelectionModel
- */
- public ColorSelectionModel getColorSelectionModel() {
- return null; // TODO
- } // getColorSelectionModel()
-
- /**
- * getColorFromModel
- * @returns Color
- */
- protected Color getColorFromModel() {
- return null; // TODO
- } // getColorFromModel()
-
- /**
- * paint
- * @param graphics TODO
- */
- public void paint(Graphics graphics) {
- // TODO
- } // paint()
+ /** The chooser associated with this panel. */
+ private JColorChooser chooser;
+
+ /**
+ * This is the constructor for the AbstractColorChooserPanel.
+ */
+ public AbstractColorChooserPanel()
+ {
+ } // AbstractColorChooserPanel()
+
+ /**
+ * This method returns the name displayed in the tab for this chooser panel.
+ *
+ * @return The name displayed in the JTabbedPane's tabs.
+ */
+ public abstract String getDisplayName();
+
+ /**
+ * This method updates the chooser panel when the JColorChooser's color has
+ * changed.
+ */
+ public abstract void updateChooser();
+
+ /**
+ * This method constructs and does any initialization necessary for the
+ * chooser panel.
+ */
+ protected abstract void buildChooser();
+
+ /**
+ * This method sets the small icon used in the JTabbedPane for this chooser
+ * panel.
+ *
+ * @return The small icon used in the JTabbedPane.
+ */
+ public abstract Icon getSmallDisplayIcon();
+
+ /**
+ * This method sets the large icon useed in the jTabbedPane for this chooser
+ * panel.
+ *
+ * @return The large icon.
+ */
+ public abstract Icon getLargeDisplayIcon();
+
+ /**
+ * This method installs the chooser panel for the given JColorChooser.
+ *
+ * @param chooser The JColorChooser that will have this panel installed.
+ */
+ public void installChooserPanel(JColorChooser chooser)
+ {
+ this.chooser = chooser;
+ buildChooser();
+ } // installChooserPanel()
+
+ /**
+ * This method removes the chooser panel from the given JColorChooser and
+ * does any necessary clean up for the chooser panel.
+ *
+ * @param chooser The JColorChooser that is having this panel removed.
+ */
+ public void uninstallChooserPanel(JColorChooser chooser)
+ {
+ this.chooser = null;
+ } // uninstallChooserPanel()
+
+ /**
+ * This method returns the ColorSelectionModel for the JColorChooser
+ * associated with this chooser panel.
+ *
+ * @return The ColorSelectionModel for the JColorChooser associated with
+ * this chooser panel.
+ */
+ public ColorSelectionModel getColorSelectionModel()
+ {
+ if (chooser != null)
+ return chooser.getSelectionModel();
+ return null;
+ } // getColorSelectionModel()
+
+ /**
+ * This method returns the current color stored in the model for this
+ * chooser panel.
+ *
+ * @return The current color.
+ */
+ protected Color getColorFromModel()
+ {
+ if (chooser != null)
+ return chooser.getColor();
+ return null;
+ } // getColorFromModel()
+
+ /**
+ * This method paints the chooser panel.
+ *
+ * @param graphics The Graphics object to paint with.
+ */
+ public void paint(Graphics graphics)
+ {
+ super.paint(graphics);
+ } // paint()
} // AbstractColorChooserPanel
diff --git a/javax/swing/colorchooser/ColorChooserComponentFactory.java b/javax/swing/colorchooser/ColorChooserComponentFactory.java
index ffd8718ea..6e7ca33d7 100644
--- a/javax/swing/colorchooser/ColorChooserComponentFactory.java
+++ b/javax/swing/colorchooser/ColorChooserComponentFactory.java
@@ -35,49 +35,51 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing.colorchooser;
import javax.swing.JComponent;
+
/**
* ColorChooserComponentFactory
- * @author Andrew Selkirk
- * @version 1.0
+ *
+ * @author Andrew Selkirk
+ * @version 1.0
*/
-public class ColorChooserComponentFactory {
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor ColorChooserComponentFactory
- */
- private ColorChooserComponentFactory() {
- // TODO
- } // ColorChooserComponentFactory()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getDefaultChooserPanels
- * @returns AbstractColorChooserPanel[]
- */
- public static AbstractColorChooserPanel[] getDefaultChooserPanels() {
- return null; // TODO
- } // getDefaultChooserPanels()
-
- /**
- * getPreviewPanel
- * @returns JComponent
- */
- public static JComponent getPreviewPanel() {
- return null; // TODO
- } // getPreviewPanel()
-
-
+public class ColorChooserComponentFactory
+{
+ /**
+ * Constructor ColorChooserComponentFactory
+ */
+ private ColorChooserComponentFactory()
+ {
+ } // ColorChooserComponentFactory()
+
+ /**
+ * This method returns the three default chooser panels to be used in
+ * JColorChooser.
+ *
+ * @return The default chooser panels.
+ */
+ public static AbstractColorChooserPanel[] getDefaultChooserPanels()
+ {
+ AbstractColorChooserPanel[] values =
+ {
+ new DefaultSwatchChooserPanel(),
+ new DefaultHSBChooserPanel(),
+ new DefaultRGBChooserPanel()
+ };
+ return values;
+ }
+
+ /**
+ * This method returns the default preview panel to be used with
+ * JColorChoosers.
+ *
+ * @return The default preview panel.
+ */
+ public static JComponent getPreviewPanel()
+ {
+ return new DefaultPreviewPanel();
+ } // getPreviewPanel()
} // ColorChooserComponentFactory
diff --git a/javax/swing/colorchooser/DefaultColorSelectionModel.java b/javax/swing/colorchooser/DefaultColorSelectionModel.java
index 43df7edff..90145edce 100644
--- a/javax/swing/colorchooser/DefaultColorSelectionModel.java
+++ b/javax/swing/colorchooser/DefaultColorSelectionModel.java
@@ -35,7 +35,6 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
-
package javax.swing.colorchooser;
import java.awt.Color;
@@ -44,43 +43,55 @@ import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.EventListenerList;
+
/**
- * DefaultColorSelectionModel
- * @author Andrew Selkirk
- * @version 1.0
+ * This is the default implementation of the ColorSelectionModel interface
+ * that JColorChoosers use.
+ *
+ * @author Andrew Selkirk
+ * @version 1.0
*/
-public class DefaultColorSelectionModel
- implements ColorSelectionModel, Serializable
+public class DefaultColorSelectionModel implements ColorSelectionModel,
+ Serializable
{
+ /** DOCUMENT ME! */
private static final long serialVersionUID = -8117143602864778804L;
+ /** The currently selected color. */
private Color selectedColor;
- protected transient ChangeEvent changeEvent = new ChangeEvent (this);
- protected EventListenerList listenerList = new EventListenerList ();
+ /** The ChangeEvent fired to all ChangeListeners. */
+ protected transient ChangeEvent changeEvent = new ChangeEvent(this);
+
+ /** The list of listeners. */
+ protected EventListenerList listenerList = new EventListenerList();
/**
- * Creates a new color selection model.
+ * Creates a new color selection model with the default white color.
*/
public DefaultColorSelectionModel()
{
- this (Color.white);
+ this(Color.white);
}
/**
* Creates a new color selection model with a given selected color.
- *
- * @param color The selected color.
+ *
+ * @param color The initial color.
+ *
+ * @throws Error If the color is null.
*/
- public DefaultColorSelectionModel (Color color)
+ public DefaultColorSelectionModel(Color color)
{
super();
+ if (color == null)
+ throw new Error("ColorSelectionModel cannot be set to have null color.");
this.selectedColor = color;
}
/**
* Returns the selected color.
- *
+ *
* @return The selected color.
*/
public Color getSelectedColor()
@@ -89,31 +100,41 @@ public class DefaultColorSelectionModel
}
/**
+ * This method sets the color.
+ *
* @param color The color to set.
+ *
+ * @throws Error If the color is set.
*/
- public void setSelectedColor (Color color)
+ public void setSelectedColor(Color color)
{
- this.selectedColor = color;
+ if (color == null)
+ throw new Error("ColorSelectionModel cannot be set to have null color.");
+ if (color != selectedColor)
+ {
+ this.selectedColor = color;
+ fireStateChanged();
+ }
}
/**
* Adds a listener to this model.
- *
+ *
* @param listener The listener to add.
*/
- public void addChangeListener (ChangeListener listener)
+ public void addChangeListener(ChangeListener listener)
{
- listenerList.add (ChangeListener.class, listener);
+ listenerList.add(ChangeListener.class, listener);
}
/**
* Removes a listener from this model.
- *
+ *
* @param listener The listener to remove.
*/
- public void removeChangeListener (ChangeListener listener)
+ public void removeChangeListener(ChangeListener listener)
{
- listenerList.remove (ChangeListener.class, listener);
+ listenerList.remove(ChangeListener.class, listener);
}
/**
@@ -123,19 +144,19 @@ public class DefaultColorSelectionModel
*/
public ChangeListener[] getChangeListeners()
{
- return (ChangeListener[]) listenerList.getListeners (ChangeListener.class);
+ return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
}
/**
* Calls all the <code>stateChanged()</code> method of all added
- * <code>ChangeListener</code> objects with <code>changeEvent</code>
- * as argument.
+ * <code>ChangeListener</code> objects with <code>changeEvent</code> as
+ * argument.
*/
protected void fireStateChanged()
{
ChangeListener[] listeners = getChangeListeners();
for (int i = 0; i < listeners.length; i++)
- listeners [i].stateChanged (changeEvent);
+ listeners[i].stateChanged(changeEvent);
}
}
diff --git a/javax/swing/colorchooser/DefaultHSBChooserPanel.java b/javax/swing/colorchooser/DefaultHSBChooserPanel.java
new file mode 100644
index 000000000..449a9c8ea
--- /dev/null
+++ b/javax/swing/colorchooser/DefaultHSBChooserPanel.java
@@ -0,0 +1,874 @@
+/* DefaultHSBChooserPanel.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.colorchooser;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.GridLayout;
+import java.awt.Image;
+import java.awt.LayoutManager;
+import java.awt.Point;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseMotionListener;
+import java.awt.image.MemoryImageSource;
+import javax.swing.AbstractButton;
+import javax.swing.ButtonGroup;
+import javax.swing.Icon;
+import javax.swing.JColorChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingConstants;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+
+/**
+ * This is the Default HSB Panel displayed in the JColorChooser.
+ */
+class DefaultHSBChooserPanel extends AbstractColorChooserPanel
+{
+ /** The gradient image displayed. */
+ private transient Image gradientImage;
+
+ /** The Panel that holds the gradient image. */
+ private transient JPanel gradientPanel;
+
+ /** The track gradient image. */
+ private transient Image trackImage;
+
+ /** The panel that holds the track. */
+ private transient JPanel trackPanel;
+
+ /** The slider for the locked HSB value. */
+ private transient JSlider slider;
+
+ /** The RadioButton that controls the Hue. */
+ private transient JRadioButton hRadio;
+
+ /** The RadioButton that controls the Saturation. */
+ private transient JRadioButton sRadio;
+
+ /** The RadioButton that controls the Brightness. */
+ private transient JRadioButton bRadio;
+
+ /** The JSpinner that controls the Hue. */
+ private transient JSpinner hSpinner;
+
+ /** The JSpinner that controls the Saturation. */
+ private transient JSpinner sSpinner;
+
+ /** The JSpinner that controls the Brightness. */
+ private transient JSpinner bSpinner;
+
+ /** The default width of the gradient image. */
+ private static final int imgWidth = 200;
+
+ /** The default height of the gradient image. */
+ private static final int imgHeight = 200;
+
+ /** The default width of the track gradient. */
+ private static final int trackWidth = 30;
+
+ /** The JLabel for Red. */
+ private static final JLabel R = new JLabel("R");
+
+ /** The JLabel for Green. */
+ private static final JLabel G = new JLabel("G");
+
+ /** The JLabel for Blue. */
+ private static final JLabel B = new JLabel("B");
+
+ // FIXME: Should be textfields.
+
+ /** The JLabel that displays the value of Red. */
+ private transient JLabel rFull;
+
+ /** The JLabel that displays the value of Green. */
+ private transient JLabel gFull;
+
+ /** The JLabel that displays the value of Blue. */
+ private transient JLabel bFull;
+
+ /** The point that is displayed in the gradient image. */
+ private transient Point gradientPoint = new Point();
+
+ /**
+ * This indicates that the change to the slider or point is triggered
+ * internally.
+ */
+ private transient boolean internalChange = false;
+
+ /** This indicates that the change to the spinner is triggered internally. */
+ private transient boolean spinnerTrigger = false;
+
+ /** This int identifies which spinner is currently locked. */
+ private transient int locked = -1;
+
+ /** This value indicates that the Hue spinner is locked. */
+ static final int HLOCKED = 0;
+
+ /** This value indicates that the Saturation spinner is locked. */
+ static final int SLOCKED = 1;
+
+ /** This value indicates that the Brightness spinner is locked. */
+ static final int BLOCKED = 2;
+
+ /**
+ * This method indicates that the mouse event is in the process of being
+ * handled.
+ */
+ private transient boolean handlingMouse;
+
+ /**
+ * This helper class handles mouse events on the gradient image.
+ */
+ class MainGradientMouseListener extends MouseAdapter
+ implements MouseMotionListener
+ {
+ /**
+ * This method is called when the mouse is pressed over the gradient
+ * image. The JColorChooser is then updated with new HSB values.
+ *
+ * @param e The MouseEvent.
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ gradientPoint = e.getPoint();
+ update(e.getPoint());
+ }
+
+ /**
+ * This method is called when the mouse is dragged over the gradient
+ * image. The JColorChooser is then updated with the new HSB values.
+ *
+ * @param e The MouseEvent.
+ */
+ public void mouseDragged(MouseEvent e)
+ {
+ Point p = e.getPoint();
+ if (p.x < 0 || p.y < 0 || p.y > imgHeight || p.x > imgWidth)
+ return;
+
+ gradientPoint = p;
+ update(p);
+ }
+
+ /**
+ * This method is called when the mouse is moved over the gradient image.
+ *
+ * @param e The MouseEvent.
+ */
+ public void mouseMoved(MouseEvent e)
+ {
+ // Do nothing.
+ }
+
+ /**
+ * This method updates the JColorChooser with the new values.
+ *
+ * @param p The Point where the MouseEvent occurred.
+ */
+ private void update(Point p)
+ {
+ handlingMouse = true;
+ if (hSpinner.isEnabled())
+ updateH(p);
+ else if (sSpinner.isEnabled())
+ updateS(p);
+ else
+ updateB(p);
+ handlingMouse = false;
+ }
+
+ /**
+ * This method updates the SB values if Hue is locked.
+ *
+ * @param p The point where the MouseEvent occurred.
+ */
+ private void updateH(Point p)
+ {
+ float s = (imgWidth - p.x * 1f) / imgWidth;
+ float b = (imgHeight - p.y * 1f) / imgHeight;
+
+ // Avoid two changes to the model by changing internalChange to true.
+ internalChange = true;
+ sSpinner.setValue(new Integer((int) (s * 100)));
+ internalChange = false;
+ bSpinner.setValue(new Integer((int) (b * 100)));
+
+ revalidate();
+ }
+
+ /**
+ * This method updates the HB values if Saturation is locked.
+ *
+ * @param p The point where the MouseEvent occurred.
+ */
+ private void updateS(Point p)
+ {
+ float h = p.x * 1f / imgWidth;
+ float b = (imgHeight - p.y * 1f) / imgHeight;
+
+ internalChange = true;
+ hSpinner.setValue(new Integer((int) (h * 365)));
+ internalChange = false;
+ bSpinner.setValue(new Integer((int) (b * 100)));
+
+ revalidate();
+ }
+
+ /**
+ * This method updates the HS values if Brightness is locked.
+ *
+ * @param p The point where the MouseEvent occurred.
+ */
+ private void updateB(Point p)
+ {
+ float h = p.x * 1f / imgWidth;
+ float s = (imgHeight - p.y * 1f) / imgHeight;
+
+ internalChange = true;
+ hSpinner.setValue(new Integer((int) (h * 365)));
+ internalChange = false;
+ sSpinner.setValue(new Integer((int) (s * 100)));
+
+ revalidate();
+ }
+ }
+
+ /**
+ * This method listens for slider value changes.
+ */
+ class SliderChangeListener implements ChangeListener
+ {
+ /**
+ * This method is called when the slider value changes. It should change
+ * the color of the JColorChooser.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ if (internalChange)
+ return;
+
+ Integer value = new Integer(slider.getValue());
+
+ switch (locked)
+ {
+ case HLOCKED:
+ hSpinner.setValue(value);
+ break;
+ case SLOCKED:
+ sSpinner.setValue(value);
+ break;
+ case BLOCKED:
+ bSpinner.setValue(value);
+ break;
+ }
+ }
+ }
+
+ /**
+ * This helper class determines the active JSpinner.
+ */
+ class RadioStateListener implements ChangeListener
+ {
+ /**
+ * This method is called when there is a new JRadioButton that was
+ * selected. As a result, it should activate the associated JSpinner.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ JSpinner change;
+ if (e.getSource() == hRadio)
+ {
+ locked = HLOCKED;
+ change = hSpinner;
+ }
+ else if (e.getSource() == sRadio)
+ {
+ locked = SLOCKED;
+ change = sSpinner;
+ }
+ else
+ {
+ locked = BLOCKED;
+ change = bSpinner;
+ }
+
+ change.setEnabled(((AbstractButton) e.getSource()).isSelected());
+ updateSlider();
+ updateTrack();
+ updateImage();
+ repaint();
+ }
+ }
+
+ /**
+ * This class listens to the JSpinners for changes.
+ */
+ class ImageScrollListener implements ChangeListener
+ {
+ /**
+ * This method is called whenever one of the JSpinner values change. The
+ * JColorChooser should be updated with the new HSB values.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ if (internalChange)
+ return;
+
+ float h = ((Number) hSpinner.getValue()).intValue() / 360f;
+ float s = ((Number) sSpinner.getValue()).intValue() / 100f;
+ float b = ((Number) bSpinner.getValue()).intValue() / 100f;
+
+ spinnerTrigger = true;
+ getColorSelectionModel().setSelectedColor(new Color(Color.HSBtoRGB(h, s,
+ b)));
+ spinnerTrigger = false;
+
+ if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting())
+ {
+ updateImage();
+ updateTrack();
+ }
+ repaint();
+ }
+ }
+
+ /**
+ * Creates a new DefaultHSBChooserPanel object.
+ */
+ DefaultHSBChooserPanel()
+ {
+ super();
+ }
+
+ /**
+ * This method returns the name displayed by the JColorChooser tab that
+ * holds this panel.
+ *
+ * @return The name displayed in the JColorChooser tab.
+ */
+ public String getDisplayName()
+ {
+ return "HSB";
+ }
+
+ /**
+ * This method updates the various components inside the HSBPanel (the
+ * JSpinners, the JSlider, and the gradient image point) with updated
+ * values when the JColorChooser color value changes.
+ */
+ public void updateChooser()
+ {
+ Color c = getColorSelectionModel().getSelectedColor();
+
+ float[] hsbVals = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(),
+ null);
+
+ internalChange = true;
+
+ if (! spinnerTrigger)
+ {
+ hSpinner.setValue(new Integer((int) (hsbVals[0] * 360)));
+ sSpinner.setValue(new Integer((int) (hsbVals[1] * 100)));
+ bSpinner.setValue(new Integer((int) (hsbVals[2] * 100)));
+ }
+
+ switch (locked)
+ {
+ case HLOCKED:
+ if (slider != null)
+ slider.setValue(((Number) hSpinner.getValue()).intValue());
+ if (! handlingMouse)
+ {
+ gradientPoint.x = (int) ((1
+ - ((Number) sSpinner.getValue()).intValue() / 100f) * imgWidth);
+ gradientPoint.y = (int) ((1
+ - ((Number) bSpinner.getValue()).intValue() / 100f) * imgHeight);
+ }
+ break;
+ case SLOCKED:
+ if (slider != null)
+ slider.setValue(((Number) sSpinner.getValue()).intValue());
+ if (! handlingMouse)
+ {
+ gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / 360f * imgWidth);
+ gradientPoint.y = (int) ((1
+ - ((Number) bSpinner.getValue()).intValue() / 100f) * imgHeight);
+ }
+ break;
+ case BLOCKED:
+ if (slider != null)
+ slider.setValue(((Number) bSpinner.getValue()).intValue());
+ if (! handlingMouse)
+ {
+ gradientPoint.x = (int) (((Number) hSpinner.getValue()).intValue() / 360f * imgWidth);
+ gradientPoint.y = (int) ((1
+ - ((Number) sSpinner.getValue()).intValue() / 100f) * imgHeight);
+ }
+ break;
+ }
+ internalChange = false;
+
+ if (! handlingMouse && slider != null && ! slider.getValueIsAdjusting())
+ updateImage();
+
+ if (! handlingMouse || locked != HLOCKED)
+ updateTrack();
+ updateTextFields();
+ }
+
+ /**
+ * This method builds the DefaultHSBChooserPanel.
+ */
+ protected void buildChooser()
+ {
+ setLayout(new BorderLayout());
+
+ add(buildRightPanel(), BorderLayout.EAST);
+
+ JPanel container = new JPanel();
+ container.setLayout(new BorderLayout());
+
+ gradientPanel = new JPanel()
+ {
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(imgWidth, imgHeight);
+ }
+
+ public void paint(Graphics g)
+ {
+ if (gradientImage != null)
+ g.drawImage(gradientImage, 0, 0, this);
+
+ Color saved = g.getColor();
+ g.setColor(Color.WHITE);
+ g.drawOval(gradientPoint.x - 3, gradientPoint.y - 3, 6, 6);
+ g.setColor(saved);
+ }
+ };
+
+ MouseAdapter ml = new MainGradientMouseListener();
+ gradientPanel.addMouseListener(ml);
+ gradientPanel.addMouseMotionListener((MouseMotionListener) ml);
+
+ trackPanel = new JPanel()
+ {
+ public Dimension getPreferredSize()
+ {
+ return new Dimension(trackWidth, imgHeight);
+ }
+
+ public void paint(Graphics g)
+ {
+ if (trackImage != null)
+ g.drawImage(trackImage, 0, 0, this);
+ }
+ };
+
+ slider = new JSlider();
+ slider.setPaintTrack(false);
+ slider.setPaintTicks(false);
+
+ slider.setOrientation(SwingConstants.VERTICAL);
+
+ updateSlider();
+
+ container.add(gradientPanel, BorderLayout.WEST);
+ container.add(slider, BorderLayout.CENTER);
+ container.add(trackPanel, BorderLayout.EAST);
+
+ add(container, BorderLayout.WEST);
+ slider.addChangeListener(new SliderChangeListener());
+ repaint();
+ }
+
+ /**
+ * This method uninstalls the DefaultHSBPanel.
+ *
+ * @param chooser The JColorChooser to remove this panel from.
+ */
+ public void uninstallChooserPanel(JColorChooser chooser)
+ {
+ trackImage = null;
+ gradientImage = null;
+ gradientPanel = null;
+ slider = null;
+
+ hSpinner = null;
+ sSpinner = null;
+ bSpinner = null;
+
+ hRadio = null;
+ sRadio = null;
+ bRadio = null;
+
+ removeAll();
+ super.uninstallChooserPanel(chooser);
+ }
+
+ /**
+ * This helper method creates the right side panel (the panel with the
+ * Spinners and TextFields).
+ *
+ * @return The right side panel.
+ */
+ private Container buildRightPanel()
+ {
+ JPanel container = new JPanel();
+ container.setLayout(new GridLayout(6, 2));
+
+ hRadio = new JRadioButton("H");
+ sRadio = new JRadioButton("S");
+ bRadio = new JRadioButton("B");
+
+ ButtonGroup group = new ButtonGroup();
+ group.add(hRadio);
+ group.add(sRadio);
+ group.add(bRadio);
+
+ hSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 359, 1));
+ sSpinner = new JSpinner(new SpinnerNumberModel(0, 0, 100, 1));
+ bSpinner = new JSpinner(new SpinnerNumberModel(100, 0, 100, 1));
+
+ hSpinner.setEnabled(false);
+ sSpinner.setEnabled(false);
+ bSpinner.setEnabled(false);
+
+ ChangeListener cl = new RadioStateListener();
+ ChangeListener scroll = new ImageScrollListener();
+
+ hRadio.addChangeListener(cl);
+ sRadio.addChangeListener(cl);
+ bRadio.addChangeListener(cl);
+
+ hSpinner.addChangeListener(scroll);
+ sSpinner.addChangeListener(scroll);
+ bSpinner.addChangeListener(scroll);
+
+ hRadio.setSelected(true);
+
+ container.add(hRadio);
+ container.add(hSpinner);
+
+ container.add(sRadio);
+ container.add(sSpinner);
+
+ container.add(bRadio);
+ container.add(bSpinner);
+
+ rFull = new JLabel("red full");
+ gFull = new JLabel("green full");
+ bFull = new JLabel("blue full");
+
+ container.add(R);
+ container.add(rFull);
+
+ container.add(G);
+ container.add(gFull);
+
+ container.add(B);
+ container.add(bFull);
+
+ return container;
+ }
+
+ /**
+ * This method returns the small display icon.
+ *
+ * @return The small display icon.
+ */
+ public Icon getSmallDisplayIcon()
+ {
+ return null;
+ }
+
+ /**
+ * This method returns the large display icon.
+ *
+ * @return The large display icon.
+ */
+ public Icon getLargeDisplayIcon()
+ {
+ return null;
+ }
+
+ /**
+ * This method paints the chooser panel.
+ *
+ * @param g The graphics object to paint with.
+ */
+ public void paint(Graphics g)
+ {
+ super.paint(g);
+ }
+
+ /**
+ * This method updates the gradient image with a new one taking the Hue
+ * value as the constant.
+ */
+ private void updateHLockImage()
+ {
+ int index = 0;
+ int[] pix = new int[imgWidth * imgHeight];
+ float hValue = ((Number) hSpinner.getValue()).intValue() / 360f;
+
+ for (int j = 0; j < imgHeight; j++)
+ for (int i = 0; i < imgWidth; i++)
+ pix[index++] = Color.HSBtoRGB(hValue, (imgWidth - i * 1f) / imgWidth,
+ (imgHeight - j * 1f) / imgHeight)
+ | (255 << 24);
+
+ gradientImage = createImage(new MemoryImageSource(imgWidth, imgHeight,
+ pix, 0, imgWidth));
+ }
+
+ /**
+ * This method updates the gradient image with a new one taking the
+ * Brightness value as the constant.
+ */
+ private void updateBLockImage()
+ {
+ int[] pix = new int[imgWidth * imgHeight];
+ float bValue = ((Number) bSpinner.getValue()).intValue() / 100f;
+
+ int index = 0;
+ for (int j = 0; j < imgHeight; j++)
+ for (int i = 0; i < imgWidth; i++)
+ pix[index++] = Color.HSBtoRGB(i * 1f / imgWidth,
+ (imgHeight - j * 1f) / imgHeight, bValue)
+ | (255 << 24);
+
+ gradientImage = createImage(new MemoryImageSource(imgWidth, imgHeight,
+ pix, 0, imgWidth));
+ }
+
+ /**
+ * This method updates the gradient image with a new one taking the
+ * Saturation value as the constant.
+ */
+ private void updateSLockImage()
+ {
+ int[] pix = new int[imgWidth * imgHeight];
+ float sValue = ((Number) sSpinner.getValue()).intValue() / 100f;
+
+ int index = 0;
+ for (int j = 0; j < imgHeight; j++)
+ for (int i = 0; i < imgWidth; i++)
+ pix[index++] = Color.HSBtoRGB(i * 1f / imgWidth, sValue,
+ (imgHeight - j * 1f) / imgHeight)
+ | (255 << 24);
+ gradientImage = createImage(new MemoryImageSource(imgWidth, imgHeight,
+ pix, 0, imgWidth));
+ }
+
+ /**
+ * This method calls the appropriate method to update the gradient image
+ * depending on which HSB value is constant.
+ */
+ private void updateImage()
+ {
+ switch (locked)
+ {
+ case HLOCKED:
+ updateHLockImage();
+ break;
+ case SLOCKED:
+ updateSLockImage();
+ break;
+ case BLOCKED:
+ updateBLockImage();
+ break;
+ }
+ }
+
+ /**
+ * This method updates the TextFields with the correct RGB values.
+ */
+ private void updateTextFields()
+ {
+ int c = getColorSelectionModel().getSelectedColor().getRGB();
+
+ rFull.setText("" + (c >> 16 & 0xff));
+ gFull.setText("" + (c >> 8 & 0xff));
+ bFull.setText("" + (c & 0xff));
+
+ repaint();
+ }
+
+ /**
+ * This method updates the slider in response to making a different HSB
+ * property the constant.
+ */
+ private void updateSlider()
+ {
+ if (slider == null)
+ return;
+
+ slider.setMinimum(0);
+ if (locked == HLOCKED)
+ {
+ slider.setMaximum(359);
+ ;
+ slider.setValue(((Number) hSpinner.getValue()).intValue());
+ slider.setInverted(true);
+ }
+ else
+ {
+ slider.setMaximum(100);
+ slider.setInverted(false);
+ if (sRadio.isSelected())
+ slider.setValue(((Number) sSpinner.getValue()).intValue());
+ else
+ slider.setValue(((Number) bSpinner.getValue()).intValue());
+ }
+ repaint();
+ }
+
+ /**
+ * This method updates the track gradient image depending on which HSB
+ * property is constant.
+ */
+ private void updateTrack()
+ {
+ switch (locked)
+ {
+ case HLOCKED:
+ updateHTrack();
+ break;
+ case SLOCKED:
+ updateSTrack();
+ break;
+ case BLOCKED:
+ updateBTrack();
+ break;
+ }
+ }
+
+ /**
+ * This method updates the track gradient image if the Hue value is allowed
+ * to change (according to the JRadioButtons).
+ */
+ private void updateHTrack()
+ {
+ int trackIndex = 0;
+ int[] trackPix = new int[trackWidth * imgHeight];
+
+ for (int j = 0; j < imgHeight; j++)
+ for (int i = 0; i < trackWidth; i++)
+ trackPix[trackIndex++] = Color.HSBtoRGB(j * 1f / imgHeight, 1f, 1f)
+ | (255 << 24);
+
+ trackImage = createImage(new MemoryImageSource(trackWidth, imgHeight,
+ trackPix, 0, trackWidth));
+ }
+
+ /**
+ * This method updates the track gradient image if the Saturation value is
+ * allowed to change (according to the JRadioButtons).
+ */
+ private void updateSTrack()
+ {
+ int[] trackPix = new int[trackWidth * imgHeight];
+
+ float hValue = ((Number) hSpinner.getValue()).intValue() / 360f;
+ float bValue = ((Number) bSpinner.getValue()).intValue() / 100f;
+
+ int trackIndex = 0;
+ for (int j = 0; j < imgHeight; j++)
+ for (int i = 0; i < trackWidth; i++)
+ trackPix[trackIndex++] = Color.HSBtoRGB(hValue,
+ (imgHeight - j * 1f) / imgHeight,
+ bValue) | (255 << 24);
+
+ trackImage = createImage(new MemoryImageSource(trackWidth, imgHeight,
+ trackPix, 0, trackWidth));
+ }
+
+ /**
+ * This method updates the track gradient image if the Brightness value is
+ * allowed to change (according to the JRadioButtons).
+ */
+ private void updateBTrack()
+ {
+ int[] trackPix = new int[trackWidth * imgHeight];
+
+ float hValue = ((Number) hSpinner.getValue()).intValue() / 360f;
+ float sValue = ((Number) sSpinner.getValue()).intValue() / 100f;
+
+ int trackIndex = 0;
+ for (int j = 0; j < imgHeight; j++)
+ for (int i = 0; i < trackWidth; i++)
+ trackPix[trackIndex++] = Color.HSBtoRGB(hValue, sValue,
+ (imgHeight - j * 1f) / imgHeight)
+ | (255 << 24);
+
+ trackImage = createImage(new MemoryImageSource(trackWidth, imgHeight,
+ trackPix, 0, trackWidth));
+ }
+
+ /**
+ * This method returns the HSB values for the currently selected color.
+ *
+ * @return The HSB values for the currently selected color.
+ */
+ private float[] getHSBValues()
+ {
+ Color c = getColorFromModel();
+ float[] f = Color.RGBtoHSB(c.getRed(), c.getGreen(), c.getBlue(), null);
+ return f;
+ }
+}
diff --git a/javax/swing/colorchooser/DefaultPreviewPanel.java b/javax/swing/colorchooser/DefaultPreviewPanel.java
new file mode 100644
index 000000000..93ecfc39a
--- /dev/null
+++ b/javax/swing/colorchooser/DefaultPreviewPanel.java
@@ -0,0 +1,317 @@
+/* DefaultPreviewPanel.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.colorchooser;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Insets;
+import javax.swing.JColorChooser;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+import javax.swing.border.Border;
+
+
+/**
+ * This is the default preview panel for the JColorChooser. The default
+ * preview panel is responsible for displaying the currently selected color
+ * of the JColorChooser.
+ */
+class DefaultPreviewPanel extends JPanel
+{
+ /**
+ * This is the border around the preview panel.
+ */
+ class PreviewBorder implements Border
+ {
+ /** This is the value of the top, bottom, top, and right inset. */
+ private static final int edge = 20;
+
+ /**
+ * This is the distance from the top left corner of the border to the
+ * text.
+ */
+ private static final int lead = 5;
+
+ /** This is the horizontal gap between the text and the border. */
+ private static final int gap = 3;
+
+ /**
+ * This method returns the border insets for the given Component.
+ *
+ * @param c The Component to retrieve insets for.
+ *
+ * @return The insets for the given Component.
+ */
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(edge, edge, edge, edge);
+ }
+
+ /**
+ * This method returns whether the border is responsible for painting its
+ * own background.
+ *
+ * @return Whether the border is responsible for painting its own
+ * background.
+ */
+ public boolean isBorderOpaque()
+ {
+ return true;
+ }
+
+ /**
+ * This method paints the border for the given component with the graphics
+ * object using the given properties.
+ *
+ * @param c The Component to paint the border for.
+ * @param g The Graphics object to paint with.
+ * @param x The x location to paint at.
+ * @param y The y location to paint at.
+ * @param width The width of the component.
+ * @param height The height of the component.
+ */
+ public void paintBorder(Component c, Graphics g, int x, int y, int width,
+ int height)
+ {
+ Color saved = g.getColor();
+ FontMetrics fm = g.getFontMetrics();
+
+ g.setColor(Color.BLACK);
+ g.drawLine(x + edge / 2, y + edge / 2, x + edge / 2,
+ y + height - edge / 2);
+ g.drawLine(x + edge / 2, y + height - edge / 2, x + width - edge / 2,
+ y + height - edge / 2);
+ g.drawLine(x + width - edge / 2, y + edge / 2, x + width - edge / 2,
+ y + height - edge / 2);
+ g.drawLine(x + edge / 2, y + edge / 2, x + edge / 2 + lead, y + edge / 2);
+
+ int strwidth = fm.stringWidth("Preview");
+
+ g.drawString("Preview", x + edge / 2 + lead + gap,
+ y + edge / 2 + fm.getAscent() / 2);
+
+ g.drawLine(x + lead + edge / 2 + strwidth + gap * 2, y + edge / 2,
+ x + width - edge / 2, y + edge / 2);
+
+ g.setColor(saved);
+ }
+ }
+
+ /** A standard large gap size. */
+ private static int largeGap = 6;
+
+ /** A standard small gap size. */
+ private static int smallGap = 2;
+
+ /** The size of each side of the square. */
+ private static int squareSize = 36;
+
+ /** This padding between the text and the edge of its box. */
+ private static int textPadding = 4;
+
+ /** The width of the right most rectangles. */
+ private static int rightSideRectWidth = 60;
+
+ /** The sample text. */
+ private static String sample = "Sample Text Sample Text";
+
+ /**
+ * Creates a new DefaultPreviewPanel object.
+ */
+ DefaultPreviewPanel()
+ {
+ super();
+ setBorder(new PreviewBorder());
+ }
+
+ /**
+ * This method paints the default preview panel with the given Graphics
+ * object.
+ *
+ * @param g The Graphics object.
+ */
+ public void paint(Graphics g)
+ {
+ super.paint(g);
+ Color currentColor = null;
+ JColorChooser chooser = (JColorChooser) SwingUtilities.getAncestorOfClass(JColorChooser.class,
+ this);
+ if (chooser != null)
+ currentColor = chooser.getColor();
+
+ Color saved = g.getColor();
+ Insets insets = getInsets();
+
+ int down = insets.top + squareSize + largeGap;
+ int currX = insets.left;
+
+ paintSquare(g, currX, insets.top, Color.WHITE, currentColor, Color.WHITE,
+ -1, -1, -1);
+ paintSquare(g, currX, down, currentColor, null, null, -1, -1, -1);
+
+ currX += squareSize + largeGap;
+
+ paintSquare(g, currX, insets.top, Color.BLACK, currentColor, Color.WHITE,
+ -1, -1, -1);
+ paintSquare(g, currX, down, Color.WHITE, currentColor, null, -1, -1, -1);
+
+ currX += squareSize + largeGap;
+
+ paintSquare(g, currX, insets.top, Color.WHITE, currentColor, Color.BLACK,
+ -1, -1, -1);
+ paintSquare(g, currX, down, Color.BLACK, currentColor, null, -1, -1, -1);
+
+ FontMetrics fm = g.getFontMetrics();
+ int strWidth = fm.stringWidth(sample);
+ int strHeight = fm.getHeight();
+
+ currX += squareSize + largeGap;
+
+ int boxWidth = 2 * textPadding + strWidth;
+ int boxHeight = 2 * textPadding + strHeight;
+
+ int first = insets.top + textPadding;
+ int second = insets.top + boxHeight + smallGap;
+ int third = insets.top + 2 * (boxHeight + smallGap);
+
+ g.setColor(Color.WHITE);
+ g.fillRect(currX, third, boxWidth, boxHeight);
+
+ g.setColor(currentColor);
+ g.drawString(sample, currX + textPadding,
+ first + textPadding + fm.getAscent());
+
+ g.fillRect(currX, second, boxWidth, boxHeight);
+
+ g.drawString(sample, currX + textPadding,
+ third + textPadding + fm.getAscent());
+
+ g.setColor(Color.BLACK);
+ g.drawString(sample, currX + textPadding,
+ second + textPadding + fm.getAscent());
+
+ currX += boxWidth + largeGap;
+
+ g.setColor(Color.WHITE);
+ g.fillRect(currX, insets.top, rightSideRectWidth, squareSize
+ + largeGap / 2);
+
+ g.setColor(currentColor);
+ g.fillRect(currX, insets.top + squareSize + largeGap / 2,
+ rightSideRectWidth, squareSize + largeGap / 2);
+
+ g.setColor(saved);
+ }
+
+ /**
+ * This method creates and paints a square. The square has two smaller
+ * squares inside of it. Each of the three squares has their sizes
+ * determined by the size arguments. If the size is not given (by passing
+ * in -1), then the size is determined automatically.
+ *
+ * @param g The Graphics object to paint with.
+ * @param x The x location to paint at.
+ * @param y The y location to paint at.
+ * @param first The color of the first square.
+ * @param second The color of the second square.
+ * @param third The color of the third square.
+ * @param firstSize The size of the first square.
+ * @param secondSize The size of the second square.
+ * @param thirdSize The size of the third square.
+ */
+ private void paintSquare(Graphics g, int x, int y, Color first,
+ Color second, Color third, int firstSize,
+ int secondSize, int thirdSize)
+ {
+ Color saved = g.getColor();
+ if (firstSize == -1)
+ firstSize = squareSize;
+ if (secondSize == -1)
+ secondSize = squareSize * 2 / 3;
+ if (thirdSize == -1)
+ thirdSize = squareSize / 3;
+ int secondOffset = (firstSize - secondSize) / 2;
+ int thirdOffset = (firstSize - thirdSize) / 2;
+
+ if (first == null)
+ return;
+ g.setColor(first);
+ g.fillRect(x, y, firstSize, firstSize);
+ if (second == null)
+ return;
+ g.setColor(second);
+ g.fillRect(x + secondOffset, y + secondOffset, secondSize, secondSize);
+ if (third == null)
+ return;
+ g.setColor(third);
+ g.fillRect(x + thirdOffset, y + thirdOffset, thirdSize, thirdSize);
+
+ g.setColor(saved);
+ }
+
+ /**
+ * This method returns the preferred size of the default preview panel.
+ *
+ * @return The preferred size of the default preview panel.
+ */
+ public Dimension getPreferredSize()
+ {
+ Graphics g = getGraphics();
+ FontMetrics fm = g.getFontMetrics();
+ g.dispose();
+
+ int strWidth = fm.stringWidth(sample);
+ int strHeight = fm.getHeight();
+
+ int h1 = (strHeight + 2 * textPadding) * 3 + 2 * smallGap;
+ int h2 = 2 * squareSize + largeGap;
+
+ int height = Math.max(h1, h2);
+
+ int width = 3 * (squareSize + largeGap) + strWidth + 2 * textPadding
+ + largeGap + rightSideRectWidth;
+
+ Insets insets = getInsets();
+
+ return new Dimension(width + insets.right + insets.left,
+ height + insets.top + insets.bottom);
+ }
+}
diff --git a/javax/swing/colorchooser/DefaultRGBChooserPanel.java b/javax/swing/colorchooser/DefaultRGBChooserPanel.java
new file mode 100644
index 000000000..a0fa8ca36
--- /dev/null
+++ b/javax/swing/colorchooser/DefaultRGBChooserPanel.java
@@ -0,0 +1,395 @@
+/* DefaultRGHChooserPanel.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.colorchooser;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.Graphics;
+import java.awt.GridBagConstraints;
+import java.awt.GridBagLayout;
+import javax.swing.Icon;
+import javax.swing.JColorChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JSlider;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+import javax.swing.SwingConstants;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+
+/**
+ * This is the default RGB panel for the JColorChooser. The color is selected
+ * using three sliders that represent the RGB values.
+ */
+public class DefaultRGBChooserPanel extends AbstractColorChooserPanel
+{
+ /**
+ * This class handles the slider value changes for all three sliders.
+ */
+ class SliderHandler implements ChangeListener
+ {
+ /**
+ * This method is called whenever any of the slider values change.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ if (updateChange)
+ return;
+
+ int color = R.getValue() << 16 | G.getValue() << 8 | B.getValue();
+
+ sliderChange = true;
+ getColorSelectionModel().setSelectedColor(new Color(color));
+ sliderChange = false;
+ }
+ }
+
+ /**
+ * This class handles the Spinner values changing.
+ */
+ class SpinnerHandler implements ChangeListener
+ {
+ /**
+ * This method is called whenever any of the JSpinners change values.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ if (updateChange)
+ return;
+
+ int red = ((Number) RSpinner.getValue()).intValue();
+ int green = ((Number) GSpinner.getValue()).intValue();
+ int blue = ((Number) BSpinner.getValue()).intValue();
+
+ int color = red << 16 | green << 8 | blue;
+
+ spinnerChange = true;
+ getColorSelectionModel().setSelectedColor(new Color(color));
+ spinnerChange = false;
+ }
+ }
+
+ /** Whether the color change was initiated by the spinners. */
+ private transient boolean spinnerChange = false;
+
+ /** Whether the color change was initiated by the sliders. */
+ private transient boolean sliderChange = false;
+
+ /**
+ * Whether the change was forced by the chooser (meaning the color has
+ * already been changed).
+ */
+ private transient boolean updateChange = false;
+
+ /** The ChangeListener for the sliders. */
+ private transient ChangeListener colorChanger;
+
+ /** The ChangeListener for the spinners. */
+ private transient ChangeListener spinnerHandler;
+
+ /** The slider that handles the red values. */
+ private transient JSlider R;
+
+ /** The slider that handles the green values. */
+ private transient JSlider G;
+
+ /** The slider that handles the blue values. */
+ private transient JSlider B;
+
+ /** The label for the red slider. */
+ private transient JLabel RLabel;
+
+ /** The label for the green slider. */
+ private transient JLabel GLabel;
+
+ /** The label for the blue slider. */
+ private transient JLabel BLabel;
+
+ /** The spinner that handles the red values. */
+ private transient JSpinner RSpinner;
+
+ /** The spinner that handles the green values. */
+ private transient JSpinner GSpinner;
+
+ /** The spinner that handles the blue values. */
+ private transient JSpinner BSpinner;
+
+ /**
+ * Creates a new DefaultRGBChooserPanel object.
+ */
+ public DefaultRGBChooserPanel()
+ {
+ super();
+ }
+
+ /**
+ * This method returns the name displayed in the JTabbedPane.
+ *
+ * @return The name displayed in the JTabbedPane.
+ */
+ public String getDisplayName()
+ {
+ return "RGB";
+ }
+
+ /**
+ * This method updates the chooser panel with the new color chosen in the
+ * JColorChooser.
+ */
+ public void updateChooser()
+ {
+ Color c = getColorFromModel();
+ int rgb = c.getRGB();
+
+ int red = rgb >> 16 & 0xff;
+ int green = rgb >> 8 & 0xff;
+ int blue = rgb & 0xff;
+
+ updateChange = true;
+
+ if (! sliderChange)
+ {
+ if (R != null)
+ R.setValue(red);
+ if (G != null)
+ G.setValue(green);
+ if (B != null)
+ B.setValue(blue);
+ }
+ if (! spinnerChange)
+ {
+ if (GSpinner != null)
+ GSpinner.setValue(new Integer(green));
+ if (RSpinner != null)
+ RSpinner.setValue(new Integer(red));
+ if (BSpinner != null)
+ BSpinner.setValue(new Integer(blue));
+ }
+
+ updateChange = false;
+
+ revalidate();
+ repaint();
+ }
+
+ /**
+ * This method builds the chooser panel.
+ */
+ protected void buildChooser()
+ {
+ setLayout(new GridBagLayout());
+
+ RLabel = new JLabel("Red");
+ RLabel.setDisplayedMnemonic('d');
+ GLabel = new JLabel("Green");
+ GLabel.setDisplayedMnemonic('n');
+ BLabel = new JLabel("Blue");
+ BLabel.setDisplayedMnemonic('B');
+
+ R = new JSlider(SwingConstants.HORIZONTAL, 0, 255, 255);
+ G = new JSlider(SwingConstants.HORIZONTAL, 0, 255, 255);
+ B = new JSlider(SwingConstants.HORIZONTAL, 0, 255, 255);
+
+ R.setPaintTicks(true);
+ R.setSnapToTicks(false);
+ G.setPaintTicks(true);
+ G.setSnapToTicks(false);
+ B.setPaintTicks(true);
+ B.setSnapToTicks(false);
+
+ R.setLabelTable(R.createStandardLabels(85));
+ R.setPaintLabels(true);
+ G.setLabelTable(G.createStandardLabels(85));
+ G.setPaintLabels(true);
+ B.setLabelTable(B.createStandardLabels(85));
+ B.setPaintLabels(true);
+
+ R.setMajorTickSpacing(85);
+ G.setMajorTickSpacing(85);
+ B.setMajorTickSpacing(85);
+
+ R.setMinorTickSpacing(17);
+ G.setMinorTickSpacing(17);
+ B.setMinorTickSpacing(17);
+
+ RSpinner = new JSpinner(new SpinnerNumberModel(R.getValue(),
+ R.getMinimum(),
+ R.getMaximum(), 1));
+ GSpinner = new JSpinner(new SpinnerNumberModel(G.getValue(),
+ G.getMinimum(),
+ G.getMaximum(), 1));
+ BSpinner = new JSpinner(new SpinnerNumberModel(B.getValue(),
+ B.getMinimum(),
+ B.getMaximum(), 1));
+
+ RLabel.setLabelFor(R);
+ GLabel.setLabelFor(G);
+ BLabel.setLabelFor(B);
+
+ GridBagConstraints bag = new GridBagConstraints();
+ bag.fill = GridBagConstraints.VERTICAL;
+
+ bag.gridx = 0;
+ bag.gridy = 0;
+ add(RLabel, bag);
+
+ bag.gridx = 1;
+ add(R, bag);
+
+ bag.gridx = 2;
+ add(RSpinner, bag);
+
+ bag.gridx = 0;
+ bag.gridy = 1;
+ add(GLabel, bag);
+
+ bag.gridx = 1;
+ add(G, bag);
+
+ bag.gridx = 2;
+ add(GSpinner, bag);
+
+ bag.gridx = 0;
+ bag.gridy = 2;
+ add(BLabel, bag);
+
+ bag.gridx = 1;
+ add(B, bag);
+
+ bag.gridx = 2;
+ add(BSpinner, bag);
+
+ installListeners();
+ }
+
+ /**
+ * This method uninstalls the chooser panel from the JColorChooser.
+ *
+ * @param chooser The JColorChooser to remove this chooser panel from.
+ */
+ public void uninstallChooserPanel(JColorChooser chooser)
+ {
+ uninstallListeners();
+ removeAll();
+
+ R = null;
+ G = null;
+ B = null;
+
+ RSpinner = null;
+ GSpinner = null;
+ BSpinner = null;
+
+ super.uninstallChooserPanel(chooser);
+ }
+
+ /**
+ * This method uninstalls any listeners that were added by the chooser
+ * panel.
+ */
+ private void uninstallListeners()
+ {
+ R.removeChangeListener(colorChanger);
+ G.removeChangeListener(colorChanger);
+ B.removeChangeListener(colorChanger);
+
+ colorChanger = null;
+
+ RSpinner.removeChangeListener(spinnerHandler);
+ GSpinner.removeChangeListener(spinnerHandler);
+ BSpinner.removeChangeListener(spinnerHandler);
+
+ spinnerHandler = null;
+ }
+
+ /**
+ * This method installs any listeners that the chooser panel needs to
+ * operate.
+ */
+ private void installListeners()
+ {
+ colorChanger = new SliderHandler();
+
+ R.addChangeListener(colorChanger);
+ G.addChangeListener(colorChanger);
+ B.addChangeListener(colorChanger);
+
+ spinnerHandler = new SpinnerHandler();
+
+ RSpinner.addChangeListener(spinnerHandler);
+ GSpinner.addChangeListener(spinnerHandler);
+ BSpinner.addChangeListener(spinnerHandler);
+ }
+
+ /**
+ * This method returns the small display icon.
+ *
+ * @return The small display icon.
+ */
+ public Icon getSmallDisplayIcon()
+ {
+ return null;
+ }
+
+ /**
+ * This method returns the large display icon.
+ *
+ * @return The large display icon.
+ */
+ public Icon getLargeDisplayIcon()
+ {
+ return null;
+ }
+
+ /**
+ * This method paints the default RGB chooser panel.
+ *
+ * @param g The Graphics object to paint with.
+ */
+ public void paint(Graphics g)
+ {
+ super.paint(g);
+ }
+}
diff --git a/javax/swing/colorchooser/DefaultSwatchChooserPanel.java b/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
new file mode 100644
index 000000000..1413a5b2d
--- /dev/null
+++ b/javax/swing/colorchooser/DefaultSwatchChooserPanel.java
@@ -0,0 +1,891 @@
+/* DefaultSwatchChooserPanel.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.colorchooser;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import javax.swing.Icon;
+import javax.swing.JColorChooser;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+
+
+/**
+ * This class is the DefaultSwatchChooserPanel. This chooser panel displays a
+ * set of colors that can be picked. Recently picked items will go into a
+ * side panel so the user can see the history of the chosen colors.
+ */
+class DefaultSwatchChooserPanel extends AbstractColorChooserPanel
+{
+ /** The main panel that holds the set of choosable colors. */
+ MainSwatchPanel mainPalette;
+
+ /** A panel that holds the recent colors. */
+ RecentSwatchPanel recentPalette;
+
+ /** The mouse handlers for the panels. */
+ MouseListener mouseHandler;
+
+ /**
+ * This the base class for all swatch panels. Swatch panels are panels that
+ * hold a set of blocks where colors are displayed.
+ */
+ abstract static class SwatchPanel extends JPanel
+ {
+ /** The width of each block. */
+ protected int cellWidth = 10;
+
+ /** The height of each block. */
+ protected int cellHeight = 10;
+
+ /** The gap between blocks. */
+ protected int gap = 1;
+
+ /** The number of rows in the swatch panel. */
+ protected int numRows;
+
+ /** The number of columns in the swatch panel. */
+ protected int numCols;
+
+ /**
+ * Creates a new SwatchPanel object.
+ */
+ SwatchPanel()
+ {
+ super();
+ setBackground(Color.WHITE);
+ }
+
+ /**
+ * This method returns the preferred size of the swatch panel based on the
+ * number of rows and columns and the size of each cell.
+ *
+ * @return The preferred size of the swatch panel.
+ */
+ public Dimension getPreferredSize()
+ {
+ int height = numRows * cellHeight + (numRows - 1) * gap;
+ int width = numCols * cellWidth + (numCols - 1) * gap;
+ Insets insets = getInsets();
+
+ return new Dimension(width + insets.left + insets.right,
+ height + insets.top + insets.bottom);
+ }
+
+ /**
+ * This method returns the color for the given position.
+ *
+ * @param x The x coordinate of the position.
+ * @param y The y coordinate of the position.
+ *
+ * @return The color at the given position.
+ */
+ public abstract Color getColorForPosition(int x, int y);
+
+ /**
+ * This method initializes the colors for the swatch panel.
+ */
+ protected abstract void initializeColors();
+ }
+
+ /**
+ * This is the main swatch panel. This panel sits in the middle and allows a
+ * set of colors to be picked which will move to the recent swatch panel.
+ */
+ static class MainSwatchPanel extends SwatchPanel
+ {
+ /** The color describing (204, 255, 255) */
+ public static final Color C204255255 = new Color(204, 204, 255);
+
+ /** The color describing (255, 204, 204) */
+ public static final Color C255204204 = new Color(255, 204, 204);
+
+ /** The color describing (204, 255, 204) */
+ public static final Color C204255204 = new Color(204, 255, 204);
+
+ /** The color describing (204, 204, 204) */
+ public static final Color C204204204 = new Color(204, 204, 204);
+
+ /** The color (153, 153, 255). */
+ public static final Color C153153255 = new Color(153, 153, 255);
+
+ /** The color (51, 51, 255). */
+ public static final Color C051051255 = new Color(51, 51, 255);
+
+ /** The color (153, 0, 153). */
+ public static final Color C153000153 = new Color(153, 0, 153);
+
+ /** The color (0, 51, 51). */
+ public static final Color C000051051 = new Color(0, 51, 51);
+
+ /** The color (51, 0, 51). */
+ public static final Color C051000051 = new Color(51, 0, 51);
+
+ /** The color (51, 51, 0). */
+ public static final Color C051051000 = new Color(51, 51, 0);
+
+ /** The color (102, 102, 0). */
+ public static final Color C102102000 = new Color(102, 102, 0);
+
+ /** The color (153, 255, 153). */
+ public static final Color C153255153 = new Color(153, 255, 153);
+
+ /** The color (102, 255, 102). */
+ public static final Color C102255102 = new Color(102, 255, 102);
+
+ /** The color (0, 102, 102). */
+ public static final Color C000102102 = new Color(0, 102, 102);
+
+ /** The color (102, 0, 102). */
+ public static final Color C102000102 = new Color(102, 0, 102);
+
+ /** The color (0, 153, 153). */
+ public static final Color C000153153 = new Color(0, 153, 153);
+
+ /** The color (153, 153, 0). */
+ public static final Color C153153000 = new Color(153, 153, 0);
+
+ /** The color (204, 204, 0). */
+ public static final Color C204204000 = new Color(204, 204, 0);
+
+ /** The color (204, 0, 204). */
+ public static final Color C204000204 = new Color(204, 0, 204);
+
+ /** The color (0, 204, 204). */
+ public static final Color C000204204 = new Color(0, 204, 204);
+
+ /** The color (51, 255, 51). */
+ public static final Color C051255051 = new Color(51, 255, 51);
+
+ /** The color (255, 51, 51). */
+ public static final Color C255051051 = new Color(255, 51, 51);
+
+ /** The color (255, 102, 102). */
+ public static final Color C255102102 = new Color(255, 102, 102);
+
+ /** The color (102, 102, 255). */
+ public static final Color C102102255 = new Color(102, 102, 255);
+
+ /** The color (255, 153, 153). */
+ public static final Color C255153153 = new Color(255, 153, 153);
+ static Color[] colors =
+ {
+ // Row 1
+ Color.WHITE, new Color(204, 255, 255), C204255255, C204255255, C204255255,
+ C204255255, C204255255, C204255255, C204255255,
+ C204255255, C204255255, new Color(255, 204, 255),
+ C255204204, C255204204, C255204204, C255204204,
+ C255204204, C255204204, C255204204, C255204204,
+ C255204204, new Color(255, 255, 204), C204255204,
+ C204255204, C204255204, C204255204, C204255204,
+ C204255204, C204255204, C204255204, C204255204,
+
+ // Row 2
+ C204204204, new Color(153, 255, 255), new Color(153, 204, 255), C153153255,
+ C153153255, C153153255, C153153255, C153153255,
+ C153153255, C153153255, new Color(204, 153, 255),
+ new Color(255, 153, 255),
+ new Color(255, 153, 204), C255153153, C255153153,
+ C255153153, C255153153, C255153153, C255153153,
+ C255153153, new Color(255, 204, 153),
+ new Color(255, 255, 153),
+ new Color(204, 255, 153), C153255153, C153255153,
+ C153255153, C153255153, C153255153, C153255153,
+ C153255153, new Color(153, 255, 204),
+
+ // Row 3
+ C204204204, new Color(102, 255, 255), new Color(102, 204, 255),
+ new Color(102, 153, 255), C102102255, C102102255,
+ C102102255, C102102255, C102102255,
+ new Color(153, 102, 255),
+ new Color(204, 102, 255),
+ new Color(255, 102, 255),
+ new Color(255, 102, 204),
+ new Color(255, 102, 153), C255102102, C255102102,
+ C255102102, C255102102, C255102102,
+ new Color(255, 153, 102),
+ new Color(255, 204, 102),
+ new Color(255, 255, 102),
+ new Color(204, 255, 102),
+ new Color(153, 255, 102), C102255102, C102255102,
+ C102255102, C102255102, C102255102,
+ new Color(102, 255, 153),
+ new Color(102, 255, 204),
+
+ // Row 4
+ new Color(153, 153, 153), new Color(51, 255, 255), new Color(51, 204, 255),
+ new Color(51, 153, 255), new Color(51, 102, 255),
+ C051051255, C051051255, C051051255,
+ new Color(102, 51, 255), new Color(153, 51, 255),
+ new Color(204, 51, 255), new Color(255, 51, 255),
+ new Color(255, 51, 204), new Color(255, 51, 153),
+ new Color(255, 51, 102), C255051051, C255051051,
+ C255051051, new Color(255, 102, 51),
+ new Color(255, 153, 51), new Color(255, 204, 51),
+ new Color(255, 255, 51), new Color(204, 255, 51),
+ new Color(153, 255, 51), new Color(102, 255, 51),
+ C051255051, C051255051, C051255051,
+ new Color(51, 255, 102), new Color(51, 255, 153),
+ new Color(51, 255, 204),
+
+ // Row 5
+ new Color(153, 153, 153), new Color(0, 255, 255), new Color(0, 204, 255),
+ new Color(0, 153, 255), new Color(0, 102, 255),
+ new Color(0, 51, 255), new Color(0, 0, 255),
+ new Color(51, 0, 255), new Color(102, 0, 255),
+ new Color(153, 0, 255), new Color(204, 0, 255),
+ new Color(255, 0, 255), new Color(255, 0, 204),
+ new Color(255, 0, 153), new Color(255, 0, 102),
+ new Color(255, 0, 51), new Color(255, 0, 0),
+ new Color(255, 51, 0), new Color(255, 102, 0),
+ new Color(255, 153, 0), new Color(255, 204, 0),
+ new Color(255, 255, 0), new Color(204, 255, 0),
+ new Color(153, 255, 0), new Color(102, 255, 0),
+ new Color(51, 255, 0), new Color(0, 255, 0),
+ new Color(0, 255, 51), new Color(0, 255, 102),
+ new Color(0, 255, 153), new Color(0, 255, 204),
+
+ // Row 6
+ new Color(102, 102, 102), C000204204, C000204204, new Color(0, 153, 204),
+ new Color(0, 102, 204), new Color(0, 51, 204),
+ new Color(0, 0, 204), new Color(51, 0, 204),
+ new Color(102, 0, 204), new Color(153, 0, 204),
+ C204000204, C204000204, C204000204,
+ new Color(204, 0, 153), new Color(204, 0, 102),
+ new Color(204, 0, 51), new Color(204, 0, 0),
+ new Color(204, 51, 0), new Color(204, 102, 0),
+ new Color(204, 153, 0), C204204000, C204204000,
+ C204204000, new Color(153, 204, 0),
+ new Color(102, 204, 0), new Color(51, 204, 0),
+ new Color(0, 204, 0), new Color(0, 204, 51),
+ new Color(0, 204, 102), new Color(0, 204, 153),
+ new Color(0, 204, 204),
+
+ // Row 7
+ new Color(102, 102, 102), C000153153, C000153153, C000153153,
+ new Color(0, 102, 153), new Color(0, 51, 153),
+ new Color(0, 0, 153), new Color(51, 0, 153),
+ new Color(102, 0, 153), C153000153, C153000153,
+ C153000153, C153000153, C153000153,
+ new Color(153, 0, 102), new Color(153, 0, 51),
+ new Color(153, 0, 0), new Color(153, 51, 0),
+ new Color(153, 102, 0), C153153000, C153153000,
+ C153153000, C153153000, C153153000,
+ new Color(102, 153, 0), new Color(51, 153, 0),
+ new Color(0, 153, 0), new Color(0, 153, 51),
+ new Color(0, 153, 102), C000153153, C000153153,
+
+ // Row 8
+ new Color(51, 51, 51), C000102102, C000102102, C000102102, C000102102,
+ new Color(0, 51, 102), new Color(0, 0, 102),
+ new Color(51, 0, 102), C102000102, C102000102,
+ C102000102, C102000102, C102000102, C102000102,
+ C102000102, new Color(102, 0, 51),
+ new Color(102, 0, 0), new Color(102, 51, 0),
+ C102102000, C102102000, C102102000, C102102000,
+ C102102000, C102102000, C102102000,
+ new Color(51, 102, 0), new Color(0, 102, 0),
+ new Color(0, 102, 51), C000102102, C000102102,
+ C000102102,
+
+ // Row 9.
+ Color.BLACK, C000051051, C000051051, C000051051, C000051051, C000051051,
+ new Color(0, 0, 51), C051000051, C051000051,
+ C051000051, C051000051, C051000051, C051000051,
+ C051000051, C051000051, C051000051,
+ new Color(51, 0, 0), C051051000, C051051000,
+ C051051000, C051051000, C051051000, C051051000,
+ C051051000, C051051000, new Color(0, 51, 0),
+ C000051051, C000051051, C000051051, C000051051,
+ new Color(51, 51, 51)
+ };
+
+ /**
+ * Creates a new MainSwatchPanel object.
+ */
+ MainSwatchPanel()
+ {
+ super();
+ numCols = 31;
+ numRows = 9;
+ initializeColors();
+ revalidate();
+ }
+
+ /**
+ * This method returns the color for the given position.
+ *
+ * @param x The x location for the position.
+ * @param y The y location for the position.
+ *
+ * @return The color for the given position.
+ */
+ public Color getColorForPosition(int x, int y)
+ {
+ if (x % (cellWidth + gap) > cellWidth
+ || y % (cellHeight + gap) > cellHeight)
+ // position is located in gap.
+ return null;
+
+ int row = y / (cellHeight + gap);
+ int col = x / (cellWidth + gap);
+ return colors[row * numCols + col];
+ }
+
+ /**
+ * This method initializes the colors for the main swatch panel.
+ */
+ protected void initializeColors()
+ {
+ // Unnecessary
+ }
+
+ /**
+ * This method paints the main graphics panel with the given Graphics
+ * object.
+ *
+ * @param graphics The Graphics object to paint with.
+ */
+ public void paint(Graphics graphics)
+ {
+ int index = 0;
+ Insets insets = getInsets();
+ int currX = insets.left;
+ int currY = insets.top;
+ Color saved = graphics.getColor();
+
+ for (int i = 0; i < numRows; i++)
+ {
+ for (int j = 0; j < numCols; j++)
+ {
+ graphics.setColor(colors[index++]);
+ graphics.fill3DRect(currX, currY, cellWidth, cellHeight, true);
+ currX += gap + cellWidth;
+ }
+ currX = insets.left;
+ currY += gap + cellHeight;
+ }
+ graphics.setColor(saved);
+ }
+
+ /**
+ * This method returns the tooltip text for the given MouseEvent.
+ *
+ * @param e The MouseEvent to find tooltip text for.
+ *
+ * @return The tooltip text.
+ */
+ public String getToolTipText(MouseEvent e)
+ {
+ Color c = getColorForPosition(e.getX(), e.getY());
+ if (c == null)
+ return null;
+ return (c.getRed() + "," + c.getGreen() + "," + c.getBlue());
+ }
+ }
+
+ /**
+ * This class is the recent swatch panel. It holds recently selected colors.
+ */
+ public static class RecentSwatchPanel extends SwatchPanel
+ {
+ /** The array for storing recently stored colors. */
+ Color[] colors;
+
+ /** The default color. */
+ public static final Color defaultColor = Color.GRAY;
+
+ /** The index of the array that is the start. */
+ int start = 0;
+
+ /**
+ * Creates a new RecentSwatchPanel object.
+ */
+ RecentSwatchPanel()
+ {
+ super();
+ numCols = 5;
+ numRows = 7;
+ initializeColors();
+ revalidate();
+ }
+
+ /**
+ * This method returns the color for the given position.
+ *
+ * @param x The x coordinate of the position.
+ * @param y The y coordinate of the position.
+ *
+ * @return The color for the given position.
+ */
+ public Color getColorForPosition(int x, int y)
+ {
+ if (x % (cellWidth + gap) > cellWidth
+ || y % (cellHeight + gap) > cellHeight)
+ // position is located in gap.
+ return null;
+
+ int row = y / (cellHeight + gap);
+ int col = x / (cellWidth + gap);
+
+ return colors[getIndexForCell(row, col)];
+ }
+
+ /**
+ * This method initializes the colors for the recent swatch panel.
+ */
+ protected void initializeColors()
+ {
+ colors = new Color[numRows * numCols];
+ for (int i = 0; i < colors.length; i++)
+ colors[i] = defaultColor;
+ }
+
+ /**
+ * This method returns the array index for the given row and column.
+ *
+ * @param row The row.
+ * @param col The column.
+ *
+ * @return The array index for the given row and column.
+ */
+ private int getIndexForCell(int row, int col)
+ {
+ return ((row * numCols) + col + start) % (numRows * numCols);
+ }
+
+ /**
+ * This method adds the given color to the beginning of the swatch panel.
+ *
+ * @param c The color to add.
+ */
+ private void addColorToQueue(Color c)
+ {
+ if (--start == -1)
+ start = numRows * numCols - 1;
+
+ colors[start] = c;
+ }
+
+ /**
+ * This method paints the panel with the given Graphics object.
+ *
+ * @param g The Graphics object to paint with.
+ */
+ public void paint(Graphics g)
+ {
+ Color saved = g.getColor();
+ Insets insets = getInsets();
+ int currX = insets.left;
+ int currY = insets.top;
+
+ for (int i = 0; i < numRows; i++)
+ {
+ for (int j = 0; j < numCols; j++)
+ {
+ g.setColor(colors[getIndexForCell(i, j)]);
+ g.fill3DRect(currX, currY, cellWidth, cellHeight, true);
+ currX += cellWidth + gap;
+ }
+ currX = insets.left;
+ currY += cellWidth + gap;
+ }
+ }
+
+ /**
+ * This method returns the tooltip text for the given MouseEvent.
+ *
+ * @param e The MouseEvent.
+ *
+ * @return The tooltip text.
+ */
+ public String getToolTipText(MouseEvent e)
+ {
+ Color c = getColorForPosition(e.getX(), e.getY());
+ if (c == null)
+ return null;
+ return c.getRed() + "," + c.getGreen() + "," + c.getBlue();
+ }
+ }
+
+ /**
+ * This class handles mouse events for the two swatch panels.
+ */
+ class MouseHandler extends MouseAdapter
+ {
+ /**
+ * This method is called whenever the mouse is pressed.
+ *
+ * @param e The MouseEvent.
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ SwatchPanel panel = (SwatchPanel) e.getSource();
+ Color c = panel.getColorForPosition(e.getX(), e.getY());
+ recentPalette.addColorToQueue(c);
+ DefaultSwatchChooserPanel.this.getColorSelectionModel().setSelectedColor(c);
+ DefaultSwatchChooserPanel.this.repaint();
+ }
+ }
+
+ /**
+ * This is the layout manager for the main panel.
+ */
+ static class MainPanelLayout implements LayoutManager
+ {
+ /**
+ * This method is called when a new component is added to the container.
+ *
+ * @param name The name of the component.
+ * @param comp The added component.
+ */
+ public void addLayoutComponent(String name, Component comp)
+ {
+ }
+
+ /**
+ * This method is called to set the size and position of the child
+ * components for the given container.
+ *
+ * @param parent The container to lay out.
+ */
+ public void layoutContainer(Container parent)
+ {
+ Component[] comps = parent.getComponents();
+ Insets insets = parent.getInsets();
+ Dimension[] pref = new Dimension[comps.length];
+
+ int xpos = 0;
+ int ypos = 0;
+ int maxHeight = 0;
+ int totalWidth = 0;
+
+ for (int i = 0; i < comps.length; i++)
+ {
+ pref[i] = comps[i].getPreferredSize();
+ if (pref[i] == null)
+ return;
+ maxHeight = Math.max(maxHeight, pref[i].height);
+ totalWidth += pref[i].width;
+ }
+
+ ypos = (parent.getSize().height - maxHeight) / 2 + insets.top;
+ xpos = insets.left + (parent.getSize().width - totalWidth) / 2;
+
+ for (int i = 0; i < comps.length; i++)
+ {
+ if (pref[i] == null)
+ continue;
+ comps[i].setBounds(xpos, ypos, pref[i].width, pref[i].height);
+ xpos += pref[i].width;
+ }
+ }
+
+ /**
+ * This method is called when a component is removed from the container.
+ *
+ * @param comp The component that was removed.
+ */
+ public void removeLayoutComponent(Component comp)
+ {
+ }
+
+ /**
+ * This methods calculates the minimum layout size for the container.
+ *
+ * @param parent The container.
+ *
+ * @return The minimum layout size.
+ */
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ return preferredLayoutSize(parent);
+ }
+
+ /**
+ * This method returns the preferred layout size for the given container.
+ *
+ * @param parent The container.
+ *
+ * @return The preferred layout size.
+ */
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ int xmax = 0;
+ int ymax = 0;
+
+ Component[] comps = parent.getComponents();
+ Dimension pref;
+
+ for (int i = 0; i < comps.length; i++)
+ {
+ pref = comps[i].getPreferredSize();
+ if (pref == null)
+ continue;
+ xmax += pref.width;
+ ymax = Math.max(ymax, pref.height);
+ }
+
+ Insets insets = parent.getInsets();
+
+ return new Dimension(insets.left + insets.right + xmax,
+ insets.top + insets.bottom + ymax);
+ }
+ }
+
+ /**
+ * This is the layout manager for the recent swatch panel.
+ */
+ static class RecentPanelLayout implements LayoutManager
+ {
+ /**
+ * This method is called when a component is added to the container.
+ *
+ * @param name The name of the component.
+ * @param comp The added component.
+ */
+ public void addLayoutComponent(String name, Component comp)
+ {
+ // Nothing needs to be done.
+ }
+
+ /**
+ * This method sets the size and position of the child components of the
+ * given container.
+ *
+ * @param parent The container to lay out.
+ */
+ public void layoutContainer(Container parent)
+ {
+ Component[] comps = parent.getComponents();
+ Dimension parentSize = parent.getSize();
+ Insets insets = parent.getInsets();
+ int currY = insets.top;
+ Dimension pref;
+
+ for (int i = 0; i < comps.length; i++)
+ {
+ pref = comps[i].getPreferredSize();
+ if (pref == null)
+ continue;
+ comps[i].setBounds(insets.left, currY, pref.width, pref.height);
+ currY += pref.height;
+ }
+ }
+
+ /**
+ * This method calculates the minimum layout size for the given container.
+ *
+ * @param parent The container.
+ *
+ * @return The minimum layout size.
+ */
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ return preferredLayoutSize(parent);
+ }
+
+ /**
+ * This method calculates the preferred layout size for the given
+ * container.
+ *
+ * @param parent The container.
+ *
+ * @return The preferred layout size.
+ */
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ int width = 0;
+ int height = 0;
+ Insets insets = parent.getInsets();
+ Component[] comps = parent.getComponents();
+ Dimension pref;
+ for (int i = 0; i < comps.length; i++)
+ {
+ pref = comps[i].getPreferredSize();
+ if (pref != null)
+ {
+ width = Math.max(width, pref.width);
+ height += pref.height;
+ }
+ }
+
+ return new Dimension(width + insets.left + insets.right,
+ height + insets.top + insets.bottom);
+ }
+
+ /**
+ * This method is called whenever a component is removed from the
+ * container.
+ *
+ * @param comp The removed component.
+ */
+ public void removeLayoutComponent(Component comp)
+ {
+ // Nothing needs to be done.
+ }
+ }
+
+ /**
+ * Creates a new DefaultSwatchChooserPanel object.
+ */
+ DefaultSwatchChooserPanel()
+ {
+ super();
+ }
+
+ /**
+ * This method updates the chooser panel with the new value from the
+ * JColorChooser.
+ */
+ public void updateChooser()
+ {
+ }
+
+ /**
+ * This method builds the chooser panel.
+ */
+ protected void buildChooser()
+ {
+ // The structure of the swatch panel is:
+ // One large panel (minus the insets).
+ // Inside that panel, there are two panels, one holds the palette.
+ // The other holds the label and the recent colors palette.
+ // The two palettes are two custom swatch panels.
+ setLayout(new MainPanelLayout());
+
+ JPanel mainPaletteHolder = new JPanel();
+ JPanel recentPaletteHolder = new JPanel();
+
+ mainPalette = new MainSwatchPanel();
+ recentPalette = new RecentSwatchPanel();
+ JLabel label = new JLabel("Recent:");
+
+ mouseHandler = new MouseHandler();
+ mainPalette.addMouseListener(mouseHandler);
+ recentPalette.addMouseListener(mouseHandler);
+
+ mainPaletteHolder.setLayout(new BorderLayout());
+ mainPaletteHolder.add(mainPalette, BorderLayout.CENTER);
+
+ recentPaletteHolder.setLayout(new RecentPanelLayout());
+ recentPaletteHolder.add(label);
+ recentPaletteHolder.add(recentPalette);
+
+ JPanel main = new JPanel();
+ main.add(mainPaletteHolder);
+ main.add(recentPaletteHolder);
+
+ this.add(main);
+ }
+
+ /**
+ * This method removes the chooser panel from the JColorChooser.
+ *
+ * @param chooser The JColorChooser this panel is being removed from.
+ */
+ public void uninstallChooserPanel(JColorChooser chooser)
+ {
+ recentPalette = null;
+ mainPalette = null;
+
+ removeAll();
+ super.uninstallChooserPanel(chooser);
+ }
+
+ /**
+ * This method returns the JTabbedPane displayed name.
+ *
+ * @return The name displayed in the JTabbedPane.
+ */
+ public String getDisplayName()
+ {
+ return "Swatches";
+ }
+
+ /**
+ * This method returns the small display icon.
+ *
+ * @return The small display icon.
+ */
+ public Icon getSmallDisplayIcon()
+ {
+ return null;
+ }
+
+ /**
+ * This method returns the large display icon.
+ *
+ * @return The large display icon.
+ */
+ public Icon getLargeDisplayIcon()
+ {
+ return null;
+ }
+
+ /**
+ * This method paints the chooser panel with the given Graphics object.
+ *
+ * @param g The Graphics object to paint with.
+ */
+ public void paint(Graphics g)
+ {
+ super.paint(g);
+ }
+
+ /**
+ * This method returns the tooltip text for the given MouseEvent.
+ *
+ * @param e The MouseEvent.
+ *
+ * @return The tooltip text.
+ */
+ public String getToolTipText(MouseEvent e)
+ {
+ return null;
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicArrowButton.java b/javax/swing/plaf/basic/BasicArrowButton.java
index 765210725..ce50e7b5e 100644
--- a/javax/swing/plaf/basic/BasicArrowButton.java
+++ b/javax/swing/plaf/basic/BasicArrowButton.java
@@ -40,14 +40,14 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
-import java.awt.Insets;
import java.awt.Graphics;
+import java.awt.Insets;
import java.awt.Polygon;
import java.awt.Rectangle;
-import javax.swing.border.Border;
import javax.swing.Icon;
import javax.swing.JButton;
import javax.swing.SwingConstants;
+import javax.swing.border.Border;
/**
@@ -55,163 +55,78 @@ import javax.swing.SwingConstants;
*/
public class BasicArrowButton extends JButton implements SwingConstants
{
- /**
- * A private helper class that draws icons.
- */
- private class arrowIcon implements Icon
- {
- /** The polygon that describes the icon. */
- private Polygon arrow;
-
- /** The size of the icon. */
- private int size = 10;
-
- /**
- * Creates a new arrowIcon object using the given arrow polygon.
- *
- * @param arrow The polygon that describes the arrow.
- */
- public arrowIcon(Polygon arrow)
- {
- this.arrow = arrow;
- }
-
- /**
- * Returns the height of the icon.
- *
- * @return The height of the icon.
- */
- public int getIconHeight()
- {
- return size;
- }
-
- /**
- * Returns the width of the icon.
- *
- * @return The width of the icon.
- */
- public int getIconWidth()
- {
- return size;
- }
-
- /**
- * Sets the size of the icon.
- *
- * @param size The size of the icon.
- */
- public void setSize(int size)
- {
- this.size = size;
- }
-
- /**
- * Sets the arrow polygon.
- *
- * @param arrow The arrow polygon.
- */
- public void setArrow(Polygon arrow)
- {
- this.arrow = arrow;
- }
-
- /**
- * Paints the icon.
- *
- * @param c The Component to paint for.
- * @param g The Graphics object to draw with.
- * @param x The X coordinate to draw at.
- * @param y The Y coordinate to draw at.
- */
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- Color arrowColor;
- if (c.isEnabled())
- arrowColor = darkShadow;
- else
- arrowColor = shadow;
-
- paintIconImpl(g, x, y, arrowColor);
- }
-
- /**
- * This method does the actual painting work.
- *
- * @param g The Graphics object to paint with.
- * @param x The x coordinate to paint at.
- * @param y The y coordinate to paint at.
- * @param arrowColor The color to paint the arrow with.
- */
- public void paintIconImpl(Graphics g, int x, int y, Color arrowColor)
- {
- g.translate(x, y);
+ /** The default size of the Arrow buttons. */
+ private static int defaultSize = 10;
- Color saved = g.getColor();
+ /** The Polygon that points up. */
+ private static Polygon upIcon = new Polygon(new int[] { 0, 5, 9 },
+ new int[] { 7, 2, 7 }, 3);
- g.setColor(arrowColor);
+ /** The Polygon that points down. */
+ private static Polygon downIcon = new Polygon(new int[] { 1, 5, 9 },
+ new int[] { 3, 7, 3 }, 3);
- g.fillPolygon(arrow);
+ /** The Polygon that points left. */
+ private static Polygon leftIcon = new Polygon(new int[] { 7, 3, 7 },
+ new int[] { 1, 5, 9 }, 3);
- g.setColor(saved);
- g.translate(-x, -y);
- }
- }
+ /** The Polygon that points right. */
+ private static Polygon rightIcon = new Polygon(new int[] { 3, 7, 3 },
+ new int[] { 1, 5, 9 }, 3);
/** The direction to point in. */
protected int direction;
- /** The color the arrow is painted in if disabled and the bottom and
- * right edges of the button. */
- private transient Color shadow = Color.BLACK;
+ /**
+ * The color the arrow is painted in if disabled and the bottom and right
+ * edges of the button.
+ */
+ private transient Color shadow = Color.GRAY;
- /** The color the arrow is painted in if enabled and the bottom and
- * right edges of the button. */
- private transient Color darkShadow = Color.BLACK;
+ /**
+ * The color the arrow is painted in if enabled and the bottom and right
+ * edges of the button.
+ */
+ private transient Color darkShadow = Color.DARK_GRAY;
/** The top and left edges of the button. */
- private transient Color highlight = Color.BLACK;
-
+ private transient Color highlight = Color.WHITE;
+
/** The border around the ArrowButton. */
- private transient Border tmpBorder = new Border()
- {
- public Insets getBorderInsets(Component c)
- {
- return new Insets(0, 0, 0, 0);
- }
-
- public boolean isBorderOpaque()
+ private transient Border buttonBorder = new Border()
{
- return false;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int w, int h)
- {
- Rectangle bounds = getBounds();
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
+ public boolean isBorderOpaque()
+ {
+ return true;
+ }
- Color saved = g.getColor();
- g.setColor(highlight);
+ public void paintBorder(Component c, Graphics g, int x, int y, int w,
+ int h)
+ {
+ Color saved = g.getColor();
+ g.setColor(highlight);
- g.drawLine(bounds.x, bounds.y, bounds.x, bounds.y + bounds.height);
- g.drawLine(bounds.x, bounds.y, bounds.x + bounds.width, bounds.y);
+ g.drawLine(x + 1, y + 1, x + w - 1, y + 1);
+ g.drawLine(x + 1, y + 1, x + 1, y + h - 1);
- g.setColor(shadow);
+ g.setColor(shadow);
- g.drawLine(bounds.x + 1, bounds.y + bounds.height - 1,
- bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
- g.drawLine(bounds.x + bounds.width - 1, bounds.y + 1,
- bounds.x + bounds.width - 1, bounds.y + bounds.height - 1);
+ g.drawLine(x + 1, y + h - 1, x + w - 1, y + h - 1);
+ g.drawLine(x + w - 1, y + 1, x + w - 1, y + h - 1);
- g.setColor(darkShadow);
+ g.setColor(darkShadow);
- g.drawLine(bounds.x, bounds.y + bounds.height, bounds.x + bounds.width,
- bounds.y + bounds.height);
- g.drawLine(bounds.x + bounds.width, bounds.y, bounds.x + bounds.width,
- bounds.y + bounds.height);
+ g.drawLine(x, y + h, x + w, y + h);
+ g.drawLine(x + w, y, x + w, y + h);
- g.setColor(saved);
- }
- };
+ g.setColor(saved);
+ }
+ };
/**
* Creates a new BasicArrowButton object.
@@ -221,12 +136,12 @@ public class BasicArrowButton extends JButton implements SwingConstants
public BasicArrowButton(int direction)
{
super();
+ setBorder(buttonBorder);
setDirection(direction);
- setBorder(tmpBorder);
}
/**
- * Creates a new BasicArrowButton object with the given colors and
+ * Creates a new BasicArrowButton object with the given colors and
* direction.
*
* @param direction The direction to point in.
@@ -246,6 +161,16 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
+ * This method returns whether the focus can traverse to this component.
+ *
+ * @return Whether the focus can traverse to this component.
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
* This method returns the direction of the arrow.
*
* @return The direction of the arrow.
@@ -262,22 +187,25 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
public void setDirection(int dir)
{
- Polygon arrow = getArrow(dir, 10);
- if (getIcon() == null)
- setIcon(new arrowIcon(arrow));
- else
- ((arrowIcon) getIcon()).setArrow(arrow);
this.direction = dir;
}
/**
- * This method paints the arrow button.
+ * This method paints the arrow button. The painting is delegated to the
+ * paintTriangle method.
*
* @param g The Graphics object to paint with.
*/
public void paint(Graphics g)
{
super.paint(g);
+ Insets insets = getInsets();
+ Rectangle bounds = getBounds();
+ int x = insets.left
+ + (bounds.width - insets.left - insets.right - defaultSize) / 2;
+ int y = insets.top
+ + (bounds.height - insets.left - insets.right - defaultSize) / 2;
+ paintTriangle(g, x, y, defaultSize, direction, isEnabled());
}
/**
@@ -287,7 +215,11 @@ public class BasicArrowButton extends JButton implements SwingConstants
*/
public Dimension getPreferredSize()
{
- return new Dimension(getIcon().getIconWidth(), getIcon().getIconHeight());
+ Insets insets = getInsets();
+ int w = defaultSize + insets.left + insets.right;
+ int h = defaultSize + insets.top + insets.bottom;
+
+ return new Dimension(w, h);
}
/**
@@ -311,8 +243,8 @@ public class BasicArrowButton extends JButton implements SwingConstants
}
/**
- * The method paints a triangle with the given size and direction at
- * the given x and y coordinates.
+ * The method paints a triangle with the given size and direction at the
+ * given x and y coordinates.
*
* @param g The Graphics object to paint with.
* @param x The x coordinate to paint at.
@@ -324,61 +256,90 @@ public class BasicArrowButton extends JButton implements SwingConstants
public void paintTriangle(Graphics g, int x, int y, int size, int direction,
boolean isEnabled)
{
- Polygon arrow = getArrow(direction, size);
- arrowIcon arrowI = new arrowIcon(arrow);
- arrowI.setSize(size);
-
- Color arrowColor;
- if (isEnabled())
- arrowColor = darkShadow;
- else
- arrowColor = shadow;
-
- arrowI.paintIconImpl(g, x, y, arrowColor);
- }
-
- /**
- * This is a private helper that creates polygons for a given size
- * and direction.
- *
- * @param direction The direction of the arrow.
- * @param size The size of the arrow.
- *
- * @return A new arrow polygon.
- */
- private Polygon getArrow(int direction, int size)
- {
- Polygon arrow;
- double dsize = (double) size;
-
- int two = (int) (dsize * 2 / 10);
- int three = (int) (dsize * 3 / 10);
- int five = (int) (dsize * 5 / 10);
- int seven = (int) (dsize * 7 / 10);
- int eight = (int) (dsize * 8 / 10);
+ Polygon arrow = null;
switch (direction)
{
case NORTH:
- arrow = new Polygon(new int[] { two, five, eight },
- new int[] { seven, three, seven }, 3);
+ arrow = upIcon;
break;
case SOUTH:
- arrow = new Polygon(new int[] { two, five, eight },
- new int[] { three, seven, three }, 3);
+ arrow = downIcon;
break;
case EAST:
case RIGHT:
- arrow = new Polygon(new int[] { three, seven, three },
- new int[] { two, five, eight }, 3);
+ arrow = rightIcon;
break;
case WEST:
case LEFT:
- arrow = new Polygon(new int[] { seven, three, seven },
- new int[] { two, five, eight }, 3);
+ arrow = leftIcon;
+ break;
+ }
+
+ int[] xPoints = arrow.xpoints;
+ int[] yPoints = arrow.ypoints;
+ int x1;
+ int y1;
+ int x2;
+ int y2;
+ x1 = y1 = x2 = y2 = 0;
+
+ if (size != defaultSize)
+ {
+ float scale = size * 1f / defaultSize;
+ for (int i = 0; i < 3; i++)
+ {
+ xPoints[i] *= scale;
+ yPoints[i] *= scale;
+ }
+ }
+ g.translate(x, y);
+
+ switch (direction)
+ {
+ case NORTH:
+ x1 = xPoints[0] + 2;
+ y1 = yPoints[0];
+ y2 = y1;
+ x2 = xPoints[2] - 1;
+ break;
+ case SOUTH:
+ x1 = xPoints[1];
+ y1 = yPoints[1] + 1;
+ x2 = xPoints[2] - 1;
+ y2 = yPoints[2];
+ break;
+ case LEFT:
+ case WEST:
+ x1 = xPoints[0] + 1;
+ y1 = yPoints[0] + 1;
+ x2 = x1;
+ y2 = yPoints[2] + 1;
+ break;
+ case RIGHT:
+ case EAST:
+ x1 = xPoints[2];
+ y1 = yPoints[2] + 1;
+ x2 = xPoints[1] - 1;
+ y2 = yPoints[1] + 1;
break;
- default:
- throw new IllegalArgumentException("Invalid direction given.");
}
- return arrow;
+ Color saved = g.getColor();
+
+ if (isEnabled)
+ {
+ g.setColor(Color.DARK_GRAY);
+
+ if (arrow != null)
+ g.fillPolygon(xPoints, yPoints, 3);
+ }
+ else
+ {
+ g.setColor(Color.GRAY);
+ g.fillPolygon(xPoints, yPoints, 3);
+ g.setColor(Color.WHITE);
+ g.drawLine(x1, y1, x2, y2);
+ }
+ g.setColor(saved);
+ g.translate(-x, -y);
}
}
diff --git a/javax/swing/plaf/basic/BasicButtonListener.java b/javax/swing/plaf/basic/BasicButtonListener.java
index c06ca0e9d..2b4be6769 100644
--- a/javax/swing/plaf/basic/BasicButtonListener.java
+++ b/javax/swing/plaf/basic/BasicButtonListener.java
@@ -37,6 +37,7 @@ exception statement from your version. */
package javax.swing.plaf.basic;
+import java.awt.event.ActionEvent;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.InputEvent;
@@ -46,6 +47,7 @@ import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
+import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.JComponent;
@@ -64,8 +66,14 @@ public class BasicButtonListener
}
public void focusGained(FocusEvent e)
{
+ if (e.getSource() instanceof AbstractButton)
+ {
+ AbstractButton button = (AbstractButton) e.getSource();
+ if (button.isFocusPainted())
+ button.repaint();
+ }
}
-
+
public void focusLost(FocusEvent e)
{
if (e.getSource() instanceof AbstractButton)
@@ -73,13 +81,43 @@ public class BasicButtonListener
AbstractButton button = (AbstractButton) e.getSource();
ButtonModel model = button.getModel();
model.setArmed(false);
+
+ if (button.isFocusPainted())
+ button.repaint();
}
}
public void installKeyboardActions(JComponent c)
{
+ c.getActionMap().put("pressed",
+ new AbstractAction()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ AbstractButton button = (AbstractButton) e.getSource();
+ ButtonModel model = button.getModel();
+ // It is important that these transitions happen in this order.
+ model.setArmed(true);
+ model.setPressed(true);
+ }
+ });
+
+ c.getActionMap().put("released",
+ new AbstractAction()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ AbstractButton button = (AbstractButton) e.getSource();
+ ButtonModel model = button.getModel();
+ // It is important that these transitions happen in this order.
+ model.setPressed(false);
+ model.setArmed(false);
+ }
+ });
}
public void uninstallKeyboardActions(JComponent c)
{
+ c.getActionMap().put("pressed", null);
+ c.getActionMap().put("released", null);
}
public void stateChanged(ChangeEvent e)
{
diff --git a/javax/swing/plaf/basic/BasicButtonUI.java b/javax/swing/plaf/basic/BasicButtonUI.java
index 9134fb2e2..df7ac4269 100644
--- a/javax/swing/plaf/basic/BasicButtonUI.java
+++ b/javax/swing/plaf/basic/BasicButtonUI.java
@@ -50,6 +50,7 @@ import java.awt.Stroke;
import javax.swing.AbstractButton;
import javax.swing.ButtonModel;
import javax.swing.Icon;
+import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
@@ -59,13 +60,21 @@ import javax.swing.plaf.ComponentUI;
public class BasicButtonUI extends ButtonUI
{
- /** A constant used to pad out elements in the button's layout and
- preferred size calculations. */
- int defaultTextIconGap = 4;
+ /**
+ * A constant used to pad out elements in the button's layout and
+ * preferred size calculations.
+ */
+ protected int defaultTextIconGap = 4;
- /** A constant added to the defaultTextIconGap to adjust the text
- within this particular button. */
- int defaultTextShiftOffset = 0;
+ /**
+ * A constant added to the defaultTextIconGap to adjust the text
+ * within this particular button.
+ */
+ protected int defaultTextShiftOffset = 0;
+
+ private int textShiftOffset;
+
+ private Color focusColor;
/**
* Factory method to create an instance of BasicButtonUI for a given
@@ -85,14 +94,32 @@ public class BasicButtonUI extends ButtonUI
return defaultTextIconGap;
}
+ protected void clearTextShiftOffset()
+ {
+ textShiftOffset = 0;
+ }
+
+ protected int getTextShiftOffset()
+ {
+ return textShiftOffset;
+ }
+
+ protected void setTextShiftOffset()
+ {
+ textShiftOffset = defaultTextShiftOffset;
+ }
+
protected void installDefaults(AbstractButton b)
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ focusColor = defaults.getColor("Button.focus");
b.setForeground(defaults.getColor("Button.foreground"));
b.setBackground(defaults.getColor("Button.background"));
b.setMargin(defaults.getInsets("Button.margin"));
b.setBorder(defaults.getBorder("Button.border"));
b.setIconTextGap(defaults.getInt("Button.textIconGap"));
+ b.setInputMap(JComponent.WHEN_FOCUSED,
+ (InputMap) defaults.get("Button.focusInputMap"));
b.setOpaque(true);
}
@@ -133,10 +160,12 @@ public class BasicButtonUI extends ButtonUI
protected void installKeyboardActions(AbstractButton b)
{
+ listener.installKeyboardActions(b);
}
protected void uninstallKeyboardActions(AbstractButton b)
{
+ listener.uninstallKeyboardActions(b);
}
/**
@@ -271,22 +300,12 @@ public class BasicButtonUI extends ButtonUI
{
if (b.hasFocus() && b.isFocusPainted())
{
- Graphics2D g2 = (Graphics2D) g;
- Stroke saved_stroke = g2.getStroke();
- Color saved_color = g2.getColor();
- float dashes[] = new float[] {1.0f, 1.0f};
- BasicStroke s = new BasicStroke(1.0f,
- BasicStroke.CAP_SQUARE,
- BasicStroke.JOIN_MITER,
- 10, dashes, 0.0f);
- g2.setStroke(s);
- g2.setColor(Color.BLACK);
- g2.drawRect(vr.x + 2,
- vr.y + 2,
- vr.width - 4,
- vr.height - 4);
- g2.setStroke(saved_stroke);
- g2.setColor(saved_color);
+ Color saved_color = g.getColor();
+ g.setColor(focusColor);
+ Rectangle focusRect = ir.union(tr);
+ g.drawRect(focusRect.x, focusRect.y,
+ focusRect.width, focusRect.height);
+ g.setColor(saved_color);
}
}
diff --git a/javax/swing/plaf/basic/BasicColorChooserUI.java b/javax/swing/plaf/basic/BasicColorChooserUI.java
new file mode 100644
index 000000000..1c2dcd695
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicColorChooserUI.java
@@ -0,0 +1,338 @@
+/* BasicColorChooserUI.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.JColorChooser;
+import javax.swing.JComponent;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.colorchooser.AbstractColorChooserPanel;
+import javax.swing.colorchooser.ColorChooserComponentFactory;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.plaf.ColorChooserUI;
+import javax.swing.plaf.ComponentUI;
+
+
+/**
+ * This is the UI Class for the JColorChooser in the Basic Look and Feel.
+ */
+public class BasicColorChooserUI extends ColorChooserUI
+{
+ /**
+ * This helper class handles property changes from the JColorChooser.
+ */
+ public class PropertyHandler implements PropertyChangeListener
+ {
+ /**
+ * This method is called when any of the properties of the JColorChooser
+ * change.
+ *
+ * @param e The PropertyChangeEvent.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName() == JColorChooser.CHOOSER_PANELS_PROPERTY)
+ makeTabs(chooser.getChooserPanels());
+ else if (e.getPropertyName() == JColorChooser.PREVIEW_PANEL_PROPERTY)
+ updatePreviewPanel(chooser.getPreviewPanel());
+ else if (e.getPropertyName() == JColorChooser.SELECTION_MODEL_PROPERTY)
+ ((AbstractColorChooserPanel) pane.getSelectedComponent())
+ .updateChooser();
+
+ chooser.repaint();
+ }
+ }
+
+ /**
+ * This is a helper class that listens to the Model of the JColorChooser for
+ * color change events so it can update the preview panel.
+ */
+ private class PreviewListener implements ChangeListener
+ {
+ /**
+ * This method is called whenever the JColorChooser's color changes.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ if (pane != null)
+ {
+ AbstractColorChooserPanel panel = (AbstractColorChooserPanel) pane
+ .getSelectedComponent();
+ if (panel != null)
+ panel.updateChooser();
+ }
+ chooser.repaint();
+ }
+ }
+
+ /**
+ * This helper class listens to the JTabbedPane that is used for tab
+ * changes.
+ */
+ private class TabPaneListener implements ChangeListener
+ {
+ /**
+ * This method is called whenever a different tab is selected in the
+ * JTabbedPane.
+ *
+ * @param e The ChangeEvent.
+ */
+ public void stateChanged(ChangeEvent e)
+ {
+ // Need to do this because we don't update all the tabs when they're not
+ // visible, so they are not informed of new colors when they're hidden.
+ AbstractColorChooserPanel comp = (AbstractColorChooserPanel) pane
+ .getSelectedComponent();
+ comp.updateChooser();
+ }
+ }
+
+ /** An array of default choosers to use in the JColorChooser. */
+ protected AbstractColorChooserPanel[] defaultChoosers;
+
+ /** The listener for the preview panel. */
+ protected ChangeListener previewListener;
+
+ /** The PropertyChangeListener for the JColorChooser. */
+ protected PropertyChangeListener propertyChangeListener;
+
+ /** The JColorChooser. */
+ private JColorChooser chooser;
+
+ /** The JTabbedPane that is used. */
+ private JTabbedPane pane;
+
+ /** The Container that holds the preview panel. */
+ private Container prevContainer;
+
+ /**
+ * Creates a new BasicColorChooserUI object.
+ */
+ public BasicColorChooserUI()
+ {
+ super();
+ }
+
+ /**
+ * This method creates a new UI Component for the given JComponent.
+ *
+ * @param c The JComponent to create an UI for.
+ *
+ * @return A new BasicColorChooserUI.
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicColorChooserUI();
+ }
+
+ /**
+ * This method creates the default chooser panels for the JColorChooser.
+ *
+ * @return The default chooser panels.
+ */
+ protected AbstractColorChooserPanel[] createDefaultChoosers()
+ {
+ return ColorChooserComponentFactory.getDefaultChooserPanels();
+ }
+
+ /**
+ * This method installs the UI Component for the given JComponent.
+ *
+ * @param c The JComponent to install this UI for.
+ */
+ public void installUI(JComponent c)
+ {
+ if (c instanceof JColorChooser)
+ {
+ chooser = (JColorChooser) c;
+ chooser.setLayout(new BorderLayout());
+
+ // Do this first, so we avoid doing work for property change events.
+ defaultChoosers = createDefaultChoosers();
+ chooser.setChooserPanels(defaultChoosers);
+ pane = new JTabbedPane();
+
+ pane.addChangeListener(new ChangeListener()
+ {
+ public void stateChanged(ChangeEvent e)
+ {
+ pane.repaint();
+ }
+ });
+
+ makeTabs(defaultChoosers);
+
+ chooser.add(pane, BorderLayout.NORTH);
+
+ installPreviewPanel();
+
+ installDefaults();
+ installListeners();
+ }
+ }
+
+ /**
+ * This method adds tabs to the JTabbedPane for the chooserPanels defined in
+ * the JColorChooser.
+ *
+ * @param panels The Panels that need tabs to be made for them.
+ */
+ private void makeTabs(AbstractColorChooserPanel[] panels)
+ {
+ pane.removeAll();
+ for (int i = 0; i < panels.length; i++)
+ pane.addTab(panels[i].getDisplayName(), panels[i].getSmallDisplayIcon(),
+ panels[i]);
+ }
+
+ /**
+ * This method uninstalls this UI for the given JComponent.
+ *
+ * @param c The JComponent that will have this UI removed.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ uninstallListeners();
+ uninstallDefaults();
+
+ pane = null;
+ chooser = null;
+ }
+
+ /**
+ * This method installs the preview panel for the JColorChooser.
+ */
+ protected void installPreviewPanel()
+ {
+ updatePreviewPanel(ColorChooserComponentFactory.getPreviewPanel());
+ }
+
+ /**
+ * This is a helper method that swaps the existing preview panel with the
+ * given panel.
+ *
+ * @param preview The new preview panel.
+ */
+ private void updatePreviewPanel(JComponent preview)
+ {
+ if (prevContainer == null)
+ {
+ prevContainer = new JPanel();
+ prevContainer.setLayout(new BorderLayout());
+ chooser.add(prevContainer, BorderLayout.CENTER);
+ }
+ prevContainer.removeAll();
+ prevContainer.add(preview, BorderLayout.CENTER);
+ }
+
+ /**
+ * This method installs the default properties given by the Basic Look and
+ * Feel.
+ */
+ protected void installDefaults()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ chooser.setFont(defaults.getFont("ColorChooser.font"));
+ chooser.setForeground(defaults.getColor("ColorChooser.foreground"));
+ chooser.setBackground(defaults.getColor("ColorChooser.background"));
+ }
+
+ /**
+ * This method uninstalls the default properties given by the Basic Look and
+ * Feel.
+ */
+ protected void uninstallDefaults()
+ {
+ chooser.setBackground(null);
+ chooser.setForeground(null);
+ chooser.setFont(null);
+ }
+
+ /**
+ * This method installs any listeners required for this UI to function.
+ */
+ protected void installListeners()
+ {
+ propertyChangeListener = createPropertyChangeListener();
+ previewListener = new PreviewListener();
+
+ chooser.addPropertyChangeListener(propertyChangeListener);
+ chooser.getSelectionModel().addChangeListener(previewListener);
+
+ pane.addChangeListener(new TabPaneListener());
+ }
+
+ /**
+ * This method creates the PropertyChangeListener used for listening to the
+ * JColorChooser.
+ *
+ * @return A PropertyChangeListener.
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyHandler();
+ }
+
+ /**
+ * This method uninstalls any listeners that were previously installed by
+ * the UI.
+ */
+ protected void uninstallListeners()
+ {
+ chooser.removePropertyChangeListener(propertyChangeListener);
+ chooser.getSelectionModel().removeChangeListener(previewListener);
+
+ previewListener = null;
+ propertyChangeListener = null;
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicComboBoxEditor.java b/javax/swing/plaf/basic/BasicComboBoxEditor.java
new file mode 100644
index 000000000..a465ff949
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicComboBoxEditor.java
@@ -0,0 +1,170 @@
+/* BasicComboBoxEditor.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Component;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import javax.swing.ComboBoxEditor;
+import javax.swing.JTextField;
+import javax.swing.border.EmptyBorder;
+import javax.swing.plaf.UIResource;
+
+
+/**
+ * This is a component that is responsible for displaying/editting selected
+ * item in comboBox. By default, the JTextField is returned as
+ * BasicComboBoxEditor.
+ *
+ * @author Olga Rodimina
+ */
+public class BasicComboBoxEditor extends Object implements ComboBoxEditor,
+ FocusListener
+{
+ protected JTextField editor;
+
+ /**
+ * Creates a new BasicComboBoxEditor object.
+ */
+ public BasicComboBoxEditor()
+ {
+ editor = new JTextField();
+ editor.setBorder(new EmptyBorder(1, 1, 1, 1));
+ }
+
+ /**
+ * This method returns textfield that will be used by the combo box to
+ * display/edit currently selected item in the combo box.
+ *
+ * @return textfield that will be used by the combo box to display/edit
+ * currently selected item
+ */
+ public Component getEditorComponent()
+ {
+ return editor;
+ }
+
+ /**
+ * Sets item that should be editted when any editting operation is performed
+ * by the user. The value is always equal to the currently selected value
+ * in the combo box. Thus whenever a different value is selected from the
+ * combo box list then this method should be called to change editting
+ * item to the new selected item.
+ *
+ * @param selectedItem item that is currently selected in the combo box
+ */
+ public void setItem(Object item)
+ {
+ editor.setText(item.toString());
+ }
+
+ /**
+ * This method returns item that is currently editable.
+ *
+ * @return item in the combo box that is currently editable
+ */
+ public Object getItem()
+ {
+ return editor.getText();
+ }
+
+ public void selectAll()
+ {
+ editor.selectAll();
+ }
+
+ /**
+ * This method is called when textfield gains focus. This will enable
+ * editing of the selected item.
+ *
+ * @param e the FocusEvent describing change in focus.
+ */
+ public void focusGained(FocusEvent e)
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method is called when textfield loses focus. If during this time any
+ * editting operation was performed by the user, then it will be cancelled
+ * and selected item will not be changed.
+ *
+ * @param e the FocusEvent describing change in focus
+ */
+ public void focusLost(FocusEvent e)
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method adds actionListener to the editor. If the user will edit
+ * currently selected item in the textfield and pressEnter, then action
+ * will be performed. The actionPerformed of this ActionListener should
+ * change the selected item of the comboBox to the newly editted selected
+ * item.
+ *
+ * @param l the ActionListener responsible for changing selected item of the
+ * combo box when it is editted by the user.
+ */
+ public void addActionListener(ActionListener l)
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method removes actionListener from the textfield.
+ *
+ * @param l the ActionListener to remove from the textfield.
+ */
+ public void removeActionListener(ActionListener l)
+ {
+ // FIXME: Need to implement
+ }
+
+ public static class UIResource extends BasicComboBoxEditor
+ implements javax.swing.plaf.UIResource
+ {
+ /**
+ * Creates a new UIResource object.
+ */
+ public UIResource()
+ {
+ }
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicComboBoxRenderer.java b/javax/swing/plaf/basic/BasicComboBoxRenderer.java
new file mode 100644
index 000000000..6bf6a74d5
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicComboBoxRenderer.java
@@ -0,0 +1,143 @@
+/* BasicComboBoxRenderer.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.io.Serializable;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingConstants;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.plaf.UIResource;
+
+
+/**
+ * This class is renderer for the combo box.
+ *
+ * @author Olga Rodimina
+ */
+public class BasicComboBoxRenderer extends JLabel implements ListCellRenderer,
+ Serializable
+{
+ /**
+ * This border is used whenever renderer doesn't have a focus.
+ */
+ protected static Border noFocusBorder = new EmptyBorder(0, 0, 0, 0);
+
+ /**
+ * Creates a new BasicComboBoxRenderer object.
+ */
+ public BasicComboBoxRenderer()
+ {
+ setHorizontalAlignment(SwingConstants.LEFT);
+ }
+
+ /**
+ * Returns preferredSize of the renderer
+ *
+ * @return preferredSize of the renderer
+ */
+ public Dimension getPreferredSize()
+ {
+ return super.getPreferredSize();
+ }
+
+ /**
+ * getListCellRendererComponent
+ *
+ * @param list List of items for which to the background and foreground
+ * colors
+ * @param value object that should be rendered in the cell
+ * @param index index of the cell in the list of items.
+ * @param isSelected draw cell highlighted if isSelected is true
+ * @param cellHasFocus draw focus rectangle around cell if the cell has
+ * focus
+ *
+ * @return Component that will be used to draw the desired cell.
+ */
+ public Component getListCellRendererComponent(JList list, Object value,
+ int index, boolean isSelected,
+ boolean cellHasFocus)
+ {
+ String s = value.toString();
+ setText(s);
+ setOpaque(true);
+
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ if (isSelected)
+ {
+ setBackground(list.getSelectionBackground());
+ setForeground(list.getSelectionForeground());
+ }
+ else
+ {
+ setBackground(list.getBackground());
+ setForeground(list.getForeground());
+ }
+
+ setEnabled(list.isEnabled());
+ setFont(list.getFont());
+
+ // Use focusCellHighlightBorder when renderer has focus and
+ // noFocusBorder otherwise
+ if (cellHasFocus)
+ setBorder(UIManager.getBorder("List.focusCellHighlightBorder"));
+ else
+ setBorder(noFocusBorder);
+
+ return this;
+ }
+
+ public static class UIResource extends BasicComboBoxRenderer
+ implements javax.swing.plaf.UIResource
+ {
+ /**
+ * Creates a new UIResource object.
+ */
+ public UIResource()
+ {
+ }
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicComboBoxUI.java b/javax/swing/plaf/basic/BasicComboBoxUI.java
new file mode 100644
index 000000000..d71dd513d
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicComboBoxUI.java
@@ -0,0 +1,1240 @@
+/* BasicComboBoxUI.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.Rectangle;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.EventListener;
+import javax.accessibility.Accessible;
+import javax.swing.CellRendererPane;
+import javax.swing.ComboBoxEditor;
+import javax.swing.ComboBoxModel;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.ListCellRenderer;
+import javax.swing.SwingConstants;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+import javax.swing.plaf.ComboBoxUI;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicComboPopup;
+import javax.swing.plaf.basic.BasicGraphicsUtils;
+
+
+/**
+ * UI Delegate for JComboBox
+ *
+ * @author Olga Rodimina
+ */
+public class BasicComboBoxUI extends ComboBoxUI
+{
+ /**
+ * This arrow button that is displayed in the rigth side of JComboBox. This
+ * button is used to hide and show combo box's list of items
+ */
+ protected JButton arrowButton;
+
+ /**
+ * The combo box for which this UI delegate is for
+ */
+ protected JComboBox comboBox;
+
+ /**
+ * Component that is responsible for displaying/editting selected item of
+ * the combo box. By default JTextField is used as an editor for the
+ * JComboBox
+ */
+ protected Component editor;
+
+ /**
+ * Listener listening to focus events occuring in the JComboBox
+ */
+ protected FocusListener focusListener;
+
+ /**
+ * tells whether JComboBox currently has focus
+ */
+ protected boolean hasFocus;
+
+ /**
+ * Listener listening to item events fired by the JComboBox
+ */
+ protected ItemListener itemListener;
+
+ /**
+ * KeyListener listening to key events that occur while JComboBox has focus
+ */
+ protected KeyListener keyListener;
+
+ /**
+ * MouseListener listening to mouse events occuring in the combo box
+ */
+ private MouseListener mouseListener;
+
+ /**
+ * List used when rendering selected item of the combo box. The selection
+ * and foreground colors for combo box renderer are configured from this
+ * list
+ */
+ protected JList listBox;
+
+ /**
+ * ListDataListener listening to JComboBox model
+ */
+ protected ListDataListener listDataListener;
+
+ /**
+ * Popup list containing combo box's menu items
+ */
+ protected ComboPopup popup;
+ protected KeyListener popupKeyListener;
+ protected MouseListener popupMouseListener;
+ protected MouseMotionListener popupMouseMotionListener;
+
+ /**
+ * Listener listening to changes in the bound properties of JComboBox
+ */
+ protected PropertyChangeListener propertyChangeListener;
+
+ /**
+ * Colors that are used to render selected item in the combo box.
+ */
+ private Color shadow;
+ private Color darkShadow;
+ private Color highlight;
+ private Color lightHighlight;
+
+ /* Size of the largest item in the comboBox */
+ private Dimension largestItemSize;
+
+ // It seems that JComboBox doesn't have a border set explicitely. So we just
+ // paint the border everytime combo box is displayed.
+
+ /* border insets for this JComboBox*/
+ private static final Insets borderInsets = new Insets(2, 2, 2, 2);
+
+ // Width of the arrow button
+ private static int arrowButtonWidth = 15;
+
+ // FIXME: This fields aren't used anywhere at this moment.
+ protected Dimension cachedMinimumSize;
+ protected CellRendererPane currentValuePane;
+ protected boolean isMinimumSizeDirty;
+
+ /**
+ * Creates a new BasicComboBoxUI object.
+ */
+ public BasicComboBoxUI()
+ {
+ }
+
+ /**
+ * Factory method to create a BasicComboBoxUI for the given {@link
+ * JComponent}, which should be a {@link JComboBox}.
+ *
+ * @param c The {@link JComponent} a UI is being created for.
+ *
+ * @return A BasicComboBoxUI for the {@link JComponent}.
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicComboBoxUI();
+ }
+
+ /**
+ * This method installs the UI for the given JComponent.
+ *
+ * @param c The JComponent to install a UI for.
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+
+ if (c instanceof JComboBox)
+ {
+ comboBox = (JComboBox) c;
+ comboBox.setOpaque(true);
+ comboBox.setLayout(createLayoutManager());
+ installDefaults();
+ installComponents();
+ installListeners();
+ installKeyboardActions();
+ }
+ }
+
+ /**
+ * This method uninstalls the UI.
+ *
+ * @param c The JComponent that is having this UI removed.
+ */
+ public void uninstallUI(JComponent c)
+ {
+ uninstallKeyboardActions();
+ uninstallListeners();
+ uninstallComponents();
+ uninstallDefaults();
+ comboBox = null;
+ }
+
+ /**
+ * This method installs the defaults that are defined in the Basic look and
+ * feel for this {@link JComboBox}.
+ */
+ protected void installDefaults()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ comboBox.setBackground(defaults.getColor("ComboBox.background"));
+ comboBox.setFont(defaults.getFont("ComboBox.font"));
+ comboBox.setForeground(defaults.getColor("ComboBox.foreground"));
+
+ // Set default color that should be used to to render selected item
+ // of the combo box.
+ shadow = defaults.getColor("Button.shadow");
+ darkShadow = defaults.getColor("Button.darkShadow");
+ lightHighlight = defaults.getColor("Button.light");
+ highlight = defaults.getColor("Button.highlight");
+ }
+
+ /**
+ * This method creates and installs the listeners for this UI.
+ */
+ protected void installListeners()
+ {
+ // install combo box's listeners
+ propertyChangeListener = createPropertyChangeListener();
+ comboBox.addPropertyChangeListener(propertyChangeListener);
+
+ focusListener = createFocusListener();
+ comboBox.addFocusListener(focusListener);
+
+ itemListener = createItemListener();
+ comboBox.addItemListener(itemListener);
+
+ keyListener = createKeyListener();
+ comboBox.addKeyListener(keyListener);
+
+ mouseListener = createMouseListener();
+ comboBox.addMouseListener(mouseListener);
+
+ // install listeners that listen to combo box model
+ listDataListener = createListDataListener();
+ comboBox.getModel().addListDataListener(listDataListener);
+
+ configureArrowButton();
+ }
+
+ /**
+ * This method uninstalls the defaults and sets any objects created during
+ * install to null
+ */
+ protected void uninstallDefaults()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+
+ comboBox.setBackground(null);
+ comboBox.setFont(null);
+ comboBox.setForeground(null);
+
+ shadow = null;
+ darkShadow = null;
+ lightHighlight = null;
+ highlight = null;
+ }
+
+ /**
+ * Detaches all the listeners we attached in {@link #installListeners}.
+ */
+ protected void uninstallListeners()
+ {
+ comboBox.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
+
+ comboBox.removeFocusListener(focusListener);
+ focusListener = null;
+
+ comboBox.removeItemListener(itemListener);
+ itemListener = null;
+
+ comboBox.removeKeyListener(keyListener);
+ keyListener = null;
+
+ comboBox.removeMouseListener(mouseListener);
+ mouseListener = null;
+
+ comboBox.getModel().removeListDataListener(listDataListener);
+ listDataListener = null;
+
+ unconfigureArrowButton();
+ }
+
+ /**
+ * This method creates popup that will contain list of combo box's items
+ *
+ * @return popup containing list of combo box's items
+ */
+ protected ComboPopup createPopup()
+ {
+ return new BasicComboPopup(comboBox);
+ }
+
+ /**
+ * Creates KeyListener to listen to key events.
+ *
+ * @return KeyListener that listens to key events.
+ */
+ protected KeyListener createKeyListener()
+ {
+ return new KeyHandler();
+ }
+
+ /**
+ * This method create MouseListener that will listen to mouse event occuring
+ * in combo box.
+ *
+ * @return the MouseListener
+ */
+ private MouseListener createMouseListener()
+ {
+ return new MouseHandler();
+ }
+
+ /**
+ * This method create FocusListener that will listen to changes in this
+ * JComboBox's focus.
+ *
+ * @return theFocusListener
+ */
+ protected FocusListener createFocusListener()
+ {
+ return new FocusHandler();
+ }
+
+ /**
+ * This method create ListDataListener to listen to ComboBox's data model
+ *
+ * @return ListDataListener
+ */
+ protected ListDataListener createListDataListener()
+ {
+ return new ListDataHandler();
+ }
+
+ /**
+ * This method creates ItemListener that will listen to to the changes in
+ * the JComboBox's selection.
+ *
+ * @return the ItemListener
+ */
+ protected ItemListener createItemListener()
+ {
+ return new ItemHandler();
+ }
+
+ /**
+ * This method creates PropertyChangeListener to listen to the changes in
+ * the JComboBox's bound properties.
+ *
+ * @return the PropertyChangeListener
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * This method returns layout manager for the combo box.
+ *
+ * @return layout manager for the combo box
+ */
+ protected LayoutManager createLayoutManager()
+ {
+ return new ComboBoxLayoutManager();
+ }
+
+ /**
+ * This method creates component that will be responsible for rendering the
+ * selected component in the combo box.
+ *
+ * @return render for the combo box
+ */
+ protected ListCellRenderer createRenderer()
+ {
+ return new BasicComboBoxRenderer();
+ }
+
+ /**
+ * Creates component that will be responsible for displaying/editting
+ * selected item in the combo box. This editor is used only when combo box
+ * is editable.
+ *
+ * @return component that will be responsible for displaying/editting
+ * selected item in the combo box.
+ */
+ protected ComboBoxEditor createEditor()
+ {
+ return new BasicComboBoxEditor();
+ }
+
+ /**
+ * This method installs components for this JComboBox. ArrowButton, main
+ * part of combo box (upper part) and popup list of items are created and
+ * configured here.
+ */
+ protected void installComponents()
+ {
+ // create and install arrow button
+ arrowButton = createArrowButton();
+
+ comboBox.add(arrowButton);
+
+ // Set list that will be used by BasicComboBoxRender
+ // in order to determine the right colors when rendering
+ listBox = new JList();
+
+ Color background = arrowButton.getBackground();
+ listBox.setBackground(background);
+ listBox.setSelectionBackground(background.darker());
+
+ Color foreground = arrowButton.getForeground();
+ listBox.setForeground(foreground);
+ listBox.setSelectionForeground(foreground);
+
+ // set editor and renderer for the combo box. Editor is used
+ // only if combo box becomes editable, otherwise renderer is used
+ // to paint the selected item; combobox is not editable by default.
+ comboBox.setRenderer(createRenderer());
+
+ comboBox.setEditor(createEditor());
+ editor = comboBox.getEditor().getEditorComponent();
+
+ // create drop down list of items
+ popup = createPopup();
+
+ comboBox.revalidate();
+ }
+
+ /**
+ * This method uninstalls components from this JComboBox
+ */
+ protected void uninstallComponents()
+ {
+ // uninstall arrow button
+ unconfigureArrowButton();
+ comboBox.remove(arrowButton);
+ arrowButton = null;
+
+ listBox = null;
+ popup = null;
+
+ comboBox.setRenderer(null);
+
+ comboBox.setEditor(null);
+ editor = null;
+ }
+
+ /**
+ * This method adds editor to the combo box
+ */
+ public void addEditor()
+ {
+ comboBox.add(editor);
+ }
+
+ /**
+ * This method removes editor from the combo box
+ */
+ public void removeEditor()
+ {
+ comboBox.remove(editor);
+ }
+
+ /**
+ * This method configures editor for this combo box.
+ */
+ protected void configureEditor()
+ {
+ // FIXME: Need to implement. Set font and add listeners.
+ }
+
+ /**
+ * This method removes all the listeners for the editor.
+ */
+ protected void unconfigureEditor()
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method adds listeners to the arrow button part of the combo box.
+ */
+ public void configureArrowButton()
+ {
+ arrowButton.addMouseListener(mouseListener);
+ }
+
+ /**
+ * This method removes listeners from the arrow button part of the combo
+ * box.
+ */
+ public void unconfigureArrowButton()
+ {
+ arrowButton.removeMouseListener(mouseListener);
+ }
+
+ /**
+ * This method create arrow button for this JComboBox. Arrow button is
+ * responsible for displaying / hiding drop down list of items when it is
+ * clicked.
+ *
+ * @return JButton arrow button for this JComboBox.
+ */
+ protected JButton createArrowButton()
+ {
+ return new BasicArrowButton(BasicArrowButton.SOUTH);
+ }
+
+ /**
+ * This method checks if popup part of the combo box is visible on the
+ * screen
+ *
+ * @param c The JComboBox to check
+ *
+ * @return true if popup part of the JComboBox is visible and false
+ * otherwise.
+ */
+ public boolean isPopupVisible(JComboBox c)
+ {
+ return popup.isVisible();
+ }
+
+ /**
+ * Displays/Hides JComboBox's list of items on the screen.
+ *
+ * @param c The combo box, for which list of items should be
+ * displayed/hidden
+ * @param v true if show popup part of the jcomboBox and false to hide.
+ */
+ public void setPopupVisible(JComboBox c, boolean v)
+ {
+ if (v)
+ popup.show();
+ else
+ popup.hide();
+ }
+
+ /**
+ * JComboBox is focus traversable if it is editable and not otherwise.
+ *
+ * @param c combo box for which to check whether it is focus traversable
+ *
+ * @return true if focus tranversable and false otherwise
+ */
+ public boolean isFocusTraversable(JComboBox c)
+ {
+ if (comboBox.isEditable())
+ return true;
+
+ return false;
+ }
+
+ /**
+ * Paints given menu item using specified graphics context
+ *
+ * @param g The graphics context used to paint this combo box
+ * @param c comboBox which needs to be painted.
+ */
+ public void paint(Graphics g, JComponent c)
+ {
+ if (c instanceof JComboBox)
+ {
+ JComboBox cb = (JComboBox) c;
+
+ paintBorder(g, comboBox.getBounds(), hasFocus);
+
+ Rectangle rect = rectangleForCurrentValue();
+ paintCurrentValueBackground(g, rect, hasFocus);
+ paintCurrentValue(g, rect, hasFocus);
+ }
+ }
+
+ private void paintBorder(Graphics g, Rectangle bounds, boolean hasFocus)
+ {
+ int x = 0;
+ int y = 0;
+ int width = bounds.width;
+ int height = bounds.height;
+
+ Color oldColor = g.getColor();
+
+ if (! arrowButton.getModel().isPressed())
+ BasicGraphicsUtils.drawEtchedRect(g, x, y, width, height, Color.gray,
+ Color.white, Color.gray, Color.white);
+ else
+ {
+ g.setColor(darkShadow);
+ g.drawRect(x, y, width, height);
+ g.setColor(shadow);
+ g.drawRect(x + 1, y + 1, width - 3, height - 3);
+ }
+ g.setColor(oldColor);
+ }
+
+ /**
+ * Returns preferred size for the given menu item.
+ *
+ * @param c comboBox for which to get preferred size
+ *
+ * @return $Dimension$ preferred size for the given combo box
+ */
+ public Dimension getPreferredSize(JComponent c)
+ {
+ // return null to indicate that combo box's layout will determin its
+ // preferred size
+ return null;
+ }
+
+ /**
+ * This method returns the minimum size for this {@link JComboBox} for this
+ * look and feel.
+ *
+ * @param c The {@link JComponent} to find the minimum size for.
+ *
+ * @return The dimensions of the minimum size.
+ */
+ public Dimension getMinimumSize(JComponent c)
+ {
+ return null;
+ }
+
+ /**
+ * This method returns the maximum size for this {@link JComboBox} for this
+ * look and feel.
+ *
+ * @param c The {@link JComponent} to find the maximum size for
+ *
+ * @return The dimensions of the minimum size.
+ */
+ public Dimension getMaximumSize(JComponent c)
+ {
+ return null;
+ }
+
+ public int getAccessibleChildrenCount(JComponent c)
+ {
+ // FIXME: Need to implement
+ return 0;
+ }
+
+ public Accessible getAccessibleChild(JComponent c, int i)
+ {
+ // FIXME: Need to implement
+ return null;
+ }
+
+ /**
+ * Returns true if the specified key is a navigation key and false otherwise
+ *
+ * @param keyCode a key for which to check whether it is navigation key or
+ * not.
+ *
+ * @return true if the specified key is a navigation key and false otherwis
+ */
+ protected boolean isNavigationKey(int keyCode)
+ {
+ return false;
+ }
+
+ /**
+ * This method selects next possible item relative to the current selection
+ * to be next selected item in the combo box.
+ */
+ protected void selectNextPossibleValue()
+ {
+ int index = comboBox.getSelectedIndex();
+ if (index != comboBox.getItemCount() - 1)
+ comboBox.setSelectedIndex(index + 1);
+ }
+
+ /**
+ * This method selects previous item relative to current selection to be
+ * next selected item.
+ */
+ protected void selectPreviousPossibleValue()
+ {
+ int index = comboBox.getSelectedIndex();
+ if (index != 0)
+ comboBox.setSelectedIndex(index - 1);
+ }
+
+ /**
+ * This method displays combo box popup if the popup is not currently shown
+ * on the screen and hides it if it is currently shown
+ */
+ protected void toggleOpenClose()
+ {
+ setPopupVisible(comboBox, ! isPopupVisible(comboBox));
+ }
+
+ /**
+ * This method returns bounds in which comboBox's selected Item will be
+ * displayed
+ *
+ * @return rectangle bounds in which comboBox's selected Item will be
+ * displayed
+ */
+ protected Rectangle rectangleForCurrentValue()
+ {
+ Rectangle cbBounds = comboBox.getBounds();
+
+ // Subtract width or the arrow button and border insets
+ Rectangle rectForCurrentValue = new Rectangle(cbBounds.x
+ + borderInsets.left,
+ cbBounds.y
+ + borderInsets.top,
+ cbBounds.width
+ - arrowButtonWidth
+ - borderInsets.left
+ - borderInsets.right,
+ cbBounds.height
+ - borderInsets.top
+ - borderInsets.bottom);
+
+ return rectForCurrentValue;
+ }
+
+ /**
+ * This method returns insets of the current border.
+ *
+ * @return Insets representing space between combo box and its border
+ */
+ protected Insets getInsets()
+ {
+ return new Insets(0, 0, 0, 0);
+ }
+
+ /**
+ * This method paints currently selected value in the main part of the combo
+ * box (part without popup).
+ *
+ * @param g graphics context
+ * @param bounds Rectangle representing the size of the area in which
+ * selected item should be drawn
+ * @param hasFocus true if combo box has focus and false otherwise
+ */
+ public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
+ {
+ if (! comboBox.isEditable())
+ {
+ Object currentValue = comboBox.getSelectedItem();
+ boolean isPressed = arrowButton.getModel().isPressed();
+ if (currentValue != null)
+ {
+ Component comp = comboBox.getRenderer()
+ .getListCellRendererComponent(listBox,
+ currentValue,
+ -1,
+ isPressed,
+ hasFocus);
+ if (! comboBox.isEnabled())
+ comp.setEnabled(false);
+
+ g.translate(borderInsets.left, borderInsets.top);
+ comp.setBounds(0, 0, bounds.width, bounds.height);
+ comp.paint(g);
+ g.translate(-borderInsets.left, -borderInsets.top);
+ }
+ comboBox.revalidate();
+ }
+ else
+ comboBox.getEditor().setItem(comboBox.getSelectedItem());
+ }
+
+ /**
+ * This method paints background of part of the combo box, where currently
+ * selected value is displayed. If the combo box has focus this method
+ * should also paint focus rectangle around the combo box.
+ *
+ * @param g graphics context
+ * @param bounds Rectangle representing the size of the largest item in the
+ * comboBox
+ * @param hasFocus true if combo box has fox and false otherwise
+ */
+ public void paintCurrentValueBackground(Graphics g, Rectangle bounds,
+ boolean hasFocus)
+ {
+ // background is painted by renderer, so it seems that nothing
+ // should be done here.
+ }
+
+ /**
+ * Returns default size for the combo box that doesn't contain any elements
+ * in it
+ *
+ * @return Default size of the combo box with no elements in it.
+ */
+ protected Dimension getDefaultSize()
+ {
+ return new Dimension(6, 17);
+ }
+
+ /**
+ * Returns size of the largest item in the combo box. This size will be the
+ * size of the combo box, not including the arrowButton.
+ *
+ * @return dimensions of the largest item in the combo box.
+ */
+ protected Dimension getLargestItemSize()
+ {
+ ComboBoxModel model = comboBox.getModel();
+ int numItems = model.getSize();
+
+ // if combo box doesn't have any items then simply
+ // return its default size
+ if (numItems == 0)
+ {
+ largestItemSize = getDefaultSize();
+ return largestItemSize;
+ }
+
+ Dimension size = new Dimension(0, 0);
+
+ // ComboBox's display size should be equal to the
+ // size of the largest item in the combo box.
+ ListCellRenderer renderer = comboBox.getRenderer();
+
+ for (int i = 0; i < numItems; i++)
+ {
+ Object item = model.getElementAt(i);
+ String s = item.toString();
+ Component comp = renderer.getListCellRendererComponent(listBox, item,
+ -1, false, false);
+
+ if (comp.getPreferredSize().getWidth() > size.getWidth())
+ size = comp.getPreferredSize();
+ }
+
+ largestItemSize = size;
+ return largestItemSize;
+ }
+
+ /**
+ * This method installs the keyboard actions for the JComboBox as specified
+ * by the look and feel.
+ */
+ protected void installKeyboardActions()
+ {
+ // FIXME: Need to implement.
+ }
+
+ /**
+ * This method uninstalls the keyboard actions for the JComboBox there were
+ * installed by in {@link #installListeners}.
+ */
+ protected void uninstallKeyboardActions()
+ {
+ // FIXME: Need to implement.
+ }
+
+ /**
+ * This class is Layout Manager for this combo box.
+ */
+ public class ComboBoxLayoutManager extends Object implements LayoutManager
+ {
+ /**
+ * Creates a new ComboBoxLayoutManager object.
+ */
+ public ComboBoxLayoutManager()
+ {
+ }
+
+ public void addLayoutComponent(String name, Component comp)
+ {
+ // Do nothing
+ }
+
+ public void removeLayoutComponent(Component comp)
+ {
+ // Do nothing
+ }
+
+ /**
+ * Returns preferred layout size of the JComboBox.
+ *
+ * @param parent Container for which preferred size should be calculated
+ *
+ * @return preferred size for the given container
+ */
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ Dimension d = new Dimension(0, 0);
+
+ if (largestItemSize == null)
+ largestItemSize = getLargestItemSize();
+
+ // add size for the area that will display selected item
+ d.width += largestItemSize.getWidth();
+ d.height += largestItemSize.getHeight();
+
+ // add size of the arrow button
+ d.width += arrowButtonWidth;
+
+ // add width and height of the border
+ d.width += borderInsets.left + borderInsets.right;
+ d.height += borderInsets.left + borderInsets.right;
+
+ // Add combo box's insets
+ Insets insets = parent.getInsets();
+ d.width += insets.left + insets.right;
+ d.width += insets.left + insets.right;
+
+ return d;
+ }
+
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ return preferredLayoutSize(parent);
+ }
+
+ /**
+ * This method layouts out the components in the container. It puts arrow
+ * button right end part of the comboBox. If the comboBox is editable
+ * then editor is placed to the left of arrow button, starting from the
+ * beginning.
+ *
+ * @param parent Container that should be layed out.
+ */
+ public void layoutContainer(Container parent)
+ {
+ // Position editor component to the left of arrow button if combo box is
+ // editable
+ int editorWidth = comboBox.getBounds().width - arrowButtonWidth - 2;
+
+ if (comboBox.isEditable())
+ editor.setBounds(borderInsets.left, borderInsets.top, editorWidth,
+ comboBox.getBounds().height - borderInsets.left
+ - borderInsets.top);
+
+ arrowButton.setBounds(editorWidth, 2, arrowButtonWidth,
+ comboBox.getBounds().height - 4);
+ comboBox.revalidate();
+ }
+ }
+
+ /**
+ * This class handles focus changes occuring in the combo box. This class is
+ * responsible for repainting combo box whenever focus is gained or lost
+ * and also for hiding popup list of items whenever combo box loses its
+ * focus.
+ */
+ public class FocusHandler extends Object implements FocusListener
+ {
+ /**
+ * Creates a new FocusHandler object.
+ */
+ public FocusHandler()
+ {
+ }
+
+ /**
+ * This mehtod is invoked when combo box gains focus. It repaints main
+ * part of combo box accordingally.
+ *
+ * @param e the FocusEvent
+ */
+ public void focusGained(FocusEvent e)
+ {
+ hasFocus = true;
+ comboBox.repaint();
+ }
+
+ /**
+ * This method is invoked when combo box loses focus It repaint main part
+ * of combo box accordingally and hides popup list of items.
+ *
+ * @param e the FocusEvent
+ */
+ public void focusLost(FocusEvent e)
+ {
+ hasFocus = false;
+ comboBox.repaint();
+ popup.hide();
+ }
+ }
+
+ /**
+ * This class handles ItemEvent fired by the JComboBox when its selected
+ * item changes.
+ */
+ public class ItemHandler extends Object implements ItemListener
+ {
+ /**
+ * Creates a new ItemHandler object.
+ */
+ public ItemHandler()
+ {
+ }
+
+ /**
+ * This method is invoked when selected item becomes deselected or when
+ * new item becomes selected.
+ *
+ * @param e the ItemEvent representing item's state change.
+ */
+ public void itemStateChanged(ItemEvent e)
+ {
+ comboBox.repaint();
+ }
+ }
+
+ /**
+ * KeyHandler handles key events occuring while JComboBox has focus.
+ */
+ public class KeyHandler extends KeyAdapter
+ {
+ public KeyHandler()
+ {
+ }
+
+ /*
+ * This method is invoked whenever key is pressed while JComboBox is in
+ * focus.
+ */
+ public void keyPressed(KeyEvent e)
+ {
+ // FIXME: This method calls JComboBox.selectWithKeyChar if the key that was
+ // pressed is not a navigation key.
+ }
+ }
+
+ /**
+ * This class handles to the changes occuring in the JComboBox's data model
+ */
+ public class ListDataHandler extends Object implements ListDataListener
+ {
+ /**
+ * Creates a new ListDataHandler object.
+ */
+ public ListDataHandler()
+ {
+ }
+
+ /**
+ * This method is invoked content's of JComboBox's data model are changed
+ *
+ * @param e ListDataEvent describing the change.
+ */
+ public void contentsChanged(ListDataEvent e)
+ {
+ // if the item is selected or deselected
+ }
+
+ /**
+ * This method is invoked when items were added to the JComboBox's data
+ * model.
+ *
+ * @param e ListDataEvent describing the change.
+ */
+ public void intervalAdded(ListDataEvent e)
+ {
+ // must determine if the size of the combo box should change
+ int start = e.getIndex0();
+ int end = e.getIndex1();
+
+ ComboBoxModel model = comboBox.getModel();
+ ListCellRenderer renderer = comboBox.getRenderer();
+
+ if (largestItemSize == null)
+ largestItemSize = new Dimension(0, 0);
+
+ for (int i = start - 1; i < end; i++)
+ {
+ Object item = model.getElementAt(i);
+ Component comp = renderer.getListCellRendererComponent(new JList(),
+ item, -1,
+ false, false);
+ if (comp.getPreferredSize().getWidth() > largestItemSize.getWidth())
+ largestItemSize = comp.getPreferredSize();
+ }
+ }
+
+ /**
+ * This method is invoked when items were removed from the JComboBox's
+ * data model.
+ *
+ * @param e ListDataEvent describing the change.
+ */
+ public void intervalRemoved(ListDataEvent e)
+ {
+ // recalculate display size of the JComboBox.
+ largestItemSize = getLargestItemSize();
+ comboBox.repaint();
+ }
+ }
+
+ /**
+ * This class handles PropertyChangeEvents fired by JComboBox.
+ */
+ public class PropertyChangeHandler extends Object
+ implements PropertyChangeListener
+ {
+ public PropertyChangeHandler()
+ {
+ }
+
+ /**
+ * This method is invoked whenever bound property of JComboBox changes.
+ */
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(JComboBox.ENABLED_CHANGED_PROPERTY))
+ {
+ arrowButton.setEnabled(comboBox.isEnabled());
+
+ if (comboBox.isEditable())
+ comboBox.getEditor().getEditorComponent().setEnabled(comboBox
+ .isEnabled());
+ }
+ else if (e.getPropertyName().equals(JComboBox.EDITABLE_CHANGED_PROPERTY))
+ {
+ if (comboBox.isEditable())
+ {
+ configureEditor();
+ addEditor();
+ }
+ else
+ {
+ unconfigureEditor();
+ removeEditor();
+ }
+
+ comboBox.revalidate();
+ comboBox.repaint();
+ }
+ else if (e.getPropertyName().equals(JComboBox.MODEL_CHANGED_PROPERTY))
+ {
+ // remove ListDataListener from old model and add it to new model
+ ComboBoxModel oldModel = (ComboBoxModel) e.getOldValue();
+ if (oldModel != null)
+ oldModel.removeListDataListener(listDataListener);
+
+ if ((ComboBoxModel) e.getNewValue() != null)
+ comboBox.getModel().addListDataListener(listDataListener);
+ }
+
+ // FIXME: Need to handle changes in other bound properties.
+ }
+ }
+
+ /**
+ * MouseHandler listens to mouse events occuring in the combo box. This
+ * class is responsible for repainting this JComboBox whenever the mouse is
+ * being pressed or released over it.
+ */
+ private class MouseHandler extends MouseAdapter
+ {
+ /**
+ * This method is invoked when mouse is pressed over the combo box. It
+ * repaints the combo box accordinglly
+ *
+ * @param e the MouseEvent
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ if (comboBox.isEnabled())
+ {
+ if (e.getSource() instanceof JComboBox)
+ {
+ arrowButton.getModel().setPressed(true);
+ arrowButton.getModel().setArmed(true);
+ }
+
+ comboBox.repaint();
+
+ if (e.getSource() instanceof BasicArrowButton)
+ toggleOpenClose();
+ }
+ }
+
+ /**
+ * This method is invoked when mouse is released over the combo box. It
+ * repaints the combo box accordinglly
+ *
+ * @param e the MouseEvent
+ */
+ public void mouseReleased(MouseEvent e)
+ {
+ if (comboBox.isEnabled())
+ {
+ if (e.getSource() instanceof JComboBox)
+ {
+ arrowButton.getModel().setPressed(false);
+ arrowButton.getModel().setArmed(false);
+ }
+
+ comboBox.repaint();
+ }
+ }
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicComboPopup.java b/javax/swing/plaf/basic/BasicComboPopup.java
new file mode 100644
index 000000000..d00979fb4
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicComboPopup.java
@@ -0,0 +1,946 @@
+/* BasicComboPopup.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Rectangle;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.awt.event.KeyAdapter;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionAdapter;
+import java.awt.event.MouseMotionListener;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.ComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.ListCellRenderer;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingConstants;
+import javax.swing.Timer;
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.PopupMenuEvent;
+import javax.swing.event.PopupMenuListener;
+
+
+/**
+ * UI Delegate for ComboPopup
+ *
+ * @author Olga Rodimina
+ */
+public class BasicComboPopup extends JPopupMenu implements ComboPopup
+{
+ protected Timer autoscrollTimer;
+
+ /**
+ * ComboBox associated with this popup
+ */
+ protected JComboBox comboBox;
+
+ /*
+ * FIXME: Document fields below
+ */
+ protected boolean hasEntered;
+ protected boolean isAutoScrolling;
+
+ /**
+ * ItemListener listening to the selection changes in the combo box
+ */
+ protected ItemListener itemListener;
+
+ /**
+ * This listener is not used
+ */
+ protected KeyListener keyListener;
+
+ /**
+ * JList which is used to display item is the combo box
+ */
+ protected JList list;
+
+ /**
+ * This listener is not used
+ */
+ protected ListDataListener listDataListener;
+
+ /**
+ * MouseListener listening to mouse events occuring in the combo box's
+ * list.
+ */
+ protected MouseListener listMouseListener;
+
+ /**
+ * MouseMotionListener listening to mouse motion events occuring in the
+ * combo box's list
+ */
+ protected MouseMotionListener listMouseMotionListener;
+
+ /**
+ * This listener is not used
+ */
+ protected ListSelectionListener listSelectionListener;
+
+ /**
+ * MouseListener listening to mouse events occuring in the combo box
+ */
+ protected MouseListener mouseListener;
+
+ /**
+ * MouseMotionListener listening to mouse motion events occuring in the
+ * combo box
+ */
+ protected MouseMotionListener mouseMotionListener;
+
+ /**
+ * PropertyChangeListener listening to changes occuring in the bound
+ * properties of the combo box
+ */
+ protected PropertyChangeListener propertyChangeListener;
+
+ /*
+ * FIXME: Document fields below
+ */
+ protected static int SCROLL_DOWN = 1;
+ protected static int SCROLL_UP = 0;
+ protected int scrollDirection;
+
+ /**
+ * JScrollPane that contains list portion of the combo box
+ */
+ protected JScrollPane scroller;
+
+ /**
+ * This field is not used
+ */
+ protected boolean valueIsAdjusting;
+
+ /**
+ * Creates a new BasicComboPopup object.
+ *
+ * @param comboBox the combo box with which this popup should be associated
+ */
+ public BasicComboPopup(JComboBox comboBox)
+ {
+ this.comboBox = comboBox;
+ installComboBoxListeners();
+ configurePopup();
+ setLightWeightPopupEnabled(comboBox.isLightWeightPopupEnabled());
+ }
+
+ /**
+ * This method displays drow down list of combo box items on the screen.
+ */
+ public void show()
+ {
+ Rectangle cbBounds = comboBox.getBounds();
+
+ // popup should have same width as the comboBox and should be hight anough
+ // to display number of rows equal to 'maximumRowCount' property
+ int popupHeight = getPopupHeightForRowCount(comboBox.getMaximumRowCount())
+ + 4;
+
+ // FIXME: Uncomment this out once preferred size of JList will be working
+ // list.setPreferredSize(new Dimension(cbBounds.width, popupHeight));
+ super.setPopupSize(cbBounds.width, popupHeight);
+
+ // location specified is relative to comboBox
+ super.show(comboBox, 0, cbBounds.height);
+ }
+
+ /**
+ * This method hides drop down list of items
+ */
+ public void hide()
+ {
+ super.setVisible(false);
+ }
+
+ /**
+ * Return list cointaining JComboBox's items
+ *
+ * @return list cointaining JComboBox's items
+ */
+ public JList getList()
+ {
+ return list;
+ }
+
+ /**
+ * Returns MouseListener that is listening to mouse events occuring in the
+ * combo box.
+ *
+ * @return MouseListener
+ */
+ public MouseListener getMouseListener()
+ {
+ return mouseListener;
+ }
+
+ /**
+ * Returns MouseMotionListener that is listening to mouse motion events
+ * occuring in the combo box.
+ *
+ * @return MouseMotionListener
+ */
+ public MouseMotionListener getMouseMotionListener()
+ {
+ return mouseMotionListener;
+ }
+
+ /**
+ * Returns KeyListener listening to key events occuring in the combo box.
+ * This method returns null because KeyHandler is not longer used.
+ *
+ * @return KeyListener
+ */
+ public KeyListener getKeyListener()
+ {
+ return keyListener;
+ }
+
+ /**
+ * This method uninstalls the UI for the given JComponent.
+ */
+ public void uninstallingUI()
+ {
+ uninstallComboBoxModelListeners(comboBox.getModel());
+
+ uninstallListeners();
+ uninstallKeyboardActions();
+ }
+
+ /**
+ * This method uninstalls listeners that were listening to changes occuring
+ * in the comb box's data model
+ *
+ * @param model data model for the combo box from which to uninstall
+ * listeners
+ */
+ protected void uninstallComboBoxModelListeners(ComboBoxModel model)
+ {
+ model.removeListDataListener(listDataListener);
+ }
+
+ /**
+ * This method uninstalls keyboard actions installed by the UI.
+ */
+ protected void uninstallKeyboardActions()
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method fires PopupMenuEvent indicating that combo box's popup list
+ * of items will become visible
+ */
+ protected void firePopupMenuWillBecomeVisible()
+ {
+ PopupMenuListener[] ll = comboBox.getPopupMenuListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].popupMenuWillBecomeVisible(new PopupMenuEvent(comboBox));
+ }
+
+ /**
+ * This method fires PopupMenuEvent indicating that combo box's popup list
+ * of items will become invisible.
+ */
+ protected void firePopupMenuWillBecomeInvisible()
+ {
+ PopupMenuListener[] ll = comboBox.getPopupMenuListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].popupMenuWillBecomeInvisible(new PopupMenuEvent(comboBox));
+ }
+
+ /**
+ * This method fires PopupMenuEvent indicating that combo box's popup list
+ * of items was closed without selection.
+ */
+ protected void firePopupMenuCanceled()
+ {
+ PopupMenuListener[] ll = comboBox.getPopupMenuListeners();
+
+ for (int i = 0; i < ll.length; i++)
+ ll[i].popupMenuCanceled(new PopupMenuEvent(comboBox));
+ }
+
+ /**
+ * Creates MouseListener to listen to mouse events occuring in the combo
+ * box. Note that this listener doesn't listen to mouse events occuring in
+ * the popup portion of the combo box, it only listens to main combo box
+ * part.
+ *
+ * @return new MouseMotionListener that listens to mouse events occuring in
+ * the combo box
+ */
+ protected MouseListener createMouseListener()
+ {
+ return new InvocationMouseHandler();
+ }
+
+ /**
+ * Create Mouse listener that listens to mouse dragging events occuring in
+ * the combo box. This listener is responsible for changing the selection
+ * in the combo box list to the component over which mouse is being
+ * currently dragged
+ *
+ * @return new MouseMotionListener that listens to mouse dragging events
+ * occuring in the combo box
+ */
+ protected MouseMotionListener createMouseMotionListener()
+ {
+ return new InvocationMouseMotionHandler();
+ }
+
+ /**
+ * KeyListener created in this method is not used anymore.
+ *
+ * @return KeyListener that does nothing
+ */
+ protected KeyListener createKeyListener()
+ {
+ return new InvocationKeyHandler();
+ }
+
+ /**
+ * ListSelectionListener created in this method is not used anymore
+ *
+ * @return ListSelectionListener that does nothing
+ */
+ protected ListSelectionListener createListSelectionListener()
+ {
+ return new ListSelectionHandler();
+ }
+
+ /**
+ * Creates ListDataListener. This method returns null, because
+ * ListDataHandler class is obsolete and is no longer used.
+ *
+ * @return null
+ */
+ protected ListDataListener createListDataListener()
+ {
+ return null;
+ }
+
+ /**
+ * This method creates ListMouseListener to listen to mouse events occuring
+ * in the combo box's item list.
+ *
+ * @return MouseListener to listen to mouse events occuring in the combo
+ * box's items list.
+ */
+ protected MouseListener createListMouseListener()
+ {
+ return new ListMouseHandler();
+ }
+
+ /**
+ * Creates ListMouseMotionlistener to listen to mouse motion events occuring
+ * in the combo box's list. This listener is responsible for highlighting
+ * items in the list when mouse is moved over them.
+ *
+ * @return MouseMotionListener that handles mouse motion events occuring in
+ * the list of the combo box.
+ */
+ protected MouseMotionListener createListMouseMotionListener()
+ {
+ return new ListMouseMotionHandler();
+ }
+
+ /**
+ * Creates PropertyChangeListener to handle changes in the JComboBox's bound
+ * properties.
+ *
+ * @return PropertyChangeListener to handle changes in the JComboBox's bound
+ * properties.
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeHandler();
+ }
+
+ /**
+ * Creates new ItemListener that will listen to ItemEvents occuring in the
+ * combo box.
+ *
+ * @return ItemListener to listen to ItemEvents occuring in the combo box.
+ */
+ protected ItemListener createItemListener()
+ {
+ return new ItemHandler();
+ }
+
+ /**
+ * Creates JList that will be used to display items in the combo box.
+ *
+ * @return JList that will be used to display items in the combo box.
+ */
+ protected JList createList()
+ {
+ JList l = new JList(comboBox.getModel());
+ l.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
+ return l;
+ }
+
+ /**
+ * This method configures the list of comboBox's items by setting default
+ * properties and installing listeners.
+ */
+ protected void configureList()
+ {
+ list.setModel(comboBox.getModel());
+ list.setVisibleRowCount(comboBox.getMaximumRowCount());
+ installListListeners();
+ }
+
+ /**
+ * This method installs list listeners.
+ */
+ protected void installListListeners()
+ {
+ // mouse listener listening to mouse events occuring in the
+ // combo box's list of items.
+ listMouseListener = createListMouseListener();
+ list.addMouseListener(listMouseListener);
+
+ // mouse listener listening to mouse motion events occuring in the
+ // combo box's list of items
+ listMouseMotionListener = createListMouseMotionListener();
+ list.addMouseMotionListener(listMouseMotionListener);
+
+ listSelectionListener = createListSelectionListener();
+ list.addListSelectionListener(listSelectionListener);
+ }
+
+ /**
+ * This method creates scroll pane that will contain the list of comboBox's
+ * items inside of it.
+ *
+ * @return JScrollPane
+ */
+ protected JScrollPane createScroller()
+ {
+ return new JScrollPane();
+ }
+
+ /**
+ * This method configures scroll pane to contain list of comboBox's items
+ */
+ protected void configureScroller()
+ {
+ scroller.getViewport().setView(list);
+ scroller.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ }
+
+ /**
+ * This method configures popup menu that will be used to display Scrollpane
+ * with list of items inside of it.
+ */
+ protected void configurePopup()
+ {
+ // initialize list that will be used to display combo box's items
+ this.list = createList();
+ ((JLabel) list.getCellRenderer()).setHorizontalAlignment(SwingConstants.LEFT);
+ configureList();
+
+ // initialize scroller. Add list to the scroller.
+ scroller = createScroller();
+ configureScroller();
+
+ // add scroller with list inside of it to JPopupMenu
+ super.add(scroller);
+ }
+
+ /*
+ * This method installs listeners that will listen to changes occuring
+ * in the combo box.
+ */
+ protected void installComboBoxListeners()
+ {
+ // mouse listener that listens to mouse event in combo box
+ mouseListener = createMouseListener();
+ comboBox.addMouseListener(mouseListener);
+
+ // mouse listener that listens to mouse dragging events in the combo box
+ mouseMotionListener = createMouseMotionListener();
+ comboBox.addMouseMotionListener(mouseMotionListener);
+
+ // item listener listenening to selection events in the combo box
+ itemListener = createItemListener();
+ comboBox.addItemListener(itemListener);
+
+ propertyChangeListener = createPropertyChangeListener();
+ comboBox.addPropertyChangeListener(propertyChangeListener);
+ }
+
+ /**
+ * This method installs listeners that will listen to changes occuring in
+ * the comb box's data model
+ *
+ * @param model data model for the combo box for which to install listeners
+ */
+ protected void installComboBoxModelListeners(ComboBoxModel model)
+ {
+ // list data listener to listen for ListDataEvents in combo box.
+ // This listener is now obsolete and nothing is done here
+ listDataListener = createListDataListener();
+ comboBox.getModel().addListDataListener(listDataListener);
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ protected void installKeyboardActions()
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method always returns false to indicate that items in the combo box
+ * list are not focus traversable.
+ *
+ * @return false
+ */
+ public boolean isFocusTraversable()
+ {
+ return false;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param direction DOCUMENT ME!
+ */
+ protected void startAutoScrolling(int direction)
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ protected void stopAutoScrolling()
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ protected void autoScrollUp()
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * DOCUMENT ME!
+ */
+ protected void autoScrollDown()
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method helps to delegate focus to the right component in the
+ * JComboBox. If the comboBox is editable then focus is sent to
+ * ComboBoxEditor, otherwise it is delegated to JComboBox.
+ *
+ * @param e MouseEvent
+ */
+ protected void delegateFocus(MouseEvent e)
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * This method displays combo box popup if the popup is not currently shown
+ * on the screen and hides it if it is currently visible
+ */
+ protected void togglePopup()
+ {
+ if (BasicComboPopup.this.isVisible())
+ hide();
+ else
+ show();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param e DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ protected MouseEvent convertMouseEvent(MouseEvent e)
+ {
+ return null;
+ }
+
+ /**
+ * Returns required height of the popup such that number of items visible in
+ * it are equal to the maximum row count. By default
+ * comboBox.maximumRowCount=8
+ *
+ * @param maxRowCount number of maximum visible rows in the combo box's
+ * popup list of items
+ *
+ * @return height of the popup required to fit number of items equal to
+ * JComboBox.maximumRowCount.
+ */
+ protected int getPopupHeightForRowCount(int maxRowCount)
+ {
+ int totalHeight = 0;
+ ListCellRenderer rend = list.getCellRenderer();
+
+ if (comboBox.getItemCount() < maxRowCount)
+ maxRowCount = comboBox.getItemCount();
+
+ for (int i = 0; i < maxRowCount; i++)
+ {
+ Component comp = rend.getListCellRendererComponent(list,
+ comboBox.getModel()
+ .getElementAt(i),
+ -1, false, false);
+ Dimension dim = comp.getPreferredSize();
+ totalHeight += dim.height;
+ }
+
+ return totalHeight;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param px DOCUMENT ME!
+ * @param py DOCUMENT ME!
+ * @param pw DOCUMENT ME!
+ * @param ph DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ protected Rectangle computePopupBounds(int px, int py, int pw, int ph)
+ {
+ return new Rectangle(px, py, pw, ph);
+ }
+
+ /**
+ * This method changes the selection in the list to the item over which the
+ * mouse is currently located.
+ *
+ * @param anEvent MouseEvent
+ * @param shouldScroll DOCUMENT ME!
+ */
+ protected void updateListBoxSelectionForEvent(MouseEvent anEvent,
+ boolean shouldScroll)
+ {
+ // FIXME: Need to implement
+ }
+
+ /**
+ * InvocationMouseHandler is a listener that listens to mouse events
+ * occuring in the combo box. Note that this listener doesn't listen to
+ * mouse events occuring in the popup portion of the combo box, it only
+ * listens to main combo box part(area that displays selected item). This
+ * listener is responsible for showing and hiding popup portion of the
+ * combo box.
+ */
+ protected class InvocationMouseHandler extends MouseAdapter
+ {
+ /**
+ * Creates a new InvocationMouseHandler object.
+ */
+ protected InvocationMouseHandler()
+ {
+ }
+
+ /**
+ * This method is invoked whenever mouse is being pressed over the main
+ * part of the combo box. This method will show popup if the popup is
+ * not shown on the screen right now, and it will hide popup otherwise.
+ *
+ * @param e MouseEvent that should be handled
+ */
+ public void mousePressed(MouseEvent e)
+ {
+ if (comboBox.isEnabled())
+ togglePopup();
+ }
+
+ /**
+ * This method is invoked whenever mouse is released
+ *
+ * @param e MouseEvent that should be handled
+ */
+ public void mouseReleased(MouseEvent e)
+ {
+ // FIXME: should handle dragging events here, if
+ // mouse was dragged and released over the list of combobox's items,
+ // then item over which it was released should be selected.
+ }
+ }
+
+ /**
+ * InvocationMouseMotionListener is a mouse listener that listens to mouse
+ * dragging events occuring in the combo box.
+ */
+ protected class InvocationMouseMotionHandler extends MouseMotionAdapter
+ {
+ /**
+ * Creates a new InvocationMouseMotionHandler object.
+ */
+ protected InvocationMouseMotionHandler()
+ {
+ }
+
+ public void mouseDragged(MouseEvent e)
+ {
+ }
+ }
+
+ /**
+ * ItemHandler is an item listener that listens to selection event occuring
+ * in the combo box. FIXME: should specify here what it does when item is
+ * selected or deselected in the combo box list.
+ */
+ protected class ItemHandler extends Object implements ItemListener
+ {
+ /**
+ * Creates a new ItemHandler object.
+ */
+ protected ItemHandler()
+ {
+ }
+
+ /**
+ * This method responds to the selection events occuring in the combo box.
+ *
+ * @param e ItemEvent specifying the combo box's selection
+ */
+ public void itemStateChanged(ItemEvent e)
+ {
+ }
+ }
+
+ /**
+ * ListMouseHandler is a listener that listens to mouse events occuring in
+ * the combo box's list of items. This class is responsible for hiding
+ * popup portion of the combo box if the mouse is released inside the combo
+ * box's list.
+ */
+ protected class ListMouseHandler extends MouseAdapter
+ {
+ protected ListMouseHandler()
+ {
+ }
+
+ public void mousePressed(MouseEvent e)
+ {
+ }
+
+ public void mouseReleased(MouseEvent anEvent)
+ {
+ int index = list.locationToIndex(anEvent.getPoint());
+ comboBox.setSelectedIndex(index);
+ hide();
+ }
+ }
+
+ /**
+ * ListMouseMotionHandler listens to mouse motion events occuring in the
+ * combo box's list. This class is responsible for highlighting items in
+ * the list when mouse is moved over them
+ */
+ protected class ListMouseMotionHandler extends MouseMotionAdapter
+ {
+ protected ListMouseMotionHandler()
+ {
+ }
+
+ public void mouseMoved(MouseEvent anEvent)
+ {
+ // Highlight list cells over which the mouse is located.
+ // This changes list model, but has no effect on combo box's data model
+ int index = list.locationToIndex(anEvent.getPoint());
+ list.setSelectedIndex(index);
+ list.repaint();
+ }
+ }
+
+ /**
+ * This class listens to changes occuring in the bound properties of the
+ * combo box
+ */
+ protected class PropertyChangeHandler extends Object
+ implements PropertyChangeListener
+ {
+ protected PropertyChangeHandler()
+ {
+ }
+
+ public void propertyChange(PropertyChangeEvent e)
+ {
+ if (e.getPropertyName().equals(JComboBox.RENDERER_CHANGED_PROPERTY))
+ {
+ list.setCellRenderer((ListCellRenderer) e.getNewValue());
+ revalidate();
+ repaint();
+ }
+ if (e.getPropertyName().equals(JComboBox.MODEL_CHANGED_PROPERTY))
+ {
+ list.setModel((ComboBoxModel) e.getNewValue());
+ revalidate();
+ repaint();
+ }
+ }
+ }
+
+ // ------ private helper methods --------------------
+
+ /**
+ * This method uninstalls listeners installed by the UI
+ */
+ private void uninstallListeners()
+ {
+ uninstallListListeners();
+ uninstallComboBoxListeners();
+ uninstallComboBoxModelListeners(comboBox.getModel());
+ }
+
+ /**
+ * This method uninstalls Listeners registered with combo boxes list of
+ * items
+ */
+ private void uninstallListListeners()
+ {
+ list.removeMouseListener(listMouseListener);
+ listMouseListener = null;
+
+ list.removeMouseMotionListener(listMouseMotionListener);
+ listMouseMotionListener = null;
+ }
+
+ /**
+ * This method uninstalls listeners listening to combo box associated with
+ * this popup menu
+ */
+ private void uninstallComboBoxListeners()
+ {
+ comboBox.removeMouseListener(mouseListener);
+ mouseListener = null;
+
+ comboBox.removeMouseMotionListener(mouseMotionListener);
+ mouseMotionListener = null;
+
+ comboBox.removeItemListener(itemListener);
+ itemListener = null;
+
+ comboBox.removePropertyChangeListener(propertyChangeListener);
+ propertyChangeListener = null;
+ }
+
+ // --------------------------------------------------------------------
+ // The following classes are here only for backwards API compatibility
+ // They aren't used.
+ // --------------------------------------------------------------------
+
+ /**
+ * This class is not used any more.
+ */
+ public class ListDataHandler extends Object implements ListDataListener
+ {
+ public ListDataHandler()
+ {
+ }
+
+ public void contentsChanged(ListDataEvent e)
+ {
+ }
+
+ public void intervalAdded(ListDataEvent e)
+ {
+ }
+
+ public void intervalRemoved(ListDataEvent e)
+ {
+ }
+ }
+
+ /**
+ * This class is not used anymore
+ */
+ protected class ListSelectionHandler extends Object
+ implements ListSelectionListener
+ {
+ protected ListSelectionHandler()
+ {
+ }
+
+ public void valueChanged(ListSelectionEvent e)
+ {
+ }
+ }
+
+ /**
+ * This class is not used anymore
+ */
+ public class InvocationKeyHandler extends KeyAdapter
+ {
+ public InvocationKeyHandler()
+ {
+ }
+
+ public void keyReleased(KeyEvent e)
+ {
+ }
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java b/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
new file mode 100644
index 000000000..c61dc40a5
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicFormattedTextFieldUI.java
@@ -0,0 +1,62 @@
+/* BasicFormattedTextFieldUI.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.basic;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+
+/**
+ * @since 1.4
+ */
+public class BasicFormattedTextFieldUI extends BasicTextFieldUI
+{
+ public BasicFormattedTextFieldUI()
+ {
+ }
+
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicFormattedTextFieldUI();
+ }
+
+ protected String getPropertyPrefix()
+ {
+ return "FormattedTextField";
+ }
+} \ No newline at end of file
diff --git a/javax/swing/plaf/basic/BasicGraphicsUtils.java b/javax/swing/plaf/basic/BasicGraphicsUtils.java
index 0645a373c..06e502e0e 100644
--- a/javax/swing/plaf/basic/BasicGraphicsUtils.java
+++ b/javax/swing/plaf/basic/BasicGraphicsUtils.java
@@ -1,5 +1,5 @@
/* BasicGraphicsUtils.java
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -455,7 +455,9 @@ public class BasicGraphicsUtils
drawUnderline = (underlinedIndex >= 0) && (underlinedIndex < textLength);
- if (!(g instanceof Graphics2D))
+ // XXX - FIXME we now always use this fall-back since TextLayout is
+ // almost completely not implemented.
+ if (!(g instanceof Graphics2D) || true)
{
/* Fall-back. This is likely to produce garbage for any text
* containing right-to-left (Hebrew or Arabic) characters, even
diff --git a/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index 3b8a2a20c..7b54fdfa8 100644
--- a/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -439,22 +439,22 @@ public class BasicInternalFrameTitlePane extends JComponent
}
/** The action command for the Close action. */
- protected static String CLOSE_CMD = "Close";
+ protected static final String CLOSE_CMD = "Close";
/** The action command for the Minimize action. */
- protected static String ICONIFY_CMD = "Minimize";
+ protected static final String ICONIFY_CMD = "Minimize";
/** The action command for the Maximize action. */
- protected static String MAXIMIZE_CMD = "Maximize";
+ protected static final String MAXIMIZE_CMD = "Maximize";
/** The action command for the Move action. */
- protected static String MOVE_CMD = "Move";
+ protected static final String MOVE_CMD = "Move";
/** The action command for the Restore action. */
- protected static String RESTORE_CMD = "Restore";
+ protected static final String RESTORE_CMD = "Restore";
/** The action command for the Size action. */
- protected static String SIZE_CMD = "Size";
+ protected static final String SIZE_CMD = "Size";
/** The action associated with closing the JInternalFrame. */
protected Action closeAction;
diff --git a/javax/swing/plaf/basic/BasicLookAndFeel.java b/javax/swing/plaf/basic/BasicLookAndFeel.java
index 154d7ed4d..689cd8f57 100644
--- a/javax/swing/plaf/basic/BasicLookAndFeel.java
+++ b/javax/swing/plaf/basic/BasicLookAndFeel.java
@@ -41,6 +41,7 @@ package javax.swing.plaf.basic;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
+import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import java.io.Serializable;
import java.util.Enumeration;
@@ -247,6 +248,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"SPACE", "pressed",
"released SPACE", "released"
}),
+ "Button.focus", midPurple,
"Button.font", new FontUIResource("Dialog", Font.PLAIN, 12),
"Button.foreground", new ColorUIResource(Color.black),
"Button.highlight", new ColorUIResource(Color.white),
@@ -821,7 +823,14 @@ public abstract class BasicLookAndFeel extends LookAndFeel
"TextField.keyBindings", new JTextComponent.KeyBinding[] {
new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,
0),
- "notify-field-accept")},
+ "notify-field-accept"),
+ new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT,
+ InputEvent.SHIFT_DOWN_MASK),
+ "selection-backward"),
+ new JTextComponent.KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT,
+ InputEvent.SHIFT_DOWN_MASK),
+ "selection-forward"),
+ },
"TextField.margin", new InsetsUIResource(0, 0, 0, 0),
"TextField.selectionBackground", new ColorUIResource(lightPurple),
"TextField.selectionForeground", new ColorUIResource(Color.black),
diff --git a/javax/swing/plaf/basic/BasicPasswordFieldUI.java b/javax/swing/plaf/basic/BasicPasswordFieldUI.java
new file mode 100644
index 000000000..0350f7437
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicPasswordFieldUI.java
@@ -0,0 +1,67 @@
+/* BasicPasswordFieldUI.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.basic;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.text.Element;
+import javax.swing.text.PasswordView;
+import javax.swing.text.View;
+
+public class BasicPasswordFieldUI extends BasicTextFieldUI
+{
+ public BasicPasswordFieldUI()
+ {
+ }
+
+ public View create(Element elem)
+ {
+ return new PasswordView(elem);
+ }
+
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicPasswordFieldUI();
+ }
+
+ protected String getPropertyPrefix()
+ {
+ return "PasswordField";
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicPopupMenuUI.java b/javax/swing/plaf/basic/BasicPopupMenuUI.java
index 46cd42292..35fb005b9 100644
--- a/javax/swing/plaf/basic/BasicPopupMenuUI.java
+++ b/javax/swing/plaf/basic/BasicPopupMenuUI.java
@@ -163,6 +163,7 @@ public class BasicPopupMenuUI extends PopupMenuUI
popupMenu.setBorder(defaults.getBorder("PopupMenu.border"));
popupMenu.setFont(defaults.getFont("PopupMenu.font"));
popupMenu.setForeground(defaults.getColor("PopupMenu.foreground"));
+ popupMenu.setOpaque(true);
}
/**
@@ -228,12 +229,12 @@ public class BasicPopupMenuUI extends PopupMenuUI
}
/**
- * This method returns the minimum size of the JPopupMenu.
- *
- * @param c The JComponent to find a size for.
- *
- * @return The minimum size.
- */
+ * This method returns the minimum size of the JPopupMenu.
+ *
+ * @param c The JComponent to find a size for.
+ *
+ * @return The minimum size.
+ */
public Dimension getMinimumSize(JComponent c)
{
return null;
@@ -264,13 +265,13 @@ public class BasicPopupMenuUI extends PopupMenuUI
}
/**
- * Return true if given mouse event is a platform popup trigger,
- * and false otherwise
+ * Return true if given mouse event is a platform popup trigger, and false
+ * otherwise
*
* @param e MouseEvent that is to be checked for popup trigger event
*
- * @return true if given mouse event is a platform popup trigger,
- * and false otherwise
+ * @return true if given mouse event is a platform popup trigger, and false
+ * otherwise
*/
public boolean isPopupTrigger(MouseEvent e)
{
@@ -334,25 +335,25 @@ public class BasicPopupMenuUI extends PopupMenuUI
path[0] = popupMenu;
Component[] comps = popupMenu.getComponents();
if (comps.length != 0 && comps[0] instanceof MenuElement)
- path[1] = (MenuElement) comps[0];
- manager.setSelectedPath(path);
+ {
+ path[1] = (MenuElement) comps[0];
+ manager.setSelectedPath(path);
+ }
}
}
}
/**
- * ComponentListener that listens to Component Events fired by the
- * top - level window to which popup menu belongs. If top-level
- * window was resized, moved or hidded then popup menu will
- * be hidded and selected path of current menu hierarchy will be set
- * to null.
- *
+ * ComponentListener that listens to Component Events fired by the top -
+ * level window to which popup menu belongs. If top-level window was
+ * resized, moved or hidded then popup menu will be hidded and selected
+ * path of current menu hierarchy will be set to null.
*/
private class TopWindowListener implements ComponentListener
{
/**
- * This method is invoked when top-level window is resized.
- * This method closes current menu hierarchy.
+ * This method is invoked when top-level window is resized. This method
+ * closes current menu hierarchy.
*
* @param e The ComponentEvent
*/
@@ -363,8 +364,8 @@ public class BasicPopupMenuUI extends PopupMenuUI
}
/**
- * This method is invoked when top-level window is moved.
- * This method closes current menu hierarchy.
+ * This method is invoked when top-level window is moved. This method
+ * closes current menu hierarchy.
*
* @param e The ComponentEvent
*/
@@ -375,8 +376,8 @@ public class BasicPopupMenuUI extends PopupMenuUI
}
/**
- * This method is invoked when top-level window is shown
- * This method does nothing by default.
+ * This method is invoked when top-level window is shown This method does
+ * nothing by default.
*
* @param e The ComponentEvent
*/
@@ -387,8 +388,8 @@ public class BasicPopupMenuUI extends PopupMenuUI
}
/**
- * This method is invoked when top-level window is hidden
- * This method closes current menu hierarchy.
+ * This method is invoked when top-level window is hidden This method
+ * closes current menu hierarchy.
*
* @param e The ComponentEvent
*/
diff --git a/javax/swing/plaf/basic/BasicScrollBarUI.java b/javax/swing/plaf/basic/BasicScrollBarUI.java
index 0bbc98774..a0ac7ce30 100644
--- a/javax/swing/plaf/basic/BasicScrollBarUI.java
+++ b/javax/swing/plaf/basic/BasicScrollBarUI.java
@@ -54,7 +54,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-
import javax.swing.BoundedRangeModel;
import javax.swing.Icon;
import javax.swing.JButton;
@@ -78,15 +77,14 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
SwingConstants
{
/**
- * A helper class that listens to the two JButtons on each end
- * of the JScrollBar.
+ * A helper class that listens to the two JButtons on each end of the
+ * JScrollBar.
*/
protected class ArrowButtonListener extends MouseAdapter
{
/**
- * Move the thumb in the direction specified by the
- * button's arrow. If this button is held down, then
- * it should keep moving the thumb.
+ * Move the thumb in the direction specified by the button's arrow. If
+ * this button is held down, then it should keep moving the thumb.
*
* @param e The MouseEvent fired by the JButton.
*/
@@ -113,8 +111,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * A helper class that listens to the ScrollBar's model
- * for ChangeEvents.
+ * A helper class that listens to the ScrollBar's model for ChangeEvents.
*/
protected class ModelListener implements ChangeListener
{
@@ -127,7 +124,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
// System.err.println(this + ".stateChanged()");
calculatePreferredSize();
- layoutContainer(scrollbar);
+ layoutContainer(scrollbar);
getThumbBounds();
scrollbar.repaint();
}
@@ -157,19 +154,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
decrButton.removeMouseListener(buttonListener);
incrButton = createIncreaseButton(scrollbar.getOrientation());
decrButton = createDecreaseButton(scrollbar.getOrientation());
- incrButton.addMouseListener(buttonListener);
- decrButton.addMouseListener(buttonListener);
- calculatePreferredSize();
- layoutContainer(scrollbar);
- }
+ incrButton.addMouseListener(buttonListener);
+ decrButton.addMouseListener(buttonListener);
+ calculatePreferredSize();
+ layoutContainer(scrollbar);
+ }
layoutContainer(scrollbar);
scrollbar.repaint();
}
}
/**
- * A helper class that listens for events from
- * the timer that is used to move the thumb.
+ * A helper class that listens for events from the timer that is used to
+ * move the thumb.
*/
protected class ScrollListener implements ActionListener
{
@@ -180,8 +177,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
private transient boolean block;
/**
- * Creates a new ScrollListener object.
- * The default is scrolling positively with block movement.
+ * Creates a new ScrollListener object. The default is scrolling
+ * positively with block movement.
*/
public ScrollListener()
{
@@ -190,8 +187,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * Creates a new ScrollListener object using
- * the given direction and block.
+ * Creates a new ScrollListener object using the given direction and
+ * block.
*
* @param dir The direction to move in.
* @param block Whether movement will be in blocks.
@@ -234,8 +231,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// Only need to check it if it's block scrolling
// We only block scroll if the click occurs
// in the track.
-
- if (!trackListener.shouldScroll(direction))
+ if (! trackListener.shouldScroll(direction))
{
trackHighlight = NO_HIGHLIGHT;
scrollbar.repaint();
@@ -260,13 +256,14 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
/** The current Y coordinate of the mouse. */
protected int currentMouseY;
- /** The offset between the current mouse cursor and the
- current value of the scrollbar. */
+ /**
+ * The offset between the current mouse cursor and the current value of
+ * the scrollbar.
+ */
protected int offset;
/**
- * This method is called when the mouse is being
- * dragged.
+ * This method is called when the mouse is being dragged.
*
* @param e The MouseEvent given.
*/
@@ -275,15 +272,15 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
currentMouseX = e.getX();
currentMouseY = e.getY();
if (scrollbar.getValueIsAdjusting())
- {
- int value;
- if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
- value = valueForXPosition(currentMouseX) - offset;
- else
- value = valueForYPosition(currentMouseY) - offset;
-
- scrollbar.setValue(value);
- }
+ {
+ int value;
+ if (scrollbar.getOrientation() == SwingConstants.HORIZONTAL)
+ value = valueForXPosition(currentMouseX) - offset;
+ else
+ value = valueForYPosition(currentMouseY) - offset;
+
+ scrollbar.setValue(value);
+ }
}
/**
@@ -298,9 +295,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method is called when the mouse is
- * pressed. When it is pressed, the thumb should
- * move in blocks towards the cursor.
+ * This method is called when the mouse is pressed. When it is pressed,
+ * the thumb should move in blocks towards the cursor.
*
* @param e The MouseEvent given.
*/
@@ -318,7 +314,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
if (value == scrollbar.getValue())
return;
- if (!thumbRect.contains(e.getPoint()))
+ if (! thumbRect.contains(e.getPoint()))
{
scrollTimer.stop();
scrollListener.setScrollByBlock(true);
@@ -344,13 +340,13 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
// to that value.
scrollbar.setValueIsAdjusting(true);
offset = value - scrollbar.getValue();
- }
- scrollbar.repaint();
+ }
+ scrollbar.repaint();
}
/**
- * This method is called when the mouse is released.
- * It should stop movement on the thumb
+ * This method is called when the mouse is released. It should stop
+ * movement on the thumb
*
* @param e The MouseEvent given.
*/
@@ -358,32 +354,32 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
{
trackHighlight = NO_HIGHLIGHT;
scrollTimer.stop();
-
+
if (scrollbar.getValueIsAdjusting())
- scrollbar.setValueIsAdjusting(false);
+ scrollbar.setValueIsAdjusting(false);
scrollbar.repaint();
}
-
+
/**
- * A helper method that decides whether we should
- * keep scrolling in the given direction.
+ * A helper method that decides whether we should keep scrolling in the
+ * given direction.
*
* @param direction The direction to check for.
*
* @return Whether the thumb should keep scrolling.
*/
- public boolean shouldScroll (int direction)
+ public boolean shouldScroll(int direction)
{
int value;
if (scrollbar.getOrientation() == HORIZONTAL)
- value = valueForXPosition(currentMouseX);
+ value = valueForXPosition(currentMouseX);
else
- value = valueForYPosition(currentMouseY);
+ value = valueForYPosition(currentMouseY);
if (direction == POSITIVE_SCROLL)
- return (value > scrollbar.getValue());
+ return (value > scrollbar.getValue());
else
- return (value < scrollbar.getValue());
+ return (value < scrollbar.getValue());
}
}
@@ -393,8 +389,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
/** The listener that listens to the model. */
protected ModelListener modelListener;
- /** The listener that listens to the scrollbar for property
- changes. */
+ /** The listener that listens to the scrollbar for property changes. */
protected PropertyChangeListener propertyChangeListener;
/** The listener that listens to the timer. */
@@ -427,8 +422,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
/** The outer light shadow for the thumb. */
protected Color thumbLightShadowColor;
- /** The color that is used when the mouse press
- occurs in the track. */
+ /** The color that is used when the mouse press occurs in the track. */
protected Color trackHighlightColor;
/** The color of the track. */
@@ -471,88 +465,6 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JScrollBar scrollbar;
/**
- * A helper class that allows us to draw icons for
- * the JButton.
- */
- private static class arrowIcon implements Icon
- {
- /** The polygon that describes the icon. */
- private Polygon arrow;
-
- /**
- * Creates a new arrowIcon object.
- *
- * @param arrow The polygon that describes the arrow.
- */
- public arrowIcon(Polygon arrow)
- {
- this.arrow = arrow;
- }
-
- /**
- * Returns the height of the icon.
- *
- * @return The height of the icon.
- */
- public int getIconHeight()
- {
- return 10;
- }
-
- /**
- * Returns the width of the icon.
- *
- * @return The width of the icon.
- */
- public int getIconWidth()
- {
- return 10;
- }
-
- /**
- * Paints the icon.
- *
- * @param c The Component to paint for.
- * @param g The Graphics object to draw with.
- * @param x The X coordinate to draw at.
- * @param y The Y coordinate to draw at.
- */
- public void paintIcon(Component c, Graphics g, int x, int y)
- {
- g.translate(x, y);
-
- Color saved = g.getColor();
-
- g.setColor(Color.BLACK);
-
- g.fillPolygon(arrow);
-
- g.setColor(saved);
- g.translate(-x, -y);
- }
- }
-
- /** The Icon that points up. */
- private static Icon upIcon = new arrowIcon(new Polygon(new int[] { 2, 5, 8 },
- new int[] { 7, 3, 7 },
- 3));
-
- /** The Icon that points down. */
- private static Icon downIcon = new arrowIcon(new Polygon(new int[] { 2, 5, 8 },
- new int[] { 3, 7, 3 },
- 3));
-
- /** The Icon that points left. */
- private static Icon leftIcon = new arrowIcon(new Polygon(new int[] { 7, 3, 7 },
- new int[] { 2, 5, 8 },
- 3));
-
- /** The Icon that points right. */
- private static Icon rightIcon = new arrowIcon(new Polygon(new int[] { 3, 7, 3},
- new int[] { 2, 5, 8},
- 3));
-
- /**
* This method adds a component to the layout.
*
* @param name The name to associate with the component that is added.
@@ -565,19 +477,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method configures the scrollbar's colors. This can be
- * done by looking up the standard colors from the Look and Feel defaults.
+ * This method configures the scrollbar's colors. This can be done by
+ * looking up the standard colors from the Look and Feel defaults.
*/
protected void configureScrollBarColors()
{
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
-
+
trackColor = defaults.getColor("ScrollBar.track");
trackHighlightColor = defaults.getColor("ScrollBar.trackHighlight");
thumbColor = defaults.getColor("ScrollBar.thumb");
thumbHighlightColor = defaults.getColor("ScrollBar.thumbHighlight");
thumbDarkShadowColor = defaults.getColor("ScrollBar.thumbDarkShadow");
- thumbLightShadowColor = defaults.getColor("ScrollBar.thumbLightShadow");
+ thumbLightShadowColor = defaults.getColor("ScrollBar.thumbLightShadow");
}
/**
@@ -590,9 +502,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
return new ArrowButtonListener();
}
- /**
- * This method creates a new JButton with the appropriate
- * icon for the orientation.
+ /**
+ * This method creates a new JButton with the appropriate icon for the
+ * orientation.
*
* @param orientation The orientation this JButton uses.
*
@@ -601,26 +513,22 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JButton createIncreaseButton(int orientation)
{
if (incrButton == null)
+ incrButton = new BasicArrowButton((orientation == SwingConstants.HORIZONTAL)
+ ? SwingConstants.EAST
+ : SwingConstants.SOUTH);
+ else
{
- incrButton = new JButton();
- incrButton.setMargin(new Insets(0,0,0,0));
- incrButton.setHorizontalAlignment(SwingConstants.CENTER);
- incrButton.setHorizontalTextPosition(SwingConstants.CENTER);
- incrButton.setVerticalAlignment(SwingConstants.CENTER);
- incrButton.setVerticalTextPosition(SwingConstants.CENTER);
+ if (orientation == SwingConstants.HORIZONTAL)
+ ((BasicArrowButton) incrButton).setDirection(SwingConstants.EAST);
+ else
+ ((BasicArrowButton) incrButton).setDirection(SwingConstants.SOUTH);
}
-
- if (orientation == SwingConstants.HORIZONTAL)
- incrButton.setIcon(rightIcon);
- else
- incrButton.setIcon(downIcon);
-
return incrButton;
}
/**
- * This method creates a new JButton with the appropriate
- * icon for the orientation.
+ * This method creates a new JButton with the appropriate icon for the
+ * orientation.
*
* @param orientation The orientation this JButton uses.
*
@@ -629,20 +537,16 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
protected JButton createDecreaseButton(int orientation)
{
if (decrButton == null)
+ decrButton = new BasicArrowButton((orientation == SwingConstants.HORIZONTAL)
+ ? SwingConstants.WEST
+ : SwingConstants.NORTH);
+ else
{
- decrButton = new JButton();
- decrButton.setMargin(new Insets(0,0,0,0));
- decrButton.setHorizontalAlignment(SwingConstants.CENTER);
- decrButton.setHorizontalTextPosition(SwingConstants.CENTER);
- decrButton.setVerticalAlignment(SwingConstants.CENTER);
- decrButton.setVerticalTextPosition(SwingConstants.CENTER);
+ if (orientation == SwingConstants.HORIZONTAL)
+ ((BasicArrowButton) decrButton).setDirection(SwingConstants.WEST);
+ else
+ ((BasicArrowButton) decrButton).setDirection(SwingConstants.NORTH);
}
-
- if (orientation == SwingConstants.HORIZONTAL)
- decrButton.setIcon(leftIcon);
- else
- decrButton.setIcon(upIcon);
-
return decrButton;
}
@@ -743,13 +647,12 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method calculates the preferred size since
- * calling getPreferredSize() returns a cached value.
+ * This method calculates the preferred size since calling
+ * getPreferredSize() returns a cached value.
*/
private void calculatePreferredSize()
{
// System.err.println(this + ".calculatePreferredSize()");
-
int height;
int width;
height = width = 0;
@@ -790,11 +693,11 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method returns a cached value of the preferredSize.
- * The only restrictions are: If the scrollbar is horizontal, the
- * height should be the maximum of the height of the JButtons and
- * the minimum width of the thumb. For vertical scrollbars, the
- * calculation is similar (swap width for height and vice versa).
+ * This method returns a cached value of the preferredSize. The only
+ * restrictions are: If the scrollbar is horizontal, the height should be
+ * the maximum of the height of the JButtons and the minimum width of the
+ * thumb. For vertical scrollbars, the calculation is similar (swap width
+ * for height and vice versa).
*
* @param c The JComponent to measure.
*
@@ -807,9 +710,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method returns the thumb's bounds based on the
- * current value of the scrollbar. This method updates the
- * cached value and returns that.
+ * This method returns the thumb's bounds based on the current value of the
+ * scrollbar. This method updates the cached value and returns that.
*
* @return The thumb bounds.
*/
@@ -821,24 +723,22 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
int extent = scrollbar.getVisibleAmount();
// System.err.println(this + ".getThumbBounds()");
-
if (max == min)
- {
- thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y;
- if (scrollbar.getOrientation() == HORIZONTAL)
{
- thumbRect.width = getMinimumThumbSize().width;
- thumbRect.height = trackRect.height;
- }
- else
- {
- thumbRect.width = trackRect.width;
- thumbRect.height = getMinimumThumbSize().height;
+ thumbRect.x = trackRect.x;
+ thumbRect.y = trackRect.y;
+ if (scrollbar.getOrientation() == HORIZONTAL)
+ {
+ thumbRect.width = getMinimumThumbSize().width;
+ thumbRect.height = trackRect.height;
+ }
+ else
+ {
+ thumbRect.width = trackRect.width;
+ thumbRect.height = getMinimumThumbSize().height;
+ }
+ return thumbRect;
}
- return thumbRect;
- }
-
if (scrollbar.getOrientation() == HORIZONTAL)
{
@@ -852,8 +752,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
else
{
thumbRect.x = trackRect.x;
- thumbRect.y = trackRect.y
- + value * trackRect.height / (max - min);
+ thumbRect.y = trackRect.y + value * trackRect.height / (max - min);
thumbRect.width = trackRect.width;
thumbRect.height = extent * trackRect.height / (max - min);
@@ -862,8 +761,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method calculates the bounds of the track. This method
- * updates the cached value and returns it.
+ * This method calculates the bounds of the track. This method updates the
+ * cached value and returns it.
*
* @return The track's bounds.
*/
@@ -889,8 +788,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs any addition Components that
- * are a part of or related to this scrollbar.
+ * This method installs any addition Components that are a part of or
+ * related to this scrollbar.
*/
protected void installComponents()
{
@@ -901,8 +800,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs the defaults for the scrollbar specified
- * by the Basic Look and Feel.
+ * This method installs the defaults for the scrollbar specified by the
+ * Basic Look and Feel.
*/
protected void installDefaults()
{
@@ -926,9 +825,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs any listeners for the scrollbar.
- * This method also installs listeners for things such as
- * the JButtons and the timer.
+ * This method installs any listeners for the scrollbar. This method also
+ * installs listeners for things such as the JButtons and the timer.
*/
protected void installListeners()
{
@@ -951,10 +849,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method installs the UI for the component.
- * This can include setting up listeners, defaults,
- * and components. This also includes initializing any data
- * objects.
+ * This method installs the UI for the component. This can include setting
+ * up listeners, defaults, and components. This also includes initializing
+ * any data objects.
*
* @param c The JComponent to install.
*/
@@ -977,7 +874,7 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
configureScrollBarColors();
calculatePreferredSize();
- layoutContainer(scrollbar);
+ layoutContainer(scrollbar);
}
}
@@ -1073,9 +970,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method is called when repainting and the mouse is
- * pressed in the track. It paints the track below the thumb
- * with the trackHighlight color.
+ * This method is called when repainting and the mouse is pressed in the
+ * track. It paints the track below the thumb with the trackHighlight
+ * color.
*
* @param g The Graphics object to paint with.
*/
@@ -1088,15 +985,15 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
g.fillRect(trackRect.x, trackRect.y, thumbRect.x - trackRect.x,
trackRect.height);
else
- g.fillRect(trackRect.x, trackRect.y, trackRect.width,
+ g.fillRect(trackRect.x, trackRect.y, trackRect.width,
thumbRect.y - trackRect.y);
g.setColor(saved);
}
/**
- * This method is called when repainting and the mouse is
- * pressed in the track. It paints the track above the thumb
- * with the trackHighlight color.
+ * This method is called when repainting and the mouse is pressed in the
+ * track. It paints the track above the thumb with the trackHighlight
+ * color.
*
* @param g The Graphics objet to paint with.
*/
@@ -1109,11 +1006,10 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
g.fillRect(thumbRect.x + thumbRect.width, trackRect.y,
trackRect.x + trackRect.width - thumbRect.x - thumbRect.width,
trackRect.height);
- else
- g.fillRect(trackRect.x, thumbRect.y + thumbRect.height,
- trackRect.width,
- trackRect.y + trackRect.height - thumbRect.y -
- thumbRect.height);
+ else
+ g.fillRect(trackRect.x, thumbRect.y + thumbRect.height, trackRect.width,
+ trackRect.y + trackRect.height - thumbRect.y
+ - thumbRect.height);
g.setColor(saved);
}
@@ -1217,25 +1113,25 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * The method scrolls the thumb by a block in the
- * direction specified.
+ * The method scrolls the thumb by a block in the direction specified.
*
* @param direction The direction to scroll.
*/
protected void scrollByBlock(int direction)
{
- scrollbar.setValue(scrollbar.getValue() + scrollbar.getBlockIncrement(direction));
+ scrollbar.setValue(scrollbar.getValue()
+ + scrollbar.getBlockIncrement(direction));
}
/**
- * The method scrolls the thumb by a unit in the
- * direction specified.
+ * The method scrolls the thumb by a unit in the direction specified.
*
* @param direction The direction to scroll.
*/
protected void scrollByUnit(int direction)
{
- scrollbar.setValue(scrollbar.getValue() + scrollbar.getUnitIncrement(direction));
+ scrollbar.setValue(scrollbar.getValue()
+ + scrollbar.getUnitIncrement(direction));
}
/**
@@ -1255,8 +1151,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any components that
- * are a part of or related to this scrollbar.
+ * This method uninstalls any components that are a part of or related to
+ * this scrollbar.
*/
protected void uninstallComponents()
{
@@ -1267,8 +1163,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any defaults that this
- * scrollbar acquired from the Basic Look and Feel defaults.
+ * This method uninstalls any defaults that this scrollbar acquired from the
+ * Basic Look and Feel defaults.
*/
protected void uninstallDefaults()
{
@@ -1278,8 +1174,8 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any keyboard
- * actions this scrollbar acquired during install.
+ * This method uninstalls any keyboard actions this scrollbar acquired
+ * during install.
*/
protected void uninstallKeyboardActions()
{
@@ -1287,22 +1183,21 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls any listeners that
- * were registered during install.
+ * This method uninstalls any listeners that were registered during install.
*/
protected void uninstallListeners()
{
scrollTimer.removeActionListener(scrollListener);
-
+
scrollbar.getModel().removeChangeListener(modelListener);
scrollbar.removePropertyChangeListener(propertyChangeListener);
-
+
decrButton.removeMouseListener(buttonListener);
incrButton.removeMouseListener(buttonListener);
-
+
scrollbar.removeMouseListener(trackListener);
scrollbar.removeMouseMotionListener(trackListener);
-
+
propertyChangeListener = null;
modelListener = null;
buttonListener = null;
@@ -1311,10 +1206,9 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
}
/**
- * This method uninstalls the UI. This includes
- * removing any defaults, listeners, and components
- * that this UI may have initialized. It also nulls
- * any instance data.
+ * This method uninstalls the UI. This includes removing any defaults,
+ * listeners, and components that this UI may have initialized. It also
+ * nulls any instance data.
*
* @param c The Component to uninstall for.
*/
@@ -1323,19 +1217,19 @@ public class BasicScrollBarUI extends ScrollBarUI implements LayoutManager,
uninstallDefaults();
uninstallListeners();
uninstallComponents();
-
+
scrollTimer = null;
-
+
thumbRect = null;
trackRect = null;
-
+
trackColor = null;
trackHighlightColor = null;
thumbColor = null;
thumbHighlightColor = null;
thumbDarkShadowColor = null;
thumbLightShadowColor = null;
-
+
scrollbar = null;
}
diff --git a/javax/swing/plaf/basic/BasicSliderUI.java b/javax/swing/plaf/basic/BasicSliderUI.java
index 196a9f168..60330ea00 100644
--- a/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/javax/swing/plaf/basic/BasicSliderUI.java
@@ -1226,6 +1226,7 @@ public class BasicSliderUI extends SliderUI
if (slider.getLabelTable() == null)
return 0;
+ Dimension pref;
for (Enumeration list = slider.getLabelTable().elements();
list.hasMoreElements();)
{
@@ -1233,8 +1234,9 @@ public class BasicSliderUI extends SliderUI
if (! (comp instanceof Component))
continue;
label = (Component) comp;
- if (label.getWidth() > widest)
- widest = label.getWidth();
+ pref = label.getPreferredSize();
+ if (pref != null && pref.width > widest)
+ widest = pref.width;
}
return widest;
}
@@ -1252,7 +1254,7 @@ public class BasicSliderUI extends SliderUI
if (slider.getLabelTable() == null)
return 0;
-
+ Dimension pref;
for (Enumeration list = slider.getLabelTable().elements();
list.hasMoreElements();)
{
@@ -1260,8 +1262,9 @@ public class BasicSliderUI extends SliderUI
if (! (comp instanceof Component))
continue;
label = (Component) comp;
- if (label.getHeight() > tallest)
- tallest = label.getHeight();
+ pref = label.getPreferredSize();
+ if (pref != null && pref.height > tallest)
+ tallest = pref.height;
}
return tallest;
}
diff --git a/javax/swing/plaf/basic/BasicSpinnerUI.java b/javax/swing/plaf/basic/BasicSpinnerUI.java
new file mode 100644
index 000000000..0f5e761d3
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicSpinnerUI.java
@@ -0,0 +1,572 @@
+/* SpinnerUI.java --
+ Copyright (C) 2003 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Insets;
+import java.awt.LayoutManager;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JSpinner;
+import javax.swing.Timer;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.SpinnerUI;
+
+
+/**
+ * DOCUMENT ME!
+ *
+ * @author Ka-Hing Cheung
+ *
+ * @see javax.swing.JSpinner
+ * @since 1.4
+ */
+public class BasicSpinnerUI extends SpinnerUI
+{
+ /**
+ * Creates a new <code>ComponentUI</code> for the specified
+ * <code>JComponent</code>
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return a ComponentUI
+ */
+ public static ComponentUI createUI(JComponent c)
+ {
+ return new BasicSpinnerUI();
+ }
+
+ /**
+ * Creates an editor component. Really, it just returns
+ * <code>JSpinner.getEditor()</code>
+ *
+ * @return a JComponent as an editor
+ *
+ * @see javax.swing.JSpinner#getEditor
+ */
+ protected JComponent createEditor()
+ {
+ return spinner.getEditor();
+ }
+
+ /**
+ * Creates a <code>LayoutManager</code> that layouts the sub components. The
+ * subcomponents are identifies by the constraint "Next", "Previous" and
+ * "Editor"
+ *
+ * @return a LayoutManager
+ *
+ * @see java.awt.LayoutManager
+ */
+ protected LayoutManager createLayout()
+ {
+ return new DefaultLayoutManager();
+ }
+
+ /**
+ * Creates the "Next" button
+ *
+ * @return the next button component
+ */
+ protected Component createNextButton()
+ {
+ JButton button = new BasicArrowButton(BasicArrowButton.NORTH);
+ return button;
+ }
+
+ /**
+ * Creates the "Previous" button
+ *
+ * @return the previous button component
+ */
+ protected Component createPreviousButton()
+ {
+ JButton button = new BasicArrowButton(BasicArrowButton.SOUTH);
+ return button;
+ }
+
+ /**
+ * Creates the <code>PropertyChangeListener</code> that will be attached by
+ * <code>installListeners</code>. It should watch for the "editor"
+ * property, when it's changed, replace the old editor with the new one,
+ * probably by calling <code>replaceEditor</code>
+ *
+ * @return a PropertyChangeListener
+ *
+ * @see #replaceEditor
+ */
+ protected PropertyChangeListener createPropertyChangeListener()
+ {
+ return new PropertyChangeListener()
+ {
+ public void propertyChange(PropertyChangeEvent evt)
+ {
+ // FIXME: Add check for enabled property change. Need to
+ // disable the buttons.
+ if ("editor".equals(evt.getPropertyName()))
+ BasicSpinnerUI.this.replaceEditor((JComponent) evt.getOldValue(),
+ (JComponent) evt.getNewValue());
+ }
+ };
+ }
+
+ /**
+ * Called by <code>installUI</code>. This should set various defaults
+ * obtained from <code>UIManager.getLookAndFeelDefaults</code>, as well as
+ * set the layout obtained from <code>createLayout</code>
+ *
+ * @see #javax.swing.UIManager#getLookAndFeelDefaults
+ * @see #createLayout
+ * @see #installUI
+ */
+ protected void installDefaults()
+ {
+ /* most of it copied from BasicLabelUI, I don't know what keys are
+ available, so someone may want to update this. Hence: TODO
+ */
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ /*
+ spinner.setForeground(defaults.getColor("Spinner.foreground"));
+ spinner.setBackground(defaults.getColor("Spinner.background"));
+ spinner.setFont(defaults.getFont("Spinner.font"));
+ spinner.setBorder(defaults.getBorder("Spinner.border"));
+ */
+ spinner.setLayout(createLayout());
+ }
+
+ /*
+ * Called by <code>installUI</code>, which basically adds the
+ * <code>PropertyChangeListener</code> created by
+ * <code>createPropertyChangeListener</code>
+ *
+ * @see #createPropertyChangeListener
+ * @see #installUI
+ */
+ protected void installListeners()
+ {
+ spinner.addPropertyChangeListener(listener);
+ }
+
+ /*
+ * Install listeners to the next button so that it increments the model
+ */
+ protected void installNextButtonListeners(Component c)
+ {
+ c.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent evt)
+ {
+ if (! spinner.isEnabled())
+ return;
+ increment();
+ timer.setInitialDelay(500);
+ timer.start();
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ timer.stop();
+ }
+
+ void increment()
+ {
+ Object next = BasicSpinnerUI.this.spinner.getNextValue();
+ if (next != null)
+ BasicSpinnerUI.this.spinner.getModel().setValue(next);
+ }
+
+ volatile boolean mouseDown = false;
+ Timer timer = new Timer(50,
+ new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ increment();
+ }
+ });
+ });
+ }
+
+ /*
+ * Install listeners to the previous button so that it decrements the model
+ */
+ protected void installPreviousButtonListeners(Component c)
+ {
+ c.addMouseListener(new MouseAdapter()
+ {
+ public void mousePressed(MouseEvent evt)
+ {
+ if (! spinner.isEnabled())
+ return;
+ decrement();
+ timer.setInitialDelay(500);
+ timer.start();
+ }
+
+ public void mouseReleased(MouseEvent evt)
+ {
+ timer.stop();
+ }
+
+ void decrement()
+ {
+ Object prev = BasicSpinnerUI.this.spinner.getPreviousValue();
+ if (prev != null)
+ BasicSpinnerUI.this.spinner.getModel().setValue(prev);
+ }
+
+ volatile boolean mouseDown = false;
+ Timer timer = new Timer(50,
+ new ActionListener()
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ decrement();
+ }
+ });
+ });
+ }
+
+ /**
+ * Install this UI to the <code>JComponent</code>, which in reality, is a
+ * <code>JSpinner</code>. Calls <code>installDefaults</code>,
+ * <code>installListeners</code>, and also adds the buttons and editor.
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @see #installDefaults
+ * @see #installListeners
+ * @see #createNextButton
+ * @see #createPreviousButton
+ * @see #createEditor
+ */
+ public void installUI(JComponent c)
+ {
+ super.installUI(c);
+
+ spinner = (JSpinner) c;
+
+ installDefaults();
+ installListeners();
+
+ Component next = createNextButton();
+ Component previous = createPreviousButton();
+
+ installNextButtonListeners(next);
+ installPreviousButtonListeners(previous);
+
+ c.add(createEditor(), "Editor");
+ c.add(next, "Next");
+ c.add(previous, "Previous");
+ }
+
+ /**
+ * Replace the old editor with the new one
+ *
+ * @param oldEditor the old editor
+ * @param newEditor the new one to replace with
+ */
+ protected void replaceEditor(JComponent oldEditor, JComponent newEditor)
+ {
+ spinner.remove(oldEditor);
+ spinner.add(newEditor);
+ }
+
+ /**
+ * The reverse of <code>installDefaults</code>. Called by
+ * <code>uninstallUI</code>
+ */
+ protected void uninstallDefaults()
+ {
+ spinner.setLayout(null);
+ }
+
+ /**
+ * The reverse of <code>installListeners</code>, called by
+ * <code>uninstallUI</code>
+ */
+ protected void uninstallListeners()
+ {
+ spinner.removePropertyChangeListener(listener);
+ }
+
+ /**
+ * Called when the current L&F is replaced with another one, should call
+ * <code>uninstallDefaults</code> and <code>uninstallListeners</code> as
+ * well as remove the next/previous buttons and the editor
+ *
+ * @param c DOCUMENT ME!
+ */
+ public void uninstallUI(JComponent c)
+ {
+ super.uninstallUI(c);
+
+ uninstallDefaults();
+ uninstallListeners();
+ c.removeAll();
+ }
+
+ /** The spinner for this UI */
+ protected JSpinner spinner;
+
+ /** DOCUMENT ME! */
+ private PropertyChangeListener listener = createPropertyChangeListener();
+
+ /**
+ * DOCUMENT ME!
+ */
+ private class DefaultLayoutManager implements LayoutManager
+ {
+ /**
+ * DOCUMENT ME!
+ *
+ * @param parent DOCUMENT ME!
+ */
+ public void layoutContainer(Container parent)
+ {
+ synchronized (parent.getTreeLock())
+ {
+ Insets i = parent.getInsets();
+ boolean l2r = parent.getComponentOrientation().isLeftToRight();
+ /*
+ -------------- --------------
+ | | n | | n | |
+ | e | - | or | - | e |
+ | | p | | p | |
+ -------------- --------------
+ */
+ Dimension e = minSize(editor);
+ Dimension n = minSize(next);
+ Dimension p = minSize(previous);
+ Dimension s = spinner.getPreferredSize();
+
+ int x = l2r ? i.left : i.right;
+ int y = i.top;
+ int w = Math.max(p.width, n.width);
+ int h = Math.max(p.height, n.height);
+ h = Math.max(h, e.height / 2);
+ int e_width = s.width - w;
+
+ if (l2r)
+ {
+ setBounds(editor, x, y + (s.height - e.height) / 2, e_width,
+ e.height);
+ x += e_width;
+
+ setBounds(next, x, y, w, h);
+ y += h;
+
+ setBounds(previous, x, y, w, h);
+ }
+ else
+ {
+ setBounds(next, x, y + (s.height - e.height) / 2, w, h);
+ y += h;
+
+ setBounds(previous, x, y, w, h);
+ x += w;
+ y -= h;
+
+ setBounds(editor, x, y, e_width, e.height);
+ }
+ }
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param parent DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension minimumLayoutSize(Container parent)
+ {
+ Dimension d = new Dimension();
+
+ if (editor != null)
+ {
+ Dimension tmp = editor.getMinimumSize();
+ d.width += tmp.width;
+ d.height = tmp.height;
+ }
+
+ int nextWidth = 0;
+ int previousWidth = 0;
+ int otherHeight = 0;
+
+ if (next != null)
+ {
+ Dimension tmp = next.getMinimumSize();
+ nextWidth = tmp.width;
+ otherHeight += tmp.height;
+ }
+ if (previous != null)
+ {
+ Dimension tmp = previous.getMinimumSize();
+ previousWidth = tmp.width;
+ otherHeight += tmp.height;
+ }
+
+ d.height = Math.max(d.height, otherHeight);
+ d.width += Math.max(nextWidth, previousWidth);
+
+ return d;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param parent DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public Dimension preferredLayoutSize(Container parent)
+ {
+ Dimension d = new Dimension();
+
+ if (editor != null)
+ {
+ Dimension tmp = editor.getPreferredSize();
+ d.width += Math.max(tmp.width, 40);
+ d.height = tmp.height;
+ }
+
+ int nextWidth = 0;
+ int previousWidth = 0;
+ int otherHeight = 0;
+
+ if (next != null)
+ {
+ Dimension tmp = next.getPreferredSize();
+ nextWidth = tmp.width;
+ otherHeight += tmp.height;
+ }
+ if (previous != null)
+ {
+ Dimension tmp = previous.getPreferredSize();
+ previousWidth = tmp.width;
+ otherHeight += tmp.height;
+ }
+
+ d.height = Math.max(d.height, otherHeight);
+ d.width += Math.max(nextWidth, previousWidth);
+
+ return d;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param child DOCUMENT ME!
+ */
+ public void removeLayoutComponent(Component child)
+ {
+ if (child == editor)
+ editor = null;
+ else if (child == next)
+ next = null;
+ else if (previous == child)
+ previous = null;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param name DOCUMENT ME!
+ * @param child DOCUMENT ME!
+ */
+ public void addLayoutComponent(String name, Component child)
+ {
+ if ("Editor".equals(name))
+ editor = child;
+ else if ("Next".equals(name))
+ next = child;
+ else if ("Previous".equals(name))
+ previous = child;
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ private Dimension minSize(Component c)
+ {
+ if (c == null)
+ return new Dimension();
+ else
+ return c.getMinimumSize();
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param c DOCUMENT ME!
+ * @param x DOCUMENT ME!
+ * @param y DOCUMENT ME!
+ * @param w DOCUMENT ME!
+ * @param h DOCUMENT ME!
+ */
+ private void setBounds(Component c, int x, int y, int w, int h)
+ {
+ if (c != null)
+ c.setBounds(x, y, w, h);
+ }
+
+ /** DOCUMENT ME! */
+ private Component editor;
+
+ /** DOCUMENT ME! */
+ private Component next;
+
+ /** DOCUMENT ME! */
+ private Component previous;
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicSplitPaneDivider.java b/javax/swing/plaf/basic/BasicSplitPaneDivider.java
index 44b64c807..78bafcdfd 100644
--- a/javax/swing/plaf/basic/BasicSplitPaneDivider.java
+++ b/javax/swing/plaf/basic/BasicSplitPaneDivider.java
@@ -153,32 +153,36 @@ public class BasicSplitPaneDivider extends Container
// left (top), middle, right(bottom)
// 0 1 2
- /** Keeps track of where the divider should be placed when using one touch expand
- * buttons. */
+ /**
+ * Keeps track of where the divider should be placed when using one touch
+ * expand buttons.
+ */
private transient int currentDividerLocation = 1;
-
+
+ /** DOCUMENT ME! */
private transient Border tmpBorder = new Border()
- {
- public Insets getBorderInsets(Component c)
- {
- return new Insets(2, 2, 2, 2);
- }
-
- public boolean isBorderOpaque()
{
- return false;
- }
-
- public void paintBorder(Component c, Graphics g, int x, int y, int width, int height)
- {
- Color saved = g.getColor();
- g.setColor(Color.BLACK);
-
- g.drawRect(x + 2, y + 2, width - 4, height - 4);
-
- g.setColor(saved);
- }
- };
+ public Insets getBorderInsets(Component c)
+ {
+ return new Insets(2, 2, 2, 2);
+ }
+
+ public boolean isBorderOpaque()
+ {
+ return false;
+ }
+
+ public void paintBorder(Component c, Graphics g, int x, int y,
+ int width, int height)
+ {
+ Color saved = g.getColor();
+ g.setColor(Color.BLACK);
+
+ g.drawRect(x + 2, y + 2, width - 4, height - 4);
+
+ g.setColor(saved);
+ }
+ };
/**
* Constructs a new divider.
@@ -420,7 +424,7 @@ public class BasicSplitPaneDivider extends Container
if (orientation == JSplitPane.VERTICAL_SPLIT)
dir = SwingConstants.NORTH;
JButton button = new BasicArrowButton(dir);
- button.setBorderPainted(false);
+ button.setBorder(null);
return button;
}
@@ -437,7 +441,7 @@ public class BasicSplitPaneDivider extends Container
if (orientation == JSplitPane.VERTICAL_SPLIT)
dir = SwingConstants.SOUTH;
JButton button = new BasicArrowButton(dir);
- button.setBorderPainted(false);
+ button.setBorder(null);
return button;
}
@@ -484,11 +488,10 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This helper method moves the divider to one of the
- * three locations when using one touch expand buttons.
- * Location 0 is the left (or top) most location.
- * Location 1 is the middle.
- * Location 2 is the right (or bottom) most location.
+ * This helper method moves the divider to one of the three locations when
+ * using one touch expand buttons. Location 0 is the left (or top) most
+ * location. Location 1 is the middle. Location 2 is the right (or bottom)
+ * most location.
*
* @param locationIndex The location to move to.
*/
@@ -612,8 +615,10 @@ public class BasicSplitPaneDivider extends Container
*/
protected class DragController
{
- /** The difference between where the mouse is clicked and the
- * initial divider location. */
+ /**
+ * The difference between where the mouse is clicked and the initial
+ * divider location.
+ */
transient int offset;
/**
@@ -650,8 +655,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method returns one of the two paramters
- * for the orientation. In this case, it returns x.
+ * This method returns one of the two paramters for the orientation. In
+ * this case, it returns x.
*
* @param x The x coordinate.
* @param y The y coordinate.
@@ -664,8 +669,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to pass on the drag information
- * to the UI through dragDividerTo.
+ * This method is called to pass on the drag information to the UI through
+ * dragDividerTo.
*
* @param newX The x coordinate of the MouseEvent.
* @param newY The y coordinate of the MouseEvent.
@@ -677,8 +682,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to pass on the drag information
- * to the UI through dragDividerTo.
+ * This method is called to pass on the drag information to the UI
+ * through dragDividerTo.
*
* @param e The MouseEvent.
*/
@@ -689,8 +694,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to finish the drag session
- * by calling finishDraggingTo.
+ * This method is called to finish the drag session by calling
+ * finishDraggingTo.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -701,8 +706,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method is called to finish the drag session
- * by calling finishDraggingTo.
+ * This method is called to finish the drag session by calling
+ * finishDraggingTo.
*
* @param e The MouseEvent.
*/
@@ -710,10 +715,10 @@ public class BasicSplitPaneDivider extends Container
{
finishDraggingTo(positionForMouseEvent(e));
}
-
+
/**
- * This is a helper method that includes the offset
- * in the needed location.
+ * This is a helper method that includes the offset in the needed
+ * location.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -727,8 +732,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This is a helper class that controls dragging when
- * the orientation is VERTICAL_SPLIT.
+ * This is a helper class that controls dragging when the orientation is
+ * VERTICAL_SPLIT.
*/
protected class VerticalDragController extends DragController
{
@@ -744,8 +749,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method returns one of the two parameters given
- * the orientation. In this case, it returns y.
+ * This method returns one of the two parameters given the orientation. In
+ * this case, it returns y.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -758,8 +763,7 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method returns the new location of the divider
- * given a MouseEvent.
+ * This method returns the new location of the divider given a MouseEvent.
*
* @param e The MouseEvent.
*
@@ -771,8 +775,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This is a helper method that includes the offset
- * in the needed location.
+ * This is a helper method that includes the offset in the needed
+ * location.
*
* @param x The x coordinate of the MouseEvent.
* @param y The y coordinate of the MouseEvent.
@@ -782,12 +786,11 @@ public class BasicSplitPaneDivider extends Container
int adjust(int x, int y)
{
return getNeededLocation(x, y) + getY() - offset;
- }
+ }
}
/**
- * This helper class acts as the Layout Manager for
- * the divider.
+ * This helper class acts as the Layout Manager for the divider.
*/
protected class DividerLayout implements LayoutManager
{
@@ -858,8 +861,8 @@ public class BasicSplitPaneDivider extends Container
}
/**
- * This method changes the button orientation when
- * the orientation of the SplitPane changes.
+ * This method changes the button orientation when the orientation of the
+ * SplitPane changes.
*/
private void changeButtonOrientation()
{
diff --git a/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/javax/swing/plaf/basic/BasicTabbedPaneUI.java
index d741a75cd..babc097a5 100644
--- a/javax/swing/plaf/basic/BasicTabbedPaneUI.java
+++ b/javax/swing/plaf/basic/BasicTabbedPaneUI.java
@@ -56,7 +56,6 @@ import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-
import javax.swing.Icon;
import javax.swing.JComponent;
import javax.swing.JPanel;
@@ -132,11 +131,17 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
if (++currentScrollLocation >= tabCount)
currentScrollLocation = tabCount - 1;
- if (currentScrollLocation == tabCount - 1)
- incrButton.setEnabled(false);
+
+ int width = 0;
+ for (int i = currentScrollLocation - 1; i < tabCount; i++)
+ width += rects[i].width;
+ if (width < viewport.getWidth())
+ // FIXME: Still getting mouse events after the button is disabled.
+ // incrButton.setEnabled(false);
+ currentScrollLocation--;
else if (! decrButton.isEnabled())
decrButton.setEnabled(true);
- tabPane.layout();
+ tabPane.revalidate();
tabPane.repaint();
return;
}
@@ -148,7 +153,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
decrButton.setEnabled(false);
else if (! incrButton.isEnabled())
incrButton.setEnabled(true);
- tabPane.layout();
+ tabPane.revalidate();
tabPane.repaint();
return;
}
@@ -160,7 +165,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
// e.g. in the inset area.
if (index != -1 && tabPane.isEnabledAt(index))
tabPane.setSelectedIndex(index);
- tabPane.layout();
+ tabPane.revalidate();
tabPane.repaint();
}
}
@@ -269,18 +274,16 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
if (tabPlacement == SwingConstants.TOP
|| tabPlacement == SwingConstants.BOTTOM)
{
- width = calculateMaxTabWidth(tabPlacement) * tabPane.getTabCount();
- calcRect = tabPane.getParent().getBounds();
- width = Math.max(width, componentWidth);
+ int min = calculateMaxTabWidth(tabPlacement);
+ width = Math.max(min, componentWidth);
int tabAreaHeight = preferredTabAreaHeight(tabPlacement, width);
height = tabAreaHeight + componentHeight;
}
else
{
- height = calculateMaxTabHeight(tabPlacement) * tabPane.getTabCount();
- calcRect = tabPane.getParent().getBounds();
- height = Math.max(height, componentHeight);
+ int min = calculateMaxTabHeight(tabPlacement);
+ height = Math.max(min, componentHeight);
int tabAreaWidth = preferredTabAreaWidth(tabPlacement, height);
width = tabAreaWidth + componentWidth;
@@ -454,7 +457,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
for (int j = first; j <= last; j++)
rects[j].y += (runCount - i) * maxTabHeight
- + (runCount - i) * tabRunOverlay;
+ - (runCount - i) * tabRunOverlay;
}
if (tabPlacement == SwingConstants.BOTTOM)
@@ -810,7 +813,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
*/
protected void rotateTabRuns(int tabPlacement, int selectedRun)
{
- if (selectedRun == 1 || selectedRun == -1)
+ if (runCount == 1 || selectedRun == 1 || selectedRun == -1)
return;
int[] newTabRuns = new int[tabRuns.length];
int currentRun = selectedRun;
@@ -1025,6 +1028,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
super.layoutContainer(pane);
int tabCount = tabPane.getTabCount();
+ Point p = null;
if (tabCount == 0)
return;
int tabPlacement = tabPane.getTabPlacement();
@@ -1083,13 +1087,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
int w = Math.max(rects[tabC].width + rects[tabC].x, tabAreaRect.width);
int h = Math.max(rects[tabC].height, tabAreaRect.height);
- Point p = findPointForIndex(currentScrollLocation);
+ p = findPointForIndex(currentScrollLocation);
// we want to cover that entire space so that borders that run under
// the tab area don't show up when we move the viewport around.
panel.setSize(w + p.x, h + p.y);
}
- viewport.setViewPosition(findPointForIndex(currentScrollLocation));
+ viewport.setViewPosition(p);
+ viewport.repaint();
}
}
@@ -1445,6 +1450,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
incrButton = createIncreaseButton();
decrButton = createDecreaseButton();
viewport = new ScrollingViewport();
+ viewport.setLayout(null);
panel = new ScrollingPanel();
viewport.setView(panel);
tabPane.add(incrButton);
@@ -1689,6 +1695,8 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
Rectangle ir = new Rectangle();
Rectangle tr = new Rectangle();
+ boolean isScroll = tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT;
+
// Please note: the ordering of the painting is important.
// we WANT to paint the outermost run first and then work our way in.
int tabCount = tabPane.getTabCount();
@@ -1701,17 +1709,33 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
for (int i = 0; i < runCount; i++)
{
int first = lastTabInRun(tabCount, getPreviousTabRun(currRun)) + 1;
- if (first == tabCount)
+ if (isScroll)
+ first = currentScrollLocation;
+ else if (first == tabCount)
first = 0;
int last = lastTabInRun(tabCount, currRun);
+ if (isScroll)
+ {
+ for (int k = first; k < tabCount; k++)
+ {
+ if (rects[k].x + rects[k].width - rects[first].x > viewport
+ .getWidth())
+ {
+ last = k;
+ break;
+ }
+ }
+ }
+
for (int j = first; j <= last; j++)
{
- if (j != selectedIndex)
+ if (j != selectedIndex || isScroll)
paintTab(g, tabPlacement, rects, j, ir, tr);
}
- currRun = getNextTabRun(currRun);
+ currRun = getPreviousTabRun(currRun);
}
- paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);
+ if (! isScroll)
+ paintTab(g, tabPlacement, rects, selectedIndex, ir, tr);
}
/**
@@ -1974,7 +1998,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int x, int y, int w, int h, boolean isSelected)
{
Color saved = g.getColor();
-
+
if (! isSelected || tabPlacement != SwingConstants.TOP)
{
g.setColor(shadow);
@@ -2029,7 +2053,7 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
{
Color bg = tabPane.getBackgroundAt(tabIndex);
if (bg == null)
- bg = tabPane.getBackground();
+ bg = Color.GRAY;
g.setColor(bg);
}
@@ -2082,14 +2106,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
if (tabPlacement == SwingConstants.TOP)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
g.drawLine(x, y, startgap - diff, y);
g.drawLine(endgap - diff, y, x + w, y);
}
@@ -2122,14 +2146,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
-
if (tabPlacement == SwingConstants.LEFT)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
g.drawLine(x, y, x, startgap - diff);
g.drawLine(x, endgap - diff, x, y + h);
}
@@ -2161,14 +2185,14 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.x;
- }
-
if (tabPlacement == SwingConstants.BOTTOM)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.x;
+ }
+
g.setColor(shadow);
g.drawLine(x + 1, y + h - 1, startgap - diff, y + h - 1);
g.drawLine(endgap - diff, y + h - 1, x + w - 1, y + h - 1);
@@ -2208,14 +2232,15 @@ public class BasicTabbedPaneUI extends TabbedPaneUI implements SwingConstants
int endgap = rects[selectedIndex].y + rects[selectedIndex].height;
int diff = 0;
- if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
- {
- Point p = findPointForIndex(currentScrollLocation);
- diff = p.y;
- }
if (tabPlacement == SwingConstants.RIGHT)
{
+ if (tabPane.getTabLayoutPolicy() == JTabbedPane.SCROLL_TAB_LAYOUT)
+ {
+ Point p = findPointForIndex(currentScrollLocation);
+ diff = p.y;
+ }
+
g.setColor(shadow);
g.drawLine(x + w - 1, y + 1, x + w - 1, startgap - diff);
g.drawLine(x + w - 1, endgap - diff, x + w - 1, y + h - 1);
diff --git a/javax/swing/plaf/basic/BasicTableHeaderUI.java b/javax/swing/plaf/basic/BasicTableHeaderUI.java
new file mode 100644
index 000000000..c55c9400f
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicTableHeaderUI.java
@@ -0,0 +1,301 @@
+/* BasicTableHeaderUI.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Rectangle;
+import java.awt.event.MouseEvent;
+import javax.swing.CellRendererPane;
+import javax.swing.JComponent;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.border.Border;
+import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TableHeaderUI;
+import javax.swing.table.JTableHeader;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+
+
+public class BasicTableHeaderUI
+ extends TableHeaderUI
+{
+
+ public static ComponentUI createUI(JComponent h)
+ {
+ return new BasicTableHeaderUI();
+ }
+
+ protected JTableHeader header;
+ protected MouseInputListener mouseInputListener;
+ protected CellRendererPane rendererPane;
+ protected Border cellBorder;
+
+ class MouseInputHandler
+ implements MouseInputListener
+ {
+ public void mouseClicked(MouseEvent e) {}
+ public void mouseDragged(MouseEvent e) {}
+ public void mouseEntered(MouseEvent e) {}
+ public void mouseExited(MouseEvent e) {}
+ public void mouseMoved(MouseEvent e) {}
+ public void mousePressed(MouseEvent e) {}
+ public void mouseReleased(MouseEvent e) {}
+ }
+
+ protected MouseInputListener createMouseInputListener()
+ {
+ return new MouseInputHandler();
+ }
+
+ public BasicTableHeaderUI()
+ {
+ mouseInputListener = createMouseInputListener();
+ }
+
+ protected void installDefaults()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ header.setBackground(defaults.getColor("TableHeader.background"));
+ header.setForeground(defaults.getColor("TableHeader.foreground"));
+ header.setFont(defaults.getFont("TableHeader.font"));
+ cellBorder = defaults.getBorder("TableHeader.cellBorder");
+ }
+
+ protected void installKeyboardActions()
+ {
+ }
+
+ protected void installListeners()
+ {
+ header.addMouseListener(mouseInputListener);
+ }
+
+ public void installUI(JComponent c)
+ {
+ header = (JTableHeader) c;
+ installDefaults();
+ installKeyboardActions();
+ installListeners();
+ }
+
+ protected void uninstallDefaults()
+ {
+ header.setBackground(null);
+ header.setForeground(null);
+ header.setFont(null);
+ }
+
+ protected void uninstallKeyboardActions()
+ {
+ }
+
+ protected void uninstallListeners()
+ {
+ header.removeMouseListener(mouseInputListener);
+ }
+
+ public void uninstallUI(JComponent c)
+ {
+ uninstallListeners();
+ uninstallKeyboardActions();
+ uninstallDefaults();
+ }
+
+ public void paint(Graphics gfx, JComponent c)
+ {
+ TableColumnModel cmod = header.getColumnModel();
+ int ncols = cmod.getColumnCount();
+ if (ncols == 0)
+ return;
+
+ Rectangle clip = gfx.getClipBounds();
+ TableCellRenderer defaultRend = header.getDefaultRenderer();
+
+ for (int i = 0; i < ncols; ++i)
+ {
+ Rectangle bounds = header.getHeaderRect(i);
+ if (bounds.intersects(clip))
+ {
+ TableColumn col = cmod.getColumn(i);
+ TableCellRenderer rend = col.getHeaderRenderer();
+ if (rend == null)
+ rend = defaultRend;
+ Object val = col.getHeaderValue();
+ Component comp = rend.getTableCellRendererComponent(header.getTable(),
+ val,
+ false, // isSelected
+ false, // isFocused
+ -1, i);
+ comp.setFont(header.getFont());
+ comp.setBackground(header.getBackground());
+ comp.setForeground(header.getForeground());
+ if (comp instanceof JComponent)
+ ((JComponent)comp).setBorder(cellBorder);
+ gfx.translate(bounds.x, bounds.y);
+ comp.setSize(bounds.width, bounds.height);
+ comp.setLocation(0,0);
+ comp.paint(gfx);
+ gfx.translate(-bounds.x, -bounds.y);
+ }
+ }
+
+ }
+
+ public Dimension getMaximumSize(JComponent c)
+ {
+ TableColumnModel cmod = header.getColumnModel();
+ TableCellRenderer defaultRend = header.getDefaultRenderer();
+ int ncols = cmod.getColumnCount();
+ int spacing = 0;
+ Dimension ret = getPreferredSize(c);
+
+ if (header.getTable() != null
+ && header.getTable().getInterCellSpacing() != null)
+ spacing = header.getTable().getInterCellSpacing().width;
+
+ ret.width = 0;
+ for (int i = 0; i < ncols; ++i)
+ {
+ TableColumn col = cmod.getColumn(i);
+ TableCellRenderer rend = col.getHeaderRenderer();
+ if (rend == null)
+ rend = defaultRend;
+ Object val = col.getHeaderValue();
+ Component comp = rend.getTableCellRendererComponent(header.getTable(),
+ val,
+ false, // isSelected
+ false, // isFocused
+ -1, i);
+ comp.setFont(header.getFont());
+ comp.setBackground(header.getBackground());
+ comp.setForeground(header.getForeground());
+ if (comp instanceof JComponent)
+ ((JComponent)comp).setBorder(cellBorder);
+
+ Dimension d = comp.getMaximumSize();
+ ret.width += col.getMaxWidth();
+ ret.height = Math.max(ret.height, d.height);
+ ret.width += spacing;
+ }
+ return ret;
+ }
+
+ public Dimension getMinimumSize(JComponent c)
+ {
+ TableColumnModel cmod = header.getColumnModel();
+ TableCellRenderer defaultRend = header.getDefaultRenderer();
+ int ncols = cmod.getColumnCount();
+ int spacing = 0;
+ Dimension ret = getPreferredSize(c);
+
+ if (header.getTable() != null
+ && header.getTable().getInterCellSpacing() != null)
+ spacing = header.getTable().getInterCellSpacing().width;
+
+ ret.width = 0;
+ for (int i = 0; i < ncols; ++i)
+ {
+ TableColumn col = cmod.getColumn(i);
+ TableCellRenderer rend = col.getHeaderRenderer();
+ if (rend == null)
+ rend = defaultRend;
+ Object val = col.getHeaderValue();
+ Component comp = rend.getTableCellRendererComponent(header.getTable(),
+ val,
+ false, // isSelected
+ false, // isFocused
+ -1, i);
+ comp.setFont(header.getFont());
+ comp.setBackground(header.getBackground());
+ comp.setForeground(header.getForeground());
+ if (comp instanceof JComponent)
+ ((JComponent)comp).setBorder(cellBorder);
+
+ Dimension d = comp.getMinimumSize();
+ ret.width += col.getMinWidth();
+ ret.width += spacing;
+ ret.height = Math.max(ret.height, d.height);
+ }
+ return ret;
+ }
+
+ public Dimension getPreferredSize(JComponent c)
+ {
+ TableColumnModel cmod = header.getColumnModel();
+ TableCellRenderer defaultRend = header.getDefaultRenderer();
+ int ncols = cmod.getColumnCount();
+ Dimension ret = new Dimension(0,0);
+ int spacing = 0;
+
+ if (header.getTable() != null
+ && header.getTable().getInterCellSpacing() != null)
+ spacing = header.getTable().getInterCellSpacing().width;
+
+ for (int i = 0; i < ncols; ++i)
+ {
+ TableColumn col = cmod.getColumn(i);
+ TableCellRenderer rend = col.getHeaderRenderer();
+ if (rend == null)
+ rend = defaultRend;
+ Object val = col.getHeaderValue();
+ Component comp = rend.getTableCellRendererComponent(header.getTable(),
+ val,
+ false, // isSelected
+ false, // isFocused
+ -1, i);
+ comp.setFont(header.getFont());
+ comp.setBackground(header.getBackground());
+ comp.setForeground(header.getForeground());
+ if (comp instanceof JComponent)
+ ((JComponent)comp).setBorder(cellBorder);
+
+ Dimension d = comp.getPreferredSize();
+ ret.width += d.width;
+ ret.width += spacing;
+ ret.height = Math.max(d.height, ret.height);
+ }
+ return ret;
+ }
+
+
+}
diff --git a/javax/swing/plaf/basic/BasicTableUI.java b/javax/swing/plaf/basic/BasicTableUI.java
new file mode 100644
index 000000000..5fa8fb713
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicTableUI.java
@@ -0,0 +1,374 @@
+/* BasicTableUI.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.MouseEvent;
+import javax.swing.CellRendererPane;
+import javax.swing.JComponent;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.MouseInputListener;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.TableUI;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumn;
+import javax.swing.table.TableColumnModel;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+
+
+public class BasicTableUI
+ extends TableUI
+{
+
+ public static ComponentUI createUI(JComponent comp)
+ {
+ return new BasicTableUI();
+ }
+
+ protected FocusListener focusListener;
+ protected KeyListener keyListener;
+ protected MouseInputListener mouseInputListener;
+ protected CellRendererPane rendererPane;
+ protected JTable table;
+
+ class FocusHandler implements FocusListener
+ {
+ public void focusGained(FocusEvent e)
+ {
+ }
+ public void focusLost(FocusEvent e)
+ {
+ }
+ }
+
+ class KeyHandler implements KeyListener
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ }
+ public void keyReleased(KeyEvent e)
+ {
+ }
+ public void keyTyped(KeyEvent e)
+ {
+ }
+ }
+
+ class MouseInputHandler implements MouseInputListener
+ {
+ Point begin, curr;
+
+ private int getRowForPoint(Point p)
+ {
+ int y0 = table.getLocation().y;
+ int nrows = table.getRowCount();
+ Dimension gap = table.getInterCellSpacing();
+ int height = table.getRowHeight() + (gap == null ? 0 : gap.height);
+ int y = p.y;
+ for (int i = 0; i < nrows; ++i)
+ {
+ if (0 <= y && y < height)
+ return i;
+ y -= height;
+ }
+ return -1;
+ }
+
+ private int getColForPoint(Point p)
+ {
+ int x0 = table.getLocation().x;
+ int ncols = table.getColumnCount();
+ Dimension gap = table.getInterCellSpacing();
+ TableColumnModel cols = table.getColumnModel();
+ int x = p.x;
+ for (int i = 0; i < ncols; ++i)
+ {
+ int width = cols.getColumn(i).getWidth() + (gap == null ? 0 : gap.width);
+ if (0 <= x && x < width)
+ return i;
+ x -= width;
+ }
+ return -1;
+ }
+
+ private void updateSelection()
+ {
+ if (table.getRowSelectionAllowed())
+ {
+ int lo_row = getRowForPoint(begin);
+ int hi_row = getRowForPoint(curr);
+ ListSelectionModel rowModel = table.getSelectionModel();
+ if (lo_row != -1 && hi_row != -1)
+ rowModel.setSelectionInterval(lo_row, hi_row);
+ }
+
+ if (table.getColumnSelectionAllowed())
+ {
+ int lo_col = getColForPoint(begin);
+ int hi_col = getColForPoint(curr);
+ ListSelectionModel colModel = table.getColumnModel().getSelectionModel();
+ if (lo_col != -1 && hi_col != -1)
+ colModel.setSelectionInterval(lo_col, hi_col);
+ }
+ }
+
+ public void mouseClicked(MouseEvent e)
+ {
+ }
+ public void mouseDragged(MouseEvent e)
+ {
+ curr = new Point(e.getX(), e.getY());
+ updateSelection();
+ }
+ public void mouseEntered(MouseEvent e)
+ {
+ }
+ public void mouseExited(MouseEvent e)
+ {
+ }
+ public void mouseMoved(MouseEvent e)
+ {
+ }
+ public void mousePressed(MouseEvent e)
+ {
+ begin = new Point(e.getX(), e.getY());
+ curr = new Point(e.getX(), e.getY());
+ updateSelection();
+ }
+ public void mouseReleased(MouseEvent e)
+ {
+ begin = null;
+ curr = null;
+ }
+ }
+
+ protected FocusListener createFocusListener()
+ {
+ return new FocusHandler();
+ }
+ protected KeyListener createKeyListener()
+ {
+ return new KeyHandler();
+ }
+ protected MouseInputListener createMouseInputListener()
+ {
+ return new MouseInputHandler();
+ }
+
+ public Dimension getMaximumSize(JComponent comp)
+ {
+ return getPreferredSize(comp);
+ }
+
+ public Dimension getMinimumSize(JComponent comp)
+ {
+ return getPreferredSize(comp);
+ }
+
+ public Dimension getPreferredSize(JComponent comp)
+ {
+ int width = table.getColumnModel().getTotalColumnWidth();
+ int height = table.getRowCount() * table.getRowHeight();
+ return new Dimension(width, height);
+ }
+
+ protected void installDefaults()
+ {
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ table.setFont(defaults.getFont("Table.font"));
+ table.setGridColor(defaults.getColor("Table.gridColor"));
+ table.setForeground(defaults.getColor("Table.foreground"));
+ table.setBackground(defaults.getColor("Table.background"));
+ table.setSelectionForeground(defaults.getColor("Table.selectionForeground"));
+ table.setSelectionBackground(defaults.getColor("Table.selectionBackground"));
+ table.setOpaque(true);
+ }
+ protected void installKeyboardActions()
+ {
+ }
+
+ protected void installListeners()
+ {
+ table.addFocusListener(focusListener);
+ table.addKeyListener(keyListener);
+ table.addMouseListener(mouseInputListener);
+ }
+
+ protected void uninstallDefaults()
+ {
+ table.setFont(null);
+ table.setGridColor(null);
+ table.setForeground(null);
+ table.setBackground(null);
+ table.setSelectionForeground(null);
+ table.setSelectionBackground(null);
+ }
+
+ protected void uninstallKeyboardActions()
+ {
+ }
+
+ protected void uninstallListeners()
+ {
+ table.removeFocusListener(focusListener);
+ table.removeKeyListener(keyListener);
+ table.removeMouseListener(mouseInputListener);
+ }
+
+ public void installUI(JComponent comp)
+ {
+ table = (JTable)comp;
+ focusListener = createFocusListener();
+ keyListener = createKeyListener();
+ mouseInputListener = createMouseInputListener();
+ installDefaults();
+ installKeyboardActions();
+ installListeners();
+ }
+
+ public void uninstallUI(JComponent c)
+ {
+ uninstallListeners();
+ uninstallKeyboardActions();
+ uninstallDefaults();
+ }
+
+ public void paint(Graphics gfx, JComponent ignored)
+ {
+ int ncols = table.getColumnCount();
+ int nrows = table.getRowCount();
+ if (nrows == 0 || ncols == 0)
+ return;
+
+ Rectangle clip = gfx.getClipBounds();
+ TableColumnModel cols = table.getColumnModel();
+
+ int height = table.getRowHeight();
+ int x0 = 0, y0 = 0;
+ int x = x0;
+ int y = y0;
+
+ Dimension gap = table.getInterCellSpacing();
+ int ymax = clip.y + clip.height;
+ int xmax = clip.x + clip.width;
+
+ // paint the cell contents
+ for (int c = 0; c < ncols && x < xmax; ++c)
+ {
+ y = y0;
+ TableColumn col = cols.getColumn(c);
+ int width = col.getWidth();
+ int modelCol = col.getModelIndex();
+
+ for (int r = 0; r < nrows && y < ymax; ++r)
+ {
+ Rectangle bounds = new Rectangle(x, y, width, height);
+ if (bounds.intersects(clip))
+ {
+ TableCellRenderer rend = table.getCellRenderer(r, c);
+ Component comp = table.prepareRenderer(rend, r, c);
+ gfx.translate(x, y);
+ comp.setBounds(new Rectangle(0, 0, width, height));
+ comp.paint(gfx);
+ gfx.translate(-x, -y);
+ }
+ y += height;
+ if (gap != null)
+ y += gap.height;
+ }
+ x += width;
+ if (gap != null)
+ x += gap.width;
+ }
+
+ // tighten up the x and y max bounds
+ ymax = y;
+ xmax = x;
+
+ Color grid = table.getGridColor();
+
+ // paint vertical grid lines
+ if (grid != null && table.getShowVerticalLines())
+ {
+ x = x0;
+ Color save = gfx.getColor();
+ gfx.setColor(grid);
+ boolean paintedLine = false;
+ for (int c = 0; c < ncols && x < xmax; ++c)
+ {
+ x += cols.getColumn(c).getWidth();;
+ if (gap != null)
+ x += gap.width;
+ gfx.drawLine(x, y0, x, ymax);
+ paintedLine = true;
+ }
+ gfx.setColor(save);
+ }
+
+ // paint horizontal grid lines
+ if (grid != null && table.getShowHorizontalLines())
+ {
+ y = y0;
+ Color save = gfx.getColor();
+ gfx.setColor(grid);
+ boolean paintedLine = false;
+ for (int r = 0; r < nrows && y < ymax; ++r)
+ {
+ y += height;
+ if (gap != null)
+ y += gap.height;
+ gfx.drawLine(x0, y, xmax, y);
+ paintedLine = true;
+ }
+ gfx.setColor(save);
+ }
+
+ }
+
+}
diff --git a/javax/swing/plaf/basic/BasicTextAreaUI.java b/javax/swing/plaf/basic/BasicTextAreaUI.java
new file mode 100644
index 000000000..f1714c20d
--- /dev/null
+++ b/javax/swing/plaf/basic/BasicTextAreaUI.java
@@ -0,0 +1,69 @@
+/* BasicTextAreaUI.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.plaf.basic;
+
+import java.beans.PropertyChangeEvent;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.text.Element;
+import javax.swing.text.PlainView;
+import javax.swing.text.View;
+
+public class BasicTextAreaUI extends BasicTextUI
+{
+ public static ComponentUI createUI(JComponent comp)
+ {
+ return new BasicTextAreaUI();
+ }
+
+ public BasicTextAreaUI()
+ {
+ }
+
+ public View create(Element elem)
+ {
+ return new PlainView(elem);
+ }
+
+ protected String getPropertyPrefix()
+ {
+ return "TextArea";
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicTextUI.java b/javax/swing/plaf/basic/BasicTextUI.java
index ad617cab2..516e4bd3d 100644
--- a/javax/swing/plaf/basic/BasicTextUI.java
+++ b/javax/swing/plaf/basic/BasicTextUI.java
@@ -46,8 +46,16 @@ import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.Shape;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import javax.swing.Action;
+import javax.swing.ActionMap;
+import javax.swing.InputMap;
import javax.swing.JComponent;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.TextUI;
import javax.swing.plaf.UIResource;
@@ -61,7 +69,9 @@ import javax.swing.text.EditorKit;
import javax.swing.text.Element;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
+import javax.swing.text.Keymap;
import javax.swing.text.PlainDocument;
+import javax.swing.text.PlainView;
import javax.swing.text.Position;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
@@ -88,13 +98,17 @@ public abstract class BasicTextUI extends TextUI
private class RootView extends View
{
- private JTextComponent textComponent;
private View view;
- public RootView(JTextComponent parent)
+ public RootView()
{
super(null);
- textComponent = parent;
+ }
+
+ public ViewFactory getViewFactory()
+ {
+ // FIXME: Handle EditorKit somehow.
+ return BasicTextUI.this;
}
public void setView(View v)
@@ -123,17 +137,34 @@ public abstract class BasicTextUI extends TextUI
public void paint(Graphics g, Shape s)
{
- System.out.println("Michael: BasicTextUI.RootView.paint");
-
if (view != null)
view.paint(g, s);
}
+
+ protected Rectangle modelToView(int position, Shape a, Position.Bias bias)
+ throws BadLocationException
+ {
+ return ((PlainView) view).modelToView(position, a, bias).getBounds();
+ }
+ }
+
+ class UpdateHandler implements PropertyChangeListener
+ {
+ public void propertyChange(PropertyChangeEvent event)
+ {
+ if (event.getPropertyName().equals("document"))
+ {
+ // Document changed.
+ modelChanged();
+ }
+ }
}
- RootView rootView;
+ static EditorKit kit = new DefaultEditorKit();
+
+ RootView rootView = new RootView();
JTextComponent textComponent;
- int gap = 3;
- EditorKit kit = new DefaultEditorKit();
+ UpdateHandler updateHandler = new UpdateHandler();
public BasicTextUI()
{
@@ -164,12 +195,12 @@ public abstract class BasicTextUI extends TextUI
Document doc = textComponent.getDocument();
if (doc == null)
{
- doc = new PlainDocument();
+ doc = getEditorKit(textComponent).createDefaultDocument();
textComponent.setDocument(doc);
}
- rootView = new RootView(textComponent);
- setView(create(doc.getDefaultRootElement()));
+ textComponent.addPropertyChangeListener(updateHandler);
+ modelChanged();
installDefaults();
installListeners();
@@ -178,20 +209,115 @@ public abstract class BasicTextUI extends TextUI
protected void installDefaults()
{
+ Caret caret = textComponent.getCaret();
+ if (caret == null)
+ {
+ caret = createCaret();
+ textComponent.setCaret(caret);
+ }
+
+ Highlighter highlighter = textComponent.getHighlighter();
+ if (highlighter == null)
+ textComponent.setHighlighter(createHighlighter());
+
+ String prefix = getPropertyPrefix();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ textComponent.setBackground(defaults.getColor(prefix + ".background"));
+ textComponent.setForeground(defaults.getColor(prefix + ".foreground"));
+ textComponent.setMargin(defaults.getInsets(prefix + ".margin"));
+ textComponent.setBorder(defaults.getBorder(prefix + ".border"));
+ textComponent.setFont(defaults.getFont(prefix + ".font"));
+
+ caret.setBlinkRate(defaults.getInt(prefix + ".caretBlinkRate"));
}
protected void installListeners()
{
+ // Do nothing here.
+ }
+
+ protected String getKeymapName()
+ {
+ return "BasicTextUI";
+ }
+
+ protected Keymap createKeymap()
+ {
+ String prefix = getPropertyPrefix();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ JTextComponent.KeyBinding[] bindings =
+ (JTextComponent.KeyBinding[]) defaults.get(prefix + ".keyBindings");
+ Keymap km = JTextComponent.addKeymap(getKeymapName(),
+ JTextComponent.getKeymap(JTextComponent.DEFAULT_KEYMAP));
+ JTextComponent.loadKeymap(km, bindings, textComponent.getActions());
+ return km;
}
protected void installKeyboardActions()
+ {
+ // load any bindings for the older Keymap interface
+ Keymap km = JTextComponent.getKeymap(getKeymapName());
+ if (km == null)
+ km = createKeymap();
+ textComponent.setKeymap(km);
+
+ // load any bindings for the newer InputMap / ActionMap interface
+ SwingUtilities.replaceUIInputMap(textComponent,
+ JComponent.WHEN_FOCUSED,
+ getInputMap(JComponent.WHEN_FOCUSED));
+ SwingUtilities.replaceUIActionMap(textComponent, getActionMap());
+ }
+
+ InputMap getInputMap(int condition)
{
+ String prefix = getPropertyPrefix();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ switch (condition)
+ {
+ case JComponent.WHEN_IN_FOCUSED_WINDOW:
+ // FIXME: is this the right string? nobody seems to use it.
+ return (InputMap) defaults.get(prefix + ".windowInputMap");
+ case JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT:
+ return (InputMap) defaults.get(prefix + ".ancestorInputMap");
+ default:
+ case JComponent.WHEN_FOCUSED:
+ return (InputMap) defaults.get(prefix + ".focusInputMap");
+ }
+ }
+
+ ActionMap getActionMap()
+ {
+ String prefix = getPropertyPrefix();
+ UIDefaults defaults = UIManager.getLookAndFeelDefaults();
+ ActionMap am = (ActionMap) defaults.get(prefix + ".actionMap");
+ if (am == null)
+ {
+ am = createActionMap();
+ defaults.put(prefix + ".actionMap", am);
+ }
+ return am;
+ }
+
+ ActionMap createActionMap()
+ {
+ Action[] actions = textComponent.getActions();
+ ActionMap am = new ActionMap();
+ for (int i = 0; i < actions.length; ++i)
+ {
+ String name = (String) actions[i].getValue(Action.NAME);
+ if (name != null)
+ am.put(name, actions[i]);
+ }
+ return am;
}
- public void uninstallUI(final JComponent c)
+ public void uninstallUI(final JComponent component)
{
- super.uninstallUI(c);
- rootView = null;
+ super.uninstallUI(component);
+ rootView.setView(null);
+
+ textComponent.removePropertyChangeListener(updateHandler);
+ textComponent = null;
uninstallDefaults();
uninstallListeners();
@@ -200,14 +326,17 @@ public abstract class BasicTextUI extends TextUI
protected void uninstallDefaults()
{
+ // Do nothing here.
}
protected void uninstallListeners()
{
+ // Do nothing here.
}
protected void uninstallKeyboardActions()
{
+ // Do nothing here.
}
protected abstract String getPropertyPrefix();
@@ -235,18 +364,19 @@ public abstract class BasicTextUI extends TextUI
if (textComponent.isOpaque())
paintBackground(g);
- rootView.paint(g, getVisibleEditorRect());
-
- if (highlighter != null)
+ if (highlighter != null
+ && textComponent.getSelectionStart() != textComponent.getSelectionEnd())
highlighter.paint(g);
+ rootView.paint(g, getVisibleEditorRect());
+
if (caret != null)
caret.paint(g);
}
protected void paintBackground(Graphics g)
{
- g.setColor(Color.WHITE); // FIXME: set background color
+ g.setColor(textComponent.getBackground());
g.fillRect(0, 0, textComponent.getWidth(), textComponent.getHeight());
}
@@ -281,13 +411,13 @@ public abstract class BasicTextUI extends TextUI
public Rectangle modelToView(JTextComponent t, int pos)
throws BadLocationException
{
- return modelToView(t, pos, null);
+ return modelToView(t, pos, Position.Bias.Forward);
}
public Rectangle modelToView(JTextComponent t, int pos, Position.Bias bias)
throws BadLocationException
{
- return null;
+ return rootView.modelToView(pos, getVisibleEditorRect(), bias).getBounds();
}
public int viewToModel(JTextComponent t, Point pt)
@@ -331,4 +461,11 @@ public abstract class BasicTextUI extends TextUI
rootView.setView(view);
view.setParent(rootView);
}
+
+ protected void modelChanged()
+ {
+ ViewFactory factory = rootView.getViewFactory();
+ Element elem = textComponent.getDocument().getDefaultRootElement();
+ setView(factory.create(elem));
+ }
}
diff --git a/javax/swing/plaf/basic/BasicToggleButtonUI.java b/javax/swing/plaf/basic/BasicToggleButtonUI.java
index a319b0b4e..1dc6423ee 100644
--- a/javax/swing/plaf/basic/BasicToggleButtonUI.java
+++ b/javax/swing/plaf/basic/BasicToggleButtonUI.java
@@ -43,12 +43,10 @@ import javax.swing.plaf.ComponentUI;
public class BasicToggleButtonUI extends BasicButtonUI
{
-
- public static ComponentUI createUI(final JComponent c) {
- return new BasicToggleButtonUI();
- }
-}
-
-
+ public static ComponentUI createUI(final JComponent component)
+ {
+ return new BasicToggleButtonUI();
+ }
+}
diff --git a/javax/swing/plaf/basic/BasicToolBarUI.java b/javax/swing/plaf/basic/BasicToolBarUI.java
index 6bffee0d5..85366a8f8 100644
--- a/javax/swing/plaf/basic/BasicToolBarUI.java
+++ b/javax/swing/plaf/basic/BasicToolBarUI.java
@@ -157,10 +157,8 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
/**
* This method creates a new BasicToolBarUI object for the given JToolBar.
- *
- * @param b The JToolBar to represent with this UI.
*/
- public BasicToolBarUI(JToolBar b)
+ public BasicToolBarUI()
{
super();
}
@@ -353,7 +351,7 @@ public class BasicToolBarUI extends ToolBarUI implements SwingConstants
*/
public static ComponentUI createUI(JComponent c)
{
- return new BasicToolBarUI((JToolBar) c);
+ return new BasicToolBarUI();
}
/**
diff --git a/javax/swing/plaf/basic/ComboPopup.java b/javax/swing/plaf/basic/ComboPopup.java
new file mode 100644
index 000000000..d4ef1f2e5
--- /dev/null
+++ b/javax/swing/plaf/basic/ComboPopup.java
@@ -0,0 +1,103 @@
+/* ComboPopup.java
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.plaf.basic;
+
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import javax.swing.JList;
+
+
+public interface ComboPopup
+{
+ /**
+ * This method display popup menu containing list of JComboBox's items to
+ * the screen
+ */
+ void show();
+
+ /**
+ * This method hides popup menu with list of JComboBox's item from the
+ * screen
+ */
+ void hide();
+
+ /**
+ * Retursn true if popup menu with JComboBOx's item is currently visible on
+ * the screen and false otherwise
+ *
+ * @return true if JComboBox's popup menu with list of items is currently
+ * visible on the screen and false otherwise.
+ */
+ boolean isVisible();
+
+ /**
+ * Return JList that is used to draw cells of the JComboBox.
+ *
+ * @return JList that is used to draw cells of the JcomboBox
+ */
+ JList getList();
+
+ /**
+ * This method returns MouseListener that listen's to mouse events occuring
+ * in the combo box
+ *
+ * @return MouseListenere
+ */
+ MouseListener getMouseListener();
+
+ /**
+ * This method returns MouseListener that listen's to mouse events occuring
+ * in the combo box.
+ *
+ * @return MouseMotionListener
+ */
+ MouseMotionListener getMouseMotionListener();
+
+ /**
+ * This method returns KeyListener that listen's to key events occuring in
+ * the combo box.
+ *
+ * @return KeyListener
+ */
+ KeyListener getKeyListener();
+
+ /* This method removes any listeners that were installed */
+ void uninstallingUI();
+}
diff --git a/javax/swing/table/DefaultTableCellRenderer.java b/javax/swing/table/DefaultTableCellRenderer.java
index 563d9e60a..ef8298861 100644
--- a/javax/swing/table/DefaultTableCellRenderer.java
+++ b/javax/swing/table/DefaultTableCellRenderer.java
@@ -122,8 +122,22 @@ public class DefaultTableCellRenderer extends JLabel
{
if (value!=null)
super.setText(value.toString());
-
- return this;
+
+ setOpaque(true);
+ if (isSelected)
+ {
+ setBackground(table.getSelectionBackground());
+ setForeground(table.getSelectionForeground());
+ }
+ else
+ {
+ setBackground(table.getBackground());
+ setForeground(table.getForeground());
+ }
+
+ setEnabled(table.isEnabled());
+ setFont(table.getFont());
+ return this;
}
/**
@@ -150,6 +164,11 @@ public class DefaultTableCellRenderer extends JLabel
// Does nothing.
}
+ public void revalidate()
+ {
+ // Does nothing.
+ }
+
/**
* Overriden for performance.
*
diff --git a/javax/swing/table/DefaultTableColumnModel.java b/javax/swing/table/DefaultTableColumnModel.java
index 6a1f30371..602d76034 100644
--- a/javax/swing/table/DefaultTableColumnModel.java
+++ b/javax/swing/table/DefaultTableColumnModel.java
@@ -44,6 +44,7 @@ import java.util.Enumeration;
import java.util.EventListener;
import java.util.Vector;
import javax.swing.ListSelectionModel;
+import javax.swing.DefaultListSelectionModel;
import javax.swing.event.ChangeEvent;
import javax.swing.event.EventListenerList;
import javax.swing.event.ListSelectionEvent;
@@ -103,25 +104,30 @@ public class DefaultTableColumnModel
*/
public DefaultTableColumnModel()
{
- // TODO
+ tableColumns = new Vector();
+ setSelectionModel(new DefaultListSelectionModel());
+ columnMargin = 1;
+ columnSelectionAllowed = false;
}
/**
* addColumn
* @param value0 TODO
*/
- public void addColumn(TableColumn value0)
+ public void addColumn(TableColumn col)
{
- // TODO
+ tableColumns.add(col);
+ invalidateWidthCache();
}
/**
* removeColumn
* @param value0 TODO
*/
- public void removeColumn(TableColumn value0)
+ public void removeColumn(TableColumn col)
{
- // TODO
+ tableColumns.remove(col);
+ invalidateWidthCache();
}
/**
@@ -129,18 +135,20 @@ public class DefaultTableColumnModel
* @param value0 TODO
* @param value1 TODO
*/
- public void moveColumn(int value0, int value1)
+ public void moveColumn(int i, int j)
{
- // TODO
+ Object tmp = tableColumns.get(i);
+ tableColumns.set(i, tableColumns.get(j));
+ tableColumns.set(j, tmp);
}
/**
* setColumnMargin
* @param value0 TODO
*/
- public void setColumnMargin(int value0)
+ public void setColumnMargin(int m)
{
- // TODO
+ columnMargin = m;
}
/**
@@ -149,7 +157,7 @@ public class DefaultTableColumnModel
*/
public int getColumnCount()
{
- return 0; // TODO
+ return tableColumns.size();
}
/**
@@ -158,7 +166,7 @@ public class DefaultTableColumnModel
*/
public Enumeration getColumns()
{
- return null; // TODO
+ return tableColumns.elements();
}
/**
@@ -166,9 +174,9 @@ public class DefaultTableColumnModel
* @param value0 TODO
* @return int
*/
- public int getColumnIndex(Object value0)
+ public int getColumnIndex(Object obj)
{
- return 0; // TODO
+ return tableColumns.indexOf(obj, 0);
}
/**
@@ -176,9 +184,9 @@ public class DefaultTableColumnModel
* @param value0 TODO
* @return TableColumn
*/
- public TableColumn getColumn(int value0)
+ public TableColumn getColumn(int i)
{
- return null; // TODO
+ return (TableColumn) tableColumns.get(i);
}
/**
@@ -187,7 +195,7 @@ public class DefaultTableColumnModel
*/
public int getColumnMargin()
{
- return 0; // TODO
+ return columnMargin;
}
/**
@@ -195,9 +203,17 @@ public class DefaultTableColumnModel
* @param value0 TODO
* @return int
*/
- public int getColumnIndexAtX(int value0)
- {
- return 0; // TODO
+ public int getColumnIndexAtX(int x)
+ {
+ for (int i = 0; i < tableColumns.size(); ++i)
+ {
+ int w = ((TableColumn)tableColumns.get(i)).getWidth();
+ if (0 <= x && x < w)
+ return i;
+ else
+ x -= w;
+ }
+ return -1;
}
/**
@@ -206,7 +222,9 @@ public class DefaultTableColumnModel
*/
public int getTotalColumnWidth()
{
- return 0; // TODO
+ if (totalColumnWidth == -1)
+ recalcWidthCache();
+ return totalColumnWidth;
}
/**
@@ -236,9 +254,9 @@ public class DefaultTableColumnModel
* setColumnSelectionAllowed
* @param value0 TODO
*/
- public void setColumnSelectionAllowed(boolean value0)
+ public void setColumnSelectionAllowed(boolean a)
{
- // TODO
+ columnSelectionAllowed = a;
}
/**
@@ -247,7 +265,7 @@ public class DefaultTableColumnModel
*/
public boolean getColumnSelectionAllowed()
{
- return false; // TODO
+ return columnSelectionAllowed;
}
/**
@@ -270,23 +288,32 @@ public class DefaultTableColumnModel
/**
* addColumnModelListener
- * @param value0 TODO
+ * @param listener the listener to add
*/
- public void addColumnModelListener(TableColumnModelListener value0)
+ public void addColumnModelListener(TableColumnModelListener listener)
{
- // TODO
+ listenerList.add(TableColumnModelListener.class, listener);
}
/**
* removeColumnModelListener
- * @param value0 TODO
+ * @param listener the listener to remove
*/
- public void removeColumnModelListener(TableColumnModelListener value0)
+ public void removeColumnModelListener(TableColumnModelListener listener)
{
- // TODO
+ listenerList.remove(TableColumnModelListener.class, listener);
}
/**
+ * @since 1.4
+ */
+ public TableColumnModelListener[] getColumnModelListeners()
+ {
+ return (TableColumnModelListener[])
+ listenerList.getListeners(TableColumnModelListener.class);
+ }
+
+ /**
* fireColumnAdded
* @param value0 TODO
*/
@@ -317,9 +344,11 @@ public class DefaultTableColumnModel
* fireColumnSelectionChanged
* @param value0 TODO
*/
- protected void fireColumnSelectionChanged(ListSelectionEvent value0)
+ protected void fireColumnSelectionChanged(ListSelectionEvent evt)
{
- // TODO
+ EventListener [] listeners = getListeners(TableColumnModelListener.class);
+ for (int i = 0; i < listeners.length; ++i)
+ ((TableColumnModelListener)listeners[i]).columnSelectionChanged(evt);
}
/**
@@ -335,9 +364,9 @@ public class DefaultTableColumnModel
* @param value0 TODO
* @return EventListener[]
*/
- public EventListener[] getListeners(Class value0)
+ public EventListener[] getListeners(Class klass)
{
- return null; // TODO
+ return listenerList.getListeners(klass);
}
/**
@@ -355,7 +384,7 @@ public class DefaultTableColumnModel
*/
public void valueChanged(ListSelectionEvent value0)
{
- // TODO
+ fireColumnSelectionChanged(value0);
}
/**
@@ -372,7 +401,14 @@ public class DefaultTableColumnModel
*/
protected void recalcWidthCache()
{
- // TODO
+ if (totalColumnWidth == -1)
+ {
+ totalColumnWidth = 0;
+ for (int i = 0; i < tableColumns.size(); ++i)
+ {
+ totalColumnWidth += ((TableColumn)tableColumns.get(i)).getWidth();
+ }
+ }
}
/**
@@ -380,6 +416,6 @@ public class DefaultTableColumnModel
*/
private void invalidateWidthCache()
{
- // TODO
+ totalColumnWidth = -1;
}
}
diff --git a/javax/swing/table/DefaultTableModel.java b/javax/swing/table/DefaultTableModel.java
index 5c57f81c6..8e111303c 100644
--- a/javax/swing/table/DefaultTableModel.java
+++ b/javax/swing/table/DefaultTableModel.java
@@ -50,445 +50,387 @@ public class DefaultTableModel extends AbstractTableModel
implements Serializable
{
static final long serialVersionUID = 6680042567037222321L;
-
- //-------------------------------------------------------------
- // Variables --------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * dataVector
- */
- protected Vector dataVector;
-
- /**
- * columnIdentifiers
- */
- protected Vector columnIdentifiers;
-
-
- //-------------------------------------------------------------
- // Initialization ---------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * Constructor DefaultTableModel
- */
- public DefaultTableModel() {
- this(0, 0);
- } // DefaultTableModel()
-
- /**
- * Constructor DefaultTableModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTableModel(int numRows, int numColumns) {
-
- // Variables
- int columnIndex;
- Vector defaultNames;
-
- // Create Column Names
- defaultNames = new Vector();
- for (columnIndex = 0; columnIndex < numColumns; columnIndex++) {
- defaultNames.addElement(super.getColumnName(columnIndex));
- } // for
-
- // Setup Data
-// setDataVector(defaultNames, numRows);
-
- } // DefaultTableModel()
-
- /**
- * Constructor DefaultTableModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTableModel(Vector columnNames, int numRows) {
-
- // Variables
- Vector data;
- Vector rowData;
- int rowIndex;
- int numColumns;
-
- // Create Data
- data = new Vector();
- if (columnNames == null) {
- numColumns = 0;
- } else {
- numColumns = columnNames.size();
- } // if
- for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
- rowData = new Vector();
- rowData.setSize(numColumns);
- data.addElement(rowData);
- } // for
-
- // Setup Data
- setDataVector(data, columnNames);
-
- } // DefaultTableModel()
-
- /**
- * Constructor DefaultTableModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTableModel(Object[] columnNames, int numRows) {
- this(convertToVector(columnNames), numRows);
- } // DefaultTableModel()
-
- /**
- * Constructor DefaultTableModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTableModel(Vector data, Vector columnNames) {
- setDataVector(data, columnNames);
- } // DefaultTableModel()
-
- /**
- * Constructor DefaultTableModel
- * @param value0 TODO
- * @param value1 TODO
- */
- public DefaultTableModel(Object[][] data, Object[] columnNames) {
- this(convertToVector(data), convertToVector(columnNames));
- } // DefaultTableModel()
-
-
- //-------------------------------------------------------------
- // Methods ----------------------------------------------------
- //-------------------------------------------------------------
-
- /**
- * getDataVector
- * @returns Vector
- */
- public Vector getDataVector() {
- return dataVector;
- } // getDataVector()
-
- /**
- * setDataVector
- * @param value0 TODO
- * @param value1 TODO
- */
- public void setDataVector(Vector data, Vector columnNames) {
-
- // Variables
- int rowIndex;
- int numRows;
- int numColumns;
- Vector columnVector;
-
- // Set Data
- dataVector = data;
- columnIdentifiers = columnNames;
-
- // Check Data
- numRows = data.size();
- numColumns = columnNames.size();
- for (rowIndex = 0; rowIndex < numRows; rowIndex++) {
- columnVector = (Vector) dataVector.get(rowIndex);
- columnVector.setSize(numColumns);
- } // for
-
- } // setDataVector()
-
- /**
- * setDataVector
- * @param value0 TODO
- * @param value1 TODO
- */
- public void setDataVector(Object[][] data, Object[] columnNames) {
- setDataVector(convertToVector(data), convertToVector(columnNames));
- } // setDataVector()
-
- /**
- * newDataAvailable
- * @param value0 TODO
- */
- public void newDataAvailable(TableModelEvent event) {
- fireTableChanged(event);
- } // newDataAvailable()
-
- /**
- * newRowsAdded
- * @param value0 TODO
- */
- public void newRowsAdded(TableModelEvent event) {
- // TODO
- } // newRowsAdded()
-
- /**
- * rowsRemoved
- * @param value0 TODO
- */
- public void rowsRemoved(TableModelEvent event) {
- fireTableChanged(event);
- } // rowsRemoved()
-
- /**
- * setColumnIdentifiers
- * @param value0 TODO
- */
- public void setColumnIdentifiers(Vector columnIdentifiers) {
- this.columnIdentifiers = columnIdentifiers;
- setColumnCount(columnIdentifiers.size());
- } // setColumnIdentifiers()
-
- /**
- * setColumnIdentifiers
- * @param value0 TODO
- */
- public void setColumnIdentifiers(Object[] columnIdentifiers) {
- setColumnIdentifiers(convertToVector(columnIdentifiers));
- } // setColumnIdentifiers()
-
- /**
- * setNumRows
- * @param value0 TODO
- */
- public void setNumRows(int numRows) {
- setRowCount(numRows);
- } // setNumRows()
-
- /**
- * setRowCount
- * @param value0 TODO
- */
- public void setRowCount(int rowCount) {
- // TODO
- } // setRowCount()
-
- /**
- * setColumnCount
- * @param value0 TODO
- */
- public void setColumnCount(int columnCount) {
- // TODO
- } // setColumnCount()
-
- /**
- * addColumn
- * @param value0 TODO
- */
- public void addColumn(Object columnName) {
- addColumn(columnName, new Vector(dataVector.size()));
- } // addColumn()
-
- /**
- * addColumn
- * @param value0 TODO
- * @param value1 TODO
- */
- public void addColumn(Object columnName, Vector columnData) {
- // TODO
- } // addColumn()
-
- /**
- * addColumn
- * @param value0 TODO
- * @param value1 TODO
- */
- public void addColumn(Object columnName, Object[] columnData) {
- // TODO
- } // addColumn()
-
- /**
- * addRow
- * @param value0 TODO
- */
- public void addRow(Vector rowData) {
- // TODO
- } // addRow()
-
- /**
- * addRow
- * @param value0 TODO
- */
- public void addRow(Object[] rowData) {
- addRow(convertToVector(rowData));
- } // addRow()
-
- /**
- * insertRow
- * @param value0 TODO
- * @param value1 TODO
- */
- public void insertRow(int row, Vector rowData) {
- dataVector.add(row, rowData);
- } // insertRow()
-
- /**
- * insertRow
- * @param value0 TODO
- * @param value1 TODO
- */
- public void insertRow(int row, Object[] rowData) {
- insertRow(row, convertToVector(rowData));
- } // insertRow()
-
- /**
- * moveRow
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void moveRow(int startIndex, int endIndex, int toIndex) {
-
- // Variables
- int index;
- Vector vector;
-
- // Move Rows
- for (index = 0; index < (endIndex - startIndex); index++) {
- vector = (Vector) dataVector.remove(startIndex);
- dataVector.add(toIndex, vector);
- } // for
-
- } // moveRow()
-
- /**
- * removeRow
- * @param value0 TODO
- */
- public void removeRow(int row) {
- dataVector.remove(row);
- } // removeRow()
-
- /**
- * getRowCount
- * @returns int
- */
- public int getRowCount() {
- return dataVector.size();
- } // getRowCount()
-
- /**
- * getColumnCount
- * @returns int
- */
- public int getColumnCount() {
- return columnIdentifiers.size();
- } // getColumnCount()
-
- /**
- * getColumnName
- * @param value0 TODO
- * @returns String
- */
- public String getColumnName(int column) {
-
- // Check for Column
- if (columnIdentifiers == null || column >= getColumnCount()) {
- return super.getColumnName(column);
- } // if
-
- // Return Column name
- return (String) columnIdentifiers.get(column);
-
- } // getColumnName()
-
- /**
- * isCellEditable
- * @param value0 TODO
- * @param value1 TODO
- * @returns boolean
- */
- public boolean isCellEditable(int row, int column) {
- return true;
- } // isCellEditable()
-
- /**
- * getValueAt
- * @param value0 TODO
- * @param value1 TODO
- * @returns Object
- */
- public Object getValueAt(int row, int column) {
-
- // Variables
- Vector rowVector;
-
- // Get Row Vector
- rowVector = (Vector) dataVector.get(row);
-
- // Get Data
- return rowVector.get(column);
-
- } // getValueAt()
-
- /**
- * setValueAt
- * @param value0 TODO
- * @param value1 TODO
- * @param value2 TODO
- */
- public void setValueAt(Object value, int row, int column) {
-
- // Variables
- Vector rowVector;
-
- // Get Row Vector
- rowVector = (Vector) dataVector.get(row);
-
- // Set Data
- rowVector.remove(column);
- rowVector.add(column, value);
-
- } // setValueAt()
-
- /**
- * convertToVector
- * @param value0 TODO
- * @returns Vector
- */
- protected static Vector convertToVector(Object[] data) {
-
- // Variables
- int index;
- Vector vector;
-
- // Check for null
- if (data == null) {
- return null;
- } // if
-
- // Process
- vector = new Vector();
- for (index = 0; index < data.length; index++) {
- vector.add(data[index]);
- } // for: index
-
- // Return new Vector
- return vector;
-
- } // convertToVector()
-
- /**
- * convertToVector
- * @param value0 TODO
- * @returns Vector
- */
- protected static Vector convertToVector(Object[][] data) {
-
- // Variables
- int index;
- Vector vector;
-
- // Process
- vector = new Vector();
- for (index = 0; index < data.length; index++) {
- vector.add(convertToVector(data[index]));
- } // for: index
-
- // Return new Vector
- return vector;
-
- } // convertToVector()
-
-
-} // DefaultTableModel
+ /**
+ * dataVector
+ */
+ protected Vector dataVector;
+
+ /**
+ * columnIdentifiers
+ */
+ protected Vector columnIdentifiers;
+
+ /**
+ * Constructor DefaultTableModel
+ */
+ public DefaultTableModel()
+ {
+ this(0, 0);
+ }
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(int numRows, int numColumns)
+ {
+ Vector defaultNames = new Vector(numColumns);
+ Vector data = new Vector(numRows);
+ for (int i = 0; i < numColumns; i++)
+ {
+ defaultNames.add(super.getColumnName(i));
+ Vector tmp = new Vector(numColumns);
+ tmp.setSize(numColumns);
+ data.add(tmp);
+ }
+ setDataVector(defaultNames, data);
+ }
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Vector columnNames, int numRows)
+ {
+ Vector data = new Vector();
+ int numColumns = 0;
+
+ if (columnNames != null)
+ numColumns = columnNames.size();
+
+ while (0 < numRows--)
+ {
+ Vector rowData = new Vector();
+ rowData.setSize(numColumns);
+ data.add(rowData);
+ }
+ setDataVector(data, columnNames);
+ }
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Object[] columnNames, int numRows)
+ {
+ this(convertToVector(columnNames), numRows);
+ }
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Vector data, Vector columnNames)
+ {
+ setDataVector(data, columnNames);
+ }
+
+ /**
+ * Constructor DefaultTableModel
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public DefaultTableModel(Object[][] data, Object[] columnNames)
+ {
+ this(convertToVector(data), convertToVector(columnNames));
+ }
+
+ /**
+ * getDataVector
+ * @returns Vector
+ */
+ public Vector getDataVector()
+ {
+ return dataVector;
+ }
+
+ /**
+ * setDataVector
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void setDataVector(Vector data, Vector columnNames)
+ {
+ dataVector = data;
+ columnIdentifiers = columnNames;
+ for (int r = 0; r < data.size(); r++) {
+ ((Vector) dataVector.get(r)).setSize(columnNames.size());
+ }
+ }
+
+ /**
+ * setDataVector
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void setDataVector(Object[][] data, Object[] columnNames)
+ {
+ setDataVector(convertToVector(data),
+ convertToVector(columnNames));
+ }
+
+ /**
+ * newDataAvailable
+ * @param value0 TODO
+ */
+ public void newDataAvailable(TableModelEvent event)
+ {
+ fireTableChanged(event);
+ }
+
+ /**
+ * newRowsAdded
+ * @param value0 TODO
+ */
+ public void newRowsAdded(TableModelEvent event)
+ {
+ fireTableChanged(event);
+ }
+
+ /**
+ * rowsRemoved
+ * @param value0 TODO
+ */
+ public void rowsRemoved(TableModelEvent event)
+ {
+ fireTableChanged(event);
+ }
+
+ /**
+ * setColumnIdentifiers
+ * @param value0 TODO
+ */
+ public void setColumnIdentifiers(Vector columnIdentifiers)
+ {
+ this.columnIdentifiers = columnIdentifiers;
+ setColumnCount(columnIdentifiers.size());
+ }
+
+ /**
+ * setColumnIdentifiers
+ * @param value0 TODO
+ */
+ public void setColumnIdentifiers(Object[] columnIdentifiers)
+ {
+ setColumnIdentifiers(convertToVector(columnIdentifiers));
+ }
+
+ /**
+ * setNumRows
+ * @param value0 TODO
+ */
+ public void setNumRows(int numRows)
+ {
+ setRowCount(numRows);
+ }
+
+ /**
+ * setRowCount
+ * @param value0 TODO
+ */
+ public void setRowCount(int rowCount)
+ {
+ dataVector.setSize(rowCount);
+ fireTableDataChanged();
+ }
+
+ /**
+ * setColumnCount
+ * @param value0 TODO
+ */
+ public void setColumnCount(int columnCount)
+ {
+ for (int i = 0; i < dataVector.size(); ++i)
+ {
+ ((Vector) dataVector.get(i)).setSize(columnCount);
+ }
+ columnIdentifiers.setSize(columnCount);
+ fireTableDataChanged();
+ }
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ */
+ public void addColumn(Object columnName)
+ {
+ addColumn(columnName, (Object[]) null);
+ }
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void addColumn(Object columnName, Vector columnData)
+ {
+ addColumn(columnName, columnData == null ? null : columnData.toArray());
+ }
+
+ /**
+ * addColumn
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void addColumn(Object columnName, Object[] columnData) {
+ for (int i = 0; i < dataVector.size(); ++i)
+ {
+ ((Vector) dataVector.get(i)).add(columnData == null ? null : columnData[i]);
+ }
+ columnIdentifiers.add(columnName);
+ fireTableDataChanged();
+ }
+
+ /**
+ * addRow
+ * @param value0 TODO
+ */
+ public void addRow(Vector rowData) {
+ dataVector.add(rowData);
+ fireTableDataChanged();
+ }
+
+ /**
+ * addRow
+ * @param value0 TODO
+ */
+ public void addRow(Object[] rowData) {
+ addRow(convertToVector(rowData));
+ }
+
+ /**
+ * insertRow
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void insertRow(int row, Vector rowData) {
+ dataVector.add(row, rowData);
+ fireTableDataChanged();
+ }
+
+ /**
+ * insertRow
+ * @param value0 TODO
+ * @param value1 TODO
+ */
+ public void insertRow(int row, Object[] rowData) {
+ insertRow(row, convertToVector(rowData));
+ }
+
+ /**
+ * moveRow
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void moveRow(int startIndex, int endIndex, int toIndex) {
+ for (int index = 0; index < (endIndex - startIndex); index++) {
+ Vector vector = (Vector) dataVector.remove(startIndex);
+ dataVector.add(toIndex, vector);
+ }
+ fireTableDataChanged();
+ }
+
+ /**
+ * removeRow
+ * @param value0 TODO
+ */
+ public void removeRow(int row) {
+ dataVector.remove(row);
+ fireTableDataChanged();
+ }
+
+ /**
+ * getRowCount
+ * @returns int
+ */
+ public int getRowCount() {
+ return dataVector.size();
+ }
+
+ /**
+ * getColumnCount
+ * @returns int
+ */
+ public int getColumnCount() {
+ return columnIdentifiers.size();
+ }
+
+ /**
+ * getColumnName
+ * @param value0 TODO
+ * @returns String
+ */
+ public String getColumnName(int column) {
+ // Check for Column
+ if (columnIdentifiers == null || column >= getColumnCount()) {
+ return super.getColumnName(column);
+ }
+
+ // Return Column name
+ return (String) columnIdentifiers.get(column);
+ }
+
+ /**
+ * isCellEditable
+ * @param value0 TODO
+ * @param value1 TODO
+ * @returns boolean
+ */
+ public boolean isCellEditable(int row, int column) {
+ return true;
+ }
+
+ /**
+ * getValueAt
+ * @param value0 TODO
+ * @param value1 TODO
+ * @returns Object
+ */
+ public Object getValueAt(int row, int column) {
+ return ((Vector) dataVector.get(row)).get(column);
+ }
+
+ /**
+ * setValueAt
+ * @param value0 TODO
+ * @param value1 TODO
+ * @param value2 TODO
+ */
+ public void setValueAt(Object value, int row, int column) {
+ ((Vector) dataVector.get(row)).set(column, value);
+ fireTableDataChanged();
+ }
+
+ /**
+ * convertToVector
+ * @param value0 TODO
+ * @returns Vector
+ */
+ protected static Vector convertToVector(Object[] data) {
+ if (data == null)
+ return null;
+ Vector vector = new Vector(data.length);
+ for (int i = 0; i < data.length; i++)
+ vector.add(data[i]);
+ return vector;
+ }
+
+ /**
+ * convertToVector
+ * @param value0 TODO
+ * @returns Vector
+ */
+ protected static Vector convertToVector(Object[][] data) {
+ if (data == null)
+ return null;
+ Vector vector = new Vector(data.length);
+ for (int i = 0; i < data.length; i++)
+ vector.add(convertToVector(data[i]));
+ return vector;
+ }
+}
diff --git a/javax/swing/table/JTableHeader.java b/javax/swing/table/JTableHeader.java
index 0063d77ef..132232bb7 100644
--- a/javax/swing/table/JTableHeader.java
+++ b/javax/swing/table/JTableHeader.java
@@ -38,29 +38,321 @@ exception statement from your version. */
package javax.swing.table;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.util.Locale;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleAction;
+import javax.accessibility.AccessibleComponent;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleStateSet;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleText;
+import javax.accessibility.AccessibleValue;
import javax.swing.JComponent;
import javax.swing.JTable;
+import javax.swing.UIManager;
+import javax.swing.plaf.TableHeaderUI;
public class JTableHeader extends JComponent
{
- protected class AccessibleJTableHeader
+ protected class AccessibleJTableHeader extends AccessibleJComponent
{
- protected class AccessibleJTableHeaderEntry
+ protected class AccessibleJTableHeaderEntry extends AccessibleContext
+ implements Accessible, AccessibleComponent
{
- }
+ public void addFocusListener(FocusListener l)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener l)
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean contains(Point p)
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleAction getAccessibleAction()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Accessible getAccessibleAt(Point p)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Accessible getAccessibleChild(int i)
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getAccessibleChildrenCount()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleComponent getAccessibleComponent()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ throw new Error("not implemented");
+ }
+
+ public String getAccessibleDescription()
+ {
+ throw new Error("not implemented");
+ }
+
+ public int getAccessibleIndexInParent()
+ {
+ throw new Error("not implemented");
+ }
+
+ public String getAccessibleName()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleRole getAccessibleRole()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleSelection getAccessibleSelection()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleStateSet getAccessibleStateSet()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleText getAccessibleText()
+ {
+ throw new Error("not implemented");
+ }
+
+ public AccessibleValue getAccessibleValue()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Color getBackground()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Rectangle getBounds()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Cursor getCursor()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Font getFont()
+ {
+ throw new Error("not implemented");
+ }
+
+ public FontMetrics getFontMetrics(Font f)
+ {
+ throw new Error("not implemented");
+ }
+
+ public Color getForeground()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Locale getLocale()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Point getLocation()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Point getLocationOnScreen()
+ {
+ throw new Error("not implemented");
+ }
+
+ public Dimension getSize()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean isEnabled()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean isFocusTraversable()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean isShowing()
+ {
+ throw new Error("not implemented");
+ }
+
+ public boolean isVisible()
+ {
+ throw new Error("not implemented");
+ }
+
+ public void removeFocusListener(FocusListener l)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void removePropertyChangeListener(PropertyChangeListener l)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void requestFocus()
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setAccessibleDescription(String s)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setAccessibleName(String s)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setBackground(Color c)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setBounds(Rectangle r)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setCursor(Cursor c)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setEnabled(boolean b)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setFont(Font f)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setForeground(Color c)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setLocation(Point p)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setSize(Dimension d)
+ {
+ throw new Error("not implemented");
+ }
+
+ public void setVisible(boolean b)
+ {
+ throw new Error("not implemented");
+ }
+ };
}
private static final long serialVersionUID = 5144633983372967710L;
+ /**
+ * The accessibleContext property.
+ */
+ AccessibleContext accessibleContext;
+
+ /**
+ * The columnModel property.
+ */
protected TableColumnModel columnModel;
+
+ /**
+ * The draggedColumn property.
+ */
protected TableColumn draggedColumn;
+
+ /**
+ * The draggedDistance property.
+ */
protected int draggedDistance;
+
+ /**
+ * The opaque property.
+ */
+ boolean opaque;
+
+ /**
+ * The reorderingAllowed property.
+ */
protected boolean reorderingAllowed;
- protected boolean resizingAllowed;
+
+ /**
+ * The resizingAllowed property.
+ */
+ protected boolean resizingAllowed = true;
+
+ /**
+ * The resizingColumn property.
+ */
protected TableColumn resizingColumn;
+
+ /**
+ * The table property.
+ */
protected JTable table;
+
+ /**
+ * The updateTableInRealTime property.
+ */
protected boolean updateTableInRealTime;
+ TableCellRenderer cellRenderer;
+
public JTableHeader()
{
this(null);
@@ -68,13 +360,262 @@ public class JTableHeader extends JComponent
public JTableHeader(TableColumnModel cm)
{
- super();
-
- this.columnModel = cm == null ? createDefaultColumnModel() : cm;
+ accessibleContext = new AccessibleJTableHeader();
+ columnModel = cm == null ? createDefaultColumnModel() : cm;
+ draggedColumn = null;
+ draggedDistance = 0;
+ opaque = true;
+ reorderingAllowed = true;
+ resizingAllowed = true;
+ resizingColumn = null;
+ table = null;
+ updateTableInRealTime = true;
+ cellRenderer = createDefaultRenderer();
+ updateUI();
}
protected TableColumnModel createDefaultColumnModel()
{
return new DefaultTableColumnModel();
}
+
+ /**
+ * Get the value of the {@link #accessibleContext} property.
+ *
+ * @return The current value of the property
+ */
+ public AccessibleContext getAccessibleContext()
+ {
+ return accessibleContext;
+ }
+
+ /**
+ * Get the value of the {@link #columnModel} property.
+ *
+ * @return The current value of the property
+ */
+ public TableColumnModel getColumnModel()
+ {
+ return columnModel;
+ }
+
+ /**
+ * Get the value of the {@link #draggedColumn} property.
+ *
+ * @return The current value of the property
+ */
+ public TableColumn getDraggedColumn()
+ {
+ return draggedColumn;
+ }
+
+ /**
+ * Get the value of the {@link #draggedDistance} property.
+ *
+ * @return The current value of the property
+ */
+ public int getDraggedDistance()
+ {
+ return draggedDistance;
+ }
+
+ /**
+ * Get the value of the {@link #reorderingAllowed} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getReorderingAllowed()
+ {
+ return reorderingAllowed;
+ }
+
+ /**
+ * Get the value of the {@link #resizingAllowed} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getResizingAllowed()
+ {
+ return resizingAllowed;
+ }
+
+ /**
+ * Get the value of the {@link #resizingColumn} property.
+ *
+ * @return The current value of the property
+ */
+ public TableColumn getResizingColumn()
+ {
+ return resizingColumn;
+ }
+
+ /**
+ * Get the value of the {@link #table} property.
+ *
+ * @return The current value of the property
+ */
+ public JTable getTable()
+ {
+ return table;
+ }
+
+ /**
+ * Get the value of the {@link #updateTableInRealTime} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean getUpdateTableInRealTime()
+ {
+ return updateTableInRealTime;
+ }
+
+ /**
+ * Get the value of the {@link #opaque} property.
+ *
+ * @return The current value of the property
+ */
+ public boolean isOpaque()
+ {
+ return opaque;
+ }
+
+ /**
+ * Set the value of the {@link #columnModel} property.
+ *
+ * @param c The new value of the property
+ */
+ public void setColumnModel(TableColumnModel c)
+ {
+ columnModel = c;
+ }
+
+ /**
+ * Set the value of the {@link #draggedColumn} property.
+ *
+ * @param d The new value of the property
+ */
+ public void setDraggedColumn(TableColumn d)
+ {
+ draggedColumn = d;
+ }
+
+ /**
+ * Set the value of the {@link #draggedDistance} property.
+ *
+ * @param d The new value of the property
+ */
+ public void setDraggedDistance(int d)
+ {
+ draggedDistance = d;
+ }
+
+ /**
+ * Set the value of the {@link #opaque} property.
+ *
+ * @param o The new value of the property
+ */
+ public void setOpaque(boolean o)
+ {
+ opaque = o;
+ }
+
+ /**
+ * Set the value of the {@link #reorderingAllowed} property.
+ *
+ * @param r The new value of the property
+ */
+ public void setReorderingAllowed(boolean r)
+ {
+ reorderingAllowed = r;
+ }
+
+ /**
+ * Set the value of the {@link #resizingAllowed} property.
+ *
+ * @param r The new value of the property
+ */
+ public void setResizingAllowed(boolean r)
+ {
+ resizingAllowed = r;
+ }
+
+ /**
+ * Set the value of the {@link #resizingColumn} property.
+ *
+ * @param r The new value of the property
+ */
+ public void setResizingColumn(TableColumn r)
+ {
+ resizingColumn = r;
+ }
+
+ /**
+ * Set the value of the {@link #table} property.
+ *
+ * @param t The new value of the property
+ */
+ public void setTable(JTable t)
+ {
+ table = t;
+ }
+
+ /**
+ * Set the value of the {@link #updateTableInRealTime} property.
+ *
+ * @param u The new value of the property
+ */
+ public void setUpdateTableInRealTime(boolean u)
+ {
+ updateTableInRealTime = u;
+ }
+
+ protected TableCellRenderer createDefaultRenderer()
+ {
+ return new DefaultTableCellRenderer();
+ }
+
+ public TableCellRenderer getDefaultRenderer()
+ {
+ return cellRenderer;
+ }
+
+ public void setDefaultRenderer(TableCellRenderer cellRenderer)
+ {
+ this.cellRenderer = cellRenderer;
+ }
+
+ public Rectangle getHeaderRect(int column)
+ {
+ Rectangle r = getTable().getCellRect(-1, column, true);
+ r.height = getHeight();
+ return r;
+ }
+
+ protected String paramString()
+ {
+ return "JTableHeader";
+ }
+
+ // UI support
+
+ public String getUIClassID()
+ {
+ return "TableHeaderUI";
+ }
+
+ public TableHeaderUI getUI()
+ {
+ return (TableHeaderUI) ui;
+ }
+
+ public void setUI(TableHeaderUI u)
+ {
+ super.setUI(u);
+ }
+
+ public void updateUI()
+ {
+ setUI((TableHeaderUI) UIManager.getUI(this));
+ }
+
}
diff --git a/javax/swing/table/TableColumn.java b/javax/swing/table/TableColumn.java
index 0be179508..1c19fb9f6 100644
--- a/javax/swing/table/TableColumn.java
+++ b/javax/swing/table/TableColumn.java
@@ -1,5 +1,5 @@
/* TableColumn.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -505,6 +505,14 @@ public class TableColumn
}
/**
+ * @since 1.4
+ */
+ public PropertyChangeListener[] getPropertyChangeListeners()
+ {
+ return changeSupport.getPropertyChangeListeners();
+ }
+
+ /**
* createDefaultHeaderRenderer
* @return TableCellRenderer
*/
diff --git a/javax/swing/text/AbstractDocument.java b/javax/swing/text/AbstractDocument.java
index 322deb06a..3f28dd124 100644
--- a/javax/swing/text/AbstractDocument.java
+++ b/javax/swing/text/AbstractDocument.java
@@ -38,6 +38,7 @@ exception statement from your version. */
package javax.swing.text;
import java.io.Serializable;
+import java.util.Collections;
import java.util.Dictionary;
import java.util.Enumeration;
import java.util.EventListener;
@@ -63,33 +64,37 @@ public abstract class AbstractDocument
public static final String ParagraphElementName = "paragraph";
public static final String SectionElementName = "section";
public static final String ElementNameAttribute = "$ename";
+
Content content;
+ AttributeContext context;
protected EventListenerList listenerList = new EventListenerList();
protected AbstractDocument(Content doc)
{
- this(doc, null);
+ this(doc, StyleContext.getDefaultStyleContext());
}
- protected AbstractDocument(Content doc, AttributeContext context)
+ protected AbstractDocument(Content doc, AttributeContext ctx)
{
content = doc;
+ context = ctx;
}
- // these still need to be implemented by a derived class:
+ // These still need to be implemented by a derived class:
public abstract Element getParagraphElement(int pos);
public abstract Element getDefaultRootElement();
- protected Element createBranchElement(Element parent, AttributeSet a)
+ protected Element createBranchElement(Element parent,
+ AttributeSet attributes)
{
- return new BranchElement(parent, a, 0, 0);
+ return new BranchElement(parent, attributes);
}
- protected Element createLeafElement(Element parent, AttributeSet a, int p0,
- int p1)
+ protected Element createLeafElement(Element parent, AttributeSet attributes,
+ int start, int end)
{
- return new LeafElement(parent, a, p0, p1 - p0);
+ return new LeafElement(parent, attributes, start, end);
}
public Position createPosition(final int offset) throws BadLocationException
@@ -145,7 +150,7 @@ public abstract class AbstractDocument
protected AttributeContext getAttributeContext()
{
- return null;
+ return context;
}
public Element getBidiRootElement()
@@ -170,7 +175,13 @@ public abstract class AbstractDocument
public Position getEndPosition()
{
- return null;
+ return new Position()
+ {
+ public int getOffset()
+ {
+ return getLength();
+ }
+ };
}
public int getLength()
@@ -190,12 +201,20 @@ public abstract class AbstractDocument
public Element[] getRootElements()
{
- return null;
+ Element[] elements = new Element[1];
+ elements[0] = getDefaultRootElement();
+ return elements;
}
public Position getStartPosition()
{
- return null;
+ return new Position()
+ {
+ public int getOffset()
+ {
+ return 0;
+ }
+ };
}
public String getText(int offset, int length) throws BadLocationException
@@ -203,34 +222,25 @@ public abstract class AbstractDocument
return content.getString(offset, length);
}
- public void getText(int offset, int length, Segment txt)
+ public void getText(int offset, int length, Segment segment)
throws BadLocationException
{
- String a = getText(offset, length);
-
- if (a == null)
- {
- txt.offset = 0;
- txt.count = 0;
- txt.array = new char[0];
-
- return;
- }
-
- txt.offset = offset;
- txt.count = length;
-
- char[] chars = new char[a.length()];
-
- a.getChars(0, a.length(), chars, 0);
-
- txt.array = chars;
+ content.getChars(offset, length, segment);
}
- public void insertString(int offs, String str, AttributeSet a)
+ public void insertString(int offset, String text, AttributeSet attributes)
throws BadLocationException
{
- content.insertString(offs, str);
+ // Just return when no text to insert was given.
+ if (text == null || text.length() == 0)
+ return;
+
+ DefaultDocumentEvent event =
+ new DefaultDocumentEvent(offset, text.length(),
+ DocumentEvent.EventType.INSERT);
+ content.insertString(offset, text);
+ insertUpdate(event, attributes);
+ fireInsertUpdate(event);
}
protected void insertUpdate(DefaultDocumentEvent chng, AttributeSet attr)
@@ -255,6 +265,26 @@ public abstract class AbstractDocument
public void remove(int offset, int length) throws BadLocationException
{
+ DefaultDocumentEvent event =
+ new DefaultDocumentEvent(offset, length,
+ DocumentEvent.EventType.REMOVE);
+ removeUpdate(event);
+ content.remove(offset, length);
+ postRemoveUpdate(event);
+ fireRemoveUpdate(event);
+ }
+
+ /**
+ * Replaces some text in the document.
+ *
+ * @since 1.4
+ */
+ public void replace(int offset, int length, String text,
+ AttributeSet attributes)
+ throws BadLocationException
+ {
+ remove(offset, length);
+ insertString(offset, text, attributes);
}
/**
@@ -375,47 +405,51 @@ public abstract class AbstractDocument
}
public abstract class AbstractElement
- implements Element, TreeNode, Serializable
+ implements Element, MutableAttributeSet, TreeNode, Serializable
{
private static final long serialVersionUID = 1265312733007397733L;
int count;
int offset;
- AttributeSet attr;
- Vector elts = new Vector();
- String name;
- Element parent;
- Vector kids = new Vector();
+
+ AttributeSet attributes;
+
+ Element element_parent;
+ Vector element_children;
+
TreeNode tree_parent;
+ Vector tree_children;
public AbstractElement(Element p, AttributeSet s)
{
- parent = p;
- attr = s;
+ element_parent = p;
+ attributes = s;
}
+ // TreeNode implementation
+
public Enumeration children()
{
- return kids.elements();
+ return Collections.enumeration(tree_children);
}
-
+
public boolean getAllowsChildren()
{
return true;
}
-
+
public TreeNode getChildAt(int index)
{
- return (TreeNode) kids.elementAt(index);
+ return (TreeNode) tree_children.get(index);
}
-
+
public int getChildCount()
{
- return kids.size();
+ return tree_children.size();
}
-
+
public int getIndex(TreeNode node)
{
- return kids.indexOf(node);
+ return tree_children.indexOf(node);
}
public TreeNode getParent()
@@ -423,55 +457,134 @@ public abstract class AbstractDocument
return tree_parent;
}
+ public abstract boolean isLeaf();
+
+
+ // MutableAttributeSet support
+
+ public void addAttribute(Object name, Object value)
+ {
+ attributes = getAttributeContext().addAttribute(attributes, name, value);
+ }
+
+ public void addAttributes(AttributeSet attrs)
+ {
+ attributes = getAttributeContext().addAttributes(attributes, attrs);
+ }
+
+ public void removeAttribute(Object name)
+ {
+ attributes = getAttributeContext().removeAttribute(attributes, name);
+ }
+
+ public void removeAttributes(AttributeSet attrs)
+ {
+ attributes = getAttributeContext().removeAttributes(attributes, attrs);
+ }
+
+ public void removeAttributes(Enumeration names)
+ {
+ attributes = getAttributeContext().removeAttributes(attributes, names);
+ }
+
+ public void setResolveParent(AttributeSet parent)
+ {
+ attributes = getAttributeContext().addAttribute(attributes, ResolveAttribute, parent);
+ }
+
+
+ // AttributeSet interface support
+
+ public boolean containsAttribute(Object name, Object value)
+ {
+ return attributes.containsAttribute(name, value);
+ }
+
+ public boolean containsAttributes(AttributeSet attrs)
+ {
+ return attributes.containsAttributes(attrs);
+ }
+
+ public AttributeSet copyAttributes()
+ {
+ return attributes.copyAttributes();
+ }
+
+ public Object getAttribute(Object key)
+ {
+ return attributes.getAttribute(key);
+ }
+
+ public int getAttributeCount()
+ {
+ return attributes.getAttributeCount();
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return attributes.getAttributeNames();
+ }
+
+ public AttributeSet getResolveParent()
+ {
+ return attributes.getResolveParent();
+ }
+
+ public boolean isDefined(Object attrName)
+ {
+ return attributes.isDefined(attrName);
+ }
+
+ public boolean isEqual(AttributeSet attrs)
+ {
+ return attributes.isEqual(attrs);
+ }
+
+ // Element interface support
+
public AttributeSet getAttributes()
{
- return attr;
+ return attributes;
}
public Document getDocument()
{
return AbstractDocument.this;
}
-
+
public Element getElement(int index)
{
- return (Element) elts.elementAt(index);
+ return (Element) element_children.get(index);
}
-
+
public String getName()
{
- return name;
+ return (String) getAttribute(NameAttribute);
}
-
+
public Element getParentElement()
{
- return parent;
+ return element_parent;
}
-
- public abstract boolean isLeaf();
-
+
public abstract int getEndOffset();
-
+
public abstract int getElementCount();
-
+
public abstract int getElementIndex(int offset);
-
+
public abstract int getStartOffset();
}
public class BranchElement extends AbstractElement
{
private static final long serialVersionUID = -8595176318868717313L;
- private int start;
- private int end;
+
private Vector children = new Vector();
- public BranchElement(Element parent, AttributeSet attributes, int start,
- int end)
+ public BranchElement(Element parent, AttributeSet attributes)
{
super(parent, attributes);
- this.start = start;
- this.end = end;
}
public Enumeration children()
@@ -486,6 +599,9 @@ public abstract class AbstractDocument
public Element getElement(int index)
{
+ if (index < 0 || index >= children.size())
+ return null;
+
return (Element) children.get(index);
}
@@ -496,12 +612,20 @@ public abstract class AbstractDocument
public int getElementIndex(int offset)
{
- return children.indexOf(positionToElement(offset));
+ if (children.size() == 0)
+ return 0;
+
+ Element element = positionToElement(offset);
+
+ if (element == null)
+ return 0;
+
+ return children.indexOf(element);
}
public int getEndOffset()
{
- return end;
+ return ((Element) children.lastElement()).getEndOffset();
}
public String getName()
@@ -511,7 +635,7 @@ public abstract class AbstractDocument
public int getStartOffset()
{
- return start;
+ return ((Element) children.firstElement()).getStartOffset();
}
public boolean isLeaf()
@@ -554,8 +678,18 @@ public abstract class AbstractDocument
implements DocumentEvent
{
private static final long serialVersionUID = -7406103236022413522L;
- public int len;
- public int off;
+
+ private int offset;
+ private int length;
+ private DocumentEvent.EventType type;
+
+ public DefaultDocumentEvent(int offset, int length,
+ DocumentEvent.EventType type)
+ {
+ this.offset = offset;
+ this.length = length;
+ this.type = type;
+ }
public Document getDocument()
{
@@ -564,17 +698,17 @@ public abstract class AbstractDocument
public int getLength()
{
- return len;
+ return length;
}
public int getOffset()
{
- return off;
+ return offset;
}
public DocumentEvent.EventType getType()
{
- return null;
+ return type;
}
public DocumentEvent.ElementChange getChange(Element elem)
@@ -584,8 +718,43 @@ public abstract class AbstractDocument
}
public static class ElementEdit extends AbstractUndoableEdit
+ implements DocumentEvent.ElementChange
{
private static final long serialVersionUID = -1216620962142928304L;
+
+ private Element elem;
+ private int index;
+ private Element[] removed;
+ private Element[] added;
+
+ public ElementEdit(Element elem, int index,
+ Element[] removed, Element[] added)
+ {
+ this.elem = elem;
+ this.index = index;
+ this.removed = removed;
+ this.added = added;
+ }
+
+ public Element[] getChildrenAdded()
+ {
+ return added;
+ }
+
+ public Element[] getChildrenRemoved()
+ {
+ return removed;
+ }
+
+ public Element getElement()
+ {
+ return elem;
+ }
+
+ public int getIndex()
+ {
+ return index;
+ }
}
public class LeafElement extends AbstractElement
diff --git a/javax/swing/text/AttributeSet.java b/javax/swing/text/AttributeSet.java
index 19f90a0f4..3f38a4cd2 100644
--- a/javax/swing/text/AttributeSet.java
+++ b/javax/swing/text/AttributeSet.java
@@ -56,7 +56,10 @@ public interface AttributeSet
static interface ParagraphAttribute
{
}
-
+
+ static Object NameAttribute = StyleConstants.NameAttribute;
+ static Object ResolveAttribute = StyleConstants.ResolveAttribute;
+
boolean containsAttribute(Object name, Object value);
boolean containsAttributes(AttributeSet attributes);
AttributeSet copyAttributes();
diff --git a/javax/swing/text/DefaultCaret.java b/javax/swing/text/DefaultCaret.java
index 968bf1ffd..516f0726b 100644
--- a/javax/swing/text/DefaultCaret.java
+++ b/javax/swing/text/DefaultCaret.java
@@ -61,15 +61,15 @@ public class DefaultCaret extends Rectangle
protected ChangeEvent changeEvent = new ChangeEvent(this);
protected EventListenerList listenerList = new EventListenerList();
- Color color = new Color(0, 0, 0);
- JTextComponent parent;
- Point magic = null;
- int mark = 0;
- boolean vis_sel = true;
- int blink = 500;
- int dot = 0;
- boolean vis = true;
-
+ private JTextComponent textComponent;
+
+ private boolean selectionVisible = true;
+ private int blinkRate = 0;
+ private int dot = 0;
+ private int mark = 0;
+ private Point magicCaretPosition = null;
+ private boolean visible = true;
+ private Object highlightEntry;
public void mouseDragged(MouseEvent event)
{
@@ -117,27 +117,29 @@ public class DefaultCaret extends Rectangle
public void deinstall(JTextComponent c)
{
- parent.removeFocusListener(this);
- parent.removeMouseListener(this);
- parent = null;
+ textComponent.removeFocusListener(this);
+ textComponent.removeMouseListener(this);
+ textComponent.removeMouseMotionListener(this);
+ textComponent = null;
}
public void install(JTextComponent c)
{
- parent.addFocusListener(this);
- parent.addMouseListener(this);
- parent = c;
+ textComponent = c;
+ textComponent.addFocusListener(this);
+ textComponent.addMouseListener(this);
+ textComponent.addMouseMotionListener(this);
repaint();
}
public void setMagicCaretPosition(Point p)
{
- magic = p;
+ magicCaretPosition = p;
}
public Point getMagicCaretPosition()
{
- return magic;
+ return magicCaretPosition;
}
public int getMark()
@@ -145,27 +147,92 @@ public class DefaultCaret extends Rectangle
return mark;
}
+ private void handleHighlight()
+ {
+ Highlighter highlighter = textComponent.getHighlighter();
+
+ if (highlighter == null)
+ return;
+
+ int p0 = Math.min(dot, mark);
+ int p1 = Math.max(dot, mark);
+
+ if (selectionVisible && p0 != p1)
+ {
+ try
+ {
+ if (highlightEntry == null)
+ highlightEntry = highlighter.addHighlight(p0, p1, getSelectionPainter());
+ else
+ highlighter.changeHighlight(highlightEntry, p0, p1);
+ }
+ catch (BadLocationException e)
+ {
+ // This should never happen.
+ throw new InternalError();
+ }
+ }
+ else
+ {
+ if (highlightEntry != null)
+ {
+ highlighter.removeHighlight(highlightEntry);
+ highlightEntry = null;
+ }
+ }
+ }
+
public void setSelectionVisible(boolean v)
{
- vis_sel = v;
+ if (selectionVisible == v)
+ return;
+
+ selectionVisible = v;
+ handleHighlight();
repaint();
}
public boolean isSelectionVisible()
{
- return vis_sel;
+ return selectionVisible;
}
protected final void repaint()
{
- if (parent != null)
- parent.repaint();
+ if (textComponent != null)
+ textComponent.repaint();
}
public void paint(Graphics g)
{
- g.setColor(color);
- g.drawLine(x, y, x, y + height);
+ if (textComponent == null)
+ return;
+
+ int dot = getDot();
+ Rectangle rect = null;
+
+ try
+ {
+ rect = textComponent.modelToView(dot);
+ }
+ catch (BadLocationException e)
+ {
+ // This should never happen as dot should be always valid.
+ return;
+ }
+
+ if (rect == null)
+ return;
+
+ // First we need to delete the old caret.
+ // FIXME: Implement deleting of old caret.
+
+ // Now draw the caret on the new position if visible.
+ if (visible)
+ {
+ g.setColor(textComponent.getCaretColor());
+ g.drawLine(rect.x, rect.y, rect.x, rect.y + rect.height);
+ }
}
public EventListener[] getListeners(Class listenerType)
@@ -198,17 +265,17 @@ public class DefaultCaret extends Rectangle
protected final JTextComponent getComponent()
{
- return parent;
+ return textComponent;
}
public int getBlinkRate()
{
- return blink;
+ return blinkRate;
}
public void setBlinkRate(int rate)
{
- blink = rate;
+ blinkRate = rate;
}
public int getDot()
@@ -218,23 +285,32 @@ public class DefaultCaret extends Rectangle
public void moveDot(int dot)
{
- setDot(dot);
+ this.dot = dot;
+ handleHighlight();
+ repaint();
}
public void setDot(int dot)
{
this.dot = dot;
+ this.mark = dot;
+ handleHighlight();
repaint();
}
public boolean isVisible()
{
- return vis;
+ return visible;
}
public void setVisible(boolean v)
{
- vis = v;
+ visible = v;
repaint();
}
+
+ protected Highlighter.HighlightPainter getSelectionPainter()
+ {
+ return DefaultHighlighter.DefaultPainter;
+ }
}
diff --git a/javax/swing/text/DefaultEditorKit.java b/javax/swing/text/DefaultEditorKit.java
index 858c640fc..a878f6792 100644
--- a/javax/swing/text/DefaultEditorKit.java
+++ b/javax/swing/text/DefaultEditorKit.java
@@ -64,6 +64,105 @@ public class DefaultEditorKit extends EditorKit
}
}
+ public static class CopyAction
+ extends TextAction
+ {
+ public CopyAction()
+ {
+ super(copyAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+ }
+
+ public static class CutAction
+ extends TextAction
+ {
+ public CutAction()
+ {
+ super(cutAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+ }
+
+ public static class DefaultKeyTypedAction
+ extends TextAction
+ {
+ public DefaultKeyTypedAction()
+ {
+ super(defaultKeyTypedAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ try
+ {
+ t.getDocument().insertString(t.getCaret().getDot(), event.getActionCommand(), null);
+ t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
+ t.getDocument().getEndPosition().getOffset()));
+ t.repaint();
+ }
+ catch (BadLocationException be)
+ {
+ // FIXME: we're not authorized to throw this.. swallow it?
+ }
+ }
+ }
+ }
+
+ public static class InsertBreakAction
+ extends TextAction
+ {
+ public InsertBreakAction()
+ {
+ super(insertBreakAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+ }
+
+ public static class InsertContentAction
+ extends TextAction
+ {
+ public InsertContentAction()
+ {
+ super(insertContentAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+ }
+
+ public static class InsertTabAction
+ extends TextAction
+ {
+ public InsertTabAction()
+ {
+ super(insertTabAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+ }
+
+ public static class PasteAction
+ extends TextAction
+ {
+ public PasteAction()
+ {
+ super(pasteAction);
+ }
+ public void actionPerformed(ActionEvent event)
+ {
+ }
+ }
+
private static final long serialVersionUID = 9017245433028523428L;
public static final String backwardAction = "caret-backward";
@@ -121,6 +220,113 @@ public class DefaultEditorKit extends EditorKit
{
}
+ private static Action[] defaultActions =
+ new Action[] {
+ new BeepAction(),
+ new CopyAction(),
+ new CutAction(),
+ new DefaultKeyTypedAction(),
+ new InsertBreakAction(),
+ new InsertContentAction(),
+ new InsertTabAction(),
+ new PasteAction(),
+ new TextAction(deleteNextCharAction)
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ try
+ {
+ int pos = t.getCaret().getDot();
+ if (pos < t.getDocument().getEndPosition().getOffset())
+ {
+ t.getDocument().remove(t.getCaret().getDot(), 1);
+ t.repaint();
+ }
+ }
+ catch (BadLocationException e)
+ {
+ // FIXME: we're not authorized to throw this.. swallow it?
+ }
+ }
+ }
+ },
+ new TextAction(deletePrevCharAction)
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ try
+ {
+ int pos = t.getCaret().getDot();
+ if (pos > t.getDocument().getStartPosition().getOffset())
+ {
+ t.getDocument().remove(pos - 1, 1);
+ t.getCaret().setDot(pos - 1);
+ t.repaint();
+ }
+ }
+ catch (BadLocationException e)
+ {
+ // FIXME: we're not authorized to throw this.. swallow it?
+ }
+ }
+ }
+ },
+ new TextAction(backwardAction)
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ t.getCaret().setDot(Math.max(t.getCaret().getDot() - 1,
+ t.getDocument().getStartPosition().getOffset()));
+ }
+ }
+ },
+ new TextAction(forwardAction)
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ t.getCaret().setDot(Math.min(t.getCaret().getDot() + 1,
+ t.getDocument().getEndPosition().getOffset()));
+ }
+ }
+ },
+ new TextAction(selectionBackwardAction)
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ t.getCaret().moveDot(Math.max(t.getCaret().getDot() - 1,
+ t.getDocument().getStartPosition().getOffset()));
+ }
+ }
+ },
+ new TextAction(selectionForwardAction)
+ {
+ public void actionPerformed(ActionEvent event)
+ {
+ JTextComponent t = getTextComponent(event);
+ if (t != null)
+ {
+ t.getCaret().moveDot(Math.min(t.getCaret().getDot() + 1,
+ t.getDocument().getEndPosition().getOffset()));
+ }
+ }
+ },
+ };
+
/**
* Called when the kit is being removed from the JEditorPane.
*/
@@ -134,17 +340,17 @@ public class DefaultEditorKit extends EditorKit
public Caret createCaret()
{
- return null;
+ return new DefaultCaret();
}
public Document createDefaultDocument()
{
return new PlainDocument();
}
-
+
public Action[] getActions()
{
- return null;
+ return defaultActions;
}
public String getContentType()
diff --git a/javax/swing/text/DefaultHighlighter.java b/javax/swing/text/DefaultHighlighter.java
index 003d17d1a..911e0f99b 100644
--- a/javax/swing/text/DefaultHighlighter.java
+++ b/javax/swing/text/DefaultHighlighter.java
@@ -38,7 +38,9 @@ exception statement from your version. */
package javax.swing.text;
+import java.awt.Color;
import java.awt.Graphics;
+import java.awt.Rectangle;
import java.awt.Shape;
import java.util.Vector;
@@ -48,6 +50,87 @@ import javax.swing.text.View;
public class DefaultHighlighter extends LayeredHighlighter
{
+ public static class DefaultHighlightPainter
+ extends LayerPainter
+ {
+ private Color color;
+
+ public DefaultHighlightPainter(Color c)
+ {
+ super();
+ color = c;
+ }
+
+ public Color getColor()
+ {
+ return color;
+ }
+
+ private void paintHighlight(Graphics g, Rectangle rect)
+ {
+ g.fillRect(rect.x, rect.y, rect.width, rect.height);
+ }
+
+ public void paint(Graphics g, int p0, int p1, Shape bounds,
+ JTextComponent c)
+ {
+ Rectangle r0 = null;
+ Rectangle r1 = null;
+ Rectangle rect = bounds.getBounds();
+
+ try
+ {
+ r0 = c.modelToView(p0);
+ r1 = c.modelToView(p1);
+ }
+ catch (BadLocationException e)
+ {
+ // This should never occur.
+ return;
+ }
+
+ if (r0 == null || r1 == null)
+ return;
+
+ if (color == null)
+ g.setColor(c.getSelectionColor());
+ else
+ g.setColor(color);
+
+ // Check if only one line to highlight.
+ if (r0.y == r1.y)
+ {
+ r0.width = r1.x - r0.x;
+ paintHighlight(g, r0);
+ return;
+ }
+
+ // First line, from p0 to end-of-line.
+ r0.width = rect.x + rect.width - r0.x;
+ paintHighlight(g, r0);
+
+ // FIXME: All the full lines in between, if any (assumes that all lines
+ // have the same height -- not a good assumption with JEditorPane/JTextPane).
+ r0.y += r0.height;
+ r0.x = rect.x;
+
+ while (r0.y < r1.y)
+ {
+ paintHighlight(g, r0);
+ r0.y += r0.height;
+ }
+
+ // Last line, from beginnin-of-line to p1.
+ paintHighlight(g, r1);
+ }
+
+ public Shape paintLayer(Graphics g, int p0, int p1, Shape bounds,
+ JTextComponent c, View view)
+ {
+ throw new InternalError();
+ }
+ }
+
private class HighlightEntry
{
int p0;
@@ -77,13 +160,30 @@ public class DefaultHighlighter extends LayeredHighlighter
}
}
+ /**
+ * @specnote final as of 1.4
+ */
+ public static final LayeredHighlighter.LayerPainter DefaultPainter =
+ new DefaultHighlightPainter(null);
+
private JTextComponent textComponent;
private Vector highlights = new Vector();
+ private boolean drawsLayeredHighlights = true;
public DefaultHighlighter()
{
}
+ public boolean getDrawsLayeredHighlights()
+ {
+ return drawsLayeredHighlights;
+ }
+
+ public void setDrawsLayeredHighlights(boolean newValue)
+ {
+ drawsLayeredHighlights = newValue;
+ }
+
private void checkPositions(int p0, int p1)
throws BadLocationException
{
@@ -146,5 +246,16 @@ public class DefaultHighlighter extends LayeredHighlighter
public void paint(Graphics g)
{
+ // Check if there are any highlights.
+ if (highlights.size() == 0)
+ return;
+
+ Shape bounds = textComponent.getBounds();
+
+ for (int index = 0; index < highlights.size(); ++index)
+ {
+ HighlightEntry entry = (HighlightEntry) highlights.get(index);
+ entry.painter.paint(g, entry.p0, entry.p1, bounds, textComponent);
+ }
}
}
diff --git a/javax/swing/text/DocumentFilter.java b/javax/swing/text/DocumentFilter.java
index 7a8e95df9..ff96d0729 100644
--- a/javax/swing/text/DocumentFilter.java
+++ b/javax/swing/text/DocumentFilter.java
@@ -1,5 +1,5 @@
/* DocumentFilter.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,4 +40,44 @@ package javax.swing.text;
public class DocumentFilter
{
+ public abstract static class FilterBypass
+ {
+ public FilterBypass()
+ {
+ // Do nothing here.
+ }
+
+ public abstract Document getDocument();
+
+ public abstract void insertString(int offset, String string,
+ AttributeSet attr)
+ throws BadLocationException;
+
+ public abstract void remove(int offset, int length)
+ throws BadLocationException;
+
+ public abstract void replace(int offset, int length, String string,
+ AttributeSet attrs)
+ throws BadLocationException;
+ }
+
+ public void insertString(DocumentFilter.FilterBypass fb, int offset,
+ String string, AttributeSet attr)
+ throws BadLocationException
+ {
+ fb.insertString(offset, string, attr);
+ }
+
+ public void remove(DocumentFilter.FilterBypass fb, int offset, int length)
+ throws BadLocationException
+ {
+ fb.remove(offset, length);
+ }
+
+ public void replace(DocumentFilter.FilterBypass fb, int offset, int length,
+ String text, AttributeSet attr)
+ throws BadLocationException
+ {
+ fb.replace(offset, length, text, attr);
+ }
}
diff --git a/javax/swing/text/FieldView.java b/javax/swing/text/FieldView.java
index 29a00acfa..06514b73f 100644
--- a/javax/swing/text/FieldView.java
+++ b/javax/swing/text/FieldView.java
@@ -90,8 +90,14 @@ public class FieldView extends PlainView
return axis = axis == X_AXIS ? 1 : 0;
}
+ public Shape modelToView(int pos, Shape a, Position.Bias bias)
+ throws BadLocationException
+ {
+ return super.modelToView(pos, a, bias);
+ }
+
public void paint(Graphics g, Shape s)
{
- drawLine(0, g, 0, 0);
+ super.paint(g, s);
}
}
diff --git a/javax/swing/text/JTextComponent.java b/javax/swing/text/JTextComponent.java
index e44c5296d..18c7674e1 100644
--- a/javax/swing/text/JTextComponent.java
+++ b/javax/swing/text/JTextComponent.java
@@ -46,13 +46,20 @@ import java.awt.Insets;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.InputMethodListener;
+import java.awt.event.KeyEvent;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleRole;
import javax.accessibility.AccessibleStateSet;
import javax.accessibility.AccessibleText;
+import javax.swing.Action;
+import javax.swing.ActionMap;
import javax.swing.Icon;
+import javax.swing.InputMap;
import javax.swing.JComponent;
import javax.swing.JViewport;
import javax.swing.KeyStroke;
@@ -62,6 +69,8 @@ import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
+import javax.swing.plaf.ActionMapUIResource;
+import javax.swing.plaf.InputMapUIResource;
import javax.swing.plaf.TextUI;
@@ -283,11 +292,505 @@ public abstract class JTextComponent extends JComponent
}
}
+ /**
+ * According to <a
+ * href="http://java.sun.com/products/jfc/tsc/special_report/kestrel/keybindings.html">this
+ * report</a>, a pair of private classes wraps a {@link
+ * javax.swing.text.Keymap} in the new {@link InputMap} / {@link
+ * ActionMap} interfaces, such that old Keymap-using code can make use of
+ * the new framework.</p>
+ *
+ * <p>A little bit of experimentation with these classes reveals the following
+ * structure:
+ *
+ * <ul>
+ *
+ * <li>KeymapWrapper extends {@link InputMap} and holds a reference to
+ * the underlying {@link Keymap}.</li>
+ *
+ * <li>KeymapWrapper maps {@link KeyStroke} objects to {@link Action}
+ * objects, by delegation to the underlying {@link Keymap}.</li>
+ *
+ * <li>KeymapActionMap extends {@link ActionMap} also holds a reference to
+ * the underlying {@link Keymap} but only appears to use it for listing
+ * its keys. </li>
+ *
+ * <li>KeymapActionMap maps all {@link Action} objects to
+ * <em>themselves</em>, whether they exist in the underlying {@link
+ * Keymap} or not, and passes other objects to the parent {@link
+ * ActionMap} for resolving.
+ *
+ * </ul>
+ */
+
+ private class KeymapWrapper extends InputMap
+ {
+ Keymap map;
+
+ public KeymapWrapper(Keymap k)
+ {
+ map = k;
+ }
+
+ public int size()
+ {
+ return map.getBoundKeyStrokes().length + super.size();
+ }
+
+ public Object get(KeyStroke ks)
+ {
+ Action mapped = null;
+ Keymap m = map;
+ while(mapped == null && m != null)
+ {
+ mapped = m.getAction(ks);
+ if (mapped == null && ks.getKeyEventType() == KeyEvent.KEY_TYPED)
+ mapped = m.getDefaultAction();
+ if (mapped == null)
+ m = m.getResolveParent();
+ }
+
+ if (mapped == null)
+ return super.get(ks);
+ else
+ return mapped;
+ }
+
+ public KeyStroke[] keys()
+ {
+ KeyStroke[] superKeys = super.keys();
+ KeyStroke[] mapKeys = map.getBoundKeyStrokes();
+ KeyStroke[] bothKeys = new KeyStroke[superKeys.length + mapKeys.length];
+ for (int i = 0; i < superKeys.length; ++i)
+ bothKeys[i] = superKeys[i];
+ for (int i = 0; i < mapKeys.length; ++i)
+ bothKeys[i + superKeys.length] = mapKeys[i];
+ return bothKeys;
+ }
+
+ public KeyStroke[] allKeys()
+ {
+ KeyStroke[] superKeys = super.allKeys();
+ KeyStroke[] mapKeys = map.getBoundKeyStrokes();
+ KeyStroke[] bothKeys = new KeyStroke[superKeys.length + mapKeys.length];
+ for (int i = 0; i < superKeys.length; ++i)
+ bothKeys[i] = superKeys[i];
+ for (int i = 0; i < mapKeys.length; ++i)
+ bothKeys[i + superKeys.length] = mapKeys[i];
+ return bothKeys;
+ }
+ }
+
+ private class KeymapActionMap extends ActionMap
+ {
+ Keymap map;
+
+ public KeymapActionMap(Keymap k)
+ {
+ map = k;
+ }
+
+ public Action get(Object cmd)
+ {
+ if (cmd instanceof Action)
+ return (Action) cmd;
+ else
+ return super.get(cmd);
+ }
+
+ public int size()
+ {
+ return map.getBoundKeyStrokes().length + super.size();
+ }
+
+ public Object[] keys()
+ {
+ Object[] superKeys = super.keys();
+ Object[] mapKeys = map.getBoundKeyStrokes();
+ Object[] bothKeys = new Object[superKeys.length + mapKeys.length];
+ for (int i = 0; i < superKeys.length; ++i)
+ bothKeys[i] = superKeys[i];
+ for (int i = 0; i < mapKeys.length; ++i)
+ bothKeys[i + superKeys.length] = mapKeys[i];
+ return bothKeys;
+ }
+
+ public Object[] allKeys()
+ {
+ Object[] superKeys = super.allKeys();
+ Object[] mapKeys = map.getBoundKeyStrokes();
+ Object[] bothKeys = new Object[superKeys.length + mapKeys.length];
+ for (int i = 0; i < superKeys.length; ++i)
+ bothKeys[i] = superKeys[i];
+ for (int i = 0; i < mapKeys.length; ++i)
+ bothKeys[i + superKeys.length] = mapKeys[i];
+ return bothKeys;
+ }
+
+ }
+
+ static class DefaultKeymap implements Keymap
+ {
+ String name;
+ Keymap parent;
+ Hashtable map;
+ Action defaultAction;
+
+ public DefaultKeymap(String name)
+ {
+ this.name = name;
+ this.map = new Hashtable();
+ }
+
+ public void addActionForKeyStroke(KeyStroke key, Action a)
+ {
+ map.put(key, a);
+ }
+
+ /**
+ * Looks up a KeyStroke either in the current map or the parent Keymap;
+ * does <em>not</em> return the default action if lookup fails.
+ *
+ * @param key The KeyStroke to look up an Action for.
+ *
+ * @return The mapping for <code>key</code>, or <code>null</code>
+ * if no mapping exists in this Keymap or any of its parents.
+ */
+ public Action getAction(KeyStroke key)
+ {
+ if (map.containsKey(key))
+ return (Action) map.get(key);
+ else if (parent != null)
+ return parent.getAction(key);
+ else
+ return null;
+ }
+
+ public Action[] getBoundActions()
+ {
+ Action [] ret = new Action[map.size()];
+ Enumeration e = map.elements();
+ int i = 0;
+ while (e.hasMoreElements())
+ {
+ ret[i++] = (Action) e.nextElement();
+ }
+ return ret;
+ }
+
+ public KeyStroke[] getBoundKeyStrokes()
+ {
+ KeyStroke [] ret = new KeyStroke[map.size()];
+ Enumeration e = map.keys();
+ int i = 0;
+ while (e.hasMoreElements())
+ {
+ ret[i++] = (KeyStroke) e.nextElement();
+ }
+ return ret;
+ }
+
+ public Action getDefaultAction()
+ {
+ return defaultAction;
+ }
+
+ public KeyStroke[] getKeyStrokesForAction(Action a)
+ {
+ int i = 0;
+ Enumeration e = map.keys();
+ while (e.hasMoreElements())
+ {
+ if (map.get(e.nextElement()).equals(a))
+ ++i;
+ }
+ KeyStroke [] ret = new KeyStroke[i];
+ i = 0;
+ e = map.keys();
+ while (e.hasMoreElements())
+ {
+ KeyStroke k = (KeyStroke) e.nextElement();
+ if (map.get(k).equals(a))
+ ret[i++] = k;
+ }
+ return ret;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public Keymap getResolveParent()
+ {
+ return parent;
+ }
+
+ public boolean isLocallyDefined(KeyStroke key)
+ {
+ return map.containsKey(key);
+ }
+
+ public void removeBindings()
+ {
+ map.clear();
+ }
+
+ public void removeKeyStrokeBinding(KeyStroke key)
+ {
+ map.remove(key);
+ }
+
+ public void setDefaultAction(Action a)
+ {
+ defaultAction = a;
+ }
+
+ public void setResolveParent(Keymap p)
+ {
+ parent = p;
+ }
+
+ }
+
private static final long serialVersionUID = -8796518220218978795L;
public static final String DEFAULT_KEYMAP = "default";
public static final String FOCUS_ACCELERATOR_KEY = "focusAcceleratorKey";
+
+ private static Hashtable keymaps = new Hashtable();
+ private Keymap keymap;
+
+ /**
+ * Get a Keymap from the global keymap table, by name.
+ *
+ * @param n The name of the Keymap to look up
+ *
+ * @return A Keymap associated with the provided name, or
+ * <code>null</code> if no such Keymap exists
+ *
+ * @see #addKeymap()
+ * @see #removeKeymap()
+ * @see #keymaps
+ */
+ public static Keymap getKeymap(String n)
+ {
+ return (Keymap) keymaps.get(n);
+ }
+
+ /**
+ * Remove a Keymap from the global Keymap table, by name.
+ *
+ * @param n The name of the Keymap to remove
+ *
+ * @return The keymap removed from the global table
+ *
+ * @see #addKeymap()
+ * @see #getKeymap()
+ * @see #keymaps
+ */
+ public static Keymap removeKeymap(String n)
+ {
+ Keymap km = (Keymap) keymaps.get(n);
+ keymaps.remove(n);
+ return km;
+ }
+
+ /**
+ * Create a new Keymap with a specific name and parent, and add the new
+ * Keymap to the global keymap table. The name may be <code>null</code>,
+ * in which case the new Keymap will <em>not</em> be added to the global
+ * Keymap table. The parent may also be <code>null</code>, which is
+ * harmless.
+ *
+ * @param n The name of the new Keymap, or <code>null</code>
+ * @param parent The parent of the new Keymap, or <code>null</code>
+ *
+ * @return The newly created Keymap
+ *
+ * @see #removeKeymap()
+ * @see #getKeymap()
+ * @see #keymaps
+ */
+ public static Keymap addKeymap(String n, Keymap parent)
+ {
+ Keymap k = new DefaultKeymap(n);
+ k.setResolveParent(parent);
+ if (n != null)
+ keymaps.put(n, k);
+ return k;
+ }
+
+ /**
+ * Get the current Keymap of this component.
+ *
+ * @return The component's current Keymap
+ *
+ * @see #setKeymap()
+ * @see #keymap
+ */
+ Keymap getKeymap()
+ {
+ return keymap;
+ }
+
+ /**
+ * Set the current Keymap of this component, installing appropriate
+ * {@link KeymapWrapper} and {@link KeymapActionMap} objects in the
+ * {@link InputMap} and {@link ActionMap} parent chains, respectively,
+ * and fire a property change event with name <code>"keymap"</code>.
+ *
+ * @see #getKeymap()
+ * @see #keymap
+ */
+ public void setKeymap(Keymap k)
+ {
+
+ // phase 1: replace the KeymapWrapper entry in the InputMap chain.
+ // the goal here is to always maintain the following ordering:
+ //
+ // [InputMap]? -> [KeymapWrapper]? -> [InputMapUIResource]*
+ //
+ // that is to say, component-specific InputMaps need to remain children
+ // of Keymaps, and Keymaps need to remain children of UI-installed
+ // InputMaps (and the order of each group needs to be preserved, of
+ // course).
+
+ KeymapWrapper kw = (k == null ? null : new KeymapWrapper(k));
+ InputMap childInputMap = getInputMap(JComponent.WHEN_FOCUSED);
+ if (childInputMap == null)
+ setInputMap(JComponent.WHEN_FOCUSED, kw);
+ else
+ {
+ while (childInputMap.getParent() != null
+ && !(childInputMap.getParent() instanceof KeymapWrapper)
+ && !(childInputMap.getParent() instanceof InputMapUIResource))
+ childInputMap = childInputMap.getParent();
+
+ // option 1: there is nobody to replace at the end of the chain
+ if (childInputMap.getParent() == null)
+ childInputMap.setParent(kw);
+
+ // option 2: there is already a KeymapWrapper in the chain which
+ // needs replacing (possibly with its own parents, possibly without)
+ else if (childInputMap.getParent() instanceof KeymapWrapper)
+ {
+ if (kw == null)
+ childInputMap.setParent(childInputMap.getParent().getParent());
+ else
+ {
+ kw.setParent(childInputMap.getParent().getParent());
+ childInputMap.setParent(kw);
+ }
+ }
+
+ // option 3: there is an InputMapUIResource in the chain, which marks
+ // the place where we need to stop and insert ourselves
+ else if (childInputMap.getParent() instanceof InputMapUIResource)
+ {
+ if (kw != null)
+ {
+ kw.setParent(childInputMap.getParent());
+ childInputMap.setParent(kw);
+ }
+ }
+ }
+
+ // phase 2: replace the KeymapActionMap entry in the ActionMap chain
+
+ KeymapActionMap kam = (k == null ? null : new KeymapActionMap(k));
+ ActionMap childActionMap = getActionMap();
+ if (childActionMap == null)
+ setActionMap(kam);
+ else
+ {
+ while (childActionMap.getParent() != null
+ && !(childActionMap.getParent() instanceof KeymapActionMap)
+ && !(childActionMap.getParent() instanceof ActionMapUIResource))
+ childActionMap = childActionMap.getParent();
+
+ // option 1: there is nobody to replace at the end of the chain
+ if (childActionMap.getParent() == null)
+ childActionMap.setParent(kam);
+
+ // option 2: there is already a KeymapActionMap in the chain which
+ // needs replacing (possibly with its own parents, possibly without)
+ else if (childActionMap.getParent() instanceof KeymapActionMap)
+ {
+ if (kam == null)
+ childActionMap.setParent(childActionMap.getParent().getParent());
+ else
+ {
+ kam.setParent(childActionMap.getParent().getParent());
+ childActionMap.setParent(kam);
+ }
+ }
+
+ // option 3: there is an ActionMapUIResource in the chain, which marks
+ // the place where we need to stop and insert ourselves
+ else if (childActionMap.getParent() instanceof ActionMapUIResource)
+ {
+ if (kam != null)
+ {
+ kam.setParent(childActionMap.getParent());
+ childActionMap.setParent(kam);
+ }
+ }
+ }
+
+ // phase 3: update the explicit keymap field
+
+ Keymap old = keymap;
+ keymap = k;
+ firePropertyChange("keymap", old, k);
+ }
+
+ /**
+ * Resolves a set of bindings against a set of actions and inserts the
+ * results into a {@link Keymap}. Specifically, for each provided binding
+ * <code>b</code>, if there exists a provided action <code>a</code> such
+ * that <code>a.getValue(Action.NAME) == b.ActionName</code> then an
+ * entry is added to the Keymap mapping <code>b</code> to
+ * </code>a</code>.
+ *
+ * @param map The Keymap to add new mappings to
+ * @param bindings The set of bindings to add to the Keymap
+ * @param actions The set of actions to resolve binding names against
+ *
+ * @see Action#NAME
+ * @see Action#getValue()
+ * @see KeyBinding#ActionName
+ */
+ public static void loadKeymap(Keymap map,
+ JTextComponent.KeyBinding[] bindings,
+ Action[] actions)
+ {
+ Hashtable acts = new Hashtable(actions.length);
+ for (int i = 0; i < actions.length; ++i)
+ acts.put(actions[i].getValue(Action.NAME), actions[i]);
+ for (int i = 0; i < bindings.length; ++i)
+ if (acts.containsKey(bindings[i].actionName))
+ map.addActionForKeyStroke(bindings[i].key, (Action) acts.get(bindings[i].actionName));
+ }
+ /**
+ * Returns the set of available Actions this component's associated
+ * editor can run. Equivalent to calling
+ * <code>getUI().getEditorKit().getActions()</code>. This set of Actions
+ * is a reasonable value to provide as a parameter to {@link
+ * #loadKeymap()}, when resolving a set of {@link #KeyBinding} objects
+ * against this component.
+ *
+ * @return The set of available Actions on this component's {@link EditorKit}
+ *
+ * @see TextUI#getEditorKit()
+ * @see EditorKit#getActions()
+ */
+ public Action[] getActions()
+ {
+ return getUI().getEditorKit(this).getActions();
+ }
+
private Document doc;
private Caret caret;
private Highlighter highlighter;
@@ -296,19 +799,48 @@ public abstract class JTextComponent extends JComponent
private Color selectedTextColor;
private Color selectionColor;
private boolean editable;
+ private Insets margin;
+ private boolean dragEnabled;
/**
* Creates a new <code>JTextComponent</code> instance.
*/
public JTextComponent()
{
+ Keymap defkeymap = getKeymap(DEFAULT_KEYMAP);
+ boolean creatingKeymap = false;
+ if (defkeymap == null)
+ {
+ defkeymap = addKeymap(DEFAULT_KEYMAP, null);
+ defkeymap.setDefaultAction(new DefaultEditorKit.DefaultKeyTypedAction());
+ creatingKeymap = true;
+ }
+
+ setFocusable(true);
enableEvents(AWTEvent.KEY_EVENT_MASK);
updateUI();
+
+ // need to do this after updateUI()
+ if (creatingKeymap)
+ loadKeymap(defkeymap,
+ new KeyBinding[] {
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0),
+ DefaultEditorKit.backwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0),
+ DefaultEditorKit.forwardAction),
+ new KeyBinding(KeyStroke.getKeyStroke("typed \b"),
+ DefaultEditorKit.deletePrevCharAction),
+ new KeyBinding(KeyStroke.getKeyStroke("typed \u007f"),
+ DefaultEditorKit.deleteNextCharAction)
+ },
+ getActions());
}
- public void setDocument(Document s)
+ public void setDocument(Document newDoc)
{
- doc = s;
+ Document oldDoc = doc;
+ doc = newDoc;
+ firePropertyChange("document", oldDoc, newDoc);
revalidate();
repaint();
}
@@ -328,18 +860,22 @@ public abstract class JTextComponent extends JComponent
return null;
}
+ public void setMargin(Insets m)
+ {
+ margin = m;
+ }
+
public Insets getMargin()
{
- // FIXME: Not implemented.
- return null;
+ return margin;
}
public void setText(String text)
{
try
{
- getDocument().remove(0, doc.getLength());
- getDocument().insertString(0, text, null);
+ doc.remove(0, doc.getLength());
+ doc.insertString(0, text, null);
}
catch (BadLocationException e)
{
@@ -386,6 +922,26 @@ public abstract class JTextComponent extends JComponent
}
/**
+ * Retrieves the currently selected text in this text document.
+ *
+ * @return the selected text
+ *
+ * @exception NullPointerException if the underlaying document is null
+ */
+ public String getSelectedText()
+ {
+ try
+ {
+ return doc.getText(getSelectionStart(), getSelectionEnd());
+ }
+ catch (BadLocationException e)
+ {
+ // This should never happen.
+ return null;
+ }
+ }
+
+ /**
* Returns a string that specifies the name of the Look and Feel class
* that renders this component.
*
@@ -488,8 +1044,16 @@ public abstract class JTextComponent extends JComponent
*/
public void setCaret(Caret newCaret)
{
- firePropertyChange("caret", caret, newCaret);
+ if (caret != null)
+ caret.deinstall(this);
+
+ Caret oldCaret = caret;
caret = newCaret;
+
+ if (caret != null)
+ caret.install(this);
+
+ firePropertyChange("caret", oldCaret, newCaret);
}
public Color getCaretColor()
@@ -499,8 +1063,9 @@ public abstract class JTextComponent extends JComponent
public void setCaretColor(Color newColor)
{
- firePropertyChange("caretColor", caretColor, newColor);
+ Color oldCaretColor = caretColor;
caretColor = newColor;
+ firePropertyChange("caretColor", oldCaretColor, newColor);
}
public Color getDisabledTextColor()
@@ -510,8 +1075,9 @@ public abstract class JTextComponent extends JComponent
public void setDisabledTextColor(Color newColor)
{
- firePropertyChange("disabledTextColor", caretColor, newColor);
+ Color oldColor = disabledTextColor;
disabledTextColor = newColor;
+ firePropertyChange("disabledTextColor", oldColor, newColor);
}
public Color getSelectedTextColor()
@@ -521,8 +1087,9 @@ public abstract class JTextComponent extends JComponent
public void setSelectedTextColor(Color newColor)
{
- firePropertyChange("selectedTextColor", caretColor, newColor);
+ Color oldColor = selectedTextColor;
selectedTextColor = newColor;
+ firePropertyChange("selectedTextColor", oldColor, newColor);
}
public Color getSelectionColor()
@@ -532,8 +1099,9 @@ public abstract class JTextComponent extends JComponent
public void setSelectionColor(Color newColor)
{
- firePropertyChange("selectionColor", caretColor, newColor);
+ Color oldColor = selectionColor;
selectionColor = newColor;
+ firePropertyChange("selectionColor", oldColor, newColor);
}
/**
@@ -584,8 +1152,16 @@ public abstract class JTextComponent extends JComponent
public void setHighlighter(Highlighter newHighlighter)
{
- firePropertyChange("highlighter", highlighter, newHighlighter);
+ if (highlighter != null)
+ highlighter.deinstall(this);
+
+ Highlighter oldHighlighter = highlighter;
highlighter = newHighlighter;
+
+ if (highlighter != null)
+ highlighter.install(this);
+
+ firePropertyChange("highlighter", oldHighlighter, newHighlighter);
}
/**
@@ -670,12 +1246,18 @@ public abstract class JTextComponent extends JComponent
try
{
+ int start = getSelectionStart();
+ int end = getSelectionEnd();
+
// Remove selected text.
if (dot != mark)
- doc.remove(Math.min(dot, mark), Math.max(dot, mark));
+ doc.remove(start, end - start);
// Insert new text.
- doc.insertString(Math.min(dot, mark), content, null);
+ doc.insertString(start, content, null);
+
+ // Set dot to new position.
+ setCaretPosition(start + content.length());
}
catch (BadLocationException e)
{
@@ -773,4 +1355,19 @@ public abstract class JTextComponent extends JComponent
{
return (InputMethodListener[]) getListeners(InputMethodListener.class);
}
+
+ public Rectangle modelToView(int position) throws BadLocationException
+ {
+ return getUI().modelToView(this, position);
+ }
+
+ public boolean getDragEnabled()
+ {
+ return dragEnabled;
+ }
+
+ public void setDragEnabled(boolean enabled)
+ {
+ dragEnabled = enabled;
+ }
}
diff --git a/javax/swing/text/NavigationFilter.java b/javax/swing/text/NavigationFilter.java
index 37d1c380a..cdf9e77b7 100644
--- a/javax/swing/text/NavigationFilter.java
+++ b/javax/swing/text/NavigationFilter.java
@@ -1,5 +1,5 @@
/* NavigationFilter.java --
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,4 +40,32 @@ package javax.swing.text;
public class NavigationFilter
{
+ public abstract static class FilterBypass
+ {
+ public FilterBypass()
+ {
+ // Do nothing here.
+ }
+
+ public abstract Caret getCaret();
+ public abstract void moveDot(int dot, Position.Bias bias);
+ public abstract void setDot(int dot, Position.Bias bias);
+ }
+
+ public NavigationFilter()
+ {
+ // Do nothing here.
+ }
+
+ public void moveDot(NavigationFilter.FilterBypass fb, int dot,
+ Position.Bias bias)
+ {
+ fb.moveDot(dot, bias);
+ }
+
+ public void setDot(NavigationFilter.FilterBypass fb, int dot,
+ Position.Bias bias)
+ {
+ fb.setDot(dot, bias);
+ }
}
diff --git a/javax/swing/text/PasswordView.java b/javax/swing/text/PasswordView.java
new file mode 100644
index 000000000..e7a755fe2
--- /dev/null
+++ b/javax/swing/text/PasswordView.java
@@ -0,0 +1,136 @@
+/* PasswordView.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Graphics;
+import javax.swing.JPasswordField;
+
+public class PasswordView extends FieldView
+{
+ /**
+ * Buffer for putting the echo char into it and
+ * then using it to draw it into the view.
+ */
+ private char[] oneCharBuffer = new char[1];
+
+ public PasswordView(Element elem)
+ {
+ super(elem);
+ }
+
+ protected int drawEchoCharacter(Graphics g, int x, int y, char ch)
+ {
+ // Update font metrics.
+ updateMetrics();
+
+ // Draw character.
+ oneCharBuffer[0] = ch;
+ g.drawChars(oneCharBuffer, 0, 1, x, y);
+
+ // Return new x position right of drawn character.
+ return x + metrics.charWidth(ch);
+ }
+
+ private char getEchoChar()
+ {
+ char ch = ((JPasswordField) getContainer()).getEchoChar();
+
+ if (ch == 0)
+ ch = '*';
+
+ return ch;
+ }
+
+ protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ // FIXME: Throw BadLocationException somehow.
+
+ // Update font metrics.
+ updateMetrics();
+
+ // Get echo character.
+ char ch = getEchoChar();
+
+ // Set color for selected text.
+ g.setColor(selectedColor);
+ g.setColor(Color.BLACK);
+
+ // Initialize buffer for faster drawing of all characters.
+ int len = p1 - p0;
+ char[] buffer = new char[len];
+ for (int index = 0; index < len; ++index)
+ buffer[index] = ch;
+
+ // Draw echo charaters.
+ g.drawChars(buffer, 0, len, x, y);
+
+ // Return new x position right of all drawn characters.
+ return x + len * metrics.charWidth(ch);
+ }
+
+ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+ throws BadLocationException
+ {
+ // FIXME: Throw BadLocationException somehow.
+
+ // Update font metrics.
+ updateMetrics();
+
+ // Get echo character.
+ char ch = getEchoChar();
+
+ // Set color for unselected text.
+ g.setColor(unselectedColor);
+ g.setColor(Color.BLACK);
+
+ // Initialize buffer for faster drawing of all characters.
+ int len = p1 - p0;
+ char[] buffer = new char[len];
+ for (int index = 0; index < len; ++index)
+ buffer[index] = ch;
+
+ // Draw echo charaters.
+ g.drawChars(buffer, 0, len, x, y);
+
+ // Return new x position right of all drawn characters.
+ return x + len * metrics.charWidth(ch);
+ }
+}
+
diff --git a/javax/swing/text/PlainView.java b/javax/swing/text/PlainView.java
index 229c7e193..bcec3538d 100644
--- a/javax/swing/text/PlainView.java
+++ b/javax/swing/text/PlainView.java
@@ -39,6 +39,8 @@ exception statement from your version. */
package javax.swing.text;
import java.awt.Color;
+import java.awt.Component;
+import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
@@ -48,12 +50,70 @@ import java.awt.Shape;
public class PlainView extends View
implements TabExpander
{
+ Color selectedColor;
+ Color unselectedColor;
+ Font font;
+
protected FontMetrics metrics;
public PlainView(Element elem)
{
super(elem);
}
+
+ /**
+ * @since 1.4
+ */
+ protected void updateMetrics()
+ {
+ Component component = getContainer();
+ Font font = component.getFont();
+
+ if (this.font != font)
+ {
+ this.font = font;
+ metrics = component.getFontMetrics(font);
+ }
+ }
+
+ /**
+ * @since 1.4
+ */
+ protected Rectangle lineToRect(Shape a, int line)
+ {
+ // Ensure metrics are up-to-date.
+ updateMetrics();
+
+ Rectangle rect = a.getBounds();
+ int fontHeight = metrics.getHeight();
+ return new Rectangle(rect.x, rect.y + (line * fontHeight),
+ rect.width, fontHeight);
+ }
+
+ public Shape modelToView(int position, Shape a, Position.Bias b)
+ throws BadLocationException
+ {
+ Document document = getDocument();
+
+ // Get rectangle of the line containing position.
+ int lineIndex = getElement().getElementIndex(position);
+ Rectangle rect = lineToRect(a, lineIndex);
+
+ // Get the rectangle for position.
+ Element line = getElement().getElement(lineIndex);
+ int lineStart = line.getStartOffset();
+ Segment segment = new Segment();
+ document.getText(lineStart, position - lineStart, segment);
+ int xoffset = Utilities.getTabbedTextWidth(segment, metrics, rect.x,
+ this, lineStart);
+
+ // Calc the real rectangle.
+ rect.x += xoffset;
+ rect.width = 1;
+ rect.height = metrics.getHeight();
+
+ return rect;
+ }
public void drawLine(int lineIndex, Graphics g, int x, int y)
{
@@ -70,33 +130,34 @@ public class PlainView extends View
}
}
- public int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
+ protected int drawSelectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
- String text = getDocument().getText(p0, p1);
- g.setColor(Color.WHITE);
- g.drawString(text, x, y);
- return metrics.stringWidth(text);
+ g.setColor(selectedColor);
+ Segment segment = new Segment();
+ getDocument().getText(p0, p1 - p0, segment);
+ return Utilities.drawTabbedText(segment, x, y, g, this, 0);
}
- public int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
+ protected int drawUnselectedText(Graphics g, int x, int y, int p0, int p1)
throws BadLocationException
{
- String text = getDocument().getText(p0, p1);
- g.setColor(Color.BLACK);
- g.drawString(text, x, y);
- return metrics.stringWidth(text);
+ g.setColor(unselectedColor);
+ Segment segment = new Segment();
+ getDocument().getText(p0, p1 - p0, segment);
+ return Utilities.drawTabbedText(segment, x, y, g, this, 0);
}
public void paint(Graphics g, Shape s)
{
- System.out.println("Michael: PlainView.paint");
+ JTextComponent textComponent = (JTextComponent) getContainer();
+
+ g.setFont(textComponent.getFont());
+ selectedColor = textComponent.getSelectedTextColor();
+ unselectedColor = textComponent.getForeground();
Rectangle rect = s.getBounds();
- g.setColor(Color.WHITE);
- g.fillRect(rect.x, rect.y, rect.width, rect.height);
-
// FIXME: Text may be scrolled.
drawLine(0, g, rect.x, rect.y);
}
@@ -106,10 +167,18 @@ public class PlainView extends View
return 8;
}
+ /**
+ * Returns the next tab stop position after a given reference position.
+ *
+ * This implementation ignores the <code>tabStop</code> argument.
+ *
+ * @param x the current x position in pixels
+ * @param tabStop the position within the text stream that the tab occured at
+ */
public float nextTabStop(float x, int tabStop)
{
- System.out.println("Michael: PlainView.nextTabpStop: missing implementation");
- return x;
+ float tabSizePixels = getTabSize() + metrics.charWidth('m');
+ return (float) (Math.floor(x / tabSizePixels) + 1) * tabSizePixels;
}
public float getPreferredSpan(int axis)
@@ -119,4 +188,5 @@ public class PlainView extends View
return 10;
}
-} \ No newline at end of file
+}
+
diff --git a/javax/swing/text/Segment.java b/javax/swing/text/Segment.java
index e23cd5a40..3b1d9e7aa 100644
--- a/javax/swing/text/Segment.java
+++ b/javax/swing/text/Segment.java
@@ -39,11 +39,11 @@ package javax.swing.text;
import java.text.CharacterIterator;
-
public class Segment
implements Cloneable, CharacterIterator
{
private boolean partialReturn;
+ private int current;
public char[] array;
public int count;
@@ -74,13 +74,20 @@ public class Segment
public char current()
{
- return array[getIndex()];
+ if (count == 0
+ || current >= getEndIndex())
+ return DONE;
+
+ return array[current];
}
public char first()
{
- offset = getBeginIndex();
- return array[offset];
+ if (count == 0)
+ return DONE;
+
+ current = getBeginIndex();
+ return array[current];
}
public int getBeginIndex()
@@ -95,31 +102,55 @@ public class Segment
public int getIndex()
{
- return offset;
+ return current;
}
public char last()
{
- offset = getEndIndex() - 1;
- return array[offset];
+ if (count == 0)
+ return DONE;
+
+ current = getEndIndex() - 1;
+ return array[current];
}
public char next()
{
- offset++;
- return array[offset];
+ if (count == 0)
+ return DONE;
+
+ if ((current + 1) >= getEndIndex())
+ {
+ current = getEndIndex();
+ return DONE;
+ }
+
+ current++;
+ return array[current];
}
public char previous()
{
- offset--;
- return array[offset];
+ if (count == 0
+ || current == getBeginIndex())
+ return DONE;
+
+ current--;
+ return array[current];
}
public char setIndex(int position)
{
- offset = position;
- return array[offset];
+ if (position < getBeginIndex()
+ || position > getEndIndex())
+ throw new IllegalArgumentException();
+
+ current = position;
+
+ if (position == getEndIndex())
+ return DONE;
+
+ return array[current];
}
public String toString()
diff --git a/javax/swing/text/SimpleAttributeSet.java b/javax/swing/text/SimpleAttributeSet.java
new file mode 100644
index 000000000..67a7c9ef2
--- /dev/null
+++ b/javax/swing/text/SimpleAttributeSet.java
@@ -0,0 +1,192 @@
+/* SimpleAttributeSet.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.lang.Cloneable;
+
+public class SimpleAttributeSet
+ implements MutableAttributeSet, Serializable, Cloneable
+{
+ public static final AttributeSet EMPTY = new SimpleAttributeSet();
+
+ Hashtable tab;
+
+ public SimpleAttributeSet()
+ {
+ this(null);
+ }
+
+ public SimpleAttributeSet(AttributeSet a)
+ {
+ tab = new Hashtable();
+ addAttributes(a);
+ }
+
+ public void addAttribute(Object name, Object value)
+ {
+ tab.put(name, value);
+ }
+
+ public void addAttributes(AttributeSet attributes)
+ {
+ Enumeration e = attributes.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ Object val = attributes.getAttribute(name);
+ tab.put(name, val);
+ }
+ }
+
+ public Object clone()
+ {
+ SimpleAttributeSet s = new SimpleAttributeSet();
+ s.tab = (Hashtable) tab.clone();
+ return s;
+ }
+
+ public boolean containsAttribute(Object name, Object value)
+ {
+ return tab.containsKey(name)
+ && tab.get(name).equals(value);
+ }
+
+ public boolean containsAttributes(AttributeSet attributes)
+ {
+ Enumeration e = attributes.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ Object val = attributes.getAttribute(name);
+ if (! containsAttribute(name, val))
+ return false;
+ }
+ return true;
+ }
+
+ public AttributeSet copyAttributes()
+ {
+ return (AttributeSet) clone();
+ }
+
+ public boolean equals(Object obj)
+ {
+ return (obj != null)
+ && (obj instanceof SimpleAttributeSet)
+ && ((SimpleAttributeSet)obj).tab.equals(this.tab);
+ }
+
+ public Object getAttribute(Object name)
+ {
+ Object val = tab.get(name);
+ if (val != null)
+ return val;
+
+ Object p = getResolveParent();
+ if (p != null && p instanceof AttributeSet)
+ return (((AttributeSet)p).getAttribute(name));
+
+ return null;
+ }
+
+ public int getAttributeCount()
+ {
+ return tab.size();
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return tab.keys();
+ }
+
+ public AttributeSet getResolveParent()
+ {
+ return (AttributeSet) tab.get(ResolveAttribute);
+ }
+
+ public int hashCode()
+ {
+ return tab.hashCode();
+ }
+
+ public boolean isDefined(Object attrName)
+ {
+ return tab.containsKey(attrName);
+ }
+
+ public boolean isEmpty()
+ {
+ return tab.isEmpty();
+ }
+
+ public boolean isEqual(AttributeSet attr)
+ {
+ return this.equals(attr);
+ }
+
+ public void removeAttribute(Object name)
+ {
+ tab.remove(name);
+ }
+
+ public void removeAttributes(AttributeSet attributes)
+ {
+ removeAttributes(attributes.getAttributeNames());
+ }
+
+ public void removeAttributes(Enumeration names)
+ {
+ while (names.hasMoreElements())
+ {
+ removeAttribute(names.nextElement());
+ }
+ }
+
+ public void setResolveParent(AttributeSet parent)
+ {
+ addAttribute(ResolveAttribute, parent);
+ }
+
+ public String toString()
+ {
+ return tab.toString();
+ }
+}
diff --git a/javax/swing/text/StyleConstants.java b/javax/swing/text/StyleConstants.java
new file mode 100644
index 000000000..2201c47b5
--- /dev/null
+++ b/javax/swing/text/StyleConstants.java
@@ -0,0 +1,439 @@
+/* StyleConstants.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Component;
+import javax.swing.Icon;
+
+public class StyleConstants
+{
+
+ String keyname;
+ private StyleConstants(String k)
+ {
+ keyname = k;
+ }
+
+ public String toString()
+ {
+ return keyname;
+ }
+
+ public static int ALIGN_CENTER;
+ public static int ALIGN_JUSTIFIED;
+ public static int ALIGN_LEFT;
+ public static int ALIGN_RIGHT;
+
+ public static Object Background = CharacterConstants.Background;
+ public static Object BidiLevel = CharacterConstants.BidiLevel;
+ public static Object Bold = CharacterConstants.Bold;
+ public static Object ComponentAttribute = CharacterConstants.ComponentAttribute;
+ public static Object FontFamily = CharacterConstants.Family;
+ public static Object FontSize = CharacterConstants.Size;
+ public static Object Foreground = CharacterConstants.Foreground;
+ public static Object IconAttribute = CharacterConstants.IconAttribute;
+ public static Object Italic = CharacterConstants.Italic;
+ public static Object StrikeThrough = CharacterConstants.StrikeThrough;
+ public static Object Subscript = CharacterConstants.Subscript;
+ public static Object Superscript = CharacterConstants.Superscript;
+ public static Object Underline = CharacterConstants.Underline;
+
+ public static Object Alignment = ParagraphConstants.Alignment;
+ public static Object FirstLineIndent = ParagraphConstants.FirstLineIndent;
+ public static Object LeftIndent = ParagraphConstants.LeftIndent;
+ public static Object LineSpacing = ParagraphConstants.LineSpacing;
+ public static Object Orientation = ParagraphConstants.Orientation;
+ public static Object RightIndent = ParagraphConstants.RightIndent;
+ public static Object SpaceAbove = ParagraphConstants.SpaceAbove;
+ public static Object SpaceBelow = ParagraphConstants.SpaceBelow;
+ public static Object TabSet = ParagraphConstants.TabSet;
+
+ public static String ComponentElementName = new String("component");
+ public static String IconElementName = new String("icon");
+
+ public static Object ComposedTextAttribute = new StyleConstants("composed text");
+ public static Object ModelAttribute = new StyleConstants("model");
+ public static Object NameAttribute = new StyleConstants("name");
+ public static Object ResolveAttribute = new StyleConstants("resolver");
+
+ public static int getAlignment(AttributeSet a)
+ {
+ if (a.isDefined(Alignment))
+ return ((Integer)a.getAttribute(Alignment)).intValue();
+ else
+ return ALIGN_LEFT;
+ }
+
+ public static Color getBackground(AttributeSet a)
+ {
+ if (a.isDefined(Background))
+ return (Color) a.getAttribute(Background);
+ else
+ return Color.BLACK;
+ }
+
+ public static int getBidiLevel(AttributeSet a)
+ {
+ if (a.isDefined(BidiLevel))
+ return ((Integer)a.getAttribute(BidiLevel)).intValue();
+ else
+ return 0;
+ }
+
+ public static Component getComponent(AttributeSet a)
+ {
+ if (a.isDefined(ComponentAttribute))
+ return (Component) a.getAttribute(ComponentAttribute);
+ else
+ return (Component) null;
+ }
+
+ public static float getFirstLineIndent(AttributeSet a)
+ {
+ if (a.isDefined(FirstLineIndent))
+ return ((Float)a.getAttribute(FirstLineIndent)).floatValue();
+ else
+ return 0.f;
+ }
+
+ public static String getFontFamily(AttributeSet a)
+ {
+ if (a.isDefined(FontFamily))
+ return (String) a.getAttribute(FontFamily);
+ else
+ return "Monospaced";
+ }
+
+ public static int getFontSize(AttributeSet a)
+ {
+ if (a.isDefined(FontSize))
+ return ((Integer)a.getAttribute(FontSize)).intValue();
+ else
+ return 12;
+ }
+
+ public static Color getForeground(AttributeSet a)
+ {
+ if (a.isDefined(Foreground))
+ return (Color) a.getAttribute(Foreground);
+ else
+ return Color.BLACK;
+ }
+
+ public static Icon getIcon(AttributeSet a)
+ {
+ if (a.isDefined(IconAttribute))
+ return (Icon) a.getAttribute(IconAttribute);
+ else
+ return (Icon) null;
+ }
+
+ public static float getLeftIndent(AttributeSet a)
+ {
+ if (a.isDefined(LeftIndent))
+ return ((Float)a.getAttribute(LeftIndent)).floatValue();
+ else
+ return 0.f;
+ }
+
+ public static float getLineSpacing(AttributeSet a)
+ {
+ if (a.isDefined(LineSpacing))
+ return ((Float)a.getAttribute(LineSpacing)).floatValue();
+ else
+ return 0.f;
+ }
+
+ public static float getRightIndent(AttributeSet a)
+ {
+ if (a.isDefined(RightIndent))
+ return ((Float)a.getAttribute(RightIndent)).floatValue();
+ else
+ return 0.f;
+ }
+
+ public static float getSpaceAbove(AttributeSet a)
+ {
+ if (a.isDefined(SpaceAbove))
+ return ((Float)a.getAttribute(SpaceAbove)).floatValue();
+ else
+ return 0.f;
+ }
+
+ public static float getSpaceBelow(AttributeSet a)
+ {
+ if (a.isDefined(SpaceBelow))
+ return ((Float)a.getAttribute(SpaceBelow)).floatValue();
+ else
+ return 0.f;
+ }
+
+ public static javax.swing.text.TabSet getTabSet(AttributeSet a)
+ {
+ if (a.isDefined(StyleConstants.TabSet))
+ return (javax.swing.text.TabSet) a.getAttribute(StyleConstants.TabSet);
+ else
+ return (javax.swing.text.TabSet) null;
+ }
+
+ public static boolean isBold(AttributeSet a)
+ {
+ if (a.isDefined(Bold))
+ return ((Boolean) a.getAttribute(Bold)).booleanValue();
+ else
+ return false;
+ }
+
+ public static boolean isItalic(AttributeSet a)
+ {
+ if (a.isDefined(Italic))
+ return ((Boolean) a.getAttribute(Italic)).booleanValue();
+ else
+ return false;
+ }
+
+ public static boolean isStrikeThrough(AttributeSet a)
+ {
+ if (a.isDefined(StrikeThrough))
+ return ((Boolean) a.getAttribute(StrikeThrough)).booleanValue();
+ else
+ return false;
+ }
+
+ public static boolean isSubscript(AttributeSet a)
+ {
+ if (a.isDefined(Subscript))
+ return ((Boolean) a.getAttribute(Subscript)).booleanValue();
+ else
+ return false;
+ }
+
+ public static boolean isSuperscript(AttributeSet a)
+ {
+ if (a.isDefined(Superscript))
+ return ((Boolean) a.getAttribute(Superscript)).booleanValue();
+ else
+ return false;
+ }
+
+ public static boolean isUnderline(AttributeSet a)
+ {
+ if (a.isDefined(Underline))
+ return ((Boolean) a.getAttribute(Underline)).booleanValue();
+ else
+ return false;
+ }
+
+ public static void setAlignment(MutableAttributeSet a, int align)
+ {
+ a.addAttribute(Alignment, new Integer(align));
+ }
+
+ public static void setBackground(MutableAttributeSet a, Color fg)
+ {
+ a.addAttribute(Background, fg);
+ }
+
+ public static void setBidiLevel(MutableAttributeSet a, int lev)
+ {
+ a.addAttribute(BidiLevel, new Integer(lev));
+ }
+
+ public static void setBold(MutableAttributeSet a, boolean b)
+ {
+ a.addAttribute(Bold, new Boolean(b));
+ }
+
+ public static void setComponent(MutableAttributeSet a, Component c)
+ {
+ a.addAttribute(ComponentAttribute, c);
+ }
+
+ public static void setFirstLineIndent(MutableAttributeSet a, float i)
+ {
+ a.addAttribute(FirstLineIndent, new Float(i));
+ }
+
+ public static void setFontFamily(MutableAttributeSet a, String fam)
+ {
+ a.addAttribute(FontFamily, fam);
+ }
+
+ public static void setFontSize(MutableAttributeSet a, int s)
+ {
+ a.addAttribute(FontSize, new Integer(s));
+ }
+
+ public static void setForeground(MutableAttributeSet a, Color fg)
+ {
+ a.addAttribute(Foreground, fg);
+ }
+
+ public static void setIcon(MutableAttributeSet a, Icon c)
+ {
+ a.addAttribute(IconAttribute, c);
+ }
+
+ public static void setItalic(MutableAttributeSet a, boolean b)
+ {
+ a.addAttribute(Italic, new Boolean(b));
+ }
+
+ public static void setLeftIndent(MutableAttributeSet a, float i)
+ {
+ a.addAttribute(LeftIndent, new Float(i));
+ }
+
+ public static void setLineSpacing(MutableAttributeSet a, float i)
+ {
+ a.addAttribute(LineSpacing, new Float(i));
+ }
+
+ public static void setRightIndent(MutableAttributeSet a, float i)
+ {
+ a.addAttribute(RightIndent, new Float(i));
+ }
+
+ public static void setSpaceAbove(MutableAttributeSet a, float i)
+ {
+ a.addAttribute(SpaceAbove, new Float(i));
+ }
+
+ public static void setSpaceBelow(MutableAttributeSet a, float i)
+ {
+ a.addAttribute(SpaceBelow, new Float(i));
+ }
+
+ public static void setStrikeThrough(MutableAttributeSet a, boolean b)
+ {
+ a.addAttribute(StrikeThrough, new Boolean(b));
+ }
+
+ public static void setSubscript(MutableAttributeSet a, boolean b)
+ {
+ a.addAttribute(Subscript, new Boolean(b));
+ }
+
+ public static void setSuperscript(MutableAttributeSet a, boolean b)
+ {
+ a.addAttribute(Superscript, new Boolean(b));
+ }
+
+ public static void setTabSet(MutableAttributeSet a, javax.swing.text.TabSet tabs)
+ {
+ a.addAttribute(StyleConstants.TabSet, tabs);
+ }
+
+ public static void setUnderline(MutableAttributeSet a, boolean b)
+ {
+ a.addAttribute(Underline, new Boolean(b));
+ }
+
+ // The remainder are so-called "typesafe enumerations" which
+ // alias subsets of the above constants.
+ public static class CharacterConstants
+ extends StyleConstants
+ implements AttributeSet.CharacterAttribute
+ {
+ private CharacterConstants(String k)
+ {
+ super(k);
+ }
+
+ public static Object Background = ColorConstants.Background;
+ public static Object BidiLevel = new CharacterConstants("bidiLevel");
+ public static Object Bold = FontConstants.Bold;
+ public static Object ComponentAttribute = new CharacterConstants("component");
+ public static Object Family = FontConstants.Family;
+ public static Object Size = FontConstants.Size;
+ public static Object Foreground = ColorConstants.Foreground;
+ public static Object IconAttribute = new CharacterConstants("icon");
+ public static Object Italic = FontConstants.Italic;
+ public static Object StrikeThrough = new CharacterConstants("strikethrough");
+ public static Object Subscript = new CharacterConstants("subscript");
+ public static Object Superscript = new CharacterConstants("superscript");
+ public static Object Underline = new CharacterConstants("underline");
+ }
+
+ public static class ColorConstants
+ extends StyleConstants
+ implements AttributeSet.ColorAttribute, AttributeSet.CharacterAttribute
+ {
+ private ColorConstants(String k)
+ {
+ super(k);
+ }
+ public static Object Foreground = new ColorConstants("foreground");
+ public static Object Background = new ColorConstants("background");
+ }
+
+ public static class FontConstants
+ extends StyleConstants
+ implements AttributeSet.FontAttribute, AttributeSet.CharacterAttribute
+ {
+ private FontConstants(String k)
+ {
+ super(k);
+ }
+ public static Object Bold = new FontConstants("bold");
+ public static Object Family = new FontConstants("family");
+ public static Object Italic = new FontConstants("italic");
+ public static Object Size = new FontConstants("size");
+ }
+
+ public static class ParagraphConstants
+ extends StyleConstants
+ implements AttributeSet.ParagraphAttribute
+ {
+ private ParagraphConstants(String k)
+ {
+ super(k);
+ }
+ public static Object Alignment = new ParagraphConstants("Alignment");
+ public static Object FirstLineIndent = new ParagraphConstants("FirstLineIndent");
+ public static Object LeftIndent = new ParagraphConstants("LeftIndent");
+ public static Object LineSpacing = new ParagraphConstants("LineSpacing");
+ public static Object Orientation = new ParagraphConstants("Orientation");
+ public static Object RightIndent = new ParagraphConstants("RightIndent");
+ public static Object SpaceAbove = new ParagraphConstants("SpaceAbove");
+ public static Object SpaceBelow = new ParagraphConstants("SpaceBelow");
+ public static Object TabSet = new ParagraphConstants("TabSet");
+ }
+
+}
diff --git a/javax/swing/text/StyleContext.java b/javax/swing/text/StyleContext.java
new file mode 100644
index 000000000..8accd9b90
--- /dev/null
+++ b/javax/swing/text/StyleContext.java
@@ -0,0 +1,697 @@
+/* StyleContext.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Toolkit;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import javax.swing.event.EventListenerList;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import java.util.Enumeration;
+import java.util.EventListener;
+import java.util.Hashtable;
+
+public class StyleContext
+ implements Serializable, AbstractDocument.AttributeContext
+{
+ public class NamedStyle
+ implements Serializable, Style
+ {
+ protected ChangeEvent changeEvent;
+ protected EventListenerList listenerList;
+
+ AttributeSet attributes;
+ String name;
+
+ public NamedStyle()
+ {
+ this(null, null);
+ }
+
+ public NamedStyle(Style parent)
+ {
+ this(null, parent);
+ }
+
+ public NamedStyle(String name, Style parent)
+ {
+ this.name = name;
+ this.attributes = getEmptySet();
+ this.changeEvent = new ChangeEvent(this);
+ this.listenerList = new EventListenerList();
+ setResolveParent(parent);
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public void setName(String n)
+ {
+ name = n;
+ fireStateChanged();
+ }
+
+ public void addChangeListener(ChangeListener l)
+ {
+ listenerList.add(ChangeListener.class, l);
+ }
+
+ public void removeChangeListener(ChangeListener l)
+ {
+ listenerList.remove(ChangeListener.class, l);
+ }
+
+ public EventListener[] getListeners(Class listenerType)
+ {
+ return listenerList.getListeners(listenerType);
+ }
+
+ public ChangeListener[] getChangeListeners()
+ {
+ return (ChangeListener[]) getListeners(ChangeListener.class);
+ }
+
+ protected void fireStateChanged()
+ {
+ ChangeListener[] listeners = getChangeListeners();
+ for (int i = 0; i < listeners.length; ++i)
+ {
+ listeners[i].stateChanged(changeEvent);
+ }
+ }
+
+ public void addAttribute(Object name, Object value)
+ {
+ attributes = StyleContext.this.addAttribute(attributes, name, value);
+ fireStateChanged();
+ }
+
+ public void addAttributes(AttributeSet attr)
+ {
+ attributes = StyleContext.this.addAttributes(attributes, attr);
+ fireStateChanged();
+ }
+
+ public boolean containsAttribute(Object name, Object value)
+ {
+ return attributes.containsAttribute(name, value);
+ }
+
+ public boolean containsAttributes(AttributeSet attrs)
+ {
+ return attributes.containsAttributes(attrs);
+ }
+
+ public AttributeSet copyAttributes()
+ {
+ return attributes.copyAttributes();
+ }
+
+ public Object getAttribute(Object attrName)
+ {
+ return attributes.getAttribute(attrName);
+ }
+
+ public int getAttributeCount()
+ {
+ return attributes.getAttributeCount();
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return attributes.getAttributeNames();
+ }
+
+ public boolean isDefined(Object attrName)
+ {
+ return attributes.isDefined(attrName);
+ }
+
+ public boolean isEqual(AttributeSet attr)
+ {
+ return attributes.isEqual(attr);
+ }
+
+ public void removeAttribute(Object name)
+ {
+ attributes = StyleContext.this.removeAttribute(attributes, name);
+ fireStateChanged();
+ }
+
+ public void removeAttributes(AttributeSet attrs)
+ {
+ attributes = StyleContext.this.removeAttributes(attributes, attrs);
+ fireStateChanged();
+ }
+
+ public void removeAttributes(Enumeration names)
+ {
+ attributes = StyleContext.this.removeAttributes(attributes, names);
+ fireStateChanged();
+ }
+
+
+ public AttributeSet getResolveParent()
+ {
+ return attributes.getResolveParent();
+ }
+
+ public void setResolveParent(AttributeSet parent)
+ {
+ attributes = StyleContext.this.addAttribute(attributes, ResolveAttribute, parent);
+ fireStateChanged();
+ }
+
+ public String toString()
+ {
+ return ("[NamedStyle: name=" + name + ", attrs=" + attributes.toString() + "]");
+ }
+ }
+
+ public class SmallAttributeSet
+ implements AttributeSet
+ {
+ final Object [] attrs;
+ public SmallAttributeSet(AttributeSet a)
+ {
+ if (a == null)
+ attrs = new Object[0];
+ else
+ {
+ int n = a.getAttributeCount();
+ int i = 0;
+ attrs = new Object[n * 2];
+ Enumeration e = a.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ attrs[i++] = name;
+ attrs[i++] = a.getAttribute(name);
+ }
+ }
+ }
+
+ public SmallAttributeSet(Object [] a)
+ {
+ if (a == null)
+ attrs = new Object[0];
+ else
+ {
+ attrs = new Object[a.length];
+ System.arraycopy(a, 0, attrs, 0, a.length);
+ }
+ }
+
+ public Object clone()
+ {
+ return new SmallAttributeSet(this.attrs);
+ }
+
+ public boolean containsAttribute(Object name, Object value)
+ {
+ for (int i = 0; i < attrs.length; i += 2)
+ {
+ if (attrs[i].equals(name) &&
+ attrs[i+1].equals(value))
+ return true;
+ }
+ return false;
+ }
+
+ public boolean containsAttributes(AttributeSet a)
+ {
+ Enumeration e = a.getAttributeNames();
+ while (e.hasMoreElements())
+ {
+ Object name = e.nextElement();
+ Object val = a.getAttribute(name);
+ if (!containsAttribute(name, val))
+ return false;
+ }
+ return true;
+ }
+
+ public AttributeSet copyAttributes()
+ {
+ return (AttributeSet) clone();
+ }
+
+ public boolean equals(Object obj)
+ {
+ return
+ (obj instanceof SmallAttributeSet)
+ && this.isEqual((AttributeSet)obj);
+ }
+
+ public Object getAttribute(Object key)
+ {
+ for (int i = 0; i < attrs.length; i += 2)
+ {
+ if (attrs[i].equals(key))
+ return attrs[i+1];
+ }
+
+ Object p = getResolveParent();
+ if (p != null && p instanceof AttributeSet)
+ return (((AttributeSet)p).getAttribute(key));
+
+ return null;
+ }
+
+ public int getAttributeCount()
+ {
+ return attrs.length / 2;
+ }
+
+ public Enumeration getAttributeNames()
+ {
+ return new Enumeration()
+ {
+ int i = 0;
+ public boolean hasMoreElements()
+ {
+ return i < attrs.length;
+ }
+ public Object nextElement()
+ {
+ i += 2;
+ return attrs[i-2];
+ }
+ };
+ }
+
+ public AttributeSet getResolveParent()
+ {
+ return (AttributeSet) getAttribute(ResolveAttribute);
+ }
+
+ public int hashCode()
+ {
+ return java.util.Arrays.asList(attrs).hashCode();
+ }
+
+ public boolean isDefined(Object key)
+ {
+ for (int i = 0; i < attrs.length; i += 2)
+ {
+ if (attrs[i].equals(key))
+ return true;
+ }
+ return false;
+ }
+
+ public boolean isEqual(AttributeSet attr)
+ {
+ return attr != null
+ && attr.containsAttributes(this)
+ && this.containsAttributes(attr);
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[StyleContext.SmallattributeSet:");
+ for (int i = 0; i < attrs.length; ++i)
+ {
+ sb.append(" (");
+ sb.append(attrs[i].toString());
+ sb.append("=");
+ sb.append(attrs[i+1].toString());
+ sb.append(")");
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+ }
+
+ // FIXME: official javadocs suggest that these might be more usefully
+ // implemented using a WeakHashMap, but not sure if that works most
+ // places or whether it really matters anyways.
+ //
+ // FIXME: also not sure if these tables ought to be static (singletons),
+ // shared across all StyleContexts. I think so, but it's not clear in
+ // docs. revert to non-shared if you think it matters.
+
+ public static final String DEFAULT_STYLE = "default";
+
+ static Hashtable sharedAttributeSets = new Hashtable();
+ static Hashtable sharedFonts = new Hashtable();
+
+ static StyleContext defaultStyleContext = new StyleContext();
+ static final int compressionThreshold = 9;
+
+ EventListenerList listenerList;
+ Hashtable styleTable;
+
+ public StyleContext()
+ {
+ listenerList = new EventListenerList();
+ styleTable = new Hashtable();
+ }
+
+ protected SmallAttributeSet createSmallAttributeSet(AttributeSet a)
+ {
+ return new SmallAttributeSet(a);
+ }
+
+ protected MutableAttributeSet createLargeAttributeSet(AttributeSet a)
+ {
+ return new SimpleAttributeSet(a);
+ }
+
+ public void addChangeListener(ChangeListener listener)
+ {
+ listenerList.add(ChangeListener.class, listener);
+ }
+
+ public void removeChangeListener(ChangeListener listener)
+ {
+ listenerList.remove(ChangeListener.class, listener);
+ }
+
+ public ChangeListener[] getChangeListeners()
+ {
+ return (ChangeListener[]) listenerList.getListeners(ChangeListener.class);
+ }
+
+ public Style addStyle(String name, Style parent)
+ {
+ Style newStyle = new NamedStyle(name, parent);
+ if (name != null)
+ styleTable.put(name, newStyle);
+ return newStyle;
+ }
+
+ public void removeStyle(String name)
+ {
+ styleTable.remove(name);
+ }
+
+ public Style getStyle(String name)
+ {
+ return (Style) styleTable.get(name);
+ }
+
+ public Enumeration getStyleNames()
+ {
+ return styleTable.keys();
+ }
+
+ //
+ // StyleContexts only understand the "simple" model of fonts present in
+ // pre-java2d systems: fonts are a family name, a size (integral number
+ // of points), and a mask of style parameters (plain, bold, italic, or
+ // bold|italic). We have an inner class here called SimpleFontSpec which
+ // holds such triples.
+ //
+ // A SimpleFontSpec can be built for *any* AttributeSet because the size,
+ // family, and style keys in an AttributeSet have default values (defined
+ // over in StyleConstants).
+ //
+ // We keep a static cache mapping SimpleFontSpecs to java.awt.Fonts, so
+ // that we reuse Fonts between styles and style contexts.
+ //
+
+ private static class SimpleFontSpec
+ {
+ String family;
+ int style;
+ int size;
+ public SimpleFontSpec(String family,
+ int style,
+ int size)
+ {
+ this.family = family;
+ this.style = style;
+ this.size = size;
+ }
+ public boolean equals(Object obj)
+ {
+ return (obj != null)
+ && (obj instanceof SimpleFontSpec)
+ && (((SimpleFontSpec)obj).family.equals(this.family))
+ && (((SimpleFontSpec)obj).style == this.style)
+ && (((SimpleFontSpec)obj).size == this.size);
+ }
+ public int hashCode()
+ {
+ return family.hashCode() + style + size;
+ }
+ }
+
+ public Font getFont(AttributeSet attr)
+ {
+ String family = StyleConstants.getFontFamily(attr);
+ int style = Font.PLAIN;
+ if (StyleConstants.isBold(attr))
+ style += Font.BOLD;
+ if (StyleConstants.isItalic(attr))
+ style += Font.ITALIC;
+ int size = StyleConstants.getFontSize(attr);
+ return getFont(family, style, size);
+ }
+
+ public Font getFont(String family, int style, int size)
+ {
+ SimpleFontSpec spec = new SimpleFontSpec(family, style, size);
+ if (sharedFonts.containsKey(spec))
+ return (Font) sharedFonts.get(spec);
+ else
+ {
+ Font tmp = new Font(family, style, size);
+ sharedFonts.put(spec, tmp);
+ return tmp;
+ }
+ }
+
+ public FontMetrics getFontMetrics(Font f)
+ {
+ return Toolkit.getDefaultToolkit().getFontMetrics(f);
+ }
+
+ public Color getForeground(AttributeSet a)
+ {
+ return StyleConstants.getForeground(a);
+ }
+
+ public Color getBackground(AttributeSet a)
+ {
+ return StyleConstants.getBackground(a);
+ }
+
+ protected int getCompressionThreshold()
+ {
+ return compressionThreshold;
+ }
+
+ public static StyleContext getDefaultStyleContext()
+ {
+ return defaultStyleContext;
+ }
+
+ public AttributeSet addAttribute(AttributeSet old, Object name, Object value)
+ {
+ if (old instanceof MutableAttributeSet)
+ {
+ ((MutableAttributeSet)old).addAttribute(name, value);
+ return old;
+ }
+ else
+ {
+ MutableAttributeSet mutable = createLargeAttributeSet(old);
+ mutable.addAttribute(name, value);
+ if (mutable.getAttributeCount() >= getCompressionThreshold())
+ return mutable;
+ else
+ {
+ SmallAttributeSet small = createSmallAttributeSet(mutable);
+ if (sharedAttributeSets.containsKey(small))
+ small = (SmallAttributeSet) sharedAttributeSets.get(small);
+ else
+ sharedAttributeSets.put(small,small);
+ return small;
+ }
+ }
+ }
+
+ public AttributeSet addAttributes(AttributeSet old, AttributeSet attributes)
+ {
+ if (old instanceof MutableAttributeSet)
+ {
+ ((MutableAttributeSet)old).addAttributes(attributes);
+ return old;
+ }
+ else
+ {
+ MutableAttributeSet mutable = createLargeAttributeSet(old);
+ mutable.addAttributes(attributes);
+ if (mutable.getAttributeCount() >= getCompressionThreshold())
+ return mutable;
+ else
+ {
+ SmallAttributeSet small = createSmallAttributeSet(mutable);
+ if (sharedAttributeSets.containsKey(small))
+ small = (SmallAttributeSet) sharedAttributeSets.get(small);
+ else
+ sharedAttributeSets.put(small,small);
+ return small;
+ }
+ }
+ }
+
+ public AttributeSet getEmptySet()
+ {
+ AttributeSet e = createSmallAttributeSet(null);
+ if (sharedAttributeSets.containsKey(e))
+ e = (AttributeSet) sharedAttributeSets.get(e);
+ else
+ sharedAttributeSets.put(e, e);
+ return e;
+ }
+
+ public void reclaim(AttributeSet attributes)
+ {
+ if (sharedAttributeSets.containsKey(attributes))
+ sharedAttributeSets.remove(attributes);
+ }
+
+ public AttributeSet removeAttribute(AttributeSet old, Object name)
+ {
+ if (old instanceof MutableAttributeSet)
+ {
+ ((MutableAttributeSet)old).removeAttribute(name);
+ if (old.getAttributeCount() < getCompressionThreshold())
+ {
+ SmallAttributeSet small = createSmallAttributeSet(old);
+ if (!sharedAttributeSets.containsKey(small))
+ sharedAttributeSets.put(small,small);
+ old = (AttributeSet) sharedAttributeSets.get(small);
+ }
+ return old;
+ }
+ else
+ {
+ MutableAttributeSet mutable = createLargeAttributeSet(old);
+ mutable.removeAttribute(name);
+ SmallAttributeSet small = createSmallAttributeSet(mutable);
+ if (sharedAttributeSets.containsKey(small))
+ small = (SmallAttributeSet) sharedAttributeSets.get(small);
+ else
+ sharedAttributeSets.put(small,small);
+ return small;
+ }
+ }
+
+ public AttributeSet removeAttributes(AttributeSet old, AttributeSet attributes)
+ {
+ return removeAttributes(old, attributes.getAttributeNames());
+ }
+
+ public AttributeSet removeAttributes(AttributeSet old, Enumeration names)
+ {
+ if (old instanceof MutableAttributeSet)
+ {
+ ((MutableAttributeSet)old).removeAttributes(names);
+ if (old.getAttributeCount() < getCompressionThreshold())
+ {
+ SmallAttributeSet small = createSmallAttributeSet(old);
+ if (!sharedAttributeSets.containsKey(small))
+ sharedAttributeSets.put(small,small);
+ old = (AttributeSet) sharedAttributeSets.get(small);
+ }
+ return old;
+ }
+ else
+ {
+ MutableAttributeSet mutable = createLargeAttributeSet(old);
+ mutable.removeAttributes(names);
+ SmallAttributeSet small = createSmallAttributeSet(mutable);
+ if (sharedAttributeSets.containsKey(small))
+ small = (SmallAttributeSet) sharedAttributeSets.get(small);
+ else
+ sharedAttributeSets.put(small,small);
+ return small;
+ }
+ }
+
+
+ // FIXME: there's some sort of quasi-serialization stuff in here which I
+ // have left incomplete; I'm not sure I understand the intent properly.
+
+ public static Object getStaticAttribute(Object key)
+ {
+ throw new InternalError("not implemented");
+ }
+
+ public static Object getStaticAttributeKey(Object key)
+ {
+ throw new InternalError("not implemented");
+ }
+
+ public static void readAttributeSet(ObjectInputStream in, MutableAttributeSet a)
+ throws ClassNotFoundException, IOException
+ {
+ throw new InternalError("not implemented");
+ }
+
+ public static void writeAttributeSet(ObjectOutputStream out, AttributeSet a)
+ throws IOException
+ {
+ throw new InternalError("not implemented");
+ }
+
+ public void readAttributes(ObjectInputStream in, MutableAttributeSet a)
+ throws ClassNotFoundException, IOException
+ {
+ throw new InternalError("not implemented");
+ }
+
+ public void writeAttributes(ObjectOutputStream out, AttributeSet a)
+ throws IOException
+ {
+ throw new InternalError("not implemented");
+ }
+}
diff --git a/javax/swing/text/TabSet.java b/javax/swing/text/TabSet.java
new file mode 100644
index 000000000..58ae65ef0
--- /dev/null
+++ b/javax/swing/text/TabSet.java
@@ -0,0 +1,102 @@
+/* TabSet.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.io.Serializable;
+
+public class TabSet implements Serializable
+{
+ TabStop[] tabs;
+
+ public TabSet(TabStop[] t)
+ {
+ tabs = t;
+ }
+
+ public TabStop getTab(int i)
+ {
+ return tabs[i];
+ }
+
+ public TabStop getTabAfter(float location)
+ {
+ int idx = getTabIndexAfter(location);
+ if (idx == -1)
+ return null;
+ else
+ return tabs[idx];
+ }
+
+ public int getTabCount()
+ {
+ return tabs.length;
+ }
+
+ public int getTabIndex(TabStop tab)
+ {
+ for (int i = 0; i < tabs.length; ++i)
+ if (tabs[i] == tab)
+ return i;
+ return -1;
+ }
+
+ public int getTabIndexAfter(float location)
+ {
+ int idx = -1;
+ for (int i = 0; i < tabs.length; ++i)
+ {
+ if (location < tabs[i].getPosition())
+ idx = i;
+ }
+ return idx;
+ }
+
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("[");
+ for (int i = 0; i < tabs.length; ++i)
+ {
+ if (i != 0)
+ sb.append(" - ");
+ sb.append(tabs[i].toString());
+ }
+ sb.append("]");
+ return sb.toString();
+ }
+}
diff --git a/javax/swing/text/TabStop.java b/javax/swing/text/TabStop.java
new file mode 100644
index 000000000..2c95a63e4
--- /dev/null
+++ b/javax/swing/text/TabStop.java
@@ -0,0 +1,133 @@
+/* TabSet.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.io.Serializable;
+
+public class TabStop implements Serializable
+{
+ public static final int ALIGN_LEFT = 0;
+ public static final int ALIGN_RIGHT = 1;
+ public static final int ALIGN_CENTER = 2;
+ public static final int ALIGN_DECIMAL = 4;
+ public static final int ALIGN_BAR = 5;
+
+ public static final int LEAD_NONE = 0;
+ public static final int LEAD_DOTS = 1;
+ public static final int LEAD_HYPHENS = 2;
+ public static final int LEAD_UNDERLINE = 3;
+ public static final int LEAD_THICKLINE = 4;
+ public static final int LEAD_EQUALS = 5;
+
+ float pos;
+ int align;
+ int leader;
+
+ public TabStop(float pos)
+ {
+ this(pos, ALIGN_LEFT, LEAD_NONE);
+ }
+
+ public TabStop(float pos, int align, int leader)
+ {
+ this.pos = pos;
+ this.align = align;
+ this.leader = leader;
+ }
+
+ public boolean equals(Object other)
+ {
+ return (other != null)
+ && (other instanceof TabStop)
+ && (((TabStop)other).getPosition() == this.getPosition())
+ && (((TabStop)other).getLeader() == this.getLeader())
+ && (((TabStop)other).getAlignment() == this.getAlignment());
+ }
+
+ public int getAlignment()
+ {
+ return align;
+ }
+
+ public int getLeader()
+ {
+ return leader;
+ }
+
+ public float getPosition()
+ {
+ return pos;
+ }
+
+ public int hashCode()
+ {
+ return (int) pos + (int) leader + (int) align;
+ }
+
+ public String toString()
+ {
+ String prefix = "";
+ switch (align)
+ {
+ case ALIGN_LEFT:
+ prefix = "left ";
+ break;
+ case ALIGN_RIGHT:
+ prefix = "right ";
+ break;
+
+ case ALIGN_CENTER:
+ prefix = "center ";
+ break;
+
+ case ALIGN_DECIMAL:
+ prefix = "decimal ";
+ break;
+
+ case ALIGN_BAR:
+ prefix = "bar ";
+ break;
+
+ default:
+ break;
+ }
+
+ return (prefix + "tab @" + pos + ((leader == LEAD_NONE) ? "" : "(w/leaders)"));
+ }
+
+}
diff --git a/javax/swing/text/TextAction.java b/javax/swing/text/TextAction.java
index bfa723157..bdcf95095 100644
--- a/javax/swing/text/TextAction.java
+++ b/javax/swing/text/TextAction.java
@@ -54,7 +54,7 @@ public abstract class TextAction extends AbstractAction
*/
public TextAction(String name)
{
- // TODO
+ super(name);
}
/**
@@ -64,7 +64,11 @@ public abstract class TextAction extends AbstractAction
*/
protected final JTextComponent getTextComponent(ActionEvent event)
{
- return null; // TODO
+ if (event.getSource() != null &&
+ event.getSource() instanceof JTextComponent)
+ return (JTextComponent) event.getSource();
+ else
+ return getFocusedComponent();
}
/**
diff --git a/javax/swing/text/Utilities.java b/javax/swing/text/Utilities.java
new file mode 100644
index 000000000..61c13eef5
--- /dev/null
+++ b/javax/swing/text/Utilities.java
@@ -0,0 +1,182 @@
+/* Utilities.java --
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.swing.text;
+
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+
+/**
+ * A set of utilities to deal with text. This is used by several other classes
+ * inside this package.
+ *
+ * @author Roman Kennke <roman@ontographics.com>
+ */
+public class Utilities
+{
+ /**
+ * The length of the char buffer that holds the characters to be drawn.
+ */
+ private static final int BUF_LENGTH = 64;
+
+ /**
+ * Creates a new <code>Utilities</code> object.
+ */
+ public Utilities()
+ {
+ // Nothing to be done here.
+ }
+
+ /**
+ * Draws the given text segment. Contained tabs and newline characters
+ * are taken into account. Tabs are expanded using the
+ * specified {@link TabExpander}.
+ *
+ * @param s the text fragment to be drawn.
+ * @param x the x position for drawing.
+ * @param y the y position for drawing.
+ * @param g the {@link Graphics} context for drawing.
+ * @param e the {@link TabExpander} which specifies the Tab-expanding
+ * technique.
+ * @param startOffset starting offset in the text.
+ * @return the x coordinate at the end of the drawn text.
+ */
+ public static final int drawTabbedText(Segment s, int x, int y, Graphics g,
+ TabExpander e, int startOffset)
+ {
+ // This buffers the chars to be drawn.
+ char[] buffer = s.array;
+
+
+ // The current x and y pixel coordinates.
+ int pixelX = x;
+ int pixelY = y;
+
+ // The font metrics of the current selected font.
+ FontMetrics metrics = g.getFontMetrics();
+ int ascent = metrics.getAscent();
+
+ for (int offset = s.offset; offset < (s.offset + s.count); ++offset)
+ {
+ switch (buffer[offset])
+ {
+ case '\t':
+ // In case we have a tab, we just 'jump' over the tab.
+ // When we have no tab expander we just use the width of 'm'.
+ if (e != null)
+ pixelX = (int) e.nextTabStop((float) pixelX,
+ startOffset + offset - s.offset);
+ else
+ pixelX += metrics.charWidth(' ');
+ break;
+ case '\n':
+ // In case we have a newline, we must draw
+ // the buffer and jump on the next line.
+ g.drawChars(buffer, offset, 1, pixelX, y);
+ pixelY += metrics.getHeight();
+ pixelX = x;
+ break;
+ default:
+ // Here we draw the char.
+ g.drawChars(buffer, offset, 1, pixelX, pixelY + ascent);
+ pixelX += metrics.charWidth(buffer[offset]);
+ break;
+ }
+ }
+
+ return pixelX;
+ }
+
+ /**
+ * Determines the width, that the given text <code>s</code> would take
+ * if it was printed with the given {@link java.awt.FontMetrics} on the
+ * specified screen position.
+ * @param s the text fragment
+ * @param metrics the font metrics of the font to be used
+ * @param x the x coordinate of the point at which drawing should be done
+ * @param e the {@link TabExpander} to be used
+ * @param startOffset the index in <code>s</code> where to start
+ * @returns the width of the given text s. This takes tabs and newlines
+ * into account.
+ */
+ public static final int getTabbedTextWidth(Segment s, FontMetrics metrics,
+ int x, TabExpander e,
+ int startOffset)
+ {
+ // This buffers the chars to be drawn.
+ char[] buffer = s.array;
+
+ // The current x coordinate.
+ int pixelX = x;
+
+ // The current maximum width.
+ int maxWidth = 0;
+
+ for (int offset = s.offset; offset < (s.offset + s.count); ++offset)
+ {
+ switch (buffer[offset])
+ {
+ case '\t':
+ // In case we have a tab, we just 'jump' over the tab.
+ // When we have no tab expander we just use the width of 'm'.
+ if (e != null)
+ pixelX = (int) e.nextTabStop((float) pixelX,
+ startOffset + offset - s.offset);
+ else
+ pixelX += metrics.charWidth(' ');
+ break;
+ case '\n':
+ // In case we have a newline, we must 'draw'
+ // the buffer and jump on the next line.
+ pixelX += metrics.charWidth(buffer[offset]);
+ maxWidth = Math.max(maxWidth, pixelX - x);
+ pixelX = x;
+ break;
+ default:
+ // Here we draw the char.
+ pixelX += metrics.charWidth(buffer[offset]);
+ break;
+ }
+ }
+
+ // Take the last line into account.
+ maxWidth = Math.max(maxWidth, pixelX - x);
+
+ return maxWidth;
+ }
+}
diff --git a/javax/swing/text/View.java b/javax/swing/text/View.java
index 00c6368ae..5ff46ed22 100644
--- a/javax/swing/text/View.java
+++ b/javax/swing/text/View.java
@@ -174,5 +174,36 @@ public abstract class View implements SwingConstants
{
return elt.getEndOffset();
}
+
+ public Shape getChildAllocation(int index, Shape a)
+ {
+ return null;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public int getViewIndex(float x, float y, Shape allocation)
+ {
+ return -1;
+ }
+
+ /**
+ * @since 1.4
+ */
+ public String getToolTipText(float x, float y, Shape allocation)
+ {
+ int index = getViewIndex(x, y, allocation);
+
+ if (index < -1)
+ return null;
+
+ Shape childAllocation = getChildAllocation(index, allocation);
+
+ if (childAllocation.getBounds().contains(x, y))
+ return getView(index).getToolTipText(x, y, childAllocation);
+
+ return null;
+ }
}
diff --git a/javax/swing/text/html/HTML.java b/javax/swing/text/html/HTML.java
index 7a2403631..098a14715 100644
--- a/javax/swing/text/html/HTML.java
+++ b/javax/swing/text/html/HTML.java
@@ -59,6 +59,11 @@ public class HTML
public static class UnknownTag extends Tag implements Serializable
{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -1534369342247250625L;
+
public UnknownTag(String id)
{
super(id);
diff --git a/lib/Makefile.am b/lib/Makefile.am
index 1516fe63b..3d9df3910 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -18,10 +18,10 @@ propertyfiles := $(shell cd $(top_srcdir)/resource && $(FIND) gnu java org -nam
# handling source to bytecode compiler programs like gcj, jikes and kjc
if FOUND_GCJ
-JAVAC = $(GCJ) --bootclasspath '' --classpath $(top_srcdir):$(top_srcdir)/external/jaxp/source:$(top_builddir)/vm/current:.:$(USER_CLASSLIB) -C -d . @classes
+JAVAC = $(GCJ) --bootclasspath '' --classpath $(top_srcdir):$(top_builddir)/vm/current:.:$(USER_CLASSLIB) -C -d . @classes
else
if FOUND_JIKES
-JAVAC = $(JIKES) +F -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_srcdir):$(top_srcdir)/external/jaxp/source:$(top_builddir)/vm/current:.:$(USER_CLASSLIB) -d . @classes
+JAVAC = $(JIKES) +F -bootclasspath '' -extdirs '' -sourcepath '' --classpath $(top_srcdir):$(top_builddir)/vm/current:.:$(USER_CLASSLIB) -d . @classes
else
if FOUND_KJC
JAVAC = $(KJC) -classpath .:$(USER_CLASSLIB) -d . @classes
diff --git a/lib/gen-classlist.sh.in b/lib/gen-classlist.sh.in
index ead9604da..3b8cb89bf 100755
--- a/lib/gen-classlist.sh.in
+++ b/lib/gen-classlist.sh.in
@@ -1,9 +1,9 @@
#! @SH@
# @configure_input@
if test "@top_srcdir@" = "${top_builddir}"; then
- @FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu @top_srcdir@/external/jaxp/source @top_srcdir@/org ${top_builddir}/vm/current -follow -type f -print | grep '\.java$' > ${top_builddir}/lib/classes.1
+ @FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu @top_srcdir@/org ${top_builddir}/vm/current -follow -type f -print | grep '\.java$' > ${top_builddir}/lib/classes.1
else
- @FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu @top_srcdir@/external/jaxp/source @top_srcdir@/org ${top_builddir}/gnu ${top_builddir}/vm/current -follow -type f -print | grep '\.java$' > ${top_builddir}/lib/classes.1
+ @FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu @top_srcdir@/org ${top_builddir}/gnu ${top_builddir}/vm/current -follow -type f -print | grep '\.java$' > ${top_builddir}/lib/classes.1
fi
for filexp in `cat @top_srcdir@/lib/$1.omit` ; do { grep -v ${filexp} < ${top_builddir}/lib/classes.1 > ${top_builddir}/lib/classes.2 ; mv ${top_builddir}/lib/classes.2 ${top_builddir}/lib/classes.1 ; } ; done
diff --git a/lib/resources b/lib/resources
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/lib/resources
diff --git a/native/jni/gtk-peer/Makefile.am b/native/jni/gtk-peer/Makefile.am
index 3456e6ed2..83e0d0ce7 100644
--- a/native/jni/gtk-peer/Makefile.am
+++ b/native/jni/gtk-peer/Makefile.am
@@ -27,6 +27,7 @@ libgtkpeer_la_SOURCES = $(gtk_cairo_c_source_files) \
gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c \
gnu_java_awt_peer_gtk_GtkEvents.c \
gnu_java_awt_peer_gtk_GtkFileDialogPeer.c \
+ gnu_java_awt_peer_gtk_GtkFramePeer.c \
gnu_java_awt_peer_gtk_GtkGenericPeer.c \
gnu_java_awt_peer_gtk_GtkImagePainter.c \
gnu_java_awt_peer_gtk_GtkLabelPeer.c \
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
index 5e8562455..78e65afc0 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGlyphVector.c
@@ -1,5 +1,5 @@
/* gdkglyphvector.c
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -273,49 +273,58 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_setChars
pango_context_set_font_description (vec->ctx, vec->desc);
- items = pango_itemize (vec->ctx, str, 0, len, attrs, NULL);
- g_assert (items != NULL);
-
- /*
- step 2: for each item:
- - shape the item into a glyphstring
- - store the (item, glyphstring) pair in the vec->glyphitems list
- */
-
if (vec->glyphitems != NULL)
+ items = pango_itemize (vec->ctx, str, 0, len, attrs, NULL);
+ if (items != NULL)
{
- free_glyphitems (vec->glyphitems);
- vec->glyphitems = NULL;
- }
-
- for (item = g_list_first (items); item != NULL; item = g_list_next (item))
- {
- g_assert (item->data != NULL);
-
- gi = NULL;
- gi = g_malloc0 (sizeof(PangoGlyphItem));
- g_assert (gi != NULL);
-
- gi->item = (PangoItem *)item->data;
- gi->glyphs = pango_glyph_string_new ();
- g_assert (gi->glyphs != NULL);
-
- pango_shape (str + gi->item->offset,
- gi->item->length,
- &(gi->item->analysis),
- gi->glyphs);
-
- vec->glyphitems = g_list_append (vec->glyphitems, gi);
+
+ /*
+ step 2: for each item:
+ - shape the item into a glyphstring
+ - store the (item, glyphstring) pair in the vec->glyphitems list
+ */
+
+ if (vec->glyphitems != NULL)
+ {
+ free_glyphitems (vec->glyphitems);
+ vec->glyphitems = NULL;
+ }
+
+ for (item = g_list_first (items);
+ item != NULL;
+ item = g_list_next (item))
+ {
+ g_assert (item->data != NULL);
+
+ gi = NULL;
+ gi = g_malloc0 (sizeof(PangoGlyphItem));
+ g_assert (gi != NULL);
+
+ gi->item = (PangoItem *)item->data;
+ gi->glyphs = pango_glyph_string_new ();
+ g_assert (gi->glyphs != NULL);
+
+ if (gi->glyphs->num_glyphs > 0)
+ {
+ pango_shape (str + gi->item->offset,
+ gi->item->length,
+ &(gi->item->analysis),
+ gi->glyphs);
+
+ vec->glyphitems = g_list_append (vec->glyphitems, gi);
+ }
+ }
+
+ /*
+ ownership of each item has been transferred to glyphitems,
+ but the list should be freed.
+ */
+
+ g_list_free (items);
}
- /*
- ownership of each item has been transferred to glyphitems,
- but the list should be freed.
- */
-
- g_list_free (items);
pango_attr_list_unref (attrs);
-
+
(*env)->ReleaseStringUTFChars (env, chars, str);
gdk_threads_leave ();
}
@@ -436,33 +445,36 @@ JNIEXPORT jdoubleArray JNICALL Java_gnu_java_awt_peer_gtk_GdkGlyphVector_allInkE
g_assert (self != NULL);
vec = (struct glyphvec *)NSA_GET_GV_PTR (env, self);
g_assert (vec != NULL);
- g_assert (vec->glyphitems != NULL);
-
- pointsize = pango_font_description_get_size (vec->desc);
- pointsize /= (double) PANGO_SCALE;
-
- for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
+ if (vec->glyphitems != NULL)
{
- g_assert (i->data != NULL);
- gi = (PangoGlyphItem *)i->data;
- g_assert (gi->glyphs != NULL);
-
- face = pango_ft2_font_get_face (gi->item->analysis.font);
- assume_pointsize_and_identity_transform (pointsize, face);
+ pointsize = pango_font_description_get_size (vec->desc);
+ pointsize /= (double) PANGO_SCALE;
- for (j = 0; j < gi->glyphs->num_glyphs; ++j)
+ for (i = g_list_first (vec->glyphitems); i != NULL; i = g_list_next (i))
{
- FT_Load_Glyph (face, gi->glyphs->glyphs[j].glyph, FT_LOAD_DEFAULT);
- /* FIXME: this needs to change for vertical layouts */
- tmp.x = x + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX);
- tmp.y = y + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY);
- tmp.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width);
- tmp.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height);
- union_rects (&rect, &tmp);
- x += DOUBLE_FROM_26_6 (face->glyph->advance.x);
- y += DOUBLE_FROM_26_6 (face->glyph->advance.y);
- }
- }
+ g_assert (i->data != NULL);
+ gi = (PangoGlyphItem *)i->data;
+ g_assert (gi->glyphs != NULL);
+
+ face = pango_ft2_font_get_face (gi->item->analysis.font);
+ assume_pointsize_and_identity_transform (pointsize, face);
+
+ for (j = 0; j < gi->glyphs->num_glyphs; ++j)
+ {
+ FT_Load_Glyph (face,
+ gi->glyphs->glyphs[j].glyph,
+ FT_LOAD_DEFAULT);
+ /* FIXME: this needs to change for vertical layouts */
+ tmp.x = x + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingX);
+ tmp.y = y + DOUBLE_FROM_26_6 (face->glyph->metrics.horiBearingY);
+ tmp.width = DOUBLE_FROM_26_6 (face->glyph->metrics.width);
+ tmp.height = DOUBLE_FROM_26_6 (face->glyph->metrics.height);
+ union_rects (&rect, &tmp);
+ x += DOUBLE_FROM_26_6 (face->glyph->advance.x);
+ y += DOUBLE_FROM_26_6 (face->glyph->advance.y);
+ }
+ }
+ }
ret = rect_to_array (env, &rect);
gdk_threads_leave ();
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
index a79ed5eb0..d537d9a40 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics.c
@@ -108,19 +108,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_initState__Lgnu_ja
gdk_threads_enter ();
widget = GTK_WIDGET (ptr);
-
- if (GTK_IS_WINDOW (widget))
- {
- g->drawable = find_gtk_layout (widget)->bin_window;
- }
- else if (GTK_IS_LAYOUT (widget))
- {
- g->drawable = (GdkDrawable *) GTK_LAYOUT (widget)->bin_window;
- }
- else
- {
- g->drawable = (GdkDrawable *) widget->window;
- }
+ g->drawable = (GdkDrawable *) widget->window;
gdk_window_ref (g->drawable);
g->cm = gtk_widget_get_colormap (widget);
@@ -432,8 +420,8 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkGraphics_clearRect
gdk_threads_enter ();
if (GDK_IS_WINDOW (g->drawable))
{
- gdk_window_clear_area ((GdkWindow *)g->drawable,
- x + g->x_offset, y + g->y_offset, width, height);
+ gdk_window_clear_area ((GdkWindow *) g->drawable,
+ x + g->x_offset, y + g->y_offset, width, height);
}
else
{
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
index e4d223c54..a13fdada9 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GdkGraphics2D.c
@@ -159,18 +159,7 @@ grab_current_drawable (GtkWidget *widget, GdkDrawable **draw, GdkWindow **win)
g_assert (draw != NULL);
g_assert (win != NULL);
- if (GTK_IS_WINDOW (widget))
- {
- *win = find_gtk_layout (widget)->bin_window;
- }
- else if (GTK_IS_LAYOUT (widget))
- {
- *win = GTK_LAYOUT (widget)->bin_window;
- }
- else
- {
- *win = widget->window;
- }
+ *win = widget->window;
*draw = *win;
gdk_window_get_internal_paint_info (*win, draw, 0, 0);
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
index 08d38b587..ed6328f46 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkButtonPeer.c
@@ -37,14 +37,21 @@ exception statement from your version. */
#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include "gnu_java_awt_peer_gtk_GtkButtonPeer.h"
+static gboolean focus_in_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ jobject peer);
+static gboolean focus_out_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ jobject peer);
+
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
(JNIEnv *env, jobject obj, jstring label)
{
const char *c_label;
+ GtkWidget *eventbox;
GtkWidget *button;
NSA_SET_GLOBAL_REF (env, obj);
@@ -53,41 +60,46 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_create
gdk_threads_enter ();
+ eventbox = gtk_event_box_new ();
button = gtk_button_new_with_label (c_label);
+ gtk_container_add (GTK_CONTAINER (eventbox), button);
gtk_widget_show (button);
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, label, c_label);
- NSA_SET_PTR (env, obj, button);
+ NSA_SET_PTR (env, obj, eventbox);
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectJObject
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
(JNIEnv *env, jobject obj)
{
void *ptr;
+ jobject *gref;
+ GtkWidget *button;
ptr = NSA_GET_PTR (env, obj);
+ gref = NSA_GET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
gtk_widget_realize (GTK_WIDGET (ptr));
+ button = gtk_bin_get_child (GTK_BIN (ptr));
- connect_awt_hook (env, obj, 1, GTK_BUTTON(ptr)->event_window);
+ g_signal_connect (G_OBJECT (ptr), "event",
+ G_CALLBACK (pre_event_handler), *gref);
- gdk_threads_leave ();
-}
+ g_signal_connect (G_OBJECT (button), "event",
+ G_CALLBACK (pre_event_handler), *gref);
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkButtonPeer_connectSignals
- (JNIEnv *env, jobject obj)
-{
- /* FIXME: Do we need to connect any signals here? Otherwise just do not
- override parent method. */
+ g_signal_connect (G_OBJECT (button), "focus-in-event",
+ G_CALLBACK (focus_in_cb), *gref);
+
+ g_signal_connect (G_OBJECT (button), "focus-out-event",
+ G_CALLBACK (focus_out_cb), *gref);
- /* Connect the superclass signals. */
- Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
+ gdk_threads_leave ();
}
JNIEXPORT void JNICALL
@@ -113,7 +125,7 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetLabel
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
@@ -186,3 +198,42 @@ Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkActivate
gdk_threads_leave ();
}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkButtonPeer_gtkWidgetRequestFocus
+ (JNIEnv *env, jobject obj)
+{
+ void *ptr;
+ GtkWidget *button;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+ button = gtk_bin_get_child (GTK_BIN (ptr));
+ gtk_widget_grab_focus (button);
+ gdk_threads_leave ();
+}
+
+static gboolean
+focus_in_cb (GtkWidget *widget __attribute((unused)),
+ GdkEventFocus *event __attribute((unused)),
+ jobject peer)
+{
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postFocusEventID,
+ AWT_FOCUS_GAINED,
+ JNI_FALSE);
+ return FALSE;
+}
+
+static gboolean
+focus_out_cb (GtkWidget *widget __attribute((unused)),
+ GdkEventFocus *event __attribute((unused)),
+ jobject peer)
+{
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postFocusEventID,
+ AWT_FOCUS_LOST,
+ JNI_FALSE);
+ return FALSE;
+}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
index 153b17fe3..ade743023 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer.c
@@ -46,7 +46,6 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
GtkWidget *widget;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
@@ -54,7 +53,6 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxMenuItemPeer_create
gdk_threads_enter ();
widget = gtk_check_menu_item_new_with_label (str);
- gtk_check_menu_item_set_show_toggle (GTK_CHECK_MENU_ITEM (widget), 1);
gtk_widget_show (widget);
gdk_threads_leave ();
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
index 4d5c8114c..3b58c05d7 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkCheckboxPeer.c
@@ -144,7 +144,7 @@ Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkToggleButtonSetActive
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkCheckboxPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
index 8aaf0d262..3240a3524 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkComponentPeer.c
@@ -49,6 +49,7 @@ static gboolean focus_in_cb (GtkWidget *widget,
static gboolean focus_out_cb (GtkWidget *widget,
GdkEventFocus *event,
jobject peer);
+
/*
* This method returns a GDK keyval that corresponds to one of the
* keysyms in the X keymap table. The return value is only used to
@@ -492,12 +493,12 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
if (GTK_IS_WINDOW (parent_widget))
{
GList *children = gtk_container_children
- (GTK_CONTAINER (GTK_BIN (parent_widget)->child));
+ (GTK_CONTAINER (parent_widget));
if (GTK_IS_MENU_BAR (children->data))
- gtk_layout_put (GTK_LAYOUT (children->next->data), widget, 0, 0);
+ gtk_fixed_put (GTK_FIXED (children->next->data), widget, 0, 0);
else
- gtk_layout_put (GTK_LAYOUT (children->data), widget, 0, 0);
+ gtk_fixed_put (GTK_FIXED (children->data), widget, 0, 0);
}
else
if (GTK_IS_SCROLLED_WINDOW (parent_widget))
@@ -509,7 +510,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetParent
}
else
- gtk_layout_put (GTK_LAYOUT (parent_widget), widget, 0, 0);
+ gtk_fixed_put (GTK_FIXED (parent_widget), widget, 0, 0);
gdk_threads_leave ();
}
@@ -792,7 +793,7 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_setNativeBoun
else
{
gtk_widget_set_size_request (widget, width, height);
- gtk_layout_move (GTK_LAYOUT (widget->parent), widget, x, y);
+ gtk_fixed_move (GTK_FIXED (widget->parent), widget, x, y);
}
gdk_threads_leave ();
@@ -908,38 +909,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetSetForeground
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkSetFont
- (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
-{
- const char *font_name;
- void *ptr;
- PangoFontDescription *font_desc;
-
- ptr = NSA_GET_PTR (env, obj);
-
- font_name = (*env)->GetStringUTFChars (env, name, NULL);
-
- gdk_threads_enter();
-
- font_desc = pango_font_description_from_string (font_name);
- pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
-
- if (style & AWT_STYLE_BOLD)
- pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
-
- if (style & AWT_STYLE_ITALIC)
- pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
-
- gtk_widget_modify_font (GTK_WIDGET(ptr), font_desc);
-
- pango_font_description_free (font_desc);
-
- gdk_threads_leave();
-
- (*env)->ReleaseStringUTFChars (env, name, font_name);
-}
-
-JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_show
(JNIEnv *env, jobject obj)
{
@@ -965,23 +934,6 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_hide
gdk_threads_leave();
}
-GtkLayout *
-find_gtk_layout (GtkWidget *parent)
-{
- if (GTK_IS_WINDOW (parent))
- {
- GList *children = gtk_container_children
- (GTK_CONTAINER (GTK_BIN (parent)->child));
-
- if (GTK_IS_MENU_BAR (children->data))
- return GTK_LAYOUT (children->next->data);
- else /* GTK_IS_LAYOUT (children->data) */
- return GTK_LAYOUT (children->data);
- }
-
- return NULL;
-}
-
JNIEXPORT jboolean JNICALL
Java_gnu_java_awt_peer_gtk_GtkComponentPeer_isEnabled
(JNIEnv *env, jobject obj)
@@ -1013,141 +965,7 @@ Java_gnu_java_awt_peer_gtk_GtkComponentPeer_modalHasGrab
return retval;
}
-static gboolean
-filter_expose_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
-{
- /*
- * Prevent the default event handler from getting this signal if applicable
- * FIXME: I came up with these filters by looking for patterns in the unwanted
- * expose events that are fed back to us from gtk/X. Perhaps there is
- * a way to prevent them from occuring in the first place.
- */
- if (event->type == GDK_EXPOSE && (!GTK_IS_LAYOUT(widget)
- || event->any.window != widget->window))
- {
- g_signal_stop_emission_by_name(GTK_OBJECT(widget), "event");
- return FALSE;
- }
- else
- {
- /* There may be non-expose events that are triggered while we're
- painting a heavyweight peer. */
- return pre_event_handler(widget, event, peer);
- }
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_addExposeFilter
- (JNIEnv *env, jobject obj)
-{
- GtkObject *filterobj;
- GtkWidget *vbox, *layout;
- GList *children;
- void *ptr = NSA_GET_PTR (env, obj);
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
- gulong hid;
-
- g_assert (gref);
-
- gdk_threads_enter ();
-
- /* GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
- Events go to the GtkLayout layer, so we filter them there. */
- if (GTK_IS_WINDOW(ptr))
- {
- children = gtk_container_get_children(GTK_CONTAINER(ptr));
- vbox = children->data;
- g_assert (GTK_IS_VBOX(vbox));
-
- children = gtk_container_get_children(GTK_CONTAINER(vbox));
- do
- {
- layout = children->data;
- children = children->next;
- }
- while (!GTK_IS_LAYOUT (layout) && children != NULL);
- g_assert (GTK_IS_LAYOUT(layout));
-
- filterobj = GTK_OBJECT(layout);
- }
- else if (GTK_IS_SCROLLED_WINDOW(ptr))
- {
- /* The event will go to the parent GtkLayout. */
- filterobj = GTK_OBJECT(GTK_WIDGET(ptr)->parent);
- }
- else
- {
- filterobj = GTK_OBJECT(ptr);
- }
- hid = g_signal_handler_find(filterobj,
- G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, *pre_event_handler, NULL);
- if (hid > 0)
- {
- g_signal_handler_block(filterobj, hid);
- }
- g_signal_connect( filterobj, "event",
- G_CALLBACK(filter_expose_event_handler), *gref);
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_removeExposeFilter
- (JNIEnv *env, jobject obj)
-{
- GtkObject *filterobj;
- GtkWidget *vbox, *layout;
- GList *children;
- void *ptr = NSA_GET_PTR (env, obj);
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
- gulong hid;
-
- g_assert (gref);
-
- gdk_threads_enter ();
-
- /* GtkFramePeer is built as a GtkLayout inside a GtkVBox inside a GtkWindow.
- Events go to the GtkLayout layer, so we filter them there. */
- if (GTK_IS_WINDOW(ptr))
- {
- children = gtk_container_get_children(GTK_CONTAINER(ptr));
- vbox = children->data;
- g_assert (GTK_IS_VBOX(vbox));
-
- children = gtk_container_get_children(GTK_CONTAINER(vbox));
- do
- {
- layout = children->data;
- children = children->next;
- }
- while (!GTK_IS_LAYOUT (layout) && children != NULL);
- g_assert (GTK_IS_LAYOUT(layout));
-
- filterobj = GTK_OBJECT(layout);
- }
- else if (GTK_IS_SCROLLED_WINDOW(ptr))
- {
- /* The event will go to the parent GtkLayout. */
- filterobj = GTK_OBJECT(GTK_WIDGET(ptr)->parent);
- }
- else
- {
- filterobj = GTK_OBJECT(ptr);
- }
-
- g_signal_handlers_disconnect_by_func (filterobj,
- *filter_expose_event_handler, *gref);
- hid = g_signal_handler_find(filterobj,
- G_SIGNAL_MATCH_FUNC,
- 0, 0, NULL, *pre_event_handler, NULL);
- if (hid > 0)
- {
- g_signal_handler_unblock(filterobj, hid);
- }
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueueDrawArea
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetRepaintArea
(JNIEnv *env, jobject obj, jint x, jint y, jint width, jint height)
{
GdkRectangle rect;
@@ -1155,15 +973,15 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_gtkWidgetQueu
ptr = NSA_GET_PTR (env, obj);
- rect.x = x + GTK_WIDGET(ptr)->allocation.x;
- rect.y = y + GTK_WIDGET(ptr)->allocation.y;
+ gdk_threads_enter ();
+
+ rect.x = x;
+ rect.y = y;
rect.width = width;
rect.height = height;
- gdk_threads_enter ();
-
gdk_window_invalidate_rect (GTK_WIDGET (ptr)->window, &rect, 0);
- gdk_window_process_all_updates();
+ gdk_window_process_updates (GTK_WIDGET (ptr)->window, TRUE);
gdk_threads_leave ();
}
@@ -1187,23 +1005,19 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectJObjec
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals
(JNIEnv *env, jobject obj)
{
- void *ptr = NSA_GET_PTR (env, obj);
- jobject *gref = NSA_GET_GLOBAL_REF (env, obj);
- g_assert (gref);
+ void *ptr;
+ jobject *gref;
+
+ ptr = NSA_GET_PTR (env, obj);
+ gref = NSA_GET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
gtk_widget_realize (GTK_WIDGET (ptr));
-
- /* FIXME: We could check here if this is a scrolled window with a
- single child that does not have an associated jobject. This
- means that it is one of our wrapped widgets like List or TextArea
- and thus we could connect the signal to the child without having
- to specialize this method. */
/* Connect EVENT signal, which happens _before_ any specific signal. */
- g_signal_connect (GTK_OBJECT (ptr), "event",
+ g_signal_connect (GTK_OBJECT (ptr), "event",
G_CALLBACK (pre_event_handler), *gref);
g_signal_connect (G_OBJECT (ptr), "focus-in-event",
@@ -1235,19 +1049,7 @@ find_bg_color_widget (GtkWidget *widget)
{
GtkWidget *bg_color_widget;
- if (GTK_IS_WINDOW (widget))
- {
- GtkWidget *vbox;
- GList* children;
-
- children = gtk_container_get_children(GTK_CONTAINER(widget));
- vbox = children->data;
-
- children = gtk_container_get_children(GTK_CONTAINER(vbox));
- bg_color_widget = children->data;
- }
- else
- bg_color_widget = widget;
+ bg_color_widget = widget;
return bg_color_widget;
}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
index c98473f54..61e1af101 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer.c
@@ -45,22 +45,18 @@ Java_gnu_java_awt_peer_gtk_GtkEmbeddedWindowPeer_create
(JNIEnv *env, jobject obj, jlong socket_id)
{
GtkWidget *window;
- GtkWidget *vbox, *layout;
+ GtkWidget *fixed;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
window = gtk_plug_new ((GdkNativeWindow) socket_id);
- vbox = gtk_vbox_new (0, 0);
- layout = gtk_layout_new (NULL, NULL);
- gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (window), vbox);
+ fixed = gtk_fixed_new ();
+ gtk_container_add (GTK_CONTAINER (window), fixed);
- gtk_widget_show (layout);
- gtk_widget_show (vbox);
+ gtk_widget_show (fixed);
gdk_threads_leave ();
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
index 7cf405df9..15c221dca 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c
@@ -1010,23 +1010,12 @@ pre_event_handler (GtkWidget *widget, GdkEvent *event, jobject peer)
}
break;
case GDK_EXPOSE:
- {
- /* This filters out unwanted feedback expose events from gtk/X
- when we explictly invalidate and update heavyweight components,
- thus avoiding an infinite loop.
- FIXME: I'm not quite sure why we're getting these expose events.
- Maybe there is a way to avoid them? */
- if((event->any.window == widget->window && event->any.send_event)
- || GTK_IS_LAYOUT(widget))
- {
- (*gdk_env)->CallVoidMethod (gdk_env, peer,
- postExposeEventID,
- (jint)event->expose.area.x,
- (jint)event->expose.area.y,
- (jint)event->expose.area.width,
- (jint)event->expose.area.height);
- }
- }
+ (*gdk_env)->CallVoidMethod (gdk_env, peer,
+ postExposeEventID,
+ (jint)event->expose.area.x,
+ (jint)event->expose.area.y,
+ (jint)event->expose.area.width,
+ (jint)event->expose.area.height);
break;
case GDK_FOCUS_CHANGE:
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
new file mode 100644
index 000000000..14c9be5da
--- /dev/null
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkFramePeer.c
@@ -0,0 +1,179 @@
+/* gtkframepeer.c -- Native implementation of GtkFramePeer
+ Copyright (C) 1998, 1999, 2002 Free Software Foundation, Inc.
+
+ This file is part of GNU Classpath.
+
+ GNU Classpath is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2, or (at your option)
+ any later version.
+
+ GNU Classpath is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNU Classpath; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Linking this library statically or dynamically with other modules is
+ making a combined work based on this library. Thus, the terms and
+ conditions of the GNU General Public License cover the whole
+ combination.
+
+ As a special exception, the copyright holders of this library give you
+ permission to link this library with independent modules to produce an
+ executable, regardless of the license terms of these independent
+ modules, and to copy and distribute the resulting executable under
+ terms of your choice, provided that you also meet, for each linked
+ independent module, the terms and conditions of the license of that
+ module. An independent module is a module which is not derived from
+ or based on this library. If you modify this library, you may extend
+ this exception to your version of the library, but you are not
+ obligated to do so. If you do not wish to do so, delete this
+ exception statement from your version. */
+
+#include "gtkpeer.h"
+#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
+ (JNIEnv *env, jobject obj)
+{
+ void *ptr;
+ void *mptr;
+ void *fixed;
+ GList* children;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+ children = gtk_container_get_children (GTK_CONTAINER (fixed));
+
+ while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
+ {
+ children = children->next;
+ }
+
+ /* If there's a menu bar, remove it. */
+ if (children != NULL)
+ {
+ mptr = children->data;
+
+ /* This will actually destroy the MenuBar. By removing it from
+ its parent, the reference count for the MenuBar widget will
+ decrement to 0. The widget will be automatically destroyed by
+ GTK. */
+ gtk_container_remove (GTK_CONTAINER (fixed), GTK_WIDGET (mptr));
+ }
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
+ (JNIEnv *env, jobject obj, jobject menubar)
+{
+ void *ptr;
+ void *mptr;
+ void *fixed;
+
+ ptr = NSA_GET_PTR (env, obj);
+ mptr = NSA_GET_PTR (env, menubar);
+
+ gdk_threads_enter ();
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+ gtk_fixed_put (GTK_FIXED (fixed), mptr, 0, 0);
+ gtk_widget_show (mptr);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT jint JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
+ (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar)
+{
+ GtkWidget *ptr;
+ GtkRequisition requisition;
+
+ ptr = NSA_GET_PTR (env, menubar);
+
+ gdk_threads_enter ();
+
+ gtk_widget_size_request (ptr, &requisition);
+
+ gdk_threads_leave ();
+
+ return requisition.height;
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarWidth
+ (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar, jint width)
+{
+ GtkWidget *ptr;
+ GtkRequisition natural_req;
+
+ ptr = NSA_GET_PTR (env, menubar);
+
+ gdk_threads_enter ();
+
+ /* Get the menubar's natural size request. */
+ gtk_widget_set_size_request (GTK_WIDGET (ptr), -1, -1);
+ gtk_widget_size_request (GTK_WIDGET (ptr), &natural_req);
+
+ /* Set the menubar's size request to width by natural_req.height. */
+ gtk_widget_set_size_request (GTK_WIDGET (ptr),
+ width, natural_req.height);
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkFixedSetVisible
+ (JNIEnv *env, jobject obj, jboolean visible)
+{
+ void *ptr;
+ void *fixed;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+
+ fixed = gtk_container_get_children (GTK_CONTAINER (ptr))->data;
+
+ if (visible)
+ gtk_widget_show (GTK_WIDGET (fixed));
+ else
+ gtk_widget_hide (GTK_WIDGET (fixed));
+
+ gdk_threads_leave ();
+}
+
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImage
+ (JNIEnv *env, jobject obj, jobject decoder)
+{
+ void *ptr;
+ GdkPixbufLoader *loader = NULL;
+ GdkPixbuf *pixbuf = NULL;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ loader = NSA_GET_PB_PTR (env, decoder);
+ g_assert (loader != NULL);
+
+ gdk_threads_enter ();
+
+ pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
+ g_assert (pixbuf != NULL);
+
+ gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
+
+ gdk_threads_leave ();
+}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
index 7b8babeb8..493e93df2 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkGenericPeer.c
@@ -57,3 +57,34 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkGenericPeer_dispose
gdk_threads_leave ();
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkGenericPeer_gtkWidgetModifyFont
+ (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+ const char *font_name;
+ void *ptr;
+ PangoFontDescription *font_desc;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+ gdk_threads_enter();
+
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
+
+ if (style & AWT_STYLE_BOLD)
+ pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+ if (style & AWT_STYLE_ITALIC)
+ pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+ gtk_widget_modify_font (GTK_WIDGET(ptr), font_desc);
+
+ pango_font_description_free (font_desc);
+
+ gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, name, font_name);
+}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
index 93d30cb69..ebffd682c 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkLabelPeer.c
@@ -44,33 +44,30 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_create
(JNIEnv *env, jobject obj, jstring text, jfloat xalign)
{
GtkWidget *label;
- GtkWidget *ebox;
- GtkContainer *ebox_container;
+ GtkWidget *eventbox;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, text, 0);
gdk_threads_enter ();
- ebox = gtk_event_box_new ();
- ebox_container = GTK_CONTAINER (ebox);
+ eventbox = gtk_event_box_new ();
label = gtk_label_new (str);
gtk_misc_set_alignment (GTK_MISC (label), xalign, 0.5);
- gtk_container_add (ebox_container, label);
+ gtk_container_add (GTK_CONTAINER (eventbox), label);
gtk_widget_show (label);
gdk_threads_leave ();
(*env)->ReleaseStringUTFChars (env, text, str);
- NSA_SET_PTR (env, obj, ebox);
+ NSA_SET_PTR (env, obj, eventbox);
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkLabelPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
@@ -121,7 +118,7 @@ Java_gnu_java_awt_peer_gtk_GtkLabelPeer_setText
gdk_threads_enter ();
- label = gtk_bin_get_child (GTK_BIN(ptr));
+ label = gtk_bin_get_child (GTK_BIN (ptr));
gtk_label_set_label (GTK_LABEL (label), str);
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
index f460484be..bbe28aaf0 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkListPeer.c
@@ -163,7 +163,7 @@ Java_gnu_java_awt_peer_gtk_GtkListPeer_connectSignals
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkListPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
index 8034f6473..984cf4b74 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuBarPeer.c
@@ -44,7 +44,6 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_create
{
GtkWidget *widget;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
@@ -70,6 +69,29 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_addMenu
gdk_threads_leave ();
}
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_nativeSetHelpMenu
+ (JNIEnv *env, jobject obj, jobject menupeer)
+{
+ static void *helpmenu;
+ void *mbar, *menu;
+ GList *list;
+
+ mbar = NSA_GET_PTR (env, obj);
+ menu = NSA_GET_PTR (env, menupeer);
+
+ gdk_threads_enter ();
+ if (helpmenu != NULL)
+ {
+ list = gtk_container_children (GTK_CONTAINER (mbar));
+ while (list != NULL && list->data != helpmenu)
+ list = list->next;
+ if (list != NULL && list->data == helpmenu)
+ gtk_container_remove (GTK_CONTAINER (mbar), GTK_WIDGET (list->data));
+ }
+ helpmenu = menu;
+ gdk_threads_leave ();
+}
+
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuBarPeer_delMenu
(JNIEnv *env, jobject obj, jint index)
{
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
index 70fc80955..cc99674bd 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuItemPeer.c
@@ -49,14 +49,14 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_create
GtkWidget *widget;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
gdk_threads_enter ();
-
- if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
+
+ /* "-" signals that we need a separator. */
+ if (strcmp (str, "-") == 0)
widget = gtk_menu_item_new ();
else
widget = gtk_menu_item_new_with_label (str);
@@ -86,11 +86,62 @@ Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_connectSignals
gdk_threads_leave ();
}
+JNIEXPORT void JNICALL
+Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_gtkWidgetModifyFont
+ (JNIEnv *env, jobject obj, jstring name, jint style, jint size)
+{
+ const char *font_name;
+ void *ptr;
+ GtkWidget *label;
+ PangoFontDescription *font_desc;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ font_name = (*env)->GetStringUTFChars (env, name, NULL);
+
+ gdk_threads_enter();
+
+ label = gtk_bin_get_child (GTK_BIN (ptr));
+
+ if (label)
+ {
+ font_desc = pango_font_description_from_string (font_name);
+ pango_font_description_set_size (font_desc, size * dpi_conversion_factor);
+
+ if (style & AWT_STYLE_BOLD)
+ pango_font_description_set_weight (font_desc, PANGO_WEIGHT_BOLD);
+
+ if (style & AWT_STYLE_ITALIC)
+ pango_font_description_set_style (font_desc, PANGO_STYLE_OBLIQUE);
+
+ gtk_widget_modify_font (GTK_WIDGET(label), font_desc);
+
+ pango_font_description_free (font_desc);
+ }
+
+ gdk_threads_leave();
+
+ (*env)->ReleaseStringUTFChars (env, name, font_name);
+}
+
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setEnabled
+ (JNIEnv *env, jobject obj, jboolean enabled)
+{
+ void *ptr;
+
+ ptr = NSA_GET_PTR (env, obj);
+
+ gdk_threads_enter ();
+ gtk_widget_set_sensitive (GTK_WIDGET (ptr), enabled);
+ gdk_threads_leave ();
+}
+
JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
(JNIEnv *env, jobject obj, jstring label)
{
void *ptr;
const char *str;
+ GtkAccelLabel *accel_label;
ptr = NSA_GET_PTR (env, obj);
@@ -98,15 +149,10 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuItemPeer_setLabel
gdk_threads_enter ();
- if (strcmp (str, "-") == 0) /* "-" signals that we need a separator */
- gtk_container_remove (GTK_CONTAINER (ptr), GTK_BIN (ptr)->child);
- else
- {
- GtkAccelLabel *accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
+ accel_label = GTK_ACCEL_LABEL (GTK_BIN (ptr)->child);
- gtk_label_set_text (GTK_LABEL (accel_label), str);
- gtk_accel_label_refetch (accel_label);
- }
+ gtk_label_set_text (GTK_LABEL (accel_label), str);
+ gtk_accel_label_refetch (accel_label);
gdk_threads_leave ();
@@ -119,4 +165,3 @@ item_activate (GtkMenuItem *item __attribute__((unused)), jobject peer_obj)
(*gdk_env)->CallVoidMethod (gdk_env, peer_obj,
postMenuActionEventID);
}
-
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
index 1ffe61b0c..eee94a0eb 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkMenuPeer.c
@@ -73,7 +73,6 @@ JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkMenuPeer_create
GtkWidget *menu_title, *menu, *toplevel;
const char *str;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
str = (*env)->GetStringUTFChars (env, label, NULL);
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
index 835c2348d..7f5009a7d 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkPanelPeer.c
@@ -44,14 +44,15 @@ JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkPanelPeer_create
(JNIEnv *env, jobject obj)
{
- gpointer widget;
+ GtkWidget *widget;
- /* Create global reference and save it for future use */
NSA_SET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
- widget = gtk_layout_new (NULL, NULL);
+ widget = gtk_fixed_new ();
+
+ gtk_fixed_set_has_window (GTK_FIXED (widget), TRUE);
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
@@ -70,7 +71,7 @@ Java_gnu_java_awt_peer_gtk_GtkPanelPeer_connectJObject
gdk_threads_enter ();
gtk_widget_realize (GTK_WIDGET (ptr));
- connect_awt_hook (env, obj, 1, GTK_LAYOUT (ptr)->bin_window);
+ connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
gdk_threads_leave ();
}
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
index c9427d49d..2507b411f 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextAreaPeer.c
@@ -141,7 +141,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_replaceRange
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkTextAreaPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
index 2a6666a0d..a7b0a4778 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
@@ -175,7 +175,7 @@ Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_setEchoChar
}
JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkSetFont
+Java_gnu_java_awt_peer_gtk_GtkTextFieldPeer_gtkWidgetModifyFont
(JNIEnv *env, jobject obj, jstring name, jint style, jint size)
{
const char *font_name;
diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
index 56f760734..8bcdf7744 100644
--- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
+++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c
@@ -37,9 +37,7 @@ exception statement from your version. */
#include "gtkpeer.h"
-#include "gnu_java_awt_peer_gtk_GtkComponentPeer.h"
#include "gnu_java_awt_peer_gtk_GtkWindowPeer.h"
-#include "gnu_java_awt_peer_gtk_GtkFramePeer.h"
#include <gdk/gdkprivate.h>
#include <gdk/gdkx.h>
#include <X11/Xatom.h>
@@ -58,8 +56,6 @@ static Bool property_notify_predicate (Display *display,
XEvent *xevent,
XPointer arg);
-static GtkLayout *find_layout (GtkWindow *window);
-
static void window_delete_cb (GtkWidget *widget, GdkEvent *event,
jobject peer);
static void window_destroy_cb (GtkWidget *widget, GdkEvent *event,
@@ -93,8 +89,7 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
GtkWidget *window_widget;
GtkWindow *window;
void *window_parent;
- GtkWidget *vbox;
- GtkWidget *layout;
+ GtkWidget *fixed;
int top = 0;
int left = 0;
int bottom = 0;
@@ -124,13 +119,10 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create
gtk_window_group_add_window (global_gtk_window_group, window);
- vbox = gtk_vbox_new (0, 0);
- layout = gtk_layout_new (NULL, NULL);
- gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
- gtk_container_add (GTK_CONTAINER (window_widget), vbox);
+ fixed = gtk_fixed_new ();
+ gtk_container_add (GTK_CONTAINER (window_widget), fixed);
- gtk_widget_show (layout);
- gtk_widget_show (vbox);
+ gtk_widget_show (fixed);
gtk_widget_realize (window_widget);
if (decorated)
@@ -236,19 +228,12 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectJObject
(JNIEnv *env, jobject obj)
{
void *ptr;
- GtkLayout *layout;
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
- layout = find_layout (GTK_WINDOW (ptr));
-
- gtk_widget_realize (GTK_WIDGET (layout));
-
- connect_awt_hook (env, obj, 1, layout->bin_window);
-
- gtk_widget_realize (ptr);
+ gtk_widget_realize (GTK_WIDGET (ptr));
connect_awt_hook (env, obj, 1, GTK_WIDGET (ptr)->window);
@@ -261,23 +246,17 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
{
void *ptr;
jobject *gref;
- GtkLayout *layout;
ptr = NSA_GET_PTR (env, obj);
-
gref = NSA_GET_GLOBAL_REF (env, obj);
gdk_threads_enter ();
- gtk_widget_realize (ptr);
-
- /* Receive events from the GtkLayout too */
- layout = find_layout (GTK_WINDOW (ptr));
+ gtk_widget_realize (GTK_WIDGET (ptr));
- g_signal_connect (G_OBJECT (layout), "event",
+ g_signal_connect (G_OBJECT (ptr), "event",
G_CALLBACK (pre_event_handler), *gref);
- /* Connect signals for window event support. */
g_signal_connect (G_OBJECT (ptr), "delete-event",
G_CALLBACK (window_delete_cb), *gref);
@@ -306,15 +285,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals
G_CALLBACK (window_property_changed_cb), *gref);
gdk_threads_leave ();
-
- /* Connect the superclass signals. */
- Java_gnu_java_awt_peer_gtk_GtkComponentPeer_connectSignals (env, obj);
}
-/*
- * Lower the z-level of a window.
- */
-
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
jobject obj)
@@ -323,16 +295,13 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env,
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
+
gdk_window_lower (GTK_WIDGET (ptr)->window);
+ gdk_flush ();
- XFlush (GDK_DISPLAY ());
gdk_threads_leave ();
}
-/*
- * Raise the z-level of a window.
- */
-
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
jobject obj)
@@ -341,9 +310,10 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env,
ptr = NSA_GET_PTR (env, obj);
gdk_threads_enter ();
+
gdk_window_raise (GTK_WIDGET (ptr)->window);
+ gdk_flush ();
- XFlush (GDK_DISPLAY ());
gdk_threads_leave ();
}
@@ -369,7 +339,9 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_setSize
height = (height < 1) ? 1 : height;
gdk_threads_enter ();
+
gtk_widget_set_size_request (GTK_WIDGET(ptr), width, height);
+
gdk_threads_leave ();
}
@@ -408,199 +380,6 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_nativeSetBounds
gdk_threads_leave ();
}
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_removeMenuBarPeer
- (JNIEnv *env, jobject obj)
-{
- void *wptr;
- GtkWidget *box;
- GtkWidget *mptr;
- GList* children;
-
- wptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- box = GTK_BIN (wptr)->child;
-
- children = gtk_container_get_children (GTK_CONTAINER (box));
-
- while (children != NULL && !GTK_IS_MENU_SHELL (children->data))
- {
- children = children->next;
- }
-
- /* If there isn't a MenuBar in this Frame's list of children
- then we can just return. */
- if (!GTK_IS_MENU_SHELL (children->data))
- return;
- else
- mptr = children->data;
-
- /* This will actually destroy the MenuBar. By removing it from
- its parent, the reference count for the MenuBar widget will
- decrement to 0. The widget will be automatically destroyed
- by Gtk. */
- gtk_container_remove (GTK_CONTAINER (box), GTK_WIDGET (mptr));
-
- gdk_threads_leave();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_setMenuBarPeer
- (JNIEnv *env, jobject obj, jobject menubar)
-{
- void *wptr;
- GtkWidget *mptr;
- GtkWidget *box;
-
- wptr = NSA_GET_PTR (env, obj);
- mptr = NSA_GET_PTR (env, menubar);
-
- gdk_threads_enter ();
-
- box = GTK_BIN (wptr)->child;
- gtk_box_pack_start (GTK_BOX (box), mptr, 0, 0, 0);
-
- gtk_widget_show (mptr);
-
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT jint JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_getMenuBarHeight
- (JNIEnv *env, jobject obj __attribute__((unused)), jobject menubar)
-{
- GtkWidget *ptr;
- jint height;
- GtkRequisition gtkreq;
-
- ptr = NSA_GET_PTR (env, menubar);
-
- gdk_threads_enter ();
- gtk_widget_size_request (ptr, &gtkreq);
-
- height = gtkreq.height;
- gdk_threads_leave ();
- return height;
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_moveLayout
- (JNIEnv *env, jobject obj, jint offset)
-{
- void* ptr;
- GList* children;
- GtkLayout* layout;
- GtkWidget* widget;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- layout = find_layout (GTK_WINDOW (ptr));
-
- children = gtk_container_get_children (GTK_CONTAINER (layout));
-
- while (children != NULL)
- {
- widget = children->data;
- gtk_layout_move (layout, widget, widget->allocation.x,
- widget->allocation.y+offset);
- children = children->next;
- }
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_gtkLayoutSetVisible
- (JNIEnv *env, jobject obj, jboolean visible)
-{
- void *ptr;
- GtkLayout *layout;
-
- ptr = NSA_GET_PTR (env, obj);
-
- gdk_threads_enter ();
-
- layout = find_layout (GTK_WINDOW (ptr));
-
- if (visible)
- gtk_widget_show (GTK_WIDGET (layout));
- else
- gtk_widget_hide (GTK_WIDGET (layout));
-
- gdk_threads_leave ();
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromDecoder
- (JNIEnv *env, jobject obj, jobject decoder)
-{
- void *ptr;
- GdkPixbufLoader *loader = NULL;
- GdkPixbuf *pixbuf = NULL;
-
- ptr = NSA_GET_PTR (env, obj);
-
- loader = NSA_GET_PB_PTR (env, decoder);
- g_assert (loader != NULL);
-
- gdk_threads_enter ();
-
- pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
- g_assert (pixbuf != NULL);
-
- gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
-
- gdk_threads_leave ();
-}
-
-void free_pixbuf_data (guchar *pixels, gpointer data __attribute__((unused)))
-{
- free(pixels);
-}
-
-JNIEXPORT void JNICALL
-Java_gnu_java_awt_peer_gtk_GtkFramePeer_nativeSetIconImageFromData
- (JNIEnv *env, jobject obj, jintArray pixelArray, jint width, jint height)
-{
- void *ptr;
- GdkPixbuf *pixbuf;
- jint *pixels;
- int pixels_length, i;
- guchar *data;
-
- ptr = NSA_GET_PTR (env, obj);
-
- pixels = (*env)->GetIntArrayElements (env, pixelArray, 0);
- pixels_length = (*env)->GetArrayLength (env, pixelArray);
-
- data = malloc (sizeof (guchar) * pixels_length);
- for (i = 0; i < pixels_length; i++)
- data[i] = (guchar) pixels[i];
-
- gdk_threads_enter ();
-
- pixbuf = gdk_pixbuf_new_from_data (data,
- GDK_COLORSPACE_RGB,
- TRUE,
- 8,
- width,
- height,
- width*4,
- free_pixbuf_data,
- NULL);
-
- gtk_window_set_icon (GTK_WINDOW (ptr), pixbuf);
-
- gdk_threads_leave ();
-
- (*env)->ReleaseIntArrayElements(env, pixelArray, pixels, 0);
-}
-
static void
window_get_frame_extents (GtkWidget *window,
int *top, int *left, int *bottom, int *right)
@@ -785,6 +564,8 @@ window_focus_in_cb (GtkWidget * widget,
postWindowEventID,
(jint) AWT_WINDOW_GAINED_FOCUS,
(jobject) NULL, (jint) 0);
+ /* FIXME: somewhere after this is handled, the child window is
+ getting an expose event. */
return FALSE;
}
@@ -797,6 +578,8 @@ window_focus_out_cb (GtkWidget * widget,
postWindowEventID,
(jint) AWT_WINDOW_LOST_FOCUS,
(jobject) NULL, (jint) 0);
+ /* FIXME: somewhere after this is handled, the child window is
+ getting an expose event. */
return FALSE;
}
@@ -924,26 +707,3 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)),
return FALSE;
}
-
-static GtkLayout *
-find_layout (GtkWindow *window)
-{
- GList* children;
- GtkBox* vbox;
- GtkLayout* layout;
-
- children = gtk_container_get_children (GTK_CONTAINER (window));
- vbox = children->data;
- g_assert (GTK_IS_VBOX (vbox));
-
- children = gtk_container_get_children (GTK_CONTAINER (vbox));
- do
- {
- layout = children->data;
- children = children->next;
- }
- while (!GTK_IS_LAYOUT (layout) && children != NULL);
- g_assert (GTK_IS_LAYOUT (layout));
-
- return layout;
-}
diff --git a/native/jni/gtk-peer/gtkpeer.h b/native/jni/gtk-peer/gtkpeer.h
index 59d49ceda..8b94f50c5 100644
--- a/native/jni/gtk-peer/gtkpeer.h
+++ b/native/jni/gtk-peer/gtkpeer.h
@@ -463,7 +463,6 @@ void connect_awt_hook (JNIEnv *env, jobject peer_obj, int nwindows, ...);
void set_visible (GtkWidget *widget, jboolean visible);
void set_parent (GtkWidget *widget, GtkContainer *parent);
-GtkLayout *find_gtk_layout (GtkWidget *parent);
jint keyevent_state_to_awt_mods (GdkEvent *event);
diff --git a/native/jni/java-util/Makefile.am b/native/jni/java-util/Makefile.am
index f7497e6d5..7a06bb709 100644
--- a/native/jni/java-util/Makefile.am
+++ b/native/jni/java-util/Makefile.am
@@ -1,5 +1,5 @@
pkglib_LTLIBRARIES = libjavautil.la
-libjavautil_la_SOURCES = java_util_TimeZone.c
+libjavautil_la_SOURCES = java_util_VMTimeZone.c
libjavautil_la_LDFLAGS = @CLASSPATH_MODULE@
diff --git a/native/jni/java-util/java_util_VMTimeZone.c b/native/jni/java-util/java_util_VMTimeZone.c
new file mode 100644
index 000000000..536f7bfef
--- /dev/null
+++ b/native/jni/java-util/java_util_VMTimeZone.c
@@ -0,0 +1,220 @@
+/* VMTimeZone.c - Native method for java.util.VMTimeZone
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+#include "config.h"
+
+#if TIME_WITH_SYS_TIME
+# include <sys/time.h>
+# include <time.h>
+#else
+# if HAVE_SYS_TIME_H
+# include <sys/time.h>
+# else
+# include <time.h>
+# endif
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <jni.h>
+
+#include "java_util_VMTimeZone.h"
+
+size_t jint_to_charbuf (char* bufend, jint num);
+
+/**
+ * This method returns a time zone id string which is in the form
+ * (standard zone name) or (standard zone name)(GMT offset) or
+ * (standard zone name)(GMT offset)(daylight time zone name). The
+ * GMT offset can be in seconds, or where it is evenly divisible by
+ * 3600, then it can be in hours. The offset must be the time to
+ * add to the local time to get GMT. If a offset is given and the
+ * time zone observes daylight saving then the (daylight time zone
+ * name) must also be given (otherwise it is assumed the time zone
+ * does not observe any daylight savings).
+ * <p>
+ * The result of this method is given to getDefaultTimeZone(String)
+ * which tries to map the time zone id to a known TimeZone. See
+ * that method on how the returned String is mapped to a real
+ * TimeZone object.
+ */
+JNIEXPORT jstring JNICALL
+Java_java_util_VMTimeZone_getSystemTimeZoneId(JNIEnv *env, jclass clazz)
+{
+ struct tm tim;
+#ifndef HAVE_LOCALTIME_R
+ struct tm *lt_tim;
+#endif
+#ifdef HAVE_TM_ZONE
+ int month;
+#endif
+ time_t current_time;
+ long tzoffset;
+ const char *tz1, *tz2;
+ char tzoff[11];
+ size_t tz1_len, tz2_len, tzoff_len;
+ char *tzid;
+ jstring retval;
+
+ time(&current_time);
+#ifdef HAVE_LOCALTIME_R
+ localtime_r(&current_time, &tim);
+#else
+ /* Fall back on non-thread safe localtime. */
+ lt_tim = localtime(&current_time);
+ memcpy(&tim, lt_tim, sizeof (struct tm));
+#endif
+ mktime(&tim);
+
+#ifdef HAVE_STRUCT_TM_TM_ZONE
+ /* We will cycle through the months to make sure we hit dst. */
+ month = tim.tm_mon;
+ tz1 = tz2 = NULL;
+ while (tz1 == NULL || tz2 == NULL)
+ {
+ if (tim.tm_isdst > 0)
+ tz2 = tim.tm_zone;
+ else if (tz1 == NULL)
+ {
+ tz1 = tim.tm_zone;
+ month = tim.tm_mon;
+ }
+
+ if (tz1 == NULL || tz2 == NULL)
+ {
+ tim.tm_mon++;
+ tim.tm_mon %= 12;
+ }
+
+ if (tim.tm_mon == month && tz2 == NULL)
+ tz2 = "";
+ else
+ mktime(&tim);
+ }
+ /* We want to make sure the tm struct we use later on is not dst. */
+ tim.tm_mon = month;
+ mktime(&tim);
+#elif defined (HAVE_TZNAME)
+ /* If dst is never used, tzname[1] is the empty string. */
+ tzset();
+ tz1 = tzname[0];
+ tz2 = tzname[1];
+#else
+ /* Some targets have no concept of timezones. Assume GMT without dst. */
+ tz1 = "GMT";
+ tz2 = "";
+#endif
+
+#ifdef STRUCT_TM_HAS_GMTOFF
+ /* tm_gmtoff is the number of seconds that you must add to GMT to get
+ local time, we need the number of seconds to add to the local time
+ to get GMT. */
+ tzoffset = -1L * tim.tm_gmtoff;
+#elif HAVE_UNDERSCORE_TIMEZONE
+ tzoffset = _timezone;
+#elif HAVE_TIMEZONE
+ /* timezone is secs WEST of UTC. */
+ tzoffset = timezone;
+#else
+ /* FIXME: there must be another global if neither tm_gmtoff nor timezone
+ is available, esp. if tzname is valid.
+ Richard Earnshaw <rearnsha@arm.com> has suggested using difftime to
+ calculate between gmtime and localtime (and accounting for possible
+ daylight savings time) as an alternative. */
+ tzoffset = 0L;
+#endif
+
+ if ((tzoffset % 3600) == 0)
+ tzoffset = tzoffset / 3600;
+
+ tz1_len = strlen(tz1);
+ tz2_len = strlen(tz2);
+ tzoff_len = jint_to_charbuf (tzoff + 11, tzoffset);
+ tzid = (char*) malloc (tz1_len + tz2_len + tzoff_len + 1); /* FIXME alloc */
+ memcpy (tzid, tz1, tz1_len);
+ memcpy (tzid + tz1_len, tzoff + 11 - tzoff_len, tzoff_len);
+ memcpy (tzid + tz1_len + tzoff_len, tz2, tz2_len);
+ tzid[tz1_len + tzoff_len + tz2_len] = '\0';
+
+ retval = (*env)->NewStringUTF (env, tzid);
+ free (tzid);
+
+ return retval;
+}
+
+/* Put printed (decimal) representation of NUM in a buffer.
+ BUFEND marks the end of the buffer, which must be at least 11 chars long.
+ Returns the COUNT of chars written. The result is in
+ (BUFEND - COUNT) (inclusive) upto (BUFEND) (exclusive).
+
+ Note that libgcj has a slightly different version called _Jv_FormatInt
+ that works on jchar buffers.
+*/
+
+static size_t
+jint_to_charbuf (char* bufend, jint num)
+{
+ register char* ptr = bufend;
+ jboolean isNeg;
+ if (num < 0)
+ {
+ isNeg = JNI_TRUE;
+ num = -(num);
+ if (num < 0)
+ {
+ /* Must be MIN_VALUE, so handle this special case.
+ FIXME use 'unsigned jint' for num. */
+ *--ptr = '8';
+ num = 214748364;
+ }
+ }
+ else
+ isNeg = JNI_FALSE;
+
+ do
+ {
+ *--ptr = (char) ((int) '0' + (num % 10));
+ num /= 10;
+ }
+ while (num > 0);
+
+ if (isNeg)
+ *--ptr = '-';
+ return bufend - ptr;
+}
diff --git a/native/target/generic/target_generic_misc.h b/native/target/generic/target_generic_misc.h
index 19e3ab2d6..e3a4de6e5 100644
--- a/native/target/generic/target_generic_misc.h
+++ b/native/target/generic/target_generic_misc.h
@@ -187,57 +187,6 @@ Systems : all
} while (0)
#endif
-/***********************************************************************\
-* Name : TARGET_NATIVE_MISC_GET_TIMEZONE_STRING
-* Purpose : get timezone string
-* Input : string - buffer for timezone string
-* maxStringLength - max. string length
-* Output : string - timezone string
-* result - TARGET_NATIVE_OK or TARGET_NATIVE_ERROR
-* Return : -
-* Side-effect: unknown
-* Notes : set WITH_TIMEZONE_VARIABLE to timezone variable if not
-* 'timezone' (e. g. Cygwin)
-\***********************************************************************/
-
-#ifndef TARGET_NATIVE_MISC_GET_TIMEZONE_STRING
- #if TIME_WITH_SYS_TIME
- #include <sys/time.h>
- #include <time.h>
- #else
- #if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #else
- #include <time.h>
- #endif
- #endif
- #include <string.h>
- #ifndef WITH_TIMEZONE_VARIABLE
- #define WITH_TIMEZONE_VARIABLE timezone
- #endif
- #define TARGET_NATIVE_MISC_GET_TIMEZONE_STRING(string,maxStringLength,result) \
- do { \
- tzset(); \
- \
- if (strcmp(tzname[0],tzname[1])!=0) \
- { \
- result=((strlen(tzname[0])+6)<=maxStringLength)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
- if (result==TARGET_NATIVE_OK) \
- { \
- snprintf(string,maxStringLength,"%s%ld",tzname[0],((WITH_TIMEZONE_VARIABLE%3600)==0)?WITH_TIMEZONE_VARIABLE/3600:WITH_TIMEZONE_VARIABLE); \
- } \
- } \
- else \
- { \
- result=((strlen(tzname[0])+strlen(tzname[1])+6)<=maxStringLength)?TARGET_NATIVE_OK:TARGET_NATIVE_ERROR; \
- if (result==TARGET_NATIVE_OK) \
- { \
- snprintf(string,maxStringLength,"%s%ld%s",tzname[0],((WITH_TIMEZONE_VARIABLE%3600)==0)?WITH_TIMEZONE_VARIABLE/3600:WITH_TIMEZONE_VARIABLE,tzname[1]); \
- } \
- } \
- } while (0)
-#endif
-
/***************************** Functions *******************************/
#ifdef __cplusplus
diff --git a/org/ietf/jgss/ChannelBinding.java b/org/ietf/jgss/ChannelBinding.java
new file mode 100644
index 000000000..9e966d54a
--- /dev/null
+++ b/org/ietf/jgss/ChannelBinding.java
@@ -0,0 +1,215 @@
+/* ChannelBinding.java -- a channel binding in the GSS-API.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+import java.net.InetAddress;
+import java.util.Arrays;
+
+/**
+ * <p>The GSS-API accommodates the concept of caller-provided channel
+ * binding information. Channel bindings are used to strengthen the
+ * quality with which peer entity authentication is provided during
+ * context establishment. They enable the GSS-API callers to bind the
+ * establishment of the security context to relevant characteristics
+ * like addresses or to application specific data.</p>
+ *
+ * <p>The caller initiating the security context must determine the
+ * appropriate channel binding values to set in the {@link GSSContext}
+ * object. The acceptor must provide an identical binding in order to
+ * validate that received tokens possess correct channel-related
+ * characteristics.</p>
+ *
+ * <p>Use of channel bindings is optional in GSS-API. Since channel-binding
+ * information may be transmitted in context establishment tokens,
+ * applications should therefore not use confidential data as
+ * channel-binding components.</p>
+ */
+public class ChannelBinding
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private final byte[] appData;
+ private final InetAddress initAddr;
+ private final InetAddress acceptAddr;
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Create a ChannelBinding object with user supplied address information
+ * and data. <code>null</code> values can be used for any fields which the
+ * application does not want to specify.
+ *
+ * @param initAddr The address of the context initiator. <code>null</code>
+ * value can be supplied to indicate that the application
+ * does not want to set this value.
+ * @param acceptAddr The address of the context acceptor. <code>null</code>
+ * value can be supplied to indicate that the application
+ * does not want to set this value.
+ * @param appData Application supplied data to be used as part of the
+ * channel bindings. <code>null</code> value can be
+ * supplied to indicate that the application does not
+ * want to set this value.
+ */
+ public ChannelBinding(InetAddress initAddr, InetAddress acceptAddr,
+ byte[] appData)
+ {
+ this.appData = (appData != null) ? (byte[]) appData.clone() : null;
+ this.initAddr = initAddr;
+ this.acceptAddr = acceptAddr;
+ }
+
+ /**
+ * Creates a ChannelBinding object without any addressing information.
+ *
+ * @param appData Application supplied data to be used as part of the
+ * channel bindings.
+ */
+ public ChannelBinding(byte[] appData)
+ {
+ this(null, null, appData);
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the initiator's address for this channel binding.
+ * <code>null</code> is returned if the address has not been set.
+ *
+ * @return The initiator's address, or <code>null</code>.
+ */
+ public InetAddress getInitiatorAddress()
+ {
+ return initAddr;
+ }
+
+ /**
+ * Returns the acceptor's address for this channel binding.
+ * <code>null</code> is returned if the address has not been set.
+ *
+ * @return The acceptor's address, or <code>null</code>.
+ */
+ public InetAddress getAcceptorAddress()
+ {
+ return acceptAddr;
+ }
+
+ /**
+ * Returns application data being used as part of the ChannelBinding.
+ * <code>null</code> is returned if no application data has been
+ * specified for the channel binding.
+ *
+ * @return The application data, or <code>null</code>.
+ */
+ public byte[] getApplicationData()
+ {
+ if (appData != null)
+ return (byte[]) appData.clone();
+ return null;
+ }
+
+ /**
+ * Returns <code>true</code> if two channel bindings match.
+ *
+ * @param obj Another channel binding to compare with.
+ * @return True if this channel binding equals the other.
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof ChannelBinding))
+ return false;
+ ChannelBinding cb = (ChannelBinding) obj;
+ boolean b1 = Arrays.equals(appData, cb.appData);
+ boolean b2 = (initAddr == null && cb.initAddr == null)
+ || (cb.initAddr != null && initAddr.equals(cb.initAddr));
+ boolean b3 = (acceptAddr == null && cb.acceptAddr == null)
+ || (cb.acceptAddr != null && acceptAddr.equals(cb.acceptAddr));
+ return b1 && b2 && b3;
+ }
+
+ /**
+ * Returns the hash code for this channel binding.
+ *
+ * @return The hash code.
+ */
+ public int hashCode()
+ {
+ int code = 0;
+ if (appData != null)
+ for (int i = 0; i < appData.length; i++)
+ code ^= appData[i] << ((8 * i) & 31);
+ if (initAddr != null)
+ code ^= initAddr.hashCode();
+ if (acceptAddr != null)
+ code ^= acceptAddr.hashCode();
+ return code;
+ }
+}
diff --git a/org/ietf/jgss/GSSContext.java b/org/ietf/jgss/GSSContext.java
new file mode 100644
index 000000000..ab09c31c5
--- /dev/null
+++ b/org/ietf/jgss/GSSContext.java
@@ -0,0 +1,924 @@
+/* GSSContext.java -- The GSS context interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.ietf.jgss;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * <p>This interface encapsulates the GSS-API security context and provides
+ * the security services ({@link #wrap(byte[],int,int,org.ietf.jgss.MessageProp)},
+ * {@link #unwrap(byte[],int,int,org.ietf.jgss.MessageProp)}, {@link
+ * #getMIC(byte[],int,int,org.ietf.jgss.MessageProp)}, {@link
+ * #verifyMIC(byte[],int,int,byte[],int,int,org.ietf.jgss.MessageProp)}) that
+ * are available over the context. Security contexts are established
+ * between peers using locally acquired credentials. Multiple contexts
+ * may exist simultaneously between a pair of peers, using the same or
+ * different set of credentials. GSS-API functions in a manner
+ * independent of the underlying transport protocol and depends on its
+ * calling application to transport its tokens between peers.</p>
+ *
+ * <p>Before the context establishment phase is initiated, the context
+ * initiator may request specific characteristics desired of the
+ * established context. These can be set using the set methods. After
+ * the context is established, the caller can check the actual
+ * characteristic and services offered by the context using the query
+ * methods.</p>
+ *
+ * <p>The context establishment phase begins with the first call to the
+ * init method by the context initiator. During this phase the
+ * {@link #initSecContext(byte[],int,int)} and {@link
+ * #acceptSecContext(byte[],int,int)} methods will produce GSS-API
+ * authentication tokens which the calling application needs to send to
+ * its peer. If an error occurs at any point, an exception will get
+ * thrown and the code will start executing in a catch block. If not,
+ * the normal flow of code continues and the application can make a call
+ * to the {@link #isEstablished()} method. If this method returns false it
+ * indicates that a token is needed from its peer in order to continue
+ * the context establishment phase. A return value of true signals that
+ * the local end of the context is established. This may still require
+ * that a token be sent to the peer, if one is produced by GSS-API.
+ * During the context establishment phase, the {@link #isProtReady()}
+ * method may be called to determine if the context can be used for the
+ * per-message operations. This allows applications to use per-message
+ * operations on contexts which aren't fully established.</p>
+ *
+ * <p>After the context has been established or the {@link #isProtReady()}
+ * method returns <code>true</code>, the query routines can be invoked to
+ * determine the actual characteristics and services of the established
+ * context. The application can also start using the per-message methods
+ * of {@link #wrap(byte[],int,int,org.ietf.jgss.MessageProp)} and
+ * {@link #getMIC(byte[],int,int,org.ietf.jgss.MessageProp)} to obtain
+ * cryptographic operations on application supplied data.</p>
+ *
+ * <p>When the context is no longer needed, the application should call
+ * {@link dispose()} to release any system resources the context may be
+ * using.</p>
+ *
+ * <h3>Example Code</h3>
+ *
+ * <pre>
+GSSManager mgr = GSSManager.getInstance();
+
+// start by creating the name for a service entity
+GSSName targetName = mgr.createName("service@host",
+ GSSName.NT_HOSTBASED_SERVICE);
+
+// create a context using default credentials for the above entity
+// and the implementation specific default mechanism
+GSSContext context = mgr.createContext(targetName,
+ null, // default mechanism
+ null, // default credentials
+ GSSContext.INDEFINITE_LIFETIME);
+
+// set desired context options - all others are false by default
+context.requestConf(true);
+context.requestMutualAuth(true);
+context.requestReplayDet(true);
+context.requestSequenceDet(true);
+
+// establish a context between peers - using byte arrays
+byte []inTok = new byte[0];
+
+try
+ {
+ do
+ {
+ byte[] outTok = context.initSecContext(inTok, 0,
+ inTok.length);
+
+ // send the token if present
+ if (outTok != null)
+ sendToken(outTok);
+
+ // check if we should expect more tokens
+ if (context.isEstablished())
+ break;
+
+ // another token expected from peer
+ inTok = readToken();
+
+ }
+ while (true);
+ }
+catch (GSSException e)
+ {
+ print("GSSAPI error: " + e.getMessage());
+ }
+
+// display context information
+print("Remaining lifetime in seconds = " + context.getLifetime());
+print("Context mechanism = " + context.getMech().toString());
+print("Initiator = " + context.getSrcName().toString());
+print("Acceptor = " + context.getTargName().toString());
+
+if (context.getConfState())
+ print("Confidentiality security service available");
+
+if (context.getIntegState())
+ print("Integrity security service available");
+
+// perform wrap on an application supplied message, appMsg,
+// using QOP = 0, and requesting privacy service
+byte[] appMsg ...
+MessageProp mProp = new MessageProp(0, true);
+byte[] tok = context.wrap(appMsg, 0, appMsg.length, mProp);
+
+if (mProp.getPrivacy())
+ print("Message protected with privacy.");
+
+sendToken(tok);
+
+
+// release the local-end of the context
+context.dispose();
+ * </pre>
+ */
+public interface GSSContext
+{
+
+ // Constants.
+ // -------------------------------------------------------------------------
+
+ /**
+ * A lifetime constant representing the default context lifetime.
+ */
+ int DEFAULT_LIFETIME = 0;
+
+ /**
+ * A lifetime constant representing indefinite context lifetime.
+ */
+ int INDEFINITE_LIFETIME = Integer.MAX_VALUE;
+
+ // Methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Called by the context initiator to start the context creation
+ * process. This is equivalent to the stream based method except that
+ * the token buffers are handled as byte arrays instead of using stream
+ * objects. This method may return an output token which the
+ * application will need to send to the peer for processing by the
+ * accept call. Typically, the application would do so by calling the
+ * {@link OutputStream#flush()} method on an OutputStream that
+ * encapsulates the connection between the two peers. The application
+ * can call {@link #isEstablished()} to determine if the context
+ * establishment phase is complete for this peer. A return value of
+ * <code>false</code> from {@link #isEstablished()} indicates that more
+ * tokens are expected to be supplied to the initSecContext() method. Note
+ * that it is possible that the initSecContext() method return a token for
+ * the peer, and {@link #isEstablished()} to return <code>true</code> also.
+ * This indicates that the token needs to be sent to the peer, but the local
+ * end of the context is now fully established.</p>
+ *
+ * <p>Upon completion of the context establishment, the available context
+ * options may be queried through the get methods.</p>
+ *
+ * @param inputBuf Token generated by the peer. This parameter is ignored
+ * on the first call.
+ * @param offset The offset within the <i>inputBuf</i> where the token
+ * begins.
+ * @param len The length of the token within the <i>inputBuf</i>
+ * (starting at the offset).
+ * @return The output token, if any.
+ * @throws GSSException If this operation fails.
+ */
+ byte[] initSecContext(byte[] inputBuf, int offset, int len)
+ throws GSSException;
+
+ /**
+ * <p>Called by the context initiator to start the context creation
+ * process. This is equivalent to the byte array based method. This
+ * method may write an output token to the <i>outStream</i>, which the
+ * application will need to send to the peer for processing by the
+ * accept call. Typically, the application would do so by calling the
+ * {@link OutputStream#flush()} method on an OutputStream that encapsulates
+ * the connection between the two peers. The application can call {@link
+ * #isEstablished()} to determine if the context establishment phase is
+ * complete for this peer. A return value of <code>false</code> from
+ * isEstablished indicates that more tokens are expected to be supplied
+ * to the initSecContext() method. Note that it is possible that the
+ * initSecContext() method return a token for the peer, and {@link
+ * #isEstablished() return <code>true</code> also. This indicates that
+ * the token needs to be sent to the peer, but the local end of the context
+ * is now fully established.</p>
+ *
+ * <p>The GSS-API authentication tokens contain a definitive start and end.
+ * This method will attempt to read one of these tokens per invocation,
+ * and may block on the stream if only part of the token is available.</p>
+ *
+ * <p>Upon completion of the context establishment, the available context
+ * options may be queried through the get methods.</p>
+ *
+ * @param inStream Contains the token generated by the peer. This
+ * parameter is ignored on the first call.
+ * @param outStream Output stream where the output token will be written.
+ * During the final stage of context establishment, there
+ * may be no bytes written.
+ * @return The number of bytes written to <i>outStream</i>, or 0 if no
+ * token is written.
+ * @throws GSSException If this operation fails.
+ */
+ int initSecContext(InputStream inStream, OutputStream outStream)
+ throws GSSException;
+
+ /**
+ * <p>Called by the context acceptor upon receiving a token from the peer.
+ * This call is equivalent to the stream based method except that the
+ * token buffers are handled as byte arrays instead of using stream
+ * objects.</p>
+ *
+ * <p>This method may return an output token which the application will
+ * need to send to the peer for further processing by the init call.</p>
+ *
+ * <p><code>null</code> return value indicates that no token needs to be
+ * sent to the peer. The application can call {@link #isEstablished()}
+ * to determine if the context establishment phase is complete for this
+ * peer. A return value of <code>false</code> from {@link #isEstablished()}
+ * indicates that more tokens are expected to be supplied to this
+ * method.</p>
+ *
+ * <p>Note that it is possible that acceptSecContext() return a token for
+ * the peer, and isEstablished() return <code>true</code> also. This
+ * indicates that the token needs to be sent to the peer, but the local
+ * end of the context is now fully established.</p>
+ *
+ * <p>Upon completion of the context establishment, the available context
+ * options may be queried through the get methods.</p>
+ *
+ * @param inTok Token generated by the peer.
+ * @param offset The offset within the <i>inTok</i> where the token begins.
+ * @param len The length of the token within the <i>inTok</i> (starting
+ * at the offset).
+ * @return The output token, if any.
+ * @throws GSSException If this operation fails.
+ */
+ byte[] acceptSecContext(byte[] inTok, int offset, int len)
+ throws GSSException;
+
+ /**
+ * <p>Called by the context acceptor upon receiving a token from the peer.
+ * This call is equivalent to the byte array method. It may write an
+ * output token to the outStream, which the application will need to
+ * send to the peer for processing by its initSecContext method.
+ * Typically, the application would do so by calling the {@link
+ * OutputStream#flush()} method on an OutputStream that encapsulates the
+ * connection between the two peers. The application can call {@link
+ * #isEstablished()} to determine if the context establishment phase is
+ * complete for this peer. A return value of <code>false</code> from
+ * {@link #isEstablished()} indicates that more tokens are expected to be
+ * supplied to this method.</p>
+ *
+ * <p>Note that it is possible that acceptSecContext() return a token for
+ * the peer, and isEstablished() return <code>true</code> also. This
+ * indicates that the token needs to be sent to the peer, but the local
+ * end of the context is now fully established.</p>
+ *
+ * <p>The GSS-API authentication tokens contain a definitive start and end.
+ * This method will attempt to read one of these tokens per invocation,
+ * and may block on the stream if only part of the token is available.</p>
+ *
+ * <p>Upon completion of the context establishment, the available context
+ * options may be queried through the get methods.</p>
+ *
+ * @param inStream Contains the token generated by the peer.
+ * @param outStream Output stream where the output token will be written.
+ * During the final stage of context establishment, there
+ * may be no bytes written.
+ * @return The number of bytes written, or 0 if no token is written.
+ * @throws GSSException If this operation fails.
+ */
+ void acceptSecContext(InputStream inStream, OutputStream outStream)
+ throws GSSException;
+
+ /**
+ * Used during context establishment to determine the state of the
+ * context. Returns <code>true</code> if this is a fully established
+ * context on the caller's side and no more tokens are needed from the
+ * peer. Should be called after a call to {@link
+ * #initSecContext(byte[],int,int)} or {@link
+ * #acceptSecContext(byte[],int,int)} when no {@link GSSException}
+ * is thrown.
+ *
+ * @return True of this context is fully established on this side.
+ */
+ boolean isEstablished();
+
+ /**
+ * Releases any system resources and cryptographic information stored in
+ * the context object. This will invalidate the context.
+ *
+ * @throws GSSException If this operation fails.
+ */
+ void dispose() throws GSSException;
+
+ /**
+ * <p>Returns the maximum message size that, if presented to the
+ * {@link #wrap(byte[],int,int,org.ietf.jgss.MessageProp)} method with
+ * the same <i>confReq</i> and <i>qop</i> parameters, will result in an
+ * output token containing no more than the <i>maxTokenSize</i> bytes.</p>
+ *
+ * <p>This call is intended for use by applications that communicate over
+ * protocols that impose a maximum message size. It enables the
+ * application to fragment messages prior to applying protection.</p>
+ *
+ * <p>GSS-API implementations are recommended but not required to detect
+ * invalid QOP values when getWrapSizeLimit is called. This routine
+ * guarantees only a maximum message size, not the availability of
+ * specific QOP values for message protection.</p>
+ *
+ * <p>Successful completion of this call does not guarantee that wrap will
+ * be able to protect a message of the computed length, since this
+ * ability may depend on the availability of system resources at the
+ * time that wrap is called. However, if the implementation itself
+ * imposes an upper limit on the length of messages that may be
+ * processed by wrap, the implementation should not return a value that
+ * is greater than this length.</p>
+ *
+ * @param qop Indicates the level of protection wrap will be asked
+ * to provide.
+ * @param confReq Indicates if wrap will be asked to provide privacy
+ * service.
+ * @param maxTokenSize The desired maximum size of the token emitted
+ * by {@link #wrap(byte[],int,int,org.ietf.jgss.MessageProp)}.
+ * @return The maximum wrapped output size.
+ * @throws GSSException If this operation fails.
+ */
+ int getWrapSizeLimit(int qop, boolean confReq, int maxTokenSize)
+ throws GSSException;
+
+ /**
+ * <p>Applies per-message security services over the established security
+ * context. The method will return a token with a cryptographic MIC and
+ * may optionally encrypt the specified <i>inBuf</i>. This method is
+ * equivalent in functionality to its stream counterpart. The returned
+ * byte array will contain both the MIC and the message.</p>
+ *
+ * <p>The {@link MessageProp} object is instantiated by the application
+ * and used to specify a QOP value which selects cryptographic algorithms,
+ * and a privacy service to optionally encrypt the message. The underlying
+ * mechanism that is used in the call may not be able to provide the
+ * privacy service. It sets the actual privacy service that it does
+ * provide in this {@link MessageProp} object which the caller should then
+ * query upon return. If the mechanism is not able to provide the
+ * requested QOP, it throws a {@link GSSException} with the {@link
+ * GSSException#BAD_QOP} code.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by wrap to provide "secure framing", implementations should support
+ * the wrapping of zero-length messages.</p>
+ *
+ * <p>The application will be responsible for sending the token to the
+ * peer.</p>
+ *
+ * @param inBuf Application data to be protected.
+ * @param offset The offset within the inBuf where the data begins.
+ * @param len The length of the data within the inBuf (starting at
+ * the offset).
+ * @param msgProp Instance of {@link MessageProp} that is used by the
+ * application to set the desired QOP and privacy state.
+ * Set the desired QOP to 0 to request the default QOP.
+ * Upon return from this method, this object will contain
+ * the the actual privacy state that was applied to the
+ * message by the underlying mechanism.
+ * @return The wrapped data.
+ * @throws GSSException If this operation fails.
+ */
+ byte[] wrap(byte[] inBuf, int offset, int len, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Allows to apply per-message security services over the established
+ * security context. The method will produce a token with a
+ * cryptographic MIC and may optionally encrypt the message in inStream.
+ * The outStream will contain both the MIC and the message.</p>
+ *
+ * <p>The {@link MessageProp} object is instantiated by the application and
+ * used to specify a QOP value which selects cryptographic algorithms, and
+ * a privacy service to optionally encrypt the message. The underlying
+ * mechanism that is used in the call may not be able to provide the
+ * privacy service. It sets the actual privacy service that it does
+ * provide in this MessageProp object which the caller should then query
+ * upon return. If the mechanism is not able to provide the requested
+ * QOP, it throws a {@link GSSException} with the {@link
+ * GSSException#BAD_QOP} code.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by wrap to provide "secure framing", implementations should support
+ * the wrapping of zero-length messages.</p>
+ *
+ * <p>The application will be responsible for sending the token to the
+ * peer.</p>
+ *
+ * @param inStream Input stream containing the application data to be
+ * protected.
+ * @param outStream The output stream to write the protected message to.
+ * The application is responsible for sending this to the
+ * other peer for processing in its unwrap method.
+ * @param msgProp Instance of {@link MessageProp} that is used by the
+ * application to set the desired QOP and privacy state.
+ * Set the desired QOP to 0 to request the default QOP.
+ * Upon return from this method, this object will contain
+ * the the actual privacy state that was applied to the
+ * message by the underlying mechanism.
+ * @throws GSSException If this operation fails.
+ */
+ void wrap(InputStream inStream, OutputStream outStream, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Used by the peer application to process tokens generated with the
+ * wrap call. This call is equal in functionality to its stream
+ * counterpart. The method will return the message supplied in the peer
+ * application to the wrap call, verifying the embedded MIC.</p>
+ *
+ * <p>The {@link MessageProp} object is instantiated by the application and
+ * is used by the underlying mechanism to return information to the caller
+ * such as the QOP, whether confidentiality was applied to the message, and
+ * other supplementary message state information.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by wrap to provide "secure framing", implementations should support
+ * the wrapping and unwrapping of zero-length messages.</p>
+ *
+ * @param inBuf GSS-API wrap token received from peer.
+ * @param offset The offset within the inBuf where the token begins.
+ * @param len The length of the token within the inBuf (starting at
+ * the offset).
+ * @param msgProp Upon return from the method, this object will contain
+ * the applied QOP, the privacy state of the message, and
+ * supplementary information stating whether the token was
+ * a duplicate, old, out of sequence or arriving after a gap.
+ * @return The unwrapped token.
+ * @throws GSSException If this operation fails.
+ */
+ byte[] unwrap(byte[] inBuf, int offset, int len, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Used by the peer application to process tokens generated with the
+ * wrap call. This call is equal in functionality to its byte array
+ * counterpart. It will produce the message supplied in the peer
+ * application to the wrap call, verifying the embedded MIC.</p>
+ *
+ * <p>The {@link MessageProp} object is instantiated by the application
+ * and is used by the underlying mechanism to return information to the
+ * caller such as the QOP, whether confidentiality was applied to the
+ * message, and other supplementary message state information.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by wrap to provide "secure framing", implementations should support
+ * the wrapping and unwrapping of zero-length messages.</p>
+ *
+ * @param inStream Input stream containing the GSS-API wrap token
+ * received from the peer.
+ * @param outStream The output stream to write the application message to.
+ * @param msgProp Upon return from the method, this object will contain
+ * the applied QOP, the privacy state of the message, and
+ * supplementary information stating whether the token was
+ * a duplicate, old, out of sequence or arriving after a gap.
+ * @throws GSSException If this operation fails.
+ */
+ void unwrap(InputStream inStream, OutputStream outStream, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Returns a token containing a cryptographic MIC for the supplied
+ * message, for transfer to the peer application. Unlike wrap, which
+ * encapsulates the user message in the returned token, only the message
+ * MIC is returned in the output token. This method is identical in
+ * functionality to its stream counterpart.</p>
+ *
+ * <p>Note that privacy can only be applied through the wrap call.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by getMIC to provide "secure framing", implementations should support
+ * derivation of MICs from zero-length messages.</p>
+ *
+ * @param inMsg Message to generate MIC over.
+ * @param offset The offset within the inMsg where the token begins.
+ * @param len The length of the token within the inMsg (starting at
+ * the offset).
+ * @param msgProp Instance of MessageProp that is used by the
+ * application to set the desired QOP. Set the desired
+ * QOP to 0 in msgProp to request the default QOP.
+ * Alternatively pass in <code>null</code> for msgProp to
+ * request default QOP.
+ * @return The MIC.
+ * @throws GSSException If this operation fails.
+ */
+ byte[] getMIC(byte[] inMsg, int offset, int len, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Produces a token containing a cryptographic MIC for the supplied
+ * message, for transfer to the peer application. Unlike wrap, which
+ * encapsulates the user message in the returned token, only the message
+ * MIC is produced in the output token. This method is identical in
+ * functionality to its byte array counterpart.</p>
+ *
+ * <p>Note that privacy can only be applied through the wrap call.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by getMIC to provide "secure framing", implementations should support
+ * derivation of MICs from zero-length messages.</p>
+ *
+ * @param inStream Input stream containing the message to generate
+ * the MIC over.
+ * @param outStream Output stream to write the GSS-API output token to.
+ * @param msgProp Instance of MessageProp that is used by the
+ * application to set the desired QOP. Set the desired
+ * QOP to 0 in msgProp to request the default QOP.
+ * Alternatively pass in <code>null</code> for msgProp
+ * to request default QOP.
+ * @throws GSSException If this operation fails.
+ */
+ void getMIC(InputStream inStream, OutputStream outStream, MessageProp mgProp)
+ throws GSSException;
+
+ /**
+ * <p>Verifies the cryptographic MIC, contained in the token parameter,
+ * over the supplied message. This method is equivalent in
+ * functionality to its stream counterpart.</p>
+ *
+ * <p>The MessageProp object is instantiated by the application and is used
+ * by the underlying mechanism to return information to the caller such
+ * as the QOP indicating the strength of protection that was applied to
+ * the message and other supplementary message state information.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by getMIC to provide "secure framing", implementations should support
+ * the calculation and verification of MICs over zero-length messages.</p>
+ *
+ * @param inTok Token generated by peer's getMIC method.
+ * @param tokOffset The offset within the inTok where the token begins.
+ * @param tokLen The length of the token within the inTok (starting at
+ * the offset).
+ * @param inMsg Application message to verify the cryptographic MIC
+ * over.
+ * @param msgOffset The offset within the inMsg where the message begins.
+ * @param msgLen The length of the message within the inMsg (starting
+ * at the offset).
+ * @param msgProp Upon return from the method, this object will contain
+ * the applied QOP and supplementary information
+ * stating whether the token was a duplicate, old, out
+ * of sequence or arriving after a gap. The
+ * confidentiality state will be set to <code>false</code>.
+ * @throws GSSException If this operation fails.
+ */
+ void verifyMIC(byte[] inTok, int tokOffset, int tokLen, byte[] inMsg,
+ int msgOffset, int msgLen, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Verifies the cryptographic MIC, contained in the token parameter,
+ * over the supplied message. This method is equivalent in
+ * functionality to its byte array counterpart.</p>
+ *
+ * <p>The MessageProp object is instantiated by the application and is used
+ * by the underlying mechanism to return information to the caller such
+ * as the QOP indicating the strength of protection that was applied to
+ * the message and other supplementary message state information.</p>
+ *
+ * <p>Since some application-level protocols may wish to use tokens emitted
+ * by getMIC to provide "secure framing", implementations should support
+ * the calculation and verification of MICs over zero-length messages.</p>
+ *
+ * @param tokStream Input stream containing the token generated by peer's
+ * getMIC method.
+ * @param msgStream Input stream containing the application message to
+ * verify the cryptographic MIC over.
+ * @param msgProp Upon return from the method, this object will contain
+ * the applied QOP and supplementary information
+ * stating whether the token was a duplicate, old, out of
+ * sequence or arriving after a gap. The confidentiality
+ * state will be set to <code>false</code>.
+ * @throws GSSException If this operation fails.
+ */
+ void verifyMIC(InputStream tokStream, InputStream msgStream, MessageProp msgProp)
+ throws GSSException;
+
+ /**
+ * <p>Provided to support the sharing of work between multiple processes.
+ * This routine will typically be used by the context-acceptor, in an
+ * application where a single process receives incoming connection
+ * requests and accepts security contexts over them, then passes the
+ * established context to one or more other processes for message
+ * exchange.</p>
+ *
+ * <p>This method deactivates the security context and creates an
+ * interprocess token which, when passed to the byte array constructor
+ * of the GSSContext interface in another process, will re-activate the
+ * context in the second process. Only a single instantiation of a
+ * given context may be active at any one time; a subsequent attempt by
+ * a context exporter to access the exported security context will fail.</p>
+ *
+ * <p>The implementation may constrain the set of processes by which the
+ * interprocess token may be imported, either as a function of local
+ * security policy, or as a result of implementation decisions. For
+ * example, some implementations may constrain contexts to be passed
+ * only between processes that run under the same account, or which are
+ * part of the same process group.</p>
+ *
+ * <p>The interprocess token may contain security-sensitive information
+ * (for example cryptographic keys). While mechanisms are encouraged to
+ * either avoid placing such sensitive information within interprocess
+ * tokens, or to encrypt the token before returning it to the
+ * application, in a typical GSS-API implementation this may not be
+ * possible. Thus the application must take care to protect the
+ * interprocess token, and ensure that any process to which the token is
+ * transferred is trustworthy.</p>
+ *
+ * @return The exported context.
+ * @throws GSSException If this operation fails.
+ */
+ byte[] export() throws GSSException;
+
+ /**
+ * <p>Sets the request state of the mutual authentication flag for the
+ * context. This method is only valid before the context creation
+ * process begins and only for the initiator.</p>
+ *
+ * @param state Boolean representing if mutual authentication should
+ * be requested during context establishment.
+ * @throws GSSException If this operation fails.
+ */
+ void requestMutualAuth(boolean state) throws GSSException;
+
+ /**
+ * <p>Sets the request state of the replay detection service for the
+ * context. This method is only valid before the context creation
+ * process begins and only for the initiator.</p>
+ *
+ * @param state Boolean representing if replay detection is desired
+ * over the established context.
+ * @throws GSSException If this operation fails.
+ */
+ void requestReplayDet(boolean state) throws GSSException;
+
+ /**
+ * <p>Sets the request state for the sequence checking service of the
+ * context. This method is only valid before the context creation
+ * process begins and only for the initiator.</p>
+ *
+ * @param state Boolean representing if sequence detection is desired
+ * over the established context.
+ * @throws GSSException If this operation fails.
+ */
+ void requestSequenceDet(boolean state) throws GSSException;
+
+ /**
+ * <p>Sets the request state for the credential delegation flag for the
+ * context. This method is only valid before the context creation
+ * process begins and only for the initiator.</p>
+ *
+ * @param state Boolean representing if credential delegation is
+ * desired.
+ * @throws GSSException If this operation fails.
+ */
+ void requestCredDeleg(boolean state) throws GSSException;
+
+ /**
+ * <p>Requests anonymous support over the context. This method is only
+ * valid before the context creation process begins and only for the
+ * initiator.</p>
+ *
+ * @param state Boolean representing if anonymity support is requested.
+ * @throws GSSException If this operation fails.
+ */
+ void requestAnonymity(boolean state) throws GSSException;
+
+ /**
+ * <p>Requests that confidentiality service be available over the context.
+ * This method is only valid before the context creation process begins
+ * and only for the initiator.</p>
+ *
+ * @param state Boolean indicating if confidentiality services are to
+ * be requested for the context.
+ * @throws GSSException If this operation fails.
+ */
+ void requestConf(boolean state) throws GSSException;
+
+ /**
+ * <p>Requests that integrity services be available over the context. This
+ * method is only valid before the context creation process begins and
+ * only for the initiator.</p>
+ *
+ * @param state Boolean indicating if integrity services are to be
+ * requested for the context.
+ * @throws GSSException If this operation fails.
+ */
+ void requestInteg(boolean state) throws GSSException;
+
+ /**
+ * <p>Sets the desired lifetime for the context in seconds. This method is
+ * only valid before the context creation process begins and only for
+ * the initiator. Use {@link #INDEFINITE_LIFETIME} and {@link
+ * #DEFAULT_LIFETIME} to request indefinite or default context lifetime.</p>
+ *
+ * @param lifetime The desired context lifetime in seconds.
+ * @throws GSSException If this operation fails.
+ */
+ void requestLifetime(int lifetime) throws GSSException;
+
+ /**
+ * <p>Sets the channel bindings to be used during context establishment.
+ * This method is only valid before the context creation process begins.</p>
+ *
+ * @param cb Channel bindings to be used.
+ * @throws GSSException If this operation fails.
+ */
+ void setChannelBinding(ChannelBinding cb) throws GSSException;
+
+ /**
+ * <p>Returns the state of the delegated credentials for the context.
+ * When issued before context establishment is completed or when the
+ * isProtReady method returns "false", it returns the desired state,
+ * otherwise it will indicate the actual state over the established
+ * context.</p>
+ *
+ * @return The state of the delegated credentials for the context.
+ */
+ boolean getCredDelegState();
+
+ /**
+ * <p>Returns the state of the mutual authentication option for the
+ * context. When issued before context establishment completes or when
+ * the isProtReady method returns "false", it returns the desired state,
+ * otherwise it will indicate the actual state over the established
+ * context.</p>
+ *
+ * @return The state of the mutual authentication option.
+ */
+ boolean getMutualAuthState();
+
+ /**
+ * <p>Returns the state of the replay detection option for the context.
+ * When issued before context establishment completes or when the
+ * isProtReady method returns "false", it returns the desired state,
+ * otherwise it will indicate the actual state over the established
+ * context.</p>
+ *
+ * @return The state of the replay detection option.
+ */
+ boolean getReplayDetState();
+
+ /**
+ * <p>Returns the state of the sequence detection option for the context.
+ * When issued before context establishment completes or when the
+ * isProtReady method returns "false", it returns the desired state,
+ * otherwise it will indicate the actual state over the established
+ * context.</p>
+ *
+ * @return The state of the sequence detection option.
+ */
+ boolean getSequenceDetState();
+
+ /**
+ * <p>Returns "true" if this is an anonymous context. When issued before
+ * context establishment completes or when the isProtReady method
+ * returns "false", it returns the desired state, otherwise it will
+ * indicate the actual state over the established context.</p>
+ *
+ * @return True if this is an anonymous context.
+ */
+ boolean getAnonymityState();
+
+ /**
+ * <p>Returns "true" if the context is transferable to other processes
+ * through the use of the {@link #export()} method. This call is only
+ * valid on fully established contexts.</p>
+ *
+ * @return True if the context is transferable.
+ * @throws GSSException If this operation fails.
+ */
+ boolean isTransferable() throws GSSException;
+
+ /**
+ * <p>Returns "true" if the per message operations can be applied over
+ * the context. Some mechanisms may allow the usage of per-message
+ * operations before the context is fully established. This will also
+ * indicate that the get methods will return actual context state
+ * characteristics instead of the desired ones.</p>
+ *
+ * @return True if the per message operations can be applied over
+ * the context.
+ */
+ boolean isProtReady();
+
+ /**
+ * <p>Returns the confidentiality service state over the context. When
+ * issued before context establishment completes or when the isProtReady
+ * method returns "false", it returns the desired state, otherwise it
+ * will indicate the actual state over the established context.</p>
+ *
+ * @return True the confidentiality service state.
+ */
+ boolean getConfState();
+
+ /**
+ * <p>Returns the integrity service state over the context. When issued
+ * before context establishment completes or when the isProtReady method
+ * returns "false", it returns the desired state, otherwise it will
+ * indicate the actual state over the established context.</p>
+ *
+ * @return The integrity service state.
+ */
+ boolean getIntegState();
+
+ /**
+ * <p>Returns the context lifetime in seconds. When issued before context
+ * establishment completes or when the isProtReady method returns
+ * "false", it returns the desired lifetime, otherwise it will indicate
+ * the remaining lifetime for the context.</p>
+ *
+ * @return The lifetime.
+ */
+ int getLifetime();
+
+ /**
+ * <p>Returns the name of the context initiator. This call is valid only
+ * after the context is fully established or the isProtReady method
+ * returns "true". It is guaranteed to return an MN.</p>
+ *
+ * @return The name of the context initiator.
+ * @throws GSSException If this operation fails.
+ */
+ GSSName getSrcName() throws GSSException;
+
+ /**
+ * <p>Returns the name of the context target (acceptor). This call is
+ * valid only after the context is fully established or the isProtReady
+ * method returns "true". It is guaranteed to return an MN.</p>
+ *
+ * @return The name of the context target.
+ * @throws GSSException If this operation fails.
+ */
+ GSSName getTargName() throws GSSException;
+
+ /**
+ * <p>Returns the mechanism oid for this context. This method may be called
+ * before the context is fully established, but the mechanism returned
+ * may change on successive calls in negotiated mechanism case.</p>
+ *
+ * @return The mechanism OID.
+ * @throws GSSException If this operation fails.
+ */
+ Oid getMech() throws GSSException;
+
+ /**
+ * <p>Returns the delegated credential object on the acceptor's side.
+ * To check for availability of delegated credentials call
+ * {@link #getDelegCredState()}. This call is only valid on fully
+ * established contexts.</p>
+ *
+ * @return The delegated credential object.
+ * @throws GSSException If this operation fails.
+ */
+ GSSCredential getDelegCred() throws GSSException;
+
+ /**
+ * <p>Returns "true" if this is the initiator of the context. This call is
+ * only valid after the context creation process has started.</p>
+ *
+ * @return True if this is the initiator.
+ * @throws GSSException If this operation fails.
+ */
+ boolean isInitiator() throws GSSException;
+}
diff --git a/org/ietf/jgss/GSSCredential.java b/org/ietf/jgss/GSSCredential.java
new file mode 100644
index 000000000..318848ec9
--- /dev/null
+++ b/org/ietf/jgss/GSSCredential.java
@@ -0,0 +1,334 @@
+/* GSSCredential.java -- GSS credential interface.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+/**
+ * <p>This interface encapsulates the GSS-API credentials for an entity.
+ * A credential contains all the necessary cryptographic information to
+ * enable the creation of a context on behalf of the entity that it
+ * represents. It may contain multiple, distinct, mechanism specific
+ * credential elements, each containing information for a specific
+ * security mechanism, but all referring to the same entity.</p>
+ *
+ * <p>A credential may be used to perform context initiation, acceptance,
+ * or both.</p>
+ *
+ * <p>GSS-API implementations must impose a local access-control policy on
+ * callers to prevent unauthorized callers from acquiring credentials to
+ * which they are not entitled. GSS-API credential creation is not
+ * intended to provide a "login to the network" function, as such a
+ * function would involve the creation of new credentials rather than
+ * merely acquiring a handle to existing credentials. Such functions,
+ * if required, should be defined in implementation-specific extensions
+ * to the API.</p>
+ *
+ * <p>If credential acquisition is time-consuming for a mechanism, the
+ * mechanism may choose to delay the actual acquisition until the
+ * credential is required (e.g. by {@link GSSContext}). Such mechanism-
+ * specific implementation decisions should be invisible to the calling
+ * application; thus the query methods immediately following the
+ * creation of a credential object must return valid credential data,
+ * and may therefore incur the overhead of a deferred credential
+ * acquisition.</p>
+ *
+ * <p>Applications will create a credential object passing the desired
+ * parameters. The application can then use the query methods to obtain
+ * specific information about the instantiated credential object
+ * (equivalent to the gss_inquire routines). When the credential is no
+ * longer needed, the application should call the dispose (equivalent to
+ * gss_release_cred) method to release any resources held by the
+ * credential object and to destroy any cryptographically sensitive
+ * information.</p>
+ *
+ * <p>Classes implementing this interface also implement the {@link Cloneable}
+ * interface. This indicates the the class will support the {@link
+ * Cloneable#clone()} method that will allow the creation of duplicate
+ * credentials. This is useful when called just before the {@link
+ * #add(org.ietf.jgss.GSSName,int,int,org.ietf.jgss.Oid,int)} call to retain
+ * a copy of the original credential.</p>
+ *
+ * <h3>Example Code</h3>
+ *
+ * <pre>
+GSSManager mgr = GSSManager.getInstance();
+
+// start by creating a name object for the entity
+GSSName name = mgr.createName("userName", GSSName.NT_USER_NAME);
+
+// now acquire credentials for the entity
+GSSCredential cred = mgr.createCredential(name,
+ GSSCredential.ACCEPT_ONLY);
+
+// display credential information - name, remaining lifetime,
+// and the mechanisms it has been acquired over
+print(cred.getName().toString());
+print(cred.getRemainingLifetime());
+
+Oid [] mechs = cred.getMechs();
+if (mechs != null)
+ {
+ for (int i = 0; i < mechs.length; i++)
+ print(mechs[i].toString());
+ }
+
+// release system resources held by the credential
+cred.dispose();
+ * </pre>
+ */
+public interface GSSCredential extends Cloneable
+{
+
+ // Constants.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Credential usage flag requesting that it be able to be used for both
+ * context initiation and acceptance.
+ */
+ int INITIATE_AND_ACCEPT = 0;
+
+ /**
+ * Credential usage flag requesting that it be able to be used for
+ * context initiation only.
+ */
+ int INITIATE_ONLY = 1;
+
+ /**
+ * Credential usage flag requesting that it be able to be used for
+ * context acceptance only.
+ */
+ int ACCEPT_ONLY = 2;
+
+ /**
+ * A lifetime constant representing the default credential lifetime.
+ */
+ int DEFAULT_LIFETIME = 0;
+
+ /**
+ * A lifetime constant representing indefinite credential lifetime.
+ */
+ int INDEFINITE_LIFETIME = Integer.MAX_VALUE;
+
+ // Methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Releases any sensitive information that the GSSCredential object may
+ * be containing. Applications should call this method as soon as the
+ * credential is no longer needed to minimize the time any sensitive
+ * information is maintained.
+ *
+ * @throws GSSException If this operation fails.
+ */
+ void dispose() throws GSSException;
+
+ /**
+ * Retrieves the name of the entity that the credential asserts.
+ *
+ * @return The name.
+ * @throws GSSException If this operation fails.
+ */
+ GSSName getName() throws GSSException;
+
+ /**
+ * Retrieves a mechanism name of the entity that the credential asserts.
+ * Equivalent to calling {@link GSSName#canonicalize(org.ietf.jgss.Oid)}
+ * on the name returned by {@link #getName()}.
+ *
+ * @param mechOID The mechanism for which information should be returned.
+ * @return The name.
+ * @throws GSSException If this operation fails.
+ */
+ GSSName getName(Oid mechOID) throws GSSException;
+
+ /**
+ * Returns the remaining lifetime in seconds for a credential. The
+ * remaining lifetime is the minimum lifetime for any of the underlying
+ * credential mechanisms. A return value of {@link
+ * GSSCredential#INDEFINITE_LIFETIME} indicates that the credential does
+ * not expire. A return value of 0 indicates that the credential is
+ * already expired.
+ *
+ * @return The remaining lifetime.
+ * @throws GSSException If this operation fails.
+ */
+ int getRemainingLifetime() throws GSSException;
+
+ /**
+ * Returns the remaining lifetime is seconds for the credential to
+ * remain capable of initiating security contexts under the specified
+ * mechanism. A return value of {@link GSSCredential#INDEFINITE_LIFETIME}
+ * indicates that the credential does not expire for context initiation.
+ * A return value of 0 indicates that the credential is already expired.
+ *
+ * @param mech The mechanism for which information should be returned.
+ * @return The remaining lifetime.
+ * @throws GSSException If this operation fails.
+ */
+ int getRemainingInitLifetime(Oid mech) throws GSSException;
+
+ /**
+ * Returns the remaining lifetime is seconds for the credential to
+ * remain capable of accepting security contexts under the specified
+ * mechanism. A return value of {@link GSSCredential#INDEFINITE_LIFETIME}
+ * indicates that the credential does not expire for context acceptance.
+ * A return value of 0 indicates that the credential is already expired.
+ *
+ * @param mech The mechanism for which information should be returned.
+ * @return The remaining lifetime.
+ * @throws GSSException If this operation fails.
+ */
+ int getRemainingAcceptLifetime(Oid mech) throws GSSException;
+
+ /**
+ * Returns the credential usage flag. The return value will be one of
+ * {@link GSSCredential#INITIATE_ONLY}, {@link GSSCredential#ACCEPT_ONLY},
+ * or {@link GSSCredential#INITIATE_AND_ACCEPT}.
+ *
+ * @return The credential usage flag.
+ * @throws GSSException If this operation fails.
+ */
+ int getUsage() throws GSSException;
+
+ /**
+ * Returns the credential usage flag for the specified credential
+ * mechanism. The return value will be one of
+ * {@link GSSCredential#INITIATE_ONLY}, {@link GSSCredential#ACCEPT_ONLY},
+ * or {@link GSSCredential#INITIATE_AND_ACCEPT}.
+ *
+ * @param mechOID The mechanism for which information should be returned.
+ * @return The credential usage flag.
+ * @throws GSSException If this operation fails.
+ */
+ int getUsage(Oid mechOID) throws GSSException;
+
+ /**
+ * Returns an array of mechanisms supported by this credential.
+ *
+ * @return The supported mechanism.
+ * @throws GSSException If this operation fails.
+ */
+ Oid[] getMechs() throws GSSException;
+
+ /**
+ * <p>Adds a mechanism specific credential-element to an existing
+ * credential. This method allows the construction of credentials one
+ * mechanism at a time.</p>
+ *
+ * <p>This routine is envisioned to be used mainly by context acceptors
+ * during the creation of acceptance credentials which are to be used
+ * with a variety of clients using different security mechanisms.</p>
+ *
+ * <p>This routine adds the new credential element "in-place". To add the
+ * element in a new credential, first call {@link Cloneable#clone()} to
+ * obtain a copy of this credential, then call its <code>add()</code>
+ * method.</p>
+ *
+ * @param aName Name of the principal for whom this credential
+ * is to be acquired. Use <code>null</code> to
+ * specify the default principal.
+ * @param initLifetime The number of seconds that credentials should
+ * remain valid for initiating of security contexts.
+ * Use {@link #INDEFINITE_LIFETIME} to request that
+ * the credentials have the maximum permitted lifetime.
+ * Use {@link GSSCredential#DEFAULT_LIFETIME} to
+ * request the default credential lifetime.
+ * @param acceptLifetime The number of seconds that credentials should
+ * remain valid for accepting of security contexts.
+ * Use {@link GSSCredential#INDEFINITE_LIFETIME} to
+ * request that the credentials have the maximum
+ * permitted lifetime. Use {@link
+ * GSSCredential#DEFAULT_LIFETIME} to request
+ * the default credential lifetime.
+ * @param mech The mechanisms over which the credential is to be
+ * acquired.
+ * @param usage The intended usage for this credential object. The
+ * value of this parameter must be one of:
+ * {@link GSSCredential#ACCEPT_AND_INITIATE},
+ * {@link GSSCredential#ACCEPT_ONLY},
+ * {@link GSSCredential#INITIATE_ONLY}.
+ * @throws GSSException If this operation fails.
+ */
+ void add(GSSName aName, int initLifetime, int acceptLifetime,
+ Oid mech, int usage) throws GSSException;
+
+ /**
+ * Tests if this GSSCredential refers to the same entity as the supplied
+ * object. The two credentials must be acquired over the same
+ * mechanisms and must refer to the same principal. Returns <code>true</code>
+ * if the two GSSCredentials refer to the same entity; <code>false</code>
+ * otherwise. (Note that the Java language specification requires that two
+ * objects that are equal according to the {@link
+ * Object#equals(java.lang.Object)} method must return the same integer
+ * result when the {@link Object#hashCode()} method is called on them.)
+ *
+ * @param another Another GSSCredential object for comparison.
+ * @return True if this object equals the other.
+ */
+ boolean equals(Object another);
+}
diff --git a/org/ietf/jgss/GSSException.java b/org/ietf/jgss/GSSException.java
new file mode 100644
index 000000000..7b8139f0f
--- /dev/null
+++ b/org/ietf/jgss/GSSException.java
@@ -0,0 +1,435 @@
+/* GSSException.java -- a general exception in GSS.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+import java.util.PropertyResourceBundle;
+import java.util.ResourceBundle;
+
+/**
+ * This exception is thrown whenever a fatal GSS-API error occurs
+ * including mechanism specific errors. It may contain both, the major
+ * and minor, GSS-API status codes. The mechanism implementers are
+ * responsible for setting appropriate minor status codes when throwing
+ * this exception. Aside from delivering the numeric error code(s) to
+ * the caller, this class performs the mapping from their numeric values
+ * to textual representations. All Java GSS-API methods are declared
+ * throwing this exception.
+ */
+public class GSSException extends Exception
+{
+ /**
+ * For compatability with Sun's JDK 1.4.2 rev. 5
+ */
+ private static final long serialVersionUID = -2706218945227726672L;
+
+ // Constants and fields.
+ // -------------------------------------------------------------------------
+
+ // These values do not jive with the "Constant Field Values" in the J2SE
+ // 1.4.1, but do follow RFC 2853. I trust the IETF, but not Sun.
+
+ /**
+ * Channel bindings mismatch error.
+ */
+ public static final int BAD_BINDINGS = 4;
+
+ /**
+ * Unsupported mechanism requested error.
+ */
+ public static final int BAD_MECH = 1;
+
+ /**
+ * Invalid name provided error.
+ */
+ public static final int BAD_NAME = 2;
+
+ /**
+ * Name of unsupported type provided error.
+ */
+ public static final int BAD_NAMETYPE = 3;
+
+ /**
+ * Invalid status code error - this is the default status value.
+ */
+ public static final int BAD_STATUS = 5;
+
+ /**
+ * Token had invalid integrity check error.
+ */
+ public static final int BAD_MIC = 6;
+
+ /**
+ * Specified security context expired error.
+ */
+ public static final int CONTEXT_EXPIRED = 12;
+
+ /**
+ * Expired credentials detected error.
+ */
+ public static final int CREDENTIALS_EXPIRED = 11;
+
+ /**
+ * Defective credential error.
+ */
+ public static final int DEFECTIVE_CREDENTIAL = 10;
+
+ /**
+ * Defective token error.
+ */
+ public static final int DEFECTIVE_TOKEN = 9;
+
+ /**
+ * General failure, unspecified at GSS-API level.
+ */
+ public static final int FAILURE = 13;
+
+ /**
+ * Invalid security context error.
+ */
+ public static final int NO_CONTEXT = 8;
+
+ /**
+ * Invalid credentials error.
+ */
+ public static final int NO_CRED = 7;
+
+ /**
+ * Unsupported QOP value error.
+ */
+ public static final int BAD_QOP = 14;
+
+ /**
+ * Operation unauthorized error.
+ */
+ public static final int UNAUTHORIZED = 15;
+
+ /**
+ * Operation unavailable error.
+ */
+ public static final int UNAVAILABLE = 16;
+
+ /**
+ * Duplicate credential element requested error.
+ */
+ public static final int DUPLICATE_ELEMENT = 17;
+
+ /**
+ * Name contains multi-mechanism elements error.
+ */
+ public static final int NAME_NOT_MN = 18;
+
+ /**
+ * The token was a duplicate of an earlier token. This is a fatal error
+ * code that may occur during context establishment. It is not used to
+ * indicate supplementary status values. The MessageProp object is used
+ * for that purpose.
+ */
+ public static final int DUPLICATE_TOKEN = 20;
+
+ /**
+ * The token's validity period has expired. This is a fatal error code
+ * that may occur during context establishment. It is not used to
+ * indicate supplementary status values. The MessageProp object is used
+ * for that purpose.
+ */
+ public static final int OLD_TOKEN = 19;
+
+ /**
+ * A later token has already been processed. This is a fatal error code
+ * that may occur during context establishment. It is not used to
+ * indicate supplementary status values. The MessageProp object is used
+ * for that purpose.
+ */
+ public static final int UNSEQ_TOKEN = 21;
+
+ /**
+ * An expected per-message token was not received. This is a fatal
+ * error code that may occur during context establishment. It is not
+ * used to indicate supplementary status values. The MessageProp object
+ * is used for that purpose.
+ */
+ public static final int GAP_TOKEN = 22;
+
+ private final int major;
+ private int minor;
+ private String minorString;
+
+ private ResourceBundle messages;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Create a new GSS exception with the given major code.
+ *
+ * @param major The major GSS error code.
+ */
+ public GSSException(int major)
+ {
+ this(major, 0, null);
+ }
+
+ /**
+ * Create a new GSS exception with the given major and minor codes, and a
+ * minor explanation string.
+ *
+ * @param major The major GSS error code.
+ * @param minor The minor application-specific error code.
+ * @param minorString An explanation of the minor error code.
+ */
+ public GSSException(int major, int minor, String minorString)
+ {
+ this.major = major;
+ this.minor = minor;
+ this.minorString = minorString;
+ try
+ {
+ messages = PropertyResourceBundle.getBundle("org/ietf/jgss/MessagesBundle");
+ }
+ catch (Exception e)
+ {
+ messages = null;
+ }
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the major code representing the GSS error code that caused
+ * this exception to be thrown.
+ *
+ * @return The major error code.
+ */
+ public int getMajor()
+ {
+ return major;
+ }
+
+ /**
+ * Returns the mechanism error code that caused this exception. The
+ * minor code is set by the underlying mechanism. Value of 0 indicates
+ * that mechanism error code is not set.
+ *
+ * @return The minor error code, or 0 if not set.
+ */
+ public int getMinor()
+ {
+ return minor;
+ }
+
+ /**
+ * Returns a string explaining the GSS major error code causing this
+ * exception to be thrown.
+ *
+ * @return The major error string.
+ */
+ public String getMajorString()
+ {
+ switch (major)
+ {
+ case BAD_MECH:
+ return getMsg("GSSException.BAD_MECH",
+ "An unsupported mechanism was requested.");
+ case BAD_NAME:
+ return getMsg("GSSException.BAD_NAME",
+ "An invalid name was supplied.");
+ case BAD_NAMETYPE:
+ return getMsg("GSSException.BAD_NAMETYPE",
+ "A supplied name was of an unsupported type.");
+ case BAD_BINDINGS:
+ return getMsg("GSSException.BAD_BINDINGS",
+ "Incorrect channel bindings were supplied.");
+ case BAD_STATUS:
+ return getMsg("GSSException.BAD_STATUS",
+ "An invalid status code was supplied.");
+ case BAD_MIC:
+ return getMsg("GSSException.BAD_MIC",
+ "A token had an invalid MIC.");
+ case NO_CRED:
+ return getMsg("GSSException.NO_CRED",
+ "No credentials were supplied, or the credentials were "+
+ "unavailable or inaccessible.");
+ case NO_CONTEXT:
+ return getMsg("GSSException.NO_CONTEXT",
+ "Invalid context has been supplied.");
+ case DEFECTIVE_TOKEN:
+ return getMsg("GSSException.DEFECTIVE_TOKEN",
+ "A supplied token was invalid.");
+ case DEFECTIVE_CREDENTIAL:
+ return getMsg("GSSException.DEFECTIVE_CREDENTIAL",
+ "A supplied credential was invalid.");
+ case CREDENTIALS_EXPIRED:
+ return getMsg("GSSException.CREDENTIALS_EXPIRED",
+ "The referenced credentials have expired.");
+ case CONTEXT_EXPIRED:
+ return getMsg("GSSException.CONTEXT_EXPIRED",
+ "The context has expired.");
+ case FAILURE:
+ return getMsg("GSSException.FAILURE",
+ "Miscellaneous failure.");
+ case BAD_QOP:
+ return getMsg("GSSException.BAD_QOP",
+ "The quality-of-protection requested could not be provided.");
+ case UNAUTHORIZED:
+ return getMsg("GSSException.UNAUTHORIZED",
+ "The operation is forbidden by local security policy.");
+ case UNAVAILABLE:
+ return getMsg("GSSException.UNAVAILABLE",
+ "The operation or option is unavailable.");
+ case DUPLICATE_ELEMENT:
+ return getMsg("GSSException.DUPLICATE_ELEMENT",
+ "The requested credential element already exists.");
+ case NAME_NOT_MN:
+ return getMsg("GSSException.NAME_NOT_MN",
+ "The provided name was not a mechanism name.");
+ case OLD_TOKEN:
+ return getMsg("GSSException.OLD_TOKEN",
+ "The token's validity period has expired.");
+ case DUPLICATE_TOKEN:
+ return getMsg("GSSException.DUPLICATE_TOKEN",
+ "The token was a duplicate of an earlier version.");
+ case UNSEQ_TOKEN:
+ return getMsg("GSSException.UNSEQ_TOKEN",
+ "A later token has already been processed.");
+ case GAP_TOKEN:
+ return getMsg("GSSException.GAP_TOKEN",
+ "An expected per-message token was not received.");
+ default: return "Unknown or invalid error code.";
+ }
+ }
+
+ /**
+ * Returns a string explaining the mechanism specific error code.
+ * <code>null</code> will be returned when no mechanism error code has
+ * been set.
+ *
+ * @return The minor error string, or <code>null</code>.
+ */
+ public String getMinorString()
+ {
+ return minorString;
+ }
+
+ /**
+ * Used internally by the GSS-API implementation and the underlying
+ * mechanisms to set the minor code and its textual representation.
+ *
+ * @param minorCode The mechanism specific error code.
+ * @param message A textual explanation of the mechanism error code.
+ */
+ public void setMinor(int minorCode, String message)
+ {
+ this.minor = minorCode;
+ this.minorString = message;
+ }
+
+ /**
+ * Returns a textual representation of both the major and minor status
+ * codes.
+ *
+ * @return The textual representation.
+ */
+ public String toString()
+ {
+ return GSSException.class.getName() + ": " + getMessage();
+ }
+
+ /**
+ * Returns a detailed message of this exception. Overrides {@link
+ * Throwable#getMessage()}. It is customary in Java to use this method to
+ * obtain exception information.
+ *
+ * @return The detail message.
+ */
+ public String getMessage()
+ {
+ if (minor == 0)
+ return getMajorString();
+ else
+ return getMajorString() + " (" + minorString + ")";
+ }
+
+ // Own methods.
+ // -------------------------------------------------------------------------
+
+ private String getMsg(String key, String defaultText)
+ {
+ if (messages != null)
+ {
+ try
+ {
+ return messages.getString(key);
+ }
+ catch (Exception e)
+ {
+ }
+ }
+ return defaultText;
+ }
+}
diff --git a/org/ietf/jgss/GSSManager.java b/org/ietf/jgss/GSSManager.java
new file mode 100644
index 000000000..26fdd14b6
--- /dev/null
+++ b/org/ietf/jgss/GSSManager.java
@@ -0,0 +1,501 @@
+/* GSSManager.java -- manager class for the GSS-API.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+import java.security.Provider;
+import java.security.Security;
+
+/**
+ * <p>The GSSManager class is an abstract class that serves as a factory
+ * for three GSS interfaces: {@link GSSName}, {@link GSSCredential}, and
+ * {@link GSSContext}. It also provides methods for applications to determine
+ * what mechanisms are available from the GSS implementation and what
+ * nametypes these mechanisms support. An instance of the default GSSManager
+ * subclass may be obtained through the static method {@link #getInstance()},
+ * but applications are free to instantiate other subclasses of GSSManager.</p>
+ *
+ * <p>All but one method in this class are declared abstract. This means
+ * that subclasses have to provide the complete implementation for those
+ * methods. The only exception to this is the static method {@link
+ * #getInstance()} which will have platform specific code to return an
+ * instance of the default subclass.</p>
+ *
+ * <p>Platform providers of GSS are required not to add any constructors to
+ * this class, private, public, or protected. This will ensure that all
+ * subclasses invoke only the default constructor provided to the base
+ * class by the compiler.</p>
+ *
+ * <p>A subclass extending the GSSManager abstract class may be implemented
+ * as a modular provider based layer that utilizes some well known
+ * service provider specification. The GSSManager API provides the
+ * application with methods to set provider preferences on such an
+ * implementation. These methods also allow the implementation to throw
+ * a well-defined exception in case provider based configuration is not
+ * supported. Applications that expect to be portable should be aware of
+ * this and recover cleanly by catching the exception.</p>
+ *
+ * <p>It is envisioned that there will be three most common ways in which
+ * providers will be used:</p>
+ *
+ * <ol>
+ * <li>The application does not care about what provider is used (the
+ * default case).</li>
+ *
+ * <li>The application wants a particular provider to be used
+ * preferentially, either for a particular mechanism or all the
+ * time, irrespective of mechanism.</li>
+ *
+ * <li>The application wants to use the locally configured providers
+ * as far as possible but if support is missing for one or more
+ * mechanisms then it wants to fall back on its own provider.</li>
+ * </ol>
+ *
+ * <p>The GSSManager class has two methods that enable these modes of
+ * usage: {@link #addProviderAtFront(java.security.Provider,org.ietf.jgss.Oid)}
+ * and {@link #addProviderAtEnd(java.security.Provider,org.ietf.jgss.Oid)}.
+ * These methods have the effect of creating an ordered list of
+ * (<i>provider</i>, <i>oid</i>) pairs where each pair indicates a preference
+ * of provider for a given oid.</p>
+ *
+ * <p>The use of these methods does not require any knowledge of whatever
+ * service provider specification the GSSManager subclass follows. It is
+ * hoped that these methods will serve the needs of most applications.
+ * Additional methods may be added to an extended GSSManager that could
+ * be part of a service provider specification that is standardized
+ * later.</p>
+ *
+ * <h3>Example Code</h3>
+ *
+ * <pre>
+GSSManager mgr = GSSManager.getInstance();
+
+// What mechs are available to us?
+Oid[] supportedMechs = mgr.getMechs();
+
+// Set a preference for the provider to be used when support is needed
+// for the mechanisms "1.2.840.113554.1.2.2" and "1.3.6.1.5.5.1.1".
+
+Oid krb = new Oid("1.2.840.113554.1.2.2");
+Oid spkm1 = new Oid("1.3.6.1.5.5.1.1");
+
+Provider p = (Provider) (new com.foo.security.Provider());
+
+mgr.addProviderAtFront(p, krb);
+mgr.addProviderAtFront(p, spkm1);
+
+// What name types does this spkm implementation support?
+Oid[] nameTypes = mgr.getNamesForMech(spkm1);
+</pre>
+ */
+public abstract class GSSManager
+{
+
+ // Constructor.
+ // -------------------------------------------------------------------------
+
+ public GSSManager()
+ {
+ }
+
+ // Class method.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns the default GSSManager implementation.
+ *
+ * @return The default GSSManager implementation.
+ */
+ public static synchronized GSSManager getInstance()
+ {
+ String impl = Security.getProperty("org.ietf.jgss.GSSManager");
+ if (impl == null)
+ impl = "gnu.crypto.gssapi.GSSManagerImpl";
+ try
+ {
+ ClassLoader loader = GSSManager.class.getClassLoader();
+ if (loader == null)
+ loader = ClassLoader.getSystemClassLoader();
+ Class c = loader.loadClass(impl);
+ return (GSSManager) c.newInstance();
+ }
+ catch (Exception x)
+ {
+ throw new RuntimeException(x.toString());
+ }
+ }
+
+ // Abstract methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>This method is used to indicate to the GSSManager that the
+ * application would like a particular provider to be used if no other
+ * provider can be found that supports the given mechanism. When a value
+ * of null is used instead of an Oid for the mechanism, the GSSManager
+ * must use the indicated provider for any mechanism.</p>
+ *
+ * <p>Calling this method repeatedly preserves the older settings but
+ * raises them above newer ones in preference thus forming an ordered
+ * list of providers and Oid pairs that grows at the bottom. Thus the
+ * older provider settings will be utilized first before this one is.</p>
+ *
+ * <p>If there are any previously existing preferences that conflict with
+ * the preference being set here, then the GSSManager should ignore this
+ * request.</p>
+ *
+ * <p>If the GSSManager implementation does not support an SPI with a
+ * pluggable provider architecture it should throw a GSSException with
+ * the status code {@link GSSException#UNAVAILABLE} to indicate that the
+ * operation is unavailable.</p>
+ *
+ * @param p The provider instance that should be used whenever
+ * support is needed for <i>mech</i>.
+ * @param mech The mechanism for which the provider is being set.
+ * @throws GSSException If this service is unavailable.
+ */
+ public abstract void addProviderAtEnd(Provider p, Oid mech)
+ throws GSSException;
+
+ /**
+ * <p>This method is used to indicate to the GSSManager that the
+ * application would like a particular provider to be used ahead of all
+ * others when support is desired for the given mechanism. When a value
+ * of null is used instead of an Oid for the mechanism, the GSSManager
+ * must use the indicated provider ahead of all others no matter what
+ * the mechanism is. Only when the indicated provider does not support
+ * the needed mechanism should the GSSManager move on to a different
+ * provider.</p>
+ *
+ * <p>Calling this method repeatedly preserves the older settings but
+ * lowers them in preference thus forming an ordered list of provider
+ * and Oid pairs that grows at the top.</p>
+ *
+ * <p>Calling addProviderAtFront with a null Oid will remove all previous
+ * preferences that were set for this provider in the GSSManager
+ * instance. Calling addProviderAtFront with a non-null Oid will remove
+ * any previous preference that was set using this mechanism and this
+ * provider together.</p>
+ *
+ * <p>If the GSSManager implementation does not support an SPI with a
+ * pluggable provider architecture it should throw a GSSException with
+ * the status code {@link GSSException#UNAVAILABLE} to indicate that the
+ * operation is unavailable.</p>
+ *
+ * @param p The provider instance that should be used whenever
+ * support is needed for <i>mech</i>.
+ * @param mech The mechanism for which the provider is being set.
+ * @throws GSSException If this service is unavailable.
+ */
+ public abstract void addProviderAtFront(Provider p, Oid mech)
+ throws GSSException;
+
+ /**
+ * Factory method for creating a previously exported context. The
+ * context properties will be determined from the input token and can't
+ * be modified through the set methods.
+ *
+ * @param interProcessToken The token previously emitted from the
+ * export method.
+ * @return The context.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSContext createContext(byte[] interProcessToken)
+ throws GSSException;
+
+ /**
+ * Factory method for creating a context on the acceptor' side. The
+ * context's properties will be determined from the input token supplied
+ * to the accept method.
+ *
+ * @param myCred Credentials for the acceptor. Use <code>null</code> to
+ * act as a default acceptor principal.
+ * @return The context.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSContext createContext(GSSCredential myCred)
+ throws GSSException;
+
+ /**
+ * Factory method for creating a context on the initiator's side.
+ * Context flags may be modified through the mutator methods prior to
+ * calling {@link
+ * GSSContext#initSecContext(java.io.InputStream,java.io.OutputStream)}.
+ *
+ * @param peer Name of the target peer.
+ * @param mech Oid of the desired mechanism. Use <code>null</code>
+ * to request default mechanism.
+ * @param myCred Credentials of the initiator. Use <code>null</code>
+ * default initiator principal.
+ * @param lifetime The request lifetime, in seconds, for the context.
+ * Use {@link GSSContext#INDEFINITE_LIFETIME} and
+ * {@link GSSContext#DEFAULT_LIFETIME} to request
+ * indefinite or default context lifetime.
+ * @return The context.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSContext createContext(GSSName peer, Oid mech,
+ GSSCredential myCred, int lifetime)
+ throws GSSException;
+
+ /**
+ * Factory method for acquiring default credentials. This will cause
+ * the GSS-API to use system specific defaults for the set of
+ * mechanisms, name, and a DEFAULT lifetime.
+ *
+ * @param usage The intended usage for this credential object. The
+ * value of this parameter must be one of:
+ * {@link GSSCredential#ACCEPT_AND_INITIATE},
+ * {@link GSSCredential#ACCEPT_ONLY},
+ * {@link GSSCredential#INITIATE_ONLY}.
+ * @return The credential.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSCredential createCredential(int usage) throws GSSException;
+
+ /**
+ * Factory method for acquiring a single mechanism credential.
+ *
+ * @param aName Name of the principal for whom this credential is to
+ * be acquired. Use <code>null</code> to specify the
+ * default principal.
+ * @param lifetime The number of seconds that credentials should remain
+ * valid. Use {@link GSSCredential#INDEFINITE_LIFETIME}
+ * to request that the credentials have the maximum
+ * permitted lifetime. Use {@link
+ * GSSCredential#DEFAULT_LIFETIME} to request default
+ * credential lifetime.
+ * @param mech The oid of the desired mechanism. Use <code>null</code>
+ * to request the default mechanism(s).
+ * @param usage The intended usage for this credential object. The
+ * value of this parameter must be one of:
+ * {@link GSSCredential#ACCEPT_AND_INITIATE},
+ * {@link GSSCredential#ACCEPT_ONLY},
+ * {@link GSSCredential#INITIATE_ONLY}.
+ * @return The credential.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSCredential createCredential(GSSName aName, int lifetime,
+ Oid mech, int usage)
+ throws GSSException;
+
+ /**
+ * Factory method for acquiring credentials over a set of mechanisms.
+ * Acquires credentials for each of the mechanisms specified in the
+ * array called mechs. To determine the list of mechanisms' for which
+ * the acquisition of credentials succeeded, the caller should use the
+ * {@link GSSCredential#getMechs()} method.
+ *
+ * @param aName Name of the principal for whom this credential is to
+ * be acquired. Use <code>null</code> to specify the
+ * default principal.
+ * @param lifetime The number of seconds that credentials should remain
+ * valid. Use {@link GSSCredential#INDEFINITE_LIFETIME}
+ * to request that the credentials have the maximum
+ * permitted lifetime. Use {@link
+ * GSSCredential#DEFAULT_LIFETIME} to request default
+ * credential lifetime.
+ * @param mechs The array of mechanisms over which the credential is
+ * to be acquired. Use <code>null</code> for requesting
+ * a system specific default set of mechanisms.
+ * @param usage The intended usage for this credential object. The
+ * value of this parameter must be one of:
+ * {@link GSSCredential#ACCEPT_AND_INITIATE},
+ * {@link GSSCredential#ACCEPT_ONLY},
+ * {@link GSSCredential#INITIATE_ONLY}.
+ * @return The credential.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSCredential createCredential(GSSName aName, int lifetime,
+ Oid[] mechs, int usage)
+ throws GSSException;
+
+ /**
+ * Factory method to convert a contiguous byte array containing a name
+ * from the specified namespace to a {@link GSSName} object. In general,
+ * the {@link GSSName} object created will not be an MN; two examples that
+ * are exceptions to this are when the namespace type parameter indicates
+ * {@link GSSName#NT_EXPORT_NAME} or when the GSS-API implementation is not
+ * multi-mechanism.
+ *
+ * @param name The byte array containing the name to create.
+ * @param nameType The Oid specifying the namespace of the name supplied
+ * in the byte array. Note that nameType serves to
+ * describe and qualify the interpretation of the input
+ * name byte array, it does not necessarily imply a type
+ * for the output GSSName implementation. "null" value
+ * can be used to specify that a mechanism specific
+ * default syntax should be assumed by each mechanism
+ * that examines the byte array.
+ * @return The name.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSName createName(byte[] name, Oid nameType)
+ throws GSSException;
+
+ /**
+ * Factory method to convert a contiguous byte array containing a name
+ * from the specified namespace to a GSSName object that is an MN. In
+ * other words, this method is a utility that does the equivalent of two
+ * steps: {@link #createName(byte[],org.ietf.jgss.Oid)} and then also
+ * {@link GSSName#canonicalize(org.ietf.jgss.Oid)}.
+ *
+ * @param name The byte array representing the name to create.
+ * @param nameType The Oid specifying the namespace of the name supplied
+ * in the byte array. Note that nameType serves to
+ * describe and qualify the interpretation of the input
+ * name byte array, it does not necessarily imply a type
+ * for the output GSSName implementation. "null" value
+ * can be used to specify that a mechanism specific
+ * default syntax should be assumed by each mechanism
+ * that examines the byte array.
+ * @param mech Oid specifying the mechanism for which this name
+ * should be created.
+ * @return The name.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSName createName(byte[] name, Oid nameType, Oid mech)
+ throws GSSException;
+
+ /**
+ * Factory method to convert a contiguous string name from the specified
+ * namespace to a {@link GSSName} object. In general, the {@link GSSName}
+ * object created will not be an MN; two examples that are exceptions to
+ * this are when the namespace type parameter indicates {@link
+ * GSSName#NT_EXPORT_NAME} or when the GSS-API implementation is not
+ * multi-mechanism.
+ *
+ * @param nameStr The string representing a printable form of the name
+ * to create.
+ * @param nameType The Oid specifying the namespace of the printable name
+ * supplied. Note that nameType serves to describe and
+ * qualify the interpretation of the input nameStr, it
+ * does not necessarily imply a type for the output
+ * GSSName implementation. "null" value can be used to
+ * specify that a mechanism specific default printable
+ * syntax should be assumed by each mechanism that
+ * examines nameStr.
+ * @return The name.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSName createName(String nameStr, Oid nameType)
+ throws GSSException;
+
+ /**
+ * Factory method to convert a contiguous string name from the specified
+ * namespace to an GSSName object that is a mechanism name (MN). In
+ * other words, this method is a utility that does the equivalent of two
+ * steps: the {@link #createName(java.lang.String,org.ietf.jgss.Oid)}
+ * and then also {@link GSSName#canonicalize(org.ietf.jgss.Oid)}.
+ *
+ * @param nameStr The string representing a printable form of the name
+ * to create.
+ * @param nameType The Oid specifying the namespace of the printable name
+ * supplied. Note that nameType serves to describe and
+ * qualify the interpretation of the input nameStr, it
+ * does not necessarily imply a type for the output
+ * GSSName implementation. "null" value can be used to
+ * specify that a mechanism specific default printable
+ * syntax should be assumed when the mechanism examines
+ * nameStr.
+ * @param mech Oid specifying the mechanism for which this name
+ * should be created.
+ * @return The name.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract GSSName createName(String nameStr, Oid nameType, Oid mech)
+ throws GSSException;
+
+ /**
+ * Returns an array of {@link Oid} objects indicating mechanisms available
+ * to GSS-API callers. A <code>null</code> value is returned when no
+ * mechanism are available (an example of this would be when mechanism are
+ * dynamically configured, and currently no mechanisms are installed).
+ *
+ * @return The array of available mechanisms, or <code>null</code>.
+ */
+ public abstract Oid[] getMechs();
+
+ /**
+ * Returns an array of {@link Oid} objects corresponding to the mechanisms
+ * that support the specific name type. <code>null</code> is returned when
+ * no mechanisms are found to support the specified name type.
+ *
+ * @param name The Oid object for the name type.
+ * @return The array of mechanisms, or <code>null</code>.
+ */
+ public abstract Oid[] getMechsForName(Oid name);
+
+ /**
+ * Returns name type Oid's supported by the specified mechanism.
+ *
+ * @param mechanism The Oid object for the mechanism to query.
+ * @return The name type Oid's supported by the mechanism.
+ * @throws GSSException If this operation fails.
+ */
+ public abstract Oid[] getNamesForMech(Oid mechanism) throws GSSException;
+}
diff --git a/org/ietf/jgss/GSSName.java b/org/ietf/jgss/GSSName.java
new file mode 100644
index 000000000..fd158a900
--- /dev/null
+++ b/org/ietf/jgss/GSSName.java
@@ -0,0 +1,269 @@
+/* GSSName.java -- a name interface for GSS.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+/**
+ * <p>This interface encapsulates a single GSS-API principal entity.
+ * Different name formats and their definitions are identified with
+ * universal Object Identifiers (Oids). The format of the names can be
+ * derived based on the unique oid of its namespace type.</p>
+ *
+ * <h3>Example Code</h3>
+ *
+ * <pre>
+GSSManager mgr = GSSManager.getInstance();
+
+// create a host based service name
+GSSName name = mgr.createName("service@host",
+ GSSName.NT_HOSTBASED_SERVICE);
+
+Oid krb5 = new Oid("1.2.840.113554.1.2.2");
+
+GSSName mechName = name.canonicalize(krb5);
+
+// the above two steps are equivalent to the following
+GSSName mechName = mgr.createName("service@host",
+ GSSName.NT_HOSTBASED_SERVICE, krb5);
+
+// perform name comparison
+if (name.equals(mechName))
+ print("Names are equal.");
+
+// obtain textual representation of name and its printable
+// name type
+print(mechName.toString() +
+ mechName.getStringNameType().toString());
+
+// export and re-import the name
+byte [] exportName = mechName.export();
+
+// create a new name object from the exported buffer
+GSSName newName = mgr.createName(exportName,
+ GSSName.NT_EXPORT_NAME);
+</pre>
+ */
+public interface GSSName
+{
+
+ // Constants.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Name type for representing an anonymous entity. It represents the
+ * following value: <code>{ 1(iso), 3(org), 6(dod), 1(internet), 5(security),
+ * 6(nametypes), 3(gss-anonymous-name) }</code>.</p>
+ */
+ Oid NT_ANONYMOUS = new Oid(new int[] { 1, 3, 6, 1, 5, 6, 3 });
+
+ /**
+ * <p>Name type used to indicate an exported name produced by the export
+ * method. It represents the following value: <code>{ 1(iso), 3(org), 6(dod),
+ * 1(internet), 5(security), 6(nametypes), 4(gss-api-exported-name)
+ * }</code>.</p>
+ */
+ Oid NT_EXPORT_NAME = new Oid(new int[] { 1, 3, 6, 1, 5, 6, 4 });
+
+ /**
+ * <p>Oid indicating a host-based service name form. It is used to
+ * represent services associated with host computers. This name form is
+ * constructed using two elements, "service" and "hostname", as follows:</p>
+ *
+ * <blockquote><code>service@hostname</code></blockquote>
+ *
+ * <p>Values for the "service" element are registered with the IANA. It
+ * represents the following value: <code>{ 1(iso), 3(org), 6(dod),
+ * 1(internet), 5(security), 6(nametypes), 2(gss-host-based-services)
+ * }</code>.</p>
+ */
+ Oid NT_HOSTBASED_SERVICE = new Oid(new int[] { 1, 3, 6, 1, 5, 6, 2 });
+
+ /**
+ * <p>Name type to indicate a numeric user identifier corresponding to a
+ * user on a local system. (e.g. Uid). It represents the following
+ * value: <code>{ iso(1) member-body(2) United States(840) mit(113554)
+ * infosys(1) gssapi(2) generic(1) machine_uid_name(2) }</code>.</p>
+ */
+ Oid NT_MACHINE_UID_NAME = new Oid(new int[] { 1, 2, 840, 113554, 1, 2, 1, 2 });
+
+ /**
+ * <p>Name type to indicate a string of digits representing the numeric
+ * user identifier of a user on a local system. It represents the
+ * following value: <code>{ iso(1) member-body(2) United States(840)
+ * mit(113554) infosys(1) gssapi(2) generic(1) string_uid_name(3)
+ * }</code>.</p>
+ */
+ Oid NT_STRING_UID_NAME = new Oid(new int[] { 1, 2, 840, 113554, 1, 2, 1, 3 });
+
+ /**
+ * <p>Name type to indicate a named user on a local system. It represents
+ * the following value: <code>{ iso(1) member-body(2) United States(840)
+ * mit(113554) infosys(1) gssapi(2) generic(1) user_name(1) }</code>.</p>
+ */
+ Oid NT_USER_NAME = new Oid(new int[] { 1, 2, 840, 113554, 1, 2, 1, 1 });
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Compares two GSSName objects to determine whether they refer to the
+ * same entity. This method may throw a {@link GSSException} when the
+ * names cannot be compared. If either of the names represents an
+ * anonymous entity, the method will return <code>false</code>.
+ *
+ * @param another GSSName object to compare with.
+ * @return True if this name equals the other, and if neither name
+ * represents an anonymous entity.
+ * @throws GSSException If the names cannot be compared.
+ */
+ boolean equals(GSSName another) throws GSSException;
+
+ /**
+ * A variation of the {@link #equals(org.ietf.jgss.GSSName)} method that
+ * is provided to override the {@link Object#equals(java.lang.Object)}
+ * method that the implementing class will inherit. The behavior is
+ * exactly the same as that in the other equals method except that no
+ * {@link GSSException} is thrown; instead, <code>false</code> will be
+ * returned in the situation where an error occurs. (Note that the Java
+ * language specification requires that two objects that are equal
+ * according to the {@link Object#equals(java.lang.Object)} method must
+ * return the same integer when the {@link hashCode()} method is called
+ * on them.
+ *
+ * @param another GSSName object to compare with.
+ * @return True if this name equals the other, if neither name
+ * represents an anonymous entity, or if an error occurs.
+ */
+ boolean equals(Object another);
+
+ /**
+ * Creates a mechanism name (MN) from an arbitrary internal name. This
+ * is equivalent to using the factory methods {@link
+ * GSSManager#createName(java.lang.String,org.ietf.jgss.Oid,org.ietf.jgss.Oid)}
+ * or {@link
+ * GSSManager#createName(byte[],org.ietf.jgss.Oid,org.ietf.jgss.Oid)}.
+ *
+ * @param mech The oid for the mechanism for which the canonical form
+ * of the name is requested.
+ * @return The mechanism name.
+ * @throws GSSException If this operation fails.
+ */
+ GSSName canonicalize(Oid mech) throws GSSException;
+
+ /**
+ * Returns a canonical contiguous byte representation of a mechanism
+ * name (MN), suitable for direct, byte by byte comparison by
+ * authorization functions. If the name is not an MN, implementations
+ * may throw a {@link GSSException} with the {@link GSSException#NAME_NOT_MN}
+ * status code. If an implementation chooses not to throw an exception,
+ * it should use some system specific default mechanism to canonicalize
+ * the name and then export it. The format of the header of the output
+ * buffer is specified in <a
+ * href="http://www.ietf.org/rfc/rfc2743.txt">RFC 2743</a>.
+ *
+ * @return The exported name.
+ * @throws GSSException If the name is not an MN and the implementation
+ * throws an exception for this case.
+ */
+ byte[] export() throws GSSException;
+
+ /**
+ * Returns a textual representation of the GSSName object. To retrieve
+ * the printed name format, which determines the syntax of the returned
+ * string, the {@link #getStringNameType()} method can be used.
+ *
+ * @return The textual representation of the GSSName object.
+ */
+ String toString();
+
+ /**
+ * Returns the oid representing the type of name returned through the
+ * {@link #toString()} method. Using this oid, the syntax of the printable
+ * name can be determined.
+ *
+ * @return The name type.
+ * @throws GSSException If this operation fails.
+ */
+ Oid getStringNameType() throws GSSException;
+
+ /**
+ * Tests if this name object represents an anonymous entity. Returns
+ * <code>true</code> if this is an anonymous name.
+ *
+ * @return True if this name represents an anonymous entity.
+ */
+ boolean isAnonymous();
+
+ /**
+ * Tests if this name object contains only one mechanism element and is
+ * thus a mechanism name as defined by <a
+ * href="http://www.ietf.org/rfc/rfc2743.txt">RFC 2743</a>.
+ *
+ * @return True if this name is a mechanism name.
+ */
+ boolean isMN();
+}
diff --git a/org/ietf/jgss/MessageProp.java b/org/ietf/jgss/MessageProp.java
new file mode 100644
index 000000000..a3fd22e55
--- /dev/null
+++ b/org/ietf/jgss/MessageProp.java
@@ -0,0 +1,273 @@
+/* MessageProp.java -- GSS-API message property.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+/**
+ * <p>This is a utility class used within the per-message {@link
+ * GSSContext} methods to convey per-message properties.</p>
+ *
+ * <p>When used with the GSSContext interface's {@link
+ * GSSContext#wrap(byte[],int,int,org.ietf.jgss.MessageProp)} and {@link
+ * GSSContext#getMIC(byte[],int,int,org.ietf.jgss.MessageProp)} methods, an
+ * instance of this class is used to indicate the desired QOP and to
+ * request if confidentiality services are to be applied to caller
+ * supplied data (wrap only). To request default QOP, the value of 0
+ * should be used for QOP.</p>
+ *
+ * <p>When used with the {@link
+ * GSSContext#unwrap(byte[],int,int,org.ietf.jgss.MessageProp)} and {@link
+ * GSSContext#verifyMIC(byte[],int,int,byte[],int,int,org.ietf.jgss.MessageProp)}
+ * methods of the GSSContext interface, an instance of this class will be
+ * used to indicate the applied QOP and confidentiality services over the
+ * supplied message. In the case of verifyMIC, the confidentiality state
+ * will always be "false". Upon return from these methods, this object will
+ * also contain any supplementary status values applicable to the processed
+ * token. The supplementary status values can indicate old tokens, out
+ * of sequence tokens, gap tokens or duplicate tokens.</p>
+ */
+public class MessageProp
+{
+
+ // Fields.
+ // -------------------------------------------------------------------------
+
+ private int qopVal;
+ private boolean privState;
+ private boolean duplicate;
+ private boolean old;
+ private boolean unseq;
+ private boolean gap;
+ private int minorStatus;
+ private String minorString;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ /**
+ * <p>Constructor which sets QOP to 0 indicating that the default QOP is
+ * requested.</p>
+ *
+ * @param privState The desired privacy state. "true" for privacy and
+ * "false" for integrity only.
+ */
+ public MessageProp(boolean privState)
+ {
+ this(0, privState);
+ }
+
+ /**
+ * <p>Constructor which sets the values for the qop and privacy state.</p>
+ *
+ * @param qop The desired QOP. Use 0 to request a default QOP.
+ * @param privState The desired privacy state. "true" for privacy and
+ * "false" for integrity only.
+ */
+ public MessageProp(int qop, boolean privState)
+ {
+ this.qopVal = qop;
+ this.privState = privState;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Retrieves the QOP value.
+ *
+ * @return The QOP value.
+ */
+ public int getQOP()
+ {
+ return qopVal;
+ }
+
+ /**
+ * Retrieves the privacy state.
+ *
+ * @return The privacy state.
+ */
+ public boolean getPrivacy()
+ {
+ return privState;
+ }
+
+ /**
+ * Retrieves the minor status that the underlying mechanism might have
+ * set.
+ *
+ * @return The minor status.
+ */
+ public int getMinorStatus()
+ {
+ return minorStatus;
+ }
+
+ /**
+ * Returns a string explaining the mechanism specific error code.
+ * <code>null</code> will be returned when no mechanism error code has
+ * been set.
+ *
+ * @return The minor status string.
+ */
+ public String getMinorString()
+ {
+ return minorString;
+ }
+
+ /**
+ * Sets the QOP value.
+ *
+ * @param qopVal The QOP value to be set. Use 0 to request a default
+ * QOP value.
+ */
+ public void setQOP(int qopVal)
+ {
+ this.qopVal = qopVal;
+ }
+
+ /**
+ * Sets the privacy state.
+ *
+ * @param privState The privacy state to set.
+ */
+ public void setPrivacy(boolean privState)
+ {
+ this.privState = privState;
+ }
+
+ /**
+ * Returns "true" if this is a duplicate of an earlier token.
+ *
+ * @return True if this is a duplicate of an earlier token.
+ */
+ public boolean isDuplicateToken()
+ {
+ return duplicate;
+ }
+
+ /**
+ * Returns "true" if the token's validity period has expired.
+ *
+ * @return True if the token's validity period has expired.
+ */
+ public boolean isOldToken()
+ {
+ return old;
+ }
+
+ /**
+ * Returns "true" if a later token has already been processed.
+ *
+ * @return True if a later token has already been processed.
+ */
+ public boolean isUnseqToken()
+ {
+ return unseq;
+ }
+
+ /**
+ * Returns "true" if an expected per-message token was not received.
+ *
+ * @return True if an expected per-message token was not received.
+ */
+ public boolean isGapToken()
+ {
+ return gap;
+ }
+
+ /**
+ * This method sets the state for the supplementary information flags
+ * and the minor status in MessageProp. It is not used by the
+ * application but by the GSS implementation to return this information
+ * to the caller of a per-message context method.
+ *
+ * @param duplicate True if the token was a duplicate of an earlier
+ * token, false otherwise.
+ * @param old True if the token's validity period has expired,
+ * false otherwise.
+ * @param unseq True if a later token has already been processed,
+ * false otherwise.
+ * @param gap True if one or more predecessor tokens have not yet
+ * been successfully processed, false otherwise.
+ * @param minorStatus The integer minor status code that the underlying
+ * mechanism wants to set.
+ * @param minorString The textual representation of the minorStatus
+ * value.
+ */
+ public void setSupplementaryStates(boolean duplicate, boolean old,
+ boolean unseq, boolean gap,
+ int minorStatus, String minorString)
+ {
+ this.duplicate = duplicate;
+ this.old = old;
+ this.unseq = unseq;
+ this.gap = gap;
+ this.minorStatus = minorStatus;
+ this.minorString = minorString;
+ }
+}
diff --git a/org/ietf/jgss/Oid.java b/org/ietf/jgss/Oid.java
new file mode 100644
index 000000000..a7c67a710
--- /dev/null
+++ b/org/ietf/jgss/Oid.java
@@ -0,0 +1,385 @@
+/* Oid.java -- Object identifier class.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+/* The documentation comments of this class are derived from the text
+ of RFC 2853: Generic Security Service API Version 2: Java Bindings.
+ That document is covered under the following license notice:
+
+Copyright (C) The Internet Society (2000). All Rights Reserved.
+
+This document and translations of it may be copied and furnished to
+others, and derivative works that comment on or otherwise explain it
+or assist in its implementation may be prepared, copied, published and
+distributed, in whole or in part, without restriction of any kind,
+provided that the above copyright notice and this paragraph are
+included on all such copies and derivative works. However, this
+document itself may not be modified in any way, such as by removing
+the copyright notice or references to the Internet Society or other
+Internet organizations, except as needed for the purpose of developing
+Internet standards in which case the procedures for copyrights defined
+in the Internet Standards process must be followed, or as required to
+translate it into languages other than English.
+
+The limited permissions granted above are perpetual and will not be
+revoked by the Internet Society or its successors or assigns.
+
+This document and the information contained herein is provided on an
+"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT
+NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN
+WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. */
+
+
+package org.ietf.jgss;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import java.math.BigInteger;
+
+import java.util.Arrays;
+import java.util.StringTokenizer;
+
+/**
+ * <p>This class represents Universal Object Identifiers (Oids) and their
+ * associated operations.</p>
+ *
+ * <p>Oids are hierarchically globally-interpretable identifiers used
+ * within the GSS-API framework to identify mechanisms and name formats.</p>
+ *
+ * <p>The structure and encoding of Oids is defined in ISOIEC-8824 and
+ * ISOIEC-8825. For example the Oid representation of Kerberos V5
+ * mechanism is "1.2.840.113554.1.2.2".</p>
+ *
+ * <p>The {@link GSSName} name class contains <code>public static Oid</code>
+ * objects representing the standard name types defined in GSS-API.</p>
+ */
+public class Oid
+{
+
+ // Constants and fields.
+ // -------------------------------------------------------------------------
+
+ private static final int OBJECT_IDENTIFIER = 0x06;
+ private static final int RELATIVE_OID = 0x0d;
+
+ private final int[] components;
+ private byte[] derOid;
+ private String strOid;
+ private boolean relative;
+
+ // Constructors.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Creates an Oid object from a string representation of its integer
+ * components (e.g. "1.2.840.113554.1.2.2").
+ *
+ * @param strOid The string representation for the oid.
+ * @throws GSSException If the argument is badly formed.
+ */
+ public Oid(String strOid) throws GSSException
+ {
+ if (strOid == null)
+ throw new NullPointerException();
+ this.strOid = strOid;
+ try
+ {
+ StringTokenizer tok = new StringTokenizer(strOid, ".");
+ components = new int[tok.countTokens()];
+ int i = 0;
+ while (tok.hasMoreTokens() && i < components.length)
+ {
+ components[i++] = Integer.parseInt(tok.nextToken());
+ }
+ }
+ catch (Exception x)
+ {
+ throw new GSSException(GSSException.FAILURE);
+ }
+ relative = false;
+ }
+
+ /**
+ * Creates an Oid object from its DER encoding. This refers to the full
+ * encoding including tag and length. The structure and encoding of
+ * Oids is defined in ISOIEC-8824 and ISOIEC-8825. This method is
+ * identical in functionality to its byte array counterpart.
+ *
+ * @param derOid Stream containing the DER encoded oid.
+ * @throws GSSException If the DER stream is badly formed, or if the
+ * input stream throws an exception.
+ */
+ public Oid(InputStream derOid) throws GSSException
+ {
+ DataInputStream in = new DataInputStream(derOid);
+ try
+ {
+ int tag = in.read() & 0x1F;
+ if (tag != OBJECT_IDENTIFIER && tag != RELATIVE_OID)
+ throw new IOException();
+ int len = in.read();
+ if ((len & ~0x7F) != 0)
+ {
+ byte[] buf = new byte[len & 0x7F];
+ in.readFully(buf);
+ len = new BigInteger(1, buf).intValue();
+ }
+ if (len < 0)
+ throw new IOException();
+ byte[] enc = new byte[len];
+ in.readFully(enc);
+ int[] comp = new int[len + 1];
+ int count = 0;
+ int i = 0;
+ relative = tag == RELATIVE_OID;
+ if (!relative && i < len)
+ {
+ int j = (enc[i] & 0xFF);
+ comp[count++] = j / 40;
+ comp[count++] = j % 40;
+ i++;
+ }
+ while (i < len)
+ {
+ int j = 0;
+ do
+ {
+ j = enc[i++] & 0xFF;
+ comp[count] <<= 7;
+ comp[count] |= j & 0x7F;
+ if (i >= len && (j & 0x80) != 0)
+ throw new IOException();
+ }
+ while ((j & 0x80) != 0);
+ count++;
+ }
+ if (count == len)
+ this.components = comp;
+ else
+ {
+ this.components = new int[count];
+ System.arraycopy(comp, 0, components, 0, count);
+ }
+ }
+ catch (IOException ioe)
+ {
+ throw new GSSException(GSSException.FAILURE);
+ }
+ }
+
+ /**
+ * Creates an Oid object from its DER encoding. This refers to the full
+ * encoding including tag and length. The structure and encoding of
+ * Oids is defined in ISOIEC-8824 and ISOIEC-8825. This method is
+ * identical in functionality to its streaming counterpart.
+ *
+ * @param derOid Byte array storing a DER encoded oid.
+ * @throws GSSException If the DER bytes are badly formed.
+ */
+ public Oid(byte[] derOid) throws GSSException
+ {
+ this(new ByteArrayInputStream(derOid));
+ this.derOid = (byte[]) derOid.clone();
+ }
+
+ Oid(int[] components)
+ {
+ this.components = components;
+ relative = false;
+ }
+
+ // Instance methods.
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns a string representation of the oid's integer components in
+ * dot separated notation (e.g. "1.2.840.113554.1.2.2").
+ *
+ * @return The string representation of this oid.
+ */
+ public String toString()
+ {
+ if (strOid == null)
+ {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < components.length; i++)
+ {
+ buf.append(components[i]);
+ if (i < components.length - 1)
+ buf.append('.');
+ }
+ strOid = buf.toString();
+ }
+ return strOid;
+ }
+
+ /**
+ * Returns the full ASN.1 DER encoding for this oid object, which
+ * includes the tag and length.
+ *
+ * @return The ASN.1 DER encoding for this oid.
+ * @throws GSSException If encoding fails.
+ */
+ public byte[] getDER() throws GSSException
+ {
+ if (derOid == null)
+ {
+ ByteArrayOutputStream out = new ByteArrayOutputStream(256);
+ try
+ {
+ int i = 0;
+ if (!relative)
+ {
+ int b = components[i++] * 40 + (components.length > 1
+ ? components[i++] : 0);
+ encodeSubId(out, b);
+ }
+ for ( ; i < components.length; i++)
+ encodeSubId(out, components[i]);
+ byte[] oid = out.toByteArray();
+ out.reset();
+ if (relative)
+ out.write(RELATIVE_OID);
+ else
+ out.write(OBJECT_IDENTIFIER);
+ if (oid.length < 128)
+ out.write(oid.length);
+ else if (oid.length < 256)
+ {
+ out.write(0x81);
+ out.write(oid.length);
+ }
+ else if (oid.length < 65536)
+ {
+ out.write(0x82);
+ out.write((oid.length >>> 8) & 0xFF);
+ out.write(oid.length & 0xFF);
+ }
+ else if (oid.length < 16777216)
+ {
+ out.write(0x83);
+ out.write((oid.length >>> 16) & 0xFF);
+ out.write((oid.length >>> 8) & 0xFF);
+ out.write(oid.length & 0xFF);
+ }
+ else
+ {
+ out.write(0x84);
+ out.write((oid.length >>> 24) & 0xFF);
+ out.write((oid.length >>> 16) & 0xFF);
+ out.write((oid.length >>> 8) & 0xFF);
+ out.write(oid.length & 0xFF);
+ }
+ out.write(oid);
+ }
+ catch (IOException ioe)
+ {
+ throw new GSSException(GSSException.FAILURE);
+ }
+ derOid = out.toByteArray();
+ }
+ return (byte[]) derOid.clone();
+ }
+
+ /**
+ * A utility method to test if an Oid object is contained within the
+ * supplied Oid object array.
+ *
+ * @param oids An array of oids to search.
+ * @return True if this oid is contained in the given array.
+ */
+ public boolean containedIn(Oid[] oids)
+ {
+ for (int i = 0; i < oids.length; i++)
+ {
+ if (equals(oids[i]))
+ return true;
+ }
+ return false;
+ }
+
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof Oid))
+ return false;
+ Oid that = (Oid) o;
+ return Arrays.equals(components, that.components);
+ }
+
+ public int hashCode()
+ {
+ int code = 0;
+ for (int i = 0; i < components.length; i++)
+ code += components[i];
+ return code;
+ }
+
+ // Own methods.
+ // -------------------------------------------------------------------------
+
+ private static void encodeSubId(OutputStream out, int id) throws IOException
+ {
+ if (id < 128)
+ {
+ out.write(id);
+ }
+ else if (id < 16384)
+ {
+ out.write((id >>> 7) | 0x80);
+ out.write(id & 0x7F);
+ }
+ else if (id < 2097152)
+ {
+ out.write((id >>> 14) | 0x80);
+ out.write(((id >>> 7) | 0x80) & 0xFF);
+ out.write(id & 0x7F);
+ }
+ else if (id < 268435456)
+ {
+ out.write( (id >>> 21) | 0x80);
+ out.write(((id >>> 14) | 0x80) & 0xFF);
+ out.write(((id >>> 7) | 0x80) & 0xFF);
+ out.write(id & 0x7F);
+ }
+ }
+}
diff --git a/resource/java/util/Makefile.am b/resource/java/util/Makefile.am
index 8a1742d43..e433cbb81 100644
--- a/resource/java/util/Makefile.am
+++ b/resource/java/util/Makefile.am
@@ -1,5 +1,7 @@
## used by automake to generate Makefile.in
+SUBDIRS = logging
+
EXTRA_DIST = \
iso3166-a3.properties \
iso3166_de.properties \
@@ -10,4 +12,3 @@ iso639_de.properties \
iso639.properties \
iso639_fr.properties \
iso639_ga.properties
-
diff --git a/resource/java/util/logging/Makefile b/resource/java/util/logging/Makefile
new file mode 100644
index 000000000..621cbd5e1
--- /dev/null
+++ b/resource/java/util/logging/Makefile
@@ -0,0 +1,374 @@
+# Makefile.in generated by automake 1.9.4 from Makefile.am.
+# resource/java/util/logging/Makefile. Generated from Makefile.in by configure.
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+
+srcdir = .
+top_srcdir = ../../../..
+
+pkgdatadir = $(datadir)/classpath
+pkglibdir = $(libdir)/classpath
+pkgincludedir = $(includedir)/classpath
+top_builddir = ../../../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = i686-pc-linux-gnu
+host_triplet = i686-pc-linux-gnu
+target_triplet = i686-pc-linux-gnu
+subdir = resource/java/util/logging
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/pkg.m4 $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/include/config.h
+CONFIG_CLEAN_FILES =
+SOURCES =
+DIST_SOURCES =
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = ${SHELL} /home/gandalf/projects/java/classpath/generics/classpath/missing --run aclocal-1.9
+AMDEP_FALSE = #
+AMDEP_TRUE =
+AMTAR = ${SHELL} /home/gandalf/projects/java/classpath/generics/classpath/missing --run tar
+AM_CFLAGS = -ansi -pedantic -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wall -Wno-long-long -D_BSD_SOURCE
+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/native/jni/classpath -I$(top_srcdir)/native/target/Linux -I$(top_srcdir)/native/target/generic
+AR = ar
+AUTOCONF = ${SHELL} /home/gandalf/projects/java/classpath/generics/classpath/missing --run autoconf
+AUTOHEADER = ${SHELL} /home/gandalf/projects/java/classpath/generics/classpath/missing --run autoheader
+AUTOMAKE = ${SHELL} /home/gandalf/projects/java/classpath/generics/classpath/missing --run automake-1.9
+AWK = gawk
+CAIRO_CFLAGS = -I/usr/include/freetype2 -I/usr/X11R6/include -I/usr/include/libpng12
+CAIRO_LIBS = -L/usr/X11R6/lib -lcairo -lm -lfreetype -lz -lfontconfig -lpixman -lXrender -lX11 -lpng12
+CC = gcc
+CCDEPMODE = depmode=gcc3
+CFLAGS = -g -O2
+CLASSPATH_MODULE = -module -version-info 0:0:0
+CP = /bin/cp
+CPP = gcc -E
+CPPFLAGS =
+CREATE_API_DOCS_FALSE =
+CREATE_API_DOCS_TRUE = #
+CREATE_CNI_LIBRARIES_FALSE =
+CREATE_CNI_LIBRARIES_TRUE = #
+CREATE_GTK_PEER_LIBRARIES_FALSE = #
+CREATE_GTK_PEER_LIBRARIES_TRUE =
+CREATE_JNI_HEADERS_FALSE =
+CREATE_JNI_HEADERS_TRUE = #
+CREATE_JNI_LIBRARIES_FALSE = #
+CREATE_JNI_LIBRARIES_TRUE =
+CXX = g++
+CXXCPP = g++ -E
+CXXDEPMODE = depmode=gcc3
+CXXFLAGS = -g -O2
+CYGPATH_W = echo
+DATE = /bin/date
+DEFS = -DHAVE_CONFIG_H
+DEPDIR = .deps
+ECHO = echo
+ECHO_C =
+ECHO_N = -n
+ECHO_T =
+EGREP = grep -E
+EXEEXT =
+F77 =
+FFLAGS =
+FIND = /usr/bin/find
+FOUND_GCJ_FALSE =
+FOUND_GCJ_TRUE = #
+FOUND_JIKES_FALSE = #
+FOUND_JIKES_TRUE =
+FOUND_KJC_FALSE =
+FOUND_KJC_TRUE = #
+GCJ =
+GJDOC =
+GTK_CAIRO_FALSE = #
+GTK_CAIRO_TRUE =
+GTK_CFLAGS = -DXTHREADS -pthread -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libart-2.0
+GTK_LIBS = -Wl,--export-dynamic -pthread -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0 -lart_lgpl_2
+INIT_LOAD_LIBRARY = true
+INSTALL_CLASS_FILES_FALSE =
+INSTALL_CLASS_FILES_TRUE = #
+INSTALL_DATA = ${INSTALL} -m 644
+INSTALL_GLIBJ_ZIP_FALSE = #
+INSTALL_GLIBJ_ZIP_TRUE =
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+JIKES = /usr/bin/jikes
+KJC =
+LDFLAGS =
+LIBDEBUG = false
+LIBOBJS =
+LIBS =
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LIBVERSION = 0:0:0
+LN_S = ln -s
+LTLIBOBJS =
+MAINT = #
+MAINTAINER_MODE_FALSE =
+MAINTAINER_MODE_TRUE = #
+MAKEINFO = ${SHELL} /home/gandalf/projects/java/classpath/generics/classpath/missing --run makeinfo
+MKDIR = /bin/mkdir
+OBJEXT = o
+PACKAGE = classpath
+PACKAGE_BUGREPORT = classpath@gnu.org
+PACKAGE_NAME = GNU Classpath
+PACKAGE_STRING = GNU Classpath 0.11+cvs
+PACKAGE_TARNAME = classpath
+PACKAGE_VERSION = 0.11+cvs
+PANGOFT2_CFLAGS = -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include
+PANGOFT2_LIBS = -Wl,--export-dynamic -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0
+PATH_SEPARATOR = :
+PKG_CONFIG = /usr/bin/pkg-config
+RANLIB = ranlib
+REMOVE =
+SET_MAKE =
+SH = /bin/sh
+SHELL = /bin/sh
+STRIP = strip
+USER_CLASSLIB =
+USER_JAVAH =
+USER_SPECIFIED_CLASSLIB_FALSE =
+USER_SPECIFIED_CLASSLIB_TRUE = #
+USER_SPECIFIED_JAVAH_FALSE =
+USER_SPECIFIED_JAVAH_TRUE = #
+VERSION = 0.11+cvs
+XMLCATALOG =
+XSLTPROC =
+ZIP = /usr/bin/zip
+ac_ct_AR = ar
+ac_ct_CC = gcc
+ac_ct_CXX = g++
+ac_ct_F77 =
+ac_ct_RANLIB = ranlib
+ac_ct_STRIP = strip
+am__fastdepCC_FALSE = #
+am__fastdepCC_TRUE =
+am__fastdepCXX_FALSE = #
+am__fastdepCXX_TRUE =
+am__include = include
+am__leading_dot = .
+am__quote =
+am__tar = tar --format=ustar -chf - "$$tardir"
+am__untar = tar -xf -
+bindir = ${exec_prefix}/bin
+build = i686-pc-linux-gnu
+build_alias =
+build_cpu = i686
+build_os = linux-gnu
+build_vendor = pc
+datadir = ${prefix}/share
+exec_prefix = ${prefix}
+host = i686-pc-linux-gnu
+host_alias =
+host_cpu = i686
+host_os = linux-gnu
+host_vendor = pc
+includedir = ${prefix}/include
+infodir = ${prefix}/info
+install_sh = /home/gandalf/projects/java/classpath/generics/classpath/install-sh
+libdir = ${exec_prefix}/lib
+libexecdir = ${exec_prefix}/libexec
+localstatedir = ${prefix}/var
+mandir = ${prefix}/man
+mkdir_p = mkdir -p --
+oldincludedir = /usr/include
+prefix = /home/gandalf/projects/java/classpath/generics-build
+program_transform_name = s,x,x,
+sbindir = ${exec_prefix}/sbin
+sharedstatedir = ${prefix}/com
+sysconfdir = ${prefix}/etc
+target = i686-pc-linux-gnu
+target_alias =
+target_cpu = x86
+target_os = linux-gnu
+target_vendor = pc
+EXTRA_DIST = \
+logging.properties
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu resource/java/util/logging/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu resource/java/util/logging/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: # $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): # $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-libtool
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ distclean distclean-generic distclean-libtool distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/resource/java/util/logging/Makefile.am b/resource/java/util/logging/Makefile.am
new file mode 100644
index 000000000..cacf80a84
--- /dev/null
+++ b/resource/java/util/logging/Makefile.am
@@ -0,0 +1,4 @@
+## used by automake to generate Makefile.in
+
+EXTRA_DIST = \
+logging.properties
diff --git a/java/util/logging/logging.properties b/resource/java/util/logging/logging.properties
index e7aabf485..e7aabf485 100644
--- a/java/util/logging/logging.properties
+++ b/resource/java/util/logging/logging.properties
diff --git a/resource/org/.cvsignore b/resource/org/.cvsignore
new file mode 100644
index 000000000..282522db0
--- /dev/null
+++ b/resource/org/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/resource/org/Makefile.am b/resource/org/Makefile.am
new file mode 100644
index 000000000..20a49d416
--- /dev/null
+++ b/resource/org/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = ietf
diff --git a/resource/org/ietf/.cvsignore b/resource/org/ietf/.cvsignore
new file mode 100644
index 000000000..282522db0
--- /dev/null
+++ b/resource/org/ietf/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/resource/org/ietf/Makefile.am b/resource/org/ietf/Makefile.am
new file mode 100644
index 000000000..233bb7408
--- /dev/null
+++ b/resource/org/ietf/Makefile.am
@@ -0,0 +1 @@
+SUBDIRS = jgss
diff --git a/resource/org/ietf/jgss/.cvsignore b/resource/org/ietf/jgss/.cvsignore
new file mode 100644
index 000000000..282522db0
--- /dev/null
+++ b/resource/org/ietf/jgss/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/resource/org/ietf/jgss/Makefile.am b/resource/org/ietf/jgss/Makefile.am
new file mode 100644
index 000000000..3590cc8e0
--- /dev/null
+++ b/resource/org/ietf/jgss/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = MessagesBundle.properties
diff --git a/resource/org/ietf/jgss/MessagesBundle.properties b/resource/org/ietf/jgss/MessagesBundle.properties
new file mode 100644
index 000000000..af8247cbf
--- /dev/null
+++ b/resource/org/ietf/jgss/MessagesBundle.properties
@@ -0,0 +1,60 @@
+# MessagesBundle.properties -- English GSS messages.
+# Copyright (C) 2004 Free Software Foundation, Inc.
+#
+# This file is a part of GNU Classpath.
+#
+# GNU Classpath is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# GNU Classpath is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Classpath; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA
+#
+# Linking this library statically or dynamically with other modules is
+# making a combined work based on this library. Thus, the terms and
+# conditions of the GNU General Public License cover the whole
+# combination.
+#
+# As a special exception, the copyright holders of this library give
+# you permission to link this library with independent modules to
+# produce an executable, regardless of the license terms of these
+# independent modules, and to copy and distribute the resulting
+# executable under terms of your choice, provided that you also meet,
+# for each linked independent module, the terms and conditions of the
+# license of that module. An independent module is a module which is
+# not derived from or based on this library. If you modify this
+# library, you may extend this exception to your version of the
+# library, but you are not obligated to do so. If you do not wish to
+# do so, delete this exception statement from your version.
+
+GSSException.BAD_MECH=An unsupported mechanism was requested.
+GSSException.BAD_NAME=An invalid name was supplied.
+GSSException.BAD_NAMETYPE=A supplied name was of an unsupported type.
+GSSException.BAD_BINDINGS=Incorrect channel bindings were supplied.
+GSSException.BAD_STATUS=An invalid status code was supplied.
+GSSException.BAD_MIC=A token had an invalid MIC.
+GSSException.NO_CRED=No credentials were supplied, or the credentials were unavailable or inaccessible.
+GSSException.NO_CONTEXT=Invalid context has been supplied.
+GSSException.DEFECTIVE_TOKEN=A supplied token was invalid.
+GSSException.DEFECTIVE_CREDENTIAL=A supplied credential was invalid.
+GSSException.CREDENTIALS_EXPIRED=The referenced credentials have expired.
+GSSException.CONTEXT_EXPIRED=The context has expired.
+GSSException.FAILURE=Miscellaneous failure.
+GSSException.BAD_QOP=The quality-of-protection requested could not be provided.
+GSSException.UNAUTHORIZED=The operation is forbidden by local security policy.
+GSSException.UNAVAILABLE=The operation or option is unavailable.
+GSSException.DUPLICATE_ELEMENT=The requested credential element already exists.
+GSSException.NAME_NOT_MN=The provided name was not a mechanism name.
+GSSException.OLD_TOKEN=The token\'s validity period has expired.
+GSSException.DUPLICATE_TOKEN=The token was a duplicate of an earlier version.
+GSSException.UNSEQ_TOKEN=A later token has already been processed.
+GSSException.GAP_TOKEN=An expected per-message token was not received.
+
diff --git a/scripts/checkstyle-config.xml b/scripts/checkstyle-config.xml
new file mode 100644
index 000000000..0b0c1f419
--- /dev/null
+++ b/scripts/checkstyle-config.xml
@@ -0,0 +1,132 @@
+<?xml version="1.0"?>
+<!DOCTYPE module PUBLIC
+ "-//Puppy Crawl//DTD Check Configuration 1.2//EN"
+ "http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
+<!--
+
+Changes to this file need to be discussed on classpath@gnu.org
+mailing list first and probably documented in the hacking guide.
+
+-->
+<module name="Checker">
+ <module name="PackageHtml"/>
+
+ <module name="TreeWalker">
+ <property name="tabWidth" value="8"/>
+
+ <!-- Javadoc related checks -->
+ <!--
+ <module name="JavadocType">
+ <property name="scope" value="protected"/>
+ </module>
+ <module name="JavadocMethod">
+ <property name="scope" value="protected"/>
+ <property name="allowUndeclaredRTE" value="true"/>
+ </module>
+ <module name="JavadocVariable">
+ <property name="scope" value="protected"/>
+ </module>
+ <module name="JavadocStyle">
+ <property name="checkFirstSentence" value="false"/>
+ <property name="checkHtml" value="true"/>
+ </module>
+ -->
+
+ <!-- File header checks -->
+ <module name="RegexpHeader">
+ <property name="headerFile" value="scripts/checkstyle-header.regex"/>
+ <property name="multiLines" value="2, 3, 38"/>
+ </module>
+
+ <!-- import checks -->
+ <module name="AvoidStarImport"/>
+ <module name="RedundantImport"/>
+ <module name="UnusedImports"/>
+ <module name="ImportOrder">
+ <property name="groups" value="gnu,java,javax,org"/>
+ <property name="ordered" value="true"/>
+ <property name="separated" value="true"/>
+ </module>
+
+ <!-- size checks -->
+ <!--
+ <module name="LineLength">
+ <property name="max" value="80"/>
+ </module>
+ -->
+
+ <!-- modifier checks -->
+ <!--
+ <module name="ModifierOrder"/>
+ <module name="RedundantModifier"/>
+ -->
+
+ <!-- block checks -->
+ <!--
+ <module name="EmptyBlock">
+ <property name="option" value="text"/>
+ </module>
+ <module name="LeftCurly">
+ <property name="option" value="nl"/>
+ </module>
+ <module name="RightCurly">
+ <property name="option" value="alone"/>
+ </module>
+ <module name="AvoidNestedBlocks"/>
+ -->
+
+ <!-- coding problem checks -->
+ <!--
+ <module name="ArrayTrailingComma"/>
+ <module name="CovariantEquals"/>
+ <module name="DoubleCheckedLocking"/>
+ <module name="EmptyStatement"/>
+ <module name="EqualsHashCode"/>
+ <module name="HiddenField"/>
+ <module name="IllegalInstantiation">
+ <property name="classes" value="java.lang.Boolean"/>
+ </module>
+ <module name="InnerAssignment"/>
+ <module name="MagicNumber"/>
+ <module name="RedundantThrows"/>
+ <module name="SimplifyBooleanExpression"/>
+ <module name="SimplifyBooleanReturn"/>
+ <module name="NestedIfDepth"/>
+ <module name="NestedTryDepth"/>
+ <module name="SuperClone"/>
+ <module name="SuperFinalize"/>
+ <module name="IllegalCatch"/>
+ -->
+ <module name="PackageDeclaration"/>
+ <!--
+ <module name="DeclarationOrder"/>
+ <module name="DefaultComesLast"/>
+ <module name="UnnecessaryParentheses"/>
+ -->
+
+ <!-- design problem checks -->
+ <!--
+ <module name="FinalClass"/>
+ <module name="HideUtilityClassConstructor"/>
+ -->
+
+ <!-- miscellaneous checks -->
+ <!--
+ <module name="TodoComment"/>
+ <module name="UpperEll"/>
+ <module name="ArrayTypeStyle"/>
+ <module name="Indentation">
+ <property name="basicOffset" value="2"/>
+ <property name="braceAdjustment" value="2"/>
+ <property name="caseIndent" value="0"/>
+ </module>
+ -->
+ </module>
+ <!--
+ <module name="StrictDuplicateCode"/>
+ -->
+
+ <module name="SuppressionFilter">
+ <property name="file" value="scripts/checkstyle-suppressions.xml"/>
+ </module>
+</module>
diff --git a/scripts/checkstyle-header.regex b/scripts/checkstyle-header.regex
new file mode 100644
index 000000000..2a08ba371
--- /dev/null
+++ b/scripts/checkstyle-header.regex
@@ -0,0 +1,38 @@
+^/\* .*$
+^ .*$
+^ (Copyright \(C\) .*|Free Software Foundation, Inc.)$
+^$
+^This file is part of GNU Classpath.$
+^$
+^GNU Classpath is free software; you can redistribute it and/or modify$
+^it under the terms of the GNU General Public License as published by$
+^the Free Software Foundation; either version 2, or \(at your option\)$
+^any later version.$
+^ *$
+^GNU Classpath is distributed in the hope that it will be useful, but$
+^WITHOUT ANY WARRANTY; without even the implied warranty of$
+^MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU$
+^General Public License for more details.$
+^$
+^You should have received a copy of the GNU General Public License$
+^along with GNU Classpath; see the file COPYING. If not, write to the$
+^Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA$
+^02111-1307 USA.$
+^$
+^Linking this library statically or dynamically with other modules is$
+^making a combined work based on this library. Thus, the terms and$
+^conditions of the GNU General Public License cover the whole$
+^combination.$
+^$
+^As a special exception, the copyright holders of this library give you$
+^permission to link this library with independent modules to produce an$
+^executable, regardless of the license terms of these independent$
+^modules, and to copy and distribute the resulting executable under$
+^terms of your choice, provided that you also meet, for each linked$
+^independent module, the terms and conditions of the license of that$
+^module. An independent module is a module which is not derived from$
+^or based on this library. If you modify this library, you may extend$
+^this exception to your version of the library, but you are not$
+^obligated to do so. If you do not wish to do so, delete this$
+^exception statement from your version. \*/$
+^ *$
diff --git a/scripts/checkstyle-suppressions.xml b/scripts/checkstyle-suppressions.xml
new file mode 100644
index 000000000..7a73aa810
--- /dev/null
+++ b/scripts/checkstyle-suppressions.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!DOCTYPE suppressions PUBLIC
+ "-//Puppy Crawl//DTD Suppressions 1.0//EN"
+ "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
+<!--
+
+Changes to this file need to be discussed on classpath@gnu.org
+mailing list first and probably documented in the hacking guide.
+
+-->
+<suppressions>
+ <suppress checks="RegexpHeader"
+ files="javax/rmi/CORBA/SystemException.java"
+ lines="1"/>
+ <suppress checks="RegexpHeader"
+ files="javax/rmi/CORBA/ObjectImpl.java"
+ lines="1"/>
+ <suppress checks="RegexpHeader"
+ files="javax/rmi/ORB.java"
+ lines="1"/>
+ <suppress checks="RegexpHeader"
+ files="javax/rmi/BAD_OPERATION.java"
+ lines="1"/>
+</suppressions>
+
diff --git a/scripts/jalopy-gnu.xml b/scripts/jalopy-gnu.xml
new file mode 100644
index 000000000..ad5c5abdf
--- /dev/null
+++ b/scripts/jalopy-gnu.xml
@@ -0,0 +1,378 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jalopy>
+ <general>
+ <compliance>
+ <version>14</version>
+ </compliance>
+ <style>
+ <description>GNU Java Coding Convention</description>
+ <name>GNU</name>
+ </style>
+ </general>
+ <inspector>
+ <enable>false</enable>
+ <naming>
+ <classes>
+ <abstract>[A-Z][a-zA-Z0-9]+</abstract>
+ <general>[A-Z][a-zA-Z0-9]+</general>
+ </classes>
+ <fields>
+ <default>[a-z][\w]+</default>
+ <defaultStatic>[a-z][\w]+</defaultStatic>
+ <defaultStaticFinal>[a-zA-Z][\w]+</defaultStaticFinal>
+ <private>[a-z][\w]+</private>
+ <privateStatic>[a-z][\w]+</privateStatic>
+ <privateStaticFinal>[a-zA-Z][\w]+</privateStaticFinal>
+ <protected>[a-z][\w]+</protected>
+ <protectedStatic>[a-z][\w]+</protectedStatic>
+ <protectedStaticFinal>[a-zA-Z][\w]+</protectedStaticFinal>
+ <public>[a-z][\w]+</public>
+ <publicStatic>[a-z][\w]+</publicStatic>
+ <publicStaticFinal>[a-zA-Z][\w]+</publicStaticFinal>
+ </fields>
+ <interfaces>[A-Z][a-zA-Z0-9]+</interfaces>
+ <labels>\w+</labels>
+ <methods>
+ <default>[a-z][\w]+</default>
+ <defaultStatic>[a-z][\w]+</defaultStatic>
+ <defaultStaticFinal>[a-z][\w]+</defaultStaticFinal>
+ <private>[a-z][\w]+</private>
+ <privateStatic>[a-z][\w]+</privateStatic>
+ <privateStaticFinal>[a-z][\w]+</privateStaticFinal>
+ <protected>[a-z][\w]+</protected>
+ <protectedStatic>[a-z][\w]+</protectedStatic>
+ <protectedStaticFinal>[a-z][\w]+</protectedStaticFinal>
+ <public>[a-z][\w]+</public>
+ <publicStatic>[a-z][\w]+</publicStatic>
+ <publicStaticFinal>[a-z][\w]+</publicStaticFinal>
+ </methods>
+ <packages>[a-z]+(?:\.[a-z]+)*</packages>
+ <parameters>
+ <default>[a-z][\w]+</default>
+ <final>[a-z][\w]+</final>
+ </parameters>
+ <variables>[a-z][\w]*</variables>
+ </naming>
+ <tips>
+ <adhereToNamingConvention>false</adhereToNamingConvention>
+ <alwaysOverrideEquals>false</alwaysOverrideEquals>
+ <alwaysOverrideHashCode>false</alwaysOverrideHashCode>
+ <avoidThreadGroups>false</avoidThreadGroups>
+ <declareCollectionComment>false</declareCollectionComment>
+ <dontIgnoreExceptions>false</dontIgnoreExceptions>
+ <dontSubstituteObjectEquals>false</dontSubstituteObjectEquals>
+ <neverDeclareException>false</neverDeclareException>
+ <neverDeclareThrowable>false</neverDeclareThrowable>
+ <neverInvokeWaitOutsideLoop>false</neverInvokeWaitOutsideLoop>
+ <neverReturnZeroArrays>false</neverReturnZeroArrays>
+ <neverUseEmptyFinally>false</neverUseEmptyFinally>
+ <obeyContractEquals>false</obeyContractEquals>
+ <overrideToString>false</overrideToString>
+ <referToObjectsByInterface>false</referToObjectsByInterface>
+ <replaceStructureWithClass>false</replaceStructureWithClass>
+ <stringLiterallI18n>false</stringLiterallI18n>
+ <useInterfaceOnlyForTypes>false</useInterfaceOnlyForTypes>
+ <wrongCollectionComment>false</wrongCollectionComment>
+ </tips>
+ </inspector>
+ <internal>
+ <version>6</version>
+ </internal>
+ <messages>
+ <priority>
+ <general>30000</general>
+ <parser>30000</parser>
+ <parserJavadoc>30000</parserJavadoc>
+ <printer>30000</printer>
+ <printerJavadoc>30000</printerJavadoc>
+ <transform>30000</transform>
+ </priority>
+ <showErrorStackTrace>true</showErrorStackTrace>
+ </messages>
+ <misc>
+ <threadCount>1</threadCount>
+ </misc>
+ <printer>
+ <alignment>
+ <methodCallChain>true</methodCallChain>
+ <parameterMethodDeclaration>false</parameterMethodDeclaration>
+ <ternaryOperator>true</ternaryOperator>
+ <variableAssignment>false</variableAssignment>
+ <variableIdentifier>false</variableIdentifier>
+ </alignment>
+ <backup>
+ <directory>bak</directory>
+ <level>0</level>
+ </backup>
+ <blanklines>
+ <after>
+ <block>0</block>
+ <braceLeft>0</braceLeft>
+ <class>1</class>
+ <declaration>0</declaration>
+ <footer>1</footer>
+ <header>1</header>
+ <interface>1</interface>
+ <lastImport>1</lastImport>
+ <method>1</method>
+ <package>1</package>
+ </after>
+ <before>
+ <block>0</block>
+ <braceRight>0</braceRight>
+ <caseBlock>0</caseBlock>
+ <comment>
+ <javadoc>1</javadoc>
+ <multiline>0</multiline>
+ <singleline>0</singleline>
+ </comment>
+ <controlStatement>0</controlStatement>
+ <declaration>0</declaration>
+ <footer>0</footer>
+ <header>0</header>
+ <package>2</package>
+ </before>
+ <keepUpTo>1</keepUpTo>
+ </blanklines>
+ <braces>
+ <empty>
+ <cuddle>false</cuddle>
+ <insertStatement>false</insertStatement>
+ </empty>
+ <insert>
+ <dowhile>false</dowhile>
+ <for>false</for>
+ <ifelse>false</ifelse>
+ <while>false</while>
+ </insert>
+ <remove>
+ <block>true</block>
+ <dowhile>true</dowhile>
+ <for>true</for>
+ <ifelse>true</ifelse>
+ <while>true</while>
+ </remove>
+ <treatDifferent>
+ <methodClass>true</methodClass>
+ <methodClassIfWrapped>false</methodClassIfWrapped>
+ </treatDifferent>
+ </braces>
+ <chunks>
+ <blanklines>true</blanklines>
+ <comments>true</comments>
+ </chunks>
+ <comments>
+ <format>
+ <multiline>false</multiline>
+ </format>
+ <javadoc>
+ <check>
+ <innerclass>false</innerclass>
+ <tags>false</tags>
+ <throwsTags>false</throwsTags>
+ </check>
+ <fieldsShort>false</fieldsShort>
+ <generate>
+ <class>0</class>
+ <constructor>0</constructor>
+ <field>0</field>
+ <method>0</method>
+ </generate>
+ <parseComments>false</parseComments>
+ <tags>
+ <in-line />
+ <standard />
+ </tags>
+ <templates>
+ <method>
+ <bottom> */</bottom>
+ <exception> * @throws $exceptionType$ DOCUMENT ME!</exception>
+ <param> * @param $paramType$ DOCUMENT ME!</param>
+ <return> * @return DOCUMENT ME!</return>
+ <top>/**| * DOCUMENT ME!</top>
+ </method>
+ </templates>
+ </javadoc>
+ <remove>
+ <javadoc>false</javadoc>
+ <multiline>false</multiline>
+ <singleline>false</singleline>
+ </remove>
+ <separator>
+ <fillCharacter>-</fillCharacter>
+ <insert>false</insert>
+ <insertRecursive>false</insertRecursive>
+ <text>
+ <class>Inner Classes</class>
+ <constructor>Constructors</constructor>
+ <field>Instance fields</field>
+ <initializer>Instance initializers</initializer>
+ <interface>Inner Interfaces</interface>
+ <method>Methods</method>
+ <static>Static fields/initializers</static>
+ </text>
+ </separator>
+ </comments>
+ <environment />
+ <footer>
+ <keys />
+ <smartMode>0</smartMode>
+ <use>false</use>
+ </footer>
+ <header>
+ <keys />
+ <smartMode>0</smartMode>
+ <use>false</use>
+ </header>
+ <history>
+ <policy>disabled</policy>
+ </history>
+ <imports>
+ <grouping>
+ <defaultDepth>1</defaultDepth>
+ <packages>*:0|gnu:1|java:1|javax:1|org:1</packages>
+ </grouping>
+ <policy>disabled</policy>
+ <sort>true</sort>
+ </imports>
+ <indentation>
+ <caseFromSwitch>true</caseFromSwitch>
+ <continuation>
+ <block>true</block>
+ <operator>true</operator>
+ </continuation>
+ <firstColumnComments>false</firstColumnComments>
+ <label>true</label>
+ <policy>
+ <deep>true</deep>
+ </policy>
+ <sizes>
+ <braceCuddled>1</braceCuddled>
+ <braceLeft>2</braceLeft>
+ <braceRight>2</braceRight>
+ <braceRightAfter>0</braceRightAfter>
+ <continuation>0</continuation>
+ <deep>55</deep>
+ <extends>-1</extends>
+ <general>2</general>
+ <implements>-1</implements>
+ <leading>0</leading>
+ <tabs>8</tabs>
+ <throws>2</throws>
+ <trailingComment>1</trailingComment>
+ </sizes>
+ <tabs>
+ <enable>true</enable>
+ <onlyLeading>true</onlyLeading>
+ </tabs>
+ </indentation>
+ <misc>
+ <arrayBracketsAfterIdent>false</arrayBracketsAfterIdent>
+ <forceFormatting>false</forceFormatting>
+ <insertExpressionParentheses>false</insertExpressionParentheses>
+ <insertLoggingConditional>false</insertLoggingConditional>
+ <insertTrailingNewline>true</insertTrailingNewline>
+ <insertUID>false</insertUID>
+ </misc>
+ <sorting>
+ <declaration>
+ <class>false</class>
+ <constructor>false</constructor>
+ <enable>false</enable>
+ <interface>false</interface>
+ <method>false</method>
+ <order>static|field|initializer|constructor|method|interface|class</order>
+ <variable>false</variable>
+ </declaration>
+ <modifier>
+ <enable>true</enable>
+ <order>public|protected|private|abstract|static|final|synchronized|transient|volatile|native|strictfp</order>
+ </modifier>
+ </sorting>
+ <whitespace>
+ <after>
+ <comma>true</comma>
+ <semicolon>true</semicolon>
+ <typeCast>true</typeCast>
+ </after>
+ <before>
+ <braces>true</braces>
+ <brackets>false</brackets>
+ <bracketsTypes>false</bracketsTypes>
+ <caseColon>false</caseColon>
+ <operator>
+ <not>true</not>
+ </operator>
+ <parentheses>
+ <methodCall>false</methodCall>
+ <methodDeclaration>false</methodDeclaration>
+ <statement>true</statement>
+ </parentheses>
+ </before>
+ <padding>
+ <braces>true</braces>
+ <brackets>false</brackets>
+ <operator>
+ <assignment>true</assignment>
+ <bitwise>true</bitwise>
+ <logical>true</logical>
+ <mathematical>true</mathematical>
+ <relational>true</relational>
+ <shift>true</shift>
+ </operator>
+ <parenthesis>false</parenthesis>
+ <typeCast>false</typeCast>
+ </padding>
+ </whitespace>
+ <wrapping>
+ <always>
+ <after>
+ <arrayElement>0</arrayElement>
+ <braceRight>true</braceRight>
+ <extendsTypes>false</extendsTypes>
+ <implementsTypes>false</implementsTypes>
+ <label>true</label>
+ <methodCallChained>false</methodCallChained>
+ <ternaryOperator>
+ <first>false</first>
+ <second>false</second>
+ </ternaryOperator>
+ <throwsTypes>false</throwsTypes>
+ </after>
+ <before>
+ <braceLeft>true</braceLeft>
+ <extends>false</extends>
+ <implements>false</implements>
+ <throws>false</throws>
+ </before>
+ <parameter>
+ <methodCall>false</methodCall>
+ <methodCallNested>false</methodCallNested>
+ <methodDeclaration>false</methodDeclaration>
+ </parameter>
+ </always>
+ <general>
+ <beforeOperator>true</beforeOperator>
+ <enable>true</enable>
+ <lineLength>79</lineLength>
+ </general>
+ <ondemand>
+ <after>
+ <assignment>false</assignment>
+ <leftParenthesis>false</leftParenthesis>
+ <parameter>false</parameter>
+ <types>
+ <extends>false</extends>
+ <implements>false</implements>
+ <throws>false</throws>
+ </types>
+ </after>
+ <before>
+ <rightParenthesis>false</rightParenthesis>
+ </before>
+ <groupingParentheses>false</groupingParentheses>
+ </ondemand>
+ </wrapping>
+ </printer>
+</jalopy>
+
diff --git a/vm/reference/java/io/VMFile.java b/vm/reference/java/io/VMFile.java
index 21e71f9e2..63d9a4f5f 100644
--- a/vm/reference/java/io/VMFile.java
+++ b/vm/reference/java/io/VMFile.java
@@ -47,18 +47,18 @@ import gnu.java.io.PlatformHelper;
*/
final class VMFile
{
- static boolean caseSensitive;
+ static boolean caseSensitive;
- static
- {
- if (Configuration.INIT_LOAD_LIBRARY)
- {
- System.loadLibrary("javaio");
- }
-
- // FIXME: We support only caseSensitive filesystems currently.
- caseSensitive = true;
- }
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javaio");
+ }
+
+ // FIXME: We support only caseSensitive filesystems currently.
+ caseSensitive = true;
+ }
/*
* This native method does the actual work of getting the last file
diff --git a/vm/reference/java/lang/VMCompiler.java b/vm/reference/java/lang/VMCompiler.java
new file mode 100644
index 000000000..64ae650ec
--- /dev/null
+++ b/vm/reference/java/lang/VMCompiler.java
@@ -0,0 +1,112 @@
+/* VMClassLoader.java -- Reference implementation of compiler interface
+ Copyright (C) 2004 Free Software Foundation
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package java.lang;
+
+/**
+ * This class is just a per-VM reflection of java.lang.Compiler.
+ * All methods are defined identically.
+ */
+final class VMCompiler
+{
+ /**
+ * Don't allow new `Compiler's to be made.
+ */
+ private VMCompiler()
+ {
+ }
+
+ /**
+ * Compile the class named by <code>oneClass</code>.
+ *
+ * @param oneClass the class to compile
+ * @return <code>false</code> if no compiler is available or
+ * compilation failed, <code>true</code> if compilation succeeded
+ * @throws NullPointerException if oneClass is null
+ */
+ public static boolean compileClass(Class oneClass)
+ {
+ // Never succeed.
+ return false;
+ }
+
+ /**
+ * Compile the classes whose name matches <code>classNames</code>.
+ *
+ * @param classNames the name of classes to compile
+ * @return <code>false</code> if no compiler is available or
+ * compilation failed, <code>true</code> if compilation succeeded
+ * @throws NullPointerException if classNames is null
+ */
+ public static boolean compileClasses(String classNames)
+ {
+ // Note the incredibly lame interface. Always fail.
+ return false;
+ }
+
+ /**
+ * This method examines the argument and performs an operation
+ * according to the compilers documentation. No specific operation
+ * is required.
+ *
+ * @param arg a compiler-specific argument
+ * @return a compiler-specific value, including null
+ * @throws NullPointerException if the compiler doesn't like a null arg
+ */
+ public static Object command(Object arg)
+ {
+ // Our implementation defines this to a no-op.
+ return null;
+ }
+
+ /**
+ * Calling <code>Compiler.enable()</code> will cause the compiler
+ * to resume operation if it was previously disabled; provided that a
+ * compiler even exists.
+ */
+ public static void enable()
+ {
+ }
+
+ /**
+ * Calling <code>Compiler.disable()</code> will cause the compiler
+ * to be suspended; provided that a compiler even exists.
+ */
+ public static void disable()
+ {
+ }
+}
diff --git a/vm/reference/java/lang/VMProcess.java b/vm/reference/java/lang/VMProcess.java
index e4c23ee09..51dc0ee84 100644
--- a/vm/reference/java/lang/VMProcess.java
+++ b/vm/reference/java/lang/VMProcess.java
@@ -111,6 +111,14 @@ final class VMProcess extends Process
// Only used in run() and spawn() method from this Thread, so no locking.
private final HashMap activeMap = new HashMap();
+ // We have an explicit constructor, because the default
+ // constructor will be private, which means the compiler will have
+ // to generate a second package-private constructor, which is
+ // bogus.
+ public ProcessThread ()
+ {
+ }
+
public void run()
{
final LinkedList workList = VMProcess.workList;
diff --git a/vm/reference/java/util/VMTimeZone.java b/vm/reference/java/util/VMTimeZone.java
new file mode 100644
index 000000000..77c055b2a
--- /dev/null
+++ b/vm/reference/java/util/VMTimeZone.java
@@ -0,0 +1,345 @@
+/* java.util.VMTimeZone
+ Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+ Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package java.util;
+
+import gnu.classpath.Configuration;
+
+import java.io.*;
+
+/**
+ *
+ */
+final class VMTimeZone
+{
+ static
+ {
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary("javautil");
+ }
+ }
+
+ /**
+ * This method returns a time zone id string which is in the form
+ * (standard zone name) or (standard zone name)(GMT offset) or
+ * (standard zone name)(GMT offset)(daylight time zone name). The
+ * GMT offset can be in seconds, or where it is evenly divisible by
+ * 3600, then it can be in hours. The offset must be the time to
+ * add to the local time to get GMT. If a offset is given and the
+ * time zone observes daylight saving then the (daylight time zone
+ * name) must also be given (otherwise it is assumed the time zone
+ * does not observe any daylight savings).
+ * <p>
+ * The result of this method is given to the method
+ * TimeZone.getDefaultTimeZone(String) which tries to map the time
+ * zone id to a known TimeZone. See that method on how the returned
+ * String is mapped to a real TimeZone object.
+ * <p>
+ * The reference implementation which is made for GNU/Posix like
+ * systems calls <code>System.getenv("TZ")</code>,
+ * <code>readTimeZoneFile("/etc/timezone")</code>,
+ * <code>readtzFile("/etc/localtime")</code> and finally
+ * <code>getSystemTimeZoneId()</code> till a supported TimeZone is
+ * found through <code>TimeZone.getDefaultTimeZone(String)</code>.
+ * If every method fails <code>null</code> is returned (which means
+ * the TimeZone code will fall back on GMT as default time zone).
+ * <p>
+ * Note that this method is called inside a
+ * <code>AccessController.doPrivileged()</code> block and runs with
+ * the priviliges of the java.util system classes. It will only be
+ * called when the default time zone is not yet set, the system
+ * property user.timezone isn't set and it is requested for the
+ * first time.
+ */
+ static TimeZone getDefaultTimeZoneId()
+ {
+ TimeZone zone = null;
+
+ // See if TZ environment variable is set and accessible.
+ String tzid = System.getenv("TZ");
+ if (tzid != null && !tzid.equals(""))
+ zone = TimeZone.getDefaultTimeZone(tzid);
+
+ // Try to parse /etc/timezone.
+ if (zone == null)
+ {
+ tzid = readTimeZoneFile("/etc/timezone");
+ if (tzid != null && !tzid.equals(""))
+ zone = TimeZone.getDefaultTimeZone(tzid);
+ }
+
+ // Try to parse /etc/localtime
+ if (zone == null)
+ {
+ tzid = readtzFile("/etc/localtime");
+ if (tzid != null && !tzid.equals(""))
+ zone = TimeZone.getDefaultTimeZone(tzid);
+ }
+
+ // Try some system specific way
+ if (zone == null)
+ {
+ tzid = getSystemTimeZoneId();
+ if (tzid != null && !tzid.equals(""))
+ zone = TimeZone.getDefaultTimeZone(tzid);
+ }
+
+ return zone;
+ }
+
+ /**
+ * Tries to read the time zone name from a file. Only the first
+ * consecutive letters, digits, slashes, dashes and underscores are
+ * read from the file. If the file cannot be read or an IOException
+ * occurs null is returned.
+ * <p>
+ * The /etc/timezone file is not standard, but a lot of systems have
+ * it. If it exist the first line always contains a string
+ * describing the timezone of the host of domain. Some systems
+ * contain a /etc/TIMEZONE file which is used to set the TZ
+ * environment variable (which is checked before /etc/timezone is
+ * read).
+ */
+ private static String readTimeZoneFile(String file)
+ {
+ File f = new File(file);
+ if (!f.exists())
+ return null;
+
+ InputStreamReader isr = null;
+ try
+ {
+ FileInputStream fis = new FileInputStream(f);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ isr = new InputStreamReader(bis);
+
+ StringBuffer sb = new StringBuffer();
+ int i = isr.read();
+ while (i != -1)
+ {
+ char c = (char) i;
+ if (Character.isLetter(c) || Character.isDigit(c)
+ || c == '/' || c == '-' || c == '_')
+ {
+ sb.append(c);
+ i = isr.read();
+ }
+ else
+ break;
+ }
+ return sb.toString();
+ }
+ catch (IOException ioe)
+ {
+ // Parse error, not a proper tzfile.
+ return null;
+ }
+ finally
+ {
+ try
+ {
+ if (isr != null)
+ isr.close();
+ }
+ catch (IOException ioe)
+ {
+ // Error while close, nothing we can do.
+ }
+ }
+ }
+
+ /**
+ * Tries to read a file as a "standard" tzfile and return a time
+ * zone id string as expected by <code>getDefaultTimeZone(String)</code>.
+ * If the file doesn't exist, an IOException occurs or it isn't a tzfile
+ * that can be parsed null is returned.
+ * <p>
+ * The tzfile structure (as also used by glibc) is described in the Olson
+ * tz database archive as can be found at
+ * <code>ftp://elsie.nci.nih.gov/pub/</code>.
+ * <p>
+ * At least the following platforms support the tzdata file format
+ * and /etc/localtime (GNU/Linux, Darwin, Solaris and FreeBSD at
+ * least). Some systems (like Darwin) don't start the file with the
+ * required magic bytes 'TZif', this implementation can handle
+ * that).
+ */
+ private static String readtzFile(String file)
+ {
+ File f = new File(file);
+ if (!f.exists())
+ return null;
+
+ DataInputStream dis = null;
+ try
+ {
+ FileInputStream fis = new FileInputStream(f);
+ BufferedInputStream bis = new BufferedInputStream(fis);
+ dis = new DataInputStream(bis);
+
+ // Make sure we are reading a tzfile.
+ byte[] tzif = new byte[4];
+ dis.readFully(tzif);
+ if (tzif[0] == 'T' && tzif[1] == 'Z'
+ && tzif[2] == 'i' && tzif[3] == 'f')
+ // Reserved bytes, ttisgmtcnt, ttisstdcnt and leapcnt
+ skipFully(dis, 16 + 3 * 4);
+ else
+ // Darwin has tzdata files that don't start with the TZif marker
+ skipFully(dis, 16 + 3 * 4 - 4);
+
+ int timecnt = dis.readInt();
+ int typecnt = dis.readInt();
+ if (typecnt > 0)
+ {
+ int charcnt = dis.readInt();
+ // Transition times plus indexed transition times.
+ skipFully(dis, timecnt * (4 + 1));
+
+ // Get last gmt_offset and dst/non-dst time zone names.
+ int abbrind = -1;
+ int dst_abbrind = -1;
+ int gmt_offset = 0;
+ while (typecnt-- > 0)
+ {
+ // gmtoff
+ int offset = dis.readInt();
+ int dst = dis.readByte();
+ if (dst == 0)
+ {
+ abbrind = dis.readByte();
+ gmt_offset = offset;
+ }
+ else
+ dst_abbrind = dis.readByte();
+ }
+
+ // gmt_offset is the offset you must add to UTC/GMT to
+ // get the local time, we need the offset to add to
+ // the local time to get UTC/GMT.
+ gmt_offset *= -1;
+
+ // Turn into hours if possible.
+ if (gmt_offset % 3600 == 0)
+ gmt_offset /= 3600;
+
+ if (abbrind >= 0)
+ {
+ byte[] names = new byte[charcnt];
+ dis.readFully(names);
+ int j = abbrind;
+ while (j < charcnt && names[j] != 0)
+ j++;
+
+ String zonename = new String(names, abbrind, j - abbrind,
+ "ASCII");
+
+ String dst_zonename;
+ if (dst_abbrind >= 0)
+ {
+ j = dst_abbrind;
+ while (j < charcnt && names[j] != 0)
+ j++;
+ dst_zonename = new String(names, dst_abbrind,
+ j - dst_abbrind, "ASCII");
+ }
+ else
+ dst_zonename = "";
+
+ // Only use gmt offset when necessary.
+ // Also special case GMT+/- timezones.
+ String offset_string;
+ if ("".equals(dst_zonename)
+ && (gmt_offset == 0
+ || zonename.startsWith("GMT+")
+ || zonename.startsWith("GMT-")))
+ offset_string = "";
+ else
+ offset_string = Integer.toString(gmt_offset);
+
+ String id = zonename + offset_string + dst_zonename;
+
+ return id;
+ }
+ }
+
+ // Something didn't match while reading the file.
+ return null;
+ }
+ catch (IOException ioe)
+ {
+ // Parse error, not a proper tzfile.
+ return null;
+ }
+ finally
+ {
+ try
+ {
+ if (dis != null)
+ dis.close();
+ }
+ catch(IOException ioe)
+ {
+ // Error while close, nothing we can do.
+ }
+ }
+ }
+
+ /**
+ * Skips the requested number of bytes in the given InputStream.
+ * Throws EOFException if not enough bytes could be skipped.
+ * Negative numbers of bytes to skip are ignored.
+ */
+ private static void skipFully(InputStream is, long l) throws IOException
+ {
+ while (l > 0)
+ {
+ long k = is.skip(l);
+ if (k <= 0)
+ throw new EOFException();
+ l -= k;
+ }
+ }
+
+ /**
+ * Tries to get the system time zone id through native code.
+ */
+ private static native String getSystemTimeZoneId();
+}