net.sourceforge.acelogger.appender
Class BaseAppender

java.lang.Object
  extended by net.sourceforge.acelogger.appender.BaseAppender
All Implemented Interfaces:
Appender, Identifiable
Direct Known Subclasses:
MultipleAppender, PrintStreamAppender, TextFileAppender

public abstract class BaseAppender
extends Object
implements Appender

Abstracts all common tasks for Appender.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Constructor Summary
BaseAppender(String identifier)
          Constructs a new BaseAppender using the supplied identifier, an empty formatter, and an empty executor manager.
BaseAppender(String identifier, Formatter formatter, ExecutorManager executor)
          Constructs a new BaseAppender using the supplied identifier, formatter, and executor manager.
BaseAppender(String identifier, Formatter formatter, ExecutorManager executor, LevelFilter threshold)
          Constructs a new BaseAppender using the supplied identifier, formatter, and executor manager.
 
Method Summary
 void appendFooter()
          Appends a footer to this appender.
protected  Runnable appendFooterProcess()
          Defines the process used to append a footer to this appender.
 void appendHeader()
          Appends a header to this appender.
protected  Runnable appendHeaderProcess()
          Defines the process used to append a header to this appender.
 void appendLog(LogEvent call)
          Appends a log call using this appender.
protected abstract  Runnable appendLogProcess(LogEvent call)
          Defines the process used to append a log call.
 void close()
          This method is responsible for termination and deallocation of any resource used by this appender.
protected  Runnable closeProcess()
          Defines the process used to close this appender.
protected  String formatLogCall(LogEvent call)
          Formats a log call based on the Formatter used by this appender.
 ExecutorManager getExecutor()
          Sets the executor manager used within this appender.
 Formatter getFormatter()
          Returns the formatter used within this appender.
 String getIdentifier()
          Gets a String that identifies this object.
 LevelFilter getThreshold()
          Gets the threshold of this appender.
protected  void initialize()
          This method is responsible for calling the needed methods after the Appender construction, this includes opening, appending the header, and registering the call to append the footer and close the file.
 void open()
          This method is responsible for allocation and preparation of any resource used by this appender.
protected  Runnable openProcess()
          Defines the process used to open this appender.
 void setThreshold(LevelFilter threshold)
          Sets the threshold of this appender.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseAppender

public BaseAppender(String identifier)
Constructs a new BaseAppender using the supplied identifier, an empty formatter, and an empty executor manager.

Parameters:
identifier - A string that identifies this appender.
Since:
1.0.0

BaseAppender

public BaseAppender(String identifier,
                    Formatter formatter,
                    ExecutorManager executor)
Constructs a new BaseAppender using the supplied identifier, formatter, and executor manager.

Parameters:
identifier - A string that identifies this appender.
formatter - The Formatter that will be used within this appender.
executor - The ExecutorManager that will be used within this appender.
Since:
1.0.0

BaseAppender

public BaseAppender(String identifier,
                    Formatter formatter,
                    ExecutorManager executor,
                    LevelFilter threshold)
Constructs a new BaseAppender using the supplied identifier, formatter, and executor manager.

Parameters:
identifier - A string that identifies this appender.
formatter - The Formatter that will be used within this appender.
executor - The ExecutorManager that will be used within this appender.
threshold - The filter used to determine if the call should be appended or not.
Since:
1.0.0
Method Detail

appendLogProcess

protected abstract Runnable appendLogProcess(LogEvent call)
Defines the process used to append a log call.

Parameters:
call - The call that will be logged.
Returns:
A Runnable indicating the process used to log this call.
Since:
1.0.0

appendHeaderProcess

protected Runnable appendHeaderProcess()
Defines the process used to append a header to this appender.

Returns:
A Runnable indicating the process used to append a header.
Since:
1.0.0

appendFooterProcess

protected Runnable appendFooterProcess()
Defines the process used to append a footer to this appender.

Returns:
A Runnable indicating the process used to append a footer.
Since:
1.0.0

openProcess

protected Runnable openProcess()
Defines the process used to open this appender. This may include allocation and preparation of resources.

Returns:
A Runnable indicating the process used to open this appender.
Since:
1.0.0

closeProcess

protected Runnable closeProcess()
Defines the process used to close this appender. This may include termination and deallocation of resources.

Returns:
A Runnable indicating the process used to close this appender.
Since:
1.0.0

initialize

protected final void initialize()
This method is responsible for calling the needed methods after the Appender construction, this includes opening, appending the header, and registering the call to append the footer and close the file.

Since:
1.0.0

appendFooter

public final void appendFooter()
Appends a footer to this appender.

Specified by:
appendFooter in interface Appender

appendHeader

public final void appendHeader()
Appends a header to this appender.

Specified by:
appendHeader in interface Appender

close

public final void close()
This method is responsible for termination and deallocation of any resource used by this appender.

Specified by:
close in interface Appender

open

public final void open()
This method is responsible for allocation and preparation of any resource used by this appender.

Specified by:
open in interface Appender

appendLog

public final void appendLog(LogEvent call)
Appends a log call using this appender.

Specified by:
appendLog in interface Appender
Parameters:
call - The log call to be appended.

getFormatter

public final Formatter getFormatter()
Returns the formatter used within this appender.

Returns:
The Formatter used within this appender.
Since:
1.0.0

getThreshold

public final LevelFilter getThreshold()
Gets the threshold of this appender.

Returns:
The filter used to determine if the call should be appended or not.

setThreshold

public final void setThreshold(LevelFilter threshold)
Sets the threshold of this appender.

Parameters:
threshold - The filter used to determine if the call should be appended or not.

getExecutor

public final ExecutorManager getExecutor()
Sets the executor manager used within this appender.

Returns:
The ExecutorManager used within this appender.
Since:
1.0.0

getIdentifier

public final String getIdentifier()
Gets a String that identifies this object.

Specified by:
getIdentifier in interface Identifiable
Returns:
The identifier of this object.

formatLogCall

protected final String formatLogCall(LogEvent call)
Formats a log call based on the Formatter used by this appender.

Parameters:
call - The log call to be formatted.
Returns:
A string containing the formatted log call.
Since:
1.0.0


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.