Class TempFileUtilImpl

  • All Implemented Interfaces:
    TempFileUtil

    public class TempFileUtilImpl
    extends java.lang.Object
    implements TempFileUtil
    This Class provides some methods to simply access output-files
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String TMPDIR_NAME
      the name of the dir which is created below the basepath
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanup​(java.lang.Object object)
      recursively removes the dir related to the given object.
      java.io.File getOutputDir​(java.lang.String relativePath)
      returns a directory created from the current output-path and the given relative path.
      java.io.File getOutputFile​(java.lang.Object object, java.lang.String relativePath)
      returns a file created from the current output-path, a sub directory for the given object and the relative path.
      java.io.File getOutputFile​(java.lang.String relativePath)
      returns a file created from the current output-path and the given relative path.
      void init()
      init - method called by spring
      void setPreferences​(JMadPreferences preferences)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TMPDIR_NAME

        public static final java.lang.String TMPDIR_NAME
        the name of the dir which is created below the basepath
        See Also:
        Constant Field Values
    • Constructor Detail

      • TempFileUtilImpl

        public TempFileUtilImpl()
    • Method Detail

      • init

        public void init()
        init - method called by spring
      • getOutputFile

        public final java.io.File getOutputFile​(java.lang.String relativePath)
        Description copied from interface: TempFileUtil
        returns a file created from the current output-path and the given relative path. This method also ensures, that the parent directory for the file is available.
        Specified by:
        getOutputFile in interface TempFileUtil
        Parameters:
        relativePath - the file-path in the current output-dir
        Returns:
        the File
      • getOutputDir

        public java.io.File getOutputDir​(java.lang.String relativePath)
        Description copied from interface: TempFileUtil
        returns a directory created from the current output-path and the given relative path. This method ensures that the directory exists, by creating it if non existing. The main difference to TempFileUtil.getOutputFile(String) is that TempFileUtil.getOutputFile(String) creates only the parent dir of the returned file, while this methods creates the directory itself.
        Specified by:
        getOutputDir in interface TempFileUtil
        Parameters:
        relativePath - the file-path relativ to the current output-dir
        Returns:
        the directory
      • getOutputFile

        public final java.io.File getOutputFile​(java.lang.Object object,
                                                java.lang.String relativePath)
        Description copied from interface: TempFileUtil
        returns a file created from the current output-path, a sub directory for the given object and the relative path. This is especially useful, if multiple threads of jmad are running and the results shall not interfere.
        Specified by:
        getOutputFile in interface TempFileUtil
        Parameters:
        object - the object which is used to create a subdir name.
        relativePath - the relative path
        Returns:
        the file
      • cleanup

        public final void cleanup​(java.lang.Object object)
        Description copied from interface: TempFileUtil
        recursively removes the dir related to the given object.
        Specified by:
        cleanup in interface TempFileUtil
        Parameters:
        object - the object for which to delete the dir
      • setPreferences

        public void setPreferences​(JMadPreferences preferences)