Database Implementation Plug-ins

The plug-ins technique makes database applications truly independent from available database implementations:

The config database implementation (to be used by the application) is defined by one and only one parameter, that is TDAQ_DB environment variable. It contains name of the implementation and it's initialization parameter separated by colon, e.g.:

TDAQ_DB="oksconfig:daq/partitions/be_test.data.xml"    # use oks and file daq/partitions/be_test.data.xml
TDAQ_DB="rdbconfig:RDB"    # use rdb and server with name RDB

Previous environment variables such as TDAQ_DB_IMPLEMENTATION, TDAQ_DB_DATA, TDAQ_DB_NAME are not used by the plug-ins technique.

The same TDAQ_DB variable format is used for both C++ in Java:

C++ code changes

The creation of the configuration object requires to pass one string parameter only.

To get such parameter from environment variable TDAQ_DB leave it empty as shown below:

::Configuration db("");

If the parameter can optionally be set via command line or provided by a different mean, the code shown below is recommended. Note the way, how error is reported, since the user does not know exact parameter used for the configuration object construction:

std::string db_spec;
if(...) db_spec = ...; // optionally set parameter, e.g. from command line
::Configuration db(db_spec);
if(!db.loaded()) {
  std::cerr << "ERROR: cannot load database \"" << db.get_impl_spec() << '\"' << std::endl;
}
Java code changes

The Java code to build configuration object is very similar to C++. Use configuration object constructor with string parameter. If it is empty string, then the value of the TDAQ_DB environment variable will be used. An example of code is shown below:

String db_spec;
if(...) db_spec = ...;
try {
  config.Configuration db = new config.Configuration(db_spec);
}
catch (config.SystemException ex) {
  System.err.println( "ERROR: caught \'config.SystemException\':\n" + ex.getMessage());
}
C++ binary linkage

Only link your binary with config library, i.e. use -lconfig. Implementation plug-in will be loaded automatically at run-time.

Old Configuration Constructors

The user's code using old approach will be compiled and will work as before. It is not necessary to modify it immediately. However this should be done by next TDAQ release.

Config dump  binary

The new binary config_dump can be used to dump contents of any database object using new implementation plug-in technology. Examples below show how to print out partition objects stored in the oks data file be_test.data.xml and defined on the RDB server running in the partition be_test:

config_dump -d "oksconfig:daq/partitions/be_test.data.xml" -c Partition
config_dump -d "rdbconfig:be_test::RDB" -c Partition

Java Attribute Converters

Java config package supports attribute converters in the way similar to existing C++ ones. This allows in particular to substitute variable parameters in the strings attributes, that is widely used by the TDAQ configuration databases. See dal package release notes for examples.

Bug Fixes

Fix problem with Configuration::cast() method. Now it checks, the target and source objects are physically the same. Before it was possible to cast source object to any target class, if it contained an object with ID of source object.