com.novell.nds.dirxml.driver.xds
Class XDSQueryResultDocument

java.lang.Object
  extended bycom.novell.nds.dirxml.driver.xds.DocumentImpl
      extended bycom.novell.nds.dirxml.driver.xds.XDSQueryResultDocument
All Implemented Interfaces:
QueryResultDocument, ReadableDocument, StatusDocument, WriteableDocument, XDSDocument

public class XDSQueryResultDocument
extends DocumentImpl
implements QueryResultDocument

The XmlDocument returned from method query(XmlDocument) of interface XmlQueryProcessor.

Interface PublicationShim implements this method. An XmlQueryProcessor object reference is passed to the SubscriptionShim.execute(XmlDocument, XmlQueryProcessor) method.


Constructor Summary
XDSQueryResultDocument()
          Constructs an empty, writeable result document.
XDSQueryResultDocument(DTDVersion dtdVersion)
          Constructs an empty, writeable result doucment.
XDSQueryResultDocument(com.novell.nds.dirxml.driver.XmlDocument xdsXML)
          Constructs a readable result document from an existing XDS-formatted, XML document.
 
Method Summary
 XDSInstanceElement appendInstanceElement()
          Appends an empty, child <instance> element to this document's <output> element.
 XDSQueryTokenElement appendQueryTokenElement(String someToken)
          Appends an empty, child <query-token> element to this document's <output> element.
 XDSSourceElement appendSourceElement()
          Appends an empty, child <source> element to this document's <nds> element.
 XDSStatusElement appendStatusElement()
          Appends an empty, child <status> element to this document's <input> or <output> element.
 List childElements()
          Returns the child elements of this document's <output> element.
 boolean containsQueryToken(String someToken)
          Does this document contain a specific query token?
 boolean containsQueryTokenElements()
          Does this document contain query token elements?
 void empty()
          Removes all child nodes from this document's <input> or <output> element.
 List extractInstanceElements()
          Returns this document's <instance> elements.
 List extractQueryTokenElements()
          Returns this document's<query-token> elements.
 XDSSourceElement extractSourceElement()
          Returns this document's <source> element.
 List extractStatusElements()
          Returns this document's <status> elements.
 List extractStatusElements(String someID)
          Returns the status elements with an event-id attribute value equal to someID.
 DTDVersion getDTDVersion()
          Returns the dtdversion attribute value from this document's <nds> element.
 XDSStatusElement mostSevereStatusElement(String someID)
          Returns the status element with the most severe level attribute value with an event-id attribute value equal to someID.
 StatusLevel mostSevereStatusLevel(String someID)
          Returns the most severe level attribute value for all <status> elements with an event-id attribute value equal to someID.
 com.novell.nds.dirxml.driver.XmlDocument toXML()
          Converts this document into an XmlDocument.
 void validate()
          Validates this document.
 
Methods inherited from class com.novell.nds.dirxml.driver.xds.DocumentImpl
domDocument, domIOElement, domNDSElement, isEmpty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.novell.nds.dirxml.driver.xds.XDSDocument
domDocument, domIOElement, domNDSElement, isEmpty
 

Constructor Detail

XDSQueryResultDocument

public XDSQueryResultDocument(com.novell.nds.dirxml.driver.XmlDocument xdsXML)
                       throws XDSParseException
Constructs a readable result document from an existing XDS-formatted, XML document.

This constructor should be used to parse documents returned from the XmlQueryProcessor object passed to method execute(XmlDocument, XmlQueryProcessor) of interface SubscriptionShim

Parameters:
xdsXML - must not be null
Throws:
XDSParseException - thrown if xdsXML is empty, malformed, or invalid
See Also:
SkeletonSubscriptionShim.execute(XmlDocument, com.novell.nds.dirxml.driver.XmlQueryProcessor)

XDSQueryResultDocument

public XDSQueryResultDocument()
Constructs an empty, writeable result document. By default, the current DTD version is used.

This constructor should be used to build documents returned from method query(XmlDocument) of interface PublicationShim

See Also:
SkeletonPublicationShim.query(XmlDocument)

XDSQueryResultDocument

public XDSQueryResultDocument(DTDVersion dtdVersion)
Constructs an empty, writeable result doucment. The DTD version used is configurable.

This constructor should be used to build documents returned from method query(XmlDocument) of interface PublicationShim

Parameters:
dtdVersion - must not be null
See Also:
SkeletonPublicationShim.query(XmlDocument)
Method Detail

getDTDVersion

public DTDVersion getDTDVersion()
Description copied from interface: ReadableDocument
Returns the dtdversion attribute value from this document's <nds> element.

Invocation Context:
READ

Specified by:
getDTDVersion in interface ReadableDocument
Returns:
will not return null; if absent, this method returns DTDVersion.UNKNOWN

extractSourceElement

public XDSSourceElement extractSourceElement()
Description copied from interface: ReadableDocument
Returns this document's <source> element.

Invocation Context:
READ

Specified by:
extractSourceElement in interface ReadableDocument
Returns:
may return null

containsQueryTokenElements

public boolean containsQueryTokenElements()
Description copied from interface: QueryResultDocument
Does this document contain query token elements?

Invocation Context:
READ

Specified by:
containsQueryTokenElements in interface QueryResultDocument
Returns:
true if it does, false otherwise

containsQueryToken

public boolean containsQueryToken(String someToken)
Description copied from interface: QueryResultDocument
Does this document contain a specific query token?

Invocation Context:
READ

Specified by:
containsQueryToken in interface QueryResultDocument
Parameters:
someToken - may be null
Returns:
true if it does, false otherwise

extractQueryTokenElements

public List extractQueryTokenElements()
Description copied from interface: QueryResultDocument
Returns this document's<query-token> elements.

Invocation Context:
READ

Specified by:
extractQueryTokenElements in interface QueryResultDocument
Returns:
Collections.EMPTY_LIST or a list of XDSStatusElement objects; will not return null

extractStatusElements

public List extractStatusElements(String someID)
Description copied from interface: QueryResultDocument
Returns the status elements with an event-id attribute value equal to someID.

Invocation Context:
READ

Specified by:
extractStatusElements in interface QueryResultDocument
Parameters:
someID - may be null
Returns:
Collections.EMPTY_LIST or a list of XDSStatusElement objects; will not return null

extractStatusElements

public List extractStatusElements()
Description copied from interface: QueryResultDocument
Returns this document's <status> elements.

Invocation Context:
READ

Specified by:
extractStatusElements in interface QueryResultDocument
Returns:
Collections.EMPTY_LIST or a list of XDSStatusElement objects; will not return null

mostSevereStatusElement

public XDSStatusElement mostSevereStatusElement(String someID)
Description copied from interface: QueryResultDocument
Returns the status element with the most severe level attribute value with an event-id attribute value equal to someID.

If no matching status element is found, the status element with the most severe level is returned irrespective of event-id value.

Invocation Context:
READ

Specified by:
mostSevereStatusElement in interface QueryResultDocument
Parameters:
someID - may be null
Returns:
may return null

mostSevereStatusLevel

public StatusLevel mostSevereStatusLevel(String someID)
Description copied from interface: QueryResultDocument
Returns the most severe level attribute value for all <status> elements with an event-id attribute value equal to someID.

If no matching status element is found, the most severe status level is returned irrespective of event-id value. If no status info is available, StatusLevel.SUCCESS is returned.

Invocation Context:
READ

Specified by:
mostSevereStatusLevel in interface QueryResultDocument
Parameters:
someID - may be null
Returns:
will not return null

extractInstanceElements

public List extractInstanceElements()
Description copied from interface: QueryResultDocument
Returns this document's <instance> elements.

Invocation Context:
READ

Specified by:
extractInstanceElements in interface QueryResultDocument
Returns:
Collections.EMPTY_LIST or a list of XDSInstanceElement objects; will not return null

childElements

public List childElements()
Returns the child elements of this document's <output> element.

Usage Notes:
The types of objects returned by this method may be extended in the future. Thus, callers should be able to handle object types other than those listed in the returns field below.
Invocation Context:
READ

Specified by:
childElements in interface ReadableDocument
Returns:
Collections.EMPTY_LIST or a list of XDSStatusElement, XDSInstanceElement, XDSQueryTokenElement, and NonXDSElement objects; will not return null

appendInstanceElement

public XDSInstanceElement appendInstanceElement()
Appends an empty, child <instance> element to this document's <output> element.

Invocation Context:
WRITE

Specified by:
appendInstanceElement in interface QueryResultDocument
Returns:
will not return null

appendQueryTokenElement

public XDSQueryTokenElement appendQueryTokenElement(String someToken)
Description copied from interface: QueryResultDocument
Appends an empty, child <query-token> element to this document's <output> element.

Invocation Context:
WRITE

Specified by:
appendQueryTokenElement in interface QueryResultDocument
Parameters:
someToken - the unique token for the source query of this document; should not be null
Returns:
will not return null

validate

public void validate()
              throws XDSParseException
Description copied from interface: WriteableDocument
Validates this document.

Invocation Context:
WRITE

Specified by:
validate in interface WriteableDocument
Throws:
XDSParseException - if this document is malformed or invalid

appendSourceElement

public XDSSourceElement appendSourceElement()
Description copied from interface: WriteableDocument
Appends an empty, child <source> element to this document's <nds> element. When called more than once, no action is taken and the same <source> element is returned.

Invocation Context:
WRITE

Specified by:
appendSourceElement in interface WriteableDocument
Returns:
will not return null

toXML

public com.novell.nds.dirxml.driver.XmlDocument toXML()
Description copied from interface: WriteableDocument
Converts this document into an XmlDocument.

Invocation Context:
WRITE

Specified by:
toXML in interface WriteableDocument
Returns:
this document as a XmlDocument

empty

public void empty()
Description copied from interface: WriteableDocument
Removes all child nodes from this document's <input> or <output> element.

Invocation Context:
WRITE

Specified by:
empty in interface WriteableDocument

appendStatusElement

public XDSStatusElement appendStatusElement()
Description copied from interface: StatusDocument
Appends an empty, child <status> element to this document's <input> or <output> element.

Invocation Context:
WRITE

Specified by:
appendStatusElement in interface StatusDocument
Returns:
will not return null