Keel 2.1RC2

org.keel.services.content
Interface Repository


public interface Repository

A Repository stores content Elements, and can retrieve specified elements, store new elements (unless it is read-only), and optionally handle locking and versioning of elements. A single repository stores elements of a particular element type.


Field Summary
static java.lang.String ROLE
           
 
Method Summary
 void add(Element e)
          Add a new element to the repository.
 void clear(java.lang.String elementType)
          Remove all elements of the specified type from this repository
 void delete(java.lang.String elementType, java.lang.Object elementId)
          Remove the specified element from the repository
 java.util.Set getAttributeNames(java.lang.String elementType)
           
 java.lang.String getDescription()
          Return a Human-readable description string for this repository
 java.util.List getIds(java.lang.String elementType, Element criteria, int offset, int max)
          Retrieve a list of element Ids from the repository.
 java.util.Set getKeyAttributeNames(java.lang.String elementType)
           
 java.util.Set getSubTypes(java.lang.String elementType)
           
 void lock(java.lang.String elementType, java.lang.Object elementId)
           
 boolean locked(java.lang.String elementType, java.lang.Object elementId)
           
 Element retrieve(java.lang.String elementType, java.lang.Object elementId)
          Retrieve a specific element by it's id.
 Element retrieve(java.lang.String elementType, java.lang.Object elementId, int version)
          Retrieve a specific version of an Element.
 java.util.List supportedTypes()
          Return a set of Strings of the element types supported by (stored in) this repository.
 void unlock(java.lang.String elementType, java.lang.Object elementId)
           
 boolean versioned()
          Return true if this repository instance supports versioning, false if it does not.
 

Field Detail

ROLE

public static final java.lang.String ROLE
See Also:
Constant Field Values
Method Detail

getDescription

public java.lang.String getDescription()
Return a Human-readable description string for this repository

Returns:
String A description of this repository

retrieve

public Element retrieve(java.lang.String elementType,
                        java.lang.Object elementId)
                 throws RepositoryException
Retrieve a specific element by it's id. Return null if no such element is stored in this repository.

Parameters:
elementType - The name of the type of element to be retrieved
elementId - An object containing the identifier of the element to be retrieved
Returns:
The Element requested
Throws:
RepositoryException - If the specified element cannot be retrieved, or if the element type does not exist

retrieve

public Element retrieve(java.lang.String elementType,
                        java.lang.Object elementId,
                        int version)
                 throws RepositoryException
Retrieve a specific version of an Element. Throws an exception if this repository does not support versioning.

Throws:
RepositoryException

add

public void add(Element e)
         throws RepositoryException
Add a new element to the repository. If the id already exists, then add a new version of this element if we support versioning. If we do not support versioning, overwrite the existing element with that id

Throws:
RepositoryException

getIds

public java.util.List getIds(java.lang.String elementType,
                             Element criteria,
                             int offset,
                             int max)
                      throws RepositoryException
Retrieve a list of element Ids from the repository. If the "criteria" Element is specified, then only elements matching any attribute criteria for the provided element are returned (if any). If offset and max are used, then the first "offset" -1 elements are not returned, and only a maximum number of "max" elements are returned. This is used when paging through a very large repository.

Throws:
RepositoryException

delete

public void delete(java.lang.String elementType,
                   java.lang.Object elementId)
            throws RepositoryException
Remove the specified element from the repository

Throws:
RepositoryException

clear

public void clear(java.lang.String elementType)
           throws RepositoryException
Remove all elements of the specified type from this repository

Throws:
RepositoryException

versioned

public boolean versioned()
                  throws RepositoryException
Return true if this repository instance supports versioning, false if it does not.

Throws:
RepositoryException

lock

public void lock(java.lang.String elementType,
                 java.lang.Object elementId)
          throws RepositoryException
Throws:
RepositoryException

unlock

public void unlock(java.lang.String elementType,
                   java.lang.Object elementId)
            throws RepositoryException
Throws:
RepositoryException

locked

public boolean locked(java.lang.String elementType,
                      java.lang.Object elementId)
               throws RepositoryException
Throws:
RepositoryException

supportedTypes

public java.util.List supportedTypes()
                              throws RepositoryException
Return a set of Strings of the element types supported by (stored in) this repository.

Returns:
Set
Throws:
RepositoryException

getAttributeNames

public java.util.Set getAttributeNames(java.lang.String elementType)
                                throws RepositoryException
Throws:
RepositoryException

getKeyAttributeNames

public java.util.Set getKeyAttributeNames(java.lang.String elementType)
                                   throws RepositoryException
Throws:
RepositoryException

getSubTypes

public java.util.Set getSubTypes(java.lang.String elementType)
                          throws RepositoryException
Throws:
RepositoryException

Keel 2.1RC2

Please see keelframework.org for information about new Keel releases.