Watcher.v1_1
Class WatchServer

java.lang.Object
  |
  +--PaP.Actor
        |
        +--PaP.ApplicationActor
              |
              +--Watcher.v1_1.WatchServer
All Implemented Interfaces:
java.awt.event.ActionListener, ActorInterface, ControlInterface, java.util.EventListener, java.rmi.Remote, java.io.Serializable

public class WatchServer
extends ApplicationActor
implements java.awt.event.ActionListener

The PaP Application class utilise the PaP Subscribe functionality to display log and status information for an existing operative DirectorActor. An instance of the class subscribe for all types of events that is reported to the subscription functionality, and this information is displayed in three different fields in a separate window. First, the log information as it occurs, then a list of actors that has been created after the WatchServer instance has been started, and last a list of Role Sessions that has been created after the WatchServer instance has been created. The WatchServer instance is terminated by pushing the X button in the window.

See Also:
Serialized Form

Field Summary
private  boolean changedBehaviour
          Indication that behaviour has changed
private  RoleSession initialRoleSession
          The initial role session created when actor is created.
private  boolean initiated
          Indication that initial ActorPlugIn has been performed
private  RoleSession ownRoleSession
          Role session when plugged into self - as preparation for ActorChangeBehaviour
private  java.lang.String startTime
          Indication when initial instance was started
private  int state
           
private static int stInitial
           
private static int stNextStateToDefine
           
private static int stServerActive
           
private static int stServerPassive
           
private static int stUpgrade
           
private  java.lang.String subscribeID
          The unique subscription identifier returned when SubscribeRequest done
private  WatcherGraphicsInterface wgi
          The object the is responsible for the presentation of the status and log information
 
Fields inherited from class PaP.Actor
bf, context, fh
 
Constructor Summary
WatchServer()
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          If the application has registered (by calling the 'WatcherGraphicalInterface' 'addActionListener()' method, this method will be called when the window is requested to be terminated by pushing the X button.
 RequestResult applicationActorEntry(RequestPars pRP)
          The common entry point for all external requests to the actor
private  RequestResult stateTransition(GAI sender, GAI receiver, ApplicationMessage am)
          This is the main behaviour definition for this actor.
 RequestResult subscribeReport(java.lang.String[] subscribeReport)
          'subscribeReport()' metho is an overloading of a corresponding dummy representation of the same methon in the 'ApplicationActor' class.
 
Methods inherited from class PaP.ApplicationActor
actorBehaviourPlugIn, actorBehaviourPlugOut, actorCapabilities, actorChangeBehaviour, actorEntry, actorPlay, actorPlugIn, actorPlugOut, anyOtherRequestType, callActorChangeBehaviour, control, dbg, init, loginUser, logoutUser, playChangesPlugIn, playPlugIn, playPlugOut, requestToActor, roleFigurePlugIn, roleFigurePlugOut, roleSessionAction, sessionResume, sessionSuspend, sessionUpdate, subscribeCancel, subscribeRequest
 
Methods inherited from class PaP.Actor
findRoleSession, getGAI, start, status, term
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

stInitial

private static final int stInitial

stUpgrade

private static final int stUpgrade

stServerActive

private static final int stServerActive

stServerPassive

private static final int stServerPassive

stNextStateToDefine

private static final int stNextStateToDefine

state

private int state

subscribeID

private java.lang.String subscribeID
The unique subscription identifier returned when SubscribeRequest done

wgi

private WatcherGraphicsInterface wgi
The object the is responsible for the presentation of the status and log information

initialRoleSession

private RoleSession initialRoleSession
The initial role session created when actor is created. Used when termination

ownRoleSession

private RoleSession ownRoleSession
Role session when plugged into self - as preparation for ActorChangeBehaviour

initiated

private boolean initiated
Indication that initial ActorPlugIn has been performed

changedBehaviour

private boolean changedBehaviour
Indication that behaviour has changed

startTime

private java.lang.String startTime
Indication when initial instance was started
Constructor Detail

WatchServer

public WatchServer()
Method Detail

subscribeReport

public RequestResult subscribeReport(java.lang.String[] subscribeReport)
                              throws java.lang.Exception
'subscribeReport()' metho is an overloading of a corresponding dummy representation of the same methon in the 'ApplicationActor' class. The method is called each time when report is received from the DirectorActor that is subscribed for.
Overrides:
subscribeReport in class ApplicationActor
Parameters:
subscribeReport - A list of reported events, where each event consist of four parameters: a) Event type is defined in SubscribeRequest class, b) Textual representation of the GAI address for the actor the report event concerns, c) Event type dependent information, and d) The point of time (in milliseconds since 1 jan. 1970) where the event was reported to the DirectorActor (Use DateFormat class for formatting to a suitable presentation format).
Returns:
Successful or failure in treatment of the results

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
If the application has registered (by calling the 'WatcherGraphicalInterface' 'addActionListener()' method, this method will be called when the window is requested to be terminated by pushing the X button.
Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - The reported action event. The action command skall be 'CancelEventInd'.

applicationActorEntry

public RequestResult applicationActorEntry(RequestPars pRP)
                                    throws java.lang.Exception
The common entry point for all external requests to the actor
Overrides:
applicationActorEntry in class ApplicationActor
Parameters:
pRP - The specification of request type and additional parameters
Returns:
Successful or failure indication

stateTransition

private RequestResult stateTransition(GAI sender,
                                      GAI receiver,
                                      ApplicationMessage am)
                               throws java.lang.Exception
This is the main behaviour definition for this actor. Note however that the methods 'actionPerformed()' and 'subscribeReport()' is also a part of the behaviour, but those methods is executed asynchrounous to the main behaviour defined in 'stateTransition()' method.
Parameters:
sender - The source of the received request
receiver - This actor's address
am - The specification of the request
Returns:
Success or failure indication