1 Reply Latest reply on Nov 15, 2013 1:46 PM by Nicolas Filotto

    How to overrride organization-configuration.xml file from my ear file

    Anish Antony Newbie

      Hi all

      Is it possible to override default organization-configuration.xml file (which appears inside gatein\gatein.ear\portal.war\WEB-INF\conf\organization) from custom created ear file (the ear file created by using this code)

       

      Regards

      Anish Antony

        • 1. Re: How to overrride organization-configuration.xml file from my ear file
          Nicolas Filotto Novice

          Yes it is possible, it is actually the main purpose of what we call the "extension mechanism". The main goal of it, is to be able to customize your portal without modifying the portal.war in order to ease migration from one version to another. You can find everything about the "extension mechanism" here Reference Guide / eXo JCR and  and in the chapter 2.4.2 http://docs.jboss.org/exojcr/1.15.4-GA/developer/en-US/html_single/#Kernel.ContainerConfiguration.UnderstandingHowConfigurationFilesLoaded

          In your case, if you want to replace the file gatein\gatein.ear\portal.war\WEB-INF\conf\organization-configuration.xml, what you need to do, is to add a new file at the exact same location in the war file of your extension. So if your extension is foo, you are supposed to put the new file at foo.war\WEB-INF\conf\organization-configuration.xml. As your extension has some configuration to share, you need to add the listener org.exoplatform.container.web.PortalContainerConfigOwner in the web.xml of you war as described in the chapter 2.4.2.2.1 of the doc, thx to that, the kernel will know that you have at least one configuration file to share.

          Don't forget to set the display-name in your web.xml and set it to the name of your extension, here it would be foo.

          The last thing to do, is to define your extension. You can do that by adding the next block at then end of the definition of the dependencies in the file standalone/configuration/gatein/configuration.xml

                        <value>

                          <string>foo</string>

                        </value>

          Thx to that, the kernel will know that your extension is a dependency of the default portal container "portal" and as it is the last dependency in the list and it is after the dependency "portal", when it will try to load the file conf\organization-configuration.xml, it will get it from the extension with the highest priority which will be your extension instead of getting it from the portal.war