org.x4juli.handlers.rolling
Class AbstractRollingPolicy

java.lang.Object
  extended byorg.x4juli.global.components.AbstractComponent
      extended byorg.x4juli.handlers.rolling.AbstractRollingPolicy
All Implemented Interfaces:
Component, OptionHandler, RollingPolicy
Direct Known Subclasses:
FixedWindowRollingPolicy, NOPRollingPolicy, TimeBasedRollingPolicy

public abstract class AbstractRollingPolicy
extends AbstractComponent
implements RollingPolicy, OptionHandler

Implements methods common to most, it not all, rolling policies. Currently such methods are limited to a compression mode getter/setter.

Logging API as a whole was originally done for Apache log4j. Juli is a port of main parts of that to complete the Java Logging APIs. All credits for initial idea, design, implementation, documentation belong to the log4j crew. This file was originally published by Ceki Gülcü, Curt Arnold. Please use exclusively the appropriate mailing lists for questions, remarks and contribution.

Since:
0.5
Author:
Boris Unckel

Field Summary
protected  java.lang.String activeFileName
          Active file name may be null.
private  java.lang.String fileNamePatternStr
          File name pattern.
private  PatternConverter[] patternConverters
          File name pattern converters.
private  FormattingInfo[] patternFields
          File name field specifiers.
 
Fields inherited from class org.x4juli.global.components.AbstractComponent
manager, repository
 
Constructor Summary
protected AbstractRollingPolicy()
          Constructor for use with file based configuration.
protected AbstractRollingPolicy(java.lang.String fileNamePattern)
          Constructor for use in programmatically configuration.
 
Method Summary
 void activateOptions()
          Activate the options that were previously set with calls to option setters.

This allows to defer activiation of the options until all options have been set. This is required for components which have related options that remain ambigous until all are set.

 void configure()
          Configure all properties of the object.
protected  void formatFileName(java.lang.Object obj, java.lang.StringBuffer buf)
          Format file name.
protected  PatternConverter getDatePatternConverter()
          Returns the first occuring DatePatternConverter in the pattern Converter array.
 java.lang.String getFileNamePattern()
          Get file name pattern.
protected  PatternConverter getIntegerPatternConverter()
          Returns the first occuring IntegerPatternConverter in the pattern Converter array.
 MessageProperties getMessageProperties()
          Specifiy Properties for the component. Default Implementation returns null.
protected  void parseFileNamePattern()
          Parse file name pattern.
 void setFileNamePattern(java.lang.String fnp)
          Set file name pattern.
 java.lang.String toString()
          
 
Methods inherited from class org.x4juli.global.components.AbstractComponent
getLogger, getLoggerRepository, getNonFloodingLogger, getProperty, getProperty, getProperty, getProperty, resetErrorCount, setObjectStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.x4juli.handlers.rolling.RollingPolicy
initialize, rollover
 

Field Detail

patternConverters

private PatternConverter[] patternConverters
File name pattern converters.


patternFields

private FormattingInfo[] patternFields
File name field specifiers.


fileNamePatternStr

private java.lang.String fileNamePatternStr
File name pattern.


activeFileName

protected java.lang.String activeFileName
Active file name may be null. Duplicates FileAppender.file and should be removed.

Constructor Detail

AbstractRollingPolicy

protected AbstractRollingPolicy()
Constructor for use with file based configuration.


AbstractRollingPolicy

protected AbstractRollingPolicy(java.lang.String fileNamePattern)
Constructor for use in programmatically configuration.

Parameters:
fileNamePattern - pattern to determine the filename.
Method Detail

activateOptions

public void activateOptions()
Activate the options that were previously set with calls to option setters.

This allows to defer activiation of the options until all options have been set. This is required for components which have related options that remain ambigous until all are set.

Specified by:
activateOptions in interface OptionHandler
Since:
0.5

configure

public void configure()
Configure all properties of the object. Subclasses should call super.configure() to ensure proper configuration.

Since:
0.5

setFileNamePattern

public void setFileNamePattern(java.lang.String fnp)
Set file name pattern.

Parameters:
fnp - file name pattern.
Since:
0.5

getFileNamePattern

public java.lang.String getFileNamePattern()
Get file name pattern.

Returns:
file name pattern.
Since:
0.5

getMessageProperties

public MessageProperties getMessageProperties()
Specifiy Properties for the component. Default Implementation returns null.

Specified by:
getMessageProperties in interface Component
Overrides:
getMessageProperties in class AbstractComponent
Since:
0.5

toString

public java.lang.String toString()

Since:

parseFileNamePattern

protected final void parseFileNamePattern()
Parse file name pattern.

Since:
0.5

formatFileName

protected final void formatFileName(java.lang.Object obj,
                                    java.lang.StringBuffer buf)
Format file name.

Parameters:
obj - object to be evaluted in formatting, may not be null.
buf - string buffer to which formatted file name is appended, may not be null.
Since:
0.5

getDatePatternConverter

protected final PatternConverter getDatePatternConverter()
Returns the first occuring DatePatternConverter in the pattern Converter array.

Returns:
the first DatePatternConverter, may return null.
Since:
0.5

getIntegerPatternConverter

protected final PatternConverter getIntegerPatternConverter()
Returns the first occuring IntegerPatternConverter in the pattern Converter array.

Returns:
the first IntegerPatternConverter, may return null.
Since:
0.5


${license_html}