Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.dbtutools.DbtuTools.core
Class ConfigService  view ConfigService download ConfigService.java

java.lang.Object
  extended byorg.dbtutools.DbtuTools.core.ConfigService

public class ConfigService
extends java.lang.Object

One of the central services offered to all the DbtuTools tools (of course, others can use them as well).

The class works as a wrapper, covering the configuration stuff and hiding the different Config Sources and their types. Currently, Unix configuration files located in the /opt/dbtutools tree [UNIX][Wintel] are the only Config Source type, but other configuration file types like Windows INI, XML etc. as well as directory services like LDAP might be an option too.

More information about the Unix configuration file format can be found in the detailed description of the org.edelbyte.util.UnixCfgParser class.


Field Summary
static int CONFIG_SOURCE_UNIXCFG
          Constant standing for a Unix Configuration files as Config Source.
static int CONFIG_SOURCE_UNKNOWN
          Constant standing for an unknown Config Source.
protected  int iConfigSourceType
          Field holding the Config Source type.
protected  java.util.Hashtable oDatabaseNames
          Field holding the given DB2 Database name(s).
protected  java.util.Hashtable oDatabaseProperties
          Field holding the Database level properties read from the Config Source.
protected  java.lang.String oInstanceName
          Field holding the given DB2 Instance name.
protected  java.util.Properties oInstanceProperties
          Field holding the Instance level properties read from the Config Source.
protected  java.lang.String oOptTreeInstanceCfg
          Field holding the path for the DB2 Instance configuration files within the /opt/dbtutools tree.
protected  java.lang.String oOptTreeRoot
          Field holding the machine wide /opt/dbtutools tree root.
 
Constructor Summary
ConfigService()
          Creates a new instance of this class which addresses the current DB2 Instance, but no DB2 database(s).
ConfigService(java.lang.String oInstanceName)
          Creates a new instance of this class which addresses the given DB2 Instance, but no DB2 database(s).
ConfigService(java.lang.String oInstanceName, java.lang.String oDatabaseName)
          Creates a new instance of this class which addresses the given DB2 Instance, as well as the given DB2 database.
ConfigService(java.lang.String oInstanceName, java.lang.String[] oDatabaseNames)
          Creates a new instance of this class which addresses the given DB2 Instance, as well as the given DB2 database(s).
 
Method Summary
protected  void getConfigSourceSettings()
          This method determines how to find and read the Config Sources.
 java.lang.String getProperty(java.lang.String oLevels, java.lang.String oDatabaseName, java.lang.String oKey)
          Searches the different properties fields for the specified property key.
 java.lang.String getProperty(java.lang.String oLevels, java.lang.String oDatabaseName, java.lang.String oKey, java.lang.String oDefaultValue)
          Searches the different properties fields for the specified property key.
 void refresh(boolean bInstanceFlag)
          As the name says, the method (re)reads the Config Sources and stores all found properties in the corresponding object fields.

Please notice, that this method covers the Config Source for the DB2 Instance only.
 void refresh(boolean bInstanceFlag, java.lang.String oDatabaseName)
          As the name says, the method (re)reads the Config Sources and stores all found properties in the corresponding object fields.
 void refresh(boolean bInstanceFlag, java.lang.String[] oDatabaseNames)
          As the name says, the method (re)reads the Config Sources and stores all found properties in the corresponding object fields.
 void refreshAll()
          As the name says, the method (re)reads all Config Sources and stores all found properties in the corresponding object fields.
private  void refreshDatabaseProperties(java.lang.String oDatabaseName)
          Submethod which is called by the refresh(boolean, java.lang.String[]) 55 method to (re)read the Config Sources for the given DB2 Database.
private  void refreshDatabasePropertiesUnixCfg(java.lang.String oDatabaseName)
          Subsubmethod for (re)reading the Unix configuration file for the given DB2 Database.
private  void refreshInstanceProperties()
          Submethod which is called by the refresh(boolean, java.lang.String[]) 55 method to (re)read the Config Sources for the addressed DB2 Instance.
private  void refreshInstancePropertiesUnixCfg()
          Subsubmethod for (re)reading the Unix configuration file for the addressed DB2 Instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_SOURCE_UNKNOWN

public static final int CONFIG_SOURCE_UNKNOWN
Constant standing for an unknown Config Source. ************************************************************************

See Also:
Constant Field Values

CONFIG_SOURCE_UNIXCFG

public static final int CONFIG_SOURCE_UNIXCFG
Constant standing for a Unix Configuration files as Config Source. ************************************************************************

See Also:
Constant Field Values

oInstanceName

protected java.lang.String oInstanceName
Field holding the given DB2 Instance name. ************************************************************************


oDatabaseNames

protected java.util.Hashtable oDatabaseNames
Field holding the given DB2 Database name(s). ************************************************************************


oInstanceProperties

protected java.util.Properties oInstanceProperties
Field holding the Instance level properties read from the Config Source. ************************************************************************


oDatabaseProperties

protected java.util.Hashtable oDatabaseProperties
Field holding the Database level properties read from the Config Source. ************************************************************************


oOptTreeRoot

protected java.lang.String oOptTreeRoot
Field holding the machine wide /opt/dbtutools tree root. ************************************************************************


oOptTreeInstanceCfg

protected java.lang.String oOptTreeInstanceCfg
Field holding the path for the DB2 Instance configuration files within the /opt/dbtutools tree. ************************************************************************


iConfigSourceType

protected int iConfigSourceType
Field holding the Config Source type. ************************************************************************

Constructor Detail

ConfigService

public ConfigService()
              throws org.edelbyte.util.UnknownValueException
Creates a new instance of this class which addresses the current DB2 Instance, but no DB2 database(s). During the instantiation, the refresh(boolean, java.lang.String[]) 55 method is called implicitly.


ConfigService

public ConfigService(java.lang.String oInstanceName)
              throws org.edelbyte.util.UnknownValueException
Creates a new instance of this class which addresses the given DB2 Instance, but no DB2 database(s). During the instantiation, the refresh(boolean, java.lang.String[]) 55 method is called implicitly.


ConfigService

public ConfigService(java.lang.String oInstanceName,
                     java.lang.String oDatabaseName)
              throws org.edelbyte.util.UnknownValueException
Creates a new instance of this class which addresses the given DB2 Instance, as well as the given DB2 database. During the instantiation, the refresh(boolean, java.lang.String[]) 55 method is called implicitly.


ConfigService

public ConfigService(java.lang.String oInstanceName,
                     java.lang.String[] oDatabaseNames)
              throws org.edelbyte.util.UnknownValueException
Creates a new instance of this class which addresses the given DB2 Instance, as well as the given DB2 database(s). During the instantiation, the refresh(boolean, java.lang.String[]) 55 method is called implicitly.

Method Detail

getConfigSourceSettings

protected void getConfigSourceSettings()
                                throws org.edelbyte.util.UnknownValueException
This method determines how to find and read the Config Sources. Therefore it reads the dbtuswitch.cfg file [UNIX][Wintel] and stores the information in the object fields.

The method is called by the refresh(boolean, java.lang.String[]) 55 method.


getProperty

public java.lang.String getProperty(java.lang.String oLevels,
                                    java.lang.String oDatabaseName,
                                    java.lang.String oKey)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.NullPointerException
Searches the different properties fields for the specified property key.


getProperty

public java.lang.String getProperty(java.lang.String oLevels,
                                    java.lang.String oDatabaseName,
                                    java.lang.String oKey,
                                    java.lang.String oDefaultValue)
                             throws java.lang.IllegalArgumentException,
                                    java.lang.NullPointerException
Searches the different properties fields for the specified property key.


refresh

public void refresh(boolean bInstanceFlag)
             throws java.lang.IllegalArgumentException,
                    java.lang.NullPointerException,
                    org.edelbyte.util.UnknownValueException
As the name says, the method (re)reads the Config Sources and stores all found properties in the corresponding object fields.

Please notice, that this method covers the Config Source for the DB2 Instance only.


refresh

public void refresh(boolean bInstanceFlag,
                    java.lang.String oDatabaseName)
             throws java.lang.IllegalArgumentException,
                    java.lang.NullPointerException,
                    org.edelbyte.util.UnknownValueException
As the name says, the method (re)reads the Config Sources and stores all found properties in the corresponding object fields.


refresh

public void refresh(boolean bInstanceFlag,
                    java.lang.String[] oDatabaseNames)
             throws java.lang.IllegalArgumentException,
                    java.lang.NullPointerException,
                    org.edelbyte.util.UnknownValueException
As the name says, the method (re)reads the Config Sources and stores all found properties in the corresponding object fields.


refreshAll

public void refreshAll()
                throws java.lang.IllegalArgumentException,
                       java.lang.NullPointerException,
                       org.edelbyte.util.UnknownValueException
As the name says, the method (re)reads all Config Sources and stores all found properties in the corresponding object fields. The method internally calls the refresh(boolean, java.lang.String[]) 55 method.


refreshDatabaseProperties

private void refreshDatabaseProperties(java.lang.String oDatabaseName)
                                throws org.edelbyte.util.UnknownValueException
Submethod which is called by the refresh(boolean, java.lang.String[]) 55 method to (re)read the Config Sources for the given DB2 Database.


refreshDatabasePropertiesUnixCfg

private void refreshDatabasePropertiesUnixCfg(java.lang.String oDatabaseName)
                                       throws org.edelbyte.util.UnknownValueException
Subsubmethod for (re)reading the Unix configuration file for the given DB2 Database.


refreshInstanceProperties

private void refreshInstanceProperties()
                                throws org.edelbyte.util.UnknownValueException
Submethod which is called by the refresh(boolean, java.lang.String[]) 55 method to (re)read the Config Sources for the addressed DB2 Instance.


refreshInstancePropertiesUnixCfg

private void refreshInstancePropertiesUnixCfg()
                                       throws org.edelbyte.util.UnknownValueException
Subsubmethod for (re)reading the Unix configuration file for the addressed DB2 Instance.