< prev index next >

jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/server/SDDocumentSource.java

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, 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.  Oracle designates this

@@ -24,13 +24,13 @@
  */
 
 package com.sun.xml.internal.ws.api.server;
 
 import com.sun.xml.internal.stream.buffer.XMLStreamBuffer;
+import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
 import com.sun.xml.internal.ws.server.ServerRtException;
 import com.sun.xml.internal.ws.streaming.TidyXMLStreamReader;
-import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
 
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import java.io.IOException;

@@ -40,11 +40,11 @@
 
 /**
  * SPI that provides the source of {@link SDDocument}.
  *
  * <p>
- * This abstract class could be implemented by appliations, or one of the
+ * This abstract class could be implemented by applications, or one of the
  * {@link #create} methods can be used.
  *
  * @author Kohsuke Kawaguchi
  */
 public abstract class SDDocumentSource {

@@ -83,32 +83,42 @@
      */
     public abstract XMLStreamReader read() throws IOException, XMLStreamException;
 
     /**
      * System ID of this document.
+     * @return
      */
     public abstract URL getSystemId();
 
+    public static SDDocumentSource create(final Class<?> implClass, final String url) {
+        return create(url, implClass);
+    }
+
     /**
      * Creates {@link SDDocumentSource} from an URL.
+     * @param url
+     * @return
      */
     public static SDDocumentSource create(final URL url) {
         return new SDDocumentSource() {
             private final URL systemId = url;
 
+            @Override
             public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException {
                 InputStream is = url.openStream();
                 return new TidyXMLStreamReader(
                     xif.createXMLStreamReader(systemId.toExternalForm(),is), is);
             }
 
+            @Override
             public XMLStreamReader read() throws IOException, XMLStreamException {
                 InputStream is = url.openStream();
                 return new TidyXMLStreamReader(
                    XMLStreamReaderFactory.create(systemId.toExternalForm(),is,false), is);
             }
 
+            @Override
             public URL getSystemId() {
                 return systemId;
             }
         };
     }

@@ -118,23 +128,26 @@
      * Required for Jigsaw runtime.
      *
      * @param resolvingClass class used to read resource
      * @param path resource path
      */
-    public static SDDocumentSource create(final Class resolvingClass, final String path) {
+    private static SDDocumentSource create(final String path, final Class<?> resolvingClass) {
         return new SDDocumentSource() {
 
+            @Override
             public XMLStreamReader read(XMLInputFactory xif) throws IOException, XMLStreamException {
                 InputStream is = inputStream();
                 return new TidyXMLStreamReader(xif.createXMLStreamReader(path,is), is);
             }
 
+            @Override
             public XMLStreamReader read() throws IOException, XMLStreamException {
                 InputStream is = inputStream();
                 return new TidyXMLStreamReader(XMLStreamReaderFactory.create(path,is,false), is);
             }
 
+            @Override
             public URL getSystemId() {
                 try {
                     return new URL("file://" + path);
                 } catch (MalformedURLException e) {
                     return null;

@@ -155,21 +168,27 @@
         };
     }
 
     /**
      * Creates a {@link SDDocumentSource} from {@link XMLStreamBuffer}.
+     * @param systemId
+     * @param xsb
+     * @return
      */
     public static SDDocumentSource create(final URL systemId, final XMLStreamBuffer xsb) {
         return new SDDocumentSource() {
+            @Override
             public XMLStreamReader read(XMLInputFactory xif) throws XMLStreamException {
                 return xsb.readAsXMLStreamReader();
             }
 
+            @Override
             public XMLStreamReader read() throws XMLStreamException {
                 return xsb.readAsXMLStreamReader();
             }
 
+            @Override
             public URL getSystemId() {
                 return systemId;
             }
         };
     }
< prev index next >