4 Replies Latest reply on Oct 24, 2012 10:35 AM by hwangarias

    Application settings

    hwangarias

      I was asked to design an application settings subsystem that loads basic settings from inner files (properties, xml, basic reports) inside the EAR but overridable from external settings (a certain path in the disc)

       

      The latter is clear for me (loading external files), but I cannot figure out what is the correct place to set the static resources in JBoss 7, I have investigated the following:

      • A jar in EAR/lib but I don't know how to list for example the list of reports in directory /resources/reports inside the jar
      • Use VFS and load inside the EAR (working in arquillian but not in production)
      • ...

       

      What is the correct approach?

       

      Thank you in advance!

      Juan

        • 1. Re: Application settings
          lehvolk

          Hi.

           

          One of my application has huge configuration stored in xml and this configuration depends on deployment enviroment (on test servers, local machines, production etc). Main idea was to store configuration outside deployment (for example into {JBOSS_HOME}/standalone/conf/app_conf/ folder). Problem was to manage configuration inside different enviroments. Solution was to manage this configuration during application building. So sources contatains all kind off configuration and when someone wants to deploy application, he runs build in special profile and specified profile configuration overrides default (build result was the configuration folder and deployment). I think it's best solution for some kind of problems.

          • 2. Re: Application settings
            hwangarias

            In order other people could come here I'll expose how did I manage...

             

            In each EAR artifact I have (I have a base core but many distributions parametrized):

            • under src/main/application I have all the typical that maven-ear plugin will include as part of the ear
            • I have src/main/resources/settings/... <hierarchy of distribution-related-settings>

             

            I have used assembly plugin in prepare-package to compress as a settings.jar (zip-file) all content of src/main/resources/settings/ to <EAR>/lib/settings.jar, and once as part of the classpath I use VFS to deal with the hierarchy, for example, getReports() looks in classpath://settings/reports/ all files contained in settings.jar and returns pointers to all of them

             

            This combined with a custom "classpath concept" allows me to create outside the EAR a replica of the structure and allow to override internal resources with external ones.

             

            This is flexible in the way I send my application with basic customizations and parametrize that is as simple as substitute internal files by external ones

             

            If anyone wants more details... here we are

             

            Thx!

            • 3. Re: Application settings
              jaikiran

              I would like to understand what exactly you are doing there. Could you please create a wiki article here https://community.jboss.org/en/jbossas7?view=documents explaining those details?

              • 4. Re: Application settings
                hwangarias

                Ok, as soon as I have a couple of minutes I'll write a paper.   Basically I embed a dir of the EAR as a jar-lib inside the ear as my "internal resource root".   Outside of jboss, in my APPLICATION_HOME I have a replic where I can overwrite all or part of those resources.

                 

                Case of use: reports

                I embed with each of my bundles a basic set of "standar reports" but I allow override them as well as append new ones