com.limegroup.gnutella
Class Main

java.lang.Object
  extended bycom.limegroup.gnutella.Main
All Implemented Interfaces:
ActivityCallback, ErrorCallback

public class Main
extends java.lang.Object
implements ActivityCallback, ErrorCallback

The command-line UI for the Gnutella servent.


Constructor Summary
Main()
           
 
Method Summary
 void acceptChat(Chatter chat)
          Add a new incoming chat connection
 void addDownload(Downloader mgr)
          Add a file to the download window
 void addSharedDirectory(java.io.File file, java.io.File parent)
          Notifies the GUI that the given directory has been shared.
 void addSharedFile(FileDesc file, java.io.File parent)
          Notifies the GUI that the given file has been shared.
 void addUpload(Uploader mgr)
          Add an uploader to the upload window
 void browseHostFailed(GUID guid)
          display an error message since the browse host failed.
 void chatErrorMessage(Chatter chatter, java.lang.String st)
          display an error message in the chat gui
 void chatUnavailable(Chatter chatter)
          The given chatter is no longer available
 void clearSharedFiles()
          The list of shared files has been emptied.
 void connectionClosed(Connection c)
          Mark a connection as closed
 void connectionInitialized(Connection c)
          Mark a connection as initialized
 void connectionInitializing(Connection c)
          Add a new unitialized connection.
 void downloadsComplete()
          Notifies the GUI that all active downloads have been completed.
 void error(int errorCode)
           
 void error(int message, java.lang.Throwable t)
           
 void error(java.lang.Throwable problem)
          Implements ActivityCallback.
 void error(java.lang.Throwable problem, java.lang.String msg)
          Displays an error stack trace to the user with a specific message.
 void fileManagerLoaded()
          Notifies a user that the filemanager has completely loaded.
 java.lang.String getHostValue(java.lang.String key)
           
 int getNumUploads()
           
 User getUserAuthenticationInfo(java.lang.String host)
          Asks user to authenticate, and returns the information received from user
 void handleQueryResult(RemoteFileDesc rfd, HostData data, java.util.Set loc)
          Add a query reply to the search result screen.
 void handleQueryString(java.lang.String query)
          Add a query string to the monitor screen
 void handleSharedFileUpdate(java.io.File file)
          Notifies the GUI that the given shared file has new information.
 void knownHost(Endpoint e)
          Add the given host/port to the host catcher
static void main(java.lang.String[] args)
           
 void notifyUserAboutUpdate(java.lang.String message, boolean isPro, boolean loc)
          A new version of LimeWire is available, notify user.
 boolean overwriteFile(java.lang.String file)
           
 void promptAboutCorruptDownload(Downloader dloader)
          Shows the user a message informing her that a file being downloaded is corrupt.
 void receiveMessage(Chatter chat)
          A new message is available from the given chatter
 void removeDownload(Downloader mgr)
          Remove a downloader from the download window.
 void removeUpload(Uploader mgr)
          Remove an uploader from the upload window.
 void restoreApplication()
          Tell the GUI to deiconify.
 void setAnnotateEnabled(boolean enabled)
          Sets the enabled/disabled state of file annotation.
 void setPort(int port)
           
 void showDownloads()
          Show active downloads
static java.lang.String[] split(java.lang.String s)
          Returns an array of strings containing the words of s, where a word is any sequence of characters not containing a space.
 void uploadsComplete()
          Notifies the GUI that all active uploads have been completed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Main

public Main()
Method Detail

main

public static void main(java.lang.String[] args)

connectionInitializing

public void connectionInitializing(Connection c)
Description copied from interface: ActivityCallback
Add a new unitialized connection.

Specified by:
connectionInitializing in interface ActivityCallback

connectionInitialized

public void connectionInitialized(Connection c)
Description copied from interface: ActivityCallback
Mark a connection as initialized

Specified by:
connectionInitialized in interface ActivityCallback

connectionClosed

public void connectionClosed(Connection c)
Description copied from interface: ActivityCallback
Mark a connection as closed

Specified by:
connectionClosed in interface ActivityCallback

knownHost

public void knownHost(Endpoint e)
Description copied from interface: ActivityCallback
Add the given host/port to the host catcher

Specified by:
knownHost in interface ActivityCallback

handleQueryResult

public void handleQueryResult(RemoteFileDesc rfd,
                              HostData data,
                              java.util.Set loc)
Description copied from interface: ActivityCallback
Add a query reply to the search result screen. The reply is not guaranteed to match the query; use RouterService.matchesType for that. Also, it's possible that the user has cancelled the search.

Specified by:
handleQueryResult in interface ActivityCallback
See Also:
RouterService#query(String,int,MediaType), RouterService.matchesType(byte[],Response)

handleQueryString

public void handleQueryString(java.lang.String query)
Add a query string to the monitor screen

Specified by:
handleQueryString in interface ActivityCallback

error

public void error(int errorCode)

error

public void error(java.lang.Throwable problem,
                  java.lang.String msg)
Description copied from interface: ErrorCallback
Displays an error stack trace to the user with a specific message.

Specified by:
error in interface ErrorCallback
Parameters:
problem - the Throwable instance containing the stack trace to display
msg - the message to display.

error

public void error(java.lang.Throwable problem)
Implements ActivityCallback.

Specified by:
error in interface ErrorCallback
Parameters:
problem - the Throwable instance containing the stack trace to display

error

public void error(int message,
                  java.lang.Throwable t)

split

public static java.lang.String[] split(java.lang.String s)
Returns an array of strings containing the words of s, where a word is any sequence of characters not containing a space.


overwriteFile

public boolean overwriteFile(java.lang.String file)

addDownload

public void addDownload(Downloader mgr)
Description copied from interface: ActivityCallback
Add a file to the download window

Specified by:
addDownload in interface ActivityCallback

removeDownload

public void removeDownload(Downloader mgr)
Description copied from interface: ActivityCallback
Remove a downloader from the download window.

Specified by:
removeDownload in interface ActivityCallback

addUpload

public void addUpload(Uploader mgr)
Description copied from interface: ActivityCallback
Add an uploader to the upload window

Specified by:
addUpload in interface ActivityCallback

removeUpload

public void removeUpload(Uploader mgr)
Description copied from interface: ActivityCallback
Remove an uploader from the upload window.

Specified by:
removeUpload in interface ActivityCallback

setPort

public void setPort(int port)

getNumUploads

public int getNumUploads()

addSharedDirectory

public void addSharedDirectory(java.io.File file,
                               java.io.File parent)
Description copied from interface: ActivityCallback
Notifies the GUI that the given directory has been shared. This method is called exactly once per directory per change to the shared directory and extension settings. Note that the files in directory are not necessarily yet indexed at the time of this call.

Specified by:
addSharedDirectory in interface ActivityCallback
Parameters:
file - MUST be a directory
parent - MUST be the parent of directory, or null if no parent exists.

addSharedFile

public void addSharedFile(FileDesc file,
                          java.io.File parent)
Description copied from interface: ActivityCallback
Notifies the GUI that the given file has been shared. This method is called exactly once per file per change to the shared directory and extension settings.

Specified by:
addSharedFile in interface ActivityCallback
Parameters:
file - MUST be a file descriptor for the file.
parent - MUST be the parent of directory, or null if no parent exists.

handleSharedFileUpdate

public void handleSharedFileUpdate(java.io.File file)
Description copied from interface: ActivityCallback
Notifies the GUI that the given shared file has new information.

Specified by:
handleSharedFileUpdate in interface ActivityCallback
Parameters:
file - The File that needs updating

clearSharedFiles

public void clearSharedFiles()
Description copied from interface: ActivityCallback
The list of shared files has been emptied.

Specified by:
clearSharedFiles in interface ActivityCallback

acceptChat

public void acceptChat(Chatter chat)
Description copied from interface: ActivityCallback
Add a new incoming chat connection

Specified by:
acceptChat in interface ActivityCallback

receiveMessage

public void receiveMessage(Chatter chat)
Description copied from interface: ActivityCallback
A new message is available from the given chatter

Specified by:
receiveMessage in interface ActivityCallback

chatUnavailable

public void chatUnavailable(Chatter chatter)
Description copied from interface: ActivityCallback
The given chatter is no longer available

Specified by:
chatUnavailable in interface ActivityCallback

chatErrorMessage

public void chatErrorMessage(Chatter chatter,
                             java.lang.String st)
Description copied from interface: ActivityCallback
display an error message in the chat gui

Specified by:
chatErrorMessage in interface ActivityCallback

downloadsComplete

public void downloadsComplete()
Description copied from interface: ActivityCallback
Notifies the GUI that all active downloads have been completed.

Specified by:
downloadsComplete in interface ActivityCallback

fileManagerLoaded

public void fileManagerLoaded()
Description copied from interface: ActivityCallback
Notifies a user that the filemanager has completely loaded.

Specified by:
fileManagerLoaded in interface ActivityCallback

getUserAuthenticationInfo

public User getUserAuthenticationInfo(java.lang.String host)
Description copied from interface: ActivityCallback
Asks user to authenticate, and returns the information received from user

Specified by:
getUserAuthenticationInfo in interface ActivityCallback
Parameters:
host - The host who is requesting authentication
Returns:
The authentication information input by user

uploadsComplete

public void uploadsComplete()
Description copied from interface: ActivityCallback
Notifies the GUI that all active uploads have been completed.

Specified by:
uploadsComplete in interface ActivityCallback

promptAboutCorruptDownload

public void promptAboutCorruptDownload(Downloader dloader)
Description copied from interface: ActivityCallback
Shows the user a message informing her that a file being downloaded is corrupt.

This method MUST call dloader.discardCorruptDownload(boolean b) otherwise there will be threads piling up waiting for a notification

Specified by:
promptAboutCorruptDownload in interface ActivityCallback

restoreApplication

public void restoreApplication()
Description copied from interface: ActivityCallback
Tell the GUI to deiconify.

Specified by:
restoreApplication in interface ActivityCallback

showDownloads

public void showDownloads()
Description copied from interface: ActivityCallback
Show active downloads

Specified by:
showDownloads in interface ActivityCallback

getHostValue

public java.lang.String getHostValue(java.lang.String key)
Specified by:
getHostValue in interface ActivityCallback

browseHostFailed

public void browseHostFailed(GUID guid)
Description copied from interface: ActivityCallback
display an error message since the browse host failed.

Specified by:
browseHostFailed in interface ActivityCallback
Parameters:
guid - The GUID of the browse host.

setAnnotateEnabled

public void setAnnotateEnabled(boolean enabled)
Description copied from interface: ActivityCallback
Sets the enabled/disabled state of file annotation.

Specified by:
setAnnotateEnabled in interface ActivityCallback

notifyUserAboutUpdate

public void notifyUserAboutUpdate(java.lang.String message,
                                  boolean isPro,
                                  boolean loc)
Description copied from interface: ActivityCallback
A new version of LimeWire is available, notify user.

Specified by:
notifyUserAboutUpdate in interface ActivityCallback