5 Replies Latest reply on Jun 30, 2014 11:32 AM by akhettar

    Sharing property place holder between different bundles

    akhettar Newbie

      Hi

       

      I have dozens of bundles sharing the same ActiveMQ, Hbase,  ElasticSearch and some other resources connection details. These connections details is defined in each bundle [PID].cfg configuration file. Is there a way of defining a PID which can be referenced by all the bundles to get access to the shared resources?

       

      According to the blueprint schema only on propertyPlaceholder element is allowed within a context - see below snippet.

       

      <camelContext id="id1"

                        xmlns="http://camel.apache.org/schema/blueprint" errorHandlerRef="errorHandler">

       

              <!-- explicitly set properties locations in blueprint -->

              <propertyPlaceholder id="properties" location="blueprint:com.zotix.provider.config" />

          ......

      </camelContext>

       

       

      Thanks

       

      Ayache

        • 1. Re: Sharing property place holder between different bundles
          Claus Ibsen Master

          I think you can have more separated with comma, eg

           

                <propertyPlaceholder id="properties" location="blueprint:com.zotix.provider.config,blueprint:somethingElse,blueprint:blabla" />

          • 2. Re: Sharing property place holder between different bundles
            akhettar Newbie

            Hi Cluas

             

            Thank you the input. Tested the above suggestion and doesn't seem to work. Does the 'blueprint:somethingElse" need to be packed within the bundle? The idea is that to have an external property file named: somethingElse.cfg which will be attached to the container profile via git. We aim to define in somethingElse.cfg all the shared properties. Do we need to have a shared bundle with dummy blueprint and having all the shared properties defined in "properties.xml"?

             

            Thanks

             

            Ayache

            • 3. Re: Sharing property place holder between different bundles
              Claus Ibsen Master

              Profiles inherit (overlay) so if you want common .properties / .cfg then store that in a parent profile that all your containers extend.

              When using fabric then all is stored in the profiles. You have to think like that, and not think about that a file must be copied to the etc directory of karaf etc.

              • 4. Re: Sharing property place holder between different bundles
                akhettar Newbie

                Hi Claus

                 

                I understand what you mean. I have stored the shared resources properties in the parent profile but when I deploy the bundle - see extract of blueprint xml, I get an error: No component with id 'shared.resources.config' could be found.

                 

                <camelContext xmlns="http://camel.apache.org/schema/blueprint"

                                 id="provider"

                                  errorHandlerRef="errorHandler">

                        <!-- explicitly set properties locations in blueprint -->

                        <propertyPlaceholder id="properties" location="blueprint:bundle-1.config,blueprint:shared.resources.config" />

                 

                The error is telling the truth as the is no component referencing that property file or pid. I can try the classpath but the whole idea is to move shared properties into a file which can be shared by all the bundles. If I remove the reference of the second shared resource property file, the bundle get installed successfully but any changes made to the shared resource property file which is attached to the parent file is not replicated in the bundle,simply because it's not referencing a second source for the properties.

                There is a documentation here which shows how to source properties from two sources but to work both sources need to be available within the bundlehttp://fusesource.com/docs/router/2.8/eip/BasicPrinciples-PropPlaceholders.html#BasicPrinciples-PropPlaceholders-Blueprint

                 

                I understand the idea of attaching PID (which corresponds to the persistence-id of the properties.xml file defining the default value) to be able to override the default values the PID must somehow be referenced in the bundle. How are we going to refetene the PID which defines the shared properties? Apologies if I am repeating the same question.

                 

                Thanks

                 

                Ayache

                • 5. Re: Sharing property place holder between different bundles
                  akhettar Newbie

                  Just to benefit all. Fabric support property resolver through profile - Property Resolver | Fabric8 Documentation . Using profile property resolver doesn't require explicit references of the PID in the blueprint.xml.

                   

                  Ayache