Package thredds.util.filesource
Class BasicWithExclusionsDescendantFileSource
- java.lang.Object
-
- thredds.util.filesource.BasicWithExclusionsDescendantFileSource
-
- All Implemented Interfaces:
DescendantFileSource,FileSource
public class BasicWithExclusionsDescendantFileSource extends Object implements DescendantFileSource
_more_- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description BasicWithExclusionsDescendantFileSource(File rootDirectory, List<String> exclusions)BasicWithExclusionsDescendantFileSource(String rootDirectoryPath, List<String> exclusions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DescendantFileSourcegetDescendant(String relativePath)Return a DescendantFileSource representing the descendant directory specified by the relative path.FilegetFile(String path)Return the File, if it exists, that the given path represents for the FileSource implementation in use.StringgetRelativePath(File file)Return the path relative to the root directory that represents the given descendant file.StringgetRelativePath(String filePath)Return the path relative to the root directory that represents the given descendant file path.FilegetRootDirectory()Return the root directory represented by this FileLocator as a java.io.File.StringgetRootDirectoryPath()Return the path of the root directory represented by this FileLocator.booleanisDescendant(File file)Return true if the given File is an existing descendant of the root directory, false otherwise.booleanisDescendant(String filePath)Return true if the given file path is an existing descendant of the root directory, false otherwise.StringtoString()
-
-
-
Method Detail
-
getFile
public File getFile(String path)
Description copied from interface:FileSourceReturn the File, if it exists, that the given path represents for the FileSource implementation in use. Different implementations of FileSource can have different restrictions on the set of recognized paths. For instance, some implementations may only be able to handle paths that reference Files under a particular root directory.- Specified by:
getFilein interfaceFileSource- Parameters:
path- the path to the desired File.- Returns:
- the File represented by the path or null.
-
getDescendant
public DescendantFileSource getDescendant(String relativePath)
Description copied from interface:DescendantFileSourceReturn a DescendantFileSource representing the descendant directory specified by the relative path.- Specified by:
getDescendantin interfaceDescendantFileSource- Parameters:
relativePath- the relative path to the descendant directory.- Returns:
- a FileLocator representing the descendant root directory or null if the path is null or the descendant directory doesn't exist or isn't a directory (or isn't a descendant).
-
getRootDirectory
public File getRootDirectory()
Description copied from interface:DescendantFileSourceReturn the root directory represented by this FileLocator as a java.io.File.- Specified by:
getRootDirectoryin interfaceDescendantFileSource- Returns:
- the root directory represented by this FileLocator.
-
getRootDirectoryPath
public String getRootDirectoryPath()
Description copied from interface:DescendantFileSourceReturn the path of the root directory represented by this FileLocator.- Specified by:
getRootDirectoryPathin interfaceDescendantFileSource- Returns:
- the path of the root directory represented by this FileLocator.
-
isDescendant
public boolean isDescendant(File file)
Description copied from interface:DescendantFileSourceReturn true if the given File is an existing descendant of the root directory, false otherwise.- Specified by:
isDescendantin interfaceDescendantFileSource- Parameters:
file- the File to be checked if it is a descendant.- Returns:
- true if the given file is an existing descendant, false otherwise.
-
isDescendant
public boolean isDescendant(String filePath)
Description copied from interface:DescendantFileSourceReturn true if the given file path is an existing descendant of the root directory, false otherwise.- Specified by:
isDescendantin interfaceDescendantFileSource- Parameters:
filePath- the file path to be checked if it is a descendant.- Returns:
- true if the given file path represents an existing descendant, false otherwise.
-
getRelativePath
public String getRelativePath(File file)
Description copied from interface:DescendantFileSourceReturn the path relative to the root directory that represents the given descendant file.- Specified by:
getRelativePathin interfaceDescendantFileSource- Parameters:
file- the File for which the relative path is to be determined.- Returns:
- the path relative to the root directory that represents the given descendant file or null if the given file is null or not a descendant.
-
getRelativePath
public String getRelativePath(String filePath)
Description copied from interface:DescendantFileSourceReturn the path relative to the root directory that represents the given descendant file path.- Specified by:
getRelativePathin interfaceDescendantFileSource- Parameters:
filePath- the file path for which the relative path is to be determined.- Returns:
- the path relative to the root directory that represents the given descendant file path or null if the given file path is null or not a descendant.
-
-