Homepage

org.talos.impl.repository
Interface Repository

All Known Implementing Classes:
RepositoryImpl

public interface Repository

This class is responsible for all persistence operations.


Method Summary
 void commit()
          Commits any changes to the persistent store.
 void create(NamedObject obj)
          Saves a new named object, checking that it is unique.
 Query createQuery(String queryString)
          Creates a Hibernate query using the given string.
 void delete(Object object)
          Removes an object from the storage.
 void deleteAll()
          This method delete all objects, subjects, categories and permissions from talos
 Capability findCapability(Subject subject, Category category)
          Looks up a capability in the storage.
 Capability findCapability(Subject subject, SecureObject object)
          Looks up a capability in the storage.
<T> T
get(Class<T> persistentClass, Serializable persistentId)
          Looks up an object from the storage.
<T> Collection<T>
listAll(Class<T> clazz)
          This method returns all objects from given class name
 Collection<Category> listCategories(Subject subject)
          Looks up a Capability in the storage.
<T> T
load(Class<T> persistentClass, Serializable persistentId)
          Looks up an object from the storage.
 Collection<Capability> loadAllCapabilities(Category category)
          This method returns all the capabilities that are related to a category.
 Collection<Capability> loadAllCapabilities(Collection<Permission> perms)
          This method returns all the capabilities that are directly related to permissions.
 Collection<Capability> loadAllCapabilities(Permission perm)
          This method returns all the capabilities that are directly related to a permission.
 Collection<Capability> loadAllCapabilities(SecureObject object)
          This method returns all the capabilities that are related to a object.
 Collection<Capability> loadAllCapabilities(Subject subject)
          This method returns all the capabilities that are related to a subject.
 void rollback()
          Discards any changes to the persistent store.
 Serializable save(Object object)
          Saves an object to the storage.
 

Method Detail

load

<T> T load(Class<T> persistentClass,
           Serializable persistentId)
       throws EntityNotFoundException,
              TalosHibernateException
Looks up an object from the storage. Returns an initialized instance or fails with an exception.

Type Parameters:
T - the type of the object to load
Parameters:
persistentClass - the object's class
persistentId - the object's id
Returns:
an object instance
Throws:
EntityNotFoundException - if an object of the given type with a given persistentId doesn't exist
TalosHibernateException - if a storage error occurs
See Also:
get(Class, Serializable)

get

<T> T get(Class<T> persistentClass,
          Serializable persistentId)
      throws TalosHibernateException
Looks up an object from the storage. Returns an initialized instance or null.

Type Parameters:
T - the type of the object to load
Parameters:
persistentClass - the object's class
persistentId - the object's id
Returns:
an object instance
Throws:
TalosHibernateException - if a storage error occurs
See Also:
load(Class, Serializable)

save

Serializable save(Object object)
                  throws TalosHibernateException
Saves an object to the storage.

Parameters:
object - the object
Returns:
the object's persistent id.
Throws:
TalosHibernateException - if a storage error occurs
See Also:
create(NamedObject), delete(Object)

create

void create(NamedObject obj)
            throws UniqueNameException,
                   TalosHibernateException
Saves a new named object, checking that it is unique.

Parameters:
obj - the new object
Throws:
UniqueNameException - if thee's another object of the same type with this name
TalosHibernateException - if a storage error occurs
See Also:
save(Object), delete(Object)

delete

void delete(Object object)
            throws TalosHibernateException
Removes an object from the storage.

Parameters:
object - the persistent object to be deleted
Throws:
TalosHibernateException - if a storage error occurs
See Also:
create(NamedObject), save(Object)

findCapability

Capability findCapability(Subject subject,
                          SecureObject object)
                          throws TalosHibernateException
Looks up a capability in the storage.

Parameters:
subject - the capability's subject
object - the capability's object
Returns:
the capability with the given subject and object, or null if it's not found.
Throws:
TalosHibernateException - if a storage error occurs
See Also:
findCapability(Subject, Category), loadAllCapabilities(Subject), loadAllCapabilities(SecureObject)

findCapability

Capability findCapability(Subject subject,
                          Category category)
                          throws TalosHibernateException
Looks up a capability in the storage.

Parameters:
subject - the capability's subject
category - the capability's category
Returns:
the capability with the given subject and category, or null if it's not found.
Throws:
TalosHibernateException - if a storage error occurs
See Also:
findCapability(Subject, SecureObject), loadAllCapabilities(Subject), loadAllCapabilities(Category)

listCategories

Collection<Category> listCategories(Subject subject)
                                    throws TalosHibernateException
Looks up a Capability in the storage.

Parameters:
subject - the capability's subject
Returns:
the categories with the given subject, or null if it's not found.
Throws:
TalosHibernateException - if a storage error occurs
See Also:
loadAllCapabilities(Subject), loadAllCapabilities(Category)

loadAllCapabilities

Collection<Capability> loadAllCapabilities(Subject subject)
                                           throws TalosHibernateException
This method returns all the capabilities that are related to a subject.

Parameters:
subject - the subject
Returns:
the set of all capabilities for a subject
Throws:
TalosHibernateException - if a storage error occurs

loadAllCapabilities

Collection<Capability> loadAllCapabilities(Category category)
                                           throws TalosHibernateException
This method returns all the capabilities that are related to a category.

Parameters:
category -
Returns:
the set of all capabilities for a category
Throws:
TalosHibernateException - if a storage error occurs

loadAllCapabilities

Collection<Capability> loadAllCapabilities(SecureObject object)
                                           throws TalosHibernateException
This method returns all the capabilities that are related to a object.

Parameters:
object - the object
Returns:
the set of all capabilities for the object
Throws:
TalosHibernateException - if a storage error occurs

rollback

void rollback()
              throws TalosHibernateException
Discards any changes to the persistent store.

Throws:
TalosHibernateException - if the rollback operation fails.
See Also:
Talos.rollback()

commit

void commit()
            throws TalosHibernateException
Commits any changes to the persistent store.

Throws:
TalosHibernateException - if the changes cannot be committed
See Also:
Talos.commit()

loadAllCapabilities

Collection<Capability> loadAllCapabilities(Permission perm)
                                           throws TalosHibernateException
This method returns all the capabilities that are directly related to a permission. Capabilities that are indirectly related (via a group permission) are not returned.

Parameters:
perm - the permission
Returns:
the set of all capabilities for the permission
Throws:
TalosHibernateException - if a storage error occurs

loadAllCapabilities

Collection<Capability> loadAllCapabilities(Collection<Permission> perms)
                                           throws TalosHibernateException
This method returns all the capabilities that are directly related to permissions. Capabilities that are indirectly related (via a group permission) are not returned.

Parameters:
perms - the permissions
Returns:
the set of all capabilities for the permissions
Throws:
TalosHibernateException - if a storage error occurs

createQuery

Query createQuery(String queryString)
                  throws TalosHibernateException
Creates a Hibernate query using the given string.

Parameters:
queryString -
Returns:
a query
Throws:
TalosHibernateException - if the query cannot be created.

listAll

<T> Collection<T> listAll(Class<T> clazz)
                      throws TalosHibernateException
This method returns all objects from given class name

Type Parameters:
T - the type of the object to load all
Parameters:
clazz - the class
Returns:
the list of all objects
Throws:
TalosHibernateException - if a storage error occurs

deleteAll

void deleteAll()
               throws TalosHibernateException
This method delete all objects, subjects, categories and permissions from talos

Throws:
TalosHibernateException - if a storage error occurs

Homepage