org.apache.ambari.view
Interface DataStore


public interface DataStore

View data store.


Method Summary
<T> T
find(Class<T> clazz, Object primaryKey)
          Find the entity of the given class type that is uniquely identified by the given primary key.
<T> Collection<T>
findAll(Class<T> clazz, String whereClause)
          Find all the entities for the given where clause.
 void remove(Object entity)
          Remove the given entity from persistent storage.
 void store(Object entity)
          Save the given entity to persistent storage.
 

Method Detail

store

void store(Object entity)
           throws PersistenceException
Save the given entity to persistent storage. The entity must be declared as an in the element of the view.xml.

Parameters:
entity - the entity to be persisted.
Throws:
PersistenceException - thrown if the given entity can not be persisted

remove

void remove(Object entity)
            throws PersistenceException
Remove the given entity from persistent storage.

Parameters:
entity - the entity to be removed.
Throws:
PersistenceException - thrown if the given entity can not be removed

find

<T> T find(Class<T> clazz,
           Object primaryKey)
       throws PersistenceException
Find the entity of the given class type that is uniquely identified by the given primary key.

Type Parameters:
T - the entity type
Parameters:
clazz - the entity class
primaryKey - the primary key
Returns:
the entity; null if the entity can't be found
Throws:
PersistenceException - thrown if an error occurs trying to find the entity

findAll

<T> Collection<T> findAll(Class<T> clazz,
                          String whereClause)
                      throws PersistenceException
Find all the entities for the given where clause. Specifying null for the where clause should return all entities of the given class type.

Type Parameters:
T - the entity type
Parameters:
clazz - the entity class
whereClause - the where clause; may be null
Returns:
all of the entities for the given where clause; empty collection if no entities can be found
Throws:
PersistenceException


Copyright © 2015 Apache Software Foundation. All rights reserved.