LDAP Classes
Implements Java LDAP

com.novell.ldap.util
Class DOMReader

java.lang.Object
  extended bycom.novell.ldap.util.DOMReader
All Implemented Interfaces:
LDAPReader

public class DOMReader
extends java.lang.Object
implements LDAPReader

Reads pre-parsed DSML as LDAPMessages.

Some applications have access to DSML(Directory Services Markup Language) pre-parsed into DOM(Document Object Model) objects. This utility class will read a DOM structure and translate it into LDAPMessages. If DSML comes from a stream or file then DSMLReader may also be used.

See Also:
DOMWriter, DSMLReader, LDAPMessage, LDAPConnection.sendRequest(com.novell.ldap.LDAPMessage, com.novell.ldap.LDAPMessageQueue)

Constructor Summary
DOMReader(org.w3c.dom.Document dsmlDoc)
          Deprecated. use #DOMReader(Element) Creates a reader that reads a DOM document and translates it into LDAPMessages.

The first batchRequest or batchResponse is located and all nodes within it will be read and translated into LDAPMessages

DOMReader(org.w3c.dom.Element root)
          Creates a reader that read a DOM element and translate it into LDAPMessages.
 
Method Summary
 java.lang.String getBatchRequestID()
          Retrieves the optional requestID attribute on a BatchRequests.
 java.lang.String getVersion()
          Retrieves the version of DSML being written.
 boolean isParallelProcessing()
          Indicates whether the requests in a batchRequest can be executed in parallel.
 boolean isRequest()
          Used to identify if the root node is a batchRequest or not.
 boolean isResponseUnordered()
          If requests in a batchRequest can be executed in parallel, this specifies whether the responses can be written in any order.
 boolean isResumeOnError()
          Indicates whether the execution of requests in a batchRequest should resume or stop should an error occur.
 LDAPMessage readMessage()
          Reads the current element and returns an LDAPMessage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMReader

public DOMReader(org.w3c.dom.Document dsmlDoc)
          throws LDAPLocalException
Deprecated. use #DOMReader(Element) Creates a reader that reads a DOM document and translates it into LDAPMessages.

The first batchRequest or batchResponse is located and all nodes within it will be read and translated into LDAPMessages

Parameters:
dsmlDoc - Document with a DSML batchRequest or batchResponse
Throws:
LDAPLocalException - Occurs when no batchRequest or batchResponse is found, or the document is invalid DSML.

DOMReader

public DOMReader(org.w3c.dom.Element root)
          throws LDAPLocalException
Creates a reader that read a DOM element and translate it into LDAPMessages.

Requests or responses must be inside of the batchRequest or batchResponse specified

Parameters:
root - Element with a name of batchRequest or batchResponse.
Throws:
LDAPLocalException - Occurs when no batchRequest or batchResponse is found, or the Element is invalid DSML.
Method Detail

getVersion

public java.lang.String getVersion()
Retrieves the version of DSML being written. Currently only 2.0 is supported.

Specified by:
getVersion in interface LDAPReader
Returns:
Version of DSML being used.

isRequest

public boolean isRequest()
Used to identify if the root node is a batchRequest or not.

Specified by:
isRequest in interface LDAPReader
Returns:
true if the root node of the DOM is a batchRequest and false otherwise.

readMessage

public LDAPMessage readMessage()
Reads the current element and returns an LDAPMessage.

Specified by:
readMessage in interface LDAPReader
Returns:
LDAPMessage found in the DSML DOM structure specified in the constructor.

getBatchRequestID

public java.lang.String getBatchRequestID()
Retrieves the optional requestID attribute on a BatchRequests.

Returns:
requestID on a batchRequest or null if requestID is not specified or the content is in a batchResponse.

isParallelProcessing

public boolean isParallelProcessing()
Indicates whether the requests in a batchRequest can be executed in parallel.

This is determined by reading the "processing" attribute on the tag batchRequest. This attribute can take on the values of "sequential" or "parallel" and defaults to "sequential" when the attribute is absent.

Returns:
true if the content is a batchRequest with the attribute processing equal to parallel; and false otherwise.

Other batchRequest properties:

See Also:
getBatchRequestID(), isResponseUnordered(), isResumeOnError()

isResponseUnordered

public boolean isResponseUnordered()
If requests in a batchRequest can be executed in parallel, this specifies whether the responses can be written in any order.

This is determined by reading the "responseOrder" attribute on the tag batchRequest. This attribute can take on the values of "sequential" or "unordered" and defaults to "sequential" when the attribute is absent.

Returns:
true if the content is a batchRequest with the attribute responseOrder equal to unordered; and false otherwise.

isResumeOnError

public boolean isResumeOnError()
Indicates whether the execution of requests in a batchRequest should resume or stop should an error occur.

This is determined by reading the "onError" attribute on the tag batchRequest. This attribute can take on the values of "resume" or "exit" and defaults to "exit" when the attribute is absent.

Returns:
true if the content is a batchRequest with the attribute onError equal to resume; and false otherwise.

Other batchRequest properties:

See Also:
getBatchRequestID(), isParallelProcessing(), isResponseUnordered()

LDAP Classes
Implements Java LDAP

Copyright © 2002 Novell, Inc. All Rights Reserved.
Novell, Inc.
1800 South Novell Place
Provo, Ut 84606
Phone: (801) 861-5000