Package org.apache.catalina.storeconfig
Class StoreFileMover
- java.lang.Object
-
- org.apache.catalina.storeconfig.StoreFileMover
-
public class StoreFileMover extends java.lang.ObjectMove server.xml or context.xml as backup
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringManagersmThe string manager for this package.
-
Constructor Summary
Constructors Constructor Description StoreFileMover(java.lang.String basename, java.lang.String filename, java.lang.String encoding)Calculate file objects for the old and new configuration files.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetBasename()Returns the base directory path for configuration files.java.io.FilegetConfigNew()Returns the File object representing the new configuration file.java.io.FilegetConfigOld()Returns the File object representing the old configuration file.java.io.FilegetConfigSave()Returns the File object representing the saved backup configuration file.java.lang.StringgetEncoding()Returns the character encoding used for configuration files.java.lang.StringgetFilename()Returns the configuration file name.protected java.lang.StringgetTimeTag()Time value for backup yyyy-mm-dd.hh-mm-ss.java.io.PrintWritergetWriter()Open an output writer for the new configuration file.voidinit()Generate the Filename to new with TimeStamp.voidmove()Shuffle old->save and new->old.voidsetBasename(java.lang.String basename)Sets the base directory path for configuration files.voidsetEncoding(java.lang.String string)Sets the character encoding used for configuration files.voidsetFilename(java.lang.String string)Sets the configuration file name.
-
-
-
Field Detail
-
sm
protected static final StringManager sm
The string manager for this package.
-
-
Method Detail
-
getConfigNew
public java.io.File getConfigNew()
Returns the File object representing the new configuration file.- Returns:
- the new configuration file
-
getConfigOld
public java.io.File getConfigOld()
Returns the File object representing the old configuration file.- Returns:
- the old configuration file
-
getConfigSave
public java.io.File getConfigSave()
Returns the File object representing the saved backup configuration file.- Returns:
- the backup configuration file
-
getBasename
public java.lang.String getBasename()
Returns the base directory path for configuration files.- Returns:
- the base directory path
-
setBasename
public void setBasename(java.lang.String basename)
Sets the base directory path for configuration files.- Parameters:
basename- the base directory path
-
getFilename
public java.lang.String getFilename()
Returns the configuration file name.- Returns:
- the configuration file name
-
setFilename
public void setFilename(java.lang.String string)
Sets the configuration file name.- Parameters:
string- the configuration file name
-
getEncoding
public java.lang.String getEncoding()
Returns the character encoding used for configuration files.- Returns:
- the character encoding
-
setEncoding
public void setEncoding(java.lang.String string)
Sets the character encoding used for configuration files.- Parameters:
string- the character encoding
-
init
public void init()
Generate the Filename to new with TimeStamp.
-
move
public void move() throws java.io.IOExceptionShuffle old->save and new->old.- Throws:
java.io.IOException- a file operation error occurred
-
getWriter
public java.io.PrintWriter getWriter() throws java.io.IOExceptionOpen an output writer for the new configuration file.- Returns:
- The writer
- Throws:
java.io.IOException- Failed opening a writer to the new file
-
getTimeTag
protected java.lang.String getTimeTag()
Time value for backup yyyy-mm-dd.hh-mm-ss.- Returns:
- The time
-
-