org.x4juli.handlers.rolling.helper
Class FileRenameAction

java.lang.Object
  extended byorg.x4juli.global.components.AbstractComponent
      extended byorg.x4juli.handlers.rolling.helper.AbstractAction
          extended byorg.x4juli.handlers.rolling.helper.FileRenameAction
All Implemented Interfaces:
Action, Component, java.lang.Runnable

public class FileRenameAction
extends AbstractAction

File rename action.

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 Curt Arnold. Please use exclusively the appropriate mailing lists for questions, remarks and contribution.

Since:
0.5
Author:
Boris Unckel

Field Summary
private  java.io.File destination
          Destination.
private  boolean renameEmptyFiles
          If true, rename empty files, otherwise delete empty files.
private  java.io.File source
          Source.
 
Fields inherited from class org.x4juli.handlers.rolling.helper.AbstractAction
 
Fields inherited from class org.x4juli.global.components.AbstractComponent
manager, repository
 
Constructor Summary
FileRenameAction(java.io.File src, java.io.File dst, boolean renameEmptyFiles)
          Creates an FileRenameAction.
 
Method Summary
 boolean execute()
          Rename file.
static boolean execute(java.io.File source, java.io.File destination, boolean renameEmptyFiles)
          Rename file.
 
Methods inherited from class org.x4juli.handlers.rolling.helper.AbstractAction
close, isComplete, reportException, run
 
Methods inherited from class org.x4juli.global.components.AbstractComponent
getLogger, getLoggerRepository, getMessageProperties, getNonFloodingLogger, getProperty, getProperty, getProperty, getProperty, resetErrorCount, setObjectStore
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

private final java.io.File source
Source.


destination

private final java.io.File destination
Destination.


renameEmptyFiles

private final boolean renameEmptyFiles
If true, rename empty files, otherwise delete empty files.

Constructor Detail

FileRenameAction

public FileRenameAction(java.io.File src,
                        java.io.File dst,
                        boolean renameEmptyFiles)
Creates an FileRenameAction.

Parameters:
src - current file name.
dst - new file name.
renameEmptyFiles - if true, rename file even if empty, otherwise delete empty files.
Method Detail

execute

public static boolean execute(java.io.File source,
                              java.io.File destination,
                              boolean renameEmptyFiles)
Rename file.

Parameters:
source - current file name.
destination - new file name.
renameEmptyFiles - if true, rename file even if empty, otherwise delete empty files.
Returns:
true if successfully renamed.

execute

public boolean execute()
Rename file.

Specified by:
execute in interface Action
Specified by:
execute in class AbstractAction
Returns:
true if successfully renamed.


${license_html}