{"id":407,"date":"2016-08-28T17:04:56","date_gmt":"2016-08-28T15:04:56","guid":{"rendered":"http:\/\/h2916922.stratoserver.net:8084\/?p=407"},"modified":"2016-08-29T17:57:51","modified_gmt":"2016-08-29T15:57:51","slug":"central-configuration-plugin-for-multi-server-icnicm-environments","status":"publish","type":"post","link":"https:\/\/www.ivojonker.nl\/?p=407","title":{"rendered":"Central Configuration plugin for multi-server ICN\/ICM environments"},"content":{"rendered":"<p>After finding out that <a href=\"?p=380\">it&#8217;s a real bad idea to store certain information in ICN plugins<\/a>, i started looking for alternatives. Eventually i came\u00a0up 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.<\/p>\n<p>Basically the plugin has the following\u00a0characteristics:<\/p>\n<ul>\n<li>It stores data in key\/value format.<\/li>\n<li>The data is centrally stored in a database, and accessed via a JNDI registered datasource.<\/li>\n<li>It&#8217;s values are accessible both front-end as back-end<\/li>\n<li>It&#8217;s accessible from all applications in a multi-server environment.<\/li>\n<li>It&#8217;s data is centrally stored.<\/li>\n<li>Security can be applied to prevent leakage of passwords or api keys.<\/li>\n<li>The configuration can be managed within the Content Navigator Admin page;<\/li>\n<li>And can be configured with a familiar look and feel.<\/li>\n<li>The configuration can be bulk-updated by replacing a JSON allowing easy management of OTAP configurations.<\/li>\n<\/ul>\n<h3>Example of the management interface.<\/h3>\n<p>As you can see below a property is identified by a\u00a0key; keys are alphabetically grouped, and all values can be\u00a0composed of multi-line strings. Each value can be marked &#8216;evaluate at front-end&#8217; which means the key\/value combination will be accessible trough JavaScript. Additionally values can be &#8220;evaluated&#8221; which basically means JavaScripts&#8217; eval function is called &#8211; this can be handy to to have a JavaScript function or Object stored in the configuration.<\/p>\n<p>For convenience all properties can have a description (click the info icon) so any administrator can easily discover the purpose of the configuration entry.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-436\" src=\"http:\/\/h2916922.stratoserver.net:8084\/wp-content\/uploads\/2016\/08\/word-image-4.png\" alt=\"word-image\" width=\"932\" height=\"336\" srcset=\"https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4.png 932w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-300x108.png 300w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-768x277.png 768w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-750x270.png 750w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-400x144.png 400w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-430x155.png 430w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-150x54.png 150w, https:\/\/www.ivojonker.nl\/wp-content\/uploads\/2016\/08\/word-image-4-100x36.png 100w\" sizes=\"auto, (max-width: 932px) 100vw, 932px\" \/><\/p>\n<p>&nbsp;<\/p>\n<h3>Sample JavaScript code:<\/h3>\n<pre class=\"lang:js decode:true\">require(\"CentralConfiguration\").get(\"filenet.ce.iiop\")<\/pre>\n<p>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.<\/p>\n<h3>Sample Java code:<\/h3>\n<p><em>Please take into account that the Central Configuration plugin requires the application to be run within a WebSphere context.<\/em><\/p>\n<pre class=\"lang:java decode:true\">package nl.ivojonker.sample;\r\n\r\nimport nl.ivojonker.icn.configuration.Configuration;\r\n\r\npublic class SampleUsage {\r\n\t\r\n\tpublic static void doStuff(){\r\n\t\t\r\n\t\tboolean useCache = false;\r\n\t\t\r\n\t\t\/\/Retrieves the singleton with default useCache = true Simply re-uses earlier collected configuration \r\n\t\tConfiguration config = Configuration.getInstance();\r\n\t\t\r\n\t\t\/\/Retrieves the singleton with the option to provide useCache=false\r\n\t\tconfig = Configuration.getInstance(useCache);\r\n\t\t\r\n\t\t\/\/Retrieves the singleton, but will not throw exceptions upon failure - might sometimes be convenient.\r\n\t\t\/\/The risk of not having a configuration available might be mitigated by using the following .getProperty(key,default) function.\r\n\t\tconfig = Configuration.getInstanceSupressExceptions(useCache)\r\n\r\n\t\t\/\/retrieves the value for filenet.ce.defaultobjectstore.\r\n\t\tconfig.getProperty(\"filenet.ce.defaultobjectstore\");\r\n\t\t\r\n\r\n\t\t\/\/retrieves the value for filenet.ce.defaultobjectstore, but returns default if the value does not exist.\r\n\t\tconfig.getProperty(\"filenet.ce.defaultobjectstore\",\"TARGET\");\r\n\t}\r\n\r\n}<\/pre>\n<p>&nbsp;<\/p>\n<h3>Download &amp; support<\/h3>\n<p>You can download the .jar with source &amp; javadoc <a href=\"http:\/\/h2916922.stratoserver.net:8084\/ivo\/wp-attachments\/Central Configuration Repository.jar\">here<\/a>.<\/p>\n<p>The manual can be found <a href=\"http:\/\/h2916922.stratoserver.net:8084\/?page_id=409\">here<\/a>.<\/p>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p>If you make any profound additions or changes to the code, please send them in so we can share them to the world:)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>After finding out that it&#8217;s a real bad idea to store certain information in ICN plugins, i started looking for alternatives. Eventually i came\u00a0up with the idea to create a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-407","post","type-post","status-publish","format-standard","hentry","category-geen-categorie"],"_links":{"self":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=407"}],"version-history":[{"count":10,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/407\/revisions"}],"predecessor-version":[{"id":441,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=\/wp\/v2\/posts\/407\/revisions\/441"}],"wp:attachment":[{"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ivojonker.nl\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}