com.sun.xml.ws.server
Class SDDocumentImpl

java.lang.Object
  extended by com.sun.xml.ws.api.server.SDDocumentSource
      extended by com.sun.xml.ws.server.SDDocumentImpl
All Implemented Interfaces:
SDDocument

public class SDDocumentImpl
extends SDDocumentSource
implements SDDocument

SDDocument implmentation.

This extends from SDDocumentSource so that JAX-WS server runtime code can use SDDocument as SDDocumentSource.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.xml.ws.api.server.SDDocument
SDDocument.Schema, SDDocument.WSDL
 
Field Summary
(package private)  ServiceDefinitionImpl owner
          Set when ServiceDefinitionImpl is constructed.
 
Constructor Summary
protected SDDocumentImpl(QName rootName, URL url, SDDocumentSource source)
           
protected SDDocumentImpl(QName rootName, URL url, SDDocumentSource source, Set<String> imports)
           
 
Method Summary
static SDDocumentImpl create(SDDocumentSource src, QName serviceName, QName portTypeName)
          Creates SDDocument from SDDocumentSource.
 Set<String> getImports()
          returns the referenced documents
 QName getRootName()
          Gets the root tag name of this document.
 URL getSystemId()
          System ID of this document.
 URL getURL()
          Gets the system ID of the document where it's taken from.
 boolean isSchema()
          Returns true if this document is schema.
 boolean isWSDL()
          Returns true if this document is WSDL.
 javax.xml.stream.XMLStreamReader read()
          Returns the XMLStreamReader that reads the document.
 javax.xml.stream.XMLStreamReader read(javax.xml.stream.XMLInputFactory xif)
          Returns the XMLStreamReader that reads the document.
 void writeTo(OutputStream os)
           
 void writeTo(PortAddressResolver portAddressResolver, DocumentAddressResolver resolver, OutputStream os)
          Writes the document to the given OutputStream.
 void writeTo(PortAddressResolver portAddressResolver, DocumentAddressResolver resolver, javax.xml.stream.XMLStreamWriter out)
          Writes the document to the given XMLStreamWriter.
 
Methods inherited from class com.sun.xml.ws.api.server.SDDocumentSource
create, create
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

ServiceDefinitionImpl owner
Set when ServiceDefinitionImpl is constructed.

Constructor Detail

SDDocumentImpl

protected SDDocumentImpl(QName rootName,
                         URL url,
                         SDDocumentSource source)

SDDocumentImpl

protected SDDocumentImpl(QName rootName,
                         URL url,
                         SDDocumentSource source,
                         Set<String> imports)
Method Detail

create

public static SDDocumentImpl create(SDDocumentSource src,
                                    QName serviceName,
                                    QName portTypeName)
Creates SDDocument from SDDocumentSource.

Parameters:
src - WSDL document infoset
serviceName - wsdl:service name
portTypeName - The information about the port of WSEndpoint to which this document is built for. These values are used to determine which document is the concrete and abstract WSDLs for this endpoint.
Returns:
null Always non-null.

getRootName

public QName getRootName()
Description copied from interface: SDDocument
Gets the root tag name of this document.

This can be used to identify a kind of document quickly (such as schema, WSDL, ...)

Specified by:
getRootName in interface SDDocument
Returns:
always non-null.

isWSDL

public boolean isWSDL()
Description copied from interface: SDDocument
Returns true if this document is WSDL.

Specified by:
isWSDL in interface SDDocument

isSchema

public boolean isSchema()
Description copied from interface: SDDocument
Returns true if this document is schema.

Specified by:
isSchema in interface SDDocument

getURL

public URL getURL()
Description copied from interface: SDDocument
Gets the system ID of the document where it's taken from. Generated documents use a fake URL that can be used to resolve relative URLs. So donot use this URL for reading or writing.

Specified by:
getURL in interface SDDocument

read

public javax.xml.stream.XMLStreamReader read(javax.xml.stream.XMLInputFactory xif)
                                      throws IOException,
                                             javax.xml.stream.XMLStreamException
Description copied from class: SDDocumentSource
Returns the XMLStreamReader that reads the document.

This method maybe invoked multiple times concurrently.

Specified by:
read in class SDDocumentSource
Parameters:
xif - The implementation may choose to use this object when it wants to create a new parser (or it can just ignore this parameter completely.)
Returns:
The caller is responsible for closing the reader to avoid resource leak.
Throws:
IOException - if something goes wrong trying to read the document.
javax.xml.stream.XMLStreamException - if something goes wrong while creating a parser.

read

public javax.xml.stream.XMLStreamReader read()
                                      throws IOException,
                                             javax.xml.stream.XMLStreamException
Description copied from class: SDDocumentSource
Returns the XMLStreamReader that reads the document.

This method maybe invoked multiple times concurrently.

Specified by:
read in class SDDocumentSource
Returns:
The caller is responsible for closing the reader to avoid resource leak.
Throws:
IOException - if something goes wrong trying to read the document.
javax.xml.stream.XMLStreamException - if something goes wrong while creating a parser.

getSystemId

public URL getSystemId()
Description copied from class: SDDocumentSource
System ID of this document.

Specified by:
getSystemId in class SDDocumentSource

getImports

public Set<String> getImports()
Description copied from interface: SDDocument
returns the referenced documents

Specified by:
getImports in interface SDDocument

writeTo

public void writeTo(OutputStream os)
             throws IOException
Throws:
IOException

writeTo

public void writeTo(PortAddressResolver portAddressResolver,
                    DocumentAddressResolver resolver,
                    OutputStream os)
             throws IOException
Description copied from interface: SDDocument
Writes the document to the given OutputStream.

Since ServiceDefinition doesn't know which endpoint address Adapter is serving to, (and often it serves multiple URLs simultaneously), this method takes the PortAddressResolver as a parameter, so that it can produce the corret address information in the generated WSDL.

Specified by:
writeTo in interface SDDocument
Parameters:
portAddressResolver - An endpoint address resolver that gives endpoint address for a WSDL port. Can be null.
resolver - Used to resolve relative references among documents.
os - The OutputStream that receives the generated document.
Throws:
IOException - if there was a failure reported from the OutputStream.

writeTo

public void writeTo(PortAddressResolver portAddressResolver,
                    DocumentAddressResolver resolver,
                    javax.xml.stream.XMLStreamWriter out)
             throws javax.xml.stream.XMLStreamException,
                    IOException
Description copied from interface: SDDocument
Writes the document to the given XMLStreamWriter.

The same as SDDocument.writeTo(PortAddressResolver,DocumentAddressResolver,OutputStream) except it writes to an XMLStreamWriter.

The implementation must not call XMLStreamWriter.writeStartDocument() nor XMLStreamWriter.writeEndDocument(). Those are the caller's responsibility.

Specified by:
writeTo in interface SDDocument
Throws:
javax.xml.stream.XMLStreamException - if the XMLStreamWriter reports an error.
IOException