|
DbtuTools project Java Library |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.dbtutools.DbtuTools.core.ConfigService
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
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int CONFIG_SOURCE_UNKNOWN
public static final int CONFIG_SOURCE_UNIXCFG
protected java.lang.String oInstanceName
protected java.util.Hashtable oDatabaseNames
protected java.util.Properties oInstanceProperties
protected java.util.Hashtable oDatabaseProperties
protected java.lang.String oOptTreeRoot
protected java.lang.String oOptTreeInstanceCfg
protected int iConfigSourceType
Constructor Detail |
public ConfigService() throws UnknownValueException
refresh(boolean, java.lang.String[])
method is called
implicitly.UnknownValueException
- For the case, that the name of the current DB2 Instance
could not be detected. If the /opt/dbtutools tree could
not be located, the exception is thrown as well.public ConfigService(java.lang.String oInstanceName) throws UnknownValueException
refresh(boolean, java.lang.String[])
method is called
implicitly.oInstanceName
- The DB2 Instance to be addressed. If null is
given, the current DB2 Instance will be used.UnknownValueException
- For the case, that the name of the current DB2 Instance
could not be detected. If the /opt/dbtutools tree could
not be located, the exception is thrown as well.public ConfigService(java.lang.String oInstanceName, java.lang.String oDatabaseName) throws UnknownValueException
refresh(boolean, java.lang.String[])
method is called implicitly.oInstanceName
- The DB2 Instance to be addressed. If null is
given, the current DB2 Instance will be used.oDatabaseName
- The DB2 Database to be addressed. If null is
given, no DB2 Database will be used.UnknownValueException
- For the case, that the name of the current DB2 Instance
could not be detected. If the /opt/dbtutools tree could
not be located, the exception is thrown as well.public ConfigService(java.lang.String oInstanceName, java.lang.String[] oDatabaseNames) throws UnknownValueException
refresh(boolean, java.lang.String[])
method is called implicitly.oInstanceName
- The DB2 Instance to be addressed. If null is
given, the current DB2 Instance will be used.oDatabaseNames
- The DB2 Database(s) to be addressed. If null is
given, no DB2 Databases will be used.UnknownValueException
- For the case, that the name of the current DB2 Instance
could not be detected. If the /opt/dbtutools tree could
not be located, the exception is thrown as well.Method Detail |
protected void getConfigSourceSettings() throws UnknownValueException
refresh(boolean, java.lang.String[])
method.UnknownValueException
- For the case, that the dbtuswitch.cfg could not be found
or read. If there is no entry for the DB2 instance
(addressed by this object), the exception is thrown as well.public java.lang.String getProperty(java.lang.String oLevels, java.lang.String oDatabaseName, java.lang.String oKey) throws java.lang.IllegalArgumentException, java.lang.NullPointerException
oLevels
- Defines the levels to search, as well as the search order.
"I"
stands for the DB2 Instance level
and "D"
stands for the DB2 Database
level. Of course you can combine them to
"DI"
or "ID"
.
Please notice that every defined level is searched whether
there was a match in before or not. So the last match wins.oDatabaseName
- The name of the DB2 Database to search the properties.
If null is given, the DB2 Instance properties
are searched only.oKey
- The properties key (ignoring case considerations).java.lang.IllegalArgumentException
- For the case there is an invalid parameter.java.lang.NullPointerException
- If one of the arguments was null
.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
oLevels
- Defines the levels to search, as well as the search order.
"I"
stands for the DB2 Instance level
and "D"
stands for the DB2 Database
level. Of course you can combine them to
"DI"
or "ID"
.
Please notice that every defined level is searched whether
there was a match in before or not. So the last match wins.oDatabaseName
- The name of the DB2 Database to search the properties.
If null is given, the DB2 Instance properties
are searched only.oKey
- The properties key (ignoring case considerations).oDefaultKey
- For the case, that there was no match, this default value
is returned.java.lang.IllegalArgumentException
- For the case there is an invalid parameter.java.lang.NullPointerException
- If one of the arguments was null
.public void refresh(boolean bInstanceFlag) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, UnknownValueException
bInstanceFlag
- Indicates whether or not the properties for the DB2 Instance
should be (re)read. When called with false
, this
method has nothing to do.java.lang.IllegalArgumentException
- For the case, that there is an invalid parameter.java.lang.NullPointerException
- If one of the arguments was null
.UnknownValueException
- For the case, that the Config Source could not be read.public void refresh(boolean bInstanceFlag, java.lang.String oDatabaseName) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, UnknownValueException
bInstanceFlag
- Indicates whether or not the properties for the DB2 Instance
should be (re)read.oDatabaseName
- The name of the DB2 Database for which the properties
should be (re)read. If null is given, no
DB2 Databases are taken into account.java.lang.IllegalArgumentException
- For the case, that there is an invalid parameter.java.lang.NullPointerException
- If one of the arguments was null
.UnknownValueException
- For the case, that the Config Source could not be read.public void refresh(boolean bInstanceFlag, java.lang.String[] oDatabaseNames) throws java.lang.IllegalArgumentException, java.lang.NullPointerException, UnknownValueException
bInstanceFlag
- Indicates whether or not the properties for the DB2 Instance
should be (re)read.oDatabaseNames
- The name of the DB2 Database(s) for which the properties
should be (re)read. If null is given, no DB2
Databases are taken into account.java.lang.IllegalArgumentException
- For the case, that there is an invalid parameter.java.lang.NullPointerException
- If one of the arguments was null
.UnknownValueException
- For the case, that the Config Source could not be read.public void refreshAll() throws java.lang.IllegalArgumentException, java.lang.NullPointerException, UnknownValueException
refresh(boolean, java.lang.String[])
method.java.lang.IllegalArgumentException
- For the case, that there is an invalid parameter.java.lang.NullPointerException
- If one of the arguments was null
.UnknownValueException
- For the case, that the Config Source could not be read.
|
DbtuTools project Java Library |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |