|
All LDAP Classes Internal LDAP Classes |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.novell.ldap.util.DOMWriter
public class DOMWriter
Writes LDAPMessages into a DOM structure as DSML batch requests and batch responses.
DOMReader,
DSMLWriter,
LDAPMessage| Field Summary | |
|---|---|
private org.w3c.dom.Document |
doc
|
private static int |
NEW_BATCH
|
private static int |
REQUEST_BATCH
|
private static int |
RESPONSE_BATCH
|
private org.w3c.dom.Element |
root
|
private static int |
SEARCH_RESPONSE
|
private org.w3c.dom.Element |
searchNode
|
private int |
state
|
| Constructor Summary | |
|---|---|
DOMWriter()
Initializes the DOMWriter. |
|
| Method Summary | |
|---|---|
private java.lang.String |
byte2String(byte[] value)
|
private void |
checkState(LDAPEntry entry)
Tests the current state with a new message that is either a response or request. |
private void |
checkState(LDAPMessage message)
Tests the current state with a new message that is either a response or request. |
(package private) static java.lang.String |
findRequestID(LDAPMessage message)
|
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. |
private org.w3c.dom.Element |
myWriteEntry(LDAPEntry entry,
LDAPControl[] controls)
|
private void |
writeAttribute(org.w3c.dom.Element attribute,
LDAPAttribute attr)
|
void |
writeComments(java.lang.String comments)
This method is not implemented and is silently ignored. |
private void |
writeControls(org.w3c.dom.Element e,
LDAPControl[] controls)
|
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 |
private void |
writeFilter(org.w3c.dom.Element e,
java.util.Iterator itr)
|
private void |
writeMatching(org.w3c.dom.Element newElement,
java.util.Iterator itr)
Common code for =, >=, <=, and ~=. |
void |
writeMessage(LDAPMessage message)
Writes the LDAPMessage into the DOMStructure. |
private void |
writeResult(org.w3c.dom.Element e,
LDAPResponse response)
Writes the specified LDAPResponse into the specified element. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private org.w3c.dom.Document doc
private org.w3c.dom.Element root
private int state
private static final int NEW_BATCH
private static final int REQUEST_BATCH
private static final int RESPONSE_BATCH
private static final int SEARCH_RESPONSE
private org.w3c.dom.Element searchNode
| Constructor Detail |
|---|
public DOMWriter()
throws javax.xml.parsers.ParserConfigurationException
javax.xml.parsers.ParserConfigurationException - Occurs if a parser could not be found or is misconfigured.| Method Detail |
|---|
public java.lang.String getVersion()
getVersion in interface LDAPWriterpublic boolean isRequest()
isRequest in interface LDAPWriter
public void writeComments(java.lang.String comments)
throws java.io.IOException
writeComments in interface LDAPWritercomments - The comments to write
java.io.IOException
public void writeMessage(LDAPMessage message)
throws LDAPLocalException,
java.io.IOException
writeMessage in interface LDAPWritermessage - LDAPMessage to write
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.
public void writeEntry(LDAPEntry entry)
throws LDAPLocalException
You are not allowed to mix request data and content data
writeEntry in interface LDAPWriterentry - LDAPEntry object
LDAPLocalException - if data and content are mixed.
LDAPLocalException - if an I/O error occurs.LDAPEntry
public void writeEntry(LDAPEntry entry,
LDAPControl[] controls)
throws LDAPLocalException
You are not allowed to mix request data and content data
writeEntry in interface LDAPWriterentry - LDAPEntry objectcontrols - Controls that were returned with this entry
LDAPLocalException - if data and content are mixed.LDAPEntry
public void writeEntry(LDAPEntry entry,
LDAPControl[] controls,
java.lang.String requestID)
throws LDAPLocalException
You are not allowed to mix request data and content data
entry - objectcontrols - Controls that were returned with this entryrequestID - the String that associates this response with the request
LDAPLocalException - if data and content are mixed.LDAPEntry
private org.w3c.dom.Element myWriteEntry(LDAPEntry entry,
LDAPControl[] controls)
private void writeAttribute(org.w3c.dom.Element attribute,
LDAPAttribute attr)
public org.w3c.dom.Element message2Element(LDAPMessage message)
message - An LDAPMessage to be converted to a DSML DOM element.
private void writeMatching(org.w3c.dom.Element newElement,
java.util.Iterator itr)
private void writeFilter(org.w3c.dom.Element e,
java.util.Iterator itr)
e - element to add a DSML search filter component (filter or a
AND, OR or NOT )itr - private java.lang.String byte2String(byte[] value)
private void writeResult(org.w3c.dom.Element e,
LDAPResponse response)
Possible information written to the element is a Result code with a description, a server response, and a matched DN. Controls and referrals should also be written - and will be in the future.
e - Element to insert response info into.response - Response message to write.
private void writeControls(org.w3c.dom.Element e,
LDAPControl[] controls)
public void writeError(java.lang.Exception e)
throws java.io.IOException
writeError in interface LDAPWritere - LDAPException to be written in DSML.
java.io.IOException
private void checkState(LDAPMessage message)
throws LDAPLocalException
If the state is NEW_BATCH, check_state will create the appropriate batch element and set it as root. If the state is SEARCH_RESPONSE then the new message is verified to be a search result, search response or search reference.
message - Message to be written
LDAPLocalException
private void checkState(LDAPEntry entry)
throws LDAPLocalException
If the state is NEW_BATCH, check_state will create the appropriate batch element and set it as root. If the state is SEARCH_RESPONSE then the new message is verified to be a search result, search response or search reference.
entry - Message to be written
LDAPLocalExceptionstatic java.lang.String findRequestID(LDAPMessage message)
public org.w3c.dom.Element getRootElement()
public void finish()
throws java.io.IOException
LDAPWriter
finish in interface LDAPWriterjava.io.IOException
|
All LDAP Classes Internal LDAP Classes |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||