|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectopenadk.library.Agent
systemic.sif.sifcommon.agent.SIFBaseAgent
public abstract class SIFBaseAgent
This class forms the base of all agents developed with the SIFCommon Framework. An agent implementation should extend this class and implement the abstract classes. In most cases nothing else needs to be changes but there is the occasional time where there is the need to override a particular behaviour (ie. change the way logging is initialised, how to deal with custom objects etc).
It is not recommended to override any other method since this class builds up the relationship between subscribers and publishers that make up an agent, all driven by the SIFAgent.properties file.
Field Summary |
---|
Fields inherited from class openadk.library.Agent |
---|
LOG_IDENTIFIER |
Constructor Summary | |
---|---|
SIFBaseAgent(java.lang.String agentID)
Constructor. |
|
SIFBaseAgent(java.lang.String agentID,
java.lang.String propertiesFileName)
Constructor. |
Method Summary | |
---|---|
openadk.library.tools.cfg.AgentConfig |
getAgentConfig()
This methods gets all properties from the actual agent.cfg file. |
java.lang.String |
getAgentID()
|
openadk.library.tools.mapping.Mappings |
getAgentMappings()
|
openadk.library.AgentProperties |
getAgentProperties()
This method returns the agent's property values for the agent configuration file (generally called SIFAgent.properties). |
SIFCommonProperties |
getFrameworkProperties()
|
java.lang.String |
getHomeDir()
Ensure that a known directory is used as the working directory. |
java.util.List<BasePublisher> |
getInitialisedPublishers()
This method returns all publishers that are initialise (after startAgent() call). |
java.util.List<BaseSubscriber> |
getInitialisedSubscribers()
This method returns all subscribers that are initialise (afterstartAgent() call). |
openadk.library.tools.mapping.Mappings |
getMappings(java.lang.String mappingID)
This method return mappings for the given mapping ID of the agent's configuration file. |
java.util.List<openadk.library.Zone> |
getZones()
Returns the list of Zones this agent is connected to. |
abstract void |
initCustomObjects()
This method initialises custom objects that have been created with Pearson's ADKGen. |
void |
setAgentID(java.lang.String agentID)
|
void |
setAgentMappings(openadk.library.tools.mapping.Mappings mappings)
|
void |
setFrameworkProperties(SIFCommonProperties frameworkProperties)
|
void |
startAgent()
Convenience method. |
void |
startAgent(boolean implementShutdownHook)
Convenience method. |
void |
startAgent(boolean implementShutdownHook,
java.util.Collection<BasePublisher> publishers,
java.util.Collection<BaseSubscriber> subscribers)
This method starts the agent. |
void |
startAgent(java.util.Collection<BasePublisher> publishers,
java.util.Collection<BaseSubscriber> subscribers)
Same as above method except that shutdown hook is defaulted to true. |
void |
stopAgent()
This method must be called to shut down the agent in full and release all resources. |
Methods inherited from class openadk.library.Agent |
---|
addMessagingListener, getConfigurationSource, getDefaultHttpProperties, getDefaultHttpsProperties, getDefaultTransportProperties, getDefaultZoneProperties, getErrorHandler, getId, getLog, getLog, getMessagingListeners, getName, getProperties, getPublisher, getQueryResults, getReportPublisher, getServerLog, getServerLog, getSubscriber, getThreadPoolManager, getTopicFactory, getTransportManager, getZoneFactory, initialize, isInitialized, isShutdown, makeGUID, purgeQueue, removeMessagingListener, setConfigurationSource, setErrorHandler, setId, setName, setPublisher, setPublisher, setQueryResults, setQueryResults, setReportPublisher, setSubscriber, setSubscriber, shutdown, shutdown, sleep, wakeup |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SIFBaseAgent(java.lang.String agentID, java.lang.String propertiesFileName) throws java.lang.Exception
agent.
This method will initialise the agent but won't connect it to any ZIS. To connect it to any ZIS
listed in the agent's config file the startAgent method must be called.
agentID
- The unique ID of this Agent. This should be the same value as in the agent id
reference in the SIFAgent.propertiess file.propertiesFileName
- The name of the SIFAgent.properties file
java.lang.Exception
public SIFBaseAgent(java.lang.String agentID) throws java.lang.Exception
agentID
-
java.lang.Exception
Method Detail |
---|
public abstract void initCustomObjects()
CustomObjectDTD customObjects = new CustomObjectDTD();
customObjects.load();
If there are no custom objects then this method can be nulled out. This method will be called as part of the constructor of this class.
public java.lang.String getAgentID()
public void setAgentID(java.lang.String agentID)
public SIFCommonProperties getFrameworkProperties()
public void setFrameworkProperties(SIFCommonProperties frameworkProperties)
public java.util.List<BaseSubscriber> getInitialisedSubscribers()
public java.util.List<BasePublisher> getInitialisedPublishers()
public openadk.library.tools.mapping.Mappings getAgentMappings()
public void setAgentMappings(openadk.library.tools.mapping.Mappings mappings)
public void startAgent(boolean implementShutdownHook, java.util.Collection<BasePublisher> publishers, java.util.Collection<BaseSubscriber> subscribers) throws java.lang.Exception
NOTE: The publishers will be assigned this agent in each BasePublisher object as part of this call. The subscribers will be assigned this agent in each BaseSubscriber object as part of this call.
implementShutdownHook
- If set to true then a shotdownHook is installed that captures the
CTRL-C to terminate the agentpublishers
- A list of publishers that are registered with the zones of this agentsubscribers
- A list of subscribers that are registered with the zones of this agent
java.lang.Exception
- An underlying issue such as failing to initialise the publishers, subscribers etc.
An error is logged and an appropriate message is stored in the exception.public void startAgent(java.util.Collection<BasePublisher> publishers, java.util.Collection<BaseSubscriber> subscribers) throws java.lang.Exception
java.lang.Exception
public void startAgent() throws java.lang.Exception
java.lang.Exception
getPublishers()
,
getSubscribers()
public void startAgent(boolean implementShutdownHook) throws java.lang.Exception
java.lang.Exception
getPublishers()
,
getSubscribers()
public void stopAgent()
public openadk.library.AgentProperties getAgentProperties()
agent._agenttID_.cfg.location=_dir_of_config_file_
agent._agenttID_.cfg.name=_name_of_config_file_
public openadk.library.tools.cfg.AgentConfig getAgentConfig()
public openadk.library.tools.mapping.Mappings getMappings(java.lang.String mappingID)
mappingID
- The ID for which the mappings shall be returned.public java.util.List<openadk.library.Zone> getZones()
public java.lang.String getHomeDir()
getHomeDir
in class openadk.library.Agent
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |