|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread edu.sdsc.inca.consumer.DepotBean
public class DepotBean
Manages a list of stored (persistent) depot queries, some of which are longer queries that are cached to disk so that results can be prefetched.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
static java.lang.String |
queryStatus
|
static java.lang.String |
QUERYSTORE
|
static java.lang.String |
suiteCachePrefix
|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
DepotBean()
|
|
DepotBean(java.lang.String filePath,
java.lang.String queryDir)
Read in or create a new list of stored queries from the provided file. |
Method Summary | |
---|---|
boolean |
add(int cachePeriod,
java.lang.String reloadAt,
java.lang.String name,
java.lang.String type,
java.lang.String... params)
Add a query to the query store. |
boolean |
add(java.lang.String name,
java.lang.String type,
java.lang.String... params)
Add a query to the query store. |
void |
clear()
Create a new XML file for persisting stored queries and save it to disk. |
edu.sdsc.inca.dataModel.queryStore.Query |
createQuery(int cachePeriod,
java.lang.String reloadAt,
java.lang.String name,
java.lang.String type,
java.lang.String... params)
Read a query from the provided xml object and parse it into a DepotQuery object. |
boolean |
delete(java.lang.String name)
Delete the specified query from the query store. |
static java.lang.String |
getCacheName(java.lang.String guid)
Make a distinct name for the cached suites that we add |
int |
getCacheReloadPeriod()
Return the period of refreshSuiteCaching for the suite and resources in the Consumer's cache. |
java.io.File |
getFile()
Return a handle to the query file. |
java.lang.String |
getQueriesXml()
Return the query store xml as a string |
java.lang.String[] |
getQueryNames()
Return the stored query names. |
java.lang.Object[] |
getQueryParams(java.lang.String name)
Return the query params for the named query |
java.lang.String |
getQueryResult(java.lang.String name)
Retrieve a result for the named query. |
java.lang.String |
getQueryType(java.lang.String name)
Return the query type for the named query |
boolean |
hasQuery(java.lang.String name)
Check to see if the query exists in the store already. |
java.lang.String[] |
list()
Fetch the list of stored query names. |
DepotQuery |
readQuery(edu.sdsc.inca.dataModel.queryStore.Query q)
Read a query from the provided xml object and parse it into a DepotQuery object. |
boolean |
refresh(java.lang.String name)
Refresh the cached result for the named query. |
void |
refreshSuiteCaching()
Query the depot and make sure there is a cache entry for each suite and remove those that are no longer around |
void |
run()
Periodically query depot and refresh caching of suites |
void |
save()
Save the query store configuration to disk. |
void |
setBeanConfig(java.util.Properties beanConfig)
Set the attributes for connecting to the agent and also the maxWait and reload frequency. |
void |
setCacheReloadPeriod(int period)
Set the period of refreshSuiteCaching for the suite and resources in the Consumer's cache. |
void |
setFile(java.lang.String filePath)
Set the path to the file containing stored query information. |
void |
startQueries()
Starts the cached query threads so that results are prefetched from the depot and continuously updated. |
void |
stopQueries()
Stop prefetching query results from the depot. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String QUERYSTORE
public static final java.lang.String suiteCachePrefix
public static final java.lang.String queryStatus
Constructor Detail |
---|
public DepotBean()
public DepotBean(java.lang.String filePath, java.lang.String queryDir) throws edu.sdsc.inca.ConfigurationException
filePath
- A string containing the path to an XML file.queryDir
- A directory where cached queries can be stored
edu.sdsc.inca.ConfigurationException
- if unable to open queriesMethod Detail |
---|
public boolean add(java.lang.String name, java.lang.String type, java.lang.String... params)
name
- The name of the query to store the hql under.type
- The depot query commandparams
- The parameters for the query command
public boolean add(int cachePeriod, java.lang.String reloadAt, java.lang.String name, java.lang.String type, java.lang.String... params)
cachePeriod
- The frequency in seconds to fetch the results of the
query periodically from the depot.reloadAt
- The start time for the cache in the form WW:HH:MMname
- The name of the query to store the hql under.type
- The depot query commandparams
- The parameters for the query command
public boolean delete(java.lang.String name)
name
- The name of the query to remove.
public int getCacheReloadPeriod()
public java.io.File getFile()
public java.lang.String getQueriesXml()
public java.lang.String[] getQueryNames()
public java.lang.Object[] getQueryParams(java.lang.String name)
name
- The name of a query
public java.lang.String getQueryResult(java.lang.String name)
name
- The name of the query to retrieve the results for
public java.lang.String getQueryType(java.lang.String name)
name
- The name of a query
public boolean hasQuery(java.lang.String name)
name
- The name of the query to search for.
public java.lang.String[] list()
public boolean refresh(java.lang.String name)
name
- The name of the query to retrieve the results for
public void refreshSuiteCaching()
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void save() throws java.io.IOException
java.io.IOException
- if trouble while writing to diskpublic void setBeanConfig(java.util.Properties beanConfig) throws edu.sdsc.inca.ConfigurationException
beanConfig
- A properties object containing the config options for
this object
edu.sdsc.inca.ConfigurationException
- if problem with config paramspublic void setCacheReloadPeriod(int period)
period
- the number of milliseconds in between reloads of cached
objectspublic void setFile(java.lang.String filePath)
filePath
- A path to an XML file.public void startQueries()
public void stopQueries()
public void clear() throws edu.sdsc.inca.ConfigurationException
edu.sdsc.inca.ConfigurationException
- if unable to create query
store xml.public static java.lang.String getCacheName(java.lang.String guid)
guid
- The guid of the suite
public edu.sdsc.inca.dataModel.queryStore.Query createQuery(int cachePeriod, java.lang.String reloadAt, java.lang.String name, java.lang.String type, java.lang.String... params)
cachePeriod
- The frequency in seconds to fetch the results of the
query periodically from the depot.reloadAt
- Should be "*" if we don't care about the time the query
is started otherwise should be WW:HH:MM.name
- The name of the query to store the hql under.type
- The depot query commandparams
- The parameters for the query command @return A new DepotQuery object that can be used to fetch results
public DepotQuery readQuery(edu.sdsc.inca.dataModel.queryStore.Query q)
q
- A xml object that describes a query
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |