fr.dyade.aaa.agent.AgentServer Class Reference

Collaboration diagram for fr.dyade.aaa.agent.AgentServer:

Collaboration graph
[legend]
List of all members.

Static Public Member Functions

static ThreadGroup getThreadGroup ()
static Engine getEngine ()
static Transaction getTransaction ()
static boolean isHAServer ()
static boolean isMasterHAServer ()
static ConfigController getConfigController ()
static final Timer getTimer ()
static final void setConfig (A3CMLConfig a3config) throws Exception
static final A3CMLConfig getConfig () throws Exception
static A3CMLConfig getAppConfig (String[] domains) throws Exception
static final short getServerId ()
static final short getClusterId ()
static final String getName ()
static short getServerIdByName (String name) throws Exception
static String getProperty (String key)
static String getProperty (String key, String value)
static Integer getInteger (String key)
static Integer getInteger (String key, int value)
static Enumeration elementsServerDesc ()
static Enumeration getServersIds ()
static final String getHostname (short sid) throws UnknownServerException
static final String getServiceArgs (short sid, String classname) throws Exception
static final String getServiceArgs (String hostname, String classname) throws Exception
static int getStatus ()
static String getStatusInfo ()
static int init (String args[]) throws Exception
static void reset (boolean force)
static void reset ()
static void init (short sid, String path, LoggerFactory loggerFactory) throws Exception
static void init (short sid, String path, LoggerFactory loggerFactory, short cid) throws Exception
static String start () throws Exception
static void stop (boolean sync)
static void stop (boolean sync, long delay, boolean reset)
static void stop ()
static void main (String args[]) throws Exception

Static Public Attributes

static final short NULL_ID = -1
static final String ADMIN_DOMAIN = "D0"
static final String ADMIN_SERVER = "s0"
static final String CFG_DIR_PROPERTY = "fr.dyade.aaa.agent.A3CONF_DIR"
static final String DEFAULT_CFG_DIR = null
static final String CFG_FILE_PROPERTY = "fr.dyade.aaa.agent.A3CONF_FILE"
static final String DEFAULT_CFG_FILE = "a3servers.xml"
static final String DEFAULT_SER_CFG_FILE = "a3cmlconfig"
static final String CFG_NAME_PROPERTY = "fr.dyade.aaa.agent.A3CONF_NAME"
static final String DEFAULT_CFG_NAME = "default"
static final String A3CMLWRP_PROPERTY = "fr.dyade.aaa.agent.A3CMLWrapper"
static final String DEFAULT_A3CMLWRP = "fr.dyade.aaa.agent.conf.A3CMLSaxWrapper"
static final String OKSTRING = "OK"
static final String ERRORSTRING = "ERROR"
static final String ENDSTRING = "END"

Static Package Functions

static void addConsumer (String domain, MessageConsumer cons) throws Exception
static Enumeration getConsumers ()
static MessageConsumer getConsumer (String domain) throws Exception
static void removeConsumer (String domain)
static final void setConfig (A3CMLConfig a3config, boolean force) throws Exception
static void addServerDesc (ServerDesc desc) throws Exception
static ServerDesc removeServerDesc (short sid) throws Exception
static final int getServerNb ()
static final ServerDesc getServerDesc (short sid) throws UnknownServerException
static final MessageConsumer getConsumer (short sid) throws UnknownServerException
static final ServiceDesc[] getServices () throws UnknownServerException
static void initServerDesc (ServerDesc desc, A3CMLServer server) throws Exception
static String startConsumers () throws Exception

Static Package Attributes

static ThreadGroup tgroup = null
static Engine engine = null
static Transaction transaction = null
static Status status = new Status()

Detailed Description

The AgentServer class manages the global configuration of an agent server. It reads the configuration file, then it creates and configure Engine, Channel, Networks. This class contains the main method for AgentServer, for example to activate a server you have to run this class with two parameters: the server id. and the path of the root of persistency. You can also use a specialized main calling methods init and start.


To start the agents server an XML configuration file describing the architecture of the agent platform is needed. By default, this file is the a3servers.xml file and it should be located inside the running directory where the server is launched. Each server must use the same configuration file.

The configuration file contains a config element, that is essentially made up of domains elements, and servers (servers elements):

Each server that is part of two domains is named a "router", be careful, it should have only one route between two domains. If it is not true the configuration failed.


A simple example of a3servers.xml follows:

<blockquote>

 <?xml version="1.0"?>
 <!DOCTYPE config SYSTEM "a3config.dtd">

 <config>
   <domain name="D1"/>
   <domain name="D2" class="fr.dyade.aaa.agent.PoolCnxNetwork"/>

   <property name="D2.nbMaxCnx" value="1"&gt;

   <server id="0" name="S0" hostname="acores">
     <network domain="D1" port="16300"/>
     <service class=\"fr.dyade.aaa.ns.NameService\" args=\"\"/>
     <property name="A3DEBUG_PROXY" value="true"&gt;
   </server>

   <server id="2" name="S2" hostname="bermudes">
     <network domain="D1" port="16310"/>
     <network domain="D2" port="16312"/>
   </server>

   <server id="3" name="S3" hostname="baleares">
     <network domain="D2" port="16320"/>
   </server>
 </config>
 
</blockquote>

This file described a 2 domains configuration D1 and D2, D1 with default network protocol and D2 with the PoolCnxNetwork one, and 4 servers:

At the beginning of the file, there is a global property that defines the maximum number of connection handled by each server of domain D2.
See also:
Engine

Channel

Network

MessageQueue

fr.dyade.aaa.util.Transaction

Definition at line 144 of file AgentServer.java.


Member Function Documentation

static Engine fr.dyade.aaa.agent.AgentServer.getEngine (  )  [static]

Returns the agent server engine.

Definition at line 185 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.engine.

static Transaction fr.dyade.aaa.agent.AgentServer.getTransaction (  )  [static]

Returns the agent server transaction context.

Definition at line 195 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.transaction.

static boolean fr.dyade.aaa.agent.AgentServer.isHAServer (  )  [static]

Test HA server.

Returns:
true if the server is HA.

Definition at line 207 of file AgentServer.java.

static boolean fr.dyade.aaa.agent.AgentServer.isMasterHAServer (  )  [static]

Test if the server is a master (coordinator).

Returns:
true if the server HA is a master.

Definition at line 216 of file AgentServer.java.

References fr.dyade.aaa.agent.JGroups.isCoordinator().

Here is the call graph for this function:

static final Timer fr.dyade.aaa.agent.AgentServer.getTimer (  )  [static]

Returns a shared timer provided by the agent server.

Definition at line 283 of file AgentServer.java.

static final void fr.dyade.aaa.agent.AgentServer.setConfig ( A3CMLConfig  a3config  )  throws Exception [static]

Set the agent server configuration. Be careful, this method cannot be called after initialization.

Parameters:
a3config A3CMLConfig
Exceptions:
Exception Server is already initialized.

Definition at line 300 of file AgentServer.java.

static final A3CMLConfig fr.dyade.aaa.agent.AgentServer.getConfig (  )  throws Exception [static]

Returns the agent server configuration.

Returns:
agent server configuration (A3CMLConfig)

Definition at line 320 of file AgentServer.java.

Referenced by fr.dyade.aaa.agent.AgentServer.getAppConfig(), fr.dyade.aaa.agent.AgentServer.getServerIdByName(), fr.dyade.aaa.agent.AgentServer.getServiceArgs(), and fr.dyade.aaa.agent.AgentServer.initServerDesc().

static A3CMLConfig fr.dyade.aaa.agent.AgentServer.getAppConfig ( String[]  domains  )  throws Exception [static]

Gets configuration of agent servers for a domain from the current A3CMLConfig object. This method fills the object graph configuration in a A3CMLConfig object.

Parameters:
domains list of domain's names
Returns:
a A3CMLConfig object.

Definition at line 333 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.getConfig(), and fr.dyade.aaa.agent.conf.A3CMLConfig.getDomainConfig().

Here is the call graph for this function:

static short fr.dyade.aaa.agent.AgentServer.getServerIdByName ( String  name  )  throws Exception [static]

Returns the identifier of the agent server which name is specified.

Parameters:
name the name of the agent server
Returns:
the identifier of the agent server
Exceptions:
Exception if the server name is unknown.

Definition at line 358 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.getConfig(), and fr.dyade.aaa.agent.conf.A3CMLConfig.getServerIdByName().

Here is the call graph for this function:

static String fr.dyade.aaa.agent.AgentServer.getProperty ( String  key  )  [static]

Searches for the property with the specified key in the server property list.

Parameters:
key the hashtable key.
Returns:
the value with the specified key value.

Definition at line 369 of file AgentServer.java.

Referenced by fr.dyade.aaa.agent.AgentServer.init().

static String fr.dyade.aaa.agent.AgentServer.getProperty ( String  key,
String  value 
) [static]

Searches for the property with the specified key in the server property list.

Parameters:
key the hashtable key.
value a default value.
Returns:
the value with the specified key value.

Definition at line 381 of file AgentServer.java.

static Integer fr.dyade.aaa.agent.AgentServer.getInteger ( String  key  )  [static]

Determines the integer value of the server property with the specified name.

Parameters:
key property name.
Returns:
the Integer value of the property.

Definition at line 392 of file AgentServer.java.

static Integer fr.dyade.aaa.agent.AgentServer.getInteger ( String  key,
int  value 
) [static]

Determines the integer value of the server property with the specified name.

Parameters:
key property name.
value a default value.
Returns:
the Integer value of the property.

Definition at line 408 of file AgentServer.java.

static final int fr.dyade.aaa.agent.AgentServer.getServerNb (  )  [static, package]

Gets the number of server known on the current server.

Returns:
the number of server.

Definition at line 441 of file AgentServer.java.

References fr.dyade.aaa.agent.ServersHT.size().

Here is the call graph for this function:

static final ServerDesc fr.dyade.aaa.agent.AgentServer.getServerDesc ( short  sid  )  throws UnknownServerException [static, package]

Gets the characteristics of the corresponding server.

Parameters:
sid agent server id.
Returns:
the server's descriptor.

Definition at line 451 of file AgentServer.java.

References fr.dyade.aaa.agent.ServersHT.get().

Referenced by fr.dyade.aaa.agent.AgentServer.getConsumer(), fr.dyade.aaa.agent.AgentServer.getHostname(), fr.dyade.aaa.agent.AgentServer.getServices(), and fr.dyade.aaa.agent.AgentServer.init().

Here is the call graph for this function:

static final MessageConsumer fr.dyade.aaa.agent.AgentServer.getConsumer ( short  sid  )  throws UnknownServerException [static, package]

Gets the message consumer for the corresponding server.

Parameters:
sid agent server id.
Returns:
the corresponding message consumer.

Definition at line 464 of file AgentServer.java.

References fr.dyade.aaa.agent.ServerDesc.domain, and fr.dyade.aaa.agent.AgentServer.getServerDesc().

Here is the call graph for this function:

static final String fr.dyade.aaa.agent.AgentServer.getHostname ( short  sid  )  throws UnknownServerException [static]

Get the host name of an agent server.

Parameters:
sid agent server id
Returns:
server host name as declared in configuration file

Definition at line 474 of file AgentServer.java.

References fr.dyade.aaa.agent.ServerDesc.getHostname(), and fr.dyade.aaa.agent.AgentServer.getServerDesc().

Here is the call graph for this function:

static final ServiceDesc [] fr.dyade.aaa.agent.AgentServer.getServices (  )  throws UnknownServerException [static, package]

Get the description of all services of the current agent server.

Returns:
server host name as declared in configuration file

Definition at line 483 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.getServerDesc(), fr.dyade.aaa.agent.AgentServer.getServerId(), and fr.dyade.aaa.agent.ServerDesc.services.

Here is the call graph for this function:

static final String fr.dyade.aaa.agent.AgentServer.getServiceArgs ( short  sid,
String  classname 
) throws Exception [static]

Get the argument strings for a particular service. The information provides from the A3 configuration file, so it's only available if this file contains service's informations for all nodes.

See also:
A3CMLConfig.getServiceArgs(short,String)
Parameters:
sid agent server id
classname the service class name
Returns:
the arguments as declared in configuration file
Exceptions:
UnknownServerException The specified server does not exist.
UnknownServiceException The specified service is not declared on this server.
Exception Probably there is no configuration defined.

Definition at line 506 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.getConfig(), and fr.dyade.aaa.agent.conf.A3CMLConfig.getServiceArgs().

Here is the call graph for this function:

static final String fr.dyade.aaa.agent.AgentServer.getServiceArgs ( String  hostname,
String  classname 
) throws Exception [static]

Get the argument strings for a particular service running on a server identified by its host. The information provides from the A3 configuration file, so it's only available if this file contains service's informations for all nodes.

See also:
A3CMLConfig.getServiceArgs(String, String)
Parameters:
hostname hostname
classname the service class name
Returns:
the arguments as declared in configuration file
Exceptions:
UnknownServiceException The specified service is not declared on this server.
Exception Probably there is no configuration defined.

Definition at line 529 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.getConfig(), and fr.dyade.aaa.agent.conf.A3CMLConfig.getServiceArgsHost().

Here is the call graph for this function:

static int fr.dyade.aaa.agent.AgentServer.init ( String  args[]  )  throws Exception [static]

Parses agent server arguments, then initializes this agent server. The start function is then called to start this agent server execution. Between the init and start calls, agents may be created and deployed, and notifications may be sent using the Channel sendTo function.

Parameters:
args launching arguments, the first one is the server id and the second one the persistency directory.
Returns:
number of arguments consumed in args
Exceptions:
Exception unspecialized exception

Definition at line 796 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.NULL_ID.

Referenced by fr.dyade.aaa.agent.AgentServer.init(), and fr.dyade.aaa.agent.AgentServer.main().

static void fr.dyade.aaa.agent.AgentServer.reset (  )  [static]

Cleans an AgentServer configuration in order to restart it from persistent storage.

Definition at line 836 of file AgentServer.java.

References fr.dyade.aaa.util.Transaction.close(), fr.dyade.aaa.agent.AgentServer.getConsumers(), fr.dyade.aaa.agent.AgentServer.getName(), fr.dyade.aaa.agent.AgentServer.getStatusInfo(), fr.dyade.aaa.agent.AgentServer.status, and fr.dyade.aaa.agent.AgentServer.transaction.

Referenced by fr.dyade.aaa.agent.AgentServer.init(), and fr.dyade.aaa.agent.AgentServer.reset().

Here is the call graph for this function:

static void fr.dyade.aaa.agent.AgentServer.init ( short  sid,
String  path,
LoggerFactory  loggerFactory 
) throws Exception [static]

Initializes this agent server. start function is then called to start this agent server execution. Between the init and start calls, agents may be created and deployed, and notifications may be sent using the Channel sendTo function.

Parameters:
sid the server id
path the persistency directory.
loggerFactory the monolog LoggerFactory;
Exceptions:
Exception unspecialized exception

Definition at line 905 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.init(), and fr.dyade.aaa.agent.AgentServer.NULL_ID.

Here is the call graph for this function:

static void fr.dyade.aaa.agent.AgentServer.init ( short  sid,
String  path,
LoggerFactory  loggerFactory,
short  cid 
) throws Exception [static]

Initializes this agent server. start function is then called to start this agent server execution. Between the init and start calls, agents may be created and deployed, and notifications may be sent using the Channel sendTo function.

Parameters:
sid the server id
path the persistency directory.
loggerFactory the monolog LoggerFactory;
cid the cluster id
Exceptions:
Exception unspecialized exception

Definition at line 927 of file AgentServer.java.

References fr.dyade.aaa.agent.conf.A3CMLConfig.addDomain(), fr.dyade.aaa.agent.conf.A3CMLConfig.addServer(), fr.dyade.aaa.agent.conf.A3CMLDomain.addServer(), fr.dyade.aaa.agent.AgentServer.ADMIN_DOMAIN, fr.dyade.aaa.agent.AgentServer.ADMIN_SERVER, fr.dyade.aaa.util.Transaction.begin(), fr.dyade.aaa.util.Transaction.commit(), fr.dyade.aaa.agent.AgentServer.DEFAULT_SER_CFG_FILE, fr.dyade.aaa.agent.ServiceDesc.getArguments(), fr.dyade.aaa.agent.ServiceDesc.getClassName(), fr.dyade.aaa.agent.conf.A3CMLConfig.getConfig(), fr.dyade.aaa.util.Transaction.getList(), fr.dyade.aaa.agent.AgentServer.getName(), fr.dyade.aaa.agent.AgentServer.getProperty(), fr.dyade.aaa.agent.AgentServer.getServerDesc(), fr.dyade.aaa.agent.AgentServer.getStatusInfo(), fr.dyade.aaa.util.Transaction.init(), fr.dyade.aaa.agent.conf.A3CMLConfig.load(), fr.dyade.aaa.agent.conf.A3CMLServer.networks, fr.dyade.aaa.agent.AgentServer.NULL_ID, fr.dyade.aaa.agent.AgentServer.reset(), fr.dyade.aaa.agent.conf.A3CMLConfig.save(), fr.dyade.aaa.agent.conf.A3CMLServer.services, fr.dyade.aaa.agent.AgentServer.status, fr.dyade.aaa.agent.AgentServer.tgroup, and fr.dyade.aaa.agent.AgentServer.transaction.

Here is the call graph for this function:

static String fr.dyade.aaa.agent.AgentServer.start (  )  throws Exception [static]

Causes this AgentServer to begin its execution. This method starts all MessageConsumer (i.e. the engine and the network components).

Definition at line 1273 of file AgentServer.java.

References fr.dyade.aaa.util.Transaction.begin(), fr.dyade.aaa.util.Transaction.commit(), fr.dyade.aaa.agent.AgentServer.getName(), fr.dyade.aaa.agent.AgentServer.getStatusInfo(), fr.dyade.aaa.agent.AgentServer.status, and fr.dyade.aaa.agent.AgentServer.transaction.

Referenced by fr.dyade.aaa.agent.AgentServer.main().

Here is the call graph for this function:

static void fr.dyade.aaa.agent.AgentServer.stop ( boolean  sync  )  [static]

Forces this AgentServer to stop executing. This method stops all consumers and services. Be careful, if you specify a synchronous process, this method wait for all server's thread to terminate; so if this method is called from a server's thread it should result a dead-lock.

Parameters:
sync If true the stop is processed synchronously, otherwise a thread is created and the method returns.

Definition at line 1365 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.stop().

Here is the call graph for this function:

static void fr.dyade.aaa.agent.AgentServer.stop ( boolean  sync,
long  delay,
boolean  reset 
) [static]

Forces this AgentServer to stop executing. This method stops all consumers and services. Be careful, if you specify a synchronous process, this method wait for all server's thread to terminate; so if this method is called from a server's thread it should result a dead-lock.

Parameters:
sync If true the stop is processed synchronously, otherwise a thread is created and the method returns.
delay if sync is false then the thread in charge of stopping the server waits this delay before initiating the stop.
reset If true the server is stopped then reseted.

Definition at line 1383 of file AgentServer.java.

static void fr.dyade.aaa.agent.AgentServer.stop (  )  [static]

Forces this AgentServer to stop executing. This method stops all consumers and services. Be careful, the stop process is now synchronous and wait for all server's thread to terminate ; If this method is called from a server's thread it should result a dead-lock.

Definition at line 1424 of file AgentServer.java.

References fr.dyade.aaa.util.Timer.cancel(), fr.dyade.aaa.agent.AgentServer.getName(), fr.dyade.aaa.agent.AgentServer.getStatusInfo(), fr.dyade.aaa.agent.AgentServer.getThreadGroup(), fr.dyade.aaa.agent.AgentServer.status, fr.dyade.aaa.util.Transaction.stop(), and fr.dyade.aaa.agent.AgentServer.transaction.

Referenced by fr.dyade.aaa.agent.AgentServer.stop().

Here is the call graph for this function:

static void fr.dyade.aaa.agent.AgentServer.main ( String  args[]  )  throws Exception [static]

Main for a standard agent server. The start arguments include in first position the identifier of the agent server to start, and in second position the directory name where the agent server stores its persistent data.

Parameters:
args start arguments
Exceptions:
Exception unspecialized exception

Definition at line 1528 of file AgentServer.java.

References fr.dyade.aaa.agent.AgentServer.ENDSTRING, fr.dyade.aaa.agent.AgentServer.ERRORSTRING, fr.dyade.aaa.agent.AgentServer.getName(), fr.dyade.aaa.agent.AgentServer.init(), fr.dyade.aaa.agent.AgentServer.OKSTRING, and fr.dyade.aaa.agent.AgentServer.start().

Here is the call graph for this function:


Member Data Documentation

Engine fr.dyade.aaa.agent.AgentServer.engine = null [static, package]

Static reference to the engine. Used in Channel.sendTo to know if the method is called from a react or no.


AF: I think we must suppress this dependency in order to be able to run multiples engine.

Definition at line 180 of file AgentServer.java.

Referenced by fr.dyade.aaa.agent.AgentServer.getEngine().

Transaction fr.dyade.aaa.agent.AgentServer.transaction = null [static, package]

Static reference to the transactional monitor.

Definition at line 190 of file AgentServer.java.

Referenced by fr.dyade.aaa.agent.AgentServer.getTransaction(), fr.dyade.aaa.agent.AgentServer.init(), fr.dyade.aaa.agent.AgentServer.reset(), fr.dyade.aaa.agent.AgentServer.start(), and fr.dyade.aaa.agent.AgentServer.stop().


The documentation for this class was generated from the following file:
Generated on Tue Sep 16 16:16:18 2008 for joram by  doxygen 1.5.0