Package org.forgerock.opendj.ldif
Class ConnectionEntryWriter
- java.lang.Object
-
- org.forgerock.opendj.ldif.ConnectionEntryWriter
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable,EntryWriter
public final class ConnectionEntryWriter extends Object implements EntryWriter
AConnectionEntryWriteris a bridge fromConnections toEntryWriters. 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
Constructors Constructor Description ConnectionEntryWriter(Connection connection)Creates a new connection entry writer whose destination is the provided connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this connection entry writer, including the underlying connection.voidflush()Connection entry writers do not require flushing, so this method has no effect.ConnectionEntryWriterwriteComment(CharSequence comment)Connection entry writers do not support comments, so the provided comment will be ignored.ConnectionEntryWriterwriteEntry(Entry entry)Writes an entry to the underlying connection using an Add request, blocking until the request completes.
-
-
-
Constructor Detail
-
ConnectionEntryWriter
public ConnectionEntryWriter(Connection connection)
Creates a new connection entry 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 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
public ConnectionEntryWriter writeComment(CharSequence comment)
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
public ConnectionEntryWriter writeEntry(Entry entry) throws LdapException
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.
-
-