com.mindtree.techworks.insight.reporting.jobs.message
Class DefaultJobMessage

java.lang.Object
  extended by com.mindtree.techworks.insight.reporting.jobs.message.DefaultJobMessage
All Implemented Interfaces:
JobMessage, java.io.Serializable

public class DefaultJobMessage
extends java.lang.Object
implements JobMessage

A simple implementation of JobMessage. All Jobs support this message type. An instance of this class would contain just a list of String messages.

Since:
Insight 1.5
Version:
$Revision: 27 $ $Date: 2007-12-16 04:58:03 -0700 (Sun, 16 Dec 2007) $
Author:
Bindul Bhowmik
See Also:
JobMessage, Job, Serialized Form

Field Summary
 
Fields inherited from interface com.mindtree.techworks.insight.reporting.jobs.message.JobMessage
ACTION_FILTER, MODE_DAEMON, MODE_INTERACTIVE
 
Constructor Summary
DefaultJobMessage()
          Creates a new instance of DefaultJobMessage.
DefaultJobMessage(int action, short mode)
          Creates a new instance of DefaultJobMessage with the mode and action provided.
DefaultJobMessage(short mode)
          Creates a new instance of DefaultJobMessage with the mode provided.
 
Method Summary
 void addMessage(java.lang.String message)
          Adds a message to the DefaultJobMessage.
 int getAction()
          Returns the action which caused the message.
 FilterCriteria getFilterCriteria()
          Returns the criteria that was in use on the action while the message was generated.
 short getInsightMode()
          Returns the mode in which Insight was running when the message was generated.
 java.lang.String getJobMessageType()
          Returns the type of the message.
 java.lang.String getMessage(int index)
          Returns the message at the specified index.
 int getMessageCount()
          Returns the number of messages in the instance.
 java.util.Iterator iterateMessages()
          Returns an Iterator for all the messages in the instance.
 void setFilterCriteria(FilterCriteria filterCriteria)
          Sets the criteria which caused the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJobMessage

public DefaultJobMessage()
Creates a new instance of DefaultJobMessage. Defaults the action to ACTION_FILTER and the mode to MODE_INTERACTIVE.


DefaultJobMessage

public DefaultJobMessage(short mode)
Creates a new instance of DefaultJobMessage with the mode provided. Defaults the action to ACTION_FILTER.

Parameters:
mode - The mode in which Insight is running.

DefaultJobMessage

public DefaultJobMessage(int action,
                         short mode)
Creates a new instance of DefaultJobMessage with the mode and action provided.

Parameters:
action - The action which caused the message.
mode - The mode in which Insight is running.
Method Detail

getJobMessageType

public java.lang.String getJobMessageType()
Description copied from interface: JobMessage
Returns the type of the message. A message may be identified uniquely by the fully qualified class name of the JobMessage class.

Specified by:
getJobMessageType in interface JobMessage
Returns:
The type of the message.
See Also:
JobMessage.getJobMessageType()

getAction

public int getAction()
Description copied from interface: JobMessage
Returns the action which caused the message. See the ACTION_ constants.

Specified by:
getAction in interface JobMessage
Returns:
The action which caused the message.
See Also:
JobMessage.getAction()

getFilterCriteria

public FilterCriteria getFilterCriteria()
Description copied from interface: JobMessage
Returns the criteria that was in use on the action while the message was generated.

Specified by:
getFilterCriteria in interface JobMessage
Returns:
The criteria in use to generate the message.
See Also:
JobMessage.getFilterCriteria()

getInsightMode

public short getInsightMode()
Description copied from interface: JobMessage
Returns the mode in which Insight was running when the message was generated. It would be one of the MODE_ constants.

Specified by:
getInsightMode in interface JobMessage
Returns:
The mode in which Insight is running.
See Also:
JobMessage.getInsightMode()

setFilterCriteria

public void setFilterCriteria(FilterCriteria filterCriteria)
Sets the criteria which caused the message.

Parameters:
filterCriteria - The criteria executed to get the message.

addMessage

public void addMessage(java.lang.String message)
Adds a message to the DefaultJobMessage.

Parameters:
message - The message to be added.

iterateMessages

public java.util.Iterator iterateMessages()
Returns an Iterator for all the messages in the instance.

Returns:
An Iterator for all the messages.

getMessageCount

public int getMessageCount()
Returns the number of messages in the instance.

Returns:
The number of messages in the instance.

getMessage

public java.lang.String getMessage(int index)
Returns the message at the specified index.

Parameters:
index - The index at which the message is required.
Returns:
The message at the index.
Throws:
java.lang.ArrayIndexOutOfBoundsException - If there is no message at the specified index.


Copyright © 2003-2008 MindTree Consulting Ltd.. All Rights Reserved.