Package org.bedework.util.directory.ldap
Class LdapDirectory
java.lang.Object
org.bedework.util.directory.common.Directory
org.bedework.util.directory.ldap.LdapDirectory
- All Implemented Interfaces:
org.bedework.util.logging.Logged
Provide access to ldap 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.myhost.edu:389
java.naming.security.authentication e.g. "simple"
java.naming.security.principal e.g. cn=dirManager
java.naming.security.credentials Usually the password
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor required so we can instantiate object dynamicallyLdapDirectory(Properties pr, String mngrDN, String pw) -
Method Summary
Modifier and TypeMethodDescriptioncheckProp(Properties pr, String name, String defaultVal) If the named property is present and has a value use that.voidclose()booleanvoidorg.bedework.util.logging.BwLoggervoidinit(Properties pr, String mngrDN, String pw) voidmodify(String dn, ModificationItem[] mods) voidreInit()If possible, reInit should allow reuse after a closevoidReplace an entire attribute with one containing only the given valuevoidReplace an entire attribute with one containing only the given valuesvoidReplace a single given attribute value with the given valuebooleanCarry out a search with specified scope.Methods inherited from class org.bedework.util.directory.common.Directory
newRecord, search, searchBase, searchOneMethods 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, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, trace, warn
-
Constructor Details
-
LdapDirectory
Constructor required so we can instantiate object dynamically- Throws:
Exception
-
LdapDirectory
- Parameters:
pr-mngrDN-pw-- Throws:
NamingException
-
-
Method Details
-
init
- Throws:
NamingException
-
reInit
Description copied from class:DirectoryIf possible, reInit should allow reuse after a close- Specified by:
reInitin classDirectory- Throws:
NamingException- on fatal error
-
destroy
- Specified by:
destroyin classDirectory- Throws:
NamingException- on fatal error
-
search
Description copied from class:DirectoryCarry out a search with specified scope.- Specified by:
searchin classDirectory- Parameters:
base- for searchfilter- ldap filter- Returns:
- false means no record(s) found. true means it's safe to call nextRecord.
- Throws:
NamingException
-
nextRecord
- Specified by:
nextRecordin classDirectory- Throws:
NamingException
-
create
- Specified by:
createin classDirectory- Parameters:
rec- directory record- Returns:
- boolean true if created, false if already exists
- Throws:
NamingException- on fatal error
-
replace
Description copied from class:DirectoryReplace an entire attribute with one containing only the given value- Specified by:
replacein classDirectory- Parameters:
dn- for recordattrName- name of attributeval- new value- Throws:
NamingException- on fatal error
-
replace
Description copied from class:DirectoryReplace an entire attribute with one containing only the given values- Specified by:
replacein classDirectory- Parameters:
dn- for recordattrName- name of attributeval- new value- Throws:
NamingException- on fatal error
-
replace
public void replace(String dn, String attrName, Object oldval, Object newval) throws NamingException Description copied from class:DirectoryReplace a single given attribute value with the given value- Specified by:
replacein classDirectory- Parameters:
dn- for recordattrName- name of attributeoldval- current valuenewval- new value- Throws:
NamingException- on fatal error
-
modify
- Specified by:
modifyin classDirectory- Parameters:
dn- for recordmods- list of changes- Throws:
NamingException- on fatal error
-
getEnvironment
- Throws:
NamingException
-
close
public void close() -
checkProp
If the named property is present and has a value use that. Otherwise, set the value to the given default and use that.- Parameters:
pr-name-defaultVal-- Returns:
- String
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()
-