You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/01/28 12:46:51 UTC
svn commit: r738457 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/component/file/
camel-core/src/main/java/org/apache/camel/converter/jaxp/
camel-core/src/test/java/org/apache/camel/component/file/
components/camel-ftp/src/main/java/org/...
Author: davsclaus
Date: Wed Jan 28 11:46:50 2009
New Revision: 738457
URL: http://svn.apache.org/viewvc?rev=738457&view=rev
Log:
CAMEL-1241: More work on the camel-vfs. Fixed some failing unit tests.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileEndpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileFilter.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/GenericFileProducer.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileBinding.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileComponent.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileEndpoint.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileOperations.java
camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerExpressionTest.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileEndpoint.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java
camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java
camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/mock/BeanMockTest.java
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileAntPathMatcherFileFilterTest-context.xml
camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileRouteTest-context.xml
camel/trunk/tests/camel-itest/pom.xml
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFtpEndpointTest.java
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/AntPathMatcherGenericFileFilter.java Wed Jan 28 11:46:50 2009
@@ -27,7 +27,7 @@
* Exclude take precedence over includes. If a file match both exclude and include it will be regarded as excluded.
*/
public class AntPathMatcherGenericFileFilter implements GenericFileFilter {
- private static final String ANTPATHMATCHER_CLASSNAME = "org.apache.camel.component.file.AntPathMatcherGenericFileFilter";
+ private static final String ANTPATHMATCHER_CLASSNAME = "org.apache.camel.component.file.AntPathMatcherFileFilter";
private String[] excludes;
private String[] includes;
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=738457&r1=738456&r2=738457&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 Wed Jan 28 11:46:50 2009
@@ -75,7 +75,7 @@
protected Expression preMoveExpression;
protected boolean idempotent;
protected IdempotentRepository idempotentRepository;
- protected GenericFileFilter filter;
+ protected GenericFileFilter<T> filter;
protected Comparator<GenericFile<T>> sorter;
protected Comparator<GenericFileExchange> sortBy;
protected String readLock = "none";
@@ -106,11 +106,7 @@
* none is provided
*/
public String getGeneratedFileName(Message message) {
- return getFileFriendlyMessageId(message.getMessageId());
- }
-
- protected String getFileFriendlyMessageId(String id) {
- return UuidGenerator.generateSanitizedId(id);
+ return UuidGenerator.generateSanitizedId(message.getMessageId());
}
public GenericFileProcessStrategy getGenericFileProcessStrategy() {
@@ -293,11 +289,11 @@
this.idempotentRepository = idempotentRepository;
}
- public GenericFileFilter getFilter() {
+ public GenericFileFilter<T> getFilter() {
return filter;
}
- public void setFilter(GenericFileFilter filter) {
+ public void setFilter(GenericFileFilter<T> filter) {
this.filter = filter;
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileFilter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileFilter.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileFilter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileFilter.java Wed Jan 28 11:46:50 2009
@@ -19,7 +19,7 @@
/**
* A filter for {@link GenericFile}.
*/
-public interface GenericFileFilter {
+public interface GenericFileFilter<T> {
/**
* Tests whether or not the specified generic file should be included
@@ -27,6 +27,6 @@
* @param file the generic file to be tested
* @return <code>true</code> if and only if <code>file</code> should be included
*/
- boolean accept(GenericFile file);
+ boolean accept(GenericFile<T> file);
}
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=738457&r1=738456&r2=738457&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 Jan 28 11:46:50 2009
@@ -20,15 +20,19 @@
public interface GenericFileOperations<T> {
- // TODO: setEndpoint method so we have access to it
+ /**
+ * Sets the endpoint as some implementations need access to the endpoint and how its configured.
+ *
+ * @param endpoint the endpoint
+ */
+ void setEndpoint(GenericFileEndpoint endpoint);
/**
* Deletes the file name by name, relative to the current directory
*
* @param name name of the file
* @return true if deleted, false if not
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
boolean deleteFile(String name) throws GenericFileOperationFailedException;
@@ -38,8 +42,7 @@
* @param from original name
* @param to the new name
* @return true if renamed, false if not
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
boolean renameFile(String from, String to) throws GenericFileOperationFailedException;
@@ -49,10 +52,8 @@
*
* @param directory the directory path to build as a relative string name
* @param absolute wether the directory is an absolute or relative path
- * @return true if build or already exists, false if not possbile (could be
- * lack of permissions)
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @return true if build or already exists, false if not possbile (could be lack of permissions)
+ * @throws GenericFileOperationFailedException can be thrown
*/
boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException;
@@ -62,8 +63,7 @@
* @param name name of the file
* @param exchange stream to write the content of the file into
* @return true if file has been retrieved, false if not
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
boolean retrieveFile(String name, GenericFileExchange<T> exchange) throws GenericFileOperationFailedException;
@@ -73,8 +73,7 @@
* @param name name of new file
* @param exchange with the content content of the file
* @return true if the file was stored, false if not
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
boolean storeFile(String name, GenericFileExchange<T> exchange) throws GenericFileOperationFailedException;
@@ -82,8 +81,7 @@
* Gets the current remote directory
*
* @return the current directory path
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
String getCurrentDirectory() throws GenericFileOperationFailedException;
@@ -91,8 +89,7 @@
* Change the current remote directory
*
* @param path the path to change to
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
void changeCurrentDirectory(String path) throws GenericFileOperationFailedException;
@@ -100,8 +97,7 @@
* List the files in the current directory
*
* @return a list of backing objects representing the files
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
List<T> listFiles() throws GenericFileOperationFailedException;
@@ -110,8 +106,7 @@
*
* @param path the remote directory
* @return a list of backing objects representing the files
- * @throws GenericFileOperationFailedException
- * can be thrown
+ * @throws GenericFileOperationFailedException can be thrown
*/
List<T> listFiles(String path) throws GenericFileOperationFailedException;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileProducer.java Wed Jan 28 11:46:50 2009
@@ -32,22 +32,18 @@
*/
public class GenericFileProducer<T> extends DefaultProducer {
protected final transient Log log = LogFactory.getLog(getClass());
- private GenericFileOperations<T> operations;
+ protected final GenericFileEndpoint<T> endpoint;
+ protected final GenericFileOperations<T> operations;
protected GenericFileProducer(GenericFileEndpoint<T> endpoint, GenericFileOperations<T> operations) {
super(endpoint);
+ this.endpoint = endpoint;
this.operations = operations;
}
- /**
- * Convenience method
- */
- protected GenericFileEndpoint<T> getGenericFileEndpoint() {
- return (GenericFileEndpoint<T>) getEndpoint();
- }
-
+ @SuppressWarnings("unchecked")
public void process(Exchange exchange) throws Exception {
- GenericFileExchange<T> fileExchange = (GenericFileExchange<T>) getGenericFileEndpoint().createExchange(exchange);
+ GenericFileExchange<T> fileExchange = (GenericFileExchange<T>) endpoint.createExchange(exchange);
processExchange(fileExchange);
ExchangeHelper.copyResults(exchange, fileExchange);
}
@@ -69,7 +65,7 @@
preWriteCheck();
// should we write to a temporary name and then afterwards rename to real target
- boolean writeAsTempAndRename = ObjectHelper.isNotEmpty(getGenericFileEndpoint().getTempPrefix());
+ boolean writeAsTempAndRename = ObjectHelper.isNotEmpty(endpoint.getTempPrefix());
String tempTarget = null;
if (writeAsTempAndRename) {
// compute temporary name with the temp prefix
@@ -85,7 +81,7 @@
if (log.isTraceEnabled()) {
log.trace("Renaming file: [" + tempTarget + "] to: [" + target + "]");
}
- boolean renamed = getOperations().renameFile(tempTarget, target);
+ boolean renamed = operations.renameFile(tempTarget, target);
if (!renamed) {
throw new GenericFileOperationFailedException("Cannot rename file from: " + tempTarget + " to: " + target);
}
@@ -121,7 +117,7 @@
int lastPathIndex = fileName.lastIndexOf('/');
if (lastPathIndex != -1) {
String directory = fileName.substring(0, lastPathIndex);
- if (!getOperations().buildDirectory(directory, false)) {
+ if (!operations.buildDirectory(directory, false)) {
log.debug("Can not build directory [" + directory + "] (could be because of denied permissions)");
}
}
@@ -130,7 +126,7 @@
log.trace("About to write [" + fileName + "] to [" + getEndpoint() + "] from exchange [" + exchange + "]");
}
- boolean success = getOperations().storeFile(fileName, exchange);
+ boolean success = operations.storeFile(fileName, exchange);
if (!success) {
throw new GenericFileOperationFailedException("Error writing file [" + fileName + "]");
}
@@ -150,7 +146,7 @@
String name = exchange.getIn().getHeader(FileComponent.HEADER_FILE_NAME, String.class);
// expression support
- Expression expression = getGenericFileEndpoint().getExpression();
+ Expression expression = endpoint.getExpression();
if (name != null) {
// the header name can be an expression too, that should override
// whatever configured on the endpoint
@@ -169,8 +165,8 @@
name = exchange.getContext().getTypeConverter().convertTo(String.class, result);
}
- String endpointFile = getGenericFileEndpoint().getConfiguration().getFile();
- if (getGenericFileEndpoint().isDirectory()) {
+ String endpointFile = endpoint.getConfiguration().getFile();
+ if (endpoint.isDirectory()) {
// Its a directory so we should use it as a basepath for the filename
// If the path isn't empty, we need to add a trailing / if it isn't already there
String baseDir = "";
@@ -183,7 +179,7 @@
} else {
// use a generated filename if no name provided
// TODO: Consider to require end user to always provide a filename instead of generating a new name
- answer = baseDir + getGenericFileEndpoint().getGeneratedFileName(exchange.getIn());
+ answer = baseDir + endpoint.getGeneratedFileName(exchange.getIn());
}
} else {
answer = endpointFile;
@@ -196,20 +192,12 @@
int path = fileName.lastIndexOf("/");
if (path == -1) {
// no path
- return getGenericFileEndpoint().getTempPrefix() + fileName;
+ return endpoint.getTempPrefix() + fileName;
} else {
StringBuilder sb = new StringBuilder(fileName);
- sb.insert(path + 1, getGenericFileEndpoint().getTempPrefix());
+ sb.insert(path + 1, endpoint.getTempPrefix());
return sb.toString();
}
}
- /**
- * @return the operations
- */
- public GenericFileOperations<T> getOperations() {
- return operations;
- }
-
-
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileBinding.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileBinding.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileBinding.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileBinding.java Wed Jan 28 11:46:50 2009
@@ -19,21 +19,27 @@
import java.io.File;
/**
- *
+ * File binding with the {@link java.io.File} type.
*/
public class NewFileBinding implements GenericFileBinding<File> {
private File body;
public Object getBody(GenericFile<File> file) {
- // TODO: comment why I do this
- // TODO: consider storing object and only create new if changed
- // TODO: Consider callback from changeName to binding so we change
- // change it at that time
- return new File(file.getAbsoluteFileName());
+ // as we use java.io.File itself as the body (not loading its content into a OutputStream etc.)
+ // we just store a java.io.File handle to the actual file denoted by the
+ // file.getAbsoluteFileName. We must do this as the original file consumed can be renamed before
+ // being processed (preMove) and thus it points to an invalid file location.
+ // GenericFile#getAbsoluteFileName() is always up-to-date and thus we use it to create a file
+ // handle that is correct
+ if (body == null || !file.getAbsoluteFileName().equals(body.getAbsolutePath())) {
+ body = new File(file.getAbsoluteFileName());
+ }
+ return body;
}
public void setBody(GenericFile<File> file, Object body) {
// noop
}
+
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileComponent.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileComponent.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileComponent.java Wed Jan 28 11:46:50 2009
@@ -34,7 +34,8 @@
config.setFile(file.getPath());
result.setConfiguration(config);
- NewFileOperations operations = new NewFileOperations(result, file);
+ NewFileOperations operations = new NewFileOperations();
+ operations.setEndpoint(result);
result.setOperations(operations);
return result;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileEndpoint.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileEndpoint.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileEndpoint.java Wed Jan 28 11:46:50 2009
@@ -28,7 +28,7 @@
*/
public class NewFileEndpoint extends GenericFileEndpoint<File> {
- private NewFileOperations operations;
+ private NewFileOperations operations = new NewFileOperations(this);
private File file;
public NewFileEndpoint() {
@@ -97,6 +97,8 @@
public void setFile(File file) {
this.file = file;
+ // update configuration as well
+ getConfiguration().setFile(file.getPath());
}
@Override
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileOperations.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileOperations.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/NewFileOperations.java Wed Jan 28 11:46:50 2009
@@ -24,7 +24,6 @@
import java.io.RandomAccessFile;
import java.nio.ByteBuffer;
import java.nio.channels.FileChannel;
-import java.util.Arrays;
import java.util.List;
import org.apache.camel.InvalidPayloadException;
@@ -34,19 +33,21 @@
import org.apache.commons.logging.LogFactory;
/**
- *
+ * File operations for {@link java.io.File}.
*/
public class NewFileOperations implements GenericFileOperations<File> {
-
private static final transient Log LOG = LogFactory.getLog(NewFileOperations.class);
- private final NewFileEndpoint endpoint;
+ private NewFileEndpoint endpoint;
- // this is our filehandle to the filesystem
- private File currentFile;
+ public NewFileOperations() {
+ }
- public NewFileOperations(final NewFileEndpoint endpoint, File fileHandle) {
+ public NewFileOperations(NewFileEndpoint endpoint) {
this.endpoint = endpoint;
- this.currentFile = fileHandle;
+ }
+
+ public void setEndpoint(GenericFileEndpoint endpoint) {
+ this.endpoint = (NewFileEndpoint) endpoint;
}
public boolean deleteFile(String name) throws GenericFileOperationFailedException {
@@ -61,6 +62,8 @@
}
public boolean buildDirectory(String directory, boolean absolute) throws GenericFileOperationFailedException {
+ ObjectHelper.notNull(endpoint, "endpoint");
+
// always create endpoint defined directory
if (endpoint.isAutoCreate() && endpoint.isDirectory() && !endpoint.getFile().exists()) {
endpoint.getFile().mkdirs();
@@ -87,26 +90,32 @@
}
public List<File> listFiles() throws GenericFileOperationFailedException {
- return Arrays.asList(this.currentFile.listFiles());
+ // noop
+ return null;
}
public List<File> listFiles(String path) throws GenericFileOperationFailedException {
- return Arrays.asList(new File(this.currentFile, path).listFiles());
+ // noop
+ return null;
}
public void changeCurrentDirectory(String path) throws GenericFileOperationFailedException {
- this.currentFile = new File(this.currentFile, path).getAbsoluteFile();
+ // noop
}
public String getCurrentDirectory() throws GenericFileOperationFailedException {
- return currentFile.getAbsolutePath();
+ // noop
+ return null;
}
public boolean retrieveFile(String name, GenericFileExchange<File> exchange) throws GenericFileOperationFailedException {
- return false;
+ // noop as we use type converters to read the body content for java.io.File
+ return true;
}
public boolean storeFile(String name, GenericFileExchange<File> exchange) throws GenericFileOperationFailedException {
+ ObjectHelper.notNull(endpoint, "endpoint");
+
File file = new File(name);
try {
boolean fileSource = exchange.getIn().getBody() instanceof File;
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java Wed Jan 28 11:46:50 2009
@@ -15,6 +15,7 @@
* limitations under the License.
*/
package org.apache.camel.converter.jaxp;
+
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -23,7 +24,6 @@
import org.w3c.dom.Text;
import org.apache.camel.Converter;
-
/**
* Converts from some DOM types to Java types
*
@@ -43,30 +43,20 @@
return buffer.toString();
}
-/*
- @Converter
- public static String toString(Node node) {
- StringBuffer buffer = new StringBuffer();
- append(buffer, node);
- return buffer.toString();
- }
-*/
-
- protected static void append(StringBuffer buffer, NodeList nodeList) {
+ private static void append(StringBuffer buffer, NodeList nodeList) {
int size = nodeList.getLength();
for (int i = 0; i < size; i++) {
append(buffer, nodeList.item(i));
}
}
- protected static void append(StringBuffer buffer, Node node) {
+ private static void append(StringBuffer buffer, Node node) {
if (node instanceof Text) {
Text text = (Text) node;
buffer.append(text.getTextContent());
} else if (node instanceof Attr) {
Attr attribute = (Attr) node;
buffer.append(attribute.getTextContent());
-
} else if (node instanceof Element) {
Element element = (Element) node;
append(buffer, element.getChildNodes());
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/converter/jaxp/XmlConverter.java Wed Jan 28 11:46:50 2009
@@ -53,6 +53,7 @@
import org.xml.sax.XMLReader;
import org.apache.camel.Converter;
+import org.apache.camel.component.file.GenericFile;
import org.apache.camel.converter.IOConverter;
import org.apache.camel.converter.NIOConverter;
import org.apache.camel.util.ObjectHelper;
@@ -309,6 +310,11 @@
}
@Converter
+ public StreamSource toStreamSource(GenericFile<File> in) throws TransformerException {
+ return toStreamSource(in.getFile());
+ }
+
+ @Converter
public StreamSource toStreamSource(byte[] in) throws TransformerException {
if (in != null) {
return new StreamSource(IOConverter.toInputStream(in));
@@ -528,6 +534,17 @@
return documentBuilder.parse(file);
}
+ /**
+ * Converts the given {@link File} to a DOM document
+ *
+ * @param file is the data to be parsed
+ * @return the parsed document
+ */
+ @Converter
+ public Document toDOMDocument(GenericFile<File> file) throws IOException, SAXException, ParserConfigurationException {
+ return toDOMDocument(file.getFile());
+ }
+
/**
* Create a DOM document from the given source.
Modified: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerExpressionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerExpressionTest.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerExpressionTest.java (original)
+++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerExpressionTest.java Wed Jan 28 11:46:50 2009
@@ -141,7 +141,7 @@
endpoint.setCamelContext(context);
endpoint.getConfiguration().setFile("target/filelanguage/report5.txt");
endpoint.setFile(new File("target/filelanguage/report5.txt"));
- endpoint.setOperations(new NewFileOperations(endpoint, endpoint.getFile()));
+ endpoint.setOperations(new NewFileOperations(endpoint));
endpoint.setDirectory(false);
endpoint.setAutoCreate(false);
endpoint.setExpression(BeanLanguage.bean("myguidgenerator"));
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileConfiguration.java Wed Jan 28 11:46:50 2009
@@ -23,6 +23,7 @@
public static final int DEFAULT_FTP_PORT = 21;
public FtpRemoteFileConfiguration() {
+ setProtocol("ftp");
}
public FtpRemoteFileConfiguration(URI uri) {
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileEndpoint.java Wed Jan 28 11:46:50 2009
@@ -17,12 +17,12 @@
package org.apache.camel.component.file.remote;
import org.apache.camel.Processor;
-import org.apache.camel.util.ObjectHelper;
import org.apache.commons.net.ftp.FTPFile;
public class FtpRemoteFileEndpoint extends RemoteFileEndpoint<FTPFile> {
public FtpRemoteFileEndpoint() {
+ this.operations = new FtpRemoteFileOperations();
}
public FtpRemoteFileEndpoint(String uri, FtpRemoteFileComponent component, FtpRemoteFileOperations operations,
@@ -31,18 +31,11 @@
}
@Override
- protected RemoteFileConsumer buildConsumer(Processor processor, RemoteFileOperations<FTPFile> operations) {
+ protected RemoteFileConsumer<FTPFile> buildConsumer(Processor processor, RemoteFileOperations<FTPFile> operations) {
return new FtpConsumer(this, processor, operations);
}
@Override
- public RemoteFileConsumer createConsumer(Processor processor) throws Exception {
- RemoteFileConsumer rfc = super.createConsumer(processor);
- ObjectHelper.notEmpty(((FtpRemoteFileConfiguration) configuration).getHost(), "host");
- return rfc;
- }
-
- @Override
public String getScheme() {
return "ftp";
}
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java Wed Jan 28 11:46:50 2009
@@ -25,6 +25,7 @@
import java.util.List;
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.GenericFileOperationFailedException;
import org.apache.camel.util.ObjectHelper;
@@ -37,9 +38,7 @@
* FTP remote file operations
*/
public class FtpRemoteFileOperations implements RemoteFileOperations<FTPFile> {
-
private static final transient Log LOG = LogFactory.getLog(FtpRemoteFileOperations.class);
-
private final FTPClient client;
public FtpRemoteFileOperations() {
@@ -50,6 +49,10 @@
this.client = client;
}
+ public void setEndpoint(GenericFileEndpoint endpoint) {
+ // noop
+ }
+
public boolean connect(RemoteFileConfiguration config) throws GenericFileOperationFailedException {
String host = config.getHost();
int port = config.getPort();
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=738457&r1=738456&r2=738457&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 Wed Jan 28 11:46:50 2009
@@ -52,14 +52,13 @@
@Override
public GenericFileProducer<T> createProducer() throws Exception {
+ afterPropertiesSet();
return new RemoteFileProducer<T>(this, (RemoteFileOperations<T>) this.operations);
}
@Override
public RemoteFileConsumer<T> createConsumer(Processor processor) throws Exception {
- String protocol = ((RemoteFileConfiguration) getConfiguration()).getProtocol();
- ObjectHelper.notEmpty(protocol, "protocol");
-
+ afterPropertiesSet();
RemoteFileConsumer<T> consumer = buildConsumer(processor, (RemoteFileOperations<T>) operations);
if (isDelete() && (getMoveNamePrefix() != null || getMoveNamePostfix() != null || getExpression() != null)) {
@@ -82,6 +81,21 @@
}
/**
+ * Validates this endpoint if its configured properly.
+ *
+ * @throws Exception is thrown if endpoint is invalid configured for its mandatory options
+ */
+ protected void afterPropertiesSet() throws Exception {
+ ObjectHelper.notNull(operations, "operations");
+ RemoteFileConfiguration config = (RemoteFileConfiguration) getConfiguration();
+ ObjectHelper.notEmpty(config.getHost(), "host");
+ ObjectHelper.notEmpty(config.getProtocol(), "protocol");
+ if (config.getPort() <= 0) {
+ throw new IllegalArgumentException("port is not assigned to a positive value");
+ }
+ }
+
+ /**
* Remote File Endpoints, impl this method to create a custom consumer specific to their "protocol" etc.
*
* @param processor the processor
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProducer.java Wed Jan 28 11:46:50 2009
@@ -63,7 +63,7 @@
if (log.isDebugEnabled()) {
log.debug("Disconnecting from " + getEndpoint());
}
- ((RemoteFileOperations) getOperations()).disconnect();
+ ((RemoteFileOperations) operations).disconnect();
}
@Override
@@ -95,12 +95,13 @@
}
protected void connectIfNecessary() throws IOException {
- if (!((RemoteFileOperations) getOperations()).isConnected() || !loggedIn) {
+ if (!((RemoteFileOperations) operations).isConnected() || !loggedIn) {
if (log.isDebugEnabled()) {
log.debug("Not connected/logged in, connecting to " + getEndpoint());
}
- RemoteFileOperations rfo = (RemoteFileOperations) getOperations();
- RemoteFileConfiguration conf = (RemoteFileConfiguration) getGenericFileEndpoint().getConfiguration();
+ RemoteFileOperations rfo = (RemoteFileOperations) operations;
+ RemoteFileEndpoint rfe = (RemoteFileEndpoint) getEndpoint();
+ RemoteFileConfiguration conf = (RemoteFileConfiguration) rfe.getConfiguration();
loggedIn = rfo.connect(conf);
if (!loggedIn) {
return;
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileConfiguration.java Wed Jan 28 11:46:50 2009
@@ -23,6 +23,7 @@
public static final int DEFAULT_SFTP_PORT = 22;
public SftpRemoteFileConfiguration() {
+ setProtocol("sftp");
}
public SftpRemoteFileConfiguration(URI uri) {
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileEndpoint.java Wed Jan 28 11:46:50 2009
@@ -23,6 +23,7 @@
public class SftpRemoteFileEndpoint extends RemoteFileEndpoint<ChannelSftp.LsEntry> {
public SftpRemoteFileEndpoint() {
+ this.operations = new SftpRemoteFileOperations();
}
public SftpRemoteFileEndpoint(String uri, SftpRemoteFileComponent component, RemoteFileOperations<ChannelSftp.LsEntry> operations,
Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java (original)
+++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java Wed Jan 28 11:46:50 2009
@@ -32,6 +32,7 @@
import com.jcraft.jsch.UserInfo;
import org.apache.camel.InvalidPayloadException;
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.GenericFileOperationFailedException;
import org.apache.camel.util.ExchangeHelper;
@@ -48,6 +49,10 @@
private ChannelSftp channel;
private Session session;
+ public void setEndpoint(GenericFileEndpoint endpoint) {
+ // noop
+ }
+
public boolean connect(RemoteFileConfiguration configuration) throws GenericFileOperationFailedException {
try {
if (isConnected()) {
Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/component/file/SpringFileRouteTest.java Wed Jan 28 11:46:50 2009
@@ -43,7 +43,7 @@
public void testMocksAreValid() throws Exception {
// lets check that our injected endpoint is valid
- FileEndpoint fileEndpoint = Assertions.assertInstanceOf(inputFile, FileEndpoint.class);
+ NewFileEndpoint fileEndpoint = Assertions.assertInstanceOf(inputFile, NewFileEndpoint.class);
assertEquals("File", new File("target/test-default-inbox"), fileEndpoint.getFile());
result.expectedBodiesReceived(expectedBody);
Modified: camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/mock/BeanMockTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/mock/BeanMockTest.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/mock/BeanMockTest.java (original)
+++ camel/trunk/components/camel-spring/src/test/java/org/apache/camel/spring/mock/BeanMockTest.java Wed Jan 28 11:46:50 2009
@@ -27,6 +27,9 @@
public void testAssertionsUsingBean() throws Exception {
MyAssertions bean = getMandatoryBean(MyAssertions.class, "myBean");
bean.assertEndpointsValid();
+
+ // give time for file consumer to stop properly
+ Thread.sleep(20);
}
protected AbstractXmlApplicationContext createApplicationContext() {
Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileAntPathMatcherFileFilterTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileAntPathMatcherFileFilterTest-context.xml?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileAntPathMatcherFileFilterTest-context.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileAntPathMatcherFileFilterTest-context.xml Wed Jan 28 11:46:50 2009
@@ -27,7 +27,7 @@
<template id="camelTemplate"/>
<!-- use myFilter as filter to allow setting ANT paths for which files to scan for -->
- <endpoint id="myFileEndpoint" uri="file://target/antpathmatcher?recursive=true&filter=#myAntFilter"/>
+ <endpoint id="myFileEndpoint" uri="newfile://target/antpathmatcher?recursive=true&filter=#myAntFilter"/>
<route>
<from ref="myFileEndpoint"/>
@@ -36,7 +36,7 @@
</camelContext>
<!-- we use the AntPathMatcherFileFilter to use ant paths for includes and exlucde -->
- <bean id="myAntFilter" class="org.apache.camel.component.file.AntPathMatcherFileFilter">
+ <bean id="myAntFilter" class="org.apache.camel.component.file.AntPathMatcherGenericFileFilter">
<!-- include and file in the subfolder that has day in the name -->
<property name="includes" value="**/subfolder/**/*day*"/>
<!-- exclude all files with bad in name or .xml files. Use comma to seperate multiple excludes -->
Modified: camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileRouteTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileRouteTest-context.xml?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileRouteTest-context.xml (original)
+++ camel/trunk/components/camel-spring/src/test/resources/org/apache/camel/component/file/SpringFileRouteTest-context.xml Wed Jan 28 11:46:50 2009
@@ -22,19 +22,19 @@
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
">
- <!-- START SNIPPET: example -->
- <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
- <template id="camelTemplate"/>
-
- <route>
- <from ref="inputFile"/>
- <to uri="mock:result"/>
- </route>
- </camelContext>
+ <!-- START SNIPPET: example -->
+ <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+ <template id="camelTemplate"/>
- <bean id="inputFile" class="org.apache.camel.component.file.FileEndpoint">
- <property name="file" value="target/test-default-inbox"/>
- </bean>
- <!-- END SNIPPET: example -->
+ <route>
+ <from ref="inputFile"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+ <bean id="inputFile" class="org.apache.camel.component.file.NewFileEndpoint">
+ <property name="file" value="target/test-default-inbox"/>
+ </bean>
+ <!-- END SNIPPET: example -->
</beans>
Modified: camel/trunk/tests/camel-itest/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/pom.xml?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/pom.xml (original)
+++ camel/trunk/tests/camel-itest/pom.xml Wed Jan 28 11:46:50 2009
@@ -167,8 +167,6 @@
<excludes>
<!-- TODO FIXME ASAP -->
<exclude>**/XXXTest.*</exclude>
- <exclude>**/SpringFtpEndpointTest.*</exclude>
- <exclude>**/SpringFileAntPathMatcherRemoteFileFilterTest.*</exclude>
</excludes>
</configuration>
</plugin>
Modified: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFtpEndpointTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFtpEndpointTest.java?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFtpEndpointTest.java (original)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFtpEndpointTest.java Wed Jan 28 11:46:50 2009
@@ -39,8 +39,10 @@
@Autowired
protected ProducerTemplate template;
+
@EndpointInject(name = "myFTPEndpoint")
protected Endpoint inputFTP;
+
@EndpointInject(uri = "mock:result")
protected MockEndpoint result;
@@ -75,7 +77,7 @@
uman.configure();
ftpServer.setUserManager(uman);
- ftpServer.getListener("default").setPort(20124);
+ ftpServer.getListener("default").setPort(20125);
}
}
\ No newline at end of file
Modified: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml?rev=738457&r1=738456&r2=738457&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml (original)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFtpEndpointTest-context.xml Wed Jan 28 11:46:50 2009
@@ -22,32 +22,36 @@
http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
">
+ <!-- START SNIPPET: e1 -->
<bean id="myFTPEndpoint" class="org.apache.camel.component.file.remote.FtpRemoteFileEndpoint">
<property name="camelContext" ref="camel"/>
<property name="configuration" ref="ftpConfig"/>
- <property name="operations" ref="ftpOperations"/>
+ <property name="consumerProperties">
+ <map key-type="java.lang.String">
+ <entry key="initialDelay" value="1000"/>
+ </map>
+ </property>
</bean>
- <bean id="ftpOperations" class="org.apache.camel.component.file.remote.FtpRemoteFileOperations"/>
-
<bean id="ftpConfig" class="org.apache.camel.component.file.remote.FtpRemoteFileConfiguration">
<property name="host" value="localhost"/>
- <property name="port" value="20124"/>
+ <property name="port" value="20125"/>
<property name="username" value="admin"/>
<property name="password" value="admin"/>
<property name="protocol" value="ftp"/>
<property name="file" value="helloftp"/>
</bean>
+ <!-- END SNIPPET: e1 -->
- <!-- START SNIPPET: example -->
+ <!-- START SNIPPET: e2 -->
<camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
<template id="camelTemplate"/>
<route>
<from ref="myFTPEndpoint"/>
- <!--<from uri="ftp://admin@localhost:20124/helloftp?password=admin"/>-->
<to uri="mock:result"/>
</route>
</camelContext>
+ <!-- START SNIPPET: e2 -->
</beans>