Interface IHierarchicalContent
-
- All Known Implementing Classes:
HierarchicalContentProxy
public interface IHierarchicalContent
Abstraction of a tree-like hierarchical content on the filesystem.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Cleans resources (e.g.IHierarchicalContentNode
getNode(java.lang.String relativePath)
Returns node with specified relativePath starting from root node.IHierarchicalContentNode
getRootNode()
Returns root node.java.util.List<IHierarchicalContentNode>
listMatchingNodes(java.lang.String relativePathPattern)
Returns list of all file nodes in this hierarchy with relative paths matching given relativePathPattern.java.util.List<IHierarchicalContentNode>
listMatchingNodes(java.lang.String startingPath, java.lang.String fileNamePattern)
Returns list of all file nodes in this hierarchy starting from startingPath with file names matching given fileNamePattern.IHierarchicalContentNode
tryGetNode(java.lang.String relativePath)
Returns node with specified relativePath starting from root node, ornull
, if this path does not exist.
-
-
-
Method Detail
-
getRootNode
IHierarchicalContentNode getRootNode()
Returns root node.
-
getNode
IHierarchicalContentNode getNode(java.lang.String relativePath) throws java.lang.IllegalArgumentException
Returns node with specified relativePath starting from root node. If the path isnull
or an empty string then the root node is returned.
- Throws:
java.lang.IllegalArgumentException
- if resource with given relativePath doesn't exist under the root of this content.
-
tryGetNode
IHierarchicalContentNode tryGetNode(java.lang.String relativePath)
Returns node with specified relativePath starting from root node, ornull
, if this path does not exist. If the path isnull
or an empty string then the root node is returned.
-
listMatchingNodes
java.util.List<IHierarchicalContentNode> listMatchingNodes(java.lang.String relativePathPattern)
Returns list of all file nodes in this hierarchy with relative paths matching given relativePathPattern.NOTE: this operation may be expensive for huge hierarchies. If prefix of relative path is constant use
listMatchingNodes(String, String)
instead with pattern for filename.
-
listMatchingNodes
java.util.List<IHierarchicalContentNode> listMatchingNodes(java.lang.String startingPath, java.lang.String fileNamePattern)
Returns list of all file nodes in this hierarchy starting from startingPath with file names matching given fileNamePattern.- Parameters:
startingPath
- Relative path from which the search should start. Use empty string to start in root.
-
close
void close()
Cleans resources (e.g. releases locks) acquired to access this hierarchical content.For now accessing
IHierarchicalContentNode
from a closed content doesn't fail immediately but it is unpredictable (e.g. files may no longer be accessible). One shouldn't call any methods ofIHierarchicalContentNode
-s that were acquired from a content which is closed at the time of invocation of the methods. In future version such operations will fail immediately.
-
-