mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-10 23:18:45 +00:00
8169948: Update ServiceProviderTest for newDefaultInstance() methods in JAXP factories
Reviewed-by: dfuchs, joehw, lana
This commit is contained in:
parent
d5eac2a77d
commit
c9e3f3fa08
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
import static org.testng.Assert.assertSame;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.StringWriter;
|
||||
import java.lang.reflect.Layer;
|
||||
import java.lang.reflect.Module;
|
||||
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
import javax.xml.stream.XMLEventFactory;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @library src/DefaultFactoryWrapperTest
|
||||
* @build xmlwrapperprovider/*
|
||||
* @run testng/othervm --add-modules=xmlwrapperprovider DefaultFactoryWrapperTest
|
||||
* @bug 8169948 8169778
|
||||
* @summary test customized provider wraps the built-in system-default implementation of JAXP factories
|
||||
*/
|
||||
public class DefaultFactoryWrapperTest {
|
||||
private static final Module XML_MODULE = Layer.boot().findModule("java.xml").get();
|
||||
|
||||
private static final String PROVIDER_PACKAGE = "xwp";
|
||||
|
||||
/*
|
||||
* Return JAXP factory and corresponding factory function.
|
||||
*/
|
||||
@DataProvider(name = "jaxpFactories")
|
||||
public Object[][] jaxpFactories() throws Exception {
|
||||
return new Object[][] {
|
||||
{ DocumentBuilderFactory.newInstance(), (Produce)factory -> ((DocumentBuilderFactory)factory).newDocumentBuilder() },
|
||||
{ SAXParserFactory.newInstance(), (Produce)factory -> ((SAXParserFactory)factory).newSAXParser() },
|
||||
{ SchemaFactory.newInstance(W3C_XML_SCHEMA_NS_URI), (Produce)factory -> ((SchemaFactory)factory).newSchema() },
|
||||
{ TransformerFactory.newInstance(), (Produce)factory -> ((TransformerFactory)factory).newTransformer() },
|
||||
{ XMLEventFactory.newInstance(), (Produce)factory -> ((XMLEventFactory)factory).createStartDocument() },
|
||||
{ XMLInputFactory.newInstance(), (Produce)factory -> ((XMLInputFactory)factory).createXMLEventReader(new StringReader("")) },
|
||||
{ XMLOutputFactory.newInstance(), (Produce)factory -> ((XMLOutputFactory)factory).createXMLEventWriter(new StringWriter()) },
|
||||
{ XPathFactory.newInstance(), (Produce)factory -> ((XPathFactory)factory).newXPath() },
|
||||
{ DatatypeFactory.newInstance(), (Produce)factory -> ((DatatypeFactory)factory).newXMLGregorianCalendar() }
|
||||
};
|
||||
}
|
||||
|
||||
/*
|
||||
* Verify the factory comes from customized provider, and produces a built-in type.
|
||||
*/
|
||||
@Test(dataProvider = "jaxpFactories")
|
||||
public void testFactory(Object factory, Produce<Object, Object> p) throws Exception {
|
||||
assertEquals(factory.getClass().getPackageName(), PROVIDER_PACKAGE);
|
||||
assertSame(p.produce(factory).getClass().getModule(), XML_MODULE);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface Produce<T, R> {
|
||||
R produce(T t) throws Exception;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
module xmlwrapperprovider {
|
||||
requires java.xml;
|
||||
|
||||
provides javax.xml.parsers.DocumentBuilderFactory with xwp.DocumentBuilderFactoryWrapper;
|
||||
provides javax.xml.parsers.SAXParserFactory with xwp.SAXParserFactoryWrapper;
|
||||
provides javax.xml.stream.XMLInputFactory with xwp.XMLInputFactoryWrapper;
|
||||
provides javax.xml.stream.XMLOutputFactory with xwp.XMLOutputFactoryWrapper;
|
||||
provides javax.xml.transform.TransformerFactory with xwp.TransformerFactoryWrapper;
|
||||
provides javax.xml.validation.SchemaFactory with xwp.SchemaFactoryWrapper;
|
||||
provides javax.xml.xpath.XPathFactory with xwp.XPathFactoryWrapper;
|
||||
provides javax.xml.datatype.DatatypeFactory with xwp.DatatypeFactoryWrapper;
|
||||
provides javax.xml.stream.XMLEventFactory with xwp.XMLEventFactoryWrapper;
|
||||
}
|
||||
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import javax.xml.datatype.DatatypeFactory;
|
||||
import javax.xml.datatype.Duration;
|
||||
import javax.xml.datatype.XMLGregorianCalendar;
|
||||
|
||||
public class DatatypeFactoryWrapper extends DatatypeFactory {
|
||||
private DatatypeFactory defaultImpl = DatatypeFactory.newDefaultInstance();
|
||||
|
||||
@Override
|
||||
public Duration newDuration(String lexicalRepresentation) {
|
||||
return defaultImpl.newDuration(lexicalRepresentation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration newDuration(long durationInMilliSeconds) {
|
||||
return defaultImpl.newDuration(durationInMilliSeconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Duration newDuration(boolean isPositive, BigInteger years, BigInteger months, BigInteger days,
|
||||
BigInteger hours, BigInteger minutes, BigDecimal seconds) {
|
||||
return defaultImpl.newDuration(isPositive, years, months, days, hours, minutes, seconds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLGregorianCalendar newXMLGregorianCalendar() {
|
||||
return defaultImpl.newXMLGregorianCalendar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLGregorianCalendar newXMLGregorianCalendar(String lexicalRepresentation) {
|
||||
return defaultImpl.newXMLGregorianCalendar(lexicalRepresentation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLGregorianCalendar newXMLGregorianCalendar(GregorianCalendar cal) {
|
||||
return defaultImpl.newXMLGregorianCalendar(cal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLGregorianCalendar newXMLGregorianCalendar(BigInteger year, int month, int day, int hour,
|
||||
int minute, int second, BigDecimal fractionalSecond, int timezone) {
|
||||
return defaultImpl.newXMLGregorianCalendar(year, month, day, hour, minute, second, fractionalSecond, timezone);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
public class DocumentBuilderFactoryWrapper extends DocumentBuilderFactory {
|
||||
private DocumentBuilderFactory defaultImpl = DocumentBuilderFactory.newDefaultInstance();
|
||||
|
||||
@Override
|
||||
public DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
|
||||
return defaultImpl.newDocumentBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) throws IllegalArgumentException {
|
||||
defaultImpl.setAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) throws IllegalArgumentException {
|
||||
return defaultImpl.getAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeature(String name, boolean value) throws ParserConfigurationException {
|
||||
defaultImpl.setFeature(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFeature(String name) throws ParserConfigurationException {
|
||||
return defaultImpl.getFeature(name);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.parsers.SAXParser;
|
||||
import javax.xml.parsers.SAXParserFactory;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
import org.xml.sax.SAXNotRecognizedException;
|
||||
import org.xml.sax.SAXNotSupportedException;
|
||||
|
||||
public class SAXParserFactoryWrapper extends SAXParserFactory {
|
||||
private SAXParserFactory defaultImpl = SAXParserFactory.newDefaultInstance();
|
||||
|
||||
@Override
|
||||
public SAXParser newSAXParser() throws ParserConfigurationException, SAXException {
|
||||
return defaultImpl.newSAXParser();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeature(String name, boolean value) throws ParserConfigurationException,
|
||||
SAXNotRecognizedException, SAXNotSupportedException {
|
||||
defaultImpl.setFeature(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFeature(String name) throws ParserConfigurationException, SAXNotRecognizedException,
|
||||
SAXNotSupportedException {
|
||||
return defaultImpl.getFeature(name);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.validation.Schema;
|
||||
import javax.xml.validation.SchemaFactory;
|
||||
|
||||
import org.w3c.dom.ls.LSResourceResolver;
|
||||
import org.xml.sax.ErrorHandler;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class SchemaFactoryWrapper extends SchemaFactory {
|
||||
private SchemaFactory defaultImpl = SchemaFactory.newDefaultInstance();
|
||||
|
||||
@Override
|
||||
public boolean isSchemaLanguageSupported(String schemaLanguage) {
|
||||
return defaultImpl.isSchemaLanguageSupported(schemaLanguage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorHandler(ErrorHandler errorHandler) {
|
||||
defaultImpl.setErrorHandler(errorHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorHandler getErrorHandler() {
|
||||
return defaultImpl.getErrorHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setResourceResolver(LSResourceResolver resourceResolver) {
|
||||
defaultImpl.setResourceResolver(resourceResolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LSResourceResolver getResourceResolver() {
|
||||
return defaultImpl.getResourceResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema newSchema(Source[] schemas) throws SAXException {
|
||||
return defaultImpl.newSchema(schemas);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Schema newSchema() throws SAXException {
|
||||
return defaultImpl.newSchema();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.URIResolver;
|
||||
|
||||
public class TransformerFactoryWrapper extends TransformerFactory {
|
||||
private TransformerFactory defaultImpl = TransformerFactory.newDefaultInstance();
|
||||
|
||||
@Override
|
||||
public Transformer newTransformer(Source source) throws TransformerConfigurationException {
|
||||
return defaultImpl.newTransformer(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transformer newTransformer() throws TransformerConfigurationException {
|
||||
return defaultImpl.newTransformer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Templates newTemplates(Source source) throws TransformerConfigurationException {
|
||||
return defaultImpl.newTemplates(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Source getAssociatedStylesheet(Source source, String media, String title, String charset)
|
||||
throws TransformerConfigurationException {
|
||||
return defaultImpl.getAssociatedStylesheet(source, media, title, charset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setURIResolver(URIResolver resolver) {
|
||||
defaultImpl.setURIResolver(resolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URIResolver getURIResolver() {
|
||||
return defaultImpl.getURIResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeature(String name, boolean value) throws TransformerConfigurationException {
|
||||
defaultImpl.setFeature(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFeature(String name) {
|
||||
return defaultImpl.getFeature(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAttribute(String name, Object value) {
|
||||
defaultImpl.setAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getAttribute(String name) {
|
||||
return defaultImpl.getAttribute(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setErrorListener(ErrorListener listener) {
|
||||
defaultImpl.setErrorListener(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ErrorListener getErrorListener() {
|
||||
return defaultImpl.getErrorListener();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,181 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.xml.namespace.NamespaceContext;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.stream.Location;
|
||||
import javax.xml.stream.XMLEventFactory;
|
||||
import javax.xml.stream.events.Attribute;
|
||||
import javax.xml.stream.events.Characters;
|
||||
import javax.xml.stream.events.Comment;
|
||||
import javax.xml.stream.events.DTD;
|
||||
import javax.xml.stream.events.EndDocument;
|
||||
import javax.xml.stream.events.EndElement;
|
||||
import javax.xml.stream.events.EntityDeclaration;
|
||||
import javax.xml.stream.events.EntityReference;
|
||||
import javax.xml.stream.events.Namespace;
|
||||
import javax.xml.stream.events.ProcessingInstruction;
|
||||
import javax.xml.stream.events.StartDocument;
|
||||
import javax.xml.stream.events.StartElement;
|
||||
|
||||
public class XMLEventFactoryWrapper extends XMLEventFactory {
|
||||
private XMLEventFactory defaultImpl = XMLEventFactory.newDefaultFactory();
|
||||
|
||||
@Override
|
||||
public void setLocation(Location location) {
|
||||
defaultImpl.setLocation(location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute createAttribute(String prefix, String namespaceURI, String localName, String value) {
|
||||
return defaultImpl.createAttribute(prefix, namespaceURI, localName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute createAttribute(String localName, String value) {
|
||||
return defaultImpl.createAttribute(localName, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Attribute createAttribute(QName name, String value) {
|
||||
return defaultImpl.createAttribute(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Namespace createNamespace(String namespaceURI) {
|
||||
return defaultImpl.createNamespace(namespaceURI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Namespace createNamespace(String prefix, String namespaceUri) {
|
||||
return defaultImpl.createNamespace(prefix, namespaceUri);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartElement createStartElement(QName name, Iterator attributes, Iterator namespaces) {
|
||||
return defaultImpl.createStartElement(name, attributes, namespaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartElement createStartElement(String prefix, String namespaceUri, String localName) {
|
||||
return defaultImpl.createStartElement(prefix, namespaceUri, localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartElement createStartElement(String prefix, String namespaceUri, String localName,
|
||||
Iterator attributes, Iterator namespaces) {
|
||||
return defaultImpl.createStartElement(prefix, namespaceUri, localName, attributes, namespaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartElement createStartElement(String prefix, String namespaceUri, String localName,
|
||||
Iterator attributes, Iterator namespaces, NamespaceContext context) {
|
||||
return defaultImpl.createStartElement(prefix, namespaceUri, localName, attributes, namespaces, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EndElement createEndElement(QName name, Iterator namespaces) {
|
||||
return defaultImpl.createEndElement(name, namespaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EndElement createEndElement(String prefix, String namespaceUri, String localName) {
|
||||
return defaultImpl.createEndElement(prefix, namespaceUri, localName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EndElement createEndElement(String prefix, String namespaceUri, String localName,
|
||||
Iterator namespaces) {
|
||||
return defaultImpl.createEndElement(prefix, namespaceUri, localName, namespaces);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Characters createCharacters(String content) {
|
||||
return defaultImpl.createCharacters(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Characters createCData(String content) {
|
||||
return defaultImpl.createCData(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Characters createSpace(String content) {
|
||||
return defaultImpl.createSpace(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Characters createIgnorableSpace(String content) {
|
||||
return defaultImpl.createIgnorableSpace(content);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartDocument createStartDocument() {
|
||||
return defaultImpl.createStartDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartDocument createStartDocument(String encoding, String version, boolean standalone) {
|
||||
return defaultImpl.createStartDocument(encoding, version, standalone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartDocument createStartDocument(String encoding, String version) {
|
||||
return defaultImpl.createStartDocument(encoding, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StartDocument createStartDocument(String encoding) {
|
||||
return defaultImpl.createStartDocument(encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EndDocument createEndDocument() {
|
||||
return defaultImpl.createEndDocument();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntityReference createEntityReference(String name, EntityDeclaration declaration) {
|
||||
return defaultImpl.createEntityReference(name, declaration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Comment createComment(String text) {
|
||||
return defaultImpl.createComment(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProcessingInstruction createProcessingInstruction(String target, String data) {
|
||||
return defaultImpl.createProcessingInstruction(target, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DTD createDTD(String dtd) {
|
||||
return defaultImpl.createDTD(dtd);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,167 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
|
||||
import javax.xml.stream.EventFilter;
|
||||
import javax.xml.stream.StreamFilter;
|
||||
import javax.xml.stream.XMLEventReader;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLReporter;
|
||||
import javax.xml.stream.XMLResolver;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import javax.xml.stream.util.XMLEventAllocator;
|
||||
import javax.xml.transform.Source;
|
||||
|
||||
public class XMLInputFactoryWrapper extends XMLInputFactory {
|
||||
private XMLInputFactory defaultImpl = XMLInputFactory.newDefaultFactory();
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamReader(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamReader(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamReader(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding)
|
||||
throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamReader(stream, encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream)
|
||||
throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamReader(systemId, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamReader(systemId, reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(systemId, reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(reader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(stream, encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventReader(systemId, stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
|
||||
throws XMLStreamException {
|
||||
return defaultImpl.createFilteredReader(reader, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
|
||||
throws XMLStreamException {
|
||||
return defaultImpl.createFilteredReader(reader, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLResolver getXMLResolver() {
|
||||
return defaultImpl.getXMLResolver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXMLResolver(XMLResolver resolver) {
|
||||
defaultImpl.setXMLResolver(resolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLReporter getXMLReporter() {
|
||||
return defaultImpl.getXMLReporter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXMLReporter(XMLReporter reporter) {
|
||||
defaultImpl.setXMLReporter(reporter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String name, Object value) throws IllegalArgumentException {
|
||||
defaultImpl.setProperty(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
return defaultImpl.getProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPropertySupported(String name) {
|
||||
return defaultImpl.isPropertySupported(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventAllocator(XMLEventAllocator allocator) {
|
||||
defaultImpl.setEventAllocator(allocator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventAllocator getEventAllocator() {
|
||||
return defaultImpl.getEventAllocator();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.io.Writer;
|
||||
|
||||
import javax.xml.stream.XMLEventWriter;
|
||||
import javax.xml.stream.XMLOutputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamWriter;
|
||||
import javax.xml.transform.Result;
|
||||
|
||||
public class XMLOutputFactoryWrapper extends XMLOutputFactory {
|
||||
private XMLOutputFactory defaultImpl = XMLOutputFactory.newDefaultFactory();
|
||||
|
||||
@Override
|
||||
public XMLStreamWriter createXMLStreamWriter(Writer stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamWriter(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamWriter createXMLStreamWriter(OutputStream stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamWriter(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamWriter createXMLStreamWriter(OutputStream stream, String encoding)
|
||||
throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamWriter(stream, encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException {
|
||||
return defaultImpl.createXMLStreamWriter(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventWriter(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventWriter createXMLEventWriter(OutputStream stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventWriter(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventWriter createXMLEventWriter(OutputStream stream, String encoding)
|
||||
throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventWriter(stream, encoding);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XMLEventWriter createXMLEventWriter(Writer stream) throws XMLStreamException {
|
||||
return defaultImpl.createXMLEventWriter(stream);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String name, Object value) throws IllegalArgumentException {
|
||||
defaultImpl.setProperty(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getProperty(String name) throws IllegalArgumentException {
|
||||
return defaultImpl.getProperty(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPropertySupported(String name) {
|
||||
return defaultImpl.isPropertySupported(name);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License version 2 only, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
|
||||
package xwp;
|
||||
|
||||
import javax.xml.xpath.XPath;
|
||||
import javax.xml.xpath.XPathFactory;
|
||||
import javax.xml.xpath.XPathFactoryConfigurationException;
|
||||
import javax.xml.xpath.XPathFunctionResolver;
|
||||
import javax.xml.xpath.XPathVariableResolver;
|
||||
|
||||
public class XPathFactoryWrapper extends XPathFactory {
|
||||
private XPathFactory defaultImpl = XPathFactory.newDefaultInstance();
|
||||
|
||||
@Override
|
||||
public boolean isObjectModelSupported(String objectModel) {
|
||||
return defaultImpl.isObjectModelSupported(objectModel);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFeature(String name, boolean value) throws XPathFactoryConfigurationException {
|
||||
defaultImpl.setFeature(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getFeature(String name) throws XPathFactoryConfigurationException {
|
||||
return defaultImpl.getFeature(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXPathVariableResolver(XPathVariableResolver resolver) {
|
||||
defaultImpl.setXPathVariableResolver(resolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXPathFunctionResolver(XPathFunctionResolver resolver) {
|
||||
defaultImpl.setXPathFunctionResolver(resolver);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XPath newXPath() {
|
||||
return defaultImpl.newXPath();
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user