Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Current situation

Currently the broker is configured via a config.xml. This file is read on startup and the system responds by creating objects that form the Broker. The current system has a number of shortcomings:

...

The main features of the design are as follows:

  • Introduce a BrokerStore ConfigurationEntry class and ConfigurationEntryStore interface to abstract the Broker from the details of how the configuration is stored. This will allow the configuration to be stored in different stores (flat-file, Derby, Oracle-BDB, SQL, etc) and remove the hard dependencies on Commons Config.
  • Allow for changes to be made dynamically (through management interfaces) to be reflected immediately in the stored configuration. This will do away with the need for the user to hand-edit configuration files.
  • Improve the mechanism used to construct the Broker from its configuration.

Key Interfaces

BrokerStore

The BrokerStore allows the caller to construct the Broker as defined by the stored configuration. The caller will receive a tree of configured objects, complete with all attributes and children intact.

Internally, the BrokerStore will use a concrete implementation of ConfigurationEntryStore to read a list of ConfigurationEnties from the store (each ConfigurationEntry represents one ConfiguredObject)· It then uses a BrokerCreator to turn the list of entries into a tree of ConfiguredObjects.

ConfigurationEntry

POJO holding the configuration for the ConfiguredObject. It also has a reference to the ConfigurationEntryStore in order to be able to load its children configuration entriesIt will also use a ConfigurationChangeMonitor to listen for changes in the tree of ConfiguredObjects and reflect those into the store via the ConfigurationEntryStore interface.

ConfigurationEntryStore

The ConfigurationEntryStore is responsible for reading a list of ConfigurationEntries from the store, and saving any changes.

...

and saving of ConfigurationEntries.
Command line arguments and default settings should be also represented as ConfigurationEntryStores. The CompositeConfigurationEntryStore will be responsible for the loading and merging of the configuration from underlyaing stores (command line arguments store, persistent configuration store and default settings)

BrokerCreator and ConfiguredObjectCreators

The BrokerCreator constructs the tree of the ConfiguredObjects representing the Broker from the list of ConfigurationEntriesthe ConfigurationEntry. It will delegate the creation of broker children (VirtualHosts, AuthenticationProviders, Ports etc) to their own Creators. Also BrokerCreator is responsible for setting of "parent-child" relationships between Broker and its children configured object.

ConfigurationChangeMonitor

...

The following UML diagrams document the design.

Class Diagram

Image RemovedImage Added

Sequence Diagram - Broker Startup

Sequence diagram depicting Broker start-up, loading of configuration, the forming of the ConfiguredObject tree
and the registering of listeners to hear changes/updates.

The DefaultBrokerCreator implementation scans the list of ConfigurationEnties. When it encounters the entry representing the Broker, it creates the Broker ConfiguredObject using a factory and 'seeds' a list of factories that will be used to create the Broker's children when these are encountered in the entry list. These factories delegate to the #createChild method of the Broker object itself.

As it encounters non-Broker entries, it looks for the factory that was created earlier and fires it, thus creating the child at the right point in the tree. Also if the child itself has children, corresponding factories are added to the list for use when those entries are encountered. Depending on the order of the ConfigurationEnties, it may be necessary to loop more than once.

Image Removed

Image Added

Sequence Diagram - Adding a new child from the management interface

Sequence diagram depicting the adding of the new child from the management interface. This shows how the new child is persisted into the store, and how the ConfigurationChangeMonitor registers itself with the new child.

Image RemovedImage Added

Sequence Diagram - Changing of attributes from management interfaces

Image RemovedImage Added

Json configuration store and Json configuration format.

...