LDAP Classes
Implements Java LDAP

com.novell.ldap.util
Class DOMWriter

java.lang.Object
  extended bycom.novell.ldap.util.DOMWriter
All Implemented Interfaces:
LDAPWriter

public class DOMWriter
extends java.lang.Object
implements LDAPWriter

Writes LDAPMessages into a DOM structure as DSML batch requests and batch responses.

See Also:
DOMReader, DSMLWriter, LDAPMessage

Constructor Summary
DOMWriter()
          Initializes the DOMWriter.
 
Method Summary
 void finish()
          Writes any remaining data to the output destination.
 org.w3c.dom.Element getRootElement()
          Retrieves the batchRequest or batchResponse element populated with this writer.
 java.lang.String getVersion()
          Retrieves the version of DSML being written, currently only 2.0 is supported.
 boolean isRequest()
          Used to identify if the root node is a batchRequest or not.
 org.w3c.dom.Element message2Element(LDAPMessage message)
          Utility method to convert an LDAPMessage to a DSML DOM element.
 void writeComments(java.lang.String comments)
          This method is not implemented and is silently ignored.
 void writeEntry(LDAPEntry entry)
          Write an LDAP record into LDIF file as LDAPContent data.
 void writeEntry(LDAPEntry entry, LDAPControl[] controls)
          Write an LDAP record into LDIF file as LDAPContent data.
 void writeEntry(LDAPEntry entry, LDAPControl[] controls, java.lang.String requestID)
          Write an LDAP record into LDIF file as LDAPContent data.
 void writeError(java.lang.Exception e)
          Any Exception can be written in DSML with this method, via the tag.
 void writeMessage(LDAPMessage message)
          Writes the LDAPMessage into the DOMStructure.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DOMWriter

public DOMWriter()
          throws javax.xml.parsers.ParserConfigurationException
Initializes the DOMWriter.

Throws:
javax.xml.parsers.ParserConfigurationException - Occurs if a parser could not be found or is misconfigured.
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 LDAPWriter
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 LDAPWriter
Returns:
true if the root node of the DOM is a batchRequest and false otherwise.

writeComments

public void writeComments(java.lang.String comments)
                   throws java.io.IOException
This method is not implemented and is silently ignored.

Specified by:
writeComments in interface LDAPWriter
Parameters:
comments - The comments to write
Throws:
java.io.IOException

writeMessage

public void writeMessage(LDAPMessage message)
                  throws LDAPLocalException,
                         java.io.IOException
Writes the LDAPMessage into the DOMStructure.

Specified by:
writeMessage in interface LDAPWriter
Parameters:
message - LDAPMessage to write
Throws:
LDAPLocalException - Occurs when a message is written out of sequence, i.e. a response is written into a batchRequest.
java.io.IOException - if an I/O error occurs.

writeEntry

public void writeEntry(LDAPEntry entry)
                throws LDAPLocalException
Write an LDAP record into LDIF file as LDAPContent data. An LDAPEntry is written as a DSML SearchResultEntry record.

You are not allowed to mix request data and content data

Specified by:
writeEntry in interface LDAPWriter
Parameters:
entry - LDAPEntry object
Throws:
LDAPLocalException - if data and content are mixed.
LDAPLocalException - if an I/O error occurs.
See Also:
LDAPEntry

writeEntry

public void writeEntry(LDAPEntry entry,
                       LDAPControl[] controls)
                throws LDAPLocalException
Write an LDAP record into LDIF file as LDAPContent data. An LDAPEntry is written as a DSML SearchResultEntry record.

You are not allowed to mix request data and content data

Specified by:
writeEntry in interface LDAPWriter
Parameters:
entry - LDAPEntry object
controls - Controls that were returned with this entry
Throws:
LDAPLocalException - if data and content are mixed.
See Also:
LDAPEntry

writeEntry

public void writeEntry(LDAPEntry entry,
                       LDAPControl[] controls,
                       java.lang.String requestID)
                throws LDAPLocalException
Write an LDAP record into LDIF file as LDAPContent data. An LDAPEntry is written as a DSML SearchResultEntry record.

You are not allowed to mix request data and content data

Parameters:
entry - object
controls - Controls that were returned with this entry
requestID - the String that associates this response with the request
Throws:
LDAPLocalException - if data and content are mixed.
See Also:
LDAPEntry

message2Element

public org.w3c.dom.Element message2Element(LDAPMessage message)
Utility method to convert an LDAPMessage to a DSML DOM element.

Parameters:
message - An LDAPMessage to be converted to a DSML DOM element.
Returns:
element A DOM element representing either a response or a request in DSML.

writeError

public void writeError(java.lang.Exception e)
                throws java.io.IOException
Any Exception can be written in DSML with this method, via the tag. In general LDAPExceptions should be written to the errorResponse tag and other exception in a SOAP Fault.

Specified by:
writeError in interface LDAPWriter
Parameters:
e - LDAPException to be written in DSML.
Throws:
java.io.IOException

getRootElement

public org.w3c.dom.Element getRootElement()
Retrieves the batchRequest or batchResponse element populated with this writer.

Returns:
A batchRequest or batchResponse element.

finish

public void finish()
            throws java.io.IOException
Description copied from interface: LDAPWriter
Writes any remaining data to the output destination.

Specified by:
finish in interface LDAPWriter
Throws:
java.io.IOException

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