LDAP Classes
Implements Java LDAP

com.novell.ldap.util
Class DSMLReader

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

public class DSMLReader
extends java.lang.Object
implements LDAPReader

Reads, parses and converts DSML into LDAPMessages.

Reads DSML, Directory Service Markup Language, from files, streams and readers, and returns LDAPMessages. Note that some XML applications will have DSML pre-parsed into DOM objects, in which case DOMReader should be used.

See Also:
DSMLWriter, DOMReader, LDAPMessage, LDAPConnection.sendRequest(com.novell.ldap.LDAPMessage, com.novell.ldap.LDAPMessageQueue)

Constructor Summary
DSMLReader(java.io.InputStream inputStream)
          Creates a reader that reads from an inputStream containing xml with DSML tags.
DSMLReader(java.io.Reader reader)
          Creates a reader that reads from a reader containing xml with DSML tags.
DSMLReader(java.lang.String dsmlFile)
          Creates a reader that reads from a file containing XML with DSML tags.
 
Method Summary
 java.lang.String getBatchRequestID()
          Retrieves the optional requestID attribute on a BatchRequests.
 java.util.ArrayList getErrors()
           
 java.lang.String getVersion()
          Gets the version of the LDIF data associated with the input stream
 boolean isParallelProcessing()
          Indicates whether the requests in a batchRequest can be executed in parallel.
 boolean isRequest()
          Returns true if request data ist associated with the input stream, or false if content data.
 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()
          Retrieves the current LDAPMessage and advances to the next.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DSMLReader

public DSMLReader(java.lang.String dsmlFile)
           throws LDAPLocalException,
                  java.io.FileNotFoundException
Creates a reader that reads from a file containing XML with DSML tags.

All XML tags before and after batchRequests or batchResponses are ignored. All requests or response within batchRequests and batchResponses are converted into LDAPMessages

Parameters:
dsmlFile - XML file with a DSML batchRequest or batchResponse
Throws:
LDAPLocalException - Occurs when no batchRequest or batchResponse is found, or the document is invalid DSML.
java.io.FileNotFoundException - Occurs when the specied file is not found

DSMLReader

public DSMLReader(java.io.InputStream inputStream)
           throws LDAPLocalException,
                  java.io.UnsupportedEncodingException
Creates a reader that reads from an inputStream containing xml with DSML tags.

All XML tags before and after batchRequests or batchResponses are ignored. All requests or response within batchRequests and batchResponses are converted into LDAPMessages

Parameters:
inputStream - Stream of XML with a DSML batchRequest or batchResponse
Throws:
LDAPLocalException - Occurs when no batchRequest or batchResponse is found, or the document is invalid DSML.
java.io.UnsupportedEncodingException

DSMLReader

public DSMLReader(java.io.Reader reader)
           throws LDAPLocalException
Creates a reader that reads from a reader containing xml with DSML tags.

All XML tags before and after batchRequests or batchResponses are ignored. All requests or response within batchRequests and batchResponses are converted into LDAPMessages

Parameters:
reader - Reader of XML with a DSML batchRequest or batchResponse
Throws:
LDAPLocalException - Occurs when no batchRequest or batchResponse is found, or the document is invalid DSML.
Method Detail

readMessage

public LDAPMessage readMessage()
Retrieves the current LDAPMessage and advances to the next.

This method is used to iterate over all DSML tags parsed into LDAPMessages

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

getVersion

public java.lang.String getVersion()
Gets the version of the LDIF data associated with the input stream

Specified by:
getVersion in interface LDAPReader
Returns:
the version number

isRequest

public boolean isRequest()
Returns true if request data ist associated with the input stream, or false if content data.

Specified by:
isRequest in interface LDAPReader
Returns:
true if input stream contains request data.

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()

getErrors

public java.util.ArrayList getErrors()

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