org.jenkinsci.plugins.periodicbackup
Class Util

java.lang.Object
  extended by org.jenkinsci.plugins.periodicbackup.Util

public class Util
extends java.lang.Object


Constructor Summary
Util()
           
 
Method Summary
static java.io.File createBackupObjectFile(BackupObject backupObject, java.lang.String destinationDir, java.lang.String fileNameBase)
          Creates the backupObject File from given BackupObject, fileNameBase and destination path
static java.lang.String createFileName(java.lang.String fileName, java.lang.String extension)
          Puts the filename and the extension together
static java.io.FileFilter extensionFileFilter(java.lang.String extension)
          Creates FileFilter for files with the given extension
static java.lang.String generateFileNameBase(java.util.Date date)
          Generates unique file name (without extension)
static java.lang.String getExtension(java.io.File f)
          This returns extension of the given File object, returns null if the file has no extension
static java.lang.String getFormattedDate(java.lang.String pattern, java.util.Date date)
          This returns timestamp String
static java.lang.String getRelativePath(java.io.File file, java.io.File baseDir)
          This returns relative path of given file with respect to given base directory
static boolean isValidBackupObjectFile(java.io.File backupObjectFile)
          This test if a given file is a valid serialized BackupObject file
static boolean isWritableDirectory(java.io.File directory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Util

public Util()
Method Detail

getRelativePath

public static java.lang.String getRelativePath(java.io.File file,
                                               java.io.File baseDir)
This returns relative path of given file with respect to given base directory

Parameters:
file - input file
baseDir - base directory
Returns:
String with relative @file path with respect to its @baseDir

generateFileNameBase

public static java.lang.String generateFileNameBase(java.util.Date date)
Generates unique file name (without extension)

Parameters:
date - Date object for the timestamp
Returns:
unique filename

getFormattedDate

public static java.lang.String getFormattedDate(java.lang.String pattern,
                                                java.util.Date date)
This returns timestamp String

Parameters:
pattern - A pattern used to format the timestamp
date - Date used as timestamp
Returns:
timestamp String

createFileName

public static java.lang.String createFileName(java.lang.String fileName,
                                              java.lang.String extension)
Puts the filename and the extension together

Parameters:
fileName - filename without extension
extension - extension of the file
Returns:
filename with extension

createBackupObjectFile

public static java.io.File createBackupObjectFile(BackupObject backupObject,
                                                  java.lang.String destinationDir,
                                                  java.lang.String fileNameBase)
                                           throws java.io.IOException
Creates the backupObject File from given BackupObject, fileNameBase and destination path

Parameters:
backupObject - BackupObject given to be serialized
destinationDir - String with path to the directory where the file will be created
fileNameBase - first part of the filename
Returns:
serialized BackupObject File
Throws:
java.io.IOException - If an IO problem occurs

isValidBackupObjectFile

public static boolean isValidBackupObjectFile(java.io.File backupObjectFile)
                                       throws java.io.IOException
This test if a given file is a valid serialized BackupObject file

Parameters:
backupObjectFile - File to test
Returns:
true if valid, false otherwise
Throws:
java.io.IOException - If an IO problem occurs

extensionFileFilter

public static java.io.FileFilter extensionFileFilter(java.lang.String extension)
Creates FileFilter for files with the given extension

Parameters:
extension - file extension
Returns:
FileFilter

getExtension

public static java.lang.String getExtension(java.io.File f)
This returns extension of the given File object, returns null if the file has no extension

Parameters:
f - given File
Returns:
String with the extension of the given file

isWritableDirectory

public static boolean isWritableDirectory(java.io.File directory)


Copyright © 2004-2013. All Rights Reserved.