You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by AlanFoster <al...@alanfoster.me> on 2013/06/30 14:31:16 UTC
Xml schema RouteDefinition
Hi guys,
I'm just wondering if there are any technical reasons why a RouteDefinition
is allowed zero to unbounded occurrences of the `from` element;
>From the Schema for camel 2.10.0 -
<xs:complexType name="routeDefinition">
<xs:complexContent>
<xs:extension base="tns:processorDefinition">
<xs:sequence>
<xs:element ref="tns:from" minOccurs="0" maxOccurs="unbounded"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
......
</xs:choice>
</xs:sequence>
......
</xs:extension>
</xs:complexContent>
</xs:complexType>
We can see from the generated Schema that we are allowed a route that looks
like the following :
<route>
<log message="Hello World" />
</route>
But we will receive the following error if we try to run it
java.lang.IllegalArgumentException: Route has no inputs: Route[[] ->
[Log[hello World]]]
IE, can we add a required = true annotation to force a min-occurs = 1 in the
generated schema, or are there technical reasons why this isn't a good idea?
Cheers
--
View this message in context: http://camel.465427.n5.nabble.com/Xml-schema-RouteDefinition-tp5735010.html
Sent from the Camel Development mailing list archive at Nabble.com.
Re: Xml schema RouteDefinition
Posted by Charles Moulliard <ch...@gmail.com>.
And to avoid a bad design, it should be only = 1 and not 1..N
On Sun, Jun 30, 2013 at 3:08 PM, Claus Ibsen <cl...@gmail.com> wrote:
> Hi
>
> Yeah there is no reason why it can be 0. It should really be 1..n.
> Though 99% uses a single <from> in a route.
>
> So yeah if we can have the schema generated with 1 as minimum then
> that would be better.
>
> Feel free to log a JIRA and provide a patch.
>
> On 6/30/13, AlanFoster <al...@alanfoster.me> wrote:
> > Hi guys,
> >
> > I'm just wondering if there are any technical reasons why a
> RouteDefinition
> > is allowed zero to unbounded occurrences of the `from` element;
> >
> > From the Schema for camel 2.10.0 -
> >
> > <xs:complexType name="routeDefinition">
> > <xs:complexContent>
> > <xs:extension base="tns:processorDefinition">
> > <xs:sequence>
> > <xs:element ref="tns:from" minOccurs="0"
> maxOccurs="unbounded"/>
> > <xs:choice minOccurs="0" maxOccurs="unbounded">
> > ......
> > </xs:choice>
> > </xs:sequence>
> > ......
> > </xs:extension>
> > </xs:complexContent>
> > </xs:complexType>
> >
> > We can see from the generated Schema that we are allowed a route that
> looks
> > like the following :
> >
> > <route>
> > <log message="Hello World" />
> > </route>
> >
> > But we will receive the following error if we try to run it
> >
> > java.lang.IllegalArgumentException: Route has no inputs: Route[[] ->
> > [Log[hello World]]]
> >
> > IE, can we add a required = true annotation to force a min-occurs = 1 in
> > the
> > generated schema, or are there technical reasons why this isn't a good
> > idea?
> >
> > Cheers
> >
> >
> >
> > --
> > View this message in context:
> >
> http://camel.465427.n5.nabble.com/Xml-schema-RouteDefinition-tp5735010.html
> > Sent from the Camel Development mailing list archive at Nabble.com.
> >
>
>
> --
> Claus Ibsen
> -----------------
> www.camelone.org: The open source integration conference.
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Email: cibsen@redhat.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.blogspot.com
Re: Xml schema RouteDefinition
Posted by Claus Ibsen <cl...@gmail.com>.
Hi
Yeah there is no reason why it can be 0. It should really be 1..n.
Though 99% uses a single <from> in a route.
So yeah if we can have the schema generated with 1 as minimum then
that would be better.
Feel free to log a JIRA and provide a patch.
On 6/30/13, AlanFoster <al...@alanfoster.me> wrote:
> Hi guys,
>
> I'm just wondering if there are any technical reasons why a RouteDefinition
> is allowed zero to unbounded occurrences of the `from` element;
>
> From the Schema for camel 2.10.0 -
>
> <xs:complexType name="routeDefinition">
> <xs:complexContent>
> <xs:extension base="tns:processorDefinition">
> <xs:sequence>
> <xs:element ref="tns:from" minOccurs="0" maxOccurs="unbounded"/>
> <xs:choice minOccurs="0" maxOccurs="unbounded">
> ......
> </xs:choice>
> </xs:sequence>
> ......
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> We can see from the generated Schema that we are allowed a route that looks
> like the following :
>
> <route>
> <log message="Hello World" />
> </route>
>
> But we will receive the following error if we try to run it
>
> java.lang.IllegalArgumentException: Route has no inputs: Route[[] ->
> [Log[hello World]]]
>
> IE, can we add a required = true annotation to force a min-occurs = 1 in
> the
> generated schema, or are there technical reasons why this isn't a good
> idea?
>
> Cheers
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Xml-schema-RouteDefinition-tp5735010.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>
--
Claus Ibsen
-----------------
www.camelone.org: The open source integration conference.
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen