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
AConnectionEntryWriter
is a bridge fromConnection
s toEntryWriter
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
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 void
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.ConnectionEntryWriter
writeComment(CharSequence comment)
Connection entry writers do not support comments, so the provided comment will be ignored.ConnectionEntryWriter
writeEntry(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
- Ifconnection
wasnull
.
-
-
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:
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
public ConnectionEntryWriter writeComment(CharSequence comment)
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
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:
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
.
-
-