You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by James Strachan <ja...@gmail.com> on 2009/06/03 10:10:56 UTC

background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Hi Xueqiang!

2009/6/3 alloyer <al...@gmail.com>:
>
> Hi All,
> I am Xueqiang Mi and alloyer is my ID on mailing list and IRC. I am a
> student of China and major in middleware technologies.
> I have been starting my work for about one week. Now I am reading the XML
> rotue editor code and try to learn a overview of the implementation of
> camel-web component.

Here's a quick overview to help you dive into the code. Its basically
written using the JAX-RS specification; I'd recommend reading the
JAX-RS specificatio, the Jersey user guide
https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html

and looking at the various examples in Jersey to get your head around
this programming model. Its a great way to build web applications!
https://jersey.dev.java.net/

The neat thing is a single controller implementation then works for
building RESTful services (serving up XML, JSON, text, csv, DOT files
and so forth) as well as a HTML web application too. We're using
Jersey's support for Implicit Views which basically means for a
resource bean, a JSP file is found in webapp/$className/index.jsp.

(I'm considering porting the JSP/custom tags/JSTL/SiteMesh combination
over to use Lift templates which are way simpler and cleaner - but
thats another discussion and I probably won't get around to doing it
for a while).

Most of the heavy duty work then just takes place in the resource beans...
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/

for example here's how the endpoints are viewed and new ones posted
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/EndpointsResource.java

which is navigated to from the root URI
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java

see the use of @Path("endpoints") etc

You can browse the API of the resource beans automatically as
described here thanks to the WADL support in Jersey:
http://camel.apache.org/web-console.html

In terms of viewing/editing routes, this is all taken care of by this
resource...
https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java

see the @POST methods. So you could start if you like diving straight
into this class and hacking it to support other languages (it kinda
assumes XML payloads currently). The method is postRouteForm() which
takes a form encoded submission and extracts the String and currently
assumes its an XML payload. So we'd need some kind of field to denote
what language the user wants the route to be expressed in etc.

I hope that helps a little! Feel free to shoot any questions you have
on the WebConsole to this list!

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Posted by Jon Anstey <ja...@gmail.com>.
Great, good to know we don't another bug there :)

On Fri, Jun 5, 2009 at 10:46 PM, alloyer <al...@gmail.com> wrote:

>
> When i uses camel-web-standalone-2.0-20090407.095250-51.jar to deploy the
> camel-web app, it do insert an <interceptor> tag. But when I build it by
> myself to deploy, it just show me the natural configuration, which is much
> pretty. As you said, this may be caused by disabling the Bespin or other
> things.
>
>
> janstey wrote:
> >
> > Btw, I don't get that <interceptor> tag when I load up the route in the
> > editor... I get this
> >
> > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
> xmlns="
> > http://camel.apache.org/schema/spring">
> >     <description>This is an example route which you can start, stop and
> > modify</description>
> >     <from uri="seda:foo"/>
> >     <to uri="mock:results" id="to1"/>
> > </route>
> >
> > Xueqiang, did you build from the trunk?
> >
> > On Fri, Jun 5, 2009 at 5:25 AM, alloyer <al...@gmail.com> wrote:
> >
> >>
> >> Thanks to James.That's much helpful for my previous work, and I have
> read
> >> most of the Jersey User Guide page. With Willem's help, I have built the
> >> camel-web and the dependent modules into my workspace, it seems that I
> >> can
> >> start my lines of code just now.
> >> Here lists some issues I encountered:
> >> 1. I will use the same editor for Groovy route editing support. When I
> >> try
> >> the XML editor, I found the route schema in the editor is a little
> >> different
> >> from the usual format in route configuration file based on spring. For
> >> instance, in configuration file, the route is as follows:
> >> <camelContext xmlns="http://camel.apache.org/schema/spring">
> >>    <route>
> >>      <description>This is an example route which you can start, stop and
> >> modify</description>
> >>
> >>      <from uri="seda:foo"/>
> >>      <to uri="mock:results"/>
> >>    </route>
> >> </camelContext>
> >> But in the editor, it appears like:
> >> <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
> >> xmlns="http://camel.apache.org/schema/spring">
> >>    <description>This is an example route which you can start, stop and
> >> modify</description>
> >>    <from uri="seda:foo"/>
> >>    <interceptor>
> >>
> >>        <to uri="mock:results" id="to1"/>
> >>    </interceptor>
> >> </route>
> >> Why are they defferent and how to do the translation ?
> >>
> >> 2. There are lots of java script in camel-web module, I want to get some
> >> suggestion to understand or work with them. Are they from some open
> >> source
> >> js tools?
> >>
> >> Thanks,:jumping:
> >>
> >>
> >>
> >> James.Strachan wrote:
> >> >
> >> > Hi Xueqiang!
> >> >
> >> > 2009/6/3 alloyer <al...@gmail.com>:
> >> >>
> >> >> Hi All,
> >> >> I am Xueqiang Mi and alloyer is my ID on mailing list and IRC. I am a
> >> >> student of China and major in middleware technologies.
> >> >> I have been starting my work for about one week. Now I am reading the
> >> XML
> >> >> rotue editor code and try to learn a overview of the implementation
> of
> >> >> camel-web component.
> >> >
> >> > Here's a quick overview to help you dive into the code. Its basically
> >> > written using the JAX-RS specification; I'd recommend reading the
> >> > JAX-RS specificatio, the Jersey user guide
> >> > https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html
> >> >
> >> > and looking at the various examples in Jersey to get your head around
> >> > this programming model. Its a great way to build web applications!
> >> > https://jersey.dev.java.net/
> >> >
> >> > The neat thing is a single controller implementation then works for
> >> > building RESTful services (serving up XML, JSON, text, csv, DOT files
> >> > and so forth) as well as a HTML web application too. We're using
> >> > Jersey's support for Implicit Views which basically means for a
> >> > resource bean, a JSP file is found in webapp/$className/index.jsp.
> >> >
> >> > (I'm considering porting the JSP/custom tags/JSTL/SiteMesh combination
> >> > over to use Lift templates which are way simpler and cleaner - but
> >> > thats another discussion and I probably won't get around to doing it
> >> > for a while).
> >> >
> >> > Most of the heavy duty work then just takes place in the resource
> >> beans...
> >> >
> >>
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/
> >> >
> >> > for example here's how the endpoints are viewed and new ones posted
> >> >
> >>
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/EndpointsResource.java
> >> >
> >> > which is navigated to from the root URI
> >> >
> >>
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java
> >> >
> >> > see the use of @Path("endpoints") etc
> >> >
> >> > You can browse the API of the resource beans automatically as
> >> > described here thanks to the WADL support in Jersey:
> >> > http://camel.apache.org/web-console.html
> >> >
> >> > In terms of viewing/editing routes, this is all taken care of by this
> >> > resource...
> >> >
> >>
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java
> >> >
> >> > see the @POST methods. So you could start if you like diving straight
> >> > into this class and hacking it to support other languages (it kinda
> >> > assumes XML payloads currently). The method is postRouteForm() which
> >> > takes a form encoded submission and extracts the String and currently
> >> > assumes its an XML payload. So we'd need some kind of field to denote
> >> > what language the user wants the route to be expressed in etc.
> >> >
> >> > I hope that helps a little! Feel free to shoot any questions you have
> >> > on the WebConsole to this list!
> >> >
> >> > --
> >> > James
> >> > -------
> >> > http://macstrac.blogspot.com/
> >> >
> >> > Open Source Integration
> >> > http://fusesource.com/
> >> >
> >> >
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/background-on-the-Web-Console-codebase-%28was-Re%3A--jira--Work-started%3A--%28CAMEL-1655%29-Groovy-Route-Editor-for-WebConsole-tp23847302p23883812.html
> >> Sent from the Camel Development mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > Cheers,
> > Jon
> >
> > http://janstey.blogspot.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/background-on-the-Web-Console-codebase-%28was-Re%3A--jira--Work-started%3A--%28CAMEL-1655%29-Groovy-Route-Editor-for-WebConsole-tp23847302p23897733.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

http://janstey.blogspot.com/

Re: background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Posted by alloyer <al...@gmail.com>.
When i uses camel-web-standalone-2.0-20090407.095250-51.jar to deploy the
camel-web app, it do insert an <interceptor> tag. But when I build it by
myself to deploy, it just show me the natural configuration, which is much
pretty. As you said, this may be caused by disabling the Bespin or other
things.


janstey wrote:
> 
> Btw, I don't get that <interceptor> tag when I load up the route in the
> editor... I get this
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="
> http://camel.apache.org/schema/spring">
>     <description>This is an example route which you can start, stop and
> modify</description>
>     <from uri="seda:foo"/>
>     <to uri="mock:results" id="to1"/>
> </route>
> 
> Xueqiang, did you build from the trunk?
> 
> On Fri, Jun 5, 2009 at 5:25 AM, alloyer <al...@gmail.com> wrote:
> 
>>
>> Thanks to James.That's much helpful for my previous work, and I have read
>> most of the Jersey User Guide page. With Willem's help, I have built the
>> camel-web and the dependent modules into my workspace, it seems that I
>> can
>> start my lines of code just now.
>> Here lists some issues I encountered:
>> 1. I will use the same editor for Groovy route editing support. When I
>> try
>> the XML editor, I found the route schema in the editor is a little
>> different
>> from the usual format in route configuration file based on spring. For
>> instance, in configuration file, the route is as follows:
>> <camelContext xmlns="http://camel.apache.org/schema/spring">
>>    <route>
>>      <description>This is an example route which you can start, stop and
>> modify</description>
>>
>>      <from uri="seda:foo"/>
>>      <to uri="mock:results"/>
>>    </route>
>> </camelContext>
>> But in the editor, it appears like:
>> <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
>> xmlns="http://camel.apache.org/schema/spring">
>>    <description>This is an example route which you can start, stop and
>> modify</description>
>>    <from uri="seda:foo"/>
>>    <interceptor>
>>
>>        <to uri="mock:results" id="to1"/>
>>    </interceptor>
>> </route>
>> Why are they defferent and how to do the translation ?
>>
>> 2. There are lots of java script in camel-web module, I want to get some
>> suggestion to understand or work with them. Are they from some open
>> source
>> js tools?
>>
>> Thanks,:jumping:
>>
>>
>>
>> James.Strachan wrote:
>> >
>> > Hi Xueqiang!
>> >
>> > 2009/6/3 alloyer <al...@gmail.com>:
>> >>
>> >> Hi All,
>> >> I am Xueqiang Mi and alloyer is my ID on mailing list and IRC. I am a
>> >> student of China and major in middleware technologies.
>> >> I have been starting my work for about one week. Now I am reading the
>> XML
>> >> rotue editor code and try to learn a overview of the implementation of
>> >> camel-web component.
>> >
>> > Here's a quick overview to help you dive into the code. Its basically
>> > written using the JAX-RS specification; I'd recommend reading the
>> > JAX-RS specificatio, the Jersey user guide
>> > https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html
>> >
>> > and looking at the various examples in Jersey to get your head around
>> > this programming model. Its a great way to build web applications!
>> > https://jersey.dev.java.net/
>> >
>> > The neat thing is a single controller implementation then works for
>> > building RESTful services (serving up XML, JSON, text, csv, DOT files
>> > and so forth) as well as a HTML web application too. We're using
>> > Jersey's support for Implicit Views which basically means for a
>> > resource bean, a JSP file is found in webapp/$className/index.jsp.
>> >
>> > (I'm considering porting the JSP/custom tags/JSTL/SiteMesh combination
>> > over to use Lift templates which are way simpler and cleaner - but
>> > thats another discussion and I probably won't get around to doing it
>> > for a while).
>> >
>> > Most of the heavy duty work then just takes place in the resource
>> beans...
>> >
>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/
>> >
>> > for example here's how the endpoints are viewed and new ones posted
>> >
>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/EndpointsResource.java
>> >
>> > which is navigated to from the root URI
>> >
>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java
>> >
>> > see the use of @Path("endpoints") etc
>> >
>> > You can browse the API of the resource beans automatically as
>> > described here thanks to the WADL support in Jersey:
>> > http://camel.apache.org/web-console.html
>> >
>> > In terms of viewing/editing routes, this is all taken care of by this
>> > resource...
>> >
>> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java
>> >
>> > see the @POST methods. So you could start if you like diving straight
>> > into this class and hacking it to support other languages (it kinda
>> > assumes XML payloads currently). The method is postRouteForm() which
>> > takes a form encoded submission and extracts the String and currently
>> > assumes its an XML payload. So we'd need some kind of field to denote
>> > what language the user wants the route to be expressed in etc.
>> >
>> > I hope that helps a little! Feel free to shoot any questions you have
>> > on the WebConsole to this list!
>> >
>> > --
>> > James
>> > -------
>> > http://macstrac.blogspot.com/
>> >
>> > Open Source Integration
>> > http://fusesource.com/
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/background-on-the-Web-Console-codebase-%28was-Re%3A--jira--Work-started%3A--%28CAMEL-1655%29-Groovy-Route-Editor-for-WebConsole-tp23847302p23883812.html
>> Sent from the Camel Development mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> Cheers,
> Jon
> 
> http://janstey.blogspot.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/background-on-the-Web-Console-codebase-%28was-Re%3A--jira--Work-started%3A--%28CAMEL-1655%29-Groovy-Route-Editor-for-WebConsole-tp23847302p23897733.html
Sent from the Camel Development mailing list archive at Nabble.com.


Re: background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Posted by Jon Anstey <ja...@gmail.com>.
Btw, I don't get that <interceptor> tag when I load up the route in the
editor... I get this

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<route id="route1" xmlns:ns2="http://camel.apache.org/schema/web" xmlns="
http://camel.apache.org/schema/spring">
    <description>This is an example route which you can start, stop and
modify</description>
    <from uri="seda:foo"/>
    <to uri="mock:results" id="to1"/>
</route>

Xueqiang, did you build from the trunk?

On Fri, Jun 5, 2009 at 5:25 AM, alloyer <al...@gmail.com> wrote:

>
> Thanks to James.That's much helpful for my previous work, and I have read
> most of the Jersey User Guide page. With Willem's help, I have built the
> camel-web and the dependent modules into my workspace, it seems that I can
> start my lines of code just now.
> Here lists some issues I encountered:
> 1. I will use the same editor for Groovy route editing support. When I try
> the XML editor, I found the route schema in the editor is a little
> different
> from the usual format in route configuration file based on spring. For
> instance, in configuration file, the route is as follows:
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>    <route>
>      <description>This is an example route which you can start, stop and
> modify</description>
>
>      <from uri="seda:foo"/>
>      <to uri="mock:results"/>
>    </route>
> </camelContext>
> But in the editor, it appears like:
> <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
> xmlns="http://camel.apache.org/schema/spring">
>    <description>This is an example route which you can start, stop and
> modify</description>
>    <from uri="seda:foo"/>
>    <interceptor>
>
>        <to uri="mock:results" id="to1"/>
>    </interceptor>
> </route>
> Why are they defferent and how to do the translation ?
>
> 2. There are lots of java script in camel-web module, I want to get some
> suggestion to understand or work with them. Are they from some open source
> js tools?
>
> Thanks,:jumping:
>
>
>
> James.Strachan wrote:
> >
> > Hi Xueqiang!
> >
> > 2009/6/3 alloyer <al...@gmail.com>:
> >>
> >> Hi All,
> >> I am Xueqiang Mi and alloyer is my ID on mailing list and IRC. I am a
> >> student of China and major in middleware technologies.
> >> I have been starting my work for about one week. Now I am reading the
> XML
> >> rotue editor code and try to learn a overview of the implementation of
> >> camel-web component.
> >
> > Here's a quick overview to help you dive into the code. Its basically
> > written using the JAX-RS specification; I'd recommend reading the
> > JAX-RS specificatio, the Jersey user guide
> > https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html
> >
> > and looking at the various examples in Jersey to get your head around
> > this programming model. Its a great way to build web applications!
> > https://jersey.dev.java.net/
> >
> > The neat thing is a single controller implementation then works for
> > building RESTful services (serving up XML, JSON, text, csv, DOT files
> > and so forth) as well as a HTML web application too. We're using
> > Jersey's support for Implicit Views which basically means for a
> > resource bean, a JSP file is found in webapp/$className/index.jsp.
> >
> > (I'm considering porting the JSP/custom tags/JSTL/SiteMesh combination
> > over to use Lift templates which are way simpler and cleaner - but
> > thats another discussion and I probably won't get around to doing it
> > for a while).
> >
> > Most of the heavy duty work then just takes place in the resource
> beans...
> >
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/
> >
> > for example here's how the endpoints are viewed and new ones posted
> >
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/EndpointsResource.java
> >
> > which is navigated to from the root URI
> >
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java
> >
> > see the use of @Path("endpoints") etc
> >
> > You can browse the API of the resource beans automatically as
> > described here thanks to the WADL support in Jersey:
> > http://camel.apache.org/web-console.html
> >
> > In terms of viewing/editing routes, this is all taken care of by this
> > resource...
> >
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java
> >
> > see the @POST methods. So you could start if you like diving straight
> > into this class and hacking it to support other languages (it kinda
> > assumes XML payloads currently). The method is postRouteForm() which
> > takes a form encoded submission and extracts the String and currently
> > assumes its an XML payload. So we'd need some kind of field to denote
> > what language the user wants the route to be expressed in etc.
> >
> > I hope that helps a little! Feel free to shoot any questions you have
> > on the WebConsole to this list!
> >
> > --
> > James
> > -------
> > http://macstrac.blogspot.com/
> >
> > Open Source Integration
> > http://fusesource.com/
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/background-on-the-Web-Console-codebase-%28was-Re%3A--jira--Work-started%3A--%28CAMEL-1655%29-Groovy-Route-Editor-for-WebConsole-tp23847302p23883812.html
> Sent from the Camel Development mailing list archive at Nabble.com.
>
>


-- 
Cheers,
Jon

http://janstey.blogspot.com/

Re: background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Posted by Jon Anstey <ja...@gmail.com>.
On Fri, Jun 5, 2009 at 6:50 AM, James Strachan <ja...@gmail.com>wrote:

> 2009/6/5 alloyer <al...@gmail.com>:
> >
> > Thanks to James.That's much helpful for my previous work, and I have read
> > most of the Jersey User Guide page. With Willem's help, I have built the
> > camel-web and the dependent modules into my workspace, it seems that I
> can
> > start my lines of code just now.
> > Here lists some issues I encountered:
> > 1. I will use the same editor for Groovy route editing support. When I
> try
> > the XML editor, I found the route schema in the editor is a little
> different
> > from the usual format in route configuration file based on spring. For
> > instance, in configuration file, the route is as follows:
> > <camelContext xmlns="http://camel.apache.org/schema/spring">
> >    <route>
> >      <description>This is an example route which you can start, stop and
> > modify</description>
> >
> >      <from uri="seda:foo"/>
> >      <to uri="mock:results"/>
> >    </route>
> > </camelContext>
> > But in the editor, it appears like:
> > <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
> > xmlns="http://camel.apache.org/schema/spring">
> >    <description>This is an example route which you can start, stop and
> > modify</description>
> >    <from uri="seda:foo"/>
> >    <interceptor>
> >
> >        <to uri="mock:results" id="to1"/>
> >    </interceptor>
> > </route>
> > Why are they defferent and how to do the translation ?
>
> I've never yet managed to figure that out! :)
>
> We're just grabbing the Route definitions from the CamelContext and
> turning them to XML with JAXB - no idea why they get mangled!
>
> The code that turns them to XML is RouteResource.getRouteXml() and the
> RouteDefinition is extracted from the CamelContext by the
> RoutesResource class in getRoute(String id).
>
> We should maybe dump more of the RouteDefinitions to XML from the test
> cases in org.apache.camel.processor in camel-core to see if its a
> common issue; the AST of the routes is being mangled somehow?
>
>
> > 2. There are lots of java script in camel-web module, I want to get some
> > suggestion to understand or work with them. Are they from some open
> source
> > js tools?
>
> We're just using Bespin
> https://bespin.mozilla.com/
>
> ideally, Bespin would be available as a tarball then we'd not need to
> shove a ton of JS files in our source tree and at build time we could
> just include Bespin inside the web app - or even load Bespin remotely
> from the web maybe (though that would not work too well in places
> where folks lock down the internet).
>
> Basically Bespin should pretty much be a black box - we shouldn't need
> to touch it; other than the link to the JS code in the
> RouteResource/edit.jsp template which AFAIK is the only place any of
> Bespin (or all that JS) is used - other than the JS used in the
> template (decorators/main.jsp) which is mostly just used for table
> sorting.


About Bespin... its actually disabled for now because it was actually
mangling the route XML itself! We are using a simple textarea right now to
enter route text, which is pretty easy to understand :)


>
>
> --
> James
> -------
> http://macstrac.blogspot.com/
>
> Open Source Integration
> http://fusesource.com/
>



-- 
Cheers,
Jon

http://janstey.blogspot.com/

Re: background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Posted by James Strachan <ja...@gmail.com>.
2009/6/5 alloyer <al...@gmail.com>:
>
> Thanks to James.That's much helpful for my previous work, and I have read
> most of the Jersey User Guide page. With Willem's help, I have built the
> camel-web and the dependent modules into my workspace, it seems that I can
> start my lines of code just now.
> Here lists some issues I encountered:
> 1. I will use the same editor for Groovy route editing support. When I try
> the XML editor, I found the route schema in the editor is a little different
> from the usual format in route configuration file based on spring. For
> instance, in configuration file, the route is as follows:
> <camelContext xmlns="http://camel.apache.org/schema/spring">
>    <route>
>      <description>This is an example route which you can start, stop and
> modify</description>
>
>      <from uri="seda:foo"/>
>      <to uri="mock:results"/>
>    </route>
> </camelContext>
> But in the editor, it appears like:
> <route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
> xmlns="http://camel.apache.org/schema/spring">
>    <description>This is an example route which you can start, stop and
> modify</description>
>    <from uri="seda:foo"/>
>    <interceptor>
>
>        <to uri="mock:results" id="to1"/>
>    </interceptor>
> </route>
> Why are they defferent and how to do the translation ?

I've never yet managed to figure that out! :)

We're just grabbing the Route definitions from the CamelContext and
turning them to XML with JAXB - no idea why they get mangled!

The code that turns them to XML is RouteResource.getRouteXml() and the
RouteDefinition is extracted from the CamelContext by the
RoutesResource class in getRoute(String id).

We should maybe dump more of the RouteDefinitions to XML from the test
cases in org.apache.camel.processor in camel-core to see if its a
common issue; the AST of the routes is being mangled somehow?


> 2. There are lots of java script in camel-web module, I want to get some
> suggestion to understand or work with them. Are they from some open source
> js tools?

We're just using Bespin
https://bespin.mozilla.com/

ideally, Bespin would be available as a tarball then we'd not need to
shove a ton of JS files in our source tree and at build time we could
just include Bespin inside the web app - or even load Bespin remotely
from the web maybe (though that would not work too well in places
where folks lock down the internet).

Basically Bespin should pretty much be a black box - we shouldn't need
to touch it; other than the link to the JS code in the
RouteResource/edit.jsp template which AFAIK is the only place any of
Bespin (or all that JS) is used - other than the JS used in the
template (decorators/main.jsp) which is mostly just used for table
sorting.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://fusesource.com/

Re: background on the Web Console codebase (was Re: [jira] Work started: (CAMEL-1655) Groovy Route Editor for WebConsole

Posted by alloyer <al...@gmail.com>.
Thanks to James.That's much helpful for my previous work, and I have read
most of the Jersey User Guide page. With Willem's help, I have built the
camel-web and the dependent modules into my workspace, it seems that I can
start my lines of code just now.
Here lists some issues I encountered:
1. I will use the same editor for Groovy route editing support. When I try
the XML editor, I found the route schema in the editor is a little different
from the usual format in route configuration file based on spring. For
instance, in configuration file, the route is as follows:
<camelContext xmlns="http://camel.apache.org/schema/spring">
    <route>
      <description>This is an example route which you can start, stop and
modify</description>
      
      <from uri="seda:foo"/>
      <to uri="mock:results"/>
    </route>
</camelContext>
But in the editor, it appears like:
<route id="route1" xmlns:ns2="http://camel.apache.org/schema/web"
xmlns="http://camel.apache.org/schema/spring">
    <description>This is an example route which you can start, stop and
modify</description>
    <from uri="seda:foo"/>
    <interceptor>

        <to uri="mock:results" id="to1"/>
    </interceptor>
</route>
Why are they defferent and how to do the translation ?

2. There are lots of java script in camel-web module, I want to get some
suggestion to understand or work with them. Are they from some open source
js tools?

Thanks,:jumping:



James.Strachan wrote:
> 
> Hi Xueqiang!
> 
> 2009/6/3 alloyer <al...@gmail.com>:
>>
>> Hi All,
>> I am Xueqiang Mi and alloyer is my ID on mailing list and IRC. I am a
>> student of China and major in middleware technologies.
>> I have been starting my work for about one week. Now I am reading the XML
>> rotue editor code and try to learn a overview of the implementation of
>> camel-web component.
> 
> Here's a quick overview to help you dive into the code. Its basically
> written using the JAX-RS specification; I'd recommend reading the
> JAX-RS specificatio, the Jersey user guide
> https://jersey.dev.java.net/documentation/1.1.0-ea/user-guide.html
> 
> and looking at the various examples in Jersey to get your head around
> this programming model. Its a great way to build web applications!
> https://jersey.dev.java.net/
> 
> The neat thing is a single controller implementation then works for
> building RESTful services (serving up XML, JSON, text, csv, DOT files
> and so forth) as well as a HTML web application too. We're using
> Jersey's support for Implicit Views which basically means for a
> resource bean, a JSP file is found in webapp/$className/index.jsp.
> 
> (I'm considering porting the JSP/custom tags/JSTL/SiteMesh combination
> over to use Lift templates which are way simpler and cleaner - but
> thats another discussion and I probably won't get around to doing it
> for a while).
> 
> Most of the heavy duty work then just takes place in the resource beans...
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/
> 
> for example here's how the endpoints are viewed and new ones posted
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/EndpointsResource.java
> 
> which is navigated to from the root URI
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/CamelContextResource.java
> 
> see the use of @Path("endpoints") etc
> 
> You can browse the API of the resource beans automatically as
> described here thanks to the WADL support in Jersey:
> http://camel.apache.org/web-console.html
> 
> In terms of viewing/editing routes, this is all taken care of by this
> resource...
> https://svn.apache.org/repos/asf/camel/trunk/components/camel-web/src/main/java/org/apache/camel/web/resources/RouteResource.java
> 
> see the @POST methods. So you could start if you like diving straight
> into this class and hacking it to support other languages (it kinda
> assumes XML payloads currently). The method is postRouteForm() which
> takes a form encoded submission and extracts the String and currently
> assumes its an XML payload. So we'd need some kind of field to denote
> what language the user wants the route to be expressed in etc.
> 
> I hope that helps a little! Feel free to shoot any questions you have
> on the WebConsole to this list!
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://fusesource.com/
> 
> 

-- 
View this message in context: http://www.nabble.com/background-on-the-Web-Console-codebase-%28was-Re%3A--jira--Work-started%3A--%28CAMEL-1655%29-Groovy-Route-Editor-for-WebConsole-tp23847302p23883812.html
Sent from the Camel Development mailing list archive at Nabble.com.