StoreFileMover (Apache Tomcat 11.0.23 API Documentation)
Description: declaration: package: org.apache.catalina.storeconfig, class: StoreFileMover

# Class StoreFileMover

java.lang.Object
org.apache.catalina.storeconfig.StoreFileMover

public class StoreFileMover extends Object
Move server.xml or context.xml as backup

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final StringManager`
  `sm`
  The string manager for this package.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StoreFileMover(String basename, String filename, String encoding)`
  Calculate file objects for the old and new configuration files.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getBasename()`
  Returns the base directory path for configuration files.
  `File`
  `getConfigNew()`
  Returns the File object representing the new configuration file.
  `File`
  `getConfigOld()`
  Returns the File object representing the old configuration file.
  `File`
  `getConfigSave()`
  Returns the File object representing the saved backup configuration file.
  `String`
  `getEncoding()`
  Returns the character encoding used for configuration files.
  `String`
  `getFilename()`
  Returns the configuration file name.
  `protected String`
  `getTimeTag()`
  Time value for backup yyyy-mm-dd.hh-mm-ss.
  `PrintWriter`
  `getWriter()`
  Open an output writer for the new configuration file.
  `void`
  `init()`
  Generate the Filename to new with TimeStamp.
  `void`
  `move()`
  Shuffle old->save and new->old.
  `void`
  `setBasename(String basename)`
  Sets the base directory path for configuration files.
  `void`
  `setEncoding(String string)`
  Sets the character encoding used for configuration files.
  `void`
  `setFilename(String string)`
  Sets the configuration file name.

  ### Methods inherited from class Object

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

- ## Field Details

  - ### sm

    protected static final StringManager sm
    The string manager for this package.

- ## Constructor Details

  - ### StoreFileMover

    public StoreFileMover(String basename, String filename, String encoding)
    Calculate file objects for the old and new configuration files.
    Parameters:
      `basename` - The base path
      `filename` - The file name
      `encoding` - The encoding of the file

- ## Method Details

  - ### getConfigNew

    public File getConfigNew()
    Returns the File object representing the new configuration file.
    Returns:
      the new configuration file

  - ### getConfigOld

    public File getConfigOld()
    Returns the File object representing the old configuration file.
    Returns:
      the old configuration file

  - ### getConfigSave

    public File getConfigSave()
    Returns the File object representing the saved backup configuration file.
    Returns:
      the backup configuration file

  - ### getBasename

    public String getBasename()
    Returns the base directory path for configuration files.
    Returns:
      the base directory path

  - ### setBasename

    public void setBasename(String basename)
    Sets the base directory path for configuration files.
    Parameters:
      `basename` - the base directory path

  - ### getFilename

    public String getFilename()
    Returns the configuration file name.
    Returns:
      the configuration file name

  - ### setFilename

    public void setFilename(String string)
    Sets the configuration file name.
    Parameters:
      `string` - the configuration file name

  - ### getEncoding

    public String getEncoding()
    Returns the character encoding used for configuration files.
    Returns:
      the character encoding

  - ### setEncoding

    public void setEncoding(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 IOException
    Shuffle old->save and new->old.
    Throws:
      `IOException` - a file operation error occurred

  - ### getWriter

    public PrintWriter getWriter() throws IOException
    Open an output writer for the new configuration file.
    Returns:
      The writer
    Throws:
      `IOException` - Failed opening a writer to the new file

  - ### getTimeTag

    protected String getTimeTag()
    Time value for backup yyyy-mm-dd.hh-mm-ss.
    Returns:
      The time