gov.nih.nci.caarray.services.util.file
Class FileLocatorUtils

java.lang.Object
  extended by gov.nih.nci.caarray.services.util.file.FileLocatorUtils

public final class FileLocatorUtils
extends java.lang.Object

Looks up file locations

Author:
gustafsons, tranp

Constructor Summary
FileLocatorUtils()
           
 
Method Summary
static boolean deleteDirectory(java.lang.String directory)
           
static java.lang.String getAffyLibraryDirectory()
           
static java.lang.String getArrayDesignDataFileInputDirectory(java.lang.String fileTypeId)
          This method is for release 1.3 to get the temporary directory to store the files to be parsed into ArrayDesign.
static java.lang.String getArrayDesignFileDirectory()
          Finds the final directory for placing the arrayDesign's uploaded files including MAGE-ML and GAL.
static java.lang.String getArrayDesignFileInputDirectory(java.lang.Long arrayDesignId)
          This method is for release 1.3.1.
static java.lang.String getArrayDesignMAGEMLFileDirectory()
          Finds the logical directory for the arrayDesign files, if not there it makes it.
static java.lang.String getDesignElementsFileLocation(long arrayDesignId, HybridizationFileType fileType)
          Get the cache file for DesignElements based on the specified UploadFileType provided by the new hybridization parsing service.
static java.lang.String getDesignElementsFileLocation(java.lang.Long arrayDesignId, UploadFileTypes.MICROARRAY_FILE_TYPE type)
           
static java.lang.String getExperimentDataFilesDirectory()
           
static java.lang.String getExperimentDataFilesDirectory(java.lang.Long experimentId)
          Finds the logical directory for the experimentData files, if not there it makes it.
static java.lang.String getExperimentInputFileDirectory()
          Input directory for Experiment MAGEML upload
static java.lang.String getExperimentInputFileDirectory(long experimentId)
          Finds the logical directory for the input files, if the directory doesn't exist, it is created.
static java.lang.String getExperimentInputFileDirectory(java.lang.Long experimentId)
          Finds the logical directory for the input files, if the directory doesn't exist, it is created.
static java.lang.String getExperimentMAGEMLFileDirectory()
          Finds the logical directory for the experimentMAGEML files, if the directory doesn't exists, creates it.
static java.lang.String getExperimentMAGEMLFileDirectory(java.lang.Long experimentId)
          Finds the logical directory for the generated experiment MAGEML files, if the directory doesn't exists, creates it.
static java.lang.String getExperimentMAGEMLFileDirectory(java.lang.Long experimentId, boolean createIfNotExists)
           
static java.lang.String getGalFileInputLocation(java.lang.String fileName)
           
static java.io.File getLatestModifiedFile(java.lang.String directory)
           
static java.io.File getLatestModifiedFile(java.lang.String directory, java.lang.String extension)
          Retrieves the latest created file in the specified directory.
static java.lang.String getNETCDFFileLocation(java.lang.Long experimentId, java.lang.Long bioAssayId)
          Locates the file path name for the .nc (NETCDF) file that stores the the parsed quantification data or BioDataCube for the specified BioAssay contained in the specified Experiment.
static java.lang.String getNETCDFFileLocation(java.lang.String directory, java.lang.Long bioAssayId)
          Locates the file path name for the .nc (NETCDF) file that stores the the parsed quantification data or BioDataCube for the specified BioAssay.
static java.lang.String getNETCDFOutputFileDirectory(java.lang.Long experimentId)
           
static java.lang.String getQuantitationTypesFileLocation(java.lang.String softwareName)
           
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileLocatorUtils

public FileLocatorUtils()
Method Detail

getArrayDesignFileDirectory

public static java.lang.String getArrayDesignFileDirectory()
Finds the final directory for placing the arrayDesign's uploaded files including MAGE-ML and GAL. If not there it makes it.


getArrayDesignMAGEMLFileDirectory

public static java.lang.String getArrayDesignMAGEMLFileDirectory()
Finds the logical directory for the arrayDesign files, if not there it makes it.


getExperimentInputFileDirectory

public static java.lang.String getExperimentInputFileDirectory(java.lang.Long experimentId)
Finds the logical directory for the input files, if the directory doesn't exist, it is created.


getExperimentInputFileDirectory

public static java.lang.String getExperimentInputFileDirectory(long experimentId)
Finds the logical directory for the input files, if the directory doesn't exist, it is created.


getExperimentInputFileDirectory

public static java.lang.String getExperimentInputFileDirectory()
Input directory for Experiment MAGEML upload

Returns:

getNETCDFOutputFileDirectory

public static java.lang.String getNETCDFOutputFileDirectory(java.lang.Long experimentId)

getNETCDFFileLocation

public static java.lang.String getNETCDFFileLocation(java.lang.Long experimentId,
                                                     java.lang.Long bioAssayId)
Locates the file path name for the .nc (NETCDF) file that stores the the parsed quantification data or BioDataCube for the specified BioAssay contained in the specified Experiment.

Parameters:
experimentId - - The Experiment that contains the specified BioAssay
bioAssayId - - The BioAssay that references the returned NETCDF file contained quantification data.

getNETCDFFileLocation

public static java.lang.String getNETCDFFileLocation(java.lang.String directory,
                                                     java.lang.Long bioAssayId)
Locates the file path name for the .nc (NETCDF) file that stores the the parsed quantification data or BioDataCube for the specified BioAssay. The NETCDF file is known to be located at the specified directory.

Parameters:
directory - - The directory at which the NETCDF file is located.
bioAssayId - - The BioAssay that references the returned NETCDF file contained quantification data.
Returns:

getDesignElementsFileLocation

public static java.lang.String getDesignElementsFileLocation(java.lang.Long arrayDesignId,
                                                             UploadFileTypes.MICROARRAY_FILE_TYPE type)

getDesignElementsFileLocation

public static java.lang.String getDesignElementsFileLocation(long arrayDesignId,
                                                             HybridizationFileType fileType)
Get the cache file for DesignElements based on the specified UploadFileType provided by the new hybridization parsing service.

Parameters:
arrayDesignId -
fileType -
Returns:

getQuantitationTypesFileLocation

public static java.lang.String getQuantitationTypesFileLocation(java.lang.String softwareName)

getGalFileInputLocation

public static java.lang.String getGalFileInputLocation(java.lang.String fileName)

getArrayDesignDataFileInputDirectory

public static java.lang.String getArrayDesignDataFileInputDirectory(java.lang.String fileTypeId)
This method is for release 1.3 to get the temporary directory to store the files to be parsed into ArrayDesign. The GAL files that used to be stored in its own directory will be moved to be in this directory.

Parameters:
fileTypeId - - The fileTypeId representing this file type as configured in the file mapping XML file.
Returns:
The full directory path which is created if it doesn't exist.

getArrayDesignFileInputDirectory

public static java.lang.String getArrayDesignFileInputDirectory(java.lang.Long arrayDesignId)
This method is for release 1.3.1. When the gal file is uploaded after an array design is created, the file will be placed in the directory created by this method. There will be only one gal file in this directory, so file name crash is not an issue.

Parameters:
arrayDesignId - the array design id, which will be used to name this subdirectory, under which the gal file is place
Returns:
The full directory path which is created if it doesn't exist.

getExperimentMAGEMLFileDirectory

public static java.lang.String getExperimentMAGEMLFileDirectory()
Finds the logical directory for the experimentMAGEML files, if the directory doesn't exists, creates it.

Returns:
The directory path for uploaded experiment MAGEML files.

getExperimentMAGEMLFileDirectory

public static java.lang.String getExperimentMAGEMLFileDirectory(java.lang.Long experimentId)
Finds the logical directory for the generated experiment MAGEML files, if the directory doesn't exists, creates it.

Parameters:
experimentId - - The experiment for which the returned directory is intended.
Returns:
The directory path for generated experiment MAGEML files.

getExperimentMAGEMLFileDirectory

public static java.lang.String getExperimentMAGEMLFileDirectory(java.lang.Long experimentId,
                                                                boolean createIfNotExists)

getExperimentDataFilesDirectory

public static java.lang.String getExperimentDataFilesDirectory(java.lang.Long experimentId)
Finds the logical directory for the experimentData files, if not there it makes it.


getAffyLibraryDirectory

public static java.lang.String getAffyLibraryDirectory()

getLatestModifiedFile

public static java.io.File getLatestModifiedFile(java.lang.String directory)

deleteDirectory

public static boolean deleteDirectory(java.lang.String directory)

getLatestModifiedFile

public static java.io.File getLatestModifiedFile(java.lang.String directory,
                                                 java.lang.String extension)
Retrieves the latest created file in the specified directory.

Parameters:
directory - - The directory in which the latest created file is retrieved.
extension - - The file extension, either prefixed with dot or not, e.g. .zip, zip.
Returns:
The latest modified file or NULL if the directory doesn't exist or is empty.

main

public static final void main(java.lang.String[] args)

getExperimentDataFilesDirectory

public static java.lang.String getExperimentDataFilesDirectory()