Class ibm.aglets.patterns.Notifier
All Packages Class Hierarchy This Package Previous Next Index
Class ibm.aglets.patterns.Notifier
java.lang.Object
|
+----aglet.Aglet
|
+----aglet.a4compatibility.OldAglet
|
+----ibm.aglets.patterns.Notifier
- public class Notifier
- extends OldAglet
Create a notifier by calling the static method create.
The notifier will get dispatched automatically. The notifier
performs successive checks (at its destination) within a specified
time duration.
Upon every successfull check (one the encounters a change in a
local state), it notifies its master.
The notifier can be defined (see create
) to complete
its job after the first successive check (although its time duration
has not been reached yet).
If a notifier cannot be dispatched or it encounters an error
during a check, it notifies its master and disposed itself.
-
ARGUMENT
- The protected variable that carries any arguments for the
checks that this notifier performs.
-
EXCEPTION
-
-
EXPIRY
-
-
MESSAGE
- The protected variable that carries any messages that should go
along with the notification back to the subscriber.
-
NOTIFICATION
-
-
Notifier()
-
-
create(URL, String, AgletContext, Aglet, Itinerary, double, double, boolean, Object)
- Creates a notifier.
-
doCheck()
- This method should be overridden to specify the check method for
this notifier.
-
getOrigin()
- Gets the URL of the Origin of the aglet.
-
getReceiver()
- Gets the URL of this notifier's receiver.
-
initializeCheck()
- This method should be overridden to specify any intialization before
the checks performed by this notifier.
-
onCreation(Object)
- Initializes the notifier.
-
run()
- Universal entry point for the notifier's execution thread.
NOTIFICATION
public final static int NOTIFICATION
EXPIRY
public final static int EXPIRY
EXCEPTION
public final static int EXCEPTION
MESSAGE
protected Object MESSAGE
- The protected variable that carries any messages that should go
along with the notification back to the subscriber.
ARGUMENT
protected Object ARGUMENT
- The protected variable that carries any arguments for the
checks that this notifier performs.
Notifier
public Notifier()
initializeCheck
protected abstract void initializeCheck() throws Exception
- This method should be overridden to specify any intialization before
the checks performed by this notifier.
- Throws: AgletException
- if fails to complete.
doCheck
protected abstract boolean doCheck() throws Exception
- This method should be overridden to specify the check method for
this notifier.
- Returns:
- boolean result of the check.
- Throws: AgletException
- if fails to complete.
getReceiver
protected AgletIdentifier getReceiver()
- Gets the URL of this notifier's receiver.
getOrigin
protected URL getOrigin()
- Gets the URL of the Origin of the aglet.
create
public static AgletProxy create(URL url,
String source,
AgletContext context,
Aglet master,
Itinerary destination,
double interval,
double duration,
boolean stay,
Object argument) throws IOException, AgletException
- Creates a notifier.
- Parameters:
- url - the URL of the aglet class.
- source - the name of the aglet class.
- context - the aglet context in which the notifier should be created.
- master - the master aglet.
- destination - the URL of the destination.
- interval - the time in hours between to checks.
- duration - the life time of the notifier.
- stay - whether the notifier should remain after a notification.
- argument - the
argument
object.
- Returns:
- an aglet proxy for the notifier.
- Throws: AgletException
- if the creation fails.
onCreation
public synchronized void onCreation(Object object)
- Initializes the notifier. Only called the very first time this
notifier is created. The initialization argument includes
the needed parameters for the checks as defined
in
create
.
- Parameters:
- obj - the initialization argument.
- Throws: AgletException
- if the initialization fails.
- Overrides:
- onCreation in class OldAglet
run
public void run()
- Universal entry point for the notifier's execution thread.
- Overrides:
- run in class Aglet
All Packages Class Hierarchy This Package Previous Next Index