edu.vt.middleware.ldap.dsml
Class AbstractDsml

java.lang.Object
  extended by edu.vt.middleware.ldap.dsml.AbstractDsml
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Dsmlv1, Dsmlv2

public abstract class AbstractDsml
extends Object
implements Serializable

AbstractDsml contains functions for converting LDAP search result sets into DSML.

Version:
$Revision: 1330 $ $Date: 2010-05-23 18:10:53 -0400 (Sun, 23 May 2010) $
Author:
Middleware Services
See Also:
Serialized Form

Field Summary
protected  LdapBeanFactory beanFactory
          Ldap bean factory.
protected  org.apache.commons.logging.Log logger
          Log for this class.
 
Constructor Summary
AbstractDsml()
           
 
Method Summary
abstract  org.dom4j.Document createDsml(Iterator<SearchResult> results)
          This will take the results of a prior LDAP query and convert it to a DSML Document.
abstract  org.dom4j.Document createDsml(LdapResult result)
          This will take the results of a prior LDAP query and convert it to a DSML Document.
protected  org.dom4j.Element createDsmlAttribute(String attrName, Set<?> attrValues, org.dom4j.Namespace ns, String elementName, String elementAttrName, String elementValueName)
          This will take an attribute name and it's values and return a DSML attribute element.
protected  List<org.dom4j.Element> createDsmlAttributes(LdapAttributes ldapAttributes, org.dom4j.Namespace ns)
          This will return a list of DSML attribute elements from the supplied LdapAttributes.
protected  org.dom4j.Element createDsmlEntry(org.dom4j.QName entryName, LdapEntry ldapEntry, org.dom4j.Namespace ns)
          This will take an LDAP search result and convert it to a DSML entry element.
protected  LdapEntry createLdapEntry(org.dom4j.Element entryElement)
          This will take a DSML Element containing an entry of type and convert it to an LDAP entry.
protected abstract  LdapResult createLdapResult(org.dom4j.Document doc)
          This will take a DSML Document and convert it to an Iterator of LDAP search results.
 LdapBeanFactory getLdapBeanFactory()
          Returns the factory for creating ldap beans.
 Iterator<SearchResult> importDsml(Reader reader)
          This will take a Reader containing a DSML Document and convert it to an Iterator of LDAP search results.
 LdapResult importDsmlToLdapResult(Reader reader)
          This will take a Reader containing a DSML Document and convert it to an LdapResult.
 void outputDsml(Iterator<SearchResult> results, Writer writer)
          This will write the supplied LDAP search results to the supplied writer in the form of DSML.
 void outputDsml(LdapResult result, Writer writer)
          This will write the supplied LDAP result to the supplied writer in the form of DSML.
 void setLdapBeanFactory(LdapBeanFactory lbf)
          Sets the factory for creating ldap beans.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Log for this class.


beanFactory

protected LdapBeanFactory beanFactory
Ldap bean factory.

Constructor Detail

AbstractDsml

public AbstractDsml()
Method Detail

getLdapBeanFactory

public LdapBeanFactory getLdapBeanFactory()
Returns the factory for creating ldap beans.

Returns:
LdapBeanFactory

setLdapBeanFactory

public void setLdapBeanFactory(LdapBeanFactory lbf)
Sets the factory for creating ldap beans.

Parameters:
lbf - LdapBeanFactory

createDsml

public abstract org.dom4j.Document createDsml(Iterator<SearchResult> results)
This will take the results of a prior LDAP query and convert it to a DSML Document.

Parameters:
results - Iterator of LDAP search results
Returns:
Document

createDsml

public abstract org.dom4j.Document createDsml(LdapResult result)
This will take the results of a prior LDAP query and convert it to a DSML Document.

Parameters:
result - LdapResult
Returns:
Document

createDsmlEntry

protected org.dom4j.Element createDsmlEntry(org.dom4j.QName entryName,
                                            LdapEntry ldapEntry,
                                            org.dom4j.Namespace ns)
This will take an LDAP search result and convert it to a DSML entry element.

Parameters:
entryName - QName name of element to create
ldapEntry - LdapEntry to convert
ns - Namespace of DSML
Returns:
Document

createDsmlAttributes

protected List<org.dom4j.Element> createDsmlAttributes(LdapAttributes ldapAttributes,
                                                       org.dom4j.Namespace ns)
This will return a list of DSML attribute elements from the supplied LdapAttributes.

Parameters:
ldapAttributes - LdapAttributes
ns - Namespace of DSML
Returns:
List of elements

createDsmlAttribute

protected org.dom4j.Element createDsmlAttribute(String attrName,
                                                Set<?> attrValues,
                                                org.dom4j.Namespace ns,
                                                String elementName,
                                                String elementAttrName,
                                                String elementValueName)
This will take an attribute name and it's values and return a DSML attribute element.

Parameters:
attrName - String
attrValues - Set
ns - Namespace of DSML
elementName - String of the attribute element
elementAttrName - String of the attribute element
elementValueName - String of the value element
Returns:
Element

outputDsml

public void outputDsml(Iterator<SearchResult> results,
                       Writer writer)
                throws IOException
This will write the supplied LDAP search results to the supplied writer in the form of DSML.

Parameters:
results - Iterator of LDAP search results
writer - Writer to write to
Throws:
IOException - if an error occurs while writing

outputDsml

public void outputDsml(LdapResult result,
                       Writer writer)
                throws IOException
This will write the supplied LDAP result to the supplied writer in the form of DSML.

Parameters:
result - LdapResult
writer - Writer to write to
Throws:
IOException - if an error occurs while writing

importDsml

public Iterator<SearchResult> importDsml(Reader reader)
                                  throws org.dom4j.DocumentException,
                                         IOException
This will take a Reader containing a DSML Document and convert it to an Iterator of LDAP search results.

Parameters:
reader - Reader containing DSML content
Returns:
Iterator - of LDAP search results
Throws:
org.dom4j.DocumentException - if an error occurs building a document from the reader
IOException - if an I/O error occurs

importDsmlToLdapResult

public LdapResult importDsmlToLdapResult(Reader reader)
                                  throws org.dom4j.DocumentException,
                                         IOException
This will take a Reader containing a DSML Document and convert it to an LdapResult.

Parameters:
reader - Reader containing DSML content
Returns:
LdapResult
Throws:
org.dom4j.DocumentException - if an error occurs building a document from the reader
IOException - if an I/O error occurs

createLdapResult

protected abstract LdapResult createLdapResult(org.dom4j.Document doc)
This will take a DSML Document and convert it to an Iterator of LDAP search results.

Parameters:
doc - Document of DSML
Returns:
Iterator - of LDAP search results

createLdapEntry

protected LdapEntry createLdapEntry(org.dom4j.Element entryElement)
This will take a DSML Element containing an entry of type and convert it to an LDAP entry.

Parameters:
entryElement - Element of DSML content
Returns:
LdapEntry


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