Package fr.dyade.aaa.agent.conf
Class A3CMLConfig
- java.lang.Object
-
- fr.dyade.aaa.agent.conf.A3CMLConfig
-
- All Implemented Interfaces:
Serializable
public class A3CMLConfig extends Object implements Serializable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description Hashtable<String,A3CMLDomain>domainsHashtable of all domainsHashtable<String,A3CMLProperty>propertiesHashtable of all global propertiesprivate static longserialVersionUIDdefine serialVersionUID for interoperabilityHashtable<Short,A3CMLServer>serversHashtable of all servers (persistent and transient)
-
Constructor Summary
Constructors Constructor Description A3CMLConfig()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddDomain(A3CMLDomain domain)Adds a domain.A3CMLPropertyaddProperty(A3CMLProperty prop)add propertyvoidaddServer(A3CMLServer server)Adds a server.voidconfigure(A3CMLServer root)Adapts the current configuration to the specified persistent server.booleancontainsDomain(String name)Returns true if it exists a domain with this name, false otherwise.booleancontainsProperty(String name)contains propertybooleancontainsServer(short sid)Returns true if the configuration contains a server with specified id.booleancontainsServer(String name)Returns true if the configuration contains a server with specified name.booleanequals(Object obj)static A3CMLConfiggetConfig(String path)Gets aA3CMLConfigserialized object from file.A3CMLDomaingetDomain(String name)Returns the description of a domain.A3CMLConfiggetDomainConfig(String domainName)Gets configuration of agent servers by a domain from a Config object.A3CMLConfiggetDomainConfig(String[] listDomainName)Gets configuration of agent servers by a list of domain from a Config object.StringgetJvmArgs(short sid)Get the JVM argument for a particular agent server identified by its id.StringgetJvmArgs(String name)Get the JVM argument for a particular agent server identified by its name.A3CMLPropertygetProperty(String name)Returns the specified property.A3CMLPropertygetProperty(String name, short sid)Returns the specified property.A3CMLServergetServer(short sid)Returns the description of a server.A3CMLServergetServer(String name)Returns the description of a server.shortgetServerIdByName(String name)Gets a server identifier from its name.StringgetServerNameById(short sid)Gets a server name from its identifier.StringgetServiceArgs(short sid, String classname)Get the argument strings for a particular service on a particular agent server identified by its id.StringgetServiceArgs(String name, String classname)Get the argument strings for a particular service on a particular agent server identified by its name.StringgetServiceArgsHost(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).inthashCode()static A3CMLConfigload()read object from a serialized file.A3CMLDomainremoveDomain(String name)Removes a domain.A3CMLPropertyremoveProperty(String name)remove propertyA3CMLServerremoveServer(short sid)Removes a server.A3CMLServerremoveServer(String name)Remove a server.voidreset()reset visited and gateway fields.voidsave()save configuration of agent servers (Config) in a serialized file.StringtoString()
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
define serialVersionUID for interoperability- See Also:
- Constant Field Values
-
domains
public Hashtable<String,A3CMLDomain> domains
Hashtable of all domains
-
servers
public Hashtable<Short,A3CMLServer> servers
Hashtable of all servers (persistent and transient)
-
properties
public Hashtable<String,A3CMLProperty> properties
Hashtable of all global properties
-
-
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(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(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(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(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(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.
-
getServerNameById
public String getServerNameById(short sid) throws UnknownServerException
Gets a server name from its identifier.- Parameters:
sid- The server identifier.- Returns:
- The server name.
- Throws:
UnknownServerException- If the server does not exist.
-
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.
-
getServer
public final A3CMLServer getServer(short sid) throws UnknownServerException
Returns the description of a server.- Parameters:
sid- The server identifier.- Returns:
- The server description if exist.
- Throws:
UnknownServerException- If the server does not exist.
-
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.
-
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.
- Throws:
Exception- an error occurs
-
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.
-
containsProperty
public final boolean containsProperty(String name)
contains property- Parameters:
name- property name- Returns:
- true if contain name; false otherwise.
-
getProperty
public final A3CMLProperty getProperty(String name)
Returns the specified property.- Parameters:
name- the name of property- Returns:
- the corresponding property
-
getProperty
public final A3CMLProperty getProperty(String name, short sid) throws Exception
Returns the specified property.- Parameters:
name- the name of propertysid- the server identifier- Returns:
- the corresponding property
- Throws:
Exception- the server is not defined
-
getJvmArgs
public final String getJvmArgs(short sid) throws UnknownServerException
Get the JVM argument for a particular agent server identified by its id.- Parameters:
sid- agent server identifier.- Returns:
- the arguments as declared in configuration file
- Throws:
UnknownServerException- The specified server does not exist.
-
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.
-
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.
-
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:
name- agent server name.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(A3CMLServer root) throws Exception
Adapts the current configuration to the specified persistent server.- Parameters:
root- the root server- Throws:
Exception- an error occurs
-
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 theConfigobject.- Parameters:
domainName- domain name- Returns:
- the
Configobject if file exists and is correct, null otherwise. - Throws:
Exception- unspecialized exception when reading and parsing the configuration file
-
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 theConfigobject.- Parameters:
listDomainName- list of domain name- Returns:
- the
Configobject if file exists and is correct, null otherwise. - Throws:
Exception- unspecialized exception when reading and parsing the configuration file
-
save
public void save() throws IOExceptionsave configuration of agent servers (Config) in a serialized file.- Throws:
IOException- an error occurs.
-
load
public static A3CMLConfig load() throws Exception
read object from a serialized file.- Returns:
- the loaded configuration object.
- Throws:
Exception- an error occurs.
-
getConfig
public static A3CMLConfig getConfig(String path) throws IOException
Gets aA3CMLConfigserialized object from file.- Parameters:
path- path of serialized configuration file- Returns:
- the
A3CMLConfigobject if file exists and is correct, null otherwise. - Throws:
IOException- an error occurs.
-
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- hostnameclassname- the service class name- Returns:
- the arguments as declared in configuration file
- Throws:
Exception- The specified service is not declared on this server.
-
reset
public void reset()
reset visited and gateway fields.
-
-