Class FilePathHelper

java.lang.Object
net.simplace.core.service.FilePathHelper

public final class FilePathHelper extends Object
Resource manager for FilePaths. Should be used allways to access the Filesystem can be used for getting Temp-Dir (Unique while software is run), Cache-Dir (Unique per user) and Random Temp-Dir (allways unique). All folders are situated in java.io.tmpdir/IMPETUS.
Author:
Andreas Enders
  • Method Details

    • getInstance

      public static FilePathHelper getInstance()
      Get Singleton instance of FilePathLocator.
      Returns:
      Singleton instance of FilePathLocator
    • getTempDirRoot

      public String getTempDirRoot()
      Returns the Tempdir used for all sessions of this JavaVM.
      Returns:
      the Tempdir used for all sessions of this JavaVM
    • setTempDirRoot

      public String setTempDirRoot(String aFilePath)
      Returns the aFilePath used for all sessions of this JavaVM.
      Parameters:
      aFilePath -
      Returns:
      the aFilePath used for all sessions of this JavaVM
    • getTempDir

      public String getTempDir()
      Returns the Tempdir used for only this session of the JavaVM.
      Returns:
      the Tempdir used for only this session of the JavaVM
    • getRandomTempDir

      public String getRandomTempDir()
      Returns a Random Tempdir used for only this session of the JavaVM.
      Returns:
      a Random Tempdir used for only this session of the JavaVM
    • getCacheDir

      public String getCacheDir()
      Returns the Cache used for all sessions of this JavaVM.
      Returns:
      the Cache used for all sessions of this JavaVM
    • setNewCacheVersion

      public void setNewCacheVersion(String aSystemID, String aFileName, String aTargetDir, float aVersion)
      Parameters:
      aSystemID -
      aFileName -
      aTargetDir -
      aVersion -
      aI -
    • getCacheVersion

      public float getCacheVersion(String aSystemID, String aFileName, String aTargetDir)
      Parameters:
      aSystemID -
      aFileName -
      aTargetDir -
      Returns:
      a cache version
    • getRandomFile

      public File getRandomFile(String aFileName)
      Returns the Tempfile used for only this call.
      Parameters:
      aFileName -
      Returns:
      the Tempfile used for only this call
    • getTempFile

      public File getTempFile(String aFileName) throws IOException
      Returns the Tempfile used for only this call.
      Parameters:
      aFileName -
      Returns:
      the Tempfile used for only this call
      Throws:
      IOException
    • removeTempDir

      public boolean removeTempDir()
      Removes the session - tempdir.
      Returns:
      success
    • removeAllClientTempDirs

      public boolean removeAllClientTempDirs()
      Removes the whole tempdir.
      Returns:
      success
    • getLogFile

      public static File getLogFile()
      Returns:
      Log file
    • getResourcePath

      public static File getResourcePath(File aFile)
      Parameters:
      aFile -
      Returns:
      Resource path