cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benson Margulies" <bimargul...@gmail.com>
Subject Re: CXF Spring Configuration and PropertyPlaceholderConfigurer
Date Sun, 14 Sep 2008 21:14:25 GMT
Christian,

Architecturally, Spring parses XML, with validation either on or off.
It parses it, then it expands the parameters on the parsed results.

Ideally, IMHO, this discussion should be happening on a Spring
discussion board: could Spring defer validation to post-parse?

I'm personally fuzzy as to whether there is an XSD validator that can
be applied to a DOM tree. If not, this is a hopeless cause.

After my experience in pushing fast-infoset into the picture, I could
probably come up with some scheme to do what you want here: parse,
expand, and validate, for the app contexts controlled directly by CXF.
Of course, when the user creates their own app context and then just
includes some CXF files and defines some beans, we can't help.

I don't know enough to offer any suggestions about the
ConnectionFactory, I'm sorry.

As is my usual habit, I'm going to wait to see the temperature of the
water that Dan throws before I decide whether to dig into this idea.

--benson




On Sun, Sep 14, 2008 at 5:07 PM, Christian Schneider
<chris@die-schneider.net> wrote:
> Do you have any idea how the problem with a spring bean reference to the
> ConnectionFactory can be solved in the xml config?
> I guess this is possible in spring but have not found any clues till now how
> to do it.
>
> Talking about validation. I think validation of Spring config files could be
> accomplished at compile time. Normally the configs
> are static and there is no need to validate them on each run. Tools like
> SpringIDE already do this.
>
> I understand that property replacement and validation do not fit well. But
> there must be a way to achieve this. A simple way would be to define
> all integer elements as string types. So the validation would still catch
> misspelled elements and attributes. But I do not like the fact that the
> generated java classes would then
> also only contain strings.
>
> What about the following: Use the current xsd to generate the Java classes.
> Then generate a new xsd from the original xsd that only defines strings then
> this xsd could be used to validate the config files.
> Would this help?
>
> Greetings
>
> Christian
>
>
> Benson Margulies schrieb:
>>
>> Both features are important. Catching typos with validation is
>> important, and property placeholders are important. Performance isn't
>> nothing either, and the only way I could think of to have both would
>> involve building an extra DOM tree, which would be slow.
>>
>> I am -1 for changing the default, but I'm not beyond persuasion of
>> many others think that validation is a hopeless goal in a
>> Spring-centric world.
>>
>>
>> On Sun, Sep 14, 2008 at 3:49 PM, Christian Schneider
>> <chris@die-schneider.net> wrote:
>>
>>>
>>> Hi Daniel,
>>>
>>> thanks for the hint. I will try this. I think the feature of replacing
>>> properties is extremely important for the cxf users. Can we trun off the
>>> validation by default?
>>> Another idea would be to do the validation after the properties have
>>> been replaced.
>>>
>>> I have got another question about the xml configuration. Is it possible
>>> to tell spring that an element is a reference to to a bean? I would like
>>> to add the functionality of referencing the
>>> ConnectionFactory to the address element. So people can define their
>>> factory locally or use springĀ“s jndi logic to look it up. Of course I
>>> could simply add a string type element and search for the Factory by
>>> hand but I would prefer to let spring do this work.
>>>
>>> Greetings
>>>
>>> Christian
>>>
>>>
>>> Daniel Kulp schrieb:
>>>
>>>>
>>>> Christian,
>>>>
>>>> I don't think it has anything to do with the
>>>> AbstractBeanDefinitionParser.
>>>>  It has to do with the schema validation that we turn on by default and
>>>> camel doesn't.    The schema validation occurs at XML parse time when
>>>> spring
>>>> is constructing the DOM.   This is long before any of the spring bean
>>>> processing.
>>>> The issue is types that aren't strings really don't validate with
>>>> properties.   For example, a <element name="timeout" type="int"/> won't
>>>> validate if it appears as:
>>>> <timeout>${cnfigured.timeout}</timeout>
>>>> in the xml file as that's not an int.
>>>>
>>>> If you turn off the schema validation, it will probably work for you.
>>>> Obviously, you have to make sure the xml is then valid yourself.  I
>>>> think it
>>>> would be -Dorg.apache.cxf.spring.validation.mode=VALIDATION_NONE
>>>>
>>>>
>>>>
>>>> Dan
>>>>
>>>>
>>>>
>>>>
>>>
>>> --
>>>
>>> Christian Schneider
>>> ---
>>> http://www.liquid-reality.de
>>>
>>>
>>>
>>>
>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>
Mime
View raw message