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 22:59:26 UTC
svn commit: r790376 - in
/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file:
GenericFileConsumer.java GenericFileExchange.java
Author: hadrian
Date: Wed Jul 1 20:59:25 2009
New Revision: 790376
URL: http://svn.apache.org/viewvc?rev=790376&view=rev
Log:
CAMEL-1078. Prepare removal of GenericFileExchange. Almost done.
Modified:
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
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=790376&r1=790375&r2=790376&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 20:59:25 2009
@@ -124,8 +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++) {
- GenericFileExchange<T> exchange = (GenericFileExchange<T>) exchanges.poll();
- String key = exchange.getGenericFile().getFileName();
+ Exchange exchange = (Exchange) exchanges.poll();
+ GenericFile<T> file = (GenericFile<T>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
+ String key = file.getFileName();
endpoint.getInProgressRepository().remove(key);
}
}
@@ -153,25 +154,26 @@
*
* @param exchange the exchange
*/
- protected void processExchange(final GenericFileExchange<T> exchange) {
+ protected void processExchange(final Exchange exchange) {
+ GenericFile<T> file = (GenericFile<T>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
if (log.isTraceEnabled()) {
- log.trace("Processing remote file: " + exchange.getGenericFile());
+ log.trace("Processing remote file: " + file);
}
try {
final GenericFileProcessStrategy<T> processStrategy = endpoint.getGenericFileProcessStrategy();
- boolean begin = processStrategy.begin(operations, endpoint, exchange, exchange.getGenericFile());
+ boolean begin = processStrategy.begin(operations, endpoint, exchange, file);
if (!begin) {
- log.debug(endpoint + " cannot begin processing file: " + exchange.getGenericFile());
+ log.debug(endpoint + " cannot begin processing file: " + file);
// remove file from the in progress list as its no longer in progress
- endpoint.getInProgressRepository().remove(exchange.getGenericFile().getFileName());
+ endpoint.getInProgressRepository().remove(file.getFileName());
return;
}
// must use file from exchange as it can be updated due the
// preMoveNamePrefix/preMoveNamePostfix options
- final GenericFile<T> target = exchange.getGenericFile();
+ final GenericFile<T> target = (GenericFile<T>) exchange.getProperty(FileComponent.FILE_EXCHANGE_FILE);
// must use full name when downloading so we have the correct path
final String name = target.getAbsoluteFilePath();
@@ -200,7 +202,6 @@
} catch (Exception e) {
handleException(e);
}
-
}
/**
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=790376&r1=790375&r2=790376&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 20:59:25 2009
@@ -16,11 +16,7 @@
*/
package org.apache.camel.component.file;
-import java.io.IOException;
-
import org.apache.camel.Endpoint;
-import org.apache.camel.Exchange;
-import org.apache.camel.RuntimeExchangeException;
import org.apache.camel.impl.DefaultExchange;
public class GenericFileExchange<T> extends DefaultExchange {
@@ -28,19 +24,4 @@
public GenericFileExchange(Endpoint fromEndpoint) {
super(fromEndpoint);
}
-
- public GenericFileExchange(DefaultExchange parent, GenericFile<T> file) {
- super(parent);
- if (file != null) {
- file.bindToExchange(this);
- }
- }
-
- public GenericFile<T> getGenericFile() {
- return (GenericFile<T>) getProperty(FileComponent.FILE_EXCHANGE_FILE);
- }
-
- public Exchange newInstance() {
- return new GenericFileExchange<T>(this, getGenericFile());
- }
}