zeus.actors.intrays
Class Zeus_ACC_Server

java.lang.Object
  extended byjava.lang.Thread
      extended byzeus.actors.Server
          extended byzeus.actors.intrays.Zeus_ACC_Server
All Implemented Interfaces:
FIPA_2000_Handler, FIPA_97_Handler, InTray, java.lang.Runnable

public class Zeus_ACC_Server
extends Server
implements InTray, FIPA_97_Handler, FIPA_2000_Handler

Zeus_ACC_Server uses the FIPA_97_Server and FIPA_2000_Server classes to provide a unified message reception and handleing service.On init this class will create a FIPA_97_Server and a FIPA_2000_Server, using itself as a parameter. When either of these intrays receives a message it will call back the appropiate handle method in this class. The message will then be processed and placed on the message handleing q in this instance. Finally this message will be handled and processed.

Since:
1.1
Author:
Simon Thompson

Field Summary
protected  AgentContext context
          access to the context object is provided as protected as a convienience for API programmers and future extentions, it is passed to the init() of this class
protected  java.lang.String host
          host is protected to allow for interference by putative sub-classes
 java.lang.String hostname
           
protected  java.lang.String httpPort
          httpPort is the number of the port that the FIPA_2000 HTTP service will listenon.
protected  FIPA_2000_HTTP_Server httpServer
          httpServer is the reference to the FIPA_2000_HTTP_Server that this class sets up and runs in it's init()
protected  java.lang.String iiop2000Port
          iiop2000port is used to store the number of the port that the FIPA_2000 IIOP listening service (the server) will use.
protected  java.lang.String iiop97Port
          iiop97port is used to store the number of the port that the FIPA_97 IIOP listening service (the server) will use.
private  Queue msgQ
           
protected  java.lang.String name
          name is set to "ACC" by default
protected  FIPA_97_Server ninetySeven_Server
          ninetySeven_Server is the reference to the FIPA_97_Server that this class sets up and runs in it's init()
private  ZeusParser parser
           
protected  FIPA_2000_IIOP_Server twoThousand_Server
          twoThousand_Server is the reference to the FIPA_2000_IIOP_Server that this class sets up and runs in it's init().
 
Fields inherited from class zeus.actors.Server
address, connection_count, DEFAULT_PORT_MAX, DEFAULT_PORT_MIN, inMail, listenSocket, MAX_CONNECTIONS, MAX_QUEUE_LENGTH, mbox, msgHandler, processing, timeout
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Zeus_ACC_Server(AgentContext context, Zeus_ACC_MailBox mbox)
          class constructor that takes the AgentContext and registers this instance with it, and the MailBox and grabs the reference so that it can be used later.
 
Method Summary
 void debug(java.lang.String str)
           
protected  void finalize()
           
 void forward(Performative perf)
          forward is the method called when the MsgHandler fires a MessageRule that is setup by the setHandleMessage method.
 void forwardFIPAMessage(java.lang.String text)
          for now the behaviour is :- get message,
act surprised,
then parse it into a FIPAPerformative,
map that to a Performative,
register self as alias in nameserver,
add alias to FIPAAddressBook,
stamp message with said alias,
assert a messageHandleing rule to invoke forwarding behaviour when a response is received send message to Zeus agent,
 Address getAddress()
           
 java.lang.String getResponseAddress()
          return a string of addresses that this server is listening on
 void handle(FipaMessage aMessage)
          handle (FIPA.FipaMessage aMessage) is called by the FIPA_2000_server that the init method of this class creates.
 void handle(java.lang.String message)
          handle(String message) is called by the FIPA_97_Server which the init method of the Zeus_ACC_Server class creates it is used as an interface to unify and collate the information reception and processing for the ACC agent.
 java.lang.String pop()
          pull something off the ACC message processing queue
 void push(java.lang.String target)
          put something onto the ACC message processing queue
 void registerAgent(FIPA_AID_Address address, java.lang.String name)
          registerAgent is functionally identical to registerAlias, but is semantically slightly different because in the one we are using the agent name directly, while in the other we are trying to decouple
protected  void registerAlias(FIPA_AID_Address sender)
          send a registration to the nameservers that we are using.
protected  void registerAlias(FIPA_AID_Address address, java.lang.String name)
          send a registration to the nameservers that we are using.
protected  void registerAlias(java.lang.String name)
          send a registration to the nameservers that we are using.
 void run()
          This is where the changes were needed.
 void setFIPAAlias(java.lang.String name, FIPA_AID_Address fAddress)
          provides a basic mechanism for getting aliases for agents on other platforms into the Zeus address space.
 void setFIPAAlias(java.lang.String name, java.lang.String address)
          provides a basic mechanism for getting aliases for agents on other platforms into the Zeus address space.
private  void setHandleMessage(FIPA_AID_Address faddress, java.lang.String alias)
          set up a forwarding rule, if one is not already present.
 void stopProcessing()
          stopProcessing will cause the run loop of this class to stop
 
Methods inherited from class zeus.actors.Server
getAgentContext, lowerStatus, newMsg, normalStatus, updateCount
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

hostname

public java.lang.String hostname

iiop2000Port

protected java.lang.String iiop2000Port
iiop2000port is used to store the number of the port that the FIPA_2000 IIOP listening service (the server) will use. This is package protected so that subclasses can do as they will! value is set to "2000" by default


iiop97Port

protected java.lang.String iiop97Port
iiop97port is used to store the number of the port that the FIPA_97 IIOP listening service (the server) will use. This is package protected so that subclasses can do as they will! value is set to "1097" by default.


httpPort

protected java.lang.String httpPort
httpPort is the number of the port that the FIPA_2000 HTTP service will listenon. This is package protected so that you can fiddle with it in subclasses. value is set to "61000" by default


context

protected AgentContext context
access to the context object is provided as protected as a convienience for API programmers and future extentions, it is passed to the init() of this class


msgQ

private Queue msgQ

parser

private ZeusParser parser

name

protected java.lang.String name
name is set to "ACC" by default


twoThousand_Server

protected FIPA_2000_IIOP_Server twoThousand_Server
twoThousand_Server is the reference to the FIPA_2000_IIOP_Server that this class sets up and runs in it's init().


ninetySeven_Server

protected FIPA_97_Server ninetySeven_Server
ninetySeven_Server is the reference to the FIPA_97_Server that this class sets up and runs in it's init()


httpServer

protected FIPA_2000_HTTP_Server httpServer
httpServer is the reference to the FIPA_2000_HTTP_Server that this class sets up and runs in it's init()


host

protected java.lang.String host
host is protected to allow for interference by putative sub-classes

Constructor Detail

Zeus_ACC_Server

public Zeus_ACC_Server(AgentContext context,
                       Zeus_ACC_MailBox mbox)
class constructor that takes the AgentContext and registers this instance with it, and the MailBox and grabs the reference so that it can be used later. This also sets up the ServerThreads for the message transports that this Server is utilizing.

Method Detail

stopProcessing

public void stopProcessing()
stopProcessing will cause the run loop of this class to stop

Overrides:
stopProcessing in class Server

run

public void run()
This is where the changes were needed. Instead of listening on a stupid socket ;-) we simply look in our message queue to see if any goodies have been put there by nice mr FIPA_97_Connection.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class Server

forwardFIPAMessage

public void forwardFIPAMessage(java.lang.String text)
for now the behaviour is :- get message,
act surprised,
then parse it into a FIPAPerformative,
map that to a Performative,
register self as alias in nameserver,
add alias to FIPAAddressBook,
stamp message with said alias,
assert a messageHandleing rule to invoke forwarding behaviour when a response is received send message to Zeus agent,


setHandleMessage

private void setHandleMessage(FIPA_AID_Address faddress,
                              java.lang.String alias)
set up a forwarding rule, if one is not already present.


setFIPAAlias

public void setFIPAAlias(java.lang.String name,
                         java.lang.String address)
provides a basic mechanism for getting aliases for agents on other platforms into the Zeus address space. If this method is called from the ACC agent stub it can be used to setup zeus names and fipa forwarding in the ANServer and in the ACC


setFIPAAlias

public void setFIPAAlias(java.lang.String name,
                         FIPA_AID_Address fAddress)
provides a basic mechanism for getting aliases for agents on other platforms into the Zeus address space. If this method is called from the ACC agent stub it can be used to setup zeus names and fipa forwarding in the ANServer and in the ACC


forward

public void forward(Performative perf)
forward is the method called when the MsgHandler fires a MessageRule that is setup by the setHandleMessage method. It converts the Zeus Performative into a FIPA performative, does any address mapping that is needed and sends the message to the FIPA_postman.


registerAlias

protected void registerAlias(FIPA_AID_Address sender)
send a registration to the nameservers that we are using.

Parameters:
sender - is the name of the alias to use

registerAlias

protected void registerAlias(FIPA_AID_Address address,
                             java.lang.String name)
send a registration to the nameservers that we are using.


registerAlias

protected void registerAlias(java.lang.String name)
send a registration to the nameservers that we are using.


registerAgent

public void registerAgent(FIPA_AID_Address address,
                          java.lang.String name)
registerAgent is functionally identical to registerAlias, but is semantically slightly different because in the one we are using the agent name directly, while in the other we are trying to decouple

Specified by:
registerAgent in interface FIPA_2000_Handler

finalize

protected void finalize()
Overrides:
finalize in class Server

getAddress

public Address getAddress()
Overrides:
getAddress in class Server

pop

public java.lang.String pop()
pull something off the ACC message processing queue


push

public void push(java.lang.String target)
put something onto the ACC message processing queue


handle

public void handle(java.lang.String message)
handle(String message) is called by the FIPA_97_Server which the init method of the Zeus_ACC_Server class creates it is used as an interface to unify and collate the information reception and processing for the ACC agent.

implements the FIPA_97_Handler interface

Specified by:
handle in interface FIPA_97_Handler
Parameters:
message - - the message picked up from the fipa_97 transport

handle

public void handle(FipaMessage aMessage)
handle (FIPA.FipaMessage aMessage) is called by the FIPA_2000_server that the init method of this class creates. implements that FIPA_2000_Handler interface

ISSUES
------
Envelopes - what should we do???

Specified by:
handle in interface FIPA_2000_Handler
Parameters:
aMessage - - the message in FIPA 2000 object (java/idl) format
See Also:
FipaMessage

getResponseAddress

public java.lang.String getResponseAddress()
return a string of addresses that this server is listening on

Specified by:
getResponseAddress in interface InTray
Overrides:
getResponseAddress in class Server

debug

public void debug(java.lang.String str)
Overrides:
debug in class Server


Copyright © 2000-2003 BT Exact Technologies. All Rights Reserved.