Package org.forgerock.opendj.ldif
Class ConnectionChangeRecordWriter
- java.lang.Object
-
- org.forgerock.opendj.ldif.ConnectionChangeRecordWriter
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,ChangeRecordWriter
public final class ConnectionChangeRecordWriter extends Object implements ChangeRecordWriter
AConnectionChangeRecordWriteris a bridge fromConnections toChangeRecordWriters. A connection change record writer writes change records by sending appropriate update requests (Add, Delete, Modify, or ModifyDN) to an underlying connection.All update requests are performed synchronously, blocking until an update result is received. If an update result indicates that an update request has failed for some reason then the error result is propagated to the caller using an
LdapException.Note: comments are not supported by connection change record writers. Attempts to write comments will be ignored.
-
-
Constructor Summary
Constructors Constructor Description ConnectionChangeRecordWriter(Connection connection)Creates a new connection change record writer whose destination is the provided connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this connection change record writer, including the underlying connection.voidflush()Connection change record writers do not require flushing, so this method has no effect.ConnectionChangeRecordWriterwriteChangeRecord(AddRequest change)Writes the provided Add request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriterwriteChangeRecord(DeleteRequest change)Writes the provided Delete request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriterwriteChangeRecord(ModifyDnRequest change)Writes the provided ModifyDN request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriterwriteChangeRecord(ModifyRequest change)Writes the provided Modify request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriterwriteChangeRecord(ChangeRecord change)Writes the provided change record to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriterwriteComment(CharSequence comment)Connection change record writers do not support comments, so the provided comment will be ignored.
-
-
-
Constructor Detail
-
ConnectionChangeRecordWriter
public ConnectionChangeRecordWriter(Connection connection)
Creates a new connection change record writer whose destination is the provided connection.- Parameters:
connection- The connection to use.- Throws:
NullPointerException- Ifconnectionwasnull.
-
-
Method Detail
-
close
public void close()
Closes this connection change record writer, including the underlying connection. Closing a previously closed change record writer has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChangeRecordWriter- Specified by:
closein interfaceCloseable
-
flush
public void flush()
Connection change record writers do not require flushing, so this method has no effect.- Specified by:
flushin interfaceChangeRecordWriter- Specified by:
flushin interfaceFlushable
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(AddRequest change) throws LdapException
Writes the provided Add request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecordin interfaceChangeRecordWriter- Parameters:
change- TheAddRequestto be written.- Returns:
- A reference to this connection change record writer.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.NullPointerException- Ifchangewasnull.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(ChangeRecord change) throws LdapException
Writes the provided change record to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecordin interfaceChangeRecordWriter- Parameters:
change- The change record to be written.- Returns:
- A reference to this connection change record writer.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.NullPointerException- Ifchangewasnull.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(DeleteRequest change) throws LdapException
Writes the provided Delete request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecordin interfaceChangeRecordWriter- Parameters:
change- TheDeleteRequestto be written.- Returns:
- A reference to this connection change record writer.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.NullPointerException- Ifchangewasnull.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(ModifyDnRequest change) throws LdapException
Writes the provided ModifyDN request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecordin interfaceChangeRecordWriter- Parameters:
change- TheModifyDNRequestto be written.- Returns:
- A reference to this connection change record writer.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.NullPointerException- Ifchangewasnull.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(ModifyRequest change) throws LdapException
Writes the provided Modify request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecordin interfaceChangeRecordWriter- Parameters:
change- TheModifyRequestto be written.- Returns:
- A reference to this connection change record writer.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.NullPointerException- Ifchangewasnull.
-
writeComment
public ConnectionChangeRecordWriter writeComment(CharSequence comment)
Connection change record writers do not support comments, so the provided comment will be ignored.- Specified by:
writeCommentin interfaceChangeRecordWriter- Parameters:
comment- TheCharSequenceto be written as a comment.- Returns:
- A reference to this connection change record writer.
- Throws:
NullPointerException- Ifcommentwasnull.
-
-