net.sf.mmm.util.resource.api
Interface BrowsableResource

All Superinterfaces:
DataResource
All Known Implementing Classes:
AbstractBrowsableResource, AbstractBrowsableResourceFactory.BrowsableResourceAdapter, AbstractBrowsableResourceProxy, FileResource

public interface BrowsableResource
extends DataResource

This is the interface for a DataResource that has higher-level features and may contain other resources. You can think of a BrowsableResource as a file that is a directory or a regular file. However it may be both and it can originate from other sources than the filesystem.
ATTENTION:
This API has a high level of abstraction. It is possible that the underlying implementation e.g. forms a web-crawler where a HTML-page is data containing the HTML-content as well as a folder containing the linked sites. Further you have to be careful when recursively scanning BrowsableResources that you avoid infinity loops. E.g. create a Set holding the URIs of the BrowsableResources that have already been visited.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Method Summary
 Iterable<BrowsableResource> getChildResources()
          This method iterates the immediate child-resources contained in this BrowsableResource.
 Iterable<BrowsableResource> getChildResources(Filter<BrowsableResource> filter)
          This method iterates the immediate child-resources contained in this BrowsableResource and are accepted by the given filter.
 boolean isFolder()
          This method determines if this BrowsableResource is a folder that potentially contains other resources.
 
Methods inherited from interface net.sf.mmm.util.resource.api.DataResource
getLastModificationDate, getName, getPath, getSize, getUri, getUrl, isAvailable, isData, isModifiedSince, navigate, openOutputStream, openStream
 

Method Detail

getChildResources

Iterable<BrowsableResource> getChildResources()
This method iterates the immediate child-resources contained in this BrowsableResource.
If this is no folder, this method will always return an empty Iterable.

Returns:
an Iterable of the child-resources.

getChildResources

Iterable<BrowsableResource> getChildResources(Filter<BrowsableResource> filter)
This method iterates the immediate child-resources contained in this BrowsableResource and are accepted by the given filter.

Parameters:
filter - is the Filter applied to the child-resources.
Returns:
an Iterable of the child-resources.

isFolder

boolean isFolder()
This method determines if this BrowsableResource is a folder that potentially contains other resources. Otherwise if this is no folder, getChildResources() will be empty (return an empty Iterable). However getChildResources() can also be empty, if this is a folder.
In order to determine if this BrowsableResource is containing data, please use DataResource.isAvailable(). Please note that isFolder() and DataResource.isAvailable() can both return true or both return false.

Returns:
true if this is a folder, false otherwise.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.