org.apache.catalina.storeconfig

## Class StoreFileMover

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

-     public class StoreFileMover
      extends Object

  Move server.xml or context.xml as backup TODO Get Encoding from Registry

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static StringManager` | `sm`

  - ### Constructor Summary

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getBasename()`
    `File` | `getConfigNew()`
    `File` | `getConfigOld()`
    `File` | `getConfigSave()`
    `String` | `getEncoding()`
    `String` | `getFilename()`
    `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)`
    `void` | `setEncoding(String string)`
    `void` | `setFilename(String string)`

    - ### Methods inherited from class java.lang.Object

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

- - ### Field Detail

    - #### sm

          protected static final StringManager sm

  - ### Constructor Detail

    - #### StoreFileMover

          public StoreFileMover(String basename,
                        String filename,
                        String encoding)

      Calculate file objects for the old and new configuration files.
      Parameters:
        `basename` - The base path
        `encoding` - The encoding of the file
        `filename` - The file name

    - #### StoreFileMover

          public StoreFileMover()

      Calculate file objects for the old and new configuration files.

  - ### Method Detail

    - #### getConfigNew

          public File getConfigNew()

      Returns:
        Returns the configNew.

    - #### getConfigOld

          public File getConfigOld()

      Returns:
        Returns the configOld.

    - #### getConfigSave

          public File getConfigSave()

      Returns:
        Returns the configSave.

    - #### getBasename

          public String getBasename()

      Returns:
        Returns the basename.

    - #### setBasename

          public void setBasename(String basename)

      Parameters:
        `basename` - The basename to set.

    - #### getFilename

          public String getFilename()

      Returns:
        The file name

    - #### setFilename

          public void setFilename(String string)

      Parameters:
        `string` - The file name

    - #### getEncoding

          public String getEncoding()

      Returns:
        The encoding

    - #### setEncoding

          public void setEncoding(String string)

      Parameters:
        `string` - The 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

Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.