Class DonkeyCore

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--DonkeyCore
All Implemented Interfaces:
java.lang.Runnable

public class DonkeyCore
extends java.lang.Thread

This class implements mlDonkey Core/GUI protocol. This is a part of jMoule. This project is licenced under GPL.

Author:
Antoine Jacquet

Field Summary
 javax.swing.JTextArea console
          This is a text panel containing console messages...
 java.util.Hashtable fileInfos
          This contains the informations about the files being downloaded.
 java.util.Hashtable resultInfos
          This contains the informations about the results of searches.
 java.util.Vector searchResults
          This contains all the searches results.
 java.util.Hashtable serverInfos
          This contains the informations about the donkey servers.
 java.util.Hashtable statInfos
          This contains statistics informations.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DonkeyCore()
          Constructs an unconnected DonkeyCore.
DonkeyCore(java.lang.String host, int port, java.lang.String password)
          Constructs a connected DonkeyCore.
 
Method Summary
 void cleanOld()
          Asks the mlDonkey core to clean old servers.
 boolean connect(java.lang.String host, int port, java.lang.String password)
          Connects an unconnected DonkeyCore.
 void connectMore()
          Asks the mlDonkey core to connect more servers.
 void connectServer(java.lang.Long serverID)
          Asks mlDonkey to connect to a new server.
 void disconnect()
          Disconnects this DonkeyCore.
 void disconnectServer(java.lang.Long serverID)
          Asks mlDonkey to disconnect from a server.
 void download(java.lang.Long fileID)
          Start a new download.
 void extend()
          Extends (redo) the last search.
 boolean isConnected()
          Tests if this DonkeyCore is already connected.
 void kill()
          Asks the mlDonkey core to kill (terminate) itself.
 void run()
          This class is a thread.
 java.util.Vector search(java.lang.String query)
          Start a new search.
 void switchDownload(java.lang.Long fileID, boolean bool)
          Pause/Resume a download.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fileInfos

public java.util.Hashtable fileInfos
This contains the informations about the files being downloaded. File ID are the hash keys. The values of the hash are vectors containing file informations : filename, size, downloaded, %, rate, ETA and running state.

resultInfos

public java.util.Hashtable resultInfos
This contains the informations about the results of searches. Files ID are the hash keys. The values of the hash are vectors containing result informations : filename, size, tags and download state.

serverInfos

public java.util.Hashtable serverInfos
This contains the informations about the donkey servers. Servers ID are the hash keys. The values of the hash are vectors containing server informations : host, users, files, connected state.

searchResults

public java.util.Vector searchResults
This contains all the searches results. Each entry is a vector containing a specific search result. Each specific search result contains vectors with same format as resultInfos.

statInfos

public java.util.Hashtable statInfos
This contains statistics informations. The keys are the variables and the values are numbers.

console

public javax.swing.JTextArea console
This is a text panel containing console messages...
Constructor Detail

DonkeyCore

public DonkeyCore()
Constructs an unconnected DonkeyCore.

DonkeyCore

public DonkeyCore(java.lang.String host,
                  int port,
                  java.lang.String password)
Constructs a connected DonkeyCore. Same parameters as "connect".
Method Detail

connect

public boolean connect(java.lang.String host,
                       int port,
                       java.lang.String password)
Connects an unconnected DonkeyCore.
Parameters:
host - mlDonkey host you wish to connect to.
port - mlDonkey core port.
password - Password if needed.

disconnect

public void disconnect()
Disconnects this DonkeyCore.

isConnected

public boolean isConnected()
Tests if this DonkeyCore is already connected.
Returns:
true if connected.

connectMore

public void connectMore()
Asks the mlDonkey core to connect more servers.

cleanOld

public void cleanOld()
Asks the mlDonkey core to clean old servers.

kill

public void kill()
Asks the mlDonkey core to kill (terminate) itself.

extend

public void extend()
Extends (redo) the last search.

download

public void download(java.lang.Long fileID)
Start a new download.
Parameters:
fileID - ID of the file to download (found in resultInfos key).

switchDownload

public void switchDownload(java.lang.Long fileID,
                           boolean bool)
Pause/Resume a download.
Parameters:
fileID - ID of the file to switch (found in resultInfos key).
bool - true = resume, false = pause.

connectServer

public void connectServer(java.lang.Long serverID)
Asks mlDonkey to connect to a new server.
Parameters:
serverID - ID of the server to connect to (found in serverInfos key).

disconnectServer

public void disconnectServer(java.lang.Long serverID)
Asks mlDonkey to disconnect from a server.
Parameters:
serverID - ID of the server to disconnect (found in serverInfos key).

search

public java.util.Vector search(java.lang.String query)
Start a new search.
Parameters:
query - A simple string to describe what you want to search.
Returns:
A vector of search results (entries of this vector have same structure as resultInfos entries).

run

public void run()
This class is a thread.
Overrides:
run in class java.lang.Thread