Author: ningjiang
Date: Thu Jul 31 22:00:54 2008
New Revision: 681600
URL: http://svn.apache.org/viewvc?rev=681600&view=rev
Log:
Fixed the build error of my last commit
Modified:
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java
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/SftpProducer.java
Modified:
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java?rev=681600&r1=681599&r2=681600&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
(original)
+++
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
Thu Jul 31 22:00:54 2008
@@ -44,18 +44,18 @@
}
protected void doStart() throws Exception {
- LOG.info("Starting");
+ log.info("Starting");
super.doStart();
}
protected void doStop() throws Exception {
- LOG.info("Stopping");
+ log.info("Stopping");
// disconnect when stopping
try {
disconnect();
} catch (Exception e) {
// ignore just log a warning
- LOG.warn("Exception occured during disconecting from " +
remoteServer() + ". "
+ log.warn("Exception occured during disconecting from " +
remoteServer() + ". "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
}
super.doStop();
@@ -63,22 +63,22 @@
protected void connectIfNecessary() throws IOException {
if (!client.isConnected()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Not connected, connecting to " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Not connected, connecting to " + remoteServer());
}
FtpUtils.connect(client, endpoint.getConfiguration());
- LOG.info("Connected to " + remoteServer());
+ log.info("Connected to " + remoteServer());
}
}
protected void disconnect() throws IOException {
- LOG.debug("Disconnecting from " + remoteServer());
+ log.debug("Disconnecting from " + remoteServer());
FtpUtils.disconnect(client);
}
protected void poll() throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Polling " + endpoint.getConfiguration());
+ if (log.isTraceEnabled()) {
+ log.trace("Polling " + endpoint.getConfiguration());
}
connectIfNecessary();
// If the attempt to connect isn't successful, then the thrown
@@ -101,10 +101,10 @@
} catch (Exception e) {
if (isStopping() || isStopped()) {
// if we are stopping then ignore any exception during a poll
- LOG.warn("Consumer is stopping. Ignoring caught exception: "
+ log.warn("Consumer is stopping. Ignoring caught exception: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
} else {
- LOG.warn("Exception occured during polling: "
+ log.warn("Exception occured during polling: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
disconnect();
// Rethrow to signify that we didn't poll
@@ -114,8 +114,8 @@
}
protected void pollDirectory(String dir) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Polling directory: " + dir);
+ if (log.isTraceEnabled()) {
+ log.trace("Polling directory: " + dir);
}
String currentDir = client.printWorkingDirectory();
@@ -128,7 +128,7 @@
pollDirectory(getFullFileName(ftpFile));
}
} else {
- LOG.debug("Unsupported type of FTPFile: " + ftpFile + " (not a
file or directory). It is skipped.");
+ log.debug("Unsupported type of FTPFile: " + ftpFile + " (not a
file or directory). It is skipped.");
}
}
@@ -145,8 +145,8 @@
return;
}
- if (LOG.isTraceEnabled()) {
- LOG.trace("Polling file: " + ftpFile);
+ if (log.isTraceEnabled()) {
+ log.trace("Polling file: " + ftpFile);
}
long ts = ftpFile.getTimestamp().getTimeInMillis();
@@ -162,8 +162,8 @@
// retrieve the file
final ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream();
client.retrieveFile(ftpFile.getName(), byteArrayOutputStream);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Retrieved file: " + ftpFile.getName() + " from: " +
remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Retrieved file: " + ftpFile.getName() + " from: " +
remoteServer());
}
RemoteFileExchange exchange =
endpoint.createExchange(fullFileName, byteArrayOutputStream);
@@ -174,27 +174,27 @@
String relativePath =
fullFileName.substring(ftpBasePath.length() + 1);
relativePath = relativePath.replaceFirst("/", "");
- if (LOG.isDebugEnabled()) {
- LOG.debug("Setting exchange filename to " + relativePath);
+ if (log.isDebugEnabled()) {
+ log.debug("Setting exchange filename to " + relativePath);
}
exchange.getIn().setHeader(FileComponent.HEADER_FILE_NAME,
relativePath);
}
if (deleteFile) {
// delete file after consuming
- if (LOG.isDebugEnabled()) {
- LOG.debug("Deleteing file: " + ftpFile.getName() + " from:
" + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Deleteing file: " + ftpFile.getName() + " from:
" + remoteServer());
}
boolean deleted = client.deleteFile(ftpFile.getName());
if (!deleted) {
// ignore just log a warning
- LOG.warn("Can not delete file: " + ftpFile.getName() + "
from: " + remoteServer());
+ log.warn("Can not delete file: " + ftpFile.getName() + "
from: " + remoteServer());
}
} else if (isMoveFile()) {
String fromName = ftpFile.getName();
String toName = getMoveFileName(fromName);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Moving file: " + fromName + " to: " + toName);
+ if (log.isDebugEnabled()) {
+ log.debug("Moving file: " + fromName + " to: " + toName);
}
// delete any existing file
@@ -206,7 +206,7 @@
if (lastPathIndex != -1) {
String directory = toName.substring(0, lastPathIndex);
if (!FtpUtils.buildDirectory(client, directory)) {
- LOG.warn("Can not build directory: " + directory +
" (maybe because of denied permissions)");
+ log.warn("Can not build directory: " + directory +
" (maybe because of denied permissions)");
}
}
}
@@ -214,7 +214,7 @@
// try to rename
boolean success = client.rename(fromName, toName);
if (!success) {
- LOG.warn("Can not move file: " + fromName + " to: " +
toName);
+ log.warn("Can not move file: " + fromName + " to: " +
toName);
}
}
@@ -223,8 +223,8 @@
}
protected void acquireExclusiveReadLock(FTPClient client, FTPFile ftpFile)
throws IOException {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Waiting for exclusive read lock to file: " + ftpFile);
+ if (log.isTraceEnabled()) {
+ log.trace("Waiting for exclusive read lock to file: " + ftpFile);
}
// the trick is to try to rename the file, if we can rename then we
have exclusive read
@@ -235,13 +235,13 @@
while (!exclusive) {
exclusive = client.rename(originalName, newName);
if (exclusive) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Acquired exclusive read lock to file: " +
originalName);
+ if (log.isDebugEnabled()) {
+ log.debug("Acquired exclusive read lock to file: " +
originalName);
}
// rename it back so we can read it
client.rename(newName, originalName);
} else {
- LOG.trace("Exclusive read lock not granted. Sleeping for 1000
millis.");
+ log.trace("Exclusive read lock not granted. Sleeping for 1000
millis.");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
Modified:
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java
URL:
http://svn.apache.org/viewvc/activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java?rev=681600&r1=681599&r2=681600&view=diff
==============================================================================
---
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java
(original)
+++
activemq/camel/trunk/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpProducer.java
Thu Jul 31 22:00:54 2008
@@ -35,8 +35,8 @@
}
public void process(Exchange exchange) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Processing " + endpoint.getConfiguration());
+ if (log.isTraceEnabled()) {
+ log.trace("Processing " + endpoint.getConfiguration());
}
connectIfNecessary();
// If the attempt to connect isn't successful, then the thrown
@@ -46,10 +46,10 @@
} catch (Exception e) {
if (isStopping() || isStopped()) {
// if we are stopping then ignore any exception during a poll
- LOG.warn("Producer is stopping. Ignoring caught exception: "
+ log.warn("Producer is stopping. Ignoring caught exception: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
} else {
- LOG.warn("Exception occured during processing: "
+ log.warn("Exception occured during processing: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
disconnect();
// Rethrow to signify that we didn't poll
@@ -60,17 +60,17 @@
protected void connectIfNecessary() throws IOException {
if (!client.isConnected()) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Not connected, connecting to " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Not connected, connecting to " + remoteServer());
}
FtpUtils.connect(client, endpoint.getConfiguration());
- LOG.info("Connected to " + remoteServer());
+ log.info("Connected to " + remoteServer());
}
}
public void disconnect() throws IOException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Disconnecting from " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Disconnecting from " + remoteServer());
}
FtpUtils.disconnect(client);
}
@@ -84,7 +84,7 @@
if (lastPathIndex != -1) {
String directory = fileName.substring(0, lastPathIndex);
if (!FtpUtils.buildDirectory(client, directory)) {
- LOG.warn("Couldn't build directory: " + directory + "
(could be because of denied permissions)");
+ log.warn("Couldn't build directory: " + directory + "
(could be because of denied permissions)");
}
}
@@ -93,7 +93,7 @@
throw new RuntimeCamelException("Error sending file: " +
fileName + " to: " + remoteServer());
}
- LOG.info("Sent: " + fileName + " to: " + remoteServer());
+ log.info("Sent: " + fileName + " to: " + remoteServer());
} finally {
if (payload != null) {
payload.close();
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=681600&r1=681599&r2=681600&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 Jul 31 22:00:54 2008
@@ -48,18 +48,18 @@
}
protected void doStart() throws Exception {
- LOG.info("Starting");
+ log.info("Starting");
super.doStart();
}
protected void doStop() throws Exception {
- LOG.info("Stopping");
+ log.info("Stopping");
// disconnect when stopping
try {
disconnect();
} catch (Exception e) {
// ignore just log a warning
- LOG.warn("Exception occured during disconecting from " +
remoteServer() + ". "
+ log.warn("Exception occured during disconecting from " +
remoteServer() + ". "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
}
super.doStop();
@@ -68,20 +68,20 @@
protected void connectIfNecessary() throws JSchException {
if (channel == null || !channel.isConnected()) {
if (session == null || !session.isConnected()) {
- LOG.debug("Session isn't connected, trying to recreate and
connect.");
+ log.debug("Session isn't connected, trying to recreate and
connect.");
session = endpoint.createSession();
session.connect();
}
- LOG.debug("Channel isn't connected, trying to recreate and
connect.");
+ log.debug("Channel isn't connected, trying to recreate and
connect.");
channel = endpoint.createChannelSftp(session);
channel.connect();
- LOG.info("Connected to " + remoteServer());
+ log.info("Connected to " + remoteServer());
}
}
protected void disconnect() throws JSchException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Disconnecting from " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Disconnecting from " + remoteServer());
}
if (session != null) {
session.disconnect();
@@ -92,8 +92,8 @@
}
protected void poll() throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Polling " + endpoint.getConfiguration());
+ if (log.isTraceEnabled()) {
+ log.trace("Polling " + endpoint.getConfiguration());
}
connectIfNecessary();
// If the attempt to connect isn't successful, then the thrown
@@ -118,10 +118,10 @@
} catch (Exception e) {
if (isStopping() || isStopped()) {
// if we are stopping then ignore any exception during a poll
- LOG.warn("Consumer is stopping. Ignoring caught exception: "
+ log.warn("Consumer is stopping. Ignoring caught exception: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
} else {
- LOG.warn("Exception occured during polling: "
+ log.warn("Exception occured during polling: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
disconnect();
// Rethrow to signify that we didn't poll
@@ -131,8 +131,8 @@
}
protected void pollDirectory(String dir) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Polling directory: " + dir);
+ if (log.isTraceEnabled()) {
+ log.trace("Polling directory: " + dir);
}
String currentDir = channel.pwd();
@@ -160,8 +160,8 @@
}
private void pollFile(ChannelSftp.LsEntry sftpFile) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Polling file: " + sftpFile);
+ if (log.isTraceEnabled()) {
+ log.trace("Polling file: " + sftpFile);
}
long ts = sftpFile.getAttrs().getMTime() * 1000L;
@@ -178,8 +178,8 @@
// retrieve the file
final ByteArrayOutputStream byteArrayOutputStream = new
ByteArrayOutputStream();
channel.get(sftpFile.getFilename(), byteArrayOutputStream);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Retrieved file: " + sftpFile.getFilename() + "
from: " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Retrieved file: " + sftpFile.getFilename() + "
from: " + remoteServer());
}
RemoteFileExchange exchange =
endpoint.createExchange(getFullFileName(sftpFile), byteArrayOutputStream);
@@ -189,23 +189,23 @@
String relativePath =
fullFileName.substring(ftpBasePath.length() + 1);
relativePath = relativePath.replaceFirst("/", "");
- if (LOG.isDebugEnabled()) {
- LOG.debug("Setting exchange filename to " + relativePath);
+ if (log.isDebugEnabled()) {
+ log.debug("Setting exchange filename to " + relativePath);
}
exchange.getIn().setHeader(FileComponent.HEADER_FILE_NAME,
relativePath);
}
if (deleteFile) {
// delete file after consuming
- if (LOG.isDebugEnabled()) {
- LOG.debug("Deleteing file: " + sftpFile.getFilename() + "
from: " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Deleteing file: " + sftpFile.getFilename() + "
from: " + remoteServer());
}
deleteFile(sftpFile.getFilename());
} else if (isMoveFile()) {
String fromName = sftpFile.getFilename();
String toName = getMoveFileName(fromName);
- if (LOG.isDebugEnabled()) {
- LOG.debug("Moving file: " + fromName + " to: " + toName);
+ if (log.isDebugEnabled()) {
+ log.debug("Moving file: " + fromName + " to: " + toName);
}
// delete any existing file
@@ -217,7 +217,7 @@
if (lastPathIndex != -1) {
String directory = toName.substring(0, lastPathIndex);
if (!SftpUtils.buildDirectory(channel, directory)) {
- LOG.warn("Can not build directory: " + directory +
" (maybe because of denied permissions)");
+ log.warn("Can not build directory: " + directory +
" (maybe because of denied permissions)");
}
}
}
@@ -227,7 +227,7 @@
channel.rename(fromName, toName);
} catch (SftpException e) {
// ignore just log a warning
- LOG.warn("Can not move file: " + fromName + " to: " +
toName);
+ log.warn("Can not move file: " + fromName + " to: " +
toName);
}
}
@@ -241,14 +241,14 @@
return true;
} catch (SftpException e) {
// ignore just log a warning
- LOG.warn("Could not delete file: " + filename + " from: " +
remoteServer());
+ log.warn("Could not delete file: " + filename + " from: " +
remoteServer());
return false;
}
}
protected void acquireExclusiveReadLock(ChannelSftp.LsEntry sftpFile)
throws SftpException {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Waiting for exclusive read lock to file: " + sftpFile);
+ if (log.isTraceEnabled()) {
+ log.trace("Waiting for exclusive read lock to file: " + sftpFile);
}
// the trick is to try to rename the file, if we can rename then we
have exclusive read
@@ -265,13 +265,13 @@
}
if (exclusive) {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Acquired exclusive read lock to file: " +
originalName);
+ if (log.isDebugEnabled()) {
+ log.debug("Acquired exclusive read lock to file: " +
originalName);
}
// rename it back so we can read it
channel.rename(newName, originalName);
} else {
- LOG.trace("Exclusive read lock not granted. Sleeping for 1000
millis");
+ log.trace("Exclusive read lock not granted. Sleeping for 1000
millis");
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
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=681600&r1=681599&r2=681600&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 Jul 31 22:00:54 2008
@@ -36,8 +36,8 @@
}
public void process(Exchange exchange) throws Exception {
- if (LOG.isTraceEnabled()) {
- LOG.trace("Processing " + endpoint.getConfiguration());
+ if (log.isTraceEnabled()) {
+ log.trace("Processing " + endpoint.getConfiguration());
}
connectIfNecessary();
// If the attempt to connect isn't successful, then the thrown
@@ -47,10 +47,10 @@
} catch (Exception e) {
if (isStopping() || isStopped()) {
// if we are stopping then ignore any exception during a poll
- LOG.warn("Producer is stopping. Ignoring caught exception: "
+ log.warn("Producer is stopping. Ignoring caught exception: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
} else {
- LOG.warn("Exception occured during processing: "
+ log.warn("Exception occured during processing: "
+ e.getClass().getCanonicalName() + " message: " +
e.getMessage());
disconnect();
// Rethrow to signify that we didn't poll
@@ -62,20 +62,20 @@
protected void connectIfNecessary() throws JSchException {
if (channel == null || !channel.isConnected()) {
if (session == null || !session.isConnected()) {
- LOG.debug("Session isn't connected, trying to recreate and
connect.");
+ log.debug("Session isn't connected, trying to recreate and
connect.");
session = endpoint.createSession();
session.connect();
}
- LOG.debug("Channel isn't connected, trying to recreate and
connect.");
+ log.debug("Channel isn't connected, trying to recreate and
connect.");
channel = endpoint.createChannelSftp(session);
channel.connect();
- LOG.info("Connected to " +
endpoint.getConfiguration().remoteServerInformation());
+ log.info("Connected to " +
endpoint.getConfiguration().remoteServerInformation());
}
}
protected void disconnect() throws JSchException {
- if (LOG.isDebugEnabled()) {
- LOG.debug("Disconnecting from " + remoteServer());
+ if (log.isDebugEnabled()) {
+ log.debug("Disconnecting from " + remoteServer());
}
if (session != null) {
session.disconnect();
@@ -96,13 +96,13 @@
String directory = fileName.substring(0, lastPathIndex);
boolean success = SftpUtils.buildDirectory(channel, directory);
if (!success) {
- LOG.warn("Couldn't build directory: " + directory + "
(could be because of denied permissions)");
+ log.warn("Couldn't build directory: " + directory + "
(could be because of denied permissions)");
}
}
channel.put(payload, fileName);
- LOG.info("Sent: " + fileName + " to: " + remoteServer);
+ log.info("Sent: " + fileName + " to: " + remoteServer);
} finally {
if (payload != null) {
payload.close();