Class StreamContentLocation

java.lang.Object
org.pentaho.reporting.libraries.repository.stream.StreamContentLocation
All Implemented Interfaces:
ContentEntity, ContentLocation

public class StreamContentLocation extends java.lang.Object implements ContentLocation
A content location that wraps around a single stream. The location will reject any attempts to create new entities or to access entities other than the single entity.
Author:
Thomas Morgner
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new stream-location.
  • Method Summary

    Modifier and Type
    Method
    Description
    createItem(java.lang.String name)
    Creates a new data item in the current location.
    createLocation(java.lang.String name)
    This method always throws an exception, as stream-repositories cannot create sub-locations.
    boolean
    Stream-repositories do not support the deletion of entries.
    boolean
    exists(java.lang.String name)
    Checks, whether an content entity with the given name exists in this content location.
    java.lang.Object
    getAttribute(java.lang.String domain, java.lang.String key)
    Stream-Repositories do not support attributes.
    java.lang.Object
    Returns a unique identifier.
    getEntry(java.lang.String name)
    Returns the content entity with the given name.
    java.lang.String
    Returns the generic name of this location.
    Returns a reference to the parent location.
    Returns the current repository, to which tis entity belongs.
    Returns all content entities stored in this content-location.
    boolean
    setAttribute(java.lang.String domain, java.lang.String key, java.lang.Object value)
    Stream-Repositories do not support attributes.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • StreamContentLocation

      public StreamContentLocation(StreamRepository repository)
      Creates a new stream-location. There can be only one location per stream-repository.
      Parameters:
      repository - the repository for which a location is created.
  • Method Details

    • listContents

      public ContentEntity[] listContents() throws ContentIOException
      Returns all content entities stored in this content-location. This returns a array that has at most one entry. If the repository is a write-only repository and no item has been created yet, the method returns an empty array.
      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
      This method always throws an exception, as stream-repositories cannot create sub-locations.
      Specified by:
      createLocation in interface ContentLocation
      Parameters:
      name - the name.
      Returns:
      nothing.
      Throws:
      ContentCreationException - always, as stream-repositories cannot create sub-locations.
    • exists

      public boolean exists(java.lang.String name)
      Checks, whether an content entity with the given name exists in this content location.
      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.
    • getName

      public java.lang.String getName()
      Returns the generic name of this location.
      Specified by:
      getName in interface ContentEntity
      Returns:
      the name.
    • getContentId

      public java.lang.Object getContentId()
      Returns a unique identifier. This can be canonical filename or a database key. It must be guaranteed that within the same repository the key will be unique.
      Specified by:
      getContentId in interface ContentEntity
      Returns:
      the unique content ID.
    • getAttribute

      public java.lang.Object getAttribute(java.lang.String domain, java.lang.String key)
      Stream-Repositories do not support attributes.
      Specified by:
      getAttribute in interface ContentEntity
      Parameters:
      domain - the attribute domain.
      key - the name of the attribute.
      Returns:
      always null.
    • setAttribute

      public boolean setAttribute(java.lang.String domain, java.lang.String key, java.lang.Object value)
      Stream-Repositories do not support attributes.
      Specified by:
      setAttribute in interface ContentEntity
      Parameters:
      domain - the attribute domain.
      key - the attribute name
      value - the new attribute value.
      Returns:
      always false.
    • getParent

      public ContentLocation getParent()
      Returns a reference to the parent location. If this entity represents the root directory, this method will return null.
      Specified by:
      getParent in interface ContentEntity
      Returns:
      the parent or null, if this is the root-directory.
    • getRepository

      public Repository getRepository()
      Returns the current repository, to which tis entity belongs.
      Specified by:
      getRepository in interface ContentEntity
      Returns:
      the repository.
    • delete

      public boolean delete()
      Stream-repositories do not support the deletion of entries.
      Specified by:
      delete in interface ContentEntity
      Returns:
      always false.