Class Directory
java.lang.Object
org.bedework.util.directory.common.Directory
- All Implemented Interfaces:
org.bedework.util.logging.Logged
- Direct Known Subclasses:
LdapDirectory,Ldif
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclose()abstract booleanabstract voidabstract voidmodify(String dn, ModificationItem[] mods) newRecord - Return a record which can have attribute values added.abstract DirRecordabstract voidreInit()If possible, reInit should allow reuse after a closeabstract voidReplace an entire attribute with one containing only the given valueabstract voidReplace an entire attribute with one containing only the given valuesabstract voidReplace a single given attribute value with the given valuebooleanCarry out a subtree searchabstract booleanCarry out a search with specified scope.booleansearchBase(String base, String filter) Carry out a base level search.booleanCarry out a one level searchMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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
-
scopeBase
public static final int scopeBase- See Also:
-
scopeOne
public static final int scopeOne- See Also:
-
scopeSub
public static final int scopeSub- See Also:
-
-
Constructor Details
-
Directory
All other constructors just call init- Throws:
NamingException
-
Directory
- Throws:
NamingException
-
-
Method Details
-
reInit
If possible, reInit should allow reuse after a close- Throws:
NamingException- on fatal error
-
destroy
- Parameters:
dn-- Throws:
NamingException- on fatal error
-
search
Carry out a subtree search- Parameters:
base- for searchfilter- ldap filter- Returns:
- DirSearchResult
- Throws:
NamingException
-
searchBase
Carry out a base level search. This should be the default if the scope is not specified.- Parameters:
base- for searchfilter- ldap filter- Returns:
- DirSearchResult or null
- Throws:
NamingException- on fatal error
-
searchOne
Carry out a one level search- Parameters:
base- for searchfilter- ldap filter- Returns:
- DirSearchResult
- Throws:
NamingException- on fatal error
-
search
Carry out a search with specified scope.- Parameters:
base- for searchfilter- ldap filterscope-- Returns:
- false means no record(s) found. true means it's safe to call nextRecord.
- Throws:
NamingException
-
nextRecord
- Throws:
NamingException
-
newRecord
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
- Parameters:
rec- directory record- Returns:
- boolean true if created, false if already exists
- Throws:
NamingException- on fatal error
-
replace
Replace an entire attribute with one containing only the given value- Parameters:
dn- for recordattrName- name of attributeval- new value- Throws:
NamingException- on fatal error
-
replace
Replace an entire attribute with one containing only the given values- Parameters:
dn- for recordattrName- name of attributeval- 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 recordattrName- name of attributeoldval- current valuenewval- new value- Throws:
NamingException- on fatal error
-
modify
- Parameters:
dn- for recordmods- list of changes- Throws:
NamingException- on fatal error
-
close
public abstract void close()
-