camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r790429 - in /camel/trunk: camel-core/src/main/java/org/apache/camel/component/file/ components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/
Date Thu, 02 Jul 2009 00:33:10 GMT
Author: hadrian
Date: Thu Jul  2 00:33:10 2009
New Revision: 790429

URL: http://svn.apache.org/viewvc?rev=790429&view=rev
Log:
CAMEL-1078.  Removed GenericFileExchange (finally).

Removed:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java
Modified:
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileComponent.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileDefaultSorter.java
    camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
    camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java?rev=790429&r1=790428&r2=790429&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
Thu Jul  2 00:33:10 2009
@@ -19,7 +19,9 @@
 import java.io.File;
 
 import org.apache.camel.Component;
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
+import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.processor.idempotent.MemoryIdempotentRepository;
 import org.apache.camel.util.ObjectHelper;
 
@@ -92,16 +94,16 @@
         return new GenericFileProducer<File>(this, operations);
     }
 
-    public GenericFileExchange<File> createExchange(GenericFile<File> file) {
-        GenericFileExchange<File> exchange = new GenericFileExchange<File>(this);
+    public Exchange createExchange(GenericFile<File> file) {
+        Exchange exchange = new DefaultExchange(this);
         if (file != null) {
             file.bindToExchange(exchange);
         }
         return exchange;
     }
 
-    public GenericFileExchange createExchange() {
-        return new GenericFileExchange(this);
+    public Exchange createExchange() {
+        return new DefaultExchange(this);
     }
 
     public File getFile() {

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileComponent.java?rev=790429&r1=790428&r2=790429&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileComponent.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileComponent.java
Thu Jul  2 00:33:10 2009
@@ -21,6 +21,7 @@
 import java.util.Map;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.EndpointHelper;
 import org.apache.camel.util.ObjectHelper;
@@ -57,7 +58,7 @@
             // we support nested sort groups so they should be chained
             String[] groups = sortBy.split(";");
             Iterator<String> it = ObjectHelper.createIterator(groups);
-            Comparator<GenericFileExchange> comparator = createSortByComparator(it);
+            Comparator<Exchange> comparator = createSortByComparator(it);
             endpoint.setSortBy(comparator);
         }
         setProperties(endpoint.getConfiguration(), parameters);
@@ -93,9 +94,9 @@
      * Helper to create a sort comparator
      *
      * @param it iterator
-     * @return Comparator<GenericFileExchange>
+     * @return Comparator<Exchange>
      */
-    private Comparator<GenericFileExchange> createSortByComparator(Iterator<String>
it) {
+    private Comparator<Exchange> createSortByComparator(Iterator<String> it)
{
         if (!it.hasNext()) {
             return null;
         }
@@ -111,7 +112,8 @@
         ObjectHelper.notEmpty(reminder, "sortBy expression", this);
 
         // recursive add nested sorters
-        return GenericFileDefaultSorter.sortByFileLanguage(getCamelContext(), reminder, reverse,
ignoreCase, createSortByComparator(it));
+        return GenericFileDefaultSorter.sortByFileLanguage(getCamelContext(), 
+            reminder, reverse, ignoreCase, createSortByComparator(it));
     }
 
 }

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java?rev=790429&r1=790428&r2=790429&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java
Thu Jul  2 00:33:10 2009
@@ -72,12 +72,10 @@
             Collections.sort(files, endpoint.getSorter());
         }
 
-        // sort using build in sorters that is expression based
-        // first we need to convert to GenericFileExchange objects so we can sort
-        // using expressions
-        LinkedList<GenericFileExchange> exchanges = new LinkedList<GenericFileExchange>();
+        // sort using build in sorters so we can use expressions
+        LinkedList<Exchange> exchanges = new LinkedList<Exchange>();
         for (GenericFile<T> file : files) {
-            GenericFileExchange<T> exchange = endpoint.createExchange(file);
+            Exchange exchange = endpoint.createExchange(file);
             endpoint.configureMessage(file, exchange.getIn());
             exchanges.add(exchange);
         }
@@ -112,7 +110,7 @@
         for (int index = 0; index < total && isRunAllowed(); index++) {
             // only loop if we are started (allowed to run)
             // use poll to remove the head so it does not consume memory even after we have
processed it
-            GenericFileExchange<T> exchange = (GenericFileExchange<T>) exchanges.poll();
+            Exchange exchange = (Exchange) exchanges.poll();
             // add current index and total as properties
             exchange.setProperty(Exchange.BATCH_INDEX, index);
             exchange.setProperty(Exchange.BATCH_SIZE, total);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileDefaultSorter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileDefaultSorter.java?rev=790429&r1=790428&r2=790429&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileDefaultSorter.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileDefaultSorter.java
Thu Jul  2 00:33:10 2009
@@ -19,6 +19,7 @@
 import java.util.Comparator;
 
 import org.apache.camel.CamelContext;
+import org.apache.camel.Exchange;
 import org.apache.camel.Expression;
 import org.apache.camel.spi.Language;
 import org.apache.camel.util.ObjectHelper;
@@ -96,7 +97,7 @@
      * @param reverse    true to reverse order
      * @return the comparator
      */
-    public static Comparator<GenericFileExchange> sortByFileLanguage(
+    public static Comparator<Exchange> sortByFileLanguage(
             CamelContext context, String expression, boolean reverse) {
         return sortByFileLanguage(context, expression, reverse, false, null);
     }
@@ -110,7 +111,7 @@
      * @param ignoreCase ignore case if comparing strings
      * @return the comparator
      */
-    public static Comparator<GenericFileExchange> sortByFileLanguage(
+    public static Comparator<Exchange> sortByFileLanguage(
             CamelContext context, String expression, boolean reverse, boolean ignoreCase)
{
         return sortByFileLanguage(context, expression, reverse, ignoreCase, null);
     }
@@ -125,11 +126,11 @@
      * @param nested     nested comparator for sub group sorting, can be null
      * @return the comparator
      */
-    public static Comparator<GenericFileExchange> sortByFileLanguage(
+    public static Comparator<Exchange> sortByFileLanguage(
             final CamelContext context, final String expression, final boolean reverse,
-            final boolean ignoreCase, final Comparator<GenericFileExchange> nested)
{
-        return new Comparator<GenericFileExchange>() {
-            public int compare(GenericFileExchange o1, GenericFileExchange o2) {
+            final boolean ignoreCase, final Comparator<Exchange> nested) {
+        return new Comparator<Exchange>() {
+            public int compare(Exchange o1, Exchange o2) {
                 Language language = context.resolveLanguage("file");
                 final Expression exp = language.createExpression(expression);
                 Object result1 = exp.evaluate(o1, Object.class);

Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java?rev=790429&r1=790428&r2=790429&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
(original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
Thu Jul  2 00:33:10 2009
@@ -73,7 +73,7 @@
     protected IdempotentRepository idempotentRepository;
     protected GenericFileFilter<T> filter;
     protected Comparator<GenericFile<T>> sorter;
-    protected Comparator<GenericFileExchange> sortBy;
+    protected Comparator<Exchange> sortBy;
     protected String readLock = "none";
     protected long readLockTimeout;
     protected GenericFileExclusiveReadLockStrategy exclusiveReadLockStrategy;
@@ -93,7 +93,7 @@
 
     public abstract GenericFileProducer<T> createProducer() throws Exception;
 
-    public abstract GenericFileExchange<T> createExchange(GenericFile<T> file);
+    public abstract Exchange createExchange(GenericFile<T> file);
 
     public abstract String getScheme();
     
@@ -280,11 +280,11 @@
         this.sorter = sorter;
     }
 
-    public Comparator<GenericFileExchange> getSortBy() {
+    public Comparator<Exchange> getSortBy() {
         return sortBy;
     }
 
-    public void setSortBy(Comparator<GenericFileExchange> sortBy) {
+    public void setSortBy(Comparator<Exchange> sortBy) {
         this.sortBy = sortBy;
     }
 

Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java?rev=790429&r1=790428&r2=790429&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
(original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
Thu Jul  2 00:33:10 2009
@@ -16,11 +16,12 @@
  */
 package org.apache.camel.component.file.remote;
 
+import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
 import org.apache.camel.component.file.GenericFile;
 import org.apache.camel.component.file.GenericFileEndpoint;
-import org.apache.camel.component.file.GenericFileExchange;
 import org.apache.camel.component.file.GenericFileProducer;
+import org.apache.camel.impl.DefaultExchange;
 import org.apache.camel.processor.idempotent.MemoryIdempotentRepository;
 import org.apache.camel.util.ObjectHelper;
 
@@ -39,14 +40,14 @@
     }
 
     @Override
-    public GenericFileExchange<T> createExchange() {
-        return new GenericFileExchange<T>(this);
+    public Exchange createExchange() {
+        return new DefaultExchange(this);
     }
 
     @Override
     @SuppressWarnings("unchecked")
-    public GenericFileExchange<T> createExchange(GenericFile<T> file) {
-        GenericFileExchange<T> answer = new GenericFileExchange<T>(this);
+    public Exchange createExchange(GenericFile<T> file) {
+        Exchange answer = new DefaultExchange(this);
         if (file != null) {
             file.bindToExchange(answer);
         }



Mime
View raw message