[DISCUSS] XML & Property placeholders

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[DISCUSS] XML & Property placeholders

Guillaume Nodet-2
I've been looking at property placeholders in our xml DSL. There are some
inconsistencies I'd like to fix for 3.1.

The main problem is that we have 2 different ways that have been introduced
to support property placeholders for non string properties:
  * the first one is to change the type of the fields to be strings instead
of int / long / booleans. A good example is the RedeliveryPolicyDefinition
[1] which have tons of string typed fields parsed to int / long / booleans
during the reification process
  * a second one is the support of the OtherAttributesAware interface as
described in the documentation [2]

The downside of the first method is that we loose the type information in
the XML schema but this is easy for users.
The second way allows keeping this type information, but forces the use of
a different namespace which provides no schema at all.
I've been experimenting a middle ground solution where we can
slightly modify the schema and use user-defined xml type which would give
some type information while still allowing any string to be used, but I
don't really think this will help completion a lot.

I'm not really what's the best way here, but it seems to me that the
current state is a bit inconsistent and should be fixed.

Thoughts ?

[1]
https://github.com/apache/camel/blob/master/core/camel-core-engine/src/main/java/org/apache/camel/model/RedeliveryPolicyDefinition.java
[2]
https://camel.apache.org/manual/latest/using-propertyplaceholder.html#UsingPropertyPlaceholder-UsingPropertyPlaceholdersforAnyKindofAttributeintheXMLDSL

--
------------------------
Guillaume Nodet
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] XML & Property placeholders

Zoran Regvart-2
Hi Guillaume,
would it make sense to use union types[1] in the schema and use strict
type in the Java code? We can impose restrictions on the string XML
schema type definition that the value needs to resemble a placeholder
syntax.

zoran

[1] https://www.w3.org/TR/xmlschema11-2/#union-datatypes

On Fri, Nov 22, 2019 at 11:22 AM Guillaume Nodet <[hidden email]> wrote:

>
> I've been looking at property placeholders in our xml DSL. There are some
> inconsistencies I'd like to fix for 3.1.
>
> The main problem is that we have 2 different ways that have been introduced
> to support property placeholders for non string properties:
>   * the first one is to change the type of the fields to be strings instead
> of int / long / booleans. A good example is the RedeliveryPolicyDefinition
> [1] which have tons of string typed fields parsed to int / long / booleans
> during the reification process
>   * a second one is the support of the OtherAttributesAware interface as
> described in the documentation [2]
>
> The downside of the first method is that we loose the type information in
> the XML schema but this is easy for users.
> The second way allows keeping this type information, but forces the use of
> a different namespace which provides no schema at all.
> I've been experimenting a middle ground solution where we can
> slightly modify the schema and use user-defined xml type which would give
> some type information while still allowing any string to be used, but I
> don't really think this will help completion a lot.
>
> I'm not really what's the best way here, but it seems to me that the
> current state is a bit inconsistent and should be fixed.
>
> Thoughts ?
>
> [1]
> https://github.com/apache/camel/blob/master/core/camel-core-engine/src/main/java/org/apache/camel/model/RedeliveryPolicyDefinition.java
> [2]
> https://camel.apache.org/manual/latest/using-propertyplaceholder.html#UsingPropertyPlaceholder-UsingPropertyPlaceholdersforAnyKindofAttributeintheXMLDSL
>
> --
> ------------------------
> Guillaume Nodet



--
Zoran Regvart
Reply | Threaded
Open this post in threaded view
|

Re: [DISCUSS] XML & Property placeholders

Claus Ibsen-2
In reply to this post by Guillaume Nodet-2
Hi

I think we should make all the types String and then include in the
xml schema documentation what target type it is.
This allows full flexibility and XML is text anyway.

The other namespace is a "clever hack" and its ugly. So it would be
better to get rid of that too in the same go.


On Fri, Nov 22, 2019 at 11:22 AM Guillaume Nodet <[hidden email]> wrote:

>
> I've been looking at property placeholders in our xml DSL. There are some
> inconsistencies I'd like to fix for 3.1.
>
> The main problem is that we have 2 different ways that have been introduced
> to support property placeholders for non string properties:
>   * the first one is to change the type of the fields to be strings instead
> of int / long / booleans. A good example is the RedeliveryPolicyDefinition
> [1] which have tons of string typed fields parsed to int / long / booleans
> during the reification process
>   * a second one is the support of the OtherAttributesAware interface as
> described in the documentation [2]
>
> The downside of the first method is that we loose the type information in
> the XML schema but this is easy for users.
> The second way allows keeping this type information, but forces the use of
> a different namespace which provides no schema at all.
> I've been experimenting a middle ground solution where we can
> slightly modify the schema and use user-defined xml type which would give
> some type information while still allowing any string to be used, but I
> don't really think this will help completion a lot.
>
> I'm not really what's the best way here, but it seems to me that the
> current state is a bit inconsistent and should be fixed.
>
> Thoughts ?
>
> [1]
> https://github.com/apache/camel/blob/master/core/camel-core-engine/src/main/java/org/apache/camel/model/RedeliveryPolicyDefinition.java
> [2]
> https://camel.apache.org/manual/latest/using-propertyplaceholder.html#UsingPropertyPlaceholder-UsingPropertyPlaceholdersforAnyKindofAttributeintheXMLDSL
>
> --
> ------------------------
> Guillaume Nodet



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