Sounds fine for inclusion in Camel 2.19 onwards.

On Thu, Nov 3, 2016 at 1:30 PM, Luca Burgazzoli <lburgazz...@gmail.com> wrote:
> Hi everyone,
>
> I've been working on a blueprint based applications for soem weeks and
> I had to deal with a number of properties placeholders so I've used
> camel-properties and I found some issues/limitation for which I've
> raised the following JIRA:
>
> 1. CAMEL-10352: Optionally delegate to Aries PropertyEvaluator services
>    in BlueprintPropertiesParser
> 2. CAMEL-10393: Add an option to disable using default value if a
>    property does not exists
> 3. CAMEL-10417: Support adding location using child nodes of
>    propertyPlaceholder element
> 4. CAMEL-10419: Allow to individually set whether to silently ignore a
>    missing location
>
>
> CAMEL-10352 and CAMEL-10393 have already been merged and I've just
> completed the implementation of CAMEL-10417 and CAMEL-10419 which you
> can find in my fork:
>
>     https://github.com/lburgazzoli/apache-camel/tree/camel-properties
>
>
> Before merge it I'd like to have your opinion as there are some small
> changes about the XML configuration I'm going to highlight here:
>
> 1. As today, you can customize the property placeholders with the tag
>    propertyPlaceholder where the attribute location is mandatory and
>    that is fine untill you just want to register your own function in
>    blueprint which lead to something like that:
>
>    <propertyPlaceholder
>      id="myPropertyPlaceholder"
>      location="none"
>      ignoreMissingLocation="true">
>
>     <propertiesFunction ref="beerFunction"/>
>
>    </propertyPlaceholder>
>
>    So you may think that you have no locations set but that is not true
>    because by default camel-blueprint detects OSGi blueprint property
>    placeholders services and add them to the mix. Of course you can
>    disable such behavior but I found this a little bit confusing so I
>    made it not more mandatory (in fact that is the same behavior you'd
>    have if you define a PropertiesComponent bean instead of using the
>    propertyPlaceholder tag) and now you can now write it as:
>
>    <propertyPlaceholder id="myPropertyPlaceholder">
>     <propertiesFunction ref="beerFunction"/>
>    </propertyPlaceholder>
>
> 2. As today to add new properties placeholder locations you need to set
>    them with the location attribute using comma as separator and this
>    work just fine but it may result confusing if you need to deal with a
>    number of properties files. In addition you can't set which location
>    is required and which may be missing as the option to ignore missing
>    location is global so I've enhanced the propertyPlaceholder tag in a
>    way you can add locations as:
>
>    <propertyPlaceholder id="myPropertyPlaceholder">
>
>     <propertiesLocation
>       resolver = "classpath"
>       path     = "com/my/company/something/my-properties-1.properties"
>       optional = "false"/>
>
>     <propertiesLocation
>       resolver = "classpath"
>       path     = "com/my/company/something/my-properties-2.properties"
>       optional = "false"/>
>
>     <propertiesLocation
>       resolver = "file"
>       path     = "${karaf.home}/etc/my-override.properties"
>       optional = "true"/>
>
>    </propertyPlaceholder>
>
>    Note that the attribute resolver and optional are not mandatory and
>    have classpath and false as default value respectivley.
>
>    Of course setting locations via location attribute is still supported
>    and it has been enhanced to support additional attributes, i.e.:
>
>    <propertyPlaceholder
>        id="myPropertyPlaceholder"
>        location="file:${karaf.home}/etc/my.properties;optional=true"/>
>
>    Note that the locations defined by the propertiesLocation tag are
>    added to those defined in location attribute.
>
>
> Any objection/suggestion on such implementation ?
>
>
> Regards,
> Luca
>
> ---
> Luca Burgazzoli



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to