atg.test.util
Class FileUtil

java.lang.Object
  extended by atg.test.util.FileUtil

public class FileUtil
extends java.lang.Object

A collection of utility methods for dealing with the filesystem.

Author:
robert

Field Summary
static java.lang.String COULD_NOT_DELETE_TEMP_DIRECTORY
           
 
Constructor Summary
FileUtil()
           
 
Method Summary
static void copyDirectory(java.lang.String srcDir, java.lang.String dstDir, java.util.List<java.lang.String> excludes)
           
static void copyFile(java.lang.String src, java.lang.String dst)
           
static void createPropertyFile(java.lang.String componentName, java.io.File configurationStagingLocation, java.lang.Class<?> clazz, java.util.Map<java.lang.String,java.lang.String> settings)
           
static void deleteDirectoryOnShutdown(java.io.File tmpDir)
          Deletes the given directory when the JVM exits.
static java.util.Map<java.lang.String,java.lang.Long> deserialize(java.io.File file, long serialTtl)
           
static java.util.Map<java.lang.String,java.lang.Long> getConfigFilesTimestamps()
           
static boolean isDirty()
           
 void searchAndReplace(java.lang.String originalValue, java.lang.String newValue, java.io.File file)
           
static void serialize(java.io.File file, java.lang.Object o)
           
static void setConfigFilesGlobalForce(java.util.Map<java.lang.String,java.lang.Long> config_files_global_force)
           
static void setConfigFilesTimestamps(java.util.Map<java.lang.String,java.lang.Long> config_files_timestamps)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COULD_NOT_DELETE_TEMP_DIRECTORY

public static final java.lang.String COULD_NOT_DELETE_TEMP_DIRECTORY
See Also:
Constant Field Values
Constructor Detail

FileUtil

public FileUtil()
Method Detail

copyDirectory

public static void copyDirectory(java.lang.String srcDir,
                                 java.lang.String dstDir,
                                 java.util.List<java.lang.String> excludes)
                          throws java.io.IOException
Parameters:
srcDir -
dstDir -
excludes -
Throws:
java.io.IOException

copyFile

public static void copyFile(java.lang.String src,
                            java.lang.String dst)
                     throws java.io.IOException
Parameters:
src -
dst -
Throws:
java.io.IOException

createPropertyFile

public static void createPropertyFile(java.lang.String componentName,
                                      java.io.File configurationStagingLocation,
                                      java.lang.Class<?> clazz,
                                      java.util.Map<java.lang.String,java.lang.String> settings)
                               throws java.io.IOException
Parameters:
componentName - The name of the nucleus component
configurationStagingLocation - A valid not null directory.
clazz - The class implementing the nucleus component
settings - An implementation of Map containing all needed properties the component is depended on (eg key = username, value = test). Can be null or empty.
Throws:
java.io.IOException

searchAndReplace

public void searchAndReplace(java.lang.String originalValue,
                             java.lang.String newValue,
                             java.io.File file)
                      throws java.io.IOException
Throws:
java.io.IOException

deleteDirectoryOnShutdown

public static void deleteDirectoryOnShutdown(java.io.File tmpDir)
Deletes the given directory when the JVM exits. This method does so by implementing a shutdown hook.

Parameters:
tmpDir -

serialize

public static void serialize(java.io.File file,
                             java.lang.Object o)
                      throws java.io.IOException
Throws:
java.io.IOException

deserialize

public static java.util.Map<java.lang.String,java.lang.Long> deserialize(java.io.File file,
                                                                         long serialTtl)

setConfigFilesTimestamps

public static void setConfigFilesTimestamps(java.util.Map<java.lang.String,java.lang.Long> config_files_timestamps)

setConfigFilesGlobalForce

public static void setConfigFilesGlobalForce(java.util.Map<java.lang.String,java.lang.Long> config_files_global_force)

isDirty

public static boolean isDirty()

getConfigFilesTimestamps

public static java.util.Map<java.lang.String,java.lang.Long> getConfigFilesTimestamps()


Copyright © 2009. All Rights Reserved.