com.sun.faban.harness.common
Class HostRoles

java.lang.Object
  extended by com.sun.faban.harness.common.HostRoles

public class HostRoles
extends Object

The HostRoles class maintains the role - host - alias relationship.

Author:
Akara Sucharitakul

Constructor Summary
HostRoles(ParamRepository par)
          Constructs the HostRoles at benchmark run time from the benchmark parameter file and run information.
HostRoles(String fileName)
          Constructs the HostRoles after the benchmark run time.
 
Method Summary
 String[] getAliasesByHost(String host)
          Obtains all aliases or interface names used to refer to the host.
 String[] getAliasesByHostAndRole(String host, String role)
          Obtains the aliases that are used for a certain host in a certain function.
 String[] getAliasesByRole(String role)
          Obtains the host aliases used for a certain role or function in the benchmark run.
 String getHostByAlias(String alias)
          Obtains the real host name referred to by an alias.
 String[] getHostsByRole(String role)
          Obtains the hosts pertaining to a certain role or function in the benchmark run.
 String[] getHostsInOrder()
          Returns the list of hosts in the run in the order their aliases are referred to in the configuration file.
 String[] getRolesByAlias(String alias)
          Obtains the roles or function an interface or alias is used for.
 String[] getRolesByHost(String host)
          Obtains the function roles the host in question is used for.
 void write(Appendable b)
          Writes the HostRoles out to an appendable for later reading.
 void write(String fileName)
          Writes the HostRoles out to file for later reading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HostRoles

public HostRoles(ParamRepository par)
          throws ConfigurationException
Constructs the HostRoles at benchmark run time from the benchmark parameter file and run information.

Parameters:
par - The parameter repository/file
Throws:
ConfigurationException - If there is a configuration error

HostRoles

public HostRoles(String fileName)
          throws IOException
Constructs the HostRoles after the benchmark run time.

Parameters:
fileName - The file containing the stored HostRoles configuration
Throws:
IOException - Error reading the file or invalid file format
Method Detail

write

public void write(String fileName)
           throws IOException
Writes the HostRoles out to file for later reading.

Parameters:
fileName - The file name to store the information
Throws:
IOException - A write error occurred

write

public void write(Appendable b)
           throws IOException
Writes the HostRoles out to an appendable for later reading.

Parameters:
b - The appendable buffer.
Throws:
IOException - A write error occurred

getHostsInOrder

public String[] getHostsInOrder()
Returns the list of hosts in the run in the order their aliases are referred to in the configuration file.

Returns:
The host list

getHostsByRole

public String[] getHostsByRole(String role)
Obtains the hosts pertaining to a certain role or function in the benchmark run.

Parameters:
role - The role name.
Returns:
An array of host names used for the role in question.

getAliasesByRole

public String[] getAliasesByRole(String role)
Obtains the host aliases used for a certain role or function in the benchmark run. The alias is usually an interface name used to refer to a host.

Parameters:
role - The role name.
Returns:
An array of aliases used for the role in question

getRolesByHost

public String[] getRolesByHost(String host)
Obtains the function roles the host in question is used for.

Parameters:
host - The host name
Returns:
An array of role names the host is used for

getAliasesByHost

public String[] getAliasesByHost(String host)
Obtains all aliases or interface names used to refer to the host.

Parameters:
host - The host name
Returns:
An array of aliases used to refer to this host.

getAliasesByHostAndRole

public String[] getAliasesByHostAndRole(String host,
                                        String role)
Obtains the aliases that are used for a certain host in a certain function.

Parameters:
host - The host name
role - The role name
Returns:
An array of applicable aliases

getHostByAlias

public String getHostByAlias(String alias)
Obtains the real host name referred to by an alias.

Parameters:
alias - The alias name
Returns:
The real host name

getRolesByAlias

public String[] getRolesByAlias(String alias)
Obtains the roles or function an interface or alias is used for.

Parameters:
alias - The alias name
Returns:
An array of function roles the alias is used for.