edu.sdsc.inca.consumer
Class AgentBean

java.lang.Object
  extended by java.lang.Thread
      extended by edu.sdsc.inca.consumer.AgentBean
All Implemented Interfaces:
java.io.Serializable, java.lang.Runnable

public class AgentBean
extends java.lang.Thread
implements java.io.Serializable

Special bean that periodically queries and caches the current Inca configuration stored on the agent. This bean starts up a thread to periodically query the

Author:
Shava Smallen <ssmallen@sdsc.edu>
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AgentBean()
          Create a new AgentBean object.
 
Method Summary
 edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument filter(java.lang.String id, java.lang.String[] macros)
          Create a new document using the __groupname__ as a replacement for the hostname and includes just the passed in macros
 int getCacheReloadPeriod()
          Return the period of refreshSuiteCaching for the suite and resources in the Consumer's cache.
 java.lang.String getCatalog()
          Get the current catalog contents.
 edu.sdsc.inca.dataModel.inca.IncaDocument getIncaDoc()
          Return cached inca config document.
 edu.sdsc.inca.util.ResourcesWrapper getResources()
          Return the cached resources object.
 java.lang.String getSuiteNames()
          Return the suite names as an XML document
 java.lang.String getSuites()
          Return the cached suite configuration.
 java.lang.String getUri()
           
 void run()
          The functionality of the thread.
 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.
 java.lang.String toString()
          Return xml document in string
 
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, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AgentBean

public AgentBean()
Create a new AgentBean object.

Method Detail

filter

public edu.sdsc.inca.dataModel.resourceConfig.ResourceConfigDocument filter(java.lang.String id,
                                                                            java.lang.String[] macros)
                                                                     throws edu.sdsc.inca.ConfigurationException
Create a new document using the __groupname__ as a replacement for the hostname and includes just the passed in macros

Parameters:
id - only return resources that are part of this group id
macros - The macro values to return for these resources
Returns:
The processed resource configuration document.
Throws:
edu.sdsc.inca.ConfigurationException - if trouble parsing resources

getCatalog

public java.lang.String getCatalog()
Get the current catalog contents.

Returns:
An xml document containing the contents of all repositories.

getCacheReloadPeriod

public int getCacheReloadPeriod()
Return the period of refreshSuiteCaching for the suite and resources in the Consumer's cache.

Returns:
the number of milliseconds in between reloads of cached objects.

getIncaDoc

public edu.sdsc.inca.dataModel.inca.IncaDocument getIncaDoc()
Return cached inca config document.

Returns:
Inca config document or null if not loaded yet.

getResources

public edu.sdsc.inca.util.ResourcesWrapper getResources()
Return the cached resources object.

Returns:
A resources object

getSuites

public java.lang.String getSuites()
Return the cached suite configuration.

Returns:
A string containing an xml document containing the configured suites.

getSuiteNames

public java.lang.String getSuiteNames()
Return the suite names as an XML document

Returns:
A string containing an xml document containing the suite names

getUri

public java.lang.String getUri()

run

public void run()
The functionality of the thread. Periodically, will fetch the configuration from the depot. Will use the configured cache reload period to wait in between iterations.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

setBeanConfig

public void setBeanConfig(java.util.Properties beanConfig)
Set the attributes for connecting to the agent and also the maxWait and reload frequency.

Parameters:
beanConfig - A properties object containing the config options for this object

setCacheReloadPeriod

public void setCacheReloadPeriod(int period)
Set the period of refreshSuiteCaching for the suite and resources in the Consumer's cache.

Parameters:
period - the number of milliseconds in between reloads of cached objects

toString

public java.lang.String toString()
Return xml document in string

Overrides:
toString in class java.lang.Thread
Returns:
Inca config in xml format.