|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.unboundid.ldif.LDIFChangeRecord
@NotExtensible @ThreadSafety(level=INTERFACE_THREADSAFE) public abstract class LDIFChangeRecord
This class provides a base class for LDIF change records, which can be used
to represent add, delete, modify, and modify DN operations in LDIF form.
LDIFReader ldifReader = new LDIFReader(pathToLDIFFile);
while (true)
{
LDIFChangeRecord changeRecord;
try
{
changeRecord = ldifReader.readChangeRecord();
if (changeRecord == null)
{
System.err.println("All changes have been processed.");
break;
}
}
catch (LDIFException le)
{
if (le.mayContinueReading())
{
System.err.println("A recoverable occurred while attempting to " +
"read a change record at or near line number " +
le.getLineNumber() + ": " + le.getMessage());
System.err.println("The change record will be skipped.");
continue;
}
else
{
System.err.println("An unrecoverable occurred while attempting to " +
"read a change record at or near line number " +
le.getLineNumber() + ": " + le.getMessage());
System.err.println("LDIF processing will be aborted.");
break;
}
}
catch (IOException ioe)
{
System.err.println("An I/O error occurred while attempting to read " +
"from the LDIF file: " + ioe.getMessage());
System.err.println("LDIF processing will be aborted.");
break;
}
try
{
LDAPResult result = changeRecord.processChange(connection);
System.out.println(changeRecord.getChangeType().getName() +
" successful for entry " + changeRecord.getDN());
}
catch (LDAPException le)
{
System.err.println(changeRecord.getChangeType().getName() +
" failed for entry " + changeRecord.getDN() + " -- " +
le.getMessage());
}
}
ldifReader.close();
| Constructor Summary | |
|---|---|
protected |
LDIFChangeRecord(java.lang.String dn)
Creates a new LDIF change record with the provided DN. |
| Method Summary | |
|---|---|
abstract boolean |
equals(java.lang.Object o)
Indicates whether the provided object is equal to this LDIF change record. |
abstract ChangeType |
getChangeType()
Retrieves the type of operation represented by this LDIF change record. |
java.lang.String |
getDN()
Retrieves the DN for this LDIF change record. |
DN |
getParsedDN()
Retrieves the parsed DN for this LDIF change record. |
abstract int |
hashCode()
Retrieves a hash code for this change record. |
abstract LDAPResult |
processChange(LDAPInterface connection)
Apply the change represented by this LDIF change record to a directory server using the provided connection. |
java.lang.String[] |
toLDIF()
Retrieves a string array whose lines contain an LDIF representation of this change record. |
void |
toLDIF(ByteStringBuffer buffer)
Appends an LDIF string representation of this change record to the provided buffer. |
abstract void |
toLDIF(ByteStringBuffer buffer,
int wrapColumn)
Appends an LDIF string representation of this change record to the provided buffer. |
abstract java.lang.String[] |
toLDIF(int wrapColumn)
Retrieves a string array whose lines contain an LDIF representation of this change record. |
java.lang.String |
toLDIFString()
Retrieves an LDIF string representation of this change record. |
java.lang.String |
toLDIFString(int wrapColumn)
Retrieves an LDIF string representation of this change record. |
void |
toLDIFString(java.lang.StringBuilder buffer)
Appends an LDIF string representation of this change record to the provided buffer. |
abstract void |
toLDIFString(java.lang.StringBuilder buffer,
int wrapColumn)
Appends an LDIF string representation of this change record to the provided buffer. |
java.lang.String |
toString()
Retrieves a single-line string representation of this change record. |
abstract void |
toString(java.lang.StringBuilder buffer)
Appends a single-line string representation of this change record to the provided buffer. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected LDIFChangeRecord(java.lang.String dn)
dn - The DN of the LDIF change record to create. It must not be
null.| Method Detail |
|---|
public final java.lang.String getDN()
getDN in interface LDIFRecord
public final DN getParsedDN()
throws LDAPException
getParsedDN in interface LDIFRecordLDAPException - If a problem occurs while trying to parse the DN.public abstract ChangeType getChangeType()
public abstract LDAPResult processChange(LDAPInterface connection)
throws LDAPException
connection - The connection to use to apply the change.
LDAPException - If an error occurs while processing this change
in the associated directory server.public final java.lang.String[] toLDIF()
toLDIF in interface LDIFRecordpublic abstract java.lang.String[] toLDIF(int wrapColumn)
toLDIF in interface LDIFRecordwrapColumn - The column at which to wrap long lines. A value that
is less than or equal to two indicates that no
wrapping should be performed.
public final void toLDIF(ByteStringBuffer buffer)
toLDIF in interface LDIFRecordbuffer - The buffer to which to append an LDIF representation of
this change record.
public abstract void toLDIF(ByteStringBuffer buffer,
int wrapColumn)
toLDIF in interface LDIFRecordbuffer - The buffer to which to append an LDIF representation of
this change record.wrapColumn - The column at which to wrap long lines. A value that
is less than or equal to two indicates that no
wrapping should be performed.public final java.lang.String toLDIFString()
toLDIFString in interface LDIFRecordpublic final java.lang.String toLDIFString(int wrapColumn)
toLDIFString in interface LDIFRecordwrapColumn - The column at which to wrap long lines. A value that
is less than or equal to two indicates that no
wrapping should be performed.
public final void toLDIFString(java.lang.StringBuilder buffer)
toLDIFString in interface LDIFRecordbuffer - The buffer to which to append an LDIF representation of
this change record.
public abstract void toLDIFString(java.lang.StringBuilder buffer,
int wrapColumn)
toLDIFString in interface LDIFRecordbuffer - The buffer to which to append an LDIF representation of
this change record.wrapColumn - The column at which to wrap long lines. A value that
is less than or equal to two indicates that no
wrapping should be performed.public abstract int hashCode()
hashCode in class java.lang.Objectpublic abstract boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - The object for which to make the determination.
true if the provided object is equal to this LDIF change
record, or false if not.public final java.lang.String toString()
toString in interface LDIFRecordtoString in class java.lang.Objectpublic abstract void toString(java.lang.StringBuilder buffer)
toString in interface LDIFRecordbuffer - The buffer to which the information should be written.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||