Class Directory

java.lang.Object
org.bedework.util.directory.common.Directory
All Implemented Interfaces:
org.bedework.util.logging.Logged
Direct Known Subclasses:
LdapDirectory, Ldif

public abstract class Directory extends Object implements org.bedework.util.logging.Logged
Provide access to directory services. If the object is provided with a Properties object it will be queried for a number of properties. If they are absent or no Properties object is provided they will default to some value. Properties are defined in javax.naming.Context and are: java.naming.factory.initial java.naming.provider.url Service provider, e.g. ldap://ldap.example.com:389 java.naming.security.authentication e.g. "simple" java.naming.security.principal e.g. cn=dirManager java.naming.security.credentials Usually the password The intention is that this class should be able to represent various forms of directory, even a sequential input stream of records.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
    static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    All other constructors just call init
    Directory(String mngrDN, String pw)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
     
    abstract boolean
     
    abstract void
     
    abstract void
     
    newRecord(String entryDn)
    newRecord - Return a record which can have attribute values added.
    abstract DirRecord
     
    abstract void
    If possible, reInit should allow reuse after a close
    abstract void
    replace(String dn, String attrName, Object val)
    Replace an entire attribute with one containing only the given value
    abstract void
    replace(String dn, String attrName, Object[] val)
    Replace an entire attribute with one containing only the given values
    abstract void
    replace(String dn, String attrName, Object oldval, Object newval)
    Replace a single given attribute value with the given value
    boolean
    search(String base, String filter)
    Carry out a subtree search
    abstract boolean
    search(String base, String filter, int scope)
    Carry out a search with specified scope.
    boolean
    searchBase(String base, String filter)
    Carry out a base level search.
    boolean
    searchOne(String base, String filter)
    Carry out a one level search

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.bedework.util.logging.Logged

    audit, debug, debug, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogger, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
  • Field Details

  • Constructor Details

  • Method Details

    • reInit

      public abstract void reInit() throws NamingException
      If possible, reInit should allow reuse after a close
      Throws:
      NamingException - on fatal error
    • destroy

      public abstract void destroy(String dn) throws NamingException
      Parameters:
      dn -
      Throws:
      NamingException - on fatal error
    • search

      public boolean search(String base, String filter) throws NamingException
      Carry out a subtree search
      Parameters:
      base - for search
      filter - ldap filter
      Returns:
      DirSearchResult
      Throws:
      NamingException
    • searchBase

      public boolean searchBase(String base, String filter) throws NamingException
      Carry out a base level search. This should be the default if the scope is not specified.
      Parameters:
      base - for search
      filter - ldap filter
      Returns:
      DirSearchResult or null
      Throws:
      NamingException - on fatal error
    • searchOne

      public boolean searchOne(String base, String filter) throws NamingException
      Carry out a one level search
      Parameters:
      base - for search
      filter - ldap filter
      Returns:
      DirSearchResult
      Throws:
      NamingException - on fatal error
    • search

      public abstract boolean search(String base, String filter, int scope) throws NamingException
      Carry out a search with specified scope.
      Parameters:
      base - for search
      filter - ldap filter
      scope -
      Returns:
      false means no record(s) found. true means it's safe to call nextRecord.
      Throws:
      NamingException
    • nextRecord

      public abstract DirRecord nextRecord() throws NamingException
      Throws:
      NamingException
    • newRecord

      public DirRecord newRecord(String entryDn) throws NamingException
      newRecord - Return a record which can have attribute values added. create should be called to create the directory entry.
      Parameters:
      entryDn -
      Returns:
      DirRecord
      Throws:
      NamingException - on fatal error
    • create

      public abstract boolean create(DirRecord rec) throws NamingException
      Parameters:
      rec - directory record
      Returns:
      boolean true if created, false if already exists
      Throws:
      NamingException - on fatal error
    • replace

      public abstract void replace(String dn, String attrName, Object val) throws NamingException
      Replace an entire attribute with one containing only the given value
      Parameters:
      dn - for record
      attrName - name of attribute
      val - new value
      Throws:
      NamingException - on fatal error
    • replace

      public abstract void replace(String dn, String attrName, Object[] val) throws NamingException
      Replace an entire attribute with one containing only the given values
      Parameters:
      dn - for record
      attrName - name of attribute
      val - new value
      Throws:
      NamingException - on fatal error
    • replace

      public abstract void replace(String dn, String attrName, Object oldval, Object newval) throws NamingException
      Replace a single given attribute value with the given value
      Parameters:
      dn - for record
      attrName - name of attribute
      oldval - current value
      newval - new value
      Throws:
      NamingException - on fatal error
    • modify

      public abstract void modify(String dn, ModificationItem[] mods) throws NamingException
      Parameters:
      dn - for record
      mods - list of changes
      Throws:
      NamingException - on fatal error
    • close

      public abstract void close()