|
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.DSMLWriter
public class DSMLWriter
Writes LDAPMessages into a Writer or outputStream as DSML batch requests and batch responses.
DSMLReader
,
DOMWriter
,
LDAPMessage
Field Summary | |
---|---|
private static java.lang.String |
BATCH_REQUEST_START
|
private static java.lang.String |
BATCH_RESPONSE_START
|
private static boolean |
fswitch
|
private boolean |
indent
|
private static int |
NEW_BATCH
|
private java.io.Writer |
out
|
private static int |
REQUEST_BATCH
|
private static int |
RESPONSE_BATCH
|
private boolean |
resumeOnError
|
private static int |
SEARCH_TAG
|
private int |
state
|
private java.lang.String |
tabString
|
private boolean |
useSOAP
|
private java.lang.String |
version
|
Constructor Summary | |
---|---|
DSMLWriter(java.io.OutputStream stream)
Initializes this writer with the specified outputstream to write DSML into. |
|
DSMLWriter(java.lang.String file)
Initializes this writer by opening the specified file to write DSML into. |
|
DSMLWriter(java.io.Writer writer)
Initializes this writer with the specified writer to write DSML into. |
Method Summary | |
---|---|
private static java.lang.String |
byteString(byte[] value)
Convert a UTF8 encoded string, or binary data, into a String encoded for a string filter. |
private void |
checkState(boolean isResponse)
Tests the current state with a new message that is either a response or request. |
void |
finish()
Writes closing tags for searchResponse, batchRequests, and batchResponse depending on the current state. |
java.lang.String |
getVersion()
Gets the version of the LDIF data associated with the input stream |
boolean |
isRequest()
Returns true if request data ist associated with the input stream, or false if content data. |
boolean |
isUseSOAP()
|
private boolean |
isXMLSafe(byte[] val)
|
private java.lang.String |
makeAttributeSafe(java.lang.String attrib)
|
private java.lang.String |
makeXMLSafe(java.lang.String msg)
|
private void |
newLine(int indentTabs)
Writes a new line and then the specified number of indentTabs to indent the next characters to be written. |
void |
setIndent(int spaces)
Sets the number of spaces for indentation of XML tags. |
void |
setResumeOnError(boolean resumeOnError)
|
void |
setUseSOAP(boolean useSOAP)
|
void |
useIndent(boolean useIndent)
Turns on or off 'pretty-printing' of XML with newlines and indentation to make output more readable. |
private void |
writeAddRequest(LDAPAddRequest request)
Writes the Add request requested within a LDAP Add request |
private void |
writeAddRequestEntry(LDAPAddRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
private void |
writeAttribute(LDAPAttribute attr)
Used to write an attribute and its values. |
void |
writeComments(java.lang.String lines)
Writes the specified strings as XML comments. |
private void |
writeCompareRequest(LDAPCompareRequest request)
Writes the Compare request requested within a LDAP Compare request |
private void |
writeCompareRequestEntry(LDAPCompareRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
private void |
writeControls(LDAPControl[] controls,
int indent)
Writes a control in DSML. |
private void |
writeDeleteRequest(LDAPDeleteRequest request)
Writes the Delete request requested within a LDAP Delete request |
private void |
writeDeleteRequestEntry(LDAPDeleteRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
void |
writeEntry(LDAPEntry entry)
Write an LDAP entry into LDIF file as LDAPContent data. |
void |
writeEntry(LDAPEntry entry,
LDAPControl[] controls)
Write an LDAP entry into LDIF file as LDAPContent data. |
void |
writeEntry(LDAPEntry entry,
LDAPControl[] controls,
java.lang.String requestID)
Write an LDAP entry 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 |
writeExtendedRequest(LDAPExtendedRequest request)
Writes the Extended request requested within a LDAP Extended request |
private void |
writeExtendedRequestEntry(LDAPExtendedRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
private void |
writeFilter(java.util.Iterator itr)
|
void |
writeMessage(LDAPMessage messageToWrite)
Writes an LDAPMessage as DSML. |
private void |
writeModifyDNRequest(LDAPModifyDNRequest request)
Writes the Modify request requested within a LDAP Modify request |
private void |
writeModifyDNRequestEntry(LDAPModifyDNRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
private void |
writeModifyRequest(LDAPModifyRequest request)
Writes the Modify request requested within a LDAP Modify request |
private void |
writeModifyRequestEntry(LDAPModifyRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
private void |
writeResult(LDAPResponse result,
int indent)
Writes all information associated with a result such as controls, referrals, result code with description, and any server message. |
private void |
writeSearchRequest(LDAPSearchRequest request)
Writes the Search request requested within a LDAP search request |
private void |
writeSearchRequestEntry(LDAPSearchRequest request,
LDAPControl[] controls,
java.lang.String requestID)
|
private void |
writeSearchResponse(LDAPSearchResult result)
Writes the entries returned within search responses. |
private void |
writeSearchResultReference(LDAPSearchResultReference ref)
Writes referrences that are returned from a search. |
private void |
writeTagWithID(java.lang.String tag,
LDAPMessage message)
Writes an XML tag with it's requestID and possibly a matchedDN. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static boolean fswitch
private java.io.Writer out
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_TAG
private boolean indent
private java.lang.String tabString
private java.lang.String version
private boolean useSOAP
private boolean resumeOnError
private static final java.lang.String BATCH_REQUEST_START
private static final java.lang.String BATCH_RESPONSE_START
Constructor Detail |
---|
public DSMLWriter(java.lang.String file) throws java.io.FileNotFoundException
file
- File to write DSML
java.io.FileNotFoundException
- occurs when the specified file could not
be opened or is not found.public DSMLWriter(java.io.OutputStream stream)
stream
- Output stream to write DSMLpublic DSMLWriter(java.io.Writer writer)
writer
- Writer to write DSMLMethod Detail |
---|
public void setResumeOnError(boolean resumeOnError)
public void writeError(java.lang.Exception e) throws java.io.IOException
writeError
in interface LDAPWriter
e
- LDAPException to be written in DSML.
java.io.IOException
public void finish() throws java.io.IOException
finish
in interface LDAPWriter
java.io.IOException
public void writeComments(java.lang.String lines) throws java.io.IOException
writeComments
in interface LDAPWriter
lines
- Comments to be written
java.io.IOException
public void writeMessage(LDAPMessage messageToWrite) throws java.io.IOException, LDAPLocalException
writeMessage
in interface LDAPWriter
messageToWrite
- Message to be written as DSML
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 java.io.IOException, LDAPLocalException
You are not allowed to mix request data and content data
writeEntry
in interface LDAPWriter
entry
- LDAPEntry object
java.io.IOException
- if an I/O error occurs.
LDAPLocalException
LDAPEntry
public void writeEntry(LDAPEntry entry, LDAPControl[] controls) throws java.io.IOException, LDAPLocalException
You are not allowed to mix request data and content data
writeEntry
in interface LDAPWriter
entry
- LDAPEntry objectcontrols
- Controls that were returned with this entry
java.io.IOException
- if an I/O error occurs.
LDAPLocalException
LDAPEntry
public void writeEntry(LDAPEntry entry, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
You are not allowed to mix request data and content data
entry
- LDAPEntry objectcontrols
- Controls that were returned with this entryrequestID
- the String that associates this response with the request
java.io.IOException
- if an I/O error occurs.
LDAPLocalException
LDAPEntry
private static java.lang.String byteString(byte[] value)
private void writeFilter(java.util.Iterator itr) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeModifyDNRequestEntry(LDAPModifyDNRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeModifyRequestEntry(LDAPModifyRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeDeleteRequestEntry(LDAPDeleteRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeExtendedRequestEntry(LDAPExtendedRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeCompareRequestEntry(LDAPCompareRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeAddRequestEntry(LDAPAddRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeSearchRequestEntry(LDAPSearchRequest request, LDAPControl[] controls, java.lang.String requestID) throws java.io.IOException, LDAPLocalException
java.io.IOException
LDAPLocalException
private void writeTagWithID(java.lang.String tag, LDAPMessage message) throws java.io.IOException
tag
- XML tag name to be writtenmessage
- LDAPMessage containing a requestID and possibly matchedDN
values to be written with the tag
java.io.IOException
public java.lang.String getVersion()
getVersion
in interface LDAPWriter
public boolean isRequest()
isRequest
in interface LDAPWriter
private void writeResult(LDAPResponse result, int indent) throws java.io.IOException
result
- result to be writtenindent
- number of indentation this result should use for writing
java.io.IOException
private void writeControls(LDAPControl[] controls, int indent) throws java.io.IOException
Used by writeResult and by the searchResponse case in writeMessage.
controls
- Controls to be writtenindent
- Size of indentation for writting.
java.io.IOException
private void writeSearchResultReference(LDAPSearchResultReference ref) throws java.io.IOException
ref
- search reference
java.io.IOException
private void writeSearchResponse(LDAPSearchResult result) throws java.io.IOException, LDAPLocalException
result
- a search result entry
java.io.IOException
LDAPLocalException
private void writeSearchRequest(LDAPSearchRequest request) throws java.io.IOException, LDAPLocalException
request
- a search request entry
java.io.IOException
LDAPLocalException
private void writeAddRequest(LDAPAddRequest request) throws java.io.IOException, LDAPLocalException
request
- a search request entry
java.io.IOException
LDAPLocalException
private void writeCompareRequest(LDAPCompareRequest request) throws java.io.IOException, LDAPLocalException
request
- a search request entry
java.io.IOException
LDAPLocalException
private void writeModifyRequest(LDAPModifyRequest request) throws java.io.IOException, LDAPLocalException
request
- a search request entry
java.io.IOException
LDAPLocalException
private void writeModifyDNRequest(LDAPModifyDNRequest request) throws java.io.IOException, LDAPLocalException
request
- a search request entry
java.io.IOException
LDAPLocalException
private void writeDeleteRequest(LDAPDeleteRequest request) throws java.io.IOException, LDAPLocalException
request
- a search request entry
java.io.IOException
LDAPLocalException
private void writeExtendedRequest(LDAPExtendedRequest request) throws java.io.IOException, LDAPLocalException
request
- a Extended request entry
java.io.IOException
LDAPLocalException
private void writeAttribute(LDAPAttribute attr) throws java.io.IOException
attr
- Attribute to be written.
java.io.IOException
private void checkState(boolean isResponse) throws java.io.IOException, LDAPLocalException
isResponse
- Indicates if the message to be written is a response
or not.
java.io.IOException
LDAPLocalException
private void newLine(int indentTabs) throws java.io.IOException
Allows the writer to 'pretty-print' XML output according to the number of tabs. The size of a tab is determined by tabString which is created by the method setIndent. No pretty-printing will occur if indent is set to false.
indentTabs
- number of tabs to indent.
java.io.IOException
public void useIndent(boolean useIndent)
For efficiency, useIndent is set to false by default. The size of an indentation can be set using the method setIndent.
useIndent
- Indicates whether indentation and newlines should be
written to make the output DSML more readable.setIndent(int)
public void setIndent(int spaces)
This setting is ignored by default unless indentation is turned on via the useIndent method.
spaces
- Number of spaces used in each indentation.useIndent(boolean)
private boolean isXMLSafe(byte[] val)
private java.lang.String makeXMLSafe(java.lang.String msg)
private java.lang.String makeAttributeSafe(java.lang.String attrib)
public boolean isUseSOAP()
public void setUseSOAP(boolean useSOAP)
useSOAP
- The useSOAP to set.
|
All LDAP Classes Internal LDAP Classes |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |