org.ceryle.wiki.plugin.query
Class QueryItemManager

java.lang.Object
  extended by org.ceryle.wiki.plugin.query.QueryItemManager

public class QueryItemManager
extends Object

Manages prebuilt QueryItem objects, so the plugin doesn't have to re-parse and such on each display of a wikipage. Handles case of possibly same queryString but on different WikiEngine instances (different wikis).

Author:
John Volkar (john.volkar at gmail.com)

Constructor Summary
QueryItemManager()
           
 
Method Summary
 QueryItem getQuery(WikiEngine engine, String queryString)
          The same queryString, evaluated against different engines probably will not give the same results (typically different engine instance means different wiki's.
 QueryItem getQueryForExpression(WikiEngine engine, Expression expr)
          Creates and/or retrieves a QueryItem based on an externally-created Expression (i.e., one not parsed into existence by getQuery(WikiEngine,String)) to the list of managed queries.
 QueryItem getQueryForExpression(WikiEngine engine, Expression expr, boolean create)
          Retrieves a QueryItem based on an externally-created Expression (i.e., one not parsed into existence by getQuery(WikiEngine,String)) to the list of managed queries.
 List getQueryList()
           
 void remove(QueryItem item)
          Called by the QueryItemReaper when it finds that the query must die.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryItemManager

public QueryItemManager()
Method Detail

getQueryList

public List getQueryList()
Returns:
a Copy of a list of all current queries, used internally by QueryItemReaper.

getQuery

public QueryItem getQuery(WikiEngine engine,
                          String queryString)
                   throws QueryException
The same queryString, evaluated against different engines probably will not give the same results (typically different engine instance means different wiki's. So, we keep a map of engines, holding a map of queryStrings for each.

Parameters:
engine -
queryString -
Returns:
the resulting QueryItem
Throws:
QueryException

getQueryForExpression

public QueryItem getQueryForExpression(WikiEngine engine,
                                       Expression expr)
Creates and/or retrieves a QueryItem based on an externally-created Expression (i.e., one not parsed into existence by getQuery(WikiEngine,String)) to the list of managed queries.

Parameters:
engine - the WikiEngine handling this plugin's context.
expr - the Expression used to obtain the QueryItem.
Returns:
the QueryItem for that Expression.

getQueryForExpression

public QueryItem getQueryForExpression(WikiEngine engine,
                                       Expression expr,
                                       boolean create)
Retrieves a QueryItem based on an externally-created Expression (i.e., one not parsed into existence by getQuery(WikiEngine,String)) to the list of managed queries. If create is true, will create a QueryItem if it did not previously exist.

Parameters:
engine - the WikiEngine handling this plugin's context.
expr - the Expression used to obtain the QueryItem.
create - if true, will create a QueryItem if it did not yet exist.
Returns:
the QueryItem for that Expression.

remove

public void remove(QueryItem item)
Called by the QueryItemReaper when it finds that the query must die.

Parameters:
item - the QueryItem to remove.


The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.