org.ldaptive.io
Class Dsmlv1Writer

java.lang.Object
  extended by org.ldaptive.io.Dsmlv1Writer
All Implemented Interfaces:
SearchResultWriter

public class Dsmlv1Writer
extends Object
implements SearchResultWriter

Writes a SearchResult as DSML version 1 to a Writer.

Version:
$Revision: 2975 $ $Date: 2014-04-28 12:08:38 -0400 (Mon, 28 Apr 2014) $
Author:
Middleware Services

Constructor Summary
Dsmlv1Writer(Writer writer)
          Creates a new dsml writer.
 
Method Summary
protected  Element createAttrElement(Document doc, LdapAttribute attr)
          Returns a 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 elements for the supplied attributes.
protected  Element createObjectclassElement(Document doc, LdapAttribute attr)
          Returns a 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Dsmlv1Writer

public Dsmlv1Writer(Writer writer)
Creates a new dsml writer. The following transformer output properties are set by default:

Parameters:
writer - to write DSML to
Method Detail

getOutputProperties

public Map<String,String> getOutputProperties()
Returns the transformer output properties used by this writer.

Returns:
transformer output properties

setOutputProperties

public void setOutputProperties(Map<String,String> properties)
Sets the transformer output properties used by this writer.

Parameters:
properties - transformer output properties

write

public void write(SearchResult result)
           throws IOException
Writes the supplied search result to the writer.

Specified by:
write in interface SearchResultWriter
Parameters:
result - search result to write
Throws:
IOException - if an error occurs using the writer

createDsml

protected Document createDsml(SearchResult result)
                       throws ParserConfigurationException
Creates DSML that corresponds to the supplied search result.

Parameters:
result - search result to parse
Returns:
DSML
Throws:
ParserConfigurationException - if a document builder cannot be created

createDsmlAttributes

protected List<Element> createDsmlAttributes(Document doc,
                                             Collection<LdapAttribute> attrs)
Returns a list of elements for the supplied attributes.

Parameters:
doc - to source elements from
attrs - to iterate over
Returns:
list of elements contains attributes

createAttrElement

protected Element createAttrElement(Document doc,
                                    LdapAttribute attr)
Returns a element for the supplied ldap attribute.

Parameters:
doc - to source elements from
attr - ldap attribute to add
Returns:
element containing the attribute

createObjectclassElement

protected Element createObjectclassElement(Document doc,
                                           LdapAttribute attr)
Returns a element for the supplied ldap attribute.

Parameters:
doc - to source elements from
attr - ldap attribute to add
Returns:
element containing the attribute values

setAttrValue

protected void setAttrValue(Document doc,
                            Element valueElement,
                            String value,
                            boolean isBase64)
Adds the supplied string to the value element.

Parameters:
doc - to create nodes with
valueElement - to append value to
value - to create node for
isBase64 - whether the value is base64 encoded


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.