net.sf.mmm.util.resource.base
Class AbstractBrowsableResourceProxy

java.lang.Object
  extended by net.sf.mmm.util.resource.base.AbstractDataResourceProxy
      extended by net.sf.mmm.util.resource.base.AbstractBrowsableResourceProxy
All Implemented Interfaces:
BrowsableResource, DataResource
Direct Known Subclasses:
AbstractBrowsableResourceFactory.BrowsableResourceAdapter

public abstract class AbstractBrowsableResourceProxy
extends AbstractDataResourceProxy
implements BrowsableResource

This is an abstract implementation of the BrowsableResource interface that delegates to another BrowsableResource.

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

Constructor Summary
AbstractBrowsableResourceProxy()
          The constructor.
 
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.
protected abstract  BrowsableResource getDelegate()
          This method gets the DataResource this proxy delegates to.
 boolean isFolder()
          This method determines if this BrowsableResource is a folder that potentially contains other resources.
 OutputStream openOutputStream()
          This method opens an output-stream in order to write data to the resource.
 
Methods inherited from class net.sf.mmm.util.resource.base.AbstractDataResourceProxy
getLastModificationDate, getName, getPath, getSize, getUri, getUrl, isAvailable, isData, isModifiedSince, navigate, openStream, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.resource.api.DataResource
getLastModificationDate, getName, getPath, getSize, getUri, getUrl, isAvailable, isData, isModifiedSince, navigate, openStream
 

Constructor Detail

AbstractBrowsableResourceProxy

public AbstractBrowsableResourceProxy()
The constructor.

Method Detail

getDelegate

protected abstract BrowsableResource getDelegate()
This method gets the DataResource this proxy delegates to.

Specified by:
getDelegate in class AbstractDataResourceProxy
Returns:
the delegate.

getChildResources

public 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.

Specified by:
getChildResources in interface BrowsableResource
Returns:
an Iterable of the child-resources.

getChildResources

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

Specified by:
getChildResources in interface BrowsableResource
Parameters:
filter - is the Filter applied to the child-resources.
Returns:
an Iterable of the child-resources.

isFolder

public boolean isFolder()
This method determines if this BrowsableResource is a folder that potentially contains other resources. Otherwise if this is no folder, BrowsableResource.getChildResources() will be empty (return an empty Iterable). However BrowsableResource.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 BrowsableResource.isFolder() and DataResource.isAvailable() can both return true or both return false.

Specified by:
isFolder in interface BrowsableResource
Returns:
true if this is a folder, false otherwise.

openOutputStream

public OutputStream openOutputStream()
                              throws ResourceNotWritableException
This method opens an output-stream in order to write data to the resource.

Specified by:
openOutputStream in interface DataResource
Overrides:
openOutputStream in class AbstractDataResourceProxy
Returns:
the OutputStream to write to the resource.
Throws:
ResourceNotWritableException - if the resource is NOT writable (e.g. read-only).


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