com.ge.grc.acuity.apvfplus.actions
Class FileSystemInteractions

java.lang.Object
  extended bycom.ge.grc.acuity.apvfplus.actions.FileSystemInteractions

public class FileSystemInteractions
extends java.lang.Object


Field Summary
static java.lang.String EMPTY_DOUBLE_QUOTES
           
 
Constructor Summary
FileSystemInteractions()
           
 
Method Summary
static java.lang.String addEffectiveRoot(java.lang.String dir, java.lang.String effRoot)
          Adds the effective root to a given directory.
static java.lang.String convertPathToClient(java.lang.String path)
          Convert path to client syntax (with '$' for ':', forward slashes).
static java.lang.String convertPathToServer(java.lang.String path)
          Convert path to server syntax (with colons, forward slashes).
static java.util.List getDirectoryStructure(java.lang.String curDir)
          Call this method to get the directory structure directly above and directly below a given (args[0]) directory.
static java.util.List getDirectoryStructure(java.lang.String curDir, java.lang.Boolean includeAA)
          Call this method to get the directory structure directly above and directly below a given (args[0]) directory.
static java.util.List getDirectoryStructure(java.lang.String curDir, java.lang.Boolean includeAA, java.lang.String maxLen)
          Call this method to get the directory structure directly above and directly below a given (args[0]) directory.
static java.util.List getDirectoryStructure(java.lang.String curDir, java.lang.String maxLen)
          Call this method to get the directory structure directly above and directly below a given (args[0]) directory.
static java.util.List getDirectoryStructure(java.lang.String curDir, java.lang.String maxLen, java.lang.String _effectiveRoot)
          Gets the directory structure.
static java.util.List getDirectoryStructure(java.lang.String curDir, java.lang.String maxLen, java.lang.String _effectiveRoot, java.lang.Boolean includeAA)
          Gets the directory structure.
static java.lang.String getFileNameFromFullPath(java.lang.String fullPath)
          Gets the file name from the full path.
static java.util.List getFilesInCurrentDirectory(java.lang.String curDir)
          Call this directory to get a list of the files in the current directory (args[0]).
static java.util.List getFilesInCurrentDirectory(java.lang.String curDir, java.lang.String effRoot)
          Gets the files in current directory.
static java.util.List getFilteredFilesInCurrentDirectory(java.lang.String curDir, java.lang.String filter)
          Call this directory to get a [filtered] list of the files in the current directory (args[0]).
static java.util.List getFilteredFilesInCurrentDirectory(java.lang.String curDir, java.lang.String filter, java.lang.String effRoot)
          Gets the filtered files in current directory.
static java.lang.String removeEffectiveRoot(java.lang.String dir, java.lang.String effRoot)
          Removes the effective root from the absolute path of a directory.
 java.lang.String uploadDataFile(java.lang.String saveDir, org.apache.struts.upload.FormFile fileInfo)
          Upload a file from the client file system to the server file system.
 java.lang.String uploadDataFile(java.lang.String relDir, org.apache.struts.upload.FormFile fileInfo, java.lang.String effectiveRoot)
          Upload a file.
static java.lang.String validateCurrentDirectory(java.lang.String curDir, java.lang.String effRoot)
          Validate current directory relative to an effective root directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_DOUBLE_QUOTES

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

FileSystemInteractions

public FileSystemInteractions()
Method Detail

getFilesInCurrentDirectory

public static java.util.List getFilesInCurrentDirectory(java.lang.String curDir,
                                                        java.lang.String effRoot)
                                                 throws AcuityException
Gets the files in current directory.

Parameters:
effRoot - the effective root
curDir - the current directory
Returns:
the files in current directory
Throws:
AcuityException - the acuity exception

getFilesInCurrentDirectory

public static java.util.List getFilesInCurrentDirectory(java.lang.String curDir)
                                                 throws AcuityException
Call this directory to get a list of the files in the current directory (args[0]).

Returns:
- a List of the names of the files in the current directory
Throws:
SQLException
AcuityException

getFilteredFilesInCurrentDirectory

public static java.util.List getFilteredFilesInCurrentDirectory(java.lang.String curDir,
                                                                java.lang.String filter,
                                                                java.lang.String effRoot)
                                                         throws AcuityException
Gets the filtered files in current directory.

Parameters:
filter - the filter
curDir - the current directory
effRoot - the effective root
Returns:
the filtered files in current directory
Throws:
AcuityException - the acuity exception

getFilteredFilesInCurrentDirectory

public static java.util.List getFilteredFilesInCurrentDirectory(java.lang.String curDir,
                                                                java.lang.String filter)
                                                         throws AcuityException
Call this directory to get a [filtered] list of the files in the current directory (args[0]).

Returns:
- a List of the names of the files in the current directory meeting the filter conditions
Throws:
SQLException
AcuityException

getDirectoryStructure

public static java.util.List getDirectoryStructure(java.lang.String curDir)
                                            throws AcuityException
Call this method to get the directory structure directly above and directly below a given (args[0]) directory. Note: by default all directories above the curDir will be included.

Parameters:
curDir - - the directory in question
Returns:
- a List of directories: the one above, this one, and the ones directly below
Throws:
AcuityException

getDirectoryStructure

public static java.util.List getDirectoryStructure(java.lang.String curDir,
                                                   java.lang.String maxLen)
                                            throws AcuityException
Call this method to get the directory structure directly above and directly below a given (args[0]) directory.

Parameters:
curDir - - the directory in question
maxLen - - the maximum length of an entry in the list. If exceeded, a separate display string will be abbreviated.
Returns:
- a List of directories: the one above, this one, and the ones directly below
Throws:
AcuityException

getDirectoryStructure

public static java.util.List getDirectoryStructure(java.lang.String curDir,
                                                   java.lang.String maxLen,
                                                   java.lang.String _effectiveRoot)
                                            throws AcuityException
Gets the directory structure.

Parameters:
curDir - the current directory
maxLen - the maximum length of the display item (2nd element) for the directory item
_effectiveRoot - the effective root
Returns:
the directory structure
Throws:
AcuityException - the acuity exception

getDirectoryStructure

public static java.util.List getDirectoryStructure(java.lang.String curDir,
                                                   java.lang.String maxLen,
                                                   java.lang.String _effectiveRoot,
                                                   java.lang.Boolean includeAA)
                                            throws AcuityException
Gets the directory structure.

Parameters:
curDir - the current directory
maxLen - the maximum length of the display item (2nd element) for the directory item
_effectiveRoot - the effective root
includeAA - if true include all ancestor directories
Returns:
the directory structure
Throws:
AcuityException - the acuity exception

validateCurrentDirectory

public static java.lang.String validateCurrentDirectory(java.lang.String curDir,
                                                        java.lang.String effRoot)
Validate current directory relative to an effective root directory. If the current directory isn't at or under the effective root, the current directory is set to the effective root.

Parameters:
curDir - the current directory
effRoot - the effective root
Returns:
the string

getDirectoryStructure

public static java.util.List getDirectoryStructure(java.lang.String curDir,
                                                   java.lang.Boolean includeAA,
                                                   java.lang.String maxLen)
                                            throws AcuityException
Call this method to get the directory structure directly above and directly below a given (args[0]) directory.

Parameters:
curDir - - the directory in question
includeAA - - if true include all the directories above else include only the one directly above
maxLen - - the maximum length of an entry in the list. If exceeded, a separate display string will be abbreviated.
Returns:
- a List of directories: the one above, this one, and the ones directly below
Throws:
AcuityException

getDirectoryStructure

public static java.util.List getDirectoryStructure(java.lang.String curDir,
                                                   java.lang.Boolean includeAA)
                                            throws AcuityException
Call this method to get the directory structure directly above and directly below a given (args[0]) directory.

Parameters:
curDir - - the directory in question
includeAA - - if true include all the directories above else include only the one directly above
Returns:
- a List of directories: the one above, this one, and the ones directly below
Throws:
AcuityException

addEffectiveRoot

public static java.lang.String addEffectiveRoot(java.lang.String dir,
                                                java.lang.String effRoot)
Adds the effective root to a given directory.

Parameters:
effRoot - the effective root
dir - the directory
Returns:
the absolute path of the directory

removeEffectiveRoot

public static java.lang.String removeEffectiveRoot(java.lang.String dir,
                                                   java.lang.String effRoot)
Removes the effective root from the absolute path of a directory.

Parameters:
effRoot - the effective root
dir - the absolute path of a directory
Returns:
the relative path of the directory with the effective root removed from the beginning

convertPathToServer

public static java.lang.String convertPathToServer(java.lang.String path)
Convert path to server syntax (with colons, forward slashes).

Parameters:
path - the path
Returns:
the converted path

convertPathToClient

public static java.lang.String convertPathToClient(java.lang.String path)
Convert path to client syntax (with '$' for ':', forward slashes).

Parameters:
path - the path
Returns:
the converted path

getFileNameFromFullPath

public static java.lang.String getFileNameFromFullPath(java.lang.String fullPath)
Gets the file name from the full path.

Parameters:
fullPath - the full path
Returns:
the file name from full path

uploadDataFile

public java.lang.String uploadDataFile(java.lang.String relDir,
                                       org.apache.struts.upload.FormFile fileInfo,
                                       java.lang.String effectiveRoot)
                                throws AcuityException
Upload a file.

Parameters:
fileInfo - the file info from the Apache processing of the HTML Form input type FILE
effectiveRoot - the effective root
relDir - the relative directory (relative to effective root) into which the uploaded file is to be placed
Returns:
the status of the upload operation
Throws:
AcuityException - the acuity exception

uploadDataFile

public java.lang.String uploadDataFile(java.lang.String saveDir,
                                       org.apache.struts.upload.FormFile fileInfo)
                                throws AcuityException
Upload a file from the client file system to the server file system.

Parameters:
fileInfo - the information about the file on the client file system being uploaded
saveDir - the directory on the server file system where the file is to be saved
Returns:
the status of the upload operation
Throws:
AcuityException