You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ha...@apache.org on 2008/03/07 03:17:21 UTC
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
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());