[ 
https://issues.apache.org/activemq/browse/CAMEL-1708?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52248#action_52248
 ] 

Stephen Gargan commented on CAMEL-1708:
---------------------------------------

Claus,

I can't really take credit, the scan framework lends itself nicely to 
extension. It's easy when its all laid out to begin with ;). 

Yeah, didn't mean to try and slip something in under the radar.  The test was 
failing on me for some reason. I took a quick look ad it seemed the routes were 
coming out in the reverse order so I added a little to grab it by name. I 
didn't figure it warranted its own patch, but I should have said it was 
attached.  I'll make the changes and upload a new patch.

I'd be happy to document it, just a couple of things; Where would you like it 
to go? How do you go about editing the confluence pages? Will my Jira 
credentials work?

thanks,

ste


> Allow for the selection of Routes during package scan using Ant like Path 
> matching
> ----------------------------------------------------------------------------------
>
>                 Key: CAMEL-1708
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1708
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-spring
>    Affects Versions: 2.0-M1
>            Reporter: Stephen Gargan
>         Attachments: patch.txt
>
>
> Attached is a patch to allow for Routes to be included and excluded using ant 
> like path patterns. Packages to be scanned are supplied as ususal, but 
> whether the Route classes discovered in these packages are included is now 
> also controlled by sets of include and exclude filters. 
> This mechanism is defined as a subelement of the CamelContext definition in 
> Spring context as follows. 
> <camelContext xmlns="http://camel.apache.org/schema/spring";>
>     <packageScan>
>       <packages>org.apache.camel.spring.config.scan</packages>
>       <exclude>**/*Excluded*</exclude>
>       <include>**/*Included*</include>
>     </packageScan>
>     ....
> </camelContext>
> It leverages Spring's AntPathMatcher to match fully qualified class names 
> against the supplied patterns. The existing <package></package> definition 
> has been deprecated and will emit a log message suggesting the new mechanism.
> This patch also includes code to allow Routes to be selectively excluded via 
> class matching at test time. i.e.
> public class RouteExcludingSpringTest extends SpringTestSupport {
>     @Override
>     protected AbstractXmlApplicationContext createApplicationContext() {
>         return new ClassPathXmlApplicationContext(new String[] 
> {"routes-context.xml"}, getRouteExcludingApplicationContext());
>     }
>     ....
>     @Override
>     protected Class excludeRoute() {
>         return MyExcludedRouteBuilder.class;
>     }
> }  
> I hope you can find this usefull. I'll be happy to make any changes you might 
> suggest.
> rgds,
> Stephen

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to