org.pentaho.reporting.libraries.repository.file
Class FileContentLocation

java.lang.Object
  extended by org.pentaho.reporting.libraries.repository.file.FileContentEntity
      extended by org.pentaho.reporting.libraries.repository.file.FileContentLocation
All Implemented Interfaces:
java.io.Serializable, ContentEntity, ContentLocation

public class FileContentLocation
extends FileContentEntity
implements ContentLocation

A content-location that uses a directory as backend.

Author:
Thomas Morgner
See Also:
Serialized Form

Constructor Summary
FileContentLocation(ContentLocation parent, java.io.File backend)
          Creates a new location for the given parent and directory.
FileContentLocation(Repository repository, java.io.File backend)
          Creates a new root-location for the given repository and directory.
 
Method Summary
 ContentItem createItem(java.lang.String name)
          Creates a new data item in the current location.
 ContentLocation createLocation(java.lang.String name)
          Creates a new content location in the current location.
 boolean exists(java.lang.String name)
          Checks, whether an content entity with the given name exists in this content location.
 ContentEntity getEntry(java.lang.String name)
          Returns the content entity with the given name.
 ContentEntity[] listContents()
          Lists all content entities stored in this content-location.
 
Methods inherited from class org.pentaho.reporting.libraries.repository.file.FileContentEntity
delete, getAttribute, getBackend, getContentId, getName, getParent, getRepository, setAttribute
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.pentaho.reporting.libraries.repository.ContentEntity
delete, getAttribute, getContentId, getName, getParent, getRepository, setAttribute
 

Constructor Detail

FileContentLocation

public FileContentLocation(ContentLocation parent,
                           java.io.File backend)
                    throws ContentIOException
Creates a new location for the given parent and directory.

Parameters:
parent - the parent location.
backend - the backend.
Throws:
ContentIOException - if an error occured or the file did not point to a directory.

FileContentLocation

public FileContentLocation(Repository repository,
                           java.io.File backend)
                    throws ContentIOException
Creates a new root-location for the given repository and directory.

Parameters:
repository - the repository for which a location should be created.
backend - the backend.
Throws:
ContentIOException - if an error occured or the file did not point to a directory.
Method Detail

listContents

public ContentEntity[] listContents()
                             throws ContentIOException
Lists all content entities stored in this content-location. This method filters out all files that have an invalid name (according to the repository rules).

Specified by:
listContents in interface ContentLocation
Returns:
the content entities for this location.
Throws:
ContentIOException - if an repository error occured.

getEntry

public ContentEntity getEntry(java.lang.String name)
                       throws ContentIOException
Returns the content entity with the given name. If the entity does not exist, an Exception will be raised.

Specified by:
getEntry in interface ContentLocation
Parameters:
name - the name of the entity to be retrieved.
Returns:
the content entity for this name, never null.
Throws:
ContentIOException - if an repository error occured.

createItem

public ContentItem createItem(java.lang.String name)
                       throws ContentCreationException
Creates a new data item in the current location. This method must never return null. This method will fail if an entity with the same name exists in this location.

Specified by:
createItem in interface ContentLocation
Parameters:
name - the name of the new entity.
Returns:
the newly created entity, never null.
Throws:
ContentCreationException - if the item could not be created.

createLocation

public ContentLocation createLocation(java.lang.String name)
                               throws ContentCreationException
Creates a new content location in the current location. This method must never return null. This method will fail if an entity with the same name exists in this location.

Specified by:
createLocation in interface ContentLocation
Parameters:
name - the name of the new entity.
Returns:
the newly created entity, never null.
Throws:
ContentCreationException - if the item could not be created.

exists

public boolean exists(java.lang.String name)
Checks, whether an content entity with the given name exists in this content location. This method will report invalid filenames as non-existent.

Specified by:
exists in interface ContentLocation
Parameters:
name - the name of the new entity.
Returns:
true, if an entity exists with this name, false otherwise.