|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfr.dyade.aaa.agent.AgentServer
public final class AgentServer
The AgentServer
class manages the global configuration
of an agent server. It reads the configuration file, then it creates
and configure
,
Engine
,
Channel
.
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.
Network
s
The configuration file contains a config
element, that
is essentially made up of domain
s elements, and servers
(server
s elements):
Network
implementation (class SimpleNetwork
by default).
hostname
attribute describes the name or the IP address of this node)
network
element with attributes
giving the domain's name (domain
attribute) and the
communication port (port
attribute).
service
element describing it.
config
element or in a server one.
<?xml version="1.0"?> <!DOCTYPE config SYSTEM "a3config.dtd"> <config> <domain name="D1"/> <domain name="D2" class="fr.dyade.aaa.agent.PoolNetwork"/> <property name="D2.nbMaxCnx" value="1"/> <server id="0" name="S0" hostname="acores"> <network domain="D1" port="16300"/> <service class="fr.dyade.aaa.agent.AdminProxy" args="8090"/> <property name="A3DEBUG_PROXY" value="true"/> </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>
This file described a 2 domains configuration D1 and D2, D1 with default
network protocol and D2 with the PoolNetwork
one, and 4
servers:
Engine
,
Channel
,
Network
,
MessageQueue
,
Transaction
Nested Class Summary | |
---|---|
static class |
AgentServer.Status
|
Field Summary | |
---|---|
static java.lang.String |
A3CMLWRP_PROPERTY
Name of property allowing to configure the XML wrapper used to read the server configuration. |
static java.lang.String |
ADMIN_DOMAIN
|
static java.lang.String |
ADMIN_SERVER
|
static java.lang.String |
CFG_DIR_PROPERTY
Name of property allowing to configure the directory to search the XML server configuration. |
static java.lang.String |
CFG_FILE_PROPERTY
Name of property allowing to configure the filename of the XML server configuration. |
static java.lang.String |
CFG_NAME_PROPERTY
|
static java.lang.String |
DEFAULT_A3CMLWRP
Default value of the XML wrapper used to read server configuration, this default value implies the use of the default SaxWrapper. |
static java.lang.String |
DEFAULT_CFG_DIR
Default value of the directory to search the XML server configuration, value is null. |
static java.lang.String |
DEFAULT_CFG_FILE
Default value of the filename of the XML server configuration, value is a3servers.xml . |
static java.lang.String |
DEFAULT_CFG_NAME
|
static java.lang.String |
DEFAULT_SER_CFG_FILE
Default value of the filename of the serialized server configuration in the persistence directory, value is a3cmlconfig . |
static java.lang.String |
ENDSTRING
|
static java.lang.String |
ERRORSTRING
|
static short |
NULL_ID
|
static java.lang.String |
OKSTRING
|
Constructor Summary | |
---|---|
AgentServer()
|
Method Summary | |
---|---|
static void |
addConsumer(java.lang.String domain,
MessageConsumer cons)
|
static void |
addServerDesc(ServerDesc desc)
|
static java.util.Enumeration |
elementsServerDesc()
|
static A3CMLConfig |
getAppConfig(java.lang.String[] domains)
Gets configuration of agent servers for a domain from the current A3CMLConfig object. |
static boolean |
getBoolean(java.lang.String key)
Determines the boolean value of the server property with the specified name. |
static short |
getClusterId()
|
static A3CMLConfig |
getConfig()
Returns the agent server configuration. |
static fr.dyade.aaa.agent.Engine |
getEngine()
Returns the agent server engine. |
static float |
getEngineAverageLoad1()
Returns the load averages for the last minute. |
static float |
getEngineAverageLoad15()
Returns the load averages for the past 15 minutes. |
static float |
getEngineAverageLoad5()
Returns the load averages for the past 5 minutes. |
static java.lang.String |
getHostname(short sid)
Get the host name of an agent server. |
static java.lang.Integer |
getInteger(java.lang.String key)
Determines the integer value of the server property with the specified name. |
static java.lang.Integer |
getInteger(java.lang.String key,
int value)
Determines the integer value of the server property with the specified name. |
static java.lang.Long |
getLong(java.lang.String key)
Determines the integer value of the server property with the specified name. |
static java.lang.Long |
getLong(java.lang.String key,
long value)
Determines the long value of the server property with the specified name. |
static java.lang.String |
getName()
|
static java.lang.String |
getProperty(java.lang.String key)
Searches for the property with the specified key in the server property list. |
static java.lang.String |
getProperty(java.lang.String key,
java.lang.String value)
Searches for the property with the specified key in the server property list. |
static ServerDesc |
getServerDesc(short sid)
Gets the characteristics of the corresponding server. |
static short |
getServerId()
|
static short |
getServerIdByName(java.lang.String name)
Returns the identifier of the agent server which name is specified. |
static java.lang.String |
getServerName()
|
static java.util.Enumeration |
getServersIds()
|
static java.lang.String |
getServiceArgs(short sid,
java.lang.String classname)
Get the argument strings for a particular service. |
static java.lang.String |
getServiceArgs(java.lang.String hostname,
java.lang.String classname)
Get the argument strings for a particular service running on a server identified by its host. |
static int |
getStatus()
|
static java.lang.String |
getStatusInfo()
|
static java.lang.ThreadGroup |
getThreadGroup()
|
static java.util.Timer |
getTimer()
Returns a shared timer provided by the agent server. |
static Transaction |
getTransaction()
Returns the agent server transaction context. |
static void |
init(short sid,
java.lang.String path,
org.objectweb.util.monolog.api.LoggerFactory loggerFactory)
Initializes this agent server. |
static void |
init(short sid,
java.lang.String path,
org.objectweb.util.monolog.api.LoggerFactory loggerFactory,
short cid)
Initializes this agent server. |
static int |
init(java.lang.String[] args)
Parses agent server arguments, then initializes this agent server. |
static void |
initServerDesc(ServerDesc desc,
A3CMLServer server)
|
static boolean |
isHAServer()
Test HA server. |
static boolean |
isMasterHAServer()
Test if the server is a master (coordinator). |
static void |
main(java.lang.String[] args)
Main for a standard agent server. |
static ServerDesc |
removeServerDesc(short sid)
|
static void |
reset()
Cleans an AgentServer configuration in order to restart it from persistent storage. |
static void |
reset(boolean force)
|
static void |
setConfig(A3CMLConfig a3config)
Set the agent server configuration. |
static void |
setConfig(A3CMLConfig a3config,
boolean force)
|
static java.lang.String |
start()
Causes this AgentServer to begin its execution. |
static void |
stop()
Forces this AgentServer to stop executing. |
static void |
stop(boolean sync)
Forces this AgentServer to stop executing. |
static void |
stop(boolean sync,
long delay,
boolean reset)
Forces this AgentServer to stop executing. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final short NULL_ID
public static final java.lang.String ADMIN_DOMAIN
public static final java.lang.String ADMIN_SERVER
public static final java.lang.String CFG_DIR_PROPERTY
Be careful, the XML server configuration file is normally used only for the initial starting of the server, the configuration is then atomically maintained in the persistence directory.
This property can only be fixed either from java
launching
command.
public static final java.lang.String DEFAULT_CFG_DIR
public static final java.lang.String CFG_FILE_PROPERTY
Be careful, the XML server configuration file is normally used only for the initial starting of the server, the configuration is then atomically maintained in the persistence directory.
This property can only be fixed either from java
launching
command.
public static final java.lang.String DEFAULT_CFG_FILE
a3servers.xml
.
public static final java.lang.String DEFAULT_SER_CFG_FILE
a3cmlconfig
.
Removing this file allows to load anew the XML configuration file at the next starting of the server. Be careful, doing this can generate incoherence in the global configuration.
public static final java.lang.String CFG_NAME_PROPERTY
public static final java.lang.String DEFAULT_CFG_NAME
public static final java.lang.String A3CMLWRP_PROPERTY
This property can only be fixed either from java
launching
command.
public static final java.lang.String DEFAULT_A3CMLWRP
public static final java.lang.String OKSTRING
public static final java.lang.String ERRORSTRING
public static final java.lang.String ENDSTRING
Constructor Detail |
---|
public AgentServer()
Method Detail |
---|
public static java.lang.ThreadGroup getThreadGroup()
public static fr.dyade.aaa.agent.Engine getEngine()
public static float getEngineAverageLoad1()
public static float getEngineAverageLoad5()
public static float getEngineAverageLoad15()
public static Transaction getTransaction()
public static boolean isHAServer()
public static boolean isMasterHAServer()
public static void addConsumer(java.lang.String domain, MessageConsumer cons) throws java.lang.Exception
java.lang.Exception
public static final java.util.Timer getTimer()
public static final void setConfig(A3CMLConfig a3config) throws java.lang.Exception
a3config
- A3CMLConfig
java.lang.Exception
- Server is already initialized.public static final void setConfig(A3CMLConfig a3config, boolean force) throws java.lang.Exception
java.lang.Exception
public static final A3CMLConfig getConfig() throws java.lang.Exception
java.lang.Exception
public static A3CMLConfig getAppConfig(java.lang.String[] domains) throws java.lang.Exception
A3CMLConfig
object.
domains
- list of domain's names
A3CMLConfig
object.
java.lang.Exception
public static final short getServerId()
public static final short getClusterId()
public static final java.lang.String getName()
public static final java.lang.String getServerName()
public static short getServerIdByName(java.lang.String name) throws java.lang.Exception
name
- the name of the agent server
java.lang.Exception
- if the server name is unknown.public static java.lang.String getProperty(java.lang.String key)
key
- the hashtable key.
public static java.lang.String getProperty(java.lang.String key, java.lang.String value)
key
- the hashtable key.value
- a default value.
public static java.lang.Integer getInteger(java.lang.String key)
key
- property name.
public static java.lang.Integer getInteger(java.lang.String key, int value)
key
- property name.value
- a default value.
public static java.lang.Long getLong(java.lang.String key)
key
- property name.
public static java.lang.Long getLong(java.lang.String key, long value)
key
- property name.value
- a default value.
public static boolean getBoolean(java.lang.String key)
key
- property name.value
- a default value.
public static void addServerDesc(ServerDesc desc) throws java.lang.Exception
java.lang.Exception
public static ServerDesc removeServerDesc(short sid) throws java.lang.Exception
java.lang.Exception
public static java.util.Enumeration elementsServerDesc()
public static java.util.Enumeration getServersIds()
public static final ServerDesc getServerDesc(short sid) throws UnknownServerException
sid
- agent server id.
UnknownServerException
public static final java.lang.String getHostname(short sid) throws UnknownServerException
sid
- agent server id
UnknownServerException
public static final java.lang.String getServiceArgs(short sid, java.lang.String classname) throws java.lang.Exception
sid
- agent server idclassname
- the service class name
UnknownServerException
- The specified server does not exist.
UnknownServiceException
- The specified service is not declared on this server.
java.lang.Exception
- Probably there is no configuration defined.A3CMLConfig.getServiceArgs(short,String)
public static final java.lang.String getServiceArgs(java.lang.String hostname, java.lang.String classname) throws java.lang.Exception
hostname
- hostnameclassname
- the service class name
UnknownServiceException
- The specified service is not declared on this server.
java.lang.Exception
- Probably there is no configuration defined.A3CMLConfig.getServiceArgs(String, String)
public static void initServerDesc(ServerDesc desc, A3CMLServer server) throws java.lang.Exception
java.lang.Exception
public static int getStatus()
public static java.lang.String getStatusInfo()
public static int init(java.lang.String[] args) throws java.lang.Exception
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.
args
- launching arguments, the first one is the server id
and the second one the persistency directory.
java.lang.Exception
- unspecialized exceptionpublic static void reset(boolean force)
public static void reset()
public static void init(short sid, java.lang.String path, org.objectweb.util.monolog.api.LoggerFactory loggerFactory) throws java.lang.Exception
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.
sid
- the server idpath
- the persistency directory.loggerFactory
- the monolog LoggerFactory;
java.lang.Exception
- unspecialized exceptionpublic static void init(short sid, java.lang.String path, org.objectweb.util.monolog.api.LoggerFactory loggerFactory, short cid) throws java.lang.Exception
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.
sid
- the server idpath
- the persistency directory.loggerFactory
- the monolog LoggerFactory;cid
- the cluster id
java.lang.Exception
- unspecialized exceptionpublic static java.lang.String start() throws java.lang.Exception
MessageConsumer
(i.e. the engine and the network components).
java.lang.Exception
public static void stop(boolean sync)
sync
- If true the stop is processed synchronously, otherwise
a thread is created and the method returns.public static void stop(boolean sync, long delay, boolean reset)
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.public static void stop()
public static void main(java.lang.String[] args) throws java.lang.Exception
args
- start arguments
java.lang.Exception
- unspecialized exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |