After finding out that it’s a real bad idea to store certain information in ICN plugins, i started looking for alternatives. Eventually i came up with the idea to create a new ICN plugin to be able to manage a central configuration repository that is secure and has support for multi server/application access.
Basically the plugin has the following characteristics:
- It stores data in key/value format.
- The data is centrally stored in a database, and accessed via a JNDI registered datasource.
- It’s values are accessible both front-end as back-end
- It’s accessible from all applications in a multi-server environment.
- It’s data is centrally stored.
- Security can be applied to prevent leakage of passwords or api keys.
- The configuration can be managed within the Content Navigator Admin page;
- And can be configured with a familiar look and feel.
- The configuration can be bulk-updated by replacing a JSON allowing easy management of OTAP configurations.
Example of the management interface.
As you can see below a property is identified by a key; keys are alphabetically grouped, and all values can be composed of multi-line strings. Each value can be marked ‘evaluate at front-end’ which means the key/value combination will be accessible trough JavaScript. Additionally values can be “evaluated” which basically means JavaScripts’ eval function is called – this can be handy to to have a JavaScript function or Object stored in the configuration.
For convenience all properties can have a description (click the info icon) so any administrator can easily discover the purpose of the configuration entry.
Sample JavaScript code:
require("CentralConfiguration").get("filenet.ce.iiop")
A second parameter can be provided to return a default value if the key ends up to be null or not present in the configuration repository.
Sample Java code:
Please take into account that the Central Configuration plugin requires the application to be run within a WebSphere context.
package nl.ivojonker.sample; import nl.ivojonker.icn.configuration.Configuration; public class SampleUsage { public static void doStuff(){ boolean useCache = false; //Retrieves the singleton with default useCache = true Simply re-uses earlier collected configuration Configuration config = Configuration.getInstance(); //Retrieves the singleton with the option to provide useCache=false config = Configuration.getInstance(useCache); //Retrieves the singleton, but will not throw exceptions upon failure - might sometimes be convenient. //The risk of not having a configuration available might be mitigated by using the following .getProperty(key,default) function. config = Configuration.getInstanceSupressExceptions(useCache) //retrieves the value for filenet.ce.defaultobjectstore. config.getProperty("filenet.ce.defaultobjectstore"); //retrieves the value for filenet.ce.defaultobjectstore, but returns default if the value does not exist. config.getProperty("filenet.ce.defaultobjectstore","TARGET"); } }
Download & support
You can download the .jar with source & javadoc here.
The manual can be found here.
If by any chance you have feature requests, feel free to request them by mail or via the form below. The same for any bugs you encounter.
If you make any profound additions or changes to the code, please send them in so we can share them to the world:)
Nice on!