Package org.forgerock.opendj.ldif
Class ConnectionEntryWriter
java.lang.Object
org.forgerock.opendj.ldif.ConnectionEntryWriter
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,EntryWriter
A
ConnectionEntryWriter is a bridge from Connections to
EntryWriters. A connection entry writer writes entries by sending Add
requests to an underlying connection.
All Add requests are performed synchronously, blocking until an Add result is
received. If an Add result indicates that an Add 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
ConstructorsConstructorDescriptionConnectionEntryWriter(Connection connection) Creates a new connection entry writer whose destination is the provided connection. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes this connection entry writer, including the underlying connection.voidflush()Connection entry writers do not require flushing, so this method has no effect.writeComment(CharSequence comment) Connection entry writers do not support comments, so the provided comment will be ignored.writeEntry(Entry entry) Writes an entry to the underlying connection using an Add request, blocking until the request completes.
-
Constructor Details
-
ConnectionEntryWriter
Creates a new connection entry writer whose destination is the provided connection.- Parameters:
connection- The connection to use.- Throws:
NullPointerException- Ifconnectionwasnull.
-
-
Method Details
-
close
public void close()Closes this connection entry writer, including the underlying connection. Closing a previously closed entry writer has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceEntryWriter
-
flush
public void flush()Connection entry writers do not require flushing, so this method has no effect.- Specified by:
flushin interfaceEntryWriter- Specified by:
flushin interfaceFlushable
-
writeComment
Connection entry writers do not support comments, so the provided comment will be ignored.- Specified by:
writeCommentin interfaceEntryWriter- Parameters:
comment- TheCharSequenceto be written as a comment.- Returns:
- A reference to this connection entry writer.
- Throws:
NullPointerException- Ifcommentwasnull.
-
writeEntry
Writes an entry to the underlying connection using an Add request, blocking until the request completes.- Specified by:
writeEntryin interfaceEntryWriter- Parameters:
entry- TheEntryto be written.- Returns:
- A reference to this connection entry writer.
- Throws:
LdapException- If the result code indicates that the request failed for some reason.NullPointerException- Ifentrywasnull.
-