Class StoreFileMover


  • public class StoreFileMover
    extends java.lang.Object
    Move server.xml or context.xml as backup
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static StringManager sm
      The 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.String getBasename()
      Returns the base directory path for configuration files.
      java.io.File getConfigNew()
      Returns the File object representing the new configuration file.
      java.io.File getConfigOld()
      Returns the File object representing the old configuration file.
      java.io.File getConfigSave()
      Returns the File object representing the saved backup configuration file.
      java.lang.String getEncoding()
      Returns the character encoding used for configuration files.
      java.lang.String getFilename()
      Returns the configuration file name.
      protected java.lang.String getTimeTag()
      Time value for backup yyyy-mm-dd.hh-mm-ss.
      java.io.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​(java.lang.String basename)
      Sets the base directory path for configuration files.
      void setEncoding​(java.lang.String string)
      Sets the character encoding used for configuration files.
      void setFilename​(java.lang.String string)
      Sets the configuration file name.
      • 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
        The string manager for this package.
    • Constructor Detail

      • StoreFileMover

        public StoreFileMover​(java.lang.String basename,
                              java.lang.String filename,
                              java.lang.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
    • 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.IOException
        Shuffle old->save and new->old.
        Throws:
        java.io.IOException - a file operation error occurred
      • getWriter

        public java.io.PrintWriter getWriter()
                                      throws java.io.IOException
        Open 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