MySnmpCrawler API

snmp.lib
Class Configurator

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--java.util.Properties
                    |
                    +--snmp.lib.Configurator
All Implemented Interfaces:
java.lang.Cloneable, java.util.Map, java.io.Serializable

public class Configurator
extends java.util.Properties

This class reads the configuration file and provides the configuration data to the system.

Version:
$Revision: 0.1 $ $Date: 2004/03/09 06:03:48 $
Author:
Scott Cheng
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.util.Hashtable
 
Nested classes inherited from class java.util.Map
java.util.Map.Entry
 
Field Summary
private  java.lang.String[] arrayClassNames
           
private  java.lang.String configFile
           
private static Configurator instance
           
private  java.util.ArrayList mbeanClassNameList
           
 
Fields inherited from class java.util.Properties
defaults
 
Fields inherited from class java.util.Hashtable
 
Constructor Summary
private Configurator(java.lang.String configFile)
          Constructs the Configurator with the passed config file name.
 
Method Summary
static Configurator create(java.lang.String configFile)
          Creates the Configurator with the passed config file name.
static Configurator getInstance()
          Gets the Configurator using the default config file name if the singleton is not instantiated.
 java.lang.String[] getMBeanClassNameList()
          Gets the list of MBean class names.
 java.lang.String getProperty(java.lang.String key)
          When the key is "MBEAN_CLASS_NAME", we simply get it from MBean class list.
 java.lang.Object put(java.lang.Object key, java.lang.Object value)
          When the key is "MBEAN_CLASS_NAME", we simply add it to the MBean class list.
 
Methods inherited from class java.util.Properties
getProperty, list, list, load, propertyNames, save, setProperty, store
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

instance

private static Configurator instance

configFile

private java.lang.String configFile

mbeanClassNameList

private java.util.ArrayList mbeanClassNameList

arrayClassNames

private java.lang.String[] arrayClassNames
Constructor Detail

Configurator

private Configurator(java.lang.String configFile)
              throws SnmpException
Constructs the Configurator with the passed config file name.

Parameters:
configFile - Config file name
Throws:
SnmpException - thrown if any error occurs during the object instantiation.
Method Detail

put

public java.lang.Object put(java.lang.Object key,
                            java.lang.Object value)
When the key is "MBEAN_CLASS_NAME", we simply add it to the MBean class list. Otherwise, we still map the value using the defult put method in the super class.

Specified by:
put in interface java.util.Map
Overrides:
put in class java.util.Hashtable
Parameters:
key - The key mapping to the value
value - The value matched to the key

getProperty

public java.lang.String getProperty(java.lang.String key)
When the key is "MBEAN_CLASS_NAME", we simply get it from MBean class list. Otherwise, we get the value by calling the default getProperty method in the super calss.

Overrides:
getProperty in class java.util.Properties

getMBeanClassNameList

public java.lang.String[] getMBeanClassNameList()
Gets the list of MBean class names.

Returns:
arrayClassNames List of MBean class name.

create

public static Configurator create(java.lang.String configFile)
                           throws SnmpException
Creates the Configurator with the passed config file name.

Parameters:
configFile - Config file name
Returns:
Singleton object of the Configurator.
Throws:
SnmpException - thrown if any error occurs during the object instantiation.

getInstance

public static Configurator getInstance()
                                throws SnmpException
Gets the Configurator using the default config file name if the singleton is not instantiated.

Returns:
Singleton object of the Configurator
Throws:
SnmpException - thrown if any error occurs during the object instantiation.

MySnmpCrawler API