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
AConnectionChangeRecordWriter
is a bridge fromConnection
s toChangeRecordWriter
s. 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 void
close()
Closes this connection change record writer, including the underlying connection.void
flush()
Connection change record writers do not require flushing, so this method has no effect.ConnectionChangeRecordWriter
writeChangeRecord(AddRequest change)
Writes the provided Add request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriter
writeChangeRecord(DeleteRequest change)
Writes the provided Delete request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriter
writeChangeRecord(ModifyDnRequest change)
Writes the provided ModifyDN request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriter
writeChangeRecord(ModifyRequest change)
Writes the provided Modify request to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriter
writeChangeRecord(ChangeRecord change)
Writes the provided change record to the underlying connection, blocking until the request completes.ConnectionChangeRecordWriter
writeComment(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
- Ifconnection
wasnull
.
-
-
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceChangeRecordWriter
- Specified by:
close
in interfaceCloseable
-
flush
public void flush()
Connection change record writers do not require flushing, so this method has no effect.- Specified by:
flush
in interfaceChangeRecordWriter
- Specified by:
flush
in 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:
writeChangeRecord
in interfaceChangeRecordWriter
- Parameters:
change
- TheAddRequest
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
- Ifchange
wasnull
.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(ChangeRecord change) throws LdapException
Writes the provided change record to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecord
in 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
- Ifchange
wasnull
.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(DeleteRequest change) throws LdapException
Writes the provided Delete request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecord
in interfaceChangeRecordWriter
- Parameters:
change
- TheDeleteRequest
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
- Ifchange
wasnull
.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(ModifyDnRequest change) throws LdapException
Writes the provided ModifyDN request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecord
in interfaceChangeRecordWriter
- Parameters:
change
- TheModifyDNRequest
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
- Ifchange
wasnull
.
-
writeChangeRecord
public ConnectionChangeRecordWriter writeChangeRecord(ModifyRequest change) throws LdapException
Writes the provided Modify request to the underlying connection, blocking until the request completes.- Specified by:
writeChangeRecord
in interfaceChangeRecordWriter
- Parameters:
change
- TheModifyRequest
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
- Ifchange
wasnull
.
-
writeComment
public ConnectionChangeRecordWriter writeComment(CharSequence comment)
Connection change record writers do not support comments, so the provided comment will be ignored.- Specified by:
writeComment
in interfaceChangeRecordWriter
- Parameters:
comment
- TheCharSequence
to be written as a comment.- Returns:
- A reference to this connection change record writer.
- Throws:
NullPointerException
- Ifcomment
wasnull
.
-
-