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 2009/01/12 09:30:08 UTC

svn commit: r733650 [2/4] - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/ camel-core/src/main/java/org/apache/camel/component/file/ camel-core/src/main/java/org/apache/camel/model/ camel-core/src/main/java/org/apache/camel/model/...

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java Mon Jan 12 00:30:05 2009
@@ -1,222 +1,222 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.net.ftp.FTPClient;
-import org.apache.commons.net.ftp.FTPFile;
-
-/**
- * FTP remote file operations
- */
-public class FtpRemoteFileOperations implements RemoteFileOperations<FTPClient> {
-    private static final Log LOG = LogFactory.getLog(FtpRemoteFileOperations.class);
-    private FTPClient client;
-
-    public FtpRemoteFileOperations() {
-        this.client = new FTPClient();
-    }
-
-    public FtpRemoteFileOperations(FTPClient client) {
-        this.client = client;
-    }
-
-    public boolean connect(RemoteFileConfiguration config) throws RemoteFileOperationFailedException {
-        String host = config.getHost();
-        int port = config.getPort();
-        String username = config.getUsername();
-
-        if (config.getFtpClientConfig() != null) {
-            LOG.trace("Configuring FTPClient with config: " + config.getFtpClientConfig());
-            client.configure(config.getFtpClientConfig());
-        }
-
-        LOG.trace("Connecting to " + config.remoteServerInformation());
-        try {
-            client.connect(host, port);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-
-        // must enter passive mode directly after connect
-        if (config.isPassiveMode()) {
-            LOG.trace("Using passive mode connections");
-            client.enterLocalPassiveMode();
-        }
-
-        try {
-            boolean login;
-            if (username != null) {
-                LOG.trace("Attempting to login user: " + username);
-                login = client.login(username, config.getPassword());
-            } else {
-                LOG.trace("Attempting to login anonymous");
-                login = client.login("anonymous", null);
-            }
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("User " + (username != null ? username : "anonymous") + " logged in: " + login);
-            }
-            if (!login) {
-                throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString());
-            }
-            client.setFileType(config.isBinary() ? FTPClient.BINARY_FILE_TYPE : FTPClient.ASCII_FILE_TYPE);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-
-        return true;
-    }
-
-    public boolean isConnected() throws RemoteFileOperationFailedException {
-        return client.isConnected();
-    }
-
-    public void disconnect() throws RemoteFileOperationFailedException {
-        try {
-            client.disconnect();
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public boolean deleteFile(String name) throws RemoteFileOperationFailedException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Deleteing file: " + name);
-        }
-        try {
-            return client.deleteFile(name);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public boolean renameFile(String from, String to) throws RemoteFileOperationFailedException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Renaming file: " + from + " to: " + to);
-        }
-        try {
-            return client.rename(from, to);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public boolean buildDirectory(String directory) throws RemoteFileOperationFailedException {
-        try {
-            String originalDirectory = client.printWorkingDirectory();
-
-            boolean success = false;
-            try {
-                // maybe the full directory already exsits
-                success = client.changeWorkingDirectory(directory);
-                if (!success) {
-                    if (LOG.isTraceEnabled()) {
-                        LOG.trace("Trying to build remote directory: " + directory);
-                    }
-                    success = client.makeDirectory(directory);
-                    if (!success) {
-                        // we are here if the server side doesn't create intermediate folders
-                        // so create the folder one by one
-                        buildDirectoryChunks(directory);
-                    }
-                }
-            } finally {
-                // change back to original directory
-                client.changeWorkingDirectory(originalDirectory);
-            }
-
-            return success;
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public boolean retrieveFile(String name, OutputStream out) throws RemoteFileOperationFailedException {
-        try {
-            return client.retrieveFile(name, out);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public boolean storeFile(String name, InputStream body) throws RemoteFileOperationFailedException {
-        try {
-            return client.storeFile(name, body);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public String getCurrentDirectory() throws RemoteFileOperationFailedException {
-        try {
-            return client.printWorkingDirectory();
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public void changeCurrentDirectory(String newDirectory) throws RemoteFileOperationFailedException {
-        try {
-            client.changeWorkingDirectory(newDirectory);
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    public List listFiles() throws RemoteFileOperationFailedException {
-        return listFiles(".");
-    }
-
-    public List listFiles(String path) throws RemoteFileOperationFailedException {
-        try {
-            final List list = new ArrayList();
-            FTPFile[] files = client.listFiles(path);
-            for (FTPFile file : files) {
-                list.add(file);
-            }
-            return list;
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
-        }
-    }
-
-    private boolean buildDirectoryChunks(String dirName) throws IOException {
-        final StringBuilder sb = new StringBuilder(dirName.length());
-        final String[] dirs = dirName.split("\\/");
-
-        boolean success = false;
-        for (String dir : dirs) {
-            sb.append(dir).append('/');
-            String directory = sb.toString();
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("Trying to build remote directory: " + directory);
-            }
-
-            success = client.makeDirectory(directory);
-        }
-
-        return success;
-    }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.commons.net.ftp.FTPClient;
+import org.apache.commons.net.ftp.FTPFile;
+
+/**
+ * FTP remote file operations
+ */
+public class FtpRemoteFileOperations implements RemoteFileOperations<FTPClient> {
+    private static final Log LOG = LogFactory.getLog(FtpRemoteFileOperations.class);
+    private FTPClient client;
+
+    public FtpRemoteFileOperations() {
+        this.client = new FTPClient();
+    }
+
+    public FtpRemoteFileOperations(FTPClient client) {
+        this.client = client;
+    }
+
+    public boolean connect(RemoteFileConfiguration config) throws RemoteFileOperationFailedException {
+        String host = config.getHost();
+        int port = config.getPort();
+        String username = config.getUsername();
+
+        if (config.getFtpClientConfig() != null) {
+            LOG.trace("Configuring FTPClient with config: " + config.getFtpClientConfig());
+            client.configure(config.getFtpClientConfig());
+        }
+
+        LOG.trace("Connecting to " + config.remoteServerInformation());
+        try {
+            client.connect(host, port);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+
+        // must enter passive mode directly after connect
+        if (config.isPassiveMode()) {
+            LOG.trace("Using passive mode connections");
+            client.enterLocalPassiveMode();
+        }
+
+        try {
+            boolean login;
+            if (username != null) {
+                LOG.trace("Attempting to login user: " + username);
+                login = client.login(username, config.getPassword());
+            } else {
+                LOG.trace("Attempting to login anonymous");
+                login = client.login("anonymous", null);
+            }
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("User " + (username != null ? username : "anonymous") + " logged in: " + login);
+            }
+            if (!login) {
+                throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString());
+            }
+            client.setFileType(config.isBinary() ? FTPClient.BINARY_FILE_TYPE : FTPClient.ASCII_FILE_TYPE);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+
+        return true;
+    }
+
+    public boolean isConnected() throws RemoteFileOperationFailedException {
+        return client.isConnected();
+    }
+
+    public void disconnect() throws RemoteFileOperationFailedException {
+        try {
+            client.disconnect();
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public boolean deleteFile(String name) throws RemoteFileOperationFailedException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Deleteing file: " + name);
+        }
+        try {
+            return client.deleteFile(name);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public boolean renameFile(String from, String to) throws RemoteFileOperationFailedException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Renaming file: " + from + " to: " + to);
+        }
+        try {
+            return client.rename(from, to);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public boolean buildDirectory(String directory) throws RemoteFileOperationFailedException {
+        try {
+            String originalDirectory = client.printWorkingDirectory();
+
+            boolean success = false;
+            try {
+                // maybe the full directory already exsits
+                success = client.changeWorkingDirectory(directory);
+                if (!success) {
+                    if (LOG.isTraceEnabled()) {
+                        LOG.trace("Trying to build remote directory: " + directory);
+                    }
+                    success = client.makeDirectory(directory);
+                    if (!success) {
+                        // we are here if the server side doesn't create intermediate folders
+                        // so create the folder one by one
+                        buildDirectoryChunks(directory);
+                    }
+                }
+            } finally {
+                // change back to original directory
+                client.changeWorkingDirectory(originalDirectory);
+            }
+
+            return success;
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public boolean retrieveFile(String name, OutputStream out) throws RemoteFileOperationFailedException {
+        try {
+            return client.retrieveFile(name, out);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public boolean storeFile(String name, InputStream body) throws RemoteFileOperationFailedException {
+        try {
+            return client.storeFile(name, body);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public String getCurrentDirectory() throws RemoteFileOperationFailedException {
+        try {
+            return client.printWorkingDirectory();
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public void changeCurrentDirectory(String newDirectory) throws RemoteFileOperationFailedException {
+        try {
+            client.changeWorkingDirectory(newDirectory);
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    public List listFiles() throws RemoteFileOperationFailedException {
+        return listFiles(".");
+    }
+
+    public List listFiles(String path) throws RemoteFileOperationFailedException {
+        try {
+            final List list = new ArrayList();
+            FTPFile[] files = client.listFiles(path);
+            for (FTPFile file : files) {
+                list.add(file);
+            }
+            return list;
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException(client.getReplyCode(), client.getReplyString(), e.getMessage(), e);
+        }
+    }
+
+    private boolean buildDirectoryChunks(String dirName) throws IOException {
+        final StringBuilder sb = new StringBuilder(dirName.length());
+        final String[] dirs = dirName.split("\\/");
+
+        boolean success = false;
+        for (String dir : dirs) {
+            sb.append(dir).append('/');
+            String directory = sb.toString();
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Trying to build remote directory: " + directory);
+            }
+
+            success = client.makeDirectory(directory);
+        }
+
+        return success;
+    }
+
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpRemoteFileOperations.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java Mon Jan 12 00:30:05 2009
@@ -1,146 +1,146 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-import java.io.OutputStream;
-
-/**
- * Represents a remote file of some sort of backing object
- */
-public class RemoteFile<T> implements Cloneable {
-
-    private String absolutelFileName;
-    private String relativeFileName;
-    private String fileName;
-    private String hostname;
-    private long fileLength;
-    private long lastModified;
-    private T file;
-    private OutputStream body;
-
-    @Override
-    public RemoteFile<T> clone() {
-        return copyFrom(this);
-    }
-
-    /**
-     * Creates a clone based on the source
-     *
-     * @param source  the source
-     * @return a clone of the source
-     */
-    public RemoteFile<T> copyFrom(RemoteFile<T> source) {
-        RemoteFile<T> result = new RemoteFile<T>();
-        result.setAbsolutelFileName(source.getAbsolutelFileName());
-        result.setRelativeFileName(source.getRelativeFileName());
-        result.setFileName(source.getFileName());
-        result.setHostname(source.getHostname());
-        result.setFileLength(source.getFileLength());
-        result.setLastModified(source.getLastModified());
-        result.setFile(source.getFile());
-        result.setBody(source.getBody());
-        return result;
-    }
-
-    /**
-     * Changes the name of this remote file. This method alters the absolute and relative names as well.
-     *
-     * @param newName the new name
-     */
-    public void changeFileName(String newName) {
-        setAbsolutelFileName(getParent() + "/" + newName);
-        if (relativeFileName.indexOf("/") != -1) {
-            setRelativeFileName(relativeFileName.substring(0, relativeFileName.lastIndexOf("/")) + newName);
-        } else {
-            setRelativeFileName(newName);
-        }
-        setFileName(newName);
-    }
-
-    public String getAbsolutelFileName() {
-        return absolutelFileName;
-    }
-
-    public void setAbsolutelFileName(String absolutelFileName) {
-        this.absolutelFileName = absolutelFileName;
-    }
-
-    public String getRelativeFileName() {
-        return relativeFileName;
-    }
-
-    public void setRelativeFileName(String relativeFileName) {
-        this.relativeFileName = relativeFileName;
-    }
-
-    public String getFileName() {
-        return fileName;
-    }
-
-    public void setFileName(String fileName) {
-        this.fileName = fileName;
-    }
-
-    public String getHostname() {
-        return hostname;
-    }
-
-    public void setHostname(String hostname) {
-        this.hostname = hostname;
-    }
-
-    public long getFileLength() {
-        return fileLength;
-    }
-
-    public void setFileLength(long fileLength) {
-        this.fileLength = fileLength;
-    }
-
-    public long getLastModified() {
-        return lastModified;
-    }
-
-    public void setLastModified(long lastModified) {
-        this.lastModified = lastModified;
-    }
-
-    public T getFile() {
-        return file;
-    }
-
-    public void setFile(T file) {
-        this.file = file;
-    }
-
-    public OutputStream getBody() {
-        return body;
-    }
-
-    public void setBody(OutputStream os) {
-        this.body = os;
-    }
-
-    public String getParent() {
-        return absolutelFileName.substring(0, absolutelFileName.lastIndexOf("/"));
-    }
-
-    @Override
-    public String toString() {
-        return absolutelFileName;
-    }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+import java.io.OutputStream;
+
+/**
+ * Represents a remote file of some sort of backing object
+ */
+public class RemoteFile<T> implements Cloneable {
+
+    private String absolutelFileName;
+    private String relativeFileName;
+    private String fileName;
+    private String hostname;
+    private long fileLength;
+    private long lastModified;
+    private T file;
+    private OutputStream body;
+
+    @Override
+    public RemoteFile<T> clone() {
+        return copyFrom(this);
+    }
+
+    /**
+     * Creates a clone based on the source
+     *
+     * @param source  the source
+     * @return a clone of the source
+     */
+    public RemoteFile<T> copyFrom(RemoteFile<T> source) {
+        RemoteFile<T> result = new RemoteFile<T>();
+        result.setAbsolutelFileName(source.getAbsolutelFileName());
+        result.setRelativeFileName(source.getRelativeFileName());
+        result.setFileName(source.getFileName());
+        result.setHostname(source.getHostname());
+        result.setFileLength(source.getFileLength());
+        result.setLastModified(source.getLastModified());
+        result.setFile(source.getFile());
+        result.setBody(source.getBody());
+        return result;
+    }
+
+    /**
+     * Changes the name of this remote file. This method alters the absolute and relative names as well.
+     *
+     * @param newName the new name
+     */
+    public void changeFileName(String newName) {
+        setAbsolutelFileName(getParent() + "/" + newName);
+        if (relativeFileName.indexOf("/") != -1) {
+            setRelativeFileName(relativeFileName.substring(0, relativeFileName.lastIndexOf("/")) + newName);
+        } else {
+            setRelativeFileName(newName);
+        }
+        setFileName(newName);
+    }
+
+    public String getAbsolutelFileName() {
+        return absolutelFileName;
+    }
+
+    public void setAbsolutelFileName(String absolutelFileName) {
+        this.absolutelFileName = absolutelFileName;
+    }
+
+    public String getRelativeFileName() {
+        return relativeFileName;
+    }
+
+    public void setRelativeFileName(String relativeFileName) {
+        this.relativeFileName = relativeFileName;
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    public String getHostname() {
+        return hostname;
+    }
+
+    public void setHostname(String hostname) {
+        this.hostname = hostname;
+    }
+
+    public long getFileLength() {
+        return fileLength;
+    }
+
+    public void setFileLength(long fileLength) {
+        this.fileLength = fileLength;
+    }
+
+    public long getLastModified() {
+        return lastModified;
+    }
+
+    public void setLastModified(long lastModified) {
+        this.lastModified = lastModified;
+    }
+
+    public T getFile() {
+        return file;
+    }
+
+    public void setFile(T file) {
+        this.file = file;
+    }
+
+    public OutputStream getBody() {
+        return body;
+    }
+
+    public void setBody(OutputStream os) {
+        this.body = os;
+    }
+
+    public String getParent() {
+        return absolutelFileName.substring(0, absolutelFileName.lastIndexOf("/"));
+    }
+
+    @Override
+    public String toString() {
+        return absolutelFileName;
+    }
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFile.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java Mon Jan 12 00:30:05 2009
@@ -1,40 +1,40 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-/**
- * Strategy for acquiring exclusive read locks for files to be consumed.
- * After granting the read lock it is realeased, we just want to make sure that when we start
- * consuming the file its not currently in progress of being written by third party.
- * <p/>
- * Camel supports out of the box the following strategies:
- * <ul>
- *   <li>RemoteFileRenameExclusiveReadLockStrategy waiting until its possible to rename the file.</li>
- * </ul>
- */
-public interface RemoteFileExclusiveReadLockStrategy {
-
-    /**
-     * Acquires exclusive read lock to the file.
-     *
-     * @param operations remote file operations
-     * @param file the remote file
-     * @return <tt>true</tt> if read lock was acquired. If <tt>false</tt> Camel will skip the file and
-     *         try it on the next poll
-     */
-    boolean acquireExclusiveReadLock(RemoteFileOperations operations, RemoteFile file);
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+/**
+ * Strategy for acquiring exclusive read locks for files to be consumed.
+ * After granting the read lock it is realeased, we just want to make sure that when we start
+ * consuming the file its not currently in progress of being written by third party.
+ * <p/>
+ * Camel supports out of the box the following strategies:
+ * <ul>
+ *   <li>RemoteFileRenameExclusiveReadLockStrategy waiting until its possible to rename the file.</li>
+ * </ul>
+ */
+public interface RemoteFileExclusiveReadLockStrategy {
+
+    /**
+     * Acquires exclusive read lock to the file.
+     *
+     * @param operations remote file operations
+     * @param file the remote file
+     * @return <tt>true</tt> if read lock was acquired. If <tt>false</tt> Camel will skip the file and
+     *         try it on the next poll
+     */
+    boolean acquireExclusiveReadLock(RemoteFileOperations operations, RemoteFile file);
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileExclusiveReadLockStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java Mon Jan 12 00:30:05 2009
@@ -1,32 +1,32 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-/**
- * A filter for {@link RemoteFile}.
- */
-public interface RemoteFileFilter {
-
-    /**
-     * Tests whether or not the specified remote file should be included
-     *
-     * @param  file  the remote file to be tested
-     * @return  <code>true</code> if and only if <code>file</code> should be included
-     */
-    boolean accept(RemoteFile file);
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+/**
+ * A filter for {@link RemoteFile}.
+ */
+public interface RemoteFileFilter {
+
+    /**
+     * Tests whether or not the specified remote file should be included
+     *
+     * @param  file  the remote file to be tested
+     * @return  <code>true</code> if and only if <code>file</code> should be included
+     */
+    boolean accept(RemoteFile file);
+
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileFilter.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java Mon Jan 12 00:30:05 2009
@@ -1,132 +1,132 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.List;
-
-/**
- * Remote file operations based on some backing framework
- */
-public interface RemoteFileOperations<T> {
-
-    /**
-     * Connects to the remote server
-     *
-     * @param configuration configuraiton
-     * @return true if connected
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean connect(RemoteFileConfiguration configuration) throws RemoteFileOperationFailedException;
-
-    /**
-     * Returns whether we are connected to the remote server or not
-     *
-     * @return true if connected, false if not
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean isConnected() throws RemoteFileOperationFailedException;
-
-    /**
-     * Discconects from the remote server
-     *
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    void disconnect() throws RemoteFileOperationFailedException;
-
-    /**
-     * Deletes the file from the remote server
-     *
-     * @param name name of the file
-     * @return true if deleted, false if not
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean deleteFile(String name) throws RemoteFileOperationFailedException;
-
-    /**
-     * Renames the file on the remote server
-     *
-     * @param from original name
-     * @param to   the new name
-     * @return true if renamed, false if not
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean renameFile(String from, String to) throws RemoteFileOperationFailedException;
-
-    /**
-     * Builds the directory structure on the remote server. Will test if the folder already exists.
-     *
-     * @param directory the directory path to build
-     * @return true if build or already exists, false if not possbile (could be lack of permissions)
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean buildDirectory(String directory) throws RemoteFileOperationFailedException;
-
-    /**
-     * Retrieves the remote file (download)
-     *
-     * @param name  name of the file
-     * @param out   stream to write the content of the file into
-     * @return true if file has been retrieved, false if not
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean retrieveFile(String name, OutputStream out) throws RemoteFileOperationFailedException;
-
-    /**
-     * Stores the content as a new remote file (upload)
-     *
-     * @param name  name of new file
-     * @param body  content of the file
-     * @return true if the file was stored, false if not
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    boolean storeFile(String name, InputStream body) throws RemoteFileOperationFailedException;
-
-    /**
-     * Gets the current remote directory
-     * @return the current directory path
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    String getCurrentDirectory() throws RemoteFileOperationFailedException;
-
-    /**
-     * Change the current remote directory
-     *
-     * @param path the path to change to
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    void changeCurrentDirectory(String path) throws RemoteFileOperationFailedException;
-
-    /**
-     * List the files in the current remote directory
-     *
-     * @return a list of backing objects representing the files
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    List listFiles() throws RemoteFileOperationFailedException;
-
-    /**
-     * List the files in the given remote directory
-     *
-     * @param path  the remote directory
-     * @return a list of backing objects representing the files
-     * @throws RemoteFileOperationFailedException can be thrown
-     */
-    List listFiles(String path) throws RemoteFileOperationFailedException;
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.List;
+
+/**
+ * Remote file operations based on some backing framework
+ */
+public interface RemoteFileOperations<T> {
+
+    /**
+     * Connects to the remote server
+     *
+     * @param configuration configuraiton
+     * @return true if connected
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean connect(RemoteFileConfiguration configuration) throws RemoteFileOperationFailedException;
+
+    /**
+     * Returns whether we are connected to the remote server or not
+     *
+     * @return true if connected, false if not
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean isConnected() throws RemoteFileOperationFailedException;
+
+    /**
+     * Discconects from the remote server
+     *
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    void disconnect() throws RemoteFileOperationFailedException;
+
+    /**
+     * Deletes the file from the remote server
+     *
+     * @param name name of the file
+     * @return true if deleted, false if not
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean deleteFile(String name) throws RemoteFileOperationFailedException;
+
+    /**
+     * Renames the file on the remote server
+     *
+     * @param from original name
+     * @param to   the new name
+     * @return true if renamed, false if not
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean renameFile(String from, String to) throws RemoteFileOperationFailedException;
+
+    /**
+     * Builds the directory structure on the remote server. Will test if the folder already exists.
+     *
+     * @param directory the directory path to build
+     * @return true if build or already exists, false if not possbile (could be lack of permissions)
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean buildDirectory(String directory) throws RemoteFileOperationFailedException;
+
+    /**
+     * Retrieves the remote file (download)
+     *
+     * @param name  name of the file
+     * @param out   stream to write the content of the file into
+     * @return true if file has been retrieved, false if not
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean retrieveFile(String name, OutputStream out) throws RemoteFileOperationFailedException;
+
+    /**
+     * Stores the content as a new remote file (upload)
+     *
+     * @param name  name of new file
+     * @param body  content of the file
+     * @return true if the file was stored, false if not
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    boolean storeFile(String name, InputStream body) throws RemoteFileOperationFailedException;
+
+    /**
+     * Gets the current remote directory
+     * @return the current directory path
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    String getCurrentDirectory() throws RemoteFileOperationFailedException;
+
+    /**
+     * Change the current remote directory
+     *
+     * @param path the path to change to
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    void changeCurrentDirectory(String path) throws RemoteFileOperationFailedException;
+
+    /**
+     * List the files in the current remote directory
+     *
+     * @return a list of backing objects representing the files
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    List listFiles() throws RemoteFileOperationFailedException;
+
+    /**
+     * List the files in the given remote directory
+     *
+     * @param path  the remote directory
+     * @return a list of backing objects representing the files
+     * @throws RemoteFileOperationFailedException can be thrown
+     */
+    List listFiles(String path) throws RemoteFileOperationFailedException;
+
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileOperations.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java Mon Jan 12 00:30:05 2009
@@ -1,58 +1,58 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-/**
- * Represents a strategy for marking that a remote file is processed.
- */
-public interface RemoteFileProcessStrategy {
-
-    /**
-     * Called when work is about to begin on this file. This method may attempt to acquire some file lock before
-     * returning true; returning false if the file lock could not be obtained so that the file should be ignored.
-     *
-     * @param operations ftp operations
-     * @param endpoint the endpoint
-     * @param exchange the exchange
-     * @param file     the remote file
-     * @return true if the file can be processed (such as if a file lock could be obtained)
-     * @throws Exception can be thrown in case of errors
-     */
-    boolean begin(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file) throws Exception;
-
-    /**
-     * Releases any file locks and possibly deletes or moves the file after successful processing
-     *
-     * @param operations ftp operations
-     * @param endpoint the endpoint
-     * @param exchange the exchange
-     * @param file     the remote file
-     * @throws Exception can be thrown in case of errors
-     */
-    void commit(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file) throws Exception;
-
-    /**
-     * Releases any file locks and possibly deletes or moves the file after unsuccessful processing
-     *
-     * @param operations ftp operations
-     * @param endpoint the endpoint
-     * @param exchange the exchange
-     * @param file     the remote file
-     */
-    void rollback(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file);
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+/**
+ * Represents a strategy for marking that a remote file is processed.
+ */
+public interface RemoteFileProcessStrategy {
+
+    /**
+     * Called when work is about to begin on this file. This method may attempt to acquire some file lock before
+     * returning true; returning false if the file lock could not be obtained so that the file should be ignored.
+     *
+     * @param operations ftp operations
+     * @param endpoint the endpoint
+     * @param exchange the exchange
+     * @param file     the remote file
+     * @return true if the file can be processed (such as if a file lock could be obtained)
+     * @throws Exception can be thrown in case of errors
+     */
+    boolean begin(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file) throws Exception;
+
+    /**
+     * Releases any file locks and possibly deletes or moves the file after successful processing
+     *
+     * @param operations ftp operations
+     * @param endpoint the endpoint
+     * @param exchange the exchange
+     * @param file     the remote file
+     * @throws Exception can be thrown in case of errors
+     */
+    void commit(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file) throws Exception;
+
+    /**
+     * Releases any file locks and possibly deletes or moves the file after unsuccessful processing
+     *
+     * @param operations ftp operations
+     * @param endpoint the endpoint
+     * @param exchange the exchange
+     * @param file     the remote file
+     */
+    void rollback(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file);
+
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileProcessStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java Mon Jan 12 00:30:05 2009
@@ -1,268 +1,268 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Vector;
-
-import com.jcraft.jsch.ChannelSftp;
-import com.jcraft.jsch.JSch;
-import com.jcraft.jsch.JSchException;
-import com.jcraft.jsch.Session;
-import com.jcraft.jsch.SftpException;
-import com.jcraft.jsch.UserInfo;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import static org.apache.camel.util.ObjectHelper.isNotEmpty;
-
-/**
- * SFTP remote file operations
- */
-public class SftpRemoteFileOperations implements RemoteFileOperations<ChannelSftp> {
-    private static final Log LOG = LogFactory.getLog(SftpRemoteFileOperations.class);
-    private ChannelSftp channel;
-    private Session session;
-
-    public boolean connect(RemoteFileConfiguration configuration) throws RemoteFileOperationFailedException {
-        try {
-            if (isConnected()) {
-                // already connected
-                return true;
-            }
-            if (channel == null || !channel.isConnected()) {
-                if (session == null || !session.isConnected()) {
-                    LOG.trace("Session isn't connected, trying to recreate and connect.");
-                    session = createSession(configuration);
-                    session.connect();
-                }
-                LOG.trace("Channel isn't connected, trying to recreate and connect.");
-                channel = (ChannelSftp) session.openChannel("sftp");
-                channel.connect();
-                LOG.info("Connected to " + configuration.remoteServerInformation());
-            }
-
-            return true;
-
-        } catch (JSchException e) {
-            throw new RemoteFileOperationFailedException("Cannot connect to " + configuration.remoteServerInformation(), e);
-        }
-    }
-
-    protected Session createSession(final RemoteFileConfiguration configuration) throws JSchException {
-        final JSch jsch = new JSch();
-
-        if (isNotEmpty(configuration.getPrivateKeyFile())) {
-            LOG.debug("Using private keyfile: " + configuration.getPrivateKeyFile());
-            if (isNotEmpty(configuration.getPrivateKeyFilePassphrase())) {
-                jsch.addIdentity(configuration.getPrivateKeyFile(), configuration.getPrivateKeyFilePassphrase());
-            } else {
-                jsch.addIdentity(configuration.getPrivateKeyFile());
-            }
-        }
-
-        if (isNotEmpty(configuration.getKnownHostsFile())) {
-            LOG.debug("Using knownhosts file: " + configuration.getKnownHostsFile());
-            jsch.setKnownHosts(configuration.getKnownHostsFile());
-        }
-
-        final Session session = jsch.getSession(configuration.getUsername(), configuration.getHost(), configuration.getPort());
-        session.setUserInfo(new UserInfo() {
-            public String getPassphrase() {
-                return null;
-            }
-
-            public String getPassword() {
-                return configuration.getPassword();
-            }
-
-            public boolean promptPassword(String s) {
-                return true;
-            }
-
-            public boolean promptPassphrase(String s) {
-                return true;
-            }
-
-            public boolean promptYesNo(String s) {
-                LOG.error(s);
-                // Return 'false' indicating modification of the hosts file is disabled.
-                return false;
-            }
-
-            public void showMessage(String s) {
-            }
-        });
-        return session;
-    }
-
-    public boolean isConnected() throws RemoteFileOperationFailedException {
-        return session != null && session.isConnected() && channel != null && channel.isConnected();
-    }
-
-    public void disconnect() throws RemoteFileOperationFailedException {
-        if (session != null && session.isConnected()) {
-            session.disconnect();
-        }
-        if (channel != null && channel.isConnected()) {
-            channel.disconnect();
-        }
-    }
-
-    public boolean deleteFile(String name) throws RemoteFileOperationFailedException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Deleteing file: " + name);
-        }
-        try {
-            channel.rm(name);
-            return true;
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot delete file: " + name, e);
-        }
-    }
-
-    public boolean renameFile(String from, String to) throws RemoteFileOperationFailedException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Renaming file: " + from + " to: " + to);
-        }
-        try {
-            channel.rename(from, to);
-            return true;
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot rename file from: " + from + " to: " + to, e);
-        }
-    }
-
-    public boolean buildDirectory(String dirName) throws RemoteFileOperationFailedException {
-        boolean success = false;
-
-        String originalDirectory = getCurrentDirectory();
-        try {
-            // maybe the full directory already exsits
-            try {
-                channel.cd(dirName);
-                success = true;
-            } catch (SftpException e) {
-                // ignore, we could not change directory so try to create it instead
-            }
-
-            if (!success) {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Trying to build remote directory: " + dirName);
-                }
-
-                try {
-                    channel.mkdir(dirName);
-                    success = true;
-                } catch (SftpException e) {
-                    // we are here if the server side doesn't create intermediate folders
-                    // so create the folder one by one
-                    success = buildDirectoryChunks(dirName);
-                }
-            }
-        } catch (IOException e) {
-            throw new RemoteFileOperationFailedException("Cannot build directory " + dirName, e);
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot build directory " + dirName, e);
-        } finally {
-            // change back to original directory
-            if (originalDirectory != null) {
-                changeCurrentDirectory(originalDirectory);
-            }
-        }
-
-        return success;
-    }
-
-    private boolean buildDirectoryChunks(String dirName) throws IOException, SftpException {
-        final StringBuilder sb = new StringBuilder(dirName.length());
-        final String[] dirs = dirName.split("\\/");
-
-        boolean success = false;
-        for (String dir : dirs) {
-            sb.append(dir).append('/');
-            String directory = sb.toString();
-            if (LOG.isTraceEnabled()) {
-                LOG.trace("Trying to build remote directory: " + directory);
-            }
-
-            try {
-                channel.mkdir(directory);
-                success = true;
-            } catch (SftpException e) {
-                // ignore keep trying to create the rest of the path
-            }
-        }
-
-        return success;
-    }
-
-    public boolean retrieveFile(String name, OutputStream out) throws RemoteFileOperationFailedException {
-        try {
-            channel.get(name, out);
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot get file: " + name, e);
-        }
-        return true;
-    }
-
-    public boolean storeFile(String name, InputStream body) throws RemoteFileOperationFailedException {
-        try {
-            channel.put(body, name);
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot put file: " + name, e);
-        }
-        return true;
-    }
-
-    public String getCurrentDirectory() throws RemoteFileOperationFailedException {
-        try {
-            return channel.pwd();
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot get current directory", e);
-        }
-    }
-
-    public void changeCurrentDirectory(String path) throws RemoteFileOperationFailedException {
-        try {
-            channel.cd(path);
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot change current directory to: " + path, e);
-        }
-    }
-
-    public List listFiles() throws RemoteFileOperationFailedException {
-        return listFiles(".");
-    }
-
-    public List listFiles(String path) throws RemoteFileOperationFailedException {
-        try {
-            final List list = new ArrayList();
-            Vector files = channel.ls(path);
-            for (Object file : files) {
-                list.add(file);
-            }
-            return list;
-        } catch (SftpException e) {
-            throw new RemoteFileOperationFailedException("Cannot list directory: " + path, e);
-        }
-    }
-
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Vector;
+
+import com.jcraft.jsch.ChannelSftp;
+import com.jcraft.jsch.JSch;
+import com.jcraft.jsch.JSchException;
+import com.jcraft.jsch.Session;
+import com.jcraft.jsch.SftpException;
+import com.jcraft.jsch.UserInfo;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import static org.apache.camel.util.ObjectHelper.isNotEmpty;
+
+/**
+ * SFTP remote file operations
+ */
+public class SftpRemoteFileOperations implements RemoteFileOperations<ChannelSftp> {
+    private static final Log LOG = LogFactory.getLog(SftpRemoteFileOperations.class);
+    private ChannelSftp channel;
+    private Session session;
+
+    public boolean connect(RemoteFileConfiguration configuration) throws RemoteFileOperationFailedException {
+        try {
+            if (isConnected()) {
+                // already connected
+                return true;
+            }
+            if (channel == null || !channel.isConnected()) {
+                if (session == null || !session.isConnected()) {
+                    LOG.trace("Session isn't connected, trying to recreate and connect.");
+                    session = createSession(configuration);
+                    session.connect();
+                }
+                LOG.trace("Channel isn't connected, trying to recreate and connect.");
+                channel = (ChannelSftp) session.openChannel("sftp");
+                channel.connect();
+                LOG.info("Connected to " + configuration.remoteServerInformation());
+            }
+
+            return true;
+
+        } catch (JSchException e) {
+            throw new RemoteFileOperationFailedException("Cannot connect to " + configuration.remoteServerInformation(), e);
+        }
+    }
+
+    protected Session createSession(final RemoteFileConfiguration configuration) throws JSchException {
+        final JSch jsch = new JSch();
+
+        if (isNotEmpty(configuration.getPrivateKeyFile())) {
+            LOG.debug("Using private keyfile: " + configuration.getPrivateKeyFile());
+            if (isNotEmpty(configuration.getPrivateKeyFilePassphrase())) {
+                jsch.addIdentity(configuration.getPrivateKeyFile(), configuration.getPrivateKeyFilePassphrase());
+            } else {
+                jsch.addIdentity(configuration.getPrivateKeyFile());
+            }
+        }
+
+        if (isNotEmpty(configuration.getKnownHostsFile())) {
+            LOG.debug("Using knownhosts file: " + configuration.getKnownHostsFile());
+            jsch.setKnownHosts(configuration.getKnownHostsFile());
+        }
+
+        final Session session = jsch.getSession(configuration.getUsername(), configuration.getHost(), configuration.getPort());
+        session.setUserInfo(new UserInfo() {
+            public String getPassphrase() {
+                return null;
+            }
+
+            public String getPassword() {
+                return configuration.getPassword();
+            }
+
+            public boolean promptPassword(String s) {
+                return true;
+            }
+
+            public boolean promptPassphrase(String s) {
+                return true;
+            }
+
+            public boolean promptYesNo(String s) {
+                LOG.error(s);
+                // Return 'false' indicating modification of the hosts file is disabled.
+                return false;
+            }
+
+            public void showMessage(String s) {
+            }
+        });
+        return session;
+    }
+
+    public boolean isConnected() throws RemoteFileOperationFailedException {
+        return session != null && session.isConnected() && channel != null && channel.isConnected();
+    }
+
+    public void disconnect() throws RemoteFileOperationFailedException {
+        if (session != null && session.isConnected()) {
+            session.disconnect();
+        }
+        if (channel != null && channel.isConnected()) {
+            channel.disconnect();
+        }
+    }
+
+    public boolean deleteFile(String name) throws RemoteFileOperationFailedException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Deleteing file: " + name);
+        }
+        try {
+            channel.rm(name);
+            return true;
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot delete file: " + name, e);
+        }
+    }
+
+    public boolean renameFile(String from, String to) throws RemoteFileOperationFailedException {
+        if (LOG.isDebugEnabled()) {
+            LOG.debug("Renaming file: " + from + " to: " + to);
+        }
+        try {
+            channel.rename(from, to);
+            return true;
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot rename file from: " + from + " to: " + to, e);
+        }
+    }
+
+    public boolean buildDirectory(String dirName) throws RemoteFileOperationFailedException {
+        boolean success = false;
+
+        String originalDirectory = getCurrentDirectory();
+        try {
+            // maybe the full directory already exsits
+            try {
+                channel.cd(dirName);
+                success = true;
+            } catch (SftpException e) {
+                // ignore, we could not change directory so try to create it instead
+            }
+
+            if (!success) {
+                if (LOG.isDebugEnabled()) {
+                    LOG.debug("Trying to build remote directory: " + dirName);
+                }
+
+                try {
+                    channel.mkdir(dirName);
+                    success = true;
+                } catch (SftpException e) {
+                    // we are here if the server side doesn't create intermediate folders
+                    // so create the folder one by one
+                    success = buildDirectoryChunks(dirName);
+                }
+            }
+        } catch (IOException e) {
+            throw new RemoteFileOperationFailedException("Cannot build directory " + dirName, e);
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot build directory " + dirName, e);
+        } finally {
+            // change back to original directory
+            if (originalDirectory != null) {
+                changeCurrentDirectory(originalDirectory);
+            }
+        }
+
+        return success;
+    }
+
+    private boolean buildDirectoryChunks(String dirName) throws IOException, SftpException {
+        final StringBuilder sb = new StringBuilder(dirName.length());
+        final String[] dirs = dirName.split("\\/");
+
+        boolean success = false;
+        for (String dir : dirs) {
+            sb.append(dir).append('/');
+            String directory = sb.toString();
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Trying to build remote directory: " + directory);
+            }
+
+            try {
+                channel.mkdir(directory);
+                success = true;
+            } catch (SftpException e) {
+                // ignore keep trying to create the rest of the path
+            }
+        }
+
+        return success;
+    }
+
+    public boolean retrieveFile(String name, OutputStream out) throws RemoteFileOperationFailedException {
+        try {
+            channel.get(name, out);
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot get file: " + name, e);
+        }
+        return true;
+    }
+
+    public boolean storeFile(String name, InputStream body) throws RemoteFileOperationFailedException {
+        try {
+            channel.put(body, name);
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot put file: " + name, e);
+        }
+        return true;
+    }
+
+    public String getCurrentDirectory() throws RemoteFileOperationFailedException {
+        try {
+            return channel.pwd();
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot get current directory", e);
+        }
+    }
+
+    public void changeCurrentDirectory(String path) throws RemoteFileOperationFailedException {
+        try {
+            channel.cd(path);
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot change current directory to: " + path, e);
+        }
+    }
+
+    public List listFiles() throws RemoteFileOperationFailedException {
+        return listFiles(".");
+    }
+
+    public List listFiles(String path) throws RemoteFileOperationFailedException {
+        try {
+            final List list = new ArrayList();
+            Vector files = channel.ls(path);
+            for (Object file : files) {
+                list.add(file);
+            }
+            return list;
+        } catch (SftpException e) {
+            throw new RemoteFileOperationFailedException("Cannot list directory: " + path, e);
+        }
+    }
+
 }
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpRemoteFileOperations.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java Mon Jan 12 00:30:05 2009
@@ -1,81 +1,81 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote.strategy;
-
-import org.apache.camel.component.file.remote.RemoteFile;
-import org.apache.camel.component.file.remote.RemoteFileExchange;
-
-public class DefaultRemoteFileRenamer implements RemoteFileRenamer {
-
-    private String namePrefix;
-    private String namePostfix;
-
-    public DefaultRemoteFileRenamer() {
-    }
-
-    public DefaultRemoteFileRenamer(String namePrefix, String namePostfix) {
-        this.namePrefix = namePrefix;
-        this.namePostfix = namePostfix;
-    }
-
-    public RemoteFile renameFile(RemoteFileExchange exchange, RemoteFile file) {
-        String newName = renameFileName(file.getFileName());
-
-        // clone and change the name
-        RemoteFile result = file.clone();
-        result.changeFileName(newName);
-        return result;
-    }
-
-    public String getNamePostfix() {
-        return namePostfix;
-    }
-
-    /**
-     * Sets the name postfix appended to moved files. For example
-     * to rename all the files from * to *.done set this value to ".done"
-     */
-    public void setNamePostfix(String namePostfix) {
-        this.namePostfix = namePostfix;
-    }
-
-    public String getNamePrefix() {
-        return namePrefix;
-    }
-
-    /**
-     * Sets the name prefix appended to moved files. For example
-     * to move processed files into a hidden directory called ".camel"
-     * set this value to ".camel/"
-     */
-    public void setNamePrefix(String namePrefix) {
-        this.namePrefix = namePrefix;
-    }
-
-    protected String renameFileName(String name) {
-        StringBuffer buffer = new StringBuffer();
-        if (namePrefix != null) {
-            buffer.append(namePrefix);
-        }
-        buffer.append(name);
-        if (namePostfix != null) {
-            buffer.append(namePostfix);
-        }
-        return buffer.toString();
-    }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote.strategy;
+
+import org.apache.camel.component.file.remote.RemoteFile;
+import org.apache.camel.component.file.remote.RemoteFileExchange;
+
+public class DefaultRemoteFileRenamer implements RemoteFileRenamer {
+
+    private String namePrefix;
+    private String namePostfix;
+
+    public DefaultRemoteFileRenamer() {
+    }
+
+    public DefaultRemoteFileRenamer(String namePrefix, String namePostfix) {
+        this.namePrefix = namePrefix;
+        this.namePostfix = namePostfix;
+    }
+
+    public RemoteFile renameFile(RemoteFileExchange exchange, RemoteFile file) {
+        String newName = renameFileName(file.getFileName());
+
+        // clone and change the name
+        RemoteFile result = file.clone();
+        result.changeFileName(newName);
+        return result;
+    }
+
+    public String getNamePostfix() {
+        return namePostfix;
+    }
+
+    /**
+     * Sets the name postfix appended to moved files. For example
+     * to rename all the files from * to *.done set this value to ".done"
+     */
+    public void setNamePostfix(String namePostfix) {
+        this.namePostfix = namePostfix;
+    }
+
+    public String getNamePrefix() {
+        return namePrefix;
+    }
+
+    /**
+     * Sets the name prefix appended to moved files. For example
+     * to move processed files into a hidden directory called ".camel"
+     * set this value to ".camel/"
+     */
+    public void setNamePrefix(String namePrefix) {
+        this.namePrefix = namePrefix;
+    }
+
+    protected String renameFileName(String name) {
+        StringBuffer buffer = new StringBuffer();
+        if (namePrefix != null) {
+            buffer.append(namePrefix);
+        }
+        buffer.append(name);
+        if (namePostfix != null) {
+            buffer.append(namePostfix);
+        }
+        return buffer.toString();
+    }
+
+}

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DefaultRemoteFileRenamer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java?rev=733650&r1=733649&r2=733650&view=diff
==============================================================================
--- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java (original)
+++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java Mon Jan 12 00:30:05 2009
@@ -1,35 +1,35 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.camel.component.file.remote.strategy;
-
-import org.apache.camel.component.file.remote.RemoteFile;
-import org.apache.camel.component.file.remote.RemoteFileEndpoint;
-import org.apache.camel.component.file.remote.RemoteFileExchange;
-import org.apache.camel.component.file.remote.RemoteFileOperationFailedException;
-import org.apache.camel.component.file.remote.RemoteFileOperations;
-
-public class DeleteRemoteFileProcessStrategy extends RemoteFileProcessStrategySupport {
-
-    @Override
-    public void commit(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file) throws Exception {
-        boolean deleted = operations.deleteFile(file.getAbsolutelFileName());
-        if (!deleted) {
-            throw new RemoteFileOperationFailedException("Cannot delete file: " + file);
-        }
-    }
-
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote.strategy;
+
+import org.apache.camel.component.file.remote.RemoteFile;
+import org.apache.camel.component.file.remote.RemoteFileEndpoint;
+import org.apache.camel.component.file.remote.RemoteFileExchange;
+import org.apache.camel.component.file.remote.RemoteFileOperationFailedException;
+import org.apache.camel.component.file.remote.RemoteFileOperations;
+
+public class DeleteRemoteFileProcessStrategy extends RemoteFileProcessStrategySupport {
+
+    @Override
+    public void commit(RemoteFileOperations operations, RemoteFileEndpoint endpoint, RemoteFileExchange exchange, RemoteFile file) throws Exception {
+        boolean deleted = operations.deleteFile(file.getAbsolutelFileName());
+        if (!deleted) {
+            throw new RemoteFileOperationFailedException("Cannot delete file: " + file);
+        }
+    }
+
 }
\ No newline at end of file

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/strategy/DeleteRemoteFileProcessStrategy.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date