|
Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Repository
The Repository is the entry point to Tiny Marbles
| Method Summary | |
|---|---|
void |
close()
Closes the repository, rolling back any pending transaction. |
void |
commit()
Commits the transaction. |
void |
commitAndClose()
Commits the transaction and Closes the repository. |
Filter |
createFilter(PType type)
Creates a filter for objects with the given type |
Filter |
createFilter(String typeName)
Creates a filter for objects with the type identified by the typeName argument |
HQLFilter |
createHQLFilter(String queryString)
Creates a filter for objects with the given queryString |
HQLFilter |
createHQLFilter(String queryString,
Map<String,Object> values)
Creates a filter for objects with the given queryString |
SQLFilter |
createSQLFilter(String queryString)
Creates a filter for objects with the given queryString |
SQLFilter |
createSQLFilter(String queryString,
Map<String,Object> values)
Creates a filter for objects with the given queryString |
PType |
createType(String name)
Creates a new persistent type with the given name. |
void |
delete()
Clears the contents of the repository. |
void |
delete(Persistent object)
Deletes this instance from the repository. |
PObject |
get(Long persistentId)
Returns an instance of the object with the given persistent ID, or null if such object doesn't exist |
PObject |
get(String systemId)
Returns an instance of the object with the given system ID, or null if such object doesn't exist |
PType |
getType(String name)
Returns the persistent type with the given name, or null if there is no such type. |
List<PObject> |
list(PType type)
Fetches all objects of a given type. |
List<PType> |
listTypes()
Lists all types in the system |
PObject |
load(Long persistentId)
Loads an object using its persistent id |
PObject |
load(String systemId)
Loads an object using its system ID |
PType |
loadType(String name)
Loads an existing persistent type given its unique name. |
PType |
requireType(String name)
Try to get an existing persistent type, if doesn't exist create a new type with the given name. |
void |
save(Persistent object)
Saves this object to the repository. |
| Method Detail |
|---|
PType createType(String name)
PType myType = repository.createType("MyType");
//add attributes to the type
myType.save();
name - the type's unique name
PType,
loadType(String)PType getType(String name)
name - the type's unique name
PType loadType(String name)
throws ObjectNotFoundException
name - the type's unique name
ObjectNotFoundExceptioncreateType(String)PObject get(String systemId)
systemId - a string that uniquely identifies this object in the repository
PType requireType(String name)
name - a string that uniquely identifies this type in the repository
PObject load(String systemId)
throws ObjectNotFoundException
systemId - a string that uniquely identifies this object in the repository
ObjectNotFoundExceptionPObject get(Long persistentId)
persistentId - the object's persistent id
PObject load(Long persistentId)
throws ObjectNotFoundException
persistentId - the object's persistent id
ObjectNotFoundExceptionList<PObject> list(PType type)
type - a persistent type
Filter createFilter(PType type)
type - a persistent type
createFilter(String)
HQLFilter createHQLFilter(String queryString,
Map<String,Object> values)
queryString - a HQL queryvalues - named values to replace in the queryString
HQLFilter createHQLFilter(String queryString)
queryString - a HQL query
SQLFilter createSQLFilter(String queryString,
Map<String,Object> values)
queryString - a sql queryvalues - named values to replace in the queryString
SQLFilter createSQLFilter(String queryString)
queryString - a sql query
Filter createFilter(String typeName)
typeName - the name of a type
createFilter(PType)void delete()
void commit()
throws StorageException
StorageException - if the storage cannot commit or rollback a transactionvoid close()
void commitAndClose()
throws StorageException
StorageException - if the storage cannot commit or rollback a transaction
List<PType> listTypes()
throws StorageException
StorageException - if the access to the repository fails.
void delete(Persistent object)
throws StorageException
object - a Persistent object to delete(PType or PObject)
StorageException - if the operation cannot be completed
void save(Persistent object)
throws StorageException
object - a Persistent object to save(PType or PObject)
StorageException - if the operation cannot be completed
|
Homepage | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||