Class OpenBuilderBase
- java.lang.Object
-
- org.apache.bookkeeper.client.impl.OpenBuilderBase
-
- All Implemented Interfaces:
OpBuilder<ReadHandle>
,OpenBuilder
- Direct Known Subclasses:
LedgerOpenOp.OpenBuilderImpl
public abstract class OpenBuilderBase extends java.lang.Object implements OpenBuilder
Base class for open builders which does the mundane builder stuff.
-
-
Field Summary
Fields Modifier and Type Field Description protected DigestType
digestType
protected long
ledgerId
(package private) static org.slf4j.Logger
LOG
protected byte[]
password
protected boolean
recovery
-
Constructor Summary
Constructors Constructor Description OpenBuilderBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected int
validate()
OpenBuilder
withDigestType(DigestType digestType)
Sets the expected digest type used to check the contents of the ledger.OpenBuilder
withLedgerId(long ledgerId)
Set the id of the ledger to be opened.OpenBuilder
withPassword(byte[] password)
Sets the password to be used to open the ledger.OpenBuilder
withRecovery(boolean recovery)
Define to open the ledger in recovery mode or in readonly mode.
-
-
-
Field Detail
-
LOG
static final org.slf4j.Logger LOG
-
recovery
protected boolean recovery
-
ledgerId
protected long ledgerId
-
password
protected byte[] password
-
digestType
protected DigestType digestType
-
-
Method Detail
-
withLedgerId
public OpenBuilder withLedgerId(long ledgerId)
Description copied from interface:OpenBuilder
Set the id of the ledger to be opened.- Specified by:
withLedgerId
in interfaceOpenBuilder
- Returns:
- the builder itself
-
withRecovery
public OpenBuilder withRecovery(boolean recovery)
Description copied from interface:OpenBuilder
Define to open the ledger in recovery mode or in readonly mode. In recovery mode the ledger will be fenced and the writer of the ledger will be prevented from issuing other writes to the ledger. It defaults to 'false'- Specified by:
withRecovery
in interfaceOpenBuilder
- Parameters:
recovery
- recovery mode- Returns:
- the builder itself
-
withPassword
public OpenBuilder withPassword(byte[] password)
Description copied from interface:OpenBuilder
Sets the password to be used to open the ledger. It defaults to an empty password- Specified by:
withPassword
in interfaceOpenBuilder
- Parameters:
password
- the password to unlock the ledger- Returns:
- the builder itself
-
withDigestType
public OpenBuilder withDigestType(DigestType digestType)
Description copied from interface:OpenBuilder
Sets the expected digest type used to check the contents of the ledger. It defaults toDigestType.CRC32
. IfClientConfiguration.setEnableDigestTypeAutodetection(boolean)
is set to true this value is ignored and the digest type is read directly from metadata- Specified by:
withDigestType
in interfaceOpenBuilder
- Parameters:
digestType
- the type of digest- Returns:
- the builder itself
-
validate
protected int validate()
-
-