MicroTAPAS
Class MicroPNES

java.lang.Object
  |
  +--MicroTAPAS.MicroBase
        |
        +--MicroTAPAS.MicroPNES
All Implemented Interfaces:
ControlInterface, MicroPNESInterface, java.lang.Runnable, java.io.Serializable

public class MicroPNES
extends MicroBase
implements MicroPNESInterface, java.lang.Runnable

This class is the implementation of MicroTAPAS layer MicroPNES, and is largely based on a combination of TAPAS.PNES and TAPAS.PAS

See Also:
Serialized Form

Field Summary
protected  MicroActorFactory af
          Functionality to create actor instances and to assign correct behaviour by downloading the desired manuscript class
protected  MicroActorManager am
          The actor manager that keeps information about all actor instances controlled by this MicroPNES
private  ComCenter cc
          The entity responsible for communication between different nodes
private static boolean DEBUG
          Determines whether debug info to be sent to debug-server
private  GAI managerGAI
           
private  GAI mobilityGAI
          The address of the local Mobility entity (MM or MA)
private  Node node
           
protected  java.lang.Thread requestThread
          Thread that takes care of requests
protected  boolean requestThreadAlive
          Boolean which determines if the thread has died
private  ScriptHandler sh
          Entity that takes care of running scripts at start-up (if any)
protected  boolean waitForNotify
          Used for requests
protected  java.util.Vector vRP
          Vector of incomming RequestPars
 
Fields inherited from class MicroTAPAS.MicroBase
bf, codebase, debug, debugServer, homeInterface, maInterface, mmInterface, nodeCaps, nodeProfile, properties, selfInterface
 
Constructor Summary
MicroPNES()
          Empty constructor so that it can be instantiated after dynamic loading of its class
 
Method Summary
private  RequestResult actorChangeBehaviour(RequestPars rpars)
          Changes behaviour for a newly created actor.
private  MicroActor actorCreate(RequestPars rpars)
          Creates one actor locally; director invokes this.
private  RequestResult actorDiscover(RequestPars pRP)
          Method to discover an actor
private  RequestResult actorPlugIn(RequestPars rpars)
          Plugs in a new actor at this node.
private  RequestResult actorPlugOut(RequestPars rpars)
          Remove an actor from the director's playing base
 void addBFCommands()
          Adds the following command-lines to the BaseFrame
private  RequestResult capabilitiyValidate(RequestPars rpars)
          Verifies that an actor's required capabilities are met prior to plugging in the new actor, or performing an actorChangeBehaviour.
 void cleanUp()
          Gives this TAPAS instance a chance to clean up when the DebugWindow is closed (i.e this TAPAS node is shutting down).
 RequestResult control(java.lang.String command, java.lang.String[] pars)
          Controls this MicroPNES object, invokes its functionality.
private  CapabilitySet getActorCapabilities(RequestPars pRP)
          Method to load an actor's required capabilities.
private  java.util.Hashtable getActorProperties(RequestPars pRP)
          Method to load an actor's properties.
private  void plugInMobility()
          Private method to plug in a mobility support entity.
private  void plugOutMobility()
          Private method to plug out the mobility support entity.
 void run()
          Runs the thread for serving requests to Actors
 RequestResult sendToPNES(RequestPars rpars)
          Sends a RequestPars to any non-local PNES instance (there can be only one PNES per node)
private  void serveRequests()
          Thread that serves requests to Actors (Asynchronous communication)
 void starter(java.lang.String[] argv)
          Initializes this MicroPNES instance
 Item status()
          Status report of MicroPNES in Item hierarchy of information elements
 RequestResult syncRequestFromActor(RequestPars rpars)
          Handles requests from Actor objects
 RequestResult syncRequestFromCC(RequestPars rpars)
          Handles incomming requests from other nodes.
 RequestResult syncRequestFromPNES(RequestPars rpars)
          Handles requests from PNES objects
 void terminalMove(java.lang.String oldNode, java.lang.String newNode)
          Method to update all relevant properties once a terminal has moved.
 void unbind()
          Closes down window
 
Methods inherited from class MicroTAPAS.MicroBase
getGAI, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

private static final boolean DEBUG
Determines whether debug info to be sent to debug-server

See Also:
Constant Field Values

vRP

protected java.util.Vector vRP
Vector of incomming RequestPars


waitForNotify

protected boolean waitForNotify
Used for requests


requestThread

protected java.lang.Thread requestThread
Thread that takes care of requests


requestThreadAlive

protected boolean requestThreadAlive
Boolean which determines if the thread has died


am

protected MicroActorManager am
The actor manager that keeps information about all actor instances controlled by this MicroPNES


af

protected MicroActorFactory af
Functionality to create actor instances and to assign correct behaviour by downloading the desired manuscript class


cc

private ComCenter cc
The entity responsible for communication between different nodes


sh

private ScriptHandler sh
Entity that takes care of running scripts at start-up (if any)


mobilityGAI

private GAI mobilityGAI
The address of the local Mobility entity (MM or MA)


managerGAI

private GAI managerGAI

node

private Node node
Constructor Detail

MicroPNES

public MicroPNES()
          throws java.lang.Exception
Empty constructor so that it can be instantiated after dynamic loading of its class

Method Detail

starter

public void starter(java.lang.String[] argv)
             throws java.lang.Exception
Initializes this MicroPNES instance

Parameters:
argv - Command line style arguments from startPaP with codebase, policy, homeinterface and debugserver.
java.lang.Exception

plugInMobility

private void plugInMobility()
Private method to plug in a mobility support entity. Whether MobilityManager (MM) or MobilityAgent (MA) is plugged in depends on attributes in the configuration file. If the local IP-address is the same as the IP-address specified for the MM, it is plugged in, otherwise, MA is plugged in.


plugOutMobility

private void plugOutMobility()
Private method to plug out the mobility support entity. This will only be done if this node is shutting down - and gives MM/MA a chance to clean up (i.e. deregistring with other nodes) before being terminated.


control

public RequestResult control(java.lang.String command,
                             java.lang.String[] pars)
                      throws java.lang.Exception
Controls this MicroPNES object, invokes its functionality. BaseFrame input field can trigger it

Specified by:
control in interface MicroPNESInterface
Parameters:
command - the command to be performed
Returns:
TAPAS style result indication of the operation
java.lang.Exception

syncRequestFromCC

public RequestResult syncRequestFromCC(RequestPars rpars)
                                throws java.lang.Exception
Handles incomming requests from other nodes.

java.lang.Exception

syncRequestFromPNES

public RequestResult syncRequestFromPNES(RequestPars rpars)
                                  throws java.lang.Exception
Handles requests from PNES objects

Specified by:
syncRequestFromPNES in interface MicroPNESInterface
Parameters:
rpars - the request
Returns:
the result fo the request
java.lang.Exception

syncRequestFromActor

public RequestResult syncRequestFromActor(RequestPars rpars)
                                   throws java.lang.Exception
Handles requests from Actor objects

Parameters:
rpars - the request
Returns:
the result fo the request
java.lang.Exception

actorCreate

private MicroActor actorCreate(RequestPars rpars)
                        throws java.lang.Exception
Creates one actor locally; director invokes this. Compiles Play and Role for the new actor and invokes ActorFactory's createActor.

Parameters:
rpars - the request
Returns:
the actor that was created
java.lang.Exception

actorPlugIn

private RequestResult actorPlugIn(RequestPars rpars)
Plugs in a new actor at this node. If mobility is used, the required caps of the actor is compare with the offered caps of this node.

Parameters:
rpars - request parameters
Returns:
reult type and cause of the operation

actorChangeBehaviour

private RequestResult actorChangeBehaviour(RequestPars rpars)
                                    throws java.lang.Exception
Changes behaviour for a newly created actor.

Parameters:
rpars - request parameters
Returns:
reult type and cause of the operation
java.lang.Exception

actorPlugOut

private RequestResult actorPlugOut(RequestPars rpars)
                            throws java.lang.Exception
Remove an actor from the director's playing base

Parameters:
rpars - request parameters
Returns:
reult type and cause of the operation
java.lang.Exception

run

public void run()
Runs the thread for serving requests to Actors

Specified by:
run in interface java.lang.Runnable

serveRequests

private void serveRequests()
                    throws java.lang.Exception
Thread that serves requests to Actors (Asynchronous communication)

java.lang.Exception

sendToPNES

public RequestResult sendToPNES(RequestPars rpars)
                         throws java.lang.Exception
Sends a RequestPars to any non-local PNES instance (there can be only one PNES per node)

Parameters:
rpars - the request sent
Returns:
PaP style result
java.lang.Exception

actorDiscover

private RequestResult actorDiscover(RequestPars pRP)
Method to discover an actor

Parameters:
pRP - The request where pRP.receiver is the actor to be located
Returns:
The result of the query

terminalMove

public void terminalMove(java.lang.String oldNode,
                         java.lang.String newNode)
Method to update all relevant properties once a terminal has moved. Called by ActorContext.

Overrides:
terminalMove in class MicroBase
Parameters:
oldNode - The old node
newNode - The new node

capabilitiyValidate

private RequestResult capabilitiyValidate(RequestPars rpars)
Verifies that an actor's required capabilities are met prior to plugging in the new actor, or performing an actorChangeBehaviour.

Parameters:
rpars - request parameters
Returns:
reult type and cause of the operation

getActorCapabilities

private CapabilitySet getActorCapabilities(RequestPars pRP)
Method to load an actor's required capabilities.

Parameters:
pRP - TAPAS-style request parameters.
Returns:
A CapabilitySet containing all the required capabilities.

getActorProperties

private java.util.Hashtable getActorProperties(RequestPars pRP)
Method to load an actor's properties.

Parameters:
pRP - TAPAS-style request parameters.
Returns:
A Hashtable containing all the actor properties.

unbind

public void unbind()
            throws java.lang.Exception
Closes down window

java.lang.Exception

cleanUp

public void cleanUp()
Gives this TAPAS instance a chance to clean up when the DebugWindow is closed (i.e this TAPAS node is shutting down).

Specified by:
cleanUp in interface ControlInterface

status

public Item status()
Status report of MicroPNES in Item hierarchy of information elements

Overrides:
status in class MicroBase
Returns:
Hierarchy of Item information elements

addBFCommands

public void addBFCommands()
                   throws java.lang.Exception
Adds the following command-lines to the BaseFrame

java.lang.Exception


The Telematics Architecture for Plug-and-Play Systems (TAPAS) is a research project undertaken by the Norwegian University of Science and Technology's Telematics department which aims at developing an architecture for network-based service systems with a) flexibility and adaptability, b) robustness and survivability, and c) QoS awareness and resource control.

More information can be found at the project's homepage at http://tapas.item.ntnu.no and the project manager, Professor Finn Arve Aagesen, can be reached at finn.arve.aagesen@item.ntnu.no.