Package org.bedework.util.directory.ldif
Class Ldif
- java.lang.Object
-
- org.bedework.util.directory.common.Directory
-
- org.bedework.util.directory.ldif.Ldif
-
- All Implemented Interfaces:
org.bedework.util.logging.Logged
public class Ldif extends Directory
This class provides methods to read ldif data from an input stream. The stream is considered to be broken up into lines, starting at line 1 each of which contains an ldif item, start of attribute + value, continuation or record terminator (null line). Methods allow us to position in the stream, read an entire ldif record, or convert a record to a tabular form for processing. Various Directory methods probably have no meaning here, searches will typically fail with an exception or be ignored.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLdif.LdifOutLdifOut - out method is called to write ldif output
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleancreate(DirRecord rec)voiddestroy(String dn)static voiddumpAttr(Ldif.LdifOut lo, Attribute a)static voiddumpLdif(Ldif.LdifOut lo, DirRecord rec)dumpLdif write the entire record as ldif.org.bedework.util.logging.BwLoggergetLogger()voidmodify(String dn, ModificationItem[] mods)DirRecordnextRecord()Return the next record in the input stream.voidreInit()If possible, reInit should allow reuse after a closevoidreplace(String dn, String attrName, Object val)Replace an entire attribute with one containing only the given valuevoidreplace(String dn, String attrName, Object[] val)Replace an entire attribute with one containing only the given valuesvoidreplace(String dn, String attrName, Object oldval, Object newval)Replace a single given attribute value with the given valuebooleansearch(String dn, String filter, int scope)search-
Methods inherited from class org.bedework.util.directory.common.Directory
newRecord, search, searchBase, searchOne
-
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, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, error, getLogLevel, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsDebugEnabled, isMetricsLoggerEnabled, metrics, setLoggerClass, setLoggerClass, trace, trace, warn
-
-
-
-
Constructor Detail
-
Ldif
public Ldif() throws ExceptionConstructor required so we can instantiate object dynamically- Throws:
Exception
-
Ldif
public Ldif(InputStream in) throws Exception
- Throws:
Exception
-
-
Method Detail
-
reInit
public void reInit()
Description copied from class:DirectoryIf possible, reInit should allow reuse after a close
-
destroy
public void destroy(String dn) throws NamingException
- Specified by:
destroyin classDirectory- Throws:
NamingException- on fatal error
-
search
public boolean search(String dn, String filter, int scope) throws NamingException
search- Specified by:
searchin classDirectory- Parameters:
dn- Used as the pathnamefilter- Ignoredscope- Ignored- Returns:
- false means no record(s) found. true means it's safe to call nextRecord.
- Throws:
NamingException
-
nextRecord
public DirRecord nextRecord() throws NamingException
Return the next record in the input stream.- Specified by:
nextRecordin classDirectory- Throws:
NamingException
-
create
public boolean create(DirRecord rec) throws NamingException
- Specified by:
createin classDirectory- Parameters:
rec- directory record- Returns:
- boolean true if created, false if already exists
- Throws:
NamingException- on fatal error
-
replace
public void replace(String dn, String attrName, Object val) throws NamingException
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
public void replace(String dn, String attrName, Object[] val) throws NamingException
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
public void modify(String dn, ModificationItem[] mods) throws NamingException
- Specified by:
modifyin classDirectory- Parameters:
dn- for recordmods- list of changes- Throws:
NamingException- on fatal error
-
dumpLdif
public static void dumpLdif(Ldif.LdifOut lo, DirRecord rec) throws NamingException
dumpLdif write the entire record as ldif.- Throws:
NamingException
-
dumpAttr
public static void dumpAttr(Ldif.LdifOut lo, Attribute a) throws NamingException
- Throws:
NamingException
-
getLogger
public org.bedework.util.logging.BwLogger getLogger()
-
-