|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.openprivacy.reptile.search.AbstractSearchProvider | +--org.openprivacy.reptile.search.impl.DBSearchProvider
A generic SearchProvider for the local DB. This should contain the default fields and sort order and the Class of the peer to use.
SearchProvider
,
AbstractSearchProvider
Field Summary | |
protected java.util.List |
defaultSearchFields
Default fields for this search provider. |
protected java.util.List |
defaultSortOrder
Default sort order for this search provider. |
Fields inherited from interface org.openprivacy.reptile.search.SearchProvider |
STATE_NEVER_SEARCHED, STATE_SEARCH_COMPLETE, STATE_SEARCH_IN_PROGRESS |
Constructor Summary | |
DBSearchProvider(java.lang.Class peer)
Create a new DBSearchProvider instance. |
Method Summary | |
protected java.util.Vector |
getResults()
Return the results directly from the search provider for use by class implementations for pulling out records. |
void |
search(SearchRequest sr)
Run a search with a given query. |
Methods inherited from class org.openprivacy.reptile.search.AbstractSearchProvider |
assertSearchable, getHandle, getResultCount, getSearchCompletedTime, getSearchRequest, getSearchStartTime, getState, getState, getTimeCreated, isSearchable, setResultCount, setSearchCompletedTime, setSearchRequest, setSearchStartTime, setState |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.openprivacy.reptile.search.SearchProvider |
destroy, record |
Field Detail |
protected java.util.List defaultSearchFields
protected java.util.List defaultSortOrder
Constructor Detail |
public DBSearchProvider(java.lang.Class peer)
DBSearchProvider
instance.
Method Detail |
public void search(SearchRequest sr) throws java.lang.Exception
SearchProvider
Run a search with a given query. Note that some search providers may NOT finish the search here.. Specifically some search providers may take a few minutes to fill in results as results are collected. A good example of this is code that executes within a P2P network and is waiting or other peers to reply.
Only one 'search' can be run on any search provder. If you wish to run multiple searches you need to instantiate multiple SearchProviders.
If you want to develop a mutltithreaded/asynchronous SearchProvider, you should set the state to STATE_SEARCH_IN_PROGRESS, kick off any threads or async queries an then set the state to STATE_SEARCH_COMPLETE (possibly outside of the search method)
Note that when you are running this method you should synchronize around 'this' object instance. This should only be done int code that could break the search if it is requested to early.
AKA This IS thread reentrant!
SearchProviders also need to pay attention to the SearchRequest and implement any settings here. Specifically we need to pay attention to sort order, search fields, criteria, etc.
java.lang.Exception
SearchProvider.search(org.openprivacy.reptile.search.SearchRequest)
protected java.util.Vector getResults()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |