com.plumtree.uiinfrastructure.tempfile
Class TempFile

java.lang.Object
  extended by com.plumtree.uiinfrastructure.tempfile.TempFile

public class TempFile
extends java.lang.Object

Author:
adolfoc Created on Dec 27, 2002

Field Summary
static java.lang.String BASE_TEMP_DIR
          The location of our temp directory.
static int MAX_TEMP_FILES
          The maximum number of temp files before we think that there's an error.
 
Constructor Summary
TempFile()
           
 
Method Summary
static java.lang.String CreateTempFile(java.lang.String strSubDirectory, java.lang.String strFilePrefix, java.lang.String strFileExtension, int nExpireFilesOlderThanMinutes)
          This is how we create a temp file.
static void ExpireTempFiles(java.lang.String strSubDirectory, int nExpireFilesOlderThanMinutes)
          This function expires (read deletes) files that were last modified more than nExpireFilesOlderThanMinutes ago from the strSubDirectory of the base temp directory.
static void StaticInit(java.lang.String strTempHome)
          Initializes our static variables for future use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BASE_TEMP_DIR

public static java.lang.String BASE_TEMP_DIR
The location of our temp directory. The current setting is a bogus default value. This should be reset from x_config.xml in StaticInit (which should be called in the warmup servlet).


MAX_TEMP_FILES

public static final int MAX_TEMP_FILES
The maximum number of temp files before we think that there's an error. This is a safegaurd value and should be set pretty high, but lower than the expected number of available handles on the system.

See Also:
Constant Field Values
Constructor Detail

TempFile

public TempFile()
Method Detail

CreateTempFile

public static java.lang.String CreateTempFile(java.lang.String strSubDirectory,
                                              java.lang.String strFilePrefix,
                                              java.lang.String strFileExtension,
                                              int nExpireFilesOlderThanMinutes)
This is how we create a temp file. Step #1: Use the sub-directory name supplied to find or create a subdirectory of the BASE_TEMP_DIR. Step #2: Using the file prefix and extension, we attempt to create a new file. If there is an existing file with the same name, we will append a number after the file prefix in order to make it unique. Step #3: We walk through all of the files in the supplied subdirectory and delete any whose last modified date is older than the expiration time. NOTE*: The expiration time is a minimum only and does not "stick" with the file created. It is used against all files in the sub-directory to determine when they should be deleted. The file created by this function will be deleted based on the expiration time passed into subsequent calls to this function - not based on this expiration time. NOTE**: The expiration time is measured from the last modified time of the created temp file - not the create time. Returns the full path of the created temp file. The created temp file may have some data in it. It is expected that the caller overwrite the created tempfile with their own data.


ExpireTempFiles

public static void ExpireTempFiles(java.lang.String strSubDirectory,
                                   int nExpireFilesOlderThanMinutes)
This function expires (read deletes) files that were last modified more than nExpireFilesOlderThanMinutes ago from the strSubDirectory of the base temp directory.


StaticInit

public static void StaticInit(java.lang.String strTempHome)
Initializes our static variables for future use.




Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.