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 Connection
s to
EntryWriter
s. 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
ConstructorDescriptionConnectionEntryWriter
(Connection connection) Creates a new connection entry writer whose destination is the provided connection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this connection entry writer, including the underlying connection.void
flush()
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
- Ifconnection
wasnull
.
-
-
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceEntryWriter
-
flush
public void flush()Connection entry writers do not require flushing, so this method has no effect.- Specified by:
flush
in interfaceEntryWriter
- Specified by:
flush
in interfaceFlushable
-
writeComment
Connection entry writers do not support comments, so the provided comment will be ignored.- Specified by:
writeComment
in interfaceEntryWriter
- Parameters:
comment
- TheCharSequence
to be written as a comment.- Returns:
- A reference to this connection entry writer.
- Throws:
NullPointerException
- Ifcomment
wasnull
.
-
writeEntry
Writes an entry to the underlying connection using an Add request, blocking until the request completes.- Specified by:
writeEntry
in interfaceEntryWriter
- Parameters:
entry
- TheEntry
to 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
- Ifentry
wasnull
.
-