Package cern.accsoft.steering.jmad.util
Class TempFileUtilImpl
- java.lang.Object
-
- cern.accsoft.steering.jmad.util.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.StringTMPDIR_NAMEthe name of the dir which is created below the basepath
-
Constructor Summary
Constructors Constructor Description TempFileUtilImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup(java.lang.Object object)recursively removes the dir related to the given object.java.io.FilegetOutputDir(java.lang.String relativePath)returns a directory created from the current output-path and the given relative path.java.io.FilegetOutputFile(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.FilegetOutputFile(java.lang.String relativePath)returns a file created from the current output-path and the given relative path.voidinit()init - method called by springvoidsetPreferences(JMadPreferences preferences)
-
-
-
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
-
-
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:TempFileUtilreturns 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:
getOutputFilein interfaceTempFileUtil- 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:TempFileUtilreturns 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 toTempFileUtil.getOutputFile(String)is thatTempFileUtil.getOutputFile(String)creates only the parent dir of the returned file, while this methods creates the directory itself.- Specified by:
getOutputDirin interfaceTempFileUtil- 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:TempFileUtilreturns 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:
getOutputFilein interfaceTempFileUtil- 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:TempFileUtilrecursively removes the dir related to the given object.- Specified by:
cleanupin interfaceTempFileUtil- Parameters:
object- the object for which to delete the dir
-
setPreferences
public void setPreferences(JMadPreferences preferences)
-
-