T - The type of the Record instances managed by the
Logger.public class SimpleDbLoggerImpl<T> extends AbstractSimpleDbClient implements org.refcodes.logger.Logger<T>, org.refcodes.component.Component, org.refcodes.component.Initializable, org.refcodes.component.Decomposeable, org.refcodes.component.Flushable
SimpleDbLoggerImpl is the Amazon SimpleDB implementation of the
Logger interface. As Amazon SimpleDB stores only String
values (everything is a String), type information may be lost as
inferencing from the String content may not be possible. The
Record instances Column.toStorageString(Object) and
Column.fromStorageString(String) methods are used to apply
conversion.
ATTENTION: Logging field values exceeding the size of 1024 characters will be
truncated and an error message is logged out. We assume not having fields
longer than 1024 bytes with this implementation of the Logger.
org.refcodes.component.Destroyable.DestroyAutomatonorg.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable| Modifier and Type | Field and Description |
|---|---|
protected static org.refcodes.logger.RuntimeLogger |
LOGGER |
| Constructor and Description |
|---|
SimpleDbLoggerImpl(String aDomainName,
String aAccessKey,
String aSecretKey,
org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
Constructs the
SimpleDbLoggerImpl for a given SimpleDB domain. |
SimpleDbLoggerImpl(String aDomainName,
String aAccessKey,
String aSecretKey,
String aEndPoint,
org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
Constructs the
SimpleDbLoggerImpl for a given SimpleDB domain. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addHeaderColumn(String eKey)
Adds a key to the dynamically created
Header for reducing object
creation overhead when massively logging data as no Column
instances are created once the key was already added. |
void |
decompose()
Tears down this component, also removes external resources.
-------------------------------------------------------------------------
ATTENTION: This method will also tear down the Amazon SimpleDB domain!
|
void |
destroy() |
void |
flush()
Flushes buffered log lines, when shutting down this component via the
destroy() method, the buffer then is flushed automatically! |
protected void |
flushBuffer()
Flushes the buffer with
Records already encapsulated in Amazon
SimpleDB's items. |
protected org.refcodes.tabular.Header<T> |
getHeader()
Provides access to the
Header member variable required for
Record related operation. |
void |
initialize() |
void |
log(org.refcodes.tabular.Record<? extends T> aRecord) |
clearDomain, getAmazonSimpleDbClient, getAmazonSimpleDbClient, getAmazonSimpleDbDomainName, getDomainNames, hasDomain, isRequestTimeoutException, isServiceUnavailableException, setAmazonSimpleDbDomainName, toMessagepublic SimpleDbLoggerImpl(String aDomainName, String aAccessKey, String aSecretKey, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
SimpleDbLoggerImpl for a given SimpleDB domain.aDomainName - The name for the Amazon SimpleDB domainaAccessKey - The Amazon access key for Amazon SimpleDBaSecretKey - The Amazon secret key for Amazon SimpleDBaColumnFactory - The ColumnFactory to create default
Column instances for Record instances to be
processedUnknownDomainAliasException - in case the campaigning domain alias
cannot be resolved.public SimpleDbLoggerImpl(String aDomainName, String aAccessKey, String aSecretKey, String aEndPoint, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
SimpleDbLoggerImpl for a given SimpleDB domain.aDomainName - The name for the Amazon SimpleDB domainaAccessKey - The Amazon access key for Amazon SimpleDBaSecretKey - The Amazon secret key for Amazon SimpleDBaEndPoint - The end-point (Amazon region) to use (see
AbstractSimpleDbClient's constructor documentation for
possible values).aColumnFactory - The ColumnFactory to create default
Column instances for Record instances to be
processedpublic void log(org.refcodes.tabular.Record<? extends T> aRecord) throws org.refcodes.logger.IllegalRecordRuntimeException, org.refcodes.logger.UnexpectedLogRuntimeException
log in interface org.refcodes.logger.Logger<T>org.refcodes.logger.IllegalRecordRuntimeExceptionorg.refcodes.logger.UnexpectedLogRuntimeExceptionpublic void initialize()
throws org.refcodes.component.InitializeException
initialize in interface org.refcodes.component.Initializableorg.refcodes.component.InitializeExceptionpublic void destroy()
destroy in interface org.refcodes.component.Destroyablepublic void decompose()
decompose in interface org.refcodes.component.Decomposeablepublic void flush()
throws org.refcodes.component.OpenException
destroy() method, the buffer then is flushed automatically!
Especially useful when unit testing the SimpleDbLoggerImpl, then
flushing can be forced by the test case.protected org.refcodes.tabular.Header<T> getHeader()
Header member variable required for
Record related operation.Header.protected void addHeaderColumn(String eKey)
Header for reducing object
creation overhead when massively logging data as no Column
instances are created once the key was already added.eKey - The key for which a Column is to be added.protected void flushBuffer()
Records already encapsulated in Amazon
SimpleDB's items.Copyright © 2016. All rights reserved.