fr.dyade.aaa.agent.conf

Class A3CMLConfig

Implemented Interfaces:
Serializable

public class A3CMLConfig
extends java.lang.Object
implements Serializable

Field Summary

Hashtable
domains
Hashtable of all domains
Hashtable
properties
Hashtable of all global properties
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(String name)
Returns true if it exists a domain with this name, false otherwise.
boolean
containsProperty(String name)
contains property
boolean
containsServer(String name)
Returns true if the configuration contains a server with specified name.
boolean
containsServer(short sid)
Returns true if the configuration contains a server with specified id.
boolean
equals(Object obj)
static A3CMLConfig
getConfig(String path)
Gets a A3CMLConfig serialialized object from file.
A3CMLDomain
getDomain(String name)
Returns the description of a domain.
A3CMLConfig
getDomainConfig(String domainName)
Gets configuration of agent servers by a domain from a Config object.
A3CMLConfig
getDomainConfig(String[] listDomainName)
Gets configuration of agent servers by a list of domain from a Config object.
String
getJvmArgs(String name)
Get the JVM argument for a particular agent server identified by its name.
String
getJvmArgs(short sid)
Get the JVM argument for a particular agent server identified by its id.
A3CMLProperty
getProperty(String name)
Returns the specified property.
A3CMLServer
getServer(String name)
Returns the description of a server.
A3CMLServer
getServer(short sid)
Returns the description of a server.
short
getServerIdByName(String name)
Gets a server identifier from its name.
String
getServiceArgs(String name, String classname)
Get the argument strings for a particular service on a particular agent server identified by its name.
String
getServiceArgs(short sid, String classname)
Get the argument strings for a particular service on a particular agent server identified by its id.
String
getServiceArgsHost(String hostname, 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(String name)
Removes a domain.
A3CMLProperty
removeProperty(String name)
remove property
A3CMLServer
removeServer(String name)
Remove a server.
A3CMLServer
removeServer(short sid)
Removes a server.
void
reset()
reset visited and gateway fields.
void
save()
save configuration of agent servers (Config) in a serialized file.
String
toString()

Field Details

domains

public Hashtable domains
Hashtable of all domains


properties

public Hashtable properties
Hashtable of all global properties


servers

public Hashtable servers
Hashtable of all servers (persitent and transient)

Constructor Details

A3CMLConfig

public A3CMLConfig()

Method Details

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.


addProperty

public final A3CMLProperty addProperty(A3CMLProperty prop)
            throws 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.


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.


configure

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


containsDomain

public final boolean containsDomain(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.


containsProperty

public final boolean containsProperty(String name)
contains property

Parameters:
name - property name

Returns:
true if contain name; false otherwise.


containsServer

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

Parameters:
name - server name

Returns:
true if contain name; false otherwise.


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.


equals

public boolean equals(Object obj)


getConfig

public static A3CMLConfig getConfig(String path)
            throws 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.


getDomain

public final A3CMLDomain getDomain(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.


getDomainConfig

public A3CMLConfig getDomainConfig(String domainName)
            throws 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.


getDomainConfig

public A3CMLConfig getDomainConfig(String[] listDomainName)
            throws 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.

Parameters:

Returns:
the Config object if file exists and is correct, null otherwise.


getJvmArgs

public final String getJvmArgs(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.


getJvmArgs

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

Parameters:

Returns:
the arguments as declared in configuration file

Throws:
UnknownServerException - The specified server does not exist.


getProperty

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


getServer

public final A3CMLServer getServer(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.


getServer

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

Parameters:

Returns:
The server description if exist.

Throws:
UnknownServerException - If the server does not exist.


getServerIdByName

public short getServerIdByName(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.


getServiceArgs

public final String getServiceArgs(String name,
                                   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.


getServiceArgs

public final String getServiceArgs(short sid,
                                   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.


getServiceArgsHost

public final String getServiceArgsHost(String hostname,
                                       String classname)
            throws 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


load

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

Parameters:


removeDomain

public final A3CMLDomain removeDomain(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.


removeProperty

public final A3CMLProperty removeProperty(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.


removeServer

public final A3CMLServer removeServer(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.


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.


reset

public void reset()
reset visited and gateway fields.


save

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

See Also:
AgentServer.DEFAULT_SER_CFG_FILE


toString

public String toString()


Copyright B) 2004 Scalagent - All rights reserved