You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ha...@apache.org on 2009/07/01 05:29:52 UTC
svn commit: r790029 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/component/file/
camel-core/src/main/java/org/apache/camel/component/file/strategy/
camel-core/src/test/java/org/apache/camel/component/file/
components/camel-ftp/src/test/...
Author: hadrian
Date: Wed Jul 1 03:29:51 2009
New Revision: 790029
URL: http://svn.apache.org/viewvc?rev=790029&view=rev
Log:
Reverting previous commits r789750 and r789761
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.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/GenericFileExchange.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOperations.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java (props changed)
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java (props changed)
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerIncludeNameTest.java (props changed)
camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIncludeNameTest.java (props changed)
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileOperations.java Wed Jul 1 03:29:51 2009
@@ -130,12 +130,12 @@
return null;
}
- public boolean retrieveFile(String name, Exchange exchange) throws GenericFileOperationFailedException {
+ public boolean retrieveFile(String name, GenericFileExchange<File> exchange) throws GenericFileOperationFailedException {
// noop as we use type converters to read the body content for java.io.File
return true;
}
- public boolean storeFile(String fileName, Exchange exchange) throws GenericFileOperationFailedException {
+ public boolean storeFile(String fileName, GenericFileExchange<File> exchange) throws GenericFileOperationFailedException {
ObjectHelper.notNull(endpoint, "endpoint");
File file = new File(fileName);
@@ -267,4 +267,5 @@
}
return out;
}
+
}
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=790029&r1=790028&r2=790029&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 Wed Jul 1 03:29:51 2009
@@ -16,7 +16,6 @@
*/
package org.apache.camel.component.file;
-import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedList;
@@ -113,7 +112,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
- Exchange exchange = (Exchange) exchanges.poll();
+ GenericFileExchange<T> exchange = (GenericFileExchange<T>) exchanges.poll();
// add current index and total as properties
exchange.setProperty(Exchange.BATCH_INDEX, index);
exchange.setProperty(Exchange.BATCH_SIZE, total);
@@ -125,11 +124,9 @@
// remove the file from the in progress list in case the batch was limited by max messages per poll
for (int index = 0; index < exchanges.size() && isRunAllowed(); index++) {
- Exchange exchange = (Exchange) exchanges.poll();
- GenericFile<T> file = (GenericFile<T>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
- if (file != null) {
- endpoint.getInProgressRepository().remove(file.getFileName());
- }
+ GenericFileExchange<T> exchange = (GenericFileExchange<T>) exchanges.poll();
+ String key = exchange.getGenericFile().getFileName();
+ endpoint.getInProgressRepository().remove(key);
}
}
@@ -156,25 +153,25 @@
*
* @param exchange the exchange
*/
- protected void processExchange(final Exchange exchange) {
- final GenericFile<T> target = (GenericFile<T>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ protected void processExchange(final GenericFileExchange<T> exchange) {
if (log.isTraceEnabled()) {
- log.trace("Processing remote file: " + target);
+ log.trace("Processing remote file: " + exchange.getGenericFile());
}
try {
final GenericFileProcessStrategy<T> processStrategy = endpoint.getGenericFileProcessStrategy();
- boolean begin = processStrategy.begin(operations, endpoint, exchange, target);
+ boolean begin = processStrategy.begin(operations, endpoint, exchange, exchange.getGenericFile());
if (!begin) {
- log.debug(endpoint + " cannot begin processing file: " + target);
+ log.debug(endpoint + " cannot begin processing file: " + exchange.getGenericFile());
// remove file from the in progress list as its no longer in progress
- endpoint.getInProgressRepository().remove(target.getFileName());
+ endpoint.getInProgressRepository().remove(exchange.getGenericFile().getFileName());
return;
}
// must use file from exchange as it can be updated due the
// preMoveNamePrefix/preMoveNamePostfix options
+ final GenericFile<T> target = exchange.getGenericFile();
// must use full name when downloading so we have the correct path
final String name = target.getAbsoluteFilePath();
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java Wed Jul 1 03:29:51 2009
@@ -41,7 +41,6 @@
}
public Exchange newInstance() {
- GenericFile<T> file = (GenericFile<T>) getProperty(FileComponent.FILE_EXCHANGE_FILE);
- return new GenericFileExchange<T>(this, file);
+ return new GenericFileExchange<T>(this, getGenericFile());
}
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOnCompletion.java Wed Jul 1 03:29:51 2009
@@ -68,7 +68,7 @@
GenericFileProcessStrategy<T> processStrategy = endpoint.getGenericFileProcessStrategy();
// after processing
- final GenericFile<T> file = (GenericFile<T>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ final GenericFile<T> file = exchange.getGenericFile();
boolean failed = exchange.isFailed();
if (log.isDebugEnabled()) {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOperations.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOperations.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileOperations.java Wed Jul 1 03:29:51 2009
@@ -18,8 +18,6 @@
import java.util.List;
-import org.apache.camel.Exchange;
-
public interface GenericFileOperations<T> {
/**
@@ -67,7 +65,7 @@
* @return true if file has been retrieved, false if not
* @throws GenericFileOperationFailedException can be thrown
*/
- boolean retrieveFile(String name, Exchange exchange) throws GenericFileOperationFailedException;
+ boolean retrieveFile(String name, GenericFileExchange<T> exchange) throws GenericFileOperationFailedException;
/**
* Stores the content as a new remote file (upload)
@@ -77,7 +75,7 @@
* @return true if the file was stored, false if not
* @throws GenericFileOperationFailedException can be thrown
*/
- boolean storeFile(String name, Exchange exchange) throws GenericFileOperationFailedException;
+ boolean storeFile(String name, GenericFileExchange<T> exchange) throws GenericFileOperationFailedException;
/**
* Gets the current remote directory
Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileLockExclusiveReadLockStrategy.java
('svn:mergeinfo' removed)
Propchange: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/strategy/FileProcessStrategyFactory.java
('svn:mergeinfo' removed)
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitExpressionRenameStrategyTest.java Wed Jul 1 03:29:51 2009
@@ -66,9 +66,8 @@
from("file://target/reports?preMove=../inprogress/${file:name.noext}.bak&move=../done/${file:name}&consumer.delay=5000")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- GenericFile<File> file = (GenericFile<File>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
- assertNotNull(file);
- assertTrue(file.getRelativeFilePath().indexOf("inprogress") > -1);
+ GenericFileExchange<File> fe = (GenericFileExchange<File>) exchange;
+ assertTrue(fe.getGenericFile().getRelativeFilePath().indexOf("inprogress") > -1);
}
})
.to("mock:report");
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginAndCommitRenameStrategyTest.java Wed Jul 1 03:29:51 2009
@@ -76,9 +76,8 @@
from("file://target/reports?preMove=../inprogress/${file:name}&move=../done/${file:name}&delay=5000")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- GenericFile<File> file = (GenericFile<File>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
- assertNotNull(file);
- assertTrue(file.getRelativeFilePath().indexOf("inprogress") > -1);
+ GenericFileExchange<File> fe = (GenericFileExchange<File>) exchange;
+ assertTrue(fe.getGenericFile().getRelativeFilePath().indexOf("inprogress") > -1);
}
})
.to("mock:report");
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginExpressionRenameStrategyTest.java Wed Jul 1 03:29:51 2009
@@ -75,9 +75,8 @@
from("file://target/reports?preMove=../inprogress/${file:name.noext}.bak&consumer.delay=5000")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- GenericFile<File> file = (GenericFile<File>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
- assertNotNull(file);
- assertTrue(file.getRelativeFilePath().indexOf("inprogress") > -1);
+ GenericFileExchange<File> fe = (GenericFileExchange<File>) exchange;
+ assertTrue(fe.getGenericFile().getRelativeFilePath().indexOf("inprogress") > -1);
}
})
.to("mock:report");
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java?rev=790029&r1=790028&r2=790029&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerBeginRenameStrategyTest.java Wed Jul 1 03:29:51 2009
@@ -73,9 +73,8 @@
from("file://target/reports?preMove=../inprogress/${file:name}&consumer.delay=5000")
.process(new Processor() {
public void process(Exchange exchange) throws Exception {
- GenericFile<File> file = (GenericFile<File>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
- assertNotNull(file);
- assertTrue(file.getRelativeFilePath().indexOf("inprogress") > -1);
+ GenericFileExchange<File> fe = (GenericFileExchange<File>) exchange;
+ assertTrue(fe.getGenericFile().getRelativeFilePath().indexOf("inprogress") > -1);
}
})
.to("mock:report");
Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerIncludeNameTest.java
('svn:mergeinfo' removed)
Propchange: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerIncludeNameTest.java
('svn:mergeinfo' removed)