Changes between Initial Version and Version 1 of ConfigOverride


Ignore:
Timestamp:
May 25, 2011, 2:04:45 AM (13 years ago)
Author:
jesseeichar
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ConfigOverride

    v1 v1  
     1= Proposal title =
     2
     3|| '''Date''' || 2011/05/25 ||
     4|| '''Contact(s)''' || Jesse Eichar (Camptocamp SA)||
     5|| '''Last edited''' || ||
     6|| '''Status''' || being discussed ||
     7|| '''Assigned to release''' || to be determined ||
     8|| '''Resources''' || Available ||
     9|| '''Ticket #''' || #XYZ ||
     10
     11== Overview ==
     12
     13In order to permit deployment of a Geonetwork instance to multiple environments and assist in development this proposal adds the ability to configure geonetwork for multiple target deployment platforms (for example, test and production) with a minimum of duplication and allow configuration selection to be chosen via System properties or ServletConfig/Context parameters. 
     14
     15=== Proposal Type ===
     16 * '''Module''': Jeeves
     17
     18=== Links ===
     19 * '''Documents''': 
     20                A working patch is attached to this proposal:
     21 * '''Email discussions''':
     22 * '''Other wiki discussions''':
     23
     24=== Voting History ===
     25 * Vote proposed by X on Y, result was +/-n (m non-voting members).
     26
     27----
     28
     29== Motivations ==
     30
     31In many organizations that deploy geonetwork instances geonetwork needs to be deployed in several different environments.  For example if one is making a customized geonetwork one might have a test server and a production server.  Obviously they cannot share the same resources so the configurations of the two servers are likely very similar but with a few key differences. 
     32
     33Currently you essentially need different configurations depending on which environment you are deploying to.  The pain can be somewhat alleviate by extracting the changes into separate files and using include tags to import them.  However this can require fairly substantial changes to the default geonetwork configuration files and if one is attempting to follow the Geonetwork development it can mean conflicts with the geonetwork configuration files when merging in changes from a new version of Geonetwork.  In addition there are certain types of changes one may want that cannot be accommodated by using the import strategy.
     34
     35== Proposal ==
     36As such I propose a new method for handling multiple deployment platforms.  The standard configuration files contain the default settings and multiple override configurations can be defined to override certain parts of those defaults.  The override that is applied can be selected via one of System properties, ServletConfig initial parameters or ServletContext initial parameters. So depending on the server/environment where the geonetwork is deployed a different configuration can be selected with minimal duplication of configuration.
     37
     38The parameter/property that is checked for the definition of the override file is jeeves.configuration.overrides.file.  If the property is not found then the no overrides are applied to the default configuration.
     39
     40
     41The following is an example of a override file:
     42
     43<overrides>
     44     <!-- properties allow some properties to be defined that will be substituted -->
     45     <!-- into text or attributes where ${property} is the substitution pattern -->
     46     <!-- The properties can reference other properties -->
     47     <properties>
     48         <fr>fr</fr>
     49         <lang>${fr}</lang>
     50         <host>localhost</host>
     51         <enabled>true</enabled>
     52         <dir>xml</dir>
     53     </properties>
     54     <!-- In this version only the file name is considered not the path.  -->
     55     <!-- So case conf1/config.xml and conf2/config.xml cannot be handled -->
     56     <file name="config.xml">
     57         <!-- This example will update the file attribute of the xml element with the name attribute 'countries' -->
     58         <replaceAtt xpath="default/gui/xml[@name = 'countries']" attName="file" value="${dir}/europeanCountries.xml"/>
     59         <!-- if there is no value then the attribute is removed -->
     60         <replaceAtt xpath="default/gui" attName="removeAtt"/>
     61         <!-- If the attribute does not exist it is added -->
     62         <replaceAtt xpath="default/gui" attName="newAtt" value="newValue"/>
     63
     64         <!-- This example will replace all the xml in resources with the contained xml -->
     65         <replaceXML xpath="resources">
     66           <resource enabled="${enabled}">
     67             <name>main-db</name>
     68             <provider>jeeves.resources.dbms.DbmsPool</provider>
     69              <config>
     70                  <user>admin</user>
     71                  <password>admin</password>
     72                  <driver>oracle.jdbc.driver.OracleDriver</driver>
     73                  <!-- ${host} will be updated to be local host -->
     74                  <url>jdbc:oracle:thin:@${host}:1521:fs</url>
     75                  <poolSize>10</poolSize>
     76              </config>
     77           </resource>
     78         </replaceXML>
     79         <!-- This example simple replaces the text of an element -->
     80         <replaceText xpath="default/language">${lang}</replaceText>
     81         <!-- This examples shows how only the text is replaced not the nodes -->
     82         <replaceText xpath="default/gui">ExtraText</replaceText>
     83         <!-- append xml as a child to a section (If xpath == "" then that indicates the root of the document),
     84              this case adds nodes to the root document -->
     85         <addXML xpath=""><newNode/></addXML>
     86         <!-- append xml as a child to a section, this case adds nodes to the root document -->
     87         <addXML xpath="default/gui"><newNode2/></addXML>
     88         <!-- remove a single node -->
     89         <removeXML xpath="default/gui/xml[@name = countries2]"/>
     90         <!-- remove all matching nodes -->
     91         <removeXML xpath="*//toRemove"/>
     92     </file>
     93         <file name="config2.xml">
     94         <replaceAtt xpath="default/gui/xml[@name = 'countries']" attName="file" value="${dir}/other.xml"/>
     95         <replaceText xpath="default/language">de</replaceText>
     96     </file>
     97</overrides>
     98
     99As this example indicates the primary tags of interest are:
     100        properties - defines common properties throughout the override
     101        file - defines the file the override segment applies to
     102        replaceAtt - defines a override that updates an attribute of a particular node
     103        replaceXML - defines a override that replaces all children of a particular node
     104        replaceText - defines a override that sets the Text of a particular node
     105        addXML - defines a override that add xml as children of a given node
     106        removeXML - defines a override that removes XML from a node
     107
     108
     109=== Backwards Compatibility Issues ===
     110
     111100% backwards compatible
     112
     113=== New libraries added ===
     114No new libraries.
     115
     116== Risks ==
     117
     118== Participants ==