Package eu.isas.reporter.preferences
Class ReporterPathPreferences
java.lang.Object
eu.isas.reporter.preferences.ReporterPathPreferences
This class sets the path preferences for the files to read/write.
- Author:
- Marc Vaudel, Harald Barsnes
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumEnum of the paths which can be set in Reporter. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ArrayList<com.compomics.software.settings.PathKey> getErrorKeys(String jarFilePath) Returns a list containing the keys of the paths where the tool is not able to write.static StringgetPathPreference(ReporterPathPreferences.ReporterPathKey reporterPathKey, String jarFilePath) Returns the path according to the given key and path.static voidloadPathParametersFromFile(File inputFile) Loads the path preferences from a text file.static voidLoads a path to be set from a line.static voidsetAllPathsIn(String path) Sets all the paths inside a given folder.static voidsetPathPreference(ReporterPathPreferences.ReporterPathKey reporterPathKey, String path) Sets the path according to the given key and path.static voidwriteConfigurationToFile(com.compomics.util.io.flat.SimpleFileWriter writer) Writes the configuration file using the provided buffered writer.static voidwriteConfigurationToFile(File file) Writes all path configurations to the given file.static voidwritePathToFile(com.compomics.util.io.flat.SimpleFileWriter writer, ReporterPathPreferences.ReporterPathKey pathKey) Writes the path of interest using the provided buffered writer.
-
Constructor Details
-
ReporterPathPreferences
public ReporterPathPreferences()
-
-
Method Details
-
loadPathParametersFromFile
public static void loadPathParametersFromFile(File inputFile) throws FileNotFoundException, IOException Loads the path preferences from a text file.- Parameters:
inputFile- the file to load the path preferences from- Throws:
FileNotFoundException- thrown if an FileNotFoundException occursIOException- thrown if an IOException occurs
-
loadPathParametersFromLine
public static void loadPathParametersFromLine(String line) throws FileNotFoundException, IOException Loads a path to be set from a line.- Parameters:
line- the line where to read the path from- Throws:
FileNotFoundException- thrown of the file cannot be foundIOException
-
setPathPreference
public static void setPathPreference(ReporterPathPreferences.ReporterPathKey reporterPathKey, String path) Sets the path according to the given key and path.- Parameters:
reporterPathKey- the key of the pathpath- the path to be set
-
setAllPathsIn
Sets all the paths inside a given folder.- Parameters:
path- the path of the folder where to redirect all paths.- Throws:
FileNotFoundException- thrown if a file cannot be found
-
writeConfigurationToFile
Writes all path configurations to the given file.- Parameters:
file- the destination file- Throws:
FileNotFoundException- thrown if an FileNotFoundException occursIOException
-
writeConfigurationToFile
public static void writeConfigurationToFile(com.compomics.util.io.flat.SimpleFileWriter writer) throws IOException Writes the configuration file using the provided buffered writer.- Parameters:
writer- the writer to use for writing.- Throws:
FileNotFoundException- thrown if an FileNotFoundException occursIOException
-
writePathToFile
public static void writePathToFile(com.compomics.util.io.flat.SimpleFileWriter writer, ReporterPathPreferences.ReporterPathKey pathKey) throws IOException Writes the path of interest using the provided buffered writer.- Parameters:
writer- the writer to use for writingpathKey- the key of the path of interest- Throws:
IOException- thrown if an IOException occurs
-
getPathPreference
public static String getPathPreference(ReporterPathPreferences.ReporterPathKey reporterPathKey, String jarFilePath) Returns the path according to the given key and path.- Parameters:
reporterPathKey- the key of the pathjarFilePath- path to the jar file- Returns:
- the path
-
getErrorKeys
public static ArrayList<com.compomics.software.settings.PathKey> getErrorKeys(String jarFilePath) throws IOException Returns a list containing the keys of the paths where the tool is not able to write.- Parameters:
jarFilePath- the path to the jar file- Returns:
- a list containing the keys of the paths where the tool is not able to write
- Throws:
IOException- exception thrown whenever an error occurred while loading the path configuration
-