|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Job
A Job
is an action that is invoked by a Verifier
when it meets its criteria. A Job
is called when the Insight
action the Verifier
is monitoring meets the criterions set in
the Verifier
.
Jobs may be executed in Synchronous (Blocking) or Asynchronous
(Non-Blocking) mode depending on the implementation of the
Job
. Hence, in particular cases where the Job
is invoked even before the entire Insight Action (like Filtering) is
completed, may block the original action for executing the Job
.
When Insight is running in the interactive GUI mode, this might not only
block the user requested action, but also freeze up the UI. In such
scenarios, the Verifier
might start the job execution in its
own Thread
.
A Job
may support any number of JobMessage
s,
which can be checked by calling the #getSupportedMessageTypes()
or the #isMessageTypeSupported(String)
methods. All
Job
s must support atleast the DefaultJobMessage
type.
If the #execute(JobMessage)
method is called with an
unsupported message type, the method would then throw an
UnsupportedMessageTypeException
. Any exception conditions
during the execution of the Job
would cause a
JobExecutionException
to be thrown.
All Job
s are uniquely identified by the fully qualified class
name of the implementing class and should be returned in the
#getUID()
method.
A Job
may be serialized (possibly as part of a
Verifier
) for later reincarnation and execution. The format
for the serialized Job
is mentioned in the documentation of
JobPersistanceHandler
.
JobPersistanceHandler
also handles the serialization and
deserialization of the Jobs
. It gets the fields to be
serialized for the Job
from the
#getSerializableFields()
methods and it deserializes the
fields on the Job
by calling the
#setDeserializedField(String, String)
. All Job
s
must provide a no-arguments public constructor for them to be deserialized.
JobMessage
,
Verifier
,
JobPersistanceHandler
Method Summary | |
---|---|
void |
execute(JobMessage jobMessage)
Executes the job with the data supplied in the JobMessage
passed to the method. |
java.lang.String |
getDisplayName()
Returns the 'display name' of the Job to be displayed to the
user. |
java.util.Map |
getSerializableFields()
A Map of all fields that might be necessary for
serializing the Job . |
java.lang.String[] |
getSupportedMessageTypes()
Returns the array of all different message types supported by the Job . |
java.lang.String |
getUID()
Returns the unique identifier for this Job - the fully
qualified name of the class implementing the interface. |
boolean |
isMessageTypeSupported(java.lang.String messageType)
Checks if the particular JobMessage , as identified by the
message type, is supported by the Job . |
void |
setDeserializedField(java.lang.String fieldName,
java.lang.String fieldValue)
Sets the deserialized field in the Job . |
Method Detail |
---|
java.lang.String[] getSupportedMessageTypes()
Job
. The values returned would be the same as returned by
the getJobMessageType()
methods of each of the
JobMessage
types supported by the Job
.
All Job
s are required to support atleast the
DefaultJobMessage
.
JobMessage
s supported.JobMessage.getJobMessageType()
boolean isMessageTypeSupported(java.lang.String messageType)
JobMessage
, as identified by the
message type, is supported by the Job
. The value of the
parameter should be the same as that returned by
JobMessage#getJobMessageType()
.
messageType
- The message type to check.
true
if the message type is supported or
false
JobMessage.getJobMessageType()
void execute(JobMessage jobMessage) throws UnsupportedMessageTypeException, JobExecutionException
JobMessage
passed to the method. The action performed on calling the method depends
on the implementation of the Job
.
Jobs may be executed asynchronously, or synchronously depending on the
implementation of the Job
. The method contract for a
Job
does not specify that. However, Verifiers
calling the #executeJob(JobMessage)
method while the
action they are monitoring need to aware that blocking jobs may
hold up (or fail) the action they are monitoring. In such scenarios, the
Verifier
may as an additional performance feature despatch
all calls on the Job
s in a seperate asynchronous
Thread
.
jobMessage
- The message used for executing the Job
.
UnsupportedMessageTypeException
- If the JobMessage
passed in is not supported
by the Job
.
JobExecutionException
- If there is problem executing the Job
.java.lang.String getDisplayName()
Job
to be displayed to the
user.
java.lang.String getUID()
Job
- the fully
qualified name of the class implementing the interface.
java.util.Map getSerializableFields()
Map
of all fields that might be necessary for
serializing the Job
. This data will later used for
recreating a Job
instance from the serialized data.
Unlike Verifiers
the data passed in the map may not be
array
s or Collection
s.
Job
.JobPersistanceHandler
void setDeserializedField(java.lang.String fieldName, java.lang.String fieldValue)
Job
. This method would
be called during the deserialization of a Job
from the
store.
fieldName
- The name of the field being deserialized.fieldValue
- The value of the field being deserialized.JobPersistanceHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |