Sandeep Deb's Home Page
Backup Application Configuration
  Configuration
Usage | Configuration | Download

The backup application creates a configuration file similar to the one shown below and stores it in the user's home directory. During invocation, one or more application identifiers can be specified at the command line.

NOTE: Now that I look at this file after a span of half a decade, I can see so many glaring flaws in the way the configuration is structured. Given a chance, I would love to rewrite it again, but then vintage code has a charm of it's own. To me, it's a constant reminder of how I am forever improving as a developer.

<ArchivePolicy>
    
    <!--------------------------------------------------------------------
    RepositoryDir node represents the directory where the application will
    write its internal information. This folder will be maintained by the
    application and the user should not update, modify or delete the
    contents of this directory else unexpected backup behaviour might result.

    path attribute : Absolute pathname of the repository directory.
    NOTE: The path should not contain a ending backslash. MANDATORY.

    REQUIREMENT : MANDATORY
    OCCURANCES : One
    ---------------------------------------------------------------------->
    <RepositoryDir path="C:\TEMP\backupapp\config" />
    
    <!--------------------------------------------------------------------
    SMTPServer node represents the SMTP server that will be used to send mail
    to the recipients.

    hostName attribute : Machine name or IP of this SMTP Server. MANDATORY.

    REQUIREMENT : MANDATORY
    OCCURANCES : One
    ---------------------------------------------------------------------->
    <SMTPServer hostName="D23M0171" />
    
    <!--------------------------------------------------------------------
    Application node represents the application that will be backed up by
    the application. Its assumed that every application has a root directory
    inside which the application directory structure is maintained.

    name attribute of this node is the identifier for this application.
    When executing this application, the user needs to specify a list of
    application names to be backed up.This is a MANDATORY attribute.

    rootDir attribute of this node is the absolute path of the root directory
    of the application. Please note that there is no trailing File separator
    after the path name. This is a MANDATORY attribute.

    incrementalOffset attribute is a specialized attribute that needs some
    explanation. Imagine a scenario in which you want to offset the time of the
    last backup by a fixed amount of time, so that any files modified within this
    offset would not be considered dirty and would not be included in the next
    incremental backup. This attribute provides the user with a means to specify
    this offset time. A practical example is where after taking the incremental
    backup, the user refreshes the entire codebase from a central version control
    system. Doing this would make the entire codebase eligible for the next
    incremental backup, to prevent this scenario from happening, the user can
    specify this attribute with an offset of after the code refresh. The format
    for specifying the offset is HH:MM:SS. This is an OPTIONAL attribute.

    REQUIREMENT : OPTIONAL, It doesn't make any sense not to have an application
    node. In which case U won't need to use this tool in the first place.
    OCCURANCES : Zero or More.
    ---------------------------------------------------------------------->
    <Application name="Chess" rootDir="F:\Sandeep\chess" incrementalOffset="00:02:00">
        
        <!----------------------------------------------------------------
        Destination node represents the location where the archive needs to
        be stored. The location can be either a separate directory (can be on
        a different drive) or on a networked machine (Map Network Drive on
        Windows and DFS on UNIX platforms), or a FTP server.

        type attribute of this node informs the application whether its a file
        destination or an FTP destination. This is a MANDATORY attribute and
        the values can be either of the following "FILE" or "FTP". If its a file
        destination the child element of this node would contain a File node
        else a Server node.
        ---------------------------------------------------------------------->
        <Destination type="FTP">
            
            <!------------------------------------------------------------------
            Server node represents the FTP server configurations needed to
            transfer the archive. This node contains the following attributes.
                  1. serverName MANDATORY, this attribute is the name or IP of
                     the FTP server.
                  2. userName MANDATORY, this attribute is the user name to be
                     used for the FTP session.
                  3. password MANDATORY, this attribute is the password for
                     the FTP session.
                  4. tempDir MANDATORY, is the scratch directory where the
                     archive will be prepared before the FTP.
                  5. serverPath OPTIONAL, If the file is to placed in some
                     directory relative to the current directory, the user can
                     specify the directory from the root. Please note the absence
                     of the trailing file separator for this attribute.
            --------------------------------------------------------------------->
            <Server serverName="9.184.212.101" userName="someone" password="something" 
                    tempDir="c:\temp" serverPath="\sandeep" />
        </Destination>
        
        <!------------------------------------------------------------------------
        Mail node represents the mail receivers information. The application can be
        configured to send a summary mail of the archive process to the interested
        user. This is an OPTIONAL node. Moreover the mailing request will only be
        respected if and only if a valid SMTP server information is supplied earlier.

        receiverAddress This is a valid electronic mail address of the recipient.
        ------------------------------------------------------------------------->
        <Mail receiverAddress="dsandeep@in.ibm.com" />
        
        <!-----------------------------------------------------------------------
        ExcludeFile node represents the list of files files that should not be included
        in the archive under any circumstances. For example class files, .obj files etc.

        extention This is a comma separated list of file extentions that should
        not be included in the archive process.
        ------------------------------------------------------------------------->
        <ExcludeFiles extention= "class,bak"/>
        
        <!------------------------------------------------------------------------
        Folder node represents fine grained information about the folders in the
        application directory.

        path This is the relative path of the directory from the application root
        folder, also the path should always begin with a file separator.

        action This attribute specifies the action that the application should take
        on this folder. Action can be of two types:
            a) EXCLUDE : This value specifies that this directory and all sub-directories
                         inside this directory should be ignored in the backup process.
                         This takes the highest priority.
            b) INCREMENTAL : This value specified that this directory and all its
                         sub-directories should be backed up incrementally. i.e. all
                         those files whose modification time stamp is greater than the
                         last backup time stamp are included in the archive process.
                         NOTE: In case U change the machine time, this option is going
                         to go wild and the behaviour is not accountable. This option
                         takes lesser precedence than the EXCLUDE option.. for example
                         if we have specified INCREMENTAL for dir \a\b and ECLUDE for \a\b\c
                         ... the directory \a\b\c will be excluded from the backup process.

              NOTE : In case any Folder entry is not found for a directory, complete
                     backup is taken for that directory.
        ------------------------------------------------------------------------>
        <Folder path="\bin" action= "EXCLUDE"/>
        <Folder path="\src" action= "INCREMENTAL"/>
    </Application>

    <Application name="Logger"   rootDir="F:\Users\Sandeep\MyWorld\apps_java\logger">
        <Destination  type="FILE">
            
            <!-------------------------------------------------------------------
            File node represents the destination folder where the archive is to
            be placed. A file destination can be mapped to a Networked drive or even a
            local directory. This element has the following attributes.
                  1. path MANDATORY, This denotes the absolute path name of the
                     destination directory.
                  2. archiveCycle MANDATORY, the archive cycling number. For example
                     if we have a archiveCycle of 3, the moment we put the fourth
                     archive the first one would get deleted.
            ------------------------------------------------------------------------------>
            <File path="C:\TEMP\backupapp\dest\logger" archiveCycle="2"/>
        </Destination>
        
        <!----------------------------------------------------------------
        BackupRegister node is a new addition in the 1.1 version of this
        application. In most cases it can be thought of as a backup log,
        in which the application can be made to write its state after the
        completion of the arvhive process. This facility has been left open
        ended to facilitate incorporation of a vareity of backup registers
        according to requirements. To incorporate a backup register, create
        a class implementing sandy.backupapp.BackupRegisterWriter and implement
        the methods provided. The following is a sample backup register I have
        implemented.
        ------------------------------------------------------------------------------>
        <BackupRegister className="sandy.backupapp.ext.QMSBackupRegWriter" >
            <RegisterFile value="D:\SomeDir\BACKUPREGISTER.csv" />
            <DateFormat value="yyyy-MM-dd" />
            <BackupContents value="Quality Docs and project artifacts" />
            <BackupLocation value="GAD1 server" />
            <BackupType value="Online" />
            <BackupCoordinator value="Sandeep Deb" />
        </BackupRegister>


        <ExcludeFiles extention="class,bak"/>
        <Folder  path="\bin"             action="INCREMENTAL"/>
        <Folder  path="\build"           action="INCREMENTAL"/>
        <Folder  path="\docs\html"       action="EXCLUDE"/>
        <Folder  path="\docs\javadocs"   action="INCREMENTAL"/>
        <Folder  path="\lib"             action="INCREMENTAL"/>
        <Folder  path="\src"             action="INCREMENTAL"/>
    </Application>
</ArchivePolicy>