jp.go.aist.rtm.RTC
Class ManagerConfig

java.lang.Object
  extended by jp.go.aist.rtm.RTC.ManagerConfig

 class ManagerConfig
extends java.lang.Object

Modify Manager's configuration.

This class receives the command line arguments and will be instantiated. Set property information of Manager with the configuration file specified by the command line argument or the environment variable etc. The priorities of each configuration are as follows:

  1. Command option "-f"
  2. Environment variable "RTC_MANAGER_CONFIG"
  3. Default configuration file "./rtc.conf"
  4. Default configuration file "/etc/rtc.conf"
  5. Default configuration file "/etc/rtc/rtc.conf"
  6. Default configuration file "/usr/local/etc/rtc.conf"
  7. Default configuration file "/usr/local/etc/rtc/rtc.conf"
  8. Embedded configuration value
If the command option "-d" is specified (even if specify configuration file by "-f" option), the embedded configuration values will be used.


Field Summary
static java.lang.String CONFIG_FILE_ENV
           The environment variable to distinguish the default configuration file path
static java.lang.String[] CONFIG_FILE_PATH
           The default configuration file path for manager
protected  Properties m_argprop
           configuration properties from arguments
protected  java.lang.String m_configFile
           Manager's configuration file path
protected  boolean m_isMaster
           Manager master flag true:master,false:slave
 
Constructor Summary
ManagerConfig()
           Constructor
ManagerConfig(java.lang.String[] args)
           Constructor
 
Method Summary
 void configure(Properties properties)
           Specify the configuration information to the Property
protected  boolean fileExist(java.lang.String filePath)
           Check the file existence
protected  boolean findConfigFile()
           Find the configuration file
 void init(java.lang.String[] args)
           Initialization
protected  void parseArgs(java.lang.String[] args)
           Parse the command arguments
protected  void setSystemInformation(Properties properties)
           Set system information
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_FILE_PATH

public static final java.lang.String[] CONFIG_FILE_PATH
The default configuration file path for manager


CONFIG_FILE_ENV

public static final java.lang.String CONFIG_FILE_ENV
The environment variable to distinguish the default configuration file path

See Also:
Constant Field Values

m_configFile

protected java.lang.String m_configFile
Manager's configuration file path


m_isMaster

protected boolean m_isMaster
Manager master flag true:master,false:slave


m_argprop

protected Properties m_argprop
configuration properties from arguments

Constructor Detail

ManagerConfig

public ManagerConfig()
Constructor


ManagerConfig

public ManagerConfig(java.lang.String[] args)
              throws java.lang.Exception
Constructor

Initialize configuration information by given arguments.

Parameters:
args - The command line arguments
Throws:
java.lang.Exception
Method Detail

init

public void init(java.lang.String[] args)
          throws java.lang.Exception
Initialization

Initialize with command line options. The following command options are available.

Parameters:
args - The command line arguments
Throws:
java.lang.Exception

configure

public void configure(Properties properties)
               throws java.io.FileNotFoundException,
                      java.io.IOException
Specify the configuration information to the Property

Configure to the properties specified by Manager's configuration

Parameters:
properties - The target properties to configure
Throws:
java.io.IOException
java.io.FileNotFoundException

parseArgs

protected void parseArgs(java.lang.String[] args)
                  throws java.lang.IllegalArgumentException
Parse the command arguments

Parameters:
args - The command line arguments
Throws:
java.lang.IllegalArgumentException

findConfigFile

protected boolean findConfigFile()
Find the configuration file

Find the configuration file and configure it. Confirm the file existence when the configuration file has already configured. The configuration file is retrieved in the following order.

  1. The command line option -f
  2. The environment variable RTC_MANAGER_CONFIG
  3. Default configuration file ./rtc.conf
  4. Default configuration file /etc/rtc.conf
  5. Default configuration file /etc/rtc/rtc.conf
  6. Default configuration file /usr/local/etc/rtc.conf
  7. Default configuration file /usr/local/etc/rtc/rtc.conf

Returns:
  • When the configuration file is the unspecific: True is returned when the configuration file can be retrieved and, otherwise, false is returned.
  • When the configuration file is a specific settlement: If the configuration file exists, true is returned and, otherwise, false is returned.

setSystemInformation

protected void setSystemInformation(Properties properties)
Set system information

Get the following system info. and set them to Manager's properties.

Parameters:
properties - Properties to set system information

fileExist

protected boolean fileExist(java.lang.String filePath)
Check the file existence

Confirm whether the specified file exists

Parameters:
filePath - The target confirmation file
Returns:
file existance confirmation (True if the file exists.)