PaP
Class PAS

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--PaP.RMIServer
                          |
                          +--PaP.PAS
All Implemented Interfaces:
java.awt.event.ActionListener, ControlInterface, java.util.EventListener, PASInterface, java.rmi.Remote, java.lang.Runnable, java.io.Serializable

public class PAS
extends RMIServer
implements java.io.Serializable, PASInterface, java.lang.Runnable

This class is the implementation of PaP layer PAS. A class instance executes within its separate JVM, and the JVM will contain the PAS functionality of the PAS, and in addition to all the actor instances that is controlled by this PAS. The JVM contains at least two threads, one to serve external requests and the other to serve actor instances.

See Also:
Serialized Form

Field Summary
private  java.lang.Thread actorServe
          The actor serve thread
private  ActorFactory af
          Functionality to create actor instances and to assign correct behaviour by downloading the desired manuascript class.
private  ActorManager am
          The actor manager that keeps information about all actor instances controlled by this PAS
protected  java.lang.String nodeProfile
          Default node profile defined at PNES startup
private  GAI ownPNES
          Own address identifier
private  boolean waitForNotify
          Indication whether or not the separate thread that serves all the actors contained is activated.
private  java.util.Vector vRP
          Queue of actor requests
 
Fields inherited from class PaP.RMIServer
bf, defaultCodebase, defaultHI, DSL, fh, ownGAI, policy
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Constructor Summary
PAS()
          Empty constructor only to throw Exception.
 
Method Summary
private  RequestResult actorChangeBehaviour(RequestPars pRP)
          Changes behaviour for a newly created actor
private  Actor actorCreate(RequestPars pRP)
          Creates one actor; director invokes this.
private  RequestResult actorPlugIn(RequestPars pRP)
          Plugs in a newly created actor
private  RequestResult actorPlugOut(RequestPars pRP)
          Remove an actor from the director's playing base
 RequestResult control(java.lang.String command, java.lang.String[] pars)
          Controls this PAS object, invokes its functionality, BaseFrame input field can trigger it
static void main(java.lang.String[] argv)
           
 void run()
          Utility for the thread support.
private  void serveActor()
          Serves the Actor requests from the queue of requests.
 void starter(java.lang.String[] argv)
          To leave constructor empty, this method initializes data field values.
 Item status()
          Status report of all contained information of this PNES object.
 RequestResult syncRequestFromActor(RequestPars pRP)
          Handles requests from Actor objects
 RequestResult syncRequestFromPNES(RequestPars pRP)
          Handles requests from PNES objects.
 
Methods inherited from class PaP.RMIServer
actionPerformed, addCodebase, getGAI, init, term, unbind
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
, clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub, writeObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

ownPNES

private GAI ownPNES
Own address identifier

am

private ActorManager am
The actor manager that keeps information about all actor instances controlled by this PAS

af

private ActorFactory af
Functionality to create actor instances and to assign correct behaviour by downloading the desired manuascript class.

waitForNotify

private boolean waitForNotify
Indication whether or not the separate thread that serves all the actors contained is activated. ActorServer is passivated if true.

vRP

private java.util.Vector vRP
Queue of actor requests

actorServe

private java.lang.Thread actorServe
The actor serve thread

nodeProfile

protected java.lang.String nodeProfile
Default node profile defined at PNES startup
Constructor Detail

PAS

public PAS()
    throws java.lang.Exception
Empty constructor only to throw Exception.
Method Detail

run

public void run()
Utility for the thread support.
Specified by:
run in interface java.lang.Runnable

starter

public void starter(java.lang.String[] argv)
             throws java.lang.Exception
To leave constructor empty, this method initializes data field values.
Parameters:
argv - Command line style arguments from startPaP with codebase, policy, homeinterface and debugserver.

status

public Item status()
Status report of all contained information of this PNES object.
Overrides:
status in class RMIServer
Returns:
PaP conform Item hierarchy of status information.

serveActor

private void serveActor()
                 throws java.lang.Exception
Serves the Actor requests from the queue of requests.

actorCreate

private Actor actorCreate(RequestPars pRP)
                   throws java.lang.Exception
Creates one actor; director invokes this. Compiles Play and Role for the new actor and invokes ActorFactory's createActor.
Parameters:
pRP - Request parameters
Returns:
The Actor that was created

actorPlugIn

private RequestResult actorPlugIn(RequestPars pRP)
                           throws java.lang.Exception
Plugs in a newly created actor
Parameters:
pRP - Request parameters
Returns:
Result type and cause of the operation

actorChangeBehaviour

private RequestResult actorChangeBehaviour(RequestPars pRP)
                                    throws java.lang.Exception
Changes behaviour for a newly created actor
Parameters:
pRP - Request parameters
Returns:
Result type and cause of the operation

actorPlugOut

private RequestResult actorPlugOut(RequestPars pRP)
                            throws java.lang.Exception
Remove an actor from the director's playing base
Parameters:
pRP - Request parameters
Returns:
Result type and cause of the operation

syncRequestFromPNES

public RequestResult syncRequestFromPNES(RequestPars pRP)
                                  throws java.lang.Exception
Handles requests from PNES objects.
Specified by:
syncRequestFromPNES in interface PASInterface
Parameters:
pRP - The request.
Returns:
Result type and cause of the operation

syncRequestFromActor

public RequestResult syncRequestFromActor(RequestPars pRP)
                                   throws java.lang.Exception
Handles requests from Actor objects
Specified by:
syncRequestFromActor in interface PASInterface
Parameters:
pRP - The request
Returns:
Result type and cause of the operation

control

public RequestResult control(java.lang.String command,
                             java.lang.String[] pars)
                      throws java.lang.Exception
Controls this PAS object, invokes its functionality, BaseFrame input field can trigger it
Specified by:
control in interface PASInterface
Parameters:
command - First command line argument, used to denote a command name
pars[] - Rest of the command line arguments, used as parameters for the denoted command
Returns:
PaP style result indication of the operation

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception