camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Why tokenize (and some others) does not support properties substitution?
Date Fri, 23 May 2014 13:24:58 GMT
Hi

Ah yeah we do not have support for @XmlAnyAttribute on the
ExpressionDefinition which is what the tokenizer etc is based upon.

So to support that we need to add that into the model, and also allow
org.apache.camel.model.ProcessorDefinition#resolvePropertyPlaceholders
to resolve from expressione definition too.

Feel free to log a JIRA.



On Fri, May 23, 2014 at 2:03 PM, carlo cancellieri
<c.cancellieri@proximainformatica.com> wrote:
> Claus,
>  I think so.
> If you kindly want to check here:
> https://github.com/ccancellieri/camel_poc/blob/master/src/main/resources/META-INF/spring/camel-context.xml#L79
> (at line 79) is commented out what I was trying to use (with no success).
> As you could see I'm using it in the file endpoint url and it works so
> there's no problem with file recognition.
>
> In the properties file I've:
> csv.row.group=2
> csv.row.delimiter=\n
>
> The error is:
> Exception in thread "main"
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line
> 79 in XML document from file
> [/home/carlo/work/code/java/camel_poc/target/classes/META-INF/spring/camel-context.xml]
> is invalid; nested exception is org.xml.sax.SAXParseException:
> cvc-complex-type.3.2.2: Attribute 'prop:token' is not allowed to appear in
> element 'tokenize'.
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
> at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
>  at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
> at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
>  at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
> at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
>  at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:243)
> at
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:127)
>  at
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:93)
> at
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
>  at
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
> at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
>  at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
> at
> org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:93)
>  at
> org.apache.camel.spring.Main.createDefaultApplicationContext(Main.java:204)
> at org.apache.camel.spring.Main.doStart(Main.java:156)
>  at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
> at org.apache.camel.main.MainSupport.run(MainSupport.java:147)
>  at org.apache.camel.main.MainSupport.run(MainSupport.java:351)
> at org.apache.camel.spring.Main.main(Main.java:89)
> Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute
> 'prop:token' is not allowed to appear in element 'tokenize'.
> at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
>  at
> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
> at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
>  at
> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
> at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:423)
>  at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3188)
> at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2665)
>  at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2072)
> at
> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:731)
>  at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
> at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2756)
>  at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
> at
> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
>  at
> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
> at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
>  at
> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
> at
> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
>  at
> com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:232)
> at
> com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
>  at
> org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
> at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
>  ... 19 more
>
> Cheers,
> Carlo
>
>
> 2014-05-23 13:52 GMT+02:00 Claus Ibsen <claus.ibsen@gmail.com>:
>
>> Hi
>>
>> Are you sure you do it correctly according to
>> http://camel.apache.org/using-propertyplaceholder.html
>>
>> On Fri, May 23, 2014 at 1:27 PM, carlo cancellieri
>> <c.cancellieri@proximainformatica.com> wrote:
>> > I'm using the master branch so I'm on 2.14-SNAPSHOT
>> >
>> >
>> > 2014-05-23 13:18 GMT+02:00 Claus Ibsen <claus.ibsen@gmail.com>:
>> >
>> >> What version of Camel do you use? And have you tried with latest
>> release.
>> >>
>> >> On Fri, May 23, 2014 at 1:17 PM, carlo cancellieri
>> >> <c.cancellieri@proximainformatica.com> wrote:
>> >> > Hi,
>> >> >  I'm trying to use the properties substitution in my tokenizer with
no
>> >> > success.
>> >> > I've also just seen that the camel-spring.xsd definition does not
>> >> declare:
>> >> >
>> >> >  <xs:anyAttribute namespace="##other" processContents="skip"/>
>> >> >
>> >> > In many complex types, so spring is not able to use the defined 'prop'
>> >> > namespace as prefix for the tokenizer and csv parser.
>> >> >
>> >> > This is my route and I'd like the substitute the 'csv.row.delimiter',
>> >> > 'csv.row.group' (in the tokenizer) and csv.row.delimiter (in the csv)
>> >> >
>> >> > <route>
>> >> >   <!-- ACTUALLY READ THE CSV stream -->
>> >> >   <from uri="seda:splitting" />
>> >> >    <split parallelProcessing="false" stopOnException="false"
>> >> > streaming="true">
>> >> >   <tokenize prop:token="csv.row.delimiter" prop:group="csv.row.group"
>> />
>> >> >     <unmarshal>
>> >> >  <csv autogenColumns="true" prop:delimiter="csv.row.delimiter"
>> >> >              skipFirstLine="false" useMaps="true"
>> configRef="csvConfig"
>> >> >              lazyLoad="false" />
>> >> >   </unmarshal>
>> >> >
>> >> >   <to uri="seda:processing" />
>> >> >   </split>
>> >> > </route>
>> >> >
>> >> > Is there a concrete need for this situation? If ther's not, you'll
>> >> consider
>> >> > to merge a contribution patch on this?
>> >> >
>> >> > Cheers,
>> >> > Carlo
>> >> >
>> >> > --
>> >> > Dott. Carlo Cancellieri
>> >> > *skype*: ccancellieri
>> >> > *Twitter*: @cancellieric
>> >> > *LinkedIn*: http://it.linkedin.com/in/ccancellieri/
>> >>
>> >>
>> >>
>> >> --
>> >> Claus Ibsen
>> >> -----------------
>> >> Red Hat, Inc.
>> >> Email: cibsen@redhat.com
>> >> Twitter: davsclaus
>> >> Blog: http://davsclaus.com
>> >> Author of Camel in Action: http://www.manning.com/ibsen
>> >> hawtio: http://hawt.io/
>> >> fabric8: http://fabric8.io/
>> >>
>> >
>> >
>> >
>> > --
>> > Dott. Carlo Cancellieri
>> > *skype*: ccancellieri
>> > *Twitter*: @cancellieric
>> > *LinkedIn*: http://it.linkedin.com/in/ccancellieri/
>>
>>
>>
>> --
>> Claus Ibsen
>> -----------------
>> Red Hat, Inc.
>> Email: cibsen@redhat.com
>> Twitter: davsclaus
>> Blog: http://davsclaus.com
>> Author of Camel in Action: http://www.manning.com/ibsen
>> hawtio: http://hawt.io/
>> fabric8: http://fabric8.io/
>>
>
>
>
> --
> Dott. Carlo Cancellieri
> *skype*: ccancellieri
> *Twitter*: @cancellieric
> *LinkedIn*: http://it.linkedin.com/in/ccancellieri/



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message