edtFTPj/Free - Open-source FTP library for Java | Download


com.enterprisedt.net.ftp
Class EventCollector

java.lang.Object
  extended by com.enterprisedt.net.ftp.EventCollector
All Implemented Interfaces:
EventListener

public class EventCollector
extends java.lang.Object
implements EventListener

Logs events in an internal buffer.

Version:
$Revision: 1.1 $
Author:
Hans Andersen

Constructor Summary
EventCollector()
           
 
Method Summary
 void bytesTransferred(java.lang.String connId, java.lang.String remoteFilename, long count)
          Report the number of bytes transferred so far.
 void clearLog()
          Clear the log of all messages
 void commandSent(java.lang.String connId, java.lang.String cmd)
          Log an FTP command being sent to the server.
 void downloadCompleted(java.lang.String connId, java.lang.String remoteFilename)
          Notifies that a download has completed
 void downloadStarted(java.lang.String connId, java.lang.String remoteFilename)
          Notifies that a download has started
 java.lang.String getLog()
          Get the log of messages
 boolean isLogCommands()
          Are commands and replies being logged? Default is true.
 boolean isLogConnectionIdentifiers()
          Are connection identifiers being logged? Default is false.
 boolean isLogTransferProgress()
          Is transfer progress being logged? Default is false.
 boolean isLogTransferStartComplete()
          Are transfer start and complete events being logged? Default is true.
 void replyReceived(java.lang.String connId, java.lang.String reply)
          Log an FTP reply being sent back to the client.
 void setLogCommands(boolean logCommands)
          Should commands and replies be logged? Default is true.
 void setLogConnectionIdentifiers(boolean logConnectionIdentifiers)
          Should connection identifiers be logged? Default is false.
 void setLogTransferProgress(boolean logTransferProgress)
          Should transfer progress be logged? Default is false.
 void setLogTransferStartComplete(boolean logTransferStartComplete)
          Should transfer start and complete events be logged? Default is true.
 void uploadCompleted(java.lang.String connId, java.lang.String remoteFilename)
          Notifies that an upload has completed
 void uploadStarted(java.lang.String connId, java.lang.String remoteFilename)
          Notifies that an upload has started
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventCollector

public EventCollector()
Method Detail

isLogConnectionIdentifiers

public boolean isLogConnectionIdentifiers()
Are connection identifiers being logged? Default is false.

Returns:
true if connection identifiers are being logged.

setLogConnectionIdentifiers

public void setLogConnectionIdentifiers(boolean logConnectionIdentifiers)
Should connection identifiers be logged? Default is false.

Parameters:
logCommands - true to enable logging of connection identifiers.

isLogCommands

public boolean isLogCommands()
Are commands and replies being logged? Default is true.

Returns:
true if commands and replies are being logged.

setLogCommands

public void setLogCommands(boolean logCommands)
Should commands and replies be logged? Default is true.

Parameters:
logCommands - true to enable logging of commands and replies.

isLogTransferStartComplete

public boolean isLogTransferStartComplete()
Are transfer start and complete events being logged? Default is true.

Returns:
true if transfer start and complete events are being logged.

setLogTransferStartComplete

public void setLogTransferStartComplete(boolean logTransferStartComplete)
Should transfer start and complete events be logged? Default is true.

Parameters:
logTransferStartComplete - true if transfer start and complete events are to be logged.

isLogTransferProgress

public boolean isLogTransferProgress()
Is transfer progress being logged? Default is false.

Returns:
true if transfer progress being logged.

setLogTransferProgress

public void setLogTransferProgress(boolean logTransferProgress)
Should transfer progress be logged? Default is false.

Parameters:
logTransferProgress - true if transfer progress is to be logged.

getLog

public java.lang.String getLog()
Get the log of messages

Returns:
message log as a string

clearLog

public void clearLog()
Clear the log of all messages


commandSent

public void commandSent(java.lang.String connId,
                        java.lang.String cmd)
Log an FTP command being sent to the server. Not used for SFTP.

Specified by:
commandSent in interface EventListener
Parameters:
connID - Identifier of FTP connection
cmd - command string

replyReceived

public void replyReceived(java.lang.String connId,
                          java.lang.String reply)
Log an FTP reply being sent back to the client. Not used for SFTP.

Specified by:
replyReceived in interface EventListener
Parameters:
connID - Identifier of FTP connection
reply - reply string

downloadStarted

public void downloadStarted(java.lang.String connId,
                            java.lang.String remoteFilename)
Notifies that a download has started

Specified by:
downloadStarted in interface EventListener
Parameters:
connID - Identifier of FTP connection
remoteFilename - remote file name

downloadCompleted

public void downloadCompleted(java.lang.String connId,
                              java.lang.String remoteFilename)
Notifies that a download has completed

Specified by:
downloadCompleted in interface EventListener
Parameters:
connID - Identifier of FTP connection
remoteFilename - remote file name

uploadStarted

public void uploadStarted(java.lang.String connId,
                          java.lang.String remoteFilename)
Notifies that an upload has started

Specified by:
uploadStarted in interface EventListener
Parameters:
connID - Identifier of FTP connection
remoteFilename - remote file name

uploadCompleted

public void uploadCompleted(java.lang.String connId,
                            java.lang.String remoteFilename)
Notifies that an upload has completed

Specified by:
uploadCompleted in interface EventListener
Parameters:
connID - Identifier of FTP connection
remoteFilename - remote file name

bytesTransferred

public void bytesTransferred(java.lang.String connId,
                             java.lang.String remoteFilename,
                             long count)
Report the number of bytes transferred so far. This may not be entirely accurate for transferring text files in ASCII mode, as new line representations can be represented differently on different platforms.

Specified by:
bytesTransferred in interface EventListener
Parameters:
connID - Identifier of FTP connection
remoteFilename - Name of remote file
count - count of bytes transferred


Copyright (c) 2001-2007 Enterprise Distributed Technologies Ltd. All Rights Reserved.