T
- The type of the Record
instances managed by the
Logger
.Flushable
, org.refcodes.component.Component
, org.refcodes.component.Decomposeable
, org.refcodes.component.Destroyable
, org.refcodes.component.Flushable
, org.refcodes.component.Initializable
, org.refcodes.logger.Logger<T>
, org.refcodes.logger.QueryLogger<T>
SimpleDbTrimLoggerImpl
public class SimpleDbQueryLoggerImpl<T> extends SimpleDbLoggerImpl<T> implements org.refcodes.logger.QueryLogger<T>, org.refcodes.component.Component, org.refcodes.component.Initializable, org.refcodes.component.Decomposeable, org.refcodes.component.Flushable
SimpleDbQueryLoggerImpl
extends the SimpleDbLoggerImpl
implementation with the QueryLogger
functionality.Modifier and Type | Class | Description |
---|---|---|
protected class |
SimpleDbQueryLoggerImpl.SimpleDbRecordsImpl |
This iterator encapsulates an Amazon select request for the business
logic to simply iterate through the results.
-------------------------------------------------------------------------
TODO Make this unit testable and create unit test:
-------------------------------------------------------------------------
|
org.refcodes.component.Decomposeable.DecomposeAutomaton
org.refcodes.component.Destroyable.DestroyAutomaton
org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable
LOGGER
Constructor | Description |
---|---|
SimpleDbQueryLoggerImpl(String aDomainName,
String aAccessKey,
String aSecretKey,
String aEndPoint,
org.refcodes.tabular.ColumnFactory<T> aColumnFactory) |
Constructs the
SimpleDbQueryLoggerImpl for a given SimpleDB
domain. |
SimpleDbQueryLoggerImpl(String aDomainName,
String aAccessKey,
String aSecretKey,
org.refcodes.tabular.ColumnFactory<T> aColumnFactory) |
Constructs the
SimpleDbQueryLoggerImpl for a given SimpleDB
domain. |
Modifier and Type | Method | Description |
---|---|---|
protected static void |
clearDomain(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient,
String aDomainName) |
Clears all content from the given Amazon SimpleDB domain.
|
void |
destroy() |
|
org.refcodes.tabular.Records<T> |
findLogs() |
|
org.refcodes.tabular.Records<T> |
findLogs(int aLimit) |
|
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria) |
|
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria,
int aLimit) |
|
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria,
org.refcodes.tabular.Header<T> aHeader) |
|
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.criteria.Criteria aCriteria,
org.refcodes.tabular.Header<T> aHeader,
int aLimit) |
|
org.refcodes.tabular.Records<T> |
findLogs(org.refcodes.tabular.Header<T> aHeader,
int aLimit) |
|
protected com.amazonaws.services.simpledb.AmazonSimpleDBClient |
getAmazonSimpleDbClient() |
Retrieves the amazon SimpleDB client to be used.
|
protected static com.amazonaws.services.simpledb.AmazonSimpleDBClient |
getAmazonSimpleDbClient(File aConfigFile) |
Retrieves an
AmazonSimpleDBClient from a configuration file
containing the access- and the secret key. |
protected String |
getAmazonSimpleDbDomainName() |
Retrieves the domain name to be used.
|
protected static List<String> |
getDomainNames(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient) |
Retrieves a list of domain names retrievable from the given
AmazonSimpleDBClient . |
protected static boolean |
hasDomain(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient,
String aDomainName) |
Tests whether the given domain exists in Amazon SimpleDB.
|
protected static boolean |
isRequestTimeoutException(Exception aException) |
Checks if is request timeout exception.
|
protected static boolean |
isServiceUnavailableException(Exception aException) |
Checks if is service unavailable exception.
|
protected void |
setAmazonSimpleDbDomainName(String aAmazonSimpleDbDomainName) |
Sets the domain name to be used.
|
protected static String |
toMessage(Throwable aThrowable) |
Creates an Amazon AWS specific exception message from the given throwable
containing additional information such as the AWS error code, the AWS
error type, the request ID, the service name and the status code.
|
protected String |
toSqlQuery(org.refcodes.criteria.Criteria aCriteria,
int aLimit) |
Creates an SQL SELECT query from the given
Criteria and the
provided limit. |
flush, flushUnchecked, isFlushable
initialize, initializeUnchecked
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addHeaderColumn, decompose, flush, flushBuffer, getHeader, initialize, log
public SimpleDbQueryLoggerImpl(String aDomainName, String aAccessKey, String aSecretKey, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
SimpleDbQueryLoggerImpl
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
processedpublic SimpleDbQueryLoggerImpl(String aDomainName, String aAccessKey, String aSecretKey, String aEndPoint, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
SimpleDbQueryLoggerImpl
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 org.refcodes.tabular.Records<T> findLogs()
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public org.refcodes.tabular.Records<T> findLogs(int aLimit)
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria)
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, int aLimit)
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, org.refcodes.tabular.Header<T> aHeader)
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public org.refcodes.tabular.Records<T> findLogs(org.refcodes.tabular.Header<T> aHeader, int aLimit)
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public org.refcodes.tabular.Records<T> findLogs(org.refcodes.criteria.Criteria aCriteria, org.refcodes.tabular.Header<T> aHeader, int aLimit)
findLogs
in interface org.refcodes.logger.QueryLogger<T>
public void destroy()
destroy
in interface org.refcodes.component.Destroyable
destroy
in class SimpleDbLoggerImpl<T>
protected String toSqlQuery(org.refcodes.criteria.Criteria aCriteria, int aLimit)
Criteria
and the
provided limit.aCriteria
- The Criteria from which to create the SQL query.aLimit
- The limit to be applied to the result set of the query.protected String getAmazonSimpleDbDomainName()
protected void setAmazonSimpleDbDomainName(String aAmazonSimpleDbDomainName)
aAmazonSimpleDbDomainName
- the new amazon simple db domain nameprotected com.amazonaws.services.simpledb.AmazonSimpleDBClient getAmazonSimpleDbClient()
protected static boolean isRequestTimeoutException(Exception aException)
aException
- the exceptionprotected static boolean isServiceUnavailableException(Exception aException)
aException
- the exceptionprotected static String toMessage(Throwable aThrowable)
aThrowable
- The throwable from which to generate the Amazon AWS
specific exception message.protected static void clearDomain(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient, String aDomainName)
aAmazonSimpleDbClient
- The AmazonSimpleDBClient
.aDomainName
- The domain name of the domain to be cleared.protected static com.amazonaws.services.simpledb.AmazonSimpleDBClient getAmazonSimpleDbClient(File aConfigFile) throws IOException
AmazonSimpleDBClient
from a configuration file
containing the access- and the secret key.aConfigFile
- The configuration file used to configure the
AmazonSimpleDBClient
.AmazonSimpleDBClient
.IOException
- In case there were problems reading the configuration
file.protected static List<String> getDomainNames(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient)
AmazonSimpleDBClient
.aAmazonSimpleDbClient
- The AmazonSimpleDBClient
.String
instances representing the
retrievable domain names.protected static boolean hasDomain(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient, String aDomainName)
aAmazonSimpleDbClient
- The AmazonSimpleDBClient
.aDomainName
- The domain name to be tested.Copyright © 2018. All rights reserved.