Class A3CMLConfig

    • Constructor Detail

      • A3CMLConfig

        public A3CMLConfig()
    • Method Detail

      • 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.
      • 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.
      • 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 property
        sid - 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.
      • 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 the Config object.
        Parameters:
        domainName - domain name
        Returns:
        the Config object 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 the Config object.
        Parameters:
        listDomainName - list of domain name
        Returns:
        the Config object if file exists and is correct, null otherwise.
        Throws:
        Exception - unspecialized exception when reading and parsing the configuration file
      • save

        public void save()
                  throws IOException
        save 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 a A3CMLConfig serialized object from file.
        Parameters:
        path - path of serialized configuration file
        Returns:
        the A3CMLConfig object 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 - hostname
        classname - the service class name
        Returns:
        the arguments as declared in configuration file
        Throws:
        Exception - The specified service is not declared on this server.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • reset

        public void reset()
        reset visited and gateway fields.