Class FileObjectContentLocation

  • All Implemented Interfaces:
    Serializable, org.pentaho.reporting.libraries.repository.ContentEntity, org.pentaho.reporting.libraries.repository.ContentLocation

    public class FileObjectContentLocation
    extends FileObjectContentEntity
    implements org.pentaho.reporting.libraries.repository.ContentLocation
    A content-location that uses a directory as backend.
    Author:
    Thomas Morgner, Alexander Buloichik
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      FileObjectContentLocation​(org.pentaho.reporting.libraries.repository.ContentLocation parent, org.apache.commons.vfs2.FileObject backend)
      Creates a new location for the given parent and directory.
      FileObjectContentLocation​(org.pentaho.reporting.libraries.repository.Repository repository, org.apache.commons.vfs2.FileObject backend)
      Creates a new root-location for the given repository and directory.
    • Constructor Detail

      • FileObjectContentLocation

        public FileObjectContentLocation​(org.pentaho.reporting.libraries.repository.ContentLocation parent,
                                         org.apache.commons.vfs2.FileObject backend)
                                  throws org.pentaho.reporting.libraries.repository.ContentIOException
        Creates a new location for the given parent and directory.
        Parameters:
        parent - the parent location.
        backend - the backend.
        Throws:
        org.pentaho.reporting.libraries.repository.ContentIOException - if an error occured or the file did not point to a directory.
      • FileObjectContentLocation

        public FileObjectContentLocation​(org.pentaho.reporting.libraries.repository.Repository repository,
                                         org.apache.commons.vfs2.FileObject backend)
                                  throws org.pentaho.reporting.libraries.repository.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:
        org.pentaho.reporting.libraries.repository.ContentIOException - if an error occured or the file did not point to a directory.
    • Method Detail

      • listContents

        public org.pentaho.reporting.libraries.repository.ContentEntity[] listContents()
                                                                                throws org.pentaho.reporting.libraries.repository.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 org.pentaho.reporting.libraries.repository.ContentLocation
        Returns:
        the content entities for this location.
        Throws:
        org.pentaho.reporting.libraries.repository.ContentIOException - if an repository error occured.
      • getEntry

        public org.pentaho.reporting.libraries.repository.ContentEntity getEntry​(String name)
                                                                          throws org.pentaho.reporting.libraries.repository.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 org.pentaho.reporting.libraries.repository.ContentLocation
        Parameters:
        name - the name of the entity to be retrieved.
        Returns:
        the content entity for this name, never null.
        Throws:
        org.pentaho.reporting.libraries.repository.ContentIOException - if an repository error occured.
      • createItem

        public org.pentaho.reporting.libraries.repository.ContentItem createItem​(String name)
                                                                          throws org.pentaho.reporting.libraries.repository.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 org.pentaho.reporting.libraries.repository.ContentLocation
        Parameters:
        name - the name of the new entity.
        Returns:
        the newly created entity, never null.
        Throws:
        org.pentaho.reporting.libraries.repository.ContentCreationException - if the item could not be created.
      • createLocation

        public org.pentaho.reporting.libraries.repository.ContentLocation createLocation​(String name)
                                                                                  throws org.pentaho.reporting.libraries.repository.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 org.pentaho.reporting.libraries.repository.ContentLocation
        Parameters:
        name - the name of the new entity.
        Returns:
        the newly created entity, never null.
        Throws:
        org.pentaho.reporting.libraries.repository.ContentCreationException - if the item could not be created.
      • exists

        public boolean exists​(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 org.pentaho.reporting.libraries.repository.ContentLocation
        Parameters:
        name - the name of the new entity.
        Returns:
        true, if an entity exists with this name, false otherwise.