External Config Provider

This page explains how to provide your own class which primrose will pull pool configuration from.
This new feature allows you to decide how you will store your pool config data.
For example, you may want to store data via LDAP, or via some other central repository.
By implementing your own config provider, you can decide how you wish to configure primrose.

You still need a config file on your server - by the only information is to provide the pool name, and the class name of your config provider.

Example config file

Here is an example of how your primrose.config file may look like :

poolName=poolOne
externalConfigProvider=uk.org.primrose.test.ExamplePoolConfigProvider

poolName=anotherPool
externalConfigProvider=uk.org.primrose.test.ExamplePoolConfigProvider

Implementing your own provider

There is a very simple example here : ExamplePoolConfigProvider.java
Your own provider must implement the interface ExternalPoolConfigProvider
There is one method to implement :

/**
* Given a pool name, and an item name, return the value
* of the item.
*/
public String getConfigItem(String poolName, String itemName) throws GeneralException;

When primrose loads, it instantiates a new class as specified in your config, and then for each normal config item (eg, user,password,driverUrl, etc) calls the getConfigItem() method, passing the pool primrose is loading at that time, and the item name of the config item required.
If you wish to use a default value (for example, the idleTime item), just return null, and the default primrose value will be used.

Config Item Names

You may obtain a list of item names programmatically by iterating the list uk.org.primrose.Constants.POOL_CONFIG_ITEM_NAMES.
They are also listed here