Interface IEntity

All Known Subinterfaces:
ICollection, IResource

public interface IEntity
The IEntity interface is a base interface for ICollection and IResource.
It provides methods that are common for both interfaces.
  • Method Summary

    Modifier and Type Method Description
    void copyTo​(String path)
    Copies this entity to a collection at the specified path.
    void create()
    Forces this entity to be created at its current path.
    void delete()
    Removes this entity from the repository.
    boolean exists()
    Returns whether this entity is valid and exists on the backend.
    IEntityInformation getInformation()
    Returns an instance of IEntityInformation through which one can obtain information on the current entity.
    String getName()
    Returns the name of this entity.
    ICollection getParent()
    Returns the collection that holds this entity.
    String getPath()
    Returns the path of this entity.
    IRepository getRepository()
    Returns the repository that holds this resource.
    boolean isEmpty()
    Returns whether this entity is empty.
    void moveTo​(String path)
    Moves this entity to a collection at the specified path.
    void renameTo​(String name)
    Changes the name of this entity to the specified value.
  • Method Details

    • getRepository

      IRepository getRepository()
      Returns the repository that holds this resource.
      Returns:
      an IRepository instance
    • getName

      String getName()
      Returns the name of this entity.

      This is equal to the content of the path after the last slash in it.

      Returns:
      the name of the entity
    • getPath

      String getPath()
      Returns the path of this entity.

      The result may not be null.

      Example: /repository/users/test.txt
      Example: /repository/articles

      Returns:
      the location
    • getParent

      ICollection getParent()
      Returns the collection that holds this entity.

      The result could be null should there be no parent (i.e. this is the root).

      Returns:
      an parent ICollection
    • getInformation

      Returns an instance of IEntityInformation through which one can obtain information on the current entity.

      This method may not return null, however, the contents of the returned IEntityInformation may return null indicating that a given information is not available.

      Returns:
      an IEntityInformation instance with the meta-data of the entity
      Throws:
      RepositoryReadException - if for some reason a connection to the backend could not be achieved.
    • create

      void create() throws RepositoryWriteException
      Forces this entity to be created at its current path.

      Whether the entity will be created as a resource or a collection depends on whether it is an instance of IResource or ICollection.

      Throws:
      RepositoryWriteException - if for some reason a connection to the backend could not be achieved, or if an entity with this path already exists on the backend.
    • delete

      void delete() throws RepositoryWriteException
      Removes this entity from the repository.

      If no such resource exists, this method does nothing.

      Throws:
      RepositoryWriteException - if for some reason a connection to the backend could not be achieved.
    • renameTo

      void renameTo​(String name) throws RepositoryWriteException
      Changes the name of this entity to the specified value.
      Parameters:
      name - the new name
      Throws:
      RepositoryWriteException - if for some reason a connection to the backend could not be achieved
    • moveTo

      void moveTo​(String path) throws RepositoryWriteException
      Moves this entity to a collection at the specified path.

      If this entity is of type ICollection, then all child entities are copied too.

      Parameters:
      path - the new location
      Throws:
      RepositoryWriteException - if for some reason a connection to the backend could not be achieved
    • copyTo

      void copyTo​(String path) throws RepositoryWriteException
      Copies this entity to a collection at the specified path.

      If this entity is of type ICollection, then all child entities are copied too.

      Parameters:
      path - the location ot be copied to
      Throws:
      RepositoryWriteException - if for some reason a connection to the backend could not be achieved
    • exists

      boolean exists() throws RepositoryReadException
      Returns whether this entity is valid and exists on the backend.
      Returns:
      whether this entity is already materialized
      Throws:
      RepositoryReadException - if for some reason a connection to the backend could not be achieved.
    • isEmpty

      boolean isEmpty() throws RepositoryReadException
      Returns whether this entity is empty.

      If the entity is a collection, implementations should check to see if it has any child entities.

      If the entity is a resource, implementations should check to see if it has any content.
      Note: Calling this method on a resource can be slow.

      Returns:
      whether this entity is empty
      Throws:
      RepositoryReadException - if for some reason a connection to the backend could not be achieved.