Class SimpleDbTrimLogger<T>

Type Parameters:
T - The type of the Record instances managed by the Logger.
All Implemented Interfaces:
Flushable, org.refcodes.component.Component, org.refcodes.component.Decomposeable, org.refcodes.component.Destroyable, org.refcodes.component.Flushable, org.refcodes.component.Initializable, org.refcodes.logger.LogDecorator, org.refcodes.logger.Logger<T>, org.refcodes.logger.QueryLogger<T>, org.refcodes.logger.TrimLogger<T>, org.refcodes.mixin.Clearable

public class SimpleDbTrimLogger<T> extends SimpleDbQueryLogger<T> implements org.refcodes.logger.TrimLogger<T>, org.refcodes.component.Component, org.refcodes.component.Initializable, org.refcodes.component.Decomposeable, org.refcodes.component.Flushable
The SimpleDbTrimLogger extends the SimpleDbQueryLogger implementation with the TrimLogger functionality.
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.refcodes.logger.alt.simpledb.SimpleDbQueryLogger

    SimpleDbQueryLogger.SimpleDbRecords

    Nested classes/interfaces inherited from interface org.refcodes.component.Decomposeable

    org.refcodes.component.Decomposeable.DecomposeAutomaton

    Nested classes/interfaces inherited from interface org.refcodes.component.Destroyable

    org.refcodes.component.Destroyable.DestroyAutomaton

    Nested classes/interfaces inherited from interface org.refcodes.component.Flushable

    org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>

    Nested classes/interfaces inherited from interface org.refcodes.component.Initializable

    org.refcodes.component.Initializable.InitializeAutomaton, org.refcodes.component.Initializable.InitializeBuilder<B extends org.refcodes.component.Initializable.InitializeBuilder<B>>, org.refcodes.component.Initializable.UncheckedInitializable
  • Constructor Summary

    Constructors
    Constructor
    Description
    SimpleDbTrimLogger(String aDomainName, String aAccessKey, String aSecretKey, String aEndPoint, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
    Instantiates a new simple db trim logger impl.
    SimpleDbTrimLogger(String aDomainName, String aAccessKey, String aSecretKey, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
    Instantiates a new simple db trim logger impl.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    protected static void
    clearDomain(com.amazonaws.services.simpledb.AmazonSimpleDB aAmazonSimpleDbClient, String aDomainName)
    Clears all content from the given Amazon SimpleDB domain.
    void
    deleteLogs(org.refcodes.criteria.Criteria aCriteria)
    protected com.amazonaws.services.simpledb.AmazonSimpleDB
    Retrieves the amazon SimpleDB client to be used.
    protected static com.amazonaws.services.simpledb.AmazonSimpleDB
    Retrieves an AmazonSimpleDBClient from a configuration file containing the access- and the secret key.
    protected String
    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
    Checks if is request timeout exception.
    protected static boolean
    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.

    Methods inherited from class org.refcodes.logger.alt.simpledb.SimpleDbQueryLogger

    destroy, findLogs, findLogs, findLogs, findLogs, findLogs, findLogs, findLogs, toSqlQuery

    Methods inherited from class org.refcodes.logger.alt.simpledb.SimpleDbLogger

    addHeaderColumn, decompose, flush, flushBuffer, getHeader, initialize, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.refcodes.component.Decomposeable

    decompose

    Methods inherited from interface org.refcodes.component.Destroyable

    destroy

    Methods inherited from interface org.refcodes.component.Flushable

    flush, flushUnchecked, isFlushable

    Methods inherited from interface org.refcodes.component.Initializable

    initialize, initializeUnchecked

    Methods inherited from interface org.refcodes.logger.LogDecorator

    printHead, printSeparator, printTail

    Methods inherited from interface org.refcodes.logger.Logger

    log

    Methods inherited from interface org.refcodes.logger.QueryLogger

    findLogs, findLogs, findLogs, findLogs, findLogs, findLogs, findLogs
  • Constructor Details

    • SimpleDbTrimLogger

      public SimpleDbTrimLogger(String aDomainName, String aAccessKey, String aSecretKey, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
      Instantiates a new simple db trim logger impl.
      Parameters:
      aDomainName - the domain name
      aAccessKey - the access key
      aSecretKey - the secret key
      aColumnFactory - the column factory
    • SimpleDbTrimLogger

      public SimpleDbTrimLogger(String aDomainName, String aAccessKey, String aSecretKey, String aEndPoint, org.refcodes.tabular.ColumnFactory<T> aColumnFactory)
      Instantiates a new simple db trim logger impl.
      Parameters:
      aDomainName - the domain name
      aAccessKey - the access key
      aSecretKey - the secret key
      aEndPoint - the end point
      aColumnFactory - the column factory
  • Method Details

    • deleteLogs

      public void deleteLogs(org.refcodes.criteria.Criteria aCriteria)
      Specified by:
      deleteLogs in interface org.refcodes.logger.TrimLogger<T>
    • clear

      public void clear()
      Specified by:
      clear in interface org.refcodes.mixin.Clearable
    • getAmazonSimpleDbDomainName

      protected String getAmazonSimpleDbDomainName()
      Retrieves the domain name to be used.
      Returns:
      The domain name.
    • setAmazonSimpleDbDomainName

      protected void setAmazonSimpleDbDomainName(String aAmazonSimpleDbDomainName)
      Sets the domain name to be used.
      Parameters:
      aAmazonSimpleDbDomainName - the new amazon simple db domain name
    • getAmazonSimpleDbClient

      protected com.amazonaws.services.simpledb.AmazonSimpleDB getAmazonSimpleDbClient()
      Retrieves the amazon SimpleDB client to be used.
      Returns:
      The SimpleDB client to be used.
    • isRequestTimeoutException

      protected static boolean isRequestTimeoutException(Exception aException)
      Checks if is request timeout exception.
      Parameters:
      aException - the exception
      Returns:
      true, if is request timeout exception
    • isServiceUnavailableException

      protected static boolean isServiceUnavailableException(Exception aException)
      Checks if is service unavailable exception.
      Parameters:
      aException - the exception
      Returns:
      true, if is service unavailable exception
    • toMessage

      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.
      Parameters:
      aThrowable - The throwable from which to generate the Amazon AWS specific exception message.
      Returns:
      The according exception message.
    • clearDomain

      protected static void clearDomain(com.amazonaws.services.simpledb.AmazonSimpleDB aAmazonSimpleDbClient, String aDomainName)
      Clears all content from the given Amazon SimpleDB domain.
      Parameters:
      aAmazonSimpleDbClient - The AmazonSimpleDBClient.
      aDomainName - The domain name of the domain to be cleared.
    • getAmazonSimpleDbClient

      protected static com.amazonaws.services.simpledb.AmazonSimpleDB getAmazonSimpleDbClient(File aConfigFile) throws IOException
      Retrieves an AmazonSimpleDBClient from a configuration file containing the access- and the secret key.
      Parameters:
      aConfigFile - The configuration file used to configure the AmazonSimpleDBClient.
      Returns:
      An AmazonSimpleDBClient.
      Throws:
      IOException - In case there were problems reading the configuration file.
    • getDomainNames

      protected static List<String> getDomainNames(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient)
      Retrieves a list of domain names retrievable from the given AmazonSimpleDBClient.
      Parameters:
      aAmazonSimpleDbClient - The AmazonSimpleDBClient.
      Returns:
      A list containing String instances representing the retrievable domain names.
    • hasDomain

      protected static boolean hasDomain(com.amazonaws.services.simpledb.AmazonSimpleDBClient aAmazonSimpleDbClient, String aDomainName)
      Tests whether the given domain exists in Amazon SimpleDB.
      Parameters:
      aAmazonSimpleDbClient - The AmazonSimpleDBClient.
      aDomainName - The domain name to be tested.
      Returns:
      True in case the domain with the given name exists, else false.