DConfig 
SourceForge.net Logo PHP Logo

Dynamic Configuration Toolkit


Introduction

What is Dynamic Configuration Toolkit?
Attribute Inheritance
What can Dynamic Configuration Toolkit do?
DConfig Features
How to Use DConfig with Web Applications?
DConfig In Action Diagram

What is Dynamic Configuration Toolkit?      

Dynamic Configuration Toolkit (DConfig) is a general purpose configuration toolkit with dynamic features. It provides a unified way to manage configuration data through sever side libraries, the DConfig Library, and a Swing based front-end, the DConfig Editor. It achieves dynamic application configuration without requiring application server restart.

A configuration entry consists of a dot-separated key and a set of attributes.

Keys like app, db.datasource, config.view are valid. A key token does not allow '.', which is the separator to separate (or combine) a series key tokens. Fox example, key config.view has two key tokens, config and view. These two key tokens are combined through a '.' to create the full key config.view. Other printable characters, such as '/', '\', space, '@', '&', etc., and numbers are allowed in a key token. When we talking about a key, we are usually talikng about the dot-separated full key, not the key tokens. However, the first level keys do not have a '.', like config, user in the following image. In most cases, whether key means a full key or a key token can be determined from its context.

In DConfig GUI Editor, a key is displayed as multi-level nodes in a tree view. The following image shows selected key config.view, where config is the parent node of view. The status bar shows the current key as config.view.
dconfig-key

An attribute has attribute name, data type, attribute value and comments. Key config.datasource.mysql has three regular attributes [ (primary), JdbcDriver, and dbURL], and two inherited attributes, which are marked by '*'. See the image below:
dconfig-attribute

Currently supported data types include:

    Boolean
    Boolean Array
    Integer
    Integer Array
    Long
    Long Array
    String
    String Array
    Float
    Float Array
    Double
    Double Array
    Datetime
    Datetime Array
datatype-supported

Attribute Inheritance      

Attribute inheritance is one of the core features offered by DConfig. Attribute inheritance is a way to inherit attributes from a nodes' parent and ancestors. Attribute inheritance is similar to object inheritance in modern programming languages.

Enable attribute inheritance from parent key by simply check the check box to the left of the current key. A icon will appear for checked node. Here, mysql is checked, so all attributes from mysql's parent key, config.datasource, are inherited. Inheritance goes back to all checked ancestor nodes until the first unchekced ancestor node or root node is encountered. An inherited attributes is marked by a * in the '#' column. For example, attribute 'attribute @ config' is an inherited attribute. Mouse over to the * area, tooltip of 'inherited from <parent keyname>' , for example, 'inherited from config', is displayed.

An attribute with same name in the lower level, i.e., deeper in the tree, overrides (hides) higher level attributes , i.e., inherited attributes.
inheritance

What can Dynamic Configuration Toolkit do?      

Dynamic Configuration Toolkit can handle almost all types of system / application configuration values. The following is a sample list of configurable attributes , or properties, that can be handled by DConfig dynamically without using JMX or application server restart:

  • System configuration
  • User preferences
  • Application states
  • Object states
  • Session states
  • Logging format, logging levels
  • Minimum, maximum values
  • Data ranges
  • Datasource
  • Page layout
  • Date, datetime, money, number display settings
  • Data connection info
  • Email address, templates
  • Application logic test

DConfig Features      

Dynamic Configuration Toolkit has the following key features:

    Visualization configuration data 
    Logically group related attributes together. Comments can be added to each attribute, and searchable
    Attribute inheritance
    Search keys, attributes, values, comments forward or backward
    Search & sort on attribute tables
    Powerful yet fast API to read / write config data
    One click switch between view mode and update mode
    Easy to work with other architures, SWT, Swing, Struts, JSF, Spring, JDO, EJB, etc.
    Support key, attribute Copy / Paste / Cut, Import / Export
    Pre-defined data types for easy accessed by Java programs
    Support major databases
    Scalable, small footprint
    Platform independent
    Can be used in both Java Applications and Web Applications

How to Use DConfig with Web Applications?      

First do a one time Database Setup, then perform Web Server Setup. A web application uses dconfig-lib.jar to load / reload DConfig configuration data into memory, read or write DConfig configuration data through DConfigReader and DConfigWriter classes, which are also included in dconfig-lib.jar. A web application can launch DConfig GUI Editor through JNLP to perform generic data editing, creation of new keys and attributes, search, sort, import, export operations. In some cases, custom pages can be created to save dynamic data through DConfigWriter class without using DConfig GUI Editor, see Run the Web Demo Without DConfig GUI Editor

Please see the following DConfig in Action Diagram for a classic DConfig deployment to a web server.


DConfig in Action Diagram      

This diagram shows how DConfig integrated with web application.
Dconfig in Action