Package edu.vt.middleware.ldap.dsml
Class AbstractDsml
- java.lang.Object
-
- edu.vt.middleware.ldap.dsml.AbstractDsml
-
- All Implemented Interfaces:
java.io.Serializable
public abstract class AbstractDsml extends java.lang.Object implements java.io.Serializable
AbstractDsml
contains functions for converting LDAP search result sets into DSML.- Version:
- $Revision: 1330 $ $Date: 2010-05-24 00:10:53 +0200 (Mon, 24 May 2010) $
- Author:
- Middleware Services
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected LdapBeanFactory
beanFactory
Ldap bean factory.protected org.apache.commons.logging.Log
logger
Log for this class.
-
Constructor Summary
Constructors Constructor Description AbstractDsml()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract org.dom4j.Document
createDsml(LdapResult result)
This will take the results of a prior LDAP query and convert it to a DSMLDocument
.abstract org.dom4j.Document
createDsml(java.util.Iterator<javax.naming.directory.SearchResult> results)
This will take the results of a prior LDAP query and convert it to a DSMLDocument
.protected org.dom4j.Element
createDsmlAttribute(java.lang.String attrName, java.util.Set<?> attrValues, org.dom4j.Namespace ns, java.lang.String elementName, java.lang.String elementAttrName, java.lang.String elementValueName)
This will take an attribute name and it's values and return a DSML attribute element.protected java.util.List<org.dom4j.Element>
createDsmlAttributes(LdapAttributes ldapAttributes, org.dom4j.Namespace ns)
This will return a list of DSML attribute elements from the suppliedLdapAttributes
.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 DSMLElement
containing an entry of typeand convert it to an LDAP entry. protected abstract LdapResult
createLdapResult(org.dom4j.Document doc)
This will take a DSMLDocument
and convert it to an Iterator of LDAP search results.LdapBeanFactory
getLdapBeanFactory()
Returns the factory for creating ldap beans.java.util.Iterator<javax.naming.directory.SearchResult>
importDsml(java.io.Reader reader)
This will take a Reader containing a DSMLDocument
and convert it to an Iterator of LDAP search results.LdapResult
importDsmlToLdapResult(java.io.Reader reader)
This will take a Reader containing a DSMLDocument
and convert it to anLdapResult
.void
outputDsml(LdapResult result, java.io.Writer writer)
This will write the supplied LDAP result to the supplied writer in the form of DSML.void
outputDsml(java.util.Iterator<javax.naming.directory.SearchResult> results, java.io.Writer writer)
This will write the supplied LDAP search results to the supplied writer in the form of DSML.void
setLdapBeanFactory(LdapBeanFactory lbf)
Sets the factory for creating ldap beans.
-
-
-
Field Detail
-
logger
protected final org.apache.commons.logging.Log logger
Log for this class.
-
beanFactory
protected LdapBeanFactory beanFactory
Ldap bean factory.
-
-
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(java.util.Iterator<javax.naming.directory.SearchResult> results)
This will take the results of a prior LDAP query and convert it to a DSMLDocument
.- 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 DSMLDocument
.- 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 createldapEntry
-LdapEntry
to convertns
-Namespace
of DSML- Returns:
Document
-
createDsmlAttributes
protected java.util.List<org.dom4j.Element> createDsmlAttributes(LdapAttributes ldapAttributes, org.dom4j.Namespace ns)
This will return a list of DSML attribute elements from the suppliedLdapAttributes
.- Parameters:
ldapAttributes
-LdapAttributes
ns
-Namespace
of DSML- Returns:
List
of elements
-
createDsmlAttribute
protected org.dom4j.Element createDsmlAttribute(java.lang.String attrName, java.util.Set<?> attrValues, org.dom4j.Namespace ns, java.lang.String elementName, java.lang.String elementAttrName, java.lang.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 DSMLelementName
-String
of the attribute elementelementAttrName
-String
of the attribute elementelementValueName
-String
of the value element- Returns:
Element
-
outputDsml
public void outputDsml(java.util.Iterator<javax.naming.directory.SearchResult> results, java.io.Writer writer) throws java.io.IOException
This will write the supplied LDAP search results to the supplied writer in the form of DSML.- Parameters:
results
-Iterator
of LDAP search resultswriter
-Writer
to write to- Throws:
java.io.IOException
- if an error occurs while writing
-
outputDsml
public void outputDsml(LdapResult result, java.io.Writer writer) throws java.io.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:
java.io.IOException
- if an error occurs while writing
-
importDsml
public java.util.Iterator<javax.naming.directory.SearchResult> importDsml(java.io.Reader reader) throws org.dom4j.DocumentException, java.io.IOException
This will take a Reader containing a DSMLDocument
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 readerjava.io.IOException
- if an I/O error occurs
-
importDsmlToLdapResult
public LdapResult importDsmlToLdapResult(java.io.Reader reader) throws org.dom4j.DocumentException, java.io.IOException
This will take a Reader containing a DSMLDocument
and convert it to anLdapResult
.- Parameters:
reader
-Reader
containing DSML content- Returns:
LdapResult
- Throws:
org.dom4j.DocumentException
- if an error occurs building a document from the readerjava.io.IOException
- if an I/O error occurs
-
createLdapResult
protected abstract LdapResult createLdapResult(org.dom4j.Document doc)
This will take a DSMLDocument
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 DSMLElement
containing an entry of typeand convert it to an LDAP entry. - Parameters:
entryElement
-Element
of DSML content- Returns:
LdapEntry
-
-