Class AbstractDsml

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    Dsmlv1, Dsmlv2

    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 DSML Document.
      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 DSML Document.
      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 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.
      java.util.Iterator<javax.naming.directory.SearchResult> importDsml​(java.io.Reader reader)
      This will take a Reader containing a DSML Document and convert it to an Iterator of LDAP search results.
      LdapResult importDsmlToLdapResult​(java.io.Reader reader)
      This will take a Reader containing a DSML Document and convert it to an LdapResult.
      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.
      • 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.
    • 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​(java.util.Iterator<javax.naming.directory.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 java.util.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​(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 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​(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 results
        writer - 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 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
        java.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 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
        java.io.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