SPT Object Database API

com.sptci.prevayler
Interface Database<P extends PrevalentObject>

All Superinterfaces:
AbstractDatabase<P>, Serializable
All Known Implementing Classes:
PrevalentManager

public interface Database<P extends PrevalentObject>
extends AbstractDatabase<P>

An interface that defines the transactional features exposed by the higher level database API.

© Copyright 2008 Sans Pareil Technologies, Inc.

Version:
$Id: Database.java 22 2008-11-24 19:04:25Z sptrakesh $
Author:
Rakesh 2008-11-23

Method Summary
 P delete(P object)
          Delete the specified prevalent object from the prevalent system.
 P save(P object)
          Save the specified prevalent object to the prevalent system.
 Collection<P> search(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter, int count)
          Execute the specified lucene query and return the collection of matching prevalent objects.
 Collection<P> search(org.apache.lucene.search.Query query, int count)
          Execute the specified lucene query and return the collection of matching prevalent objects.
 
Methods inherited from interface com.sptci.prevayler.AbstractDatabase
count, fetch, fetch, fetch, fetchIntersection, fetchUnion, search
 

Method Detail

save

P save(P object)
                               throws PrevalentException
Save the specified prevalent object to the prevalent system. Objects not already persistent are added to the system, while already persistent objects are updated.

Parameters:
object - The prevalent object to be saved in the system.
Returns:
The potentially modified prevalent object.
Throws:
PrevalentException - If errors are encountered while adding/updating the object. Errors thrown could indicate constraint violations.

delete

P delete(P object)
                                 throws PrevalentException
Delete the specified prevalent object from the prevalent system. Processes cascading delete rules if so configured.

Parameters:
object - The prevalent object to delete.
Returns:
The deleted object with potential modifications.
Throws:
PrevalentException - If errors are encountered while deleting the prevalent object.

search

Collection<P> search(org.apache.lucene.search.Query query,
                     int count)
                                             throws PrevalentException
Execute the specified lucene query and return the collection of matching prevalent objects.

Parameters:
query - The lucene query that is to be executed to find matching prevalent object instances.
count - The maximum number to top hits for the search to return.
Returns:
The collection of matching instances or an empty collection.
Throws:
PrevalentException - If errors are encountered while reconstituting the prevalent objects being returned.

search

Collection<P> search(org.apache.lucene.search.Query query,
                     org.apache.lucene.search.Filter filter,
                     int count)
                                             throws PrevalentException
Execute the specified lucene query and return the collection of matching prevalent objects.

Parameters:
query - The lucene query that is to be executed to find matching prevalent object instances.
filter - The filter to apply to restrict the query results.
count - The maximum number to top hits for the search to return.
Returns:
The collection of matching instances or an empty collection.
Throws:
PrevalentException - If errors are encountered while reconstituting the prevalent objects being returned.

SPT Object Database API