Skip to content
Snippets Groups Projects
Commit dd3f1b3d authored by brinn's avatar brinn
Browse files

add: methods for checking whether files, directories or paths are accessible (from FileUtilities)

[LMS-472] Solve performance problem of BDS dataset creation and process triggering on trunk
merged from branch 8.04.x, improvements for 8.04.3

SVN: 7832
parent b9b9cf6e
No related branches found
No related tags found
No related merge requests found
...@@ -310,6 +310,36 @@ public class FileOperations implements IFileOperations ...@@ -310,6 +310,36 @@ public class FileOperations implements IFileOperations
return FileUtilities.listFilesAndDirectories(directory, recursive, observerOrNull); return FileUtilities.listFilesAndDirectories(directory, recursive, observerOrNull);
} }
public String checkPathFullyAccessible(File path, String kindOfPath)
{
return FileUtilities.checkPathFullyAccessible(path, kindOfPath);
}
public String checkPathReadAccessible(File path, String kindOfPath)
{
return FileUtilities.checkPathReadAccessible(path, kindOfPath);
}
public String checkDirectoryFullyAccessible(File directory, String kindOfDirectory)
{
return FileUtilities.checkDirectoryFullyAccessible(directory, kindOfDirectory);
}
public String checkDirectoryReadAccessible(File directory, String kindOfDirectory)
{
return FileUtilities.checkDirectoryReadAccessible(directory, kindOfDirectory);
}
public String checkFileFullyAccessible(File file, String kindOfFile)
{
return FileUtilities.checkFileFullyAccessible(file, kindOfFile);
}
public String checkFileReadAccessible(File file, String kindOfFile)
{
return FileUtilities.checkFileReadAccessible(file, kindOfFile);
}
public void touch(File file) throws WrappedIOException public void touch(File file) throws WrappedIOException
{ {
try try
......
...@@ -189,6 +189,61 @@ public interface IFileOperations extends IFileRemover ...@@ -189,6 +189,61 @@ public interface IFileOperations extends IFileRemover
*/ */
public List<File> listFilesAndDirectories(File directory, boolean recursive); public List<File> listFilesAndDirectories(File directory, boolean recursive);
/**
* Checks whether a <var>path</var> of some <var>kind</var> is fully accessible to the program.
*
* @param kindOfPath description of given <var>path</var>. Mainly used for error messages.
* @return <code>null</code> if the <var>directory</var> is fully accessible and an error
* message describing the problem with the <var>directory</var> otherwise.
*/
public String checkPathFullyAccessible(final File path, final String kindOfPath);
/**
* Checks whether a <var>path</var> of some <var>kind</var> is accessible for reading to the
* program.
*
* @param kindOfPath description of given <var>path</var>. Mainly used for error messages.
* @return <code>null</code> if the <var>directory</var> is fully accessible and an error
* message describing the problem with the <var>directory</var> otherwise.
*/
public String checkPathReadAccessible(final File path, final String kindOfPath);
/**
* Checks whether a <var>directory</var> of some <var>kind</var> is fully accessible to the
* program (it's a directory, you can read and write in it)
*
* @return <code>null</code> if the <var>directory</var> is fully accessible and an error
* message describing the problem with the <var>directory</var> otherwise.
*/
public String checkDirectoryFullyAccessible(final File directory, final String kindOfDirectory);
/**
* Checks whether a <var>directory</var> of some <var>kind</var> is accessible for reading to
* the program (it's a directory, you can read and write in it)
*
* @return <code>null</code> if the <var>directory</var> is accessible for reading and an error
* message describing the problem with the <var>directory</var> otherwise.
*/
public String checkDirectoryReadAccessible(final File directory, final String kindOfDirectory);
/**
* Checks whether a <var>file</var> of some <var>kindOfFile</var> is accessible for reading to
* the program (so it's a file and you can read it)
*
* @return <code>null</code> if the <var>file</var> is accessible to reading and an error
* message describing the problem with the <var>file</var> otherwise.
*/
public String checkFileReadAccessible(final File file, final String kindOfFile);
/**
* Checks whether a <var>file</var> of some <var>kindOfFile</var> is accessible for reading and
* writing to the program (so it's a file and you can read and write it)
*
* @return <code>null</code> if the <var>file</var> is fully accessible and an error message
* describing the problem with the <var>file</var> otherwise.
*/
public String checkFileFullyAccessible(final File file, final String kindOfFile);
/** /**
* Sets the file's last modification time to the current time without changing the content. If * Sets the file's last modification time to the current time without changing the content. If
* the file does not exist, create it empty. * the file does not exist, create it empty.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment