public class Dsmlv1Writer extends Object implements SearchResultWriter
SearchResult as DSML version 1 to a Writer.| Modifier and Type | Field and Description |
|---|---|
private static DocumentBuilderFactory |
DOC_BUILDER_FACTORY
Document builder factory.
|
private Writer |
dsmlWriter
Writer to write to.
|
private Map<String,String> |
outputProperties
Transformer output properties.
|
private static TransformerFactory |
TRANSFORMER_FACTORY
Transformer factory.
|
| Constructor and Description |
|---|
Dsmlv1Writer(Writer writer)
Creates a new dsml writer.
|
| Modifier and Type | Method and Description |
|---|---|
protected Element |
createAttrElement(Document doc,
LdapAttribute attr)
Returns a <dsml:attr/> element for the supplied ldap attribute.
|
protected Document |
createDsml(SearchResult result)
Creates DSML that corresponds to the supplied search result.
|
protected List<Element> |
createDsmlAttributes(Document doc,
Collection<LdapAttribute> attrs)
Returns a list of <dsml:attr/> elements for the supplied attributes.
|
protected Element |
createObjectclassElement(Document doc,
LdapAttribute attr)
Returns a <dsml:objectclass/> element for the supplied ldap attribute.
|
Map<String,String> |
getOutputProperties()
Returns the transformer output properties used by this writer.
|
protected void |
setAttrValue(Document doc,
Element valueElement,
String value,
boolean isBase64)
Adds the supplied string to the value element.
|
void |
setOutputProperties(Map<String,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 DocumentBuilderFactory DOC_BUILDER_FACTORY
private static final TransformerFactory TRANSFORMER_FACTORY
private final Writer dsmlWriter
private Map<String,String> outputProperties
Transformer.setOutputProperty(String, String).public Dsmlv1Writer(Writer writer)
writer - to write DSML topublic Map<String,String> getOutputProperties()
public void setOutputProperties(Map<String,String> properties)
properties - transformer output propertiespublic void write(SearchResult result) throws IOException
write in interface SearchResultWriterresult - search result to writeIOException - if an error occurs using the writerprotected Document createDsml(SearchResult result) throws ParserConfigurationException
result - search result to parseParserConfigurationException - if a document builder cannot be createdprotected List<Element> createDsmlAttributes(Document doc, Collection<LdapAttribute> attrs)
doc - to source elements fromattrs - to iterate overprotected Element createAttrElement(Document doc, LdapAttribute attr)
doc - to source elements fromattr - ldap attribute to addprotected Element createObjectclassElement(Document doc, LdapAttribute attr)
doc - to source elements fromattr - ldap attribute to addprotected void setAttrValue(Document doc, Element valueElement, String value, boolean isBase64)
doc - to create nodes withvalueElement - to append value tovalue - to create node forisBase64 - whether the value is base64 encodedCopyright © 2003-2019 Virginia Tech. All Rights Reserved.