public class Dsmlv1Writer extends java.lang.Object implements SearchResultWriter
SearchResult as DSML version 1 to a Writer.| Modifier and Type | Field and Description |
|---|---|
private static javax.xml.parsers.DocumentBuilderFactory |
DOC_BUILDER_FACTORY
Document builder factory.
|
private java.io.Writer |
dsmlWriter
Writer to write to.
|
private java.util.Map<java.lang.String,java.lang.String> |
outputProperties
Transformer output properties.
|
private static javax.xml.transform.TransformerFactory |
TRANSFORMER_FACTORY
Transformer factory.
|
| Constructor and Description |
|---|
Dsmlv1Writer(java.io.Writer writer)
Creates a new dsml writer.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.w3c.dom.Element |
createAttrElement(org.w3c.dom.Document doc,
LdapAttribute attr)
Returns a
|
protected org.w3c.dom.Document |
createDsml(SearchResult result)
Creates DSML that corresponds to the supplied search result.
|
protected java.util.List<org.w3c.dom.Element> |
createDsmlAttributes(org.w3c.dom.Document doc,
java.util.Collection<LdapAttribute> attrs)
Returns a list of
|
protected org.w3c.dom.Element |
createObjectclassElement(org.w3c.dom.Document doc,
LdapAttribute attr)
Returns a
|
java.util.Map<java.lang.String,java.lang.String> |
getOutputProperties()
Returns the transformer output properties used by this writer.
|
protected void |
setAttrValue(org.w3c.dom.Document doc,
org.w3c.dom.Element valueElement,
java.lang.String value,
boolean isBase64)
Adds the supplied string to the value element.
|
void |
setOutputProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Sets the transformer output properties used by this writer.
|
void |
write(SearchResult result)
Writes the supplied search result to the writer.
|
private static final javax.xml.parsers.DocumentBuilderFactory DOC_BUILDER_FACTORY
private static final javax.xml.transform.TransformerFactory TRANSFORMER_FACTORY
private final java.io.Writer dsmlWriter
private java.util.Map<java.lang.String,java.lang.String> outputProperties
Transformer.setOutputProperty(String, String).public Dsmlv1Writer(java.io.Writer writer)
writer - to write DSML topublic java.util.Map<java.lang.String,java.lang.String> getOutputProperties()
public void setOutputProperties(java.util.Map<java.lang.String,java.lang.String> properties)
properties - transformer output propertiespublic void write(SearchResult result) throws java.io.IOException
write in interface SearchResultWriterresult - search result to writejava.io.IOException - if an error occurs using the writerprotected org.w3c.dom.Document createDsml(SearchResult result) throws javax.xml.parsers.ParserConfigurationException
result - search result to parsejavax.xml.parsers.ParserConfigurationException - if a document builder cannot be createdprotected java.util.List<org.w3c.dom.Element> createDsmlAttributes(org.w3c.dom.Document doc,
java.util.Collection<LdapAttribute> attrs)
doc - to source elements fromattrs - to iterate overprotected org.w3c.dom.Element createAttrElement(org.w3c.dom.Document doc,
LdapAttribute attr)
doc - to source elements fromattr - ldap attribute to addprotected org.w3c.dom.Element createObjectclassElement(org.w3c.dom.Document doc,
LdapAttribute attr)
doc - to source elements fromattr - ldap attribute to addprotected void setAttrValue(org.w3c.dom.Document doc,
org.w3c.dom.Element valueElement,
java.lang.String value,
boolean isBase64)
doc - to create nodes withvalueElement - to append value tovalue - to create node forisBase64 - whether the value is base64 encoded