org.xnap.plugin.gift.net
Class GiFTDaemon

java.lang.Object
  extended by org.xnap.plugin.gift.net.GiFTDaemon

public class GiFTDaemon
extends java.lang.Object

Handles a connection to a single giFT daemon.

Author:
Tammo van Lessen, Steffen Pingel

Field Summary
static int NETWORK_STATS_INTERVAL
          The poll intervall for network stats.
 
Constructor Summary
GiFTDaemon(java.lang.String host, int port, java.lang.String user)
           
 
Method Summary
 void addDaemonListener(GiFTDaemonListener listener)
          Adds an event listener.
 void addDownload(GiFTSearchResult sr)
           
 void changeDownload(GiFTDownloadContainer dc, java.lang.String action)
           
 void changeSearch(GiFTSearch s, java.lang.String action)
           
 void changeUpload(GiFTUpload u, java.lang.String action)
           
 void deleteSource(GiFTDownloadContainer dc, java.lang.String url)
           
protected  GiFTDownloadContainer getDownloadContainer(java.lang.String filename, java.lang.String hash, long size)
           
 java.lang.String getHost()
           
 java.lang.String getMessage()
           
 int getPort()
           
 java.lang.String getServerInfo()
          Returns giFT server's name and version as String
 java.lang.String getStats()
           
 java.lang.String getStatus()
           
 java.lang.String getUsername()
           
 java.lang.String getVerboseMessage()
           
 boolean isConnected()
           
 boolean isDisconnected()
           
 void locate(GiFTDownloadContainer dc)
          Searches for more sources for dc.
protected  void queueCommand(Command cmd)
           
 void removeDaemonListener(GiFTDaemonListener listener)
          Removes an event listener.
 void search(GiFTSearch s)
          Adds a new search
 void setHost(java.lang.String host)
          Sets giFT host
 void setPort(int port)
          Sets giFT port
 void setUsername(java.lang.String username)
          Sets giFT user name
 void setVerboseMessage(java.lang.Exception e)
           
 void start()
          Connects to the daemon.
 void stop(boolean killGiFT)
          Disconnects the daemon.
 void syncShares()
          Forces giFT to sync its shares index
 void updateNetworkStats()
          Forces giFT to send network stats
 void updateShareListing()
          Forces giFT to list its shares
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NETWORK_STATS_INTERVAL

public static final int NETWORK_STATS_INTERVAL
The poll intervall for network stats.

See Also:
Constant Field Values
Constructor Detail

GiFTDaemon

public GiFTDaemon(java.lang.String host,
                  int port,
                  java.lang.String user)
Method Detail

addDaemonListener

public void addDaemonListener(GiFTDaemonListener listener)
Adds an event listener.

Parameters:
listener - the listener

addDownload

public void addDownload(GiFTSearchResult sr)

changeDownload

public void changeDownload(GiFTDownloadContainer dc,
                           java.lang.String action)

changeSearch

public void changeSearch(GiFTSearch s,
                         java.lang.String action)

changeUpload

public void changeUpload(GiFTUpload u,
                         java.lang.String action)

deleteSource

public void deleteSource(GiFTDownloadContainer dc,
                         java.lang.String url)

getDownloadContainer

protected GiFTDownloadContainer getDownloadContainer(java.lang.String filename,
                                                     java.lang.String hash,
                                                     long size)

getHost

public java.lang.String getHost()

getMessage

public java.lang.String getMessage()

getPort

public int getPort()

getUsername

public java.lang.String getUsername()

getStats

public java.lang.String getStats()

getStatus

public java.lang.String getStatus()

getServerInfo

public java.lang.String getServerInfo()
Returns giFT server's name and version as String

Returns:
server info

getVerboseMessage

public java.lang.String getVerboseMessage()

isConnected

public boolean isConnected()

isDisconnected

public boolean isDisconnected()

locate

public void locate(GiFTDownloadContainer dc)
Searches for more sources for dc.


queueCommand

protected void queueCommand(Command cmd)

removeDaemonListener

public void removeDaemonListener(GiFTDaemonListener listener)
Removes an event listener.

Parameters:
listener -

updateNetworkStats

public void updateNetworkStats()
Forces giFT to send network stats


updateShareListing

public void updateShareListing()
Forces giFT to list its shares


search

public void search(GiFTSearch s)
Adds a new search

Parameters:
sf - SearchFilter

setHost

public void setHost(java.lang.String host)
Sets giFT host

Parameters:
host -

setPort

public void setPort(int port)
Sets giFT port

Parameters:
port -

setUsername

public void setUsername(java.lang.String username)
Sets giFT user name

Parameters:
user -

setVerboseMessage

public void setVerboseMessage(java.lang.Exception e)

start

public void start()
Connects to the daemon.


stop

public void stop(boolean killGiFT)
Disconnects the daemon.


syncShares

public void syncShares()
Forces giFT to sync its shares index



Copyright © 2001-2005 XNap Team. All Rights Reserved.