|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--com.ls.lars.communication.CommunicationTemplate | +--com.ls.lars.server.AgentTemplate | +--com.ls.lars.server.AgentCron
Note: AgentCron is depending on the services of AgentTimer
!
Incoming Messages: AgentCron understands messages for the following services. Input parameters you have to specify are listed with the messages and must be transmitted using a Map. ------------------------------------------------------------------------ notify_agent ------------------------------------------------------------------------ Function: Inserts a notification request into the cron queue. Parameters: expression of period, agent, job to be done (Map) The syntax is explained below in detail in the section "content of a notify_agent message". Responses: notified_agent The notification request was added to the timer queue. agent_not_notified The request was malformed (i.e. bad period of time) and was not added to the queue. Both responses use the reply ID of the incoming message and send back the original parameter map as content. This can be saved, for instance, to be able to cancel a notification later on. The quality of service of either reply isThe content of aQualityOfService.QOS_NONE
. ------------------------------------------------------------------------ cancel_notify ------------------------------------------------------------------------ Function: Removes a notification from the cron queue. Parameters: expression of period, agent, job to be done (Map) Responses: notify_canceled The notification request was removed from the cron queue. notify_not_canceled The notification could not be removed because of a malformed specification of the time or because the notification request does not exist. Both responses use the reply ID of the incoming message and send back the original parameter map as content. The quality of service of either reply isQualityOfService.QOS_NONE
. ------------------------------------------------------------------------ wake_up ------------------------------------------------------------------------ Function: AgentTimer informs AgentCron, that he now needs to send one or multiple message to his client agents (those agents, that requested the notification). Parameters: none (content is not needed and ignored) Responses: the message that the agent requested to be notified at the specified time ------------------------------------------------------------------------ response_group_members ------------------------------------------------------------------------ Function: AgentMessageRouter informs AgentCron, what are the agents that compose a message group (depending on the message that AgentCron sends to AgentMessageRouter). This message is used to determine if a group(s) has any agent alive. Parameters: the current message with the list of agents Responses: none ------------------------------------------------------------------------ response_service_provider_members ------------------------------------------------------------------------ Function: AgentMessageRouter informs AgentCron, what are the agents that are register as 'service provider' (depending on the message that AgentCron sends to AgentMessageRouter). This message is used to determine if there are still agents alive, which are registered as service providers. Parameters: the current message with the list of agents Responses: none ------------------------------------------------------------------------ sender_rip ------------------------------------------------------------------------ Function: Removes all notification requests of the sender from the cron queue, because that agent just died. Parameters: none (content is not needed and ignored) Responses: Due to the termination of the requesting agent no answer is sent. ----------------------------------------------------------------------------- Config File: AgentCron does not need to have a config file. If it has one, it can contain any notification request(s).
notify_agent
message must have the following format:
type
from the period are: CRON, INTERVAL and TIME.
CRON
: specifies the exact period in time the notification has to be send
INTERVAL
: specifies interval of time between notifications
TIME
: specifies a point in time when the the notification is needed
Field Summary | |
protected String |
revisionInformation
revision information string, managed by our version control system. |
Fields inherited from class com.ls.lars.communication.CommunicationTemplate |
agentName, homePlatform, iPKIHandler, logger, STATUS_CONNECTED, STATUS_NOT_CONNECTED |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
AgentCron(String agentName,
String homePlatform,
List agentConfigFiles)
Constructor with the agentName, its homePlatform and a List containing
the names of the configuration file(s) of the new agent. |
Method Summary | |
protected String |
getRevisionInformation()
gets the revision information of this agent |
protected void |
initializeAction()
Initializes the immediateList, the requestedList, CronQueue and CronThread components.
This method gets called, before the config file is interpreted! |
void |
initializeMessages()
Calls super.initializeMessages() and afterwards registers AgentTimer as a service provider for the service "sender_rip". |
protected boolean |
interpretCancelNotify(Message currentMessage)
Cancels the notification, specified in the content of the message, of an agent. |
protected boolean |
interpretNotifiedAgent(Message currentMessage)
Writes a log message to the system's log file and to the agent's log file, because a "notified_agent" message was received (probably from AgentTimer ). |
protected boolean |
interpretNotifyAgent(Message currentMessage)
Registers the agent to be notified at a specific period of time. |
protected boolean |
interpretNotifyCanceled(Message currentMessage)
Implements the reaction that the agent should have in case that it receives a notification of a cancel. |
protected boolean |
interpretResponseGroupMembers(Message currentMessage)
Interprets the message 'response_group_member', it verifies if the message contains the tag "error" in its content message. |
protected boolean |
interpretResponseServiceProviderMembers(Message currentMessage)
Interprets the message 'response_service_provider_member', it verifies if the message contains the tag "error" in its content message. |
protected boolean |
interpretSenderRip(Message currentMessage)
Cancels all notifications for the sender of the given message, because that agent just died. |
protected boolean |
interpretWakeUp(Message currentMessage)
Sends a new request for notification to the AgentTimer when it receive a notification for wake up for the next element from the immediateRequestlist and try to send a notification to the agent or agents that need the notification at that time. |
boolean |
terminateAction()
Checks, if the corresponding cron requestedList has any notification requests. |
Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, yield |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.ls.lars.communication.IToLars |
start |
Field Detail |
protected String revisionInformation
Constructor Detail |
public AgentCron(String agentName, String homePlatform, List agentConfigFiles)
List
containing
the names of the configuration file(s) of the new agent.agentName
- name of the agent. (example: xyz)homePlatform
- the name of the homePlatform where the agent
was created. (example: 195.52.158.233/lars)agentConfigFiles
- the config file(s), which should be read by the
agent when it starts up.Method Detail |
protected String getRevisionInformation()
getRevisionInformation
in class AgentTemplate
protected void initializeAction()
CronQueue
and CronThread
components.
This method gets called, before the config file is interpreted!initializeAction
in class AgentTemplate
public void initializeMessages()
initializeMessages
in class AgentTemplate
protected boolean interpretNotifyAgent(Message currentMessage)
currentMessage
- message with a notification request of an agentprotected boolean interpretCancelNotify(Message currentMessage)
currentMessage
- message with a cancel request of an Agentprotected boolean interpretNotifyCanceled(Message currentMessage)
interpretNotifyCanceled
in class AgentTemplate
currentMessage
- message with a notification for cancelprotected boolean interpretWakeUp(Message currentMessage)
currentMessage
- message with a notice request from a previous request.protected boolean interpretSenderRip(Message currentMessage)
currentMessage
- message with cancel requestprotected boolean interpretResponseGroupMembers(Message currentMessage)
currentMessage
- the mesage with the service 'response_group_member'protected boolean interpretResponseServiceProviderMembers(Message currentMessage)
currentMessage
- the mesage with the service 'response_service_provider_member'protected boolean interpretNotifiedAgent(Message currentMessage)
AgentTimer
).interpretNotifiedAgent
in class AgentTemplate
currentMessage
- "notified_agent" messagepublic boolean terminateAction()
terminateAction
in class AgentTemplate
AgentTemplate.terminateAction()
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |