Return-Path: Delivered-To: apmail-activemq-camel-commits-archive@locus.apache.org Received: (qmail 85612 invoked from network); 7 Mar 2008 02:17:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Mar 2008 02:17:43 -0000 Received: (qmail 3929 invoked by uid 500); 7 Mar 2008 02:17:40 -0000 Delivered-To: apmail-activemq-camel-commits-archive@activemq.apache.org Received: (qmail 3903 invoked by uid 500); 7 Mar 2008 02:17:39 -0000 Mailing-List: contact camel-commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-dev@activemq.apache.org Delivered-To: mailing list camel-commits@activemq.apache.org Received: (qmail 3894 invoked by uid 99); 7 Mar 2008 02:17:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Mar 2008 18:17:39 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Mar 2008 02:17:12 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A3E861A9832; Thu, 6 Mar 2008 18:17:22 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r634501 - in /activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote: SftpConsumer.java SftpEndpoint.java SftpProducer.java Date: Fri, 07 Mar 2008 02:17:21 -0000 To: camel-commits@activemq.apache.org From: hadrian@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080307021722.A3E861A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hadrian Date: Thu Mar 6 18:17:05 2008 New Revision: 634501 URL: http://svn.apache.org/viewvc?rev=634501&view=rev Log: CAMEL-370. Patch applied with thanks! Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java?rev=634501&r1=634500&r2=634501&view=diff ============================================================================== --- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java (original) +++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java Thu Mar 6 18:17:05 2008 @@ -41,27 +41,27 @@ private Session session; private boolean setNames = false; - public SftpConsumer(SftpEndpoint endpoint, Processor processor, ChannelSftp channel) { + public SftpConsumer(SftpEndpoint endpoint, Processor processor, Session session) { super(endpoint, processor); this.endpoint = endpoint; - this.channel = channel; + this.session = session; } - public SftpConsumer(SftpEndpoint endpoint, Processor processor, ChannelSftp channel, ScheduledExecutorService executor) { + public SftpConsumer(SftpEndpoint endpoint, Processor processor, Session session, ScheduledExecutorService executor) { super(endpoint, processor, executor); this.endpoint = endpoint; - this.channel = channel; + this.session = session; } // TODO: is there a way to avoid copy-pasting the reconnect logic? protected void connectIfNecessary() throws JSchException { if (channel == null || !channel.isConnected()) { if (session == null || !session.isConnected()) { - LOG.warn("Session isn't connected, trying to recreate and connect..."); + LOG.info("Session isn't connected, trying to recreate and connect..."); session = endpoint.createSession(); session.connect(); } - LOG.warn("Channel isn't connected, trying to recreate and connect..."); + LOG.info("Channel isn't connected, trying to recreate and connect..."); channel = endpoint.createChannelSftp(session); channel.connect(); LOG.info("Connected to " + endpoint.getConfiguration().toString()); @@ -133,10 +133,7 @@ } private void pollFile(ChannelSftp.LsEntry sftpFile) throws Exception { - if (sftpFile.getAttrs().getMTime() * 1000 > lastPollTime) { // TODO do - // we need - // to adjust - // the TZ? + if (sftpFile.getAttrs().getMTime() * 1000L > lastPollTime) { if (isMatched(sftpFile)) { final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); channel.get(sftpFile.getFilename(), byteArrayOutputStream); Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java?rev=634501&r1=634500&r2=634501&view=diff ============================================================================== --- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java (original) +++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpEndpoint.java Thu Mar 6 18:17:05 2008 @@ -33,7 +33,7 @@ } public SftpConsumer createConsumer(Processor processor) throws Exception { - final SftpConsumer consumer = new SftpConsumer(this, processor, createChannelSftp(createSession())); + final SftpConsumer consumer = new SftpConsumer(this, processor, createSession()); configureConsumer(consumer); return consumer; } @@ -48,7 +48,7 @@ } public String getPassword() { - return SftpEndpoint.this.getConfiguration().getPassword(); + return getConfiguration().getPassword(); } public boolean promptPassword(String string) { Modified: activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java URL: http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java?rev=634501&r1=634500&r2=634501&view=diff ============================================================================== --- activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java (original) +++ activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpProducer.java Thu Mar 6 18:17:05 2008 @@ -45,11 +45,11 @@ protected void connectIfNecessary() throws JSchException { if (channel == null || !channel.isConnected()) { if (session == null || !session.isConnected()) { - LOG.warn("Session isn't connected, trying to recreate and connect..."); + LOG.info("Session isn't connected, trying to recreate and connect..."); session = endpoint.createSession(); session.connect(); } - LOG.warn("Channel isn't connected, trying to recreate and connect..."); + LOG.info("Channel isn't connected, trying to recreate and connect..."); channel = endpoint.createChannelSftp(session); channel.connect(); LOG.info("Connected to " + endpoint.getConfiguration().toString());