fr.dyade.aaa.agent.conf
Class A3CMLConfig

java.lang.Object
  extended byfr.dyade.aaa.agent.conf.A3CMLConfig
All Implemented Interfaces:
java.io.Serializable

public class A3CMLConfig
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
 java.util.Hashtable domains
          Hashtable of all domains
 java.util.Hashtable properties
          Hashtable of all global properties
 java.util.Hashtable servers
          Hashtable of all servers (persitent and transient)
 
Constructor Summary
A3CMLConfig()
           
 
Method Summary
 void addDomain(A3CMLDomain domain)
          Adds a domain.
 A3CMLProperty addProperty(A3CMLProperty prop)
          add property
 void addServer(A3CMLServer server)
          Adds a server.
 void configure(A3CMLPServer root)
          Adapts the current configuration to the specified persistent server.
 boolean containsDomain(java.lang.String name)
          Returns true if it exists a domain with this name, false otherwise.
 boolean containsProperty(java.lang.String name)
          contains property
 boolean containsServer(short sid)
          Returns true if the configuration contains a server with specified id.
 boolean containsServer(java.lang.String name)
          Returns true if the configuration contains a server with specified name.
 boolean equals(java.lang.Object obj)
           
static A3CMLConfig getConfig(java.lang.String path)
          Gets a A3CMLConfig serialialized object from file.
 A3CMLDomain getDomain(java.lang.String name)
          Returns the description of a domain.
 A3CMLConfig getDomainConfig(java.lang.String domainName)
          Gets configuration of agent servers by a domain from a Config object.
 A3CMLConfig getDomainConfig(java.lang.String[] listDomainName)
          Gets configuration of agent servers by a list of domain from a Config object.
 java.lang.String getJvmArgs(short sid)
          Get the JVM argument for a particular agent server identified by its id.
 java.lang.String getJvmArgs(java.lang.String name)
          Get the JVM argument for a particular agent server identified by its name.
 A3CMLProperty getProperty(java.lang.String name)
          Returns the specified property.
 A3CMLServer getServer(short sid)
          Returns the description of a server.
 A3CMLServer getServer(java.lang.String name)
          Returns the description of a server.
 short getServerIdByName(java.lang.String name)
          Gets a server identifier from its name.
 java.lang.String getServiceArgs(short sid, java.lang.String classname)
          Get the argument strings for a particular service on a particular agent server identified by its id.
 java.lang.String getServiceArgs(java.lang.String name, java.lang.String classname)
          Get the argument strings for a particular service on a particular agent server identified by its name.
 java.lang.String getServiceArgsHost(java.lang.String hostname, java.lang.String classname)
          Gets the argument strings for a particular service running on a server identified by its host (searchs on all servers and associated transient).
static A3CMLConfig load()
          read object from a serialized file, in cfgDir if null, search object in path used to load classes
 A3CMLDomain removeDomain(java.lang.String name)
          Removes a domain.
 A3CMLProperty removeProperty(java.lang.String name)
          remove property
 A3CMLServer removeServer(short sid)
          Removes a server.
 A3CMLServer removeServer(java.lang.String name)
          Remove a server.
 void reset()
          reset visited and gateway fields.
 void save()
          save configuration of agent servers (Config) in a serialized file.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

domains

public java.util.Hashtable domains
Hashtable of all domains


servers

public java.util.Hashtable servers
Hashtable of all servers (persitent and transient)


properties

public java.util.Hashtable properties
Hashtable of all global properties

Constructor Detail

A3CMLConfig

public A3CMLConfig()
Method Detail

addDomain

public final void addDomain(A3CMLDomain domain)
                     throws DuplicateDomainException
Adds a domain.

Parameters:
domain - The description of added domain.
Throws:
DuplicateDomainException - If the domain already exist.

removeDomain

public final A3CMLDomain removeDomain(java.lang.String name)
                               throws UnknownDomainException
Removes a domain.

Parameters:
name - The domain name.
Returns:
The domain description if exist.
Throws:
UnknownDomainException - If the domain don't exist.

containsDomain

public final boolean containsDomain(java.lang.String name)
Returns true if it exists a domain with this name, false otherwise.

Parameters:
name - The domain name.
Returns:
True if the domain is declared, false otherwise.

getDomain

public final A3CMLDomain getDomain(java.lang.String name)
                            throws UnknownDomainException
Returns the description of a domain.

Parameters:
name - The domain name.
Returns:
The domain description if exist.
Throws:
UnknownDomainException - If the domain don't exist.

addServer

public final void addServer(A3CMLServer server)
                     throws DuplicateServerException
Adds a server.

Parameters:
server - The description of added server.
Throws:
DuplicateServerException - If the server already exist.

removeServer

public final A3CMLServer removeServer(short sid)
                               throws UnknownServerException
Removes a server.

Parameters:
sid - The unique server identifier.
Returns:
The server description if exists.
Throws:
UnknownServerException - If the server does not exist.

removeServer

public final A3CMLServer removeServer(java.lang.String name)
                               throws UnknownServerException
Remove a server.

Parameters:
name - The server name.
Returns:
The server description if exists.
Throws:
UnknownServerException - If the server does not exist.

containsServer

public final boolean containsServer(short sid)
Returns true if the configuration contains a server with specified id.

Parameters:
sid - server id
Returns:
true if contain sid; false otherwise.

getServerIdByName

public short getServerIdByName(java.lang.String name)
                        throws UnknownServerException
Gets a server identifier from its name.

Parameters:
name - The server name.
Returns:
The server identifier.
Throws:
UnknownServerException - If the server does not exist.

containsServer

public final boolean containsServer(java.lang.String name)
Returns true if the configuration contains a server with specified name.

Parameters:
name - server name
Returns:
true if contain name; false otherwise.

getServer

public final A3CMLServer getServer(short sid)
                            throws UnknownServerException
Returns the description of a server.

Returns:
The server description if exist.
Throws:
UnknownServerException - If the server does not exist.

getServer

public final A3CMLServer getServer(java.lang.String name)
                            throws UnknownServerException
Returns the description of a server.

Parameters:
name - The server name.
Returns:
The server description if exist.
Throws:
UnknownServerException - If the server does not exist.

addProperty

public final A3CMLProperty addProperty(A3CMLProperty prop)
                                throws java.lang.Exception
add property

Parameters:
prop - A3CMLProperty
Returns:
the previous value of the specified prop.name in this hashtable, or null if it did not have one.
Throws:
java.lang.Exception

removeProperty

public final A3CMLProperty removeProperty(java.lang.String name)
remove property

Parameters:
name - property name
Returns:
the value to which the name had been mapped in this hashtable, or null if the name did not have a mapping.

containsProperty

public final boolean containsProperty(java.lang.String name)
contains property

Parameters:
name - property name
Returns:
true if contain name; false otherwise.

getProperty

public final A3CMLProperty getProperty(java.lang.String name)
Returns the specified property.


getJvmArgs

public final java.lang.String getJvmArgs(short sid)
                                  throws UnknownServerException
Get the JVM argument for a particular agent server identified by its id.

Returns:
the arguments as declared in configuration file
Throws:
UnknownServerException - The specified server does not exist.

getJvmArgs

public final java.lang.String getJvmArgs(java.lang.String name)
                                  throws UnknownServerException
Get the JVM argument for a particular agent server identified by its name.

Parameters:
name - agent server name.
Returns:
the arguments as declared in configuration file
Throws:
UnknownServerException - The specified server does not exist.

getServiceArgs

public final java.lang.String getServiceArgs(short sid,
                                             java.lang.String classname)
                                      throws UnknownServerException,
                                             UnknownServiceException
Get the argument strings for a particular service on a particular agent server identified by its id.

Parameters:
sid - agent server id.
classname - the service class name.
Returns:
the arguments as declared.
Throws:
UnknownServerException - The specified server does not exist.
UnknownServiceException - The specified service is not declared on this server.

getServiceArgs

public final java.lang.String getServiceArgs(java.lang.String name,
                                             java.lang.String classname)
                                      throws UnknownServerException,
                                             UnknownServiceException
Get the argument strings for a particular service on a particular agent server identified by its name.

Parameters:
classname - the service class name.
Returns:
the arguments as declared.
Throws:
UnknownServerException - The specified server does not exist.
UnknownServiceException - The specified service is not declared on this server.

configure

public void configure(A3CMLPServer root)
               throws java.lang.Exception
Adapts the current configuration to the specified persistent server.

Throws:
java.lang.Exception

getDomainConfig

public A3CMLConfig getDomainConfig(java.lang.String domainName)
                            throws java.lang.Exception
Gets configuration of agent servers by a domain from a Config object. This method fills the object graph configuration in the Config object.

Parameters:
domainName - domain name
Returns:
the Config object if file exists and is correct, null otherwise.
Throws:
java.lang.Exception - unspecialized exception when reading and parsing the configuration file

getDomainConfig

public A3CMLConfig getDomainConfig(java.lang.String[] listDomainName)
                            throws java.lang.Exception
Gets configuration of agent servers by a list of domain from a Config object. This method fills the object graph configuration in the Config object.

Returns:
the Config object if file exists and is correct, null otherwise.
Throws:
java.lang.Exception - unspecialized exception when reading and parsing the configuration file

save

public void save()
          throws java.io.IOException
save configuration of agent servers (Config) in a serialized file.

Throws:
java.io.IOException
See Also:
AgentServer.DEFAULT_SER_CFG_FILE

load

public static A3CMLConfig load()
                        throws java.lang.Exception
read object from a serialized file, in cfgDir if null, search object in path used to load classes

Throws:
java.lang.Exception

getConfig

public static A3CMLConfig getConfig(java.lang.String path)
                             throws java.lang.Exception
Gets a A3CMLConfig serialialized object from file.

Parameters:
path - path of serialized configuration file
Returns:
the A3CMLConfig object if file exists and is correct, null otherwise.
Throws:
java.lang.Exception - unspecialized exception when reading and parsing the configuration file

toString

public java.lang.String toString()

getServiceArgsHost

public final java.lang.String getServiceArgsHost(java.lang.String hostname,
                                                 java.lang.String classname)
                                          throws java.lang.Exception
Gets the argument strings for a particular service running on a server identified by its host (searchs on all servers and associated transient).

Parameters:
hostname - hostname
Returns:
the arguments as declared in configuration file
Throws:
UnknownServiceException - The specified service is not declared on this server.
java.lang.Exception

equals

public boolean equals(java.lang.Object obj)

reset

public void reset()
reset visited and gateway fields.



Copyright ? 2004 Scalagent - All rights reserved