You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2008/12/17 15:25:04 UTC

svn commit: r727389 - in /activemq/camel/branches/camel-1.x: ./ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/test/java/org/apache/camel/processor/ components/camel-mina/src/test/java/org/apache/camel/component/mina/ examples/camel-ex...

Author: ningjiang
Date: Wed Dec 17 06:25:03 2008
New Revision: 727389

URL: http://svn.apache.org/viewvc?rev=727389&view=rev
Log:
Merged revisions 727375 via svnmerge from 
https://svn.apache.org/repos/asf/activemq/camel/trunk

........
  r727375 | ningjiang | 2008-12-17 21:27:14 +0800 (Wed, 17 Dec 2008) | 1 line
  
  CAMEL-1192  Better fluent API supporting in the core module
........

Modified:
    activemq/camel/branches/camel-1.x/   (props changed)
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SetExchangePatternType.java
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SplitterType.java
    activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java
    activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMCustomCodecTest.java   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMFileTcpTest.java   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTextlineProtocolTest.java   (props changed)
    activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTransferExchangeOptionTest.java   (props changed)
    activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java
    activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Dec 17 06:25:03 2008
@@ -1 +1 @@
-/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612,725652-725660,726640-726645,726932,727113
+/activemq/camel/trunk:709850,711200,711206,711219-711220,711523,711531,711756,711784,711859,711874,711962,711971,712064,712119,712148,712662,712692,712925,713013,713107,713136,713273,713290,713292,713295,713314,713475,713625,713932,713944,714032,717965,717989,718242,718273,718312-718515,719163-719184,719334,719339,719524,719662,719848,719851,719855,719864,719978-719979,720207,720435-720437,720806,721272,721331,721333-721334,721360,721669,721764,721813,721985,722005,722070,722110,722415,722438,722726,722845,722878,723264,723314,723325-723327,723409,723835,723966,724122,724619,724681,725040,725309-725320,725340,725351,725569-725572,725612,725652-725660,726640-726645,726932,727113,727375

Propchange: activemq/camel/branches/camel-1.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/MulticastType.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/MulticastType.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/MulticastType.java (original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/MulticastType.java Wed Dec 17 06:25:03 2008
@@ -66,6 +66,45 @@
         return createOutputsProcessor(routeContext);
     }
 
+    // Fluent API
+    // -------------------------------------------------------------------------
+    /**
+     * Set the multicasting aggregationStrategy
+     * @param aggregationStrategy 
+     *
+     * @return the builder
+     */
+    public MulticastType aggregationStrategy(AggregationStrategy aggregationStrategy) {
+        setAggregationStrategy(aggregationStrategy);
+        return this;
+    }
+    
+    /**
+     * Set the multicasting action's thread model
+     * @param parallelProcessing 
+     * if it is true the Splitter will use a thread pool to do the multicasting work; 
+     * if it is false the Splitter only do the multicasting work in the calling thread.
+     *
+     * @return the builder
+     */
+    public MulticastType parallelProcessing(boolean parallelProcessing) {
+        setParallelProcessing(parallelProcessing);
+        return this;
+    }
+    
+    /**
+     * Setting the executor for executing the multicasting action.
+     *   
+     * @param executor , it should be a instance of ThreadPoolExcutor
+     * NOTE in Camel 2.0 , it will change to use the instance which implements Executor interface
+     *
+     * @return the builder
+     */
+    public MulticastType executor(ThreadPoolExecutor executor) {
+        setThreadPoolExecutor(executor);
+        return this;
+    }
+    
     protected Processor createCompositeProcessor(RouteContext routeContext, List<Processor> list) {
         if (aggregationStrategy == null && strategyRef != null) {
             aggregationStrategy = routeContext.lookup(strategyRef, AggregationStrategy.class);
@@ -82,28 +121,26 @@
     public AggregationStrategy getAggregationStrategy() {
         return aggregationStrategy;
     }
-
-    public MulticastType setAggregationStrategy(AggregationStrategy aggregationStrategy) {
-        this.aggregationStrategy = aggregationStrategy;
-        return this;
+    
+    public void setAggregationStrategy(AggregationStrategy aggregationStrategy) {
+        this.aggregationStrategy = aggregationStrategy;        
     }
 
     public boolean isParallelProcessing() {
         return parallelProcessing != null ? parallelProcessing : false;
     }
 
-    public MulticastType setParallelProcessing(boolean parallelProcessing) {
-        this.parallelProcessing = parallelProcessing;
-        return this;
+    public void setParallelProcessing(boolean parallelProcessing) {
+        this.parallelProcessing = parallelProcessing;        
     }
 
     public ThreadPoolExecutor getThreadPoolExecutor() {
         return threadPoolExecutor;
     }
 
-    public MulticastType setThreadPoolExecutor(ThreadPoolExecutor executor) {
-        this.threadPoolExecutor = executor;
-        return this;
+    public void setThreadPoolExecutor(ThreadPoolExecutor executor) {
+        this.threadPoolExecutor = executor;        
+
     }
 
     @Override

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SetExchangePatternType.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SetExchangePatternType.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SetExchangePatternType.java (original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SetExchangePatternType.java Wed Dec 17 06:25:03 2008
@@ -51,6 +51,10 @@
         this.pattern = pattern;
     }
 
+    public SetExchangePatternType pattern(ExchangePattern pattern) {
+        setPattern(pattern);
+        return this;
+    }
 
     public ExchangePattern getPattern() {
         return pattern;

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SplitterType.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SplitterType.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SplitterType.java (original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/SplitterType.java Wed Dec 17 06:25:03 2008
@@ -85,6 +85,54 @@
                 isParallelProcessing(), threadPoolExecutor, streaming);
     }
     
+    // Fluent API
+    // -------------------------------------------------------------------------
+    /**
+     * Set the spliter's aggregationStrategy
+     * @param aggregationStrategy 
+     *
+     * @return the builder
+     */
+    public SplitterType aggregationStrategy(AggregationStrategy aggregationStrategy) {
+        setAggregationStrategy(aggregationStrategy);
+        return this;
+    }
+    
+    /**
+     * Set the splitting action's thread model
+     * @param parallelProcessing 
+     * if it is true the Splitter will use a thread pool to do the splitting work; 
+     * if it is false the Splitter only do the splitting work in the calling thread.
+     *
+     * @return the builder
+     */
+    public SplitterType parallelProcessing(boolean parallelProcessing) {
+        setParallelProcessing(parallelProcessing);
+        return this;
+    }
+    
+    /**
+     * Enables streaming. 
+     * See {@link SplitterType#setStreaming(boolean)} for more information
+     *
+     * @return the builder
+     */
+    public SplitterType streaming() {
+        setStreaming(true);
+        return this;
+    }
+    
+    /**
+     * Setting the executor for executing the splitting action. 
+     * @param executor , it should be a instance of ThreadPoolExcutor
+     * NOTE in Camel 2.0 , it will change to use the instance which implements Executor interface
+     * @return the builder
+     */
+    public SplitterType executor(ThreadPoolExecutor executor) {
+        setThreadPoolExecutor(executor);
+        return this;
+    }
+    
     public AggregationStrategy getAggregationStrategy() {
         return aggregationStrategy;
     }
@@ -115,15 +163,7 @@
     public void setStreaming(boolean streaming) {
         this.streaming = streaming;
     }
-    
-    /**
-     * Enables streaming. 
-     * Cfr. {@link SplitterType#setStreaming(boolean)} for more information
-     */
-    public SplitterType streaming() {
-        setStreaming(true);
-        return this;
-    }
+
 
     private ThreadPoolExecutor createThreadPoolExecutor(RouteContext routeContext) {
         ThreadPoolExecutor threadPoolExecutor = getThreadPoolExecutor();

Modified: activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java (original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/main/java/org/apache/camel/model/ThrottlerType.java Wed Dec 17 06:25:03 2008
@@ -80,7 +80,18 @@
      * Sets the time period during which the maximum request count is valid for
      */
     public ThrottlerType timePeriodMillis(long timePeriodMillis) {
-        this.timePeriodMillis = timePeriodMillis;
+        setTimePeriodMillis(timePeriodMillis);
+        return this;
+    }
+    
+    /**
+     * Sets the time period during which the maximum request count per period
+     *
+     * @param maximumRequestsPerPeriod  the maximum request count number per time period
+     * @return the builder
+     */
+    public ThrottlerType maximumRequestsPerPeriod(Long maximumRequestsPerPeriod) {
+        setMaximumRequestsPerPeriod(maximumRequestsPerPeriod);
         return this;
     }
 

Modified: activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java (original)
+++ activemq/camel/branches/camel-1.x/camel-core/src/test/java/org/apache/camel/processor/MultiCastAggregatorTest.java Wed Dec 17 06:25:03 2008
@@ -72,7 +72,7 @@
                 // START SNIPPET: example
                 // The message will be sent parallelly to the endpoints
                 from("direct:parallel")
-                    .multicast(new BodyOutAggregatingStrategy(), true).setThreadPoolExecutor(tpExecutor)
+                    .multicast(new BodyOutAggregatingStrategy(), true).executor(tpExecutor)
                         .to("direct:x", "direct:y", "direct:z");
                 // Multicast the message in a sequential way
                 from("direct:sequential").multicast(new BodyOutAggregatingStrategy()).to("direct:x", "direct:y", "direct:z");

Propchange: activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMCustomCodecTest.java
            ('svn:mergeinfo' removed)

Propchange: activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMFileTcpTest.java
            ('svn:mergeinfo' removed)

Propchange: activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTextlineProtocolTest.java
            ('svn:mergeinfo' removed)

Propchange: activemq/camel/branches/camel-1.x/components/camel-mina/src/test/java/org/apache/camel/component/mina/MinaVMTransferExchangeOptionTest.java
            ('svn:mergeinfo' removed)

Modified: activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java (original)
+++ activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/queue/version/LoanBroker.java Wed Dec 17 06:25:03 2008
@@ -100,7 +100,7 @@
             // Set the aggregation strategy for aggregating the out message            
             .multicast(new BankResponseAggregationStrategy().setAggregatingOutMessage(true))
                 // Send out the request the below three different banks parallelly
-                .setParallelProcessing(true).to("jms:queue2:bank1", "jms:queue2:bank2", "jms:queue2:bank3");
+                .parallelProcessing(true).to("jms:queue2:bank1", "jms:queue2:bank2", "jms:queue2:bank3");
         
         // Each bank processor will process the message and put the response message back
         from("jms:queue2:bank1").process(new Bank("bank1"));

Modified: activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java
URL: http://svn.apache.org/viewvc/activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java?rev=727389&r1=727388&r2=727389&view=diff
==============================================================================
--- activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java (original)
+++ activemq/camel/branches/camel-1.x/examples/camel-example-loan-broker/src/main/java/org/apache/camel/loanbroker/webservice/version/LoanBroker.java Wed Dec 17 06:25:03 2008
@@ -96,7 +96,7 @@
                 .multicast(new BankResponseAggregationStrategy())
                     // Camel will create a thread pool with the size of the send to endpoints
                     // for sending the message parallelly
-                    .setParallelProcessing(true)
+                    .parallelProcessing(true)
                     .to(Constants.BANK1_URI, Constants.BANK2_URI, Constants.BANK3_URI);
 
     //END SNIPPET: dsl