Author: davsclaus Date: Tue Mar 10 08:21:33 2009 New Revision: 752021 URL: http://svn.apache.org/viewvc?rev=752021&view=rev Log: Removed code not needed.
Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java (with props) Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java?rev=752021&r1=752020&r2=752021&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java Tue Mar 10 08:21:33 2009 @@ -72,22 +72,6 @@ } } - protected void pollFile(String fileName, List<GenericFile<File>> fileList) { - File file = new File(fileName); - - if (!file.exists()) { - return; - } - - // createa a generic file - GenericFile<File> gf = asGenericFile(endpointPath, file); - - if (isValidFile(gf, false)) { - // matched file so add - fileList.add(gf); - } - } - /** * Creates a new GenericFile<File> based on the given file. * Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java?rev=752021&r1=752020&r2=752021&view=diff ============================================================================== --- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java (original) +++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConsumer.java Tue Mar 10 08:21:33 2009 @@ -118,14 +118,6 @@ protected abstract void pollDirectory(String fileName, List<GenericFile<T>> fileList); /** - * Polls the given file - * - * @param fileName the file name - * @param fileList current list of files gathered - */ - protected abstract void pollFile(String fileName, List<GenericFile<T>> fileList); - - /** * Processes the exchange * * @param exchange the exchange Added: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java?rev=752021&view=auto ============================================================================== --- camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java (added) +++ camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java Tue Mar 10 08:21:33 2009 @@ -0,0 +1,37 @@ +/** + * 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; + +import org.apache.camel.ContextTestSupport; +import org.apache.camel.Endpoint; + +/** + * @version $Revision$ + */ +public class FileConsumerEndpointNotDirectoryTest extends ContextTestSupport { + + public void testEndpointIsNotDirectory() throws Exception { + // starting file must be a directory + Endpoint endpoint = context.getEndpoint("file://myfile.txt"); + try { + endpoint.createPollingConsumer().start(); + } catch (IllegalArgumentException e) { + assertEquals("Only directory is supported. Endpoint must be configured with a valid starting directory: myfile.txt", e.getMessage()); + } + } + +} Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/camel-core/src/test/java/org/apache/camel/component/file/FileConsumerEndpointNotDirectoryTest.java ------------------------------------------------------------------------------ svn:keywords = Rev Date Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java?rev=752021&r1=752020&r2=752021&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java Tue Mar 10 08:21:33 2009 @@ -68,30 +68,6 @@ } } - protected void pollFile(String fileName, List<GenericFile<FTPFile>> fileList) { - String directory = "."; - int index = fileName.lastIndexOf("/"); - if (index > -1) { - directory = fileName.substring(0, index); - } - // list the files in the fold and poll the first file - List<FTPFile> list = operations.listFiles(fileName); - if (list.size() > 0) { - FTPFile file = list.get(0); - if (file != null) { - RemoteFile<FTPFile> remoteFile = asRemoteFile(directory, file); - if (isValidFile(remoteFile, false)) { - // matched file so add - fileList.add(remoteFile); - } - } - } else { - if (log.isTraceEnabled()) { - log.trace("Polled [" + fileName + "]. No files found"); - } - } - } - @SuppressWarnings("unchecked") private RemoteFile<FTPFile> asRemoteFile(String directory, FTPFile file) { RemoteFile<FTPFile> answer = new RemoteFile<FTPFile>(); Modified: camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java?rev=752021&r1=752020&r2=752021&view=diff ============================================================================== --- camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java (original) +++ camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java Tue Mar 10 08:21:33 2009 @@ -68,36 +68,6 @@ } } - /** - * Polls the given file - * - * @param fileName the file name - * @param fileList current list of files gathered - */ - protected void pollFile(String fileName, List<GenericFile<ChannelSftp.LsEntry>> fileList) { - String directory = "."; - int index = fileName.lastIndexOf("/"); - if (index > -1) { - directory = fileName.substring(0, index); - } - // list the files in the fold and poll the first file - List<ChannelSftp.LsEntry> list = operations.listFiles(fileName); - if (list.size() > 0) { - ChannelSftp.LsEntry file = list.get(0); - if (file != null) { - RemoteFile<ChannelSftp.LsEntry> remoteFile = asRemoteFile(directory, file); - if (isValidFile(remoteFile, false)) { - // matched file so add - fileList.add(remoteFile); - } - } - } else { - if (log.isTraceEnabled()) { - log.trace("Polled [" + fileName + "]. No files found"); - } - } - } - private RemoteFile<ChannelSftp.LsEntry> asRemoteFile(String directory, ChannelSftp.LsEntry file) { RemoteFile<ChannelSftp.LsEntry> answer = new RemoteFile<ChannelSftp.LsEntry>();