The goal if this project is to create an implementation of the file sharing API provided by the [[Eclipse Communication Framework Project|Eclipse Communication Framework]] using the [http://www.bittorrent.org BitTorrent] protocol.

+

The goal if this project is to create an implementation of the file sharing API provided by the [[Eclipse Communication Framework Project|Eclipse Communication Framework]] using the [http://www.bittorrent.org BitTorrent] protocol. The BitTorrent protocol will be implemented in 100% Java in a clean room environment. It is currently under active development and is licensed under both the MIT License and the Eclipse Public License.

−

==BitTorrent Plug-in Data Model==

+

Bug [https://bugs.eclipse.org/bugs/show_bug.cgi?id=144133 144133] will monitor the progress of this project.

−

The package name ''org.eclipse.bittorrent'' may be altered when the plug-in is released.

+

==Getting the code==

+

The 'Summer of Code' project component has been approved by Eclipse but the code has not yet been committed into CVS yet as it is currently questionable whether the base library itself will be hosted by Eclipse.org or not.

−

Text in <font color="red">red</font> denotes that the code has not been written yet.

+

'''Host:''' eclipse-incub.cvs.sourceforge.net<br>

+

'''Repository Path:''' /cvsroot/eclipse-incub<br>

+

'''User name:''' anonymous<br>

+

'''Connection type:''' pserver

+

+

==Features==

+

*start and stop torrents, resuming supported

+

*select which files to try to download first and which files to not download at all

+

*set up and down speeds

+

+

==Examples==

+

Currently, there are three example projects committed into CVS.

+

*org.eclipse.bittorrent.example

+

*org.eclipse.bittorrent.example.plugin

+

*org.eclipse.ecf.example.rcpbittorrent

+

+

===org.eclipse.bittorrent.example===

+

This project contains two different classes each with a main method. The command line client's main class is org.eclipse.bittorrent.example.cli.CLI. The other client within this project is the SWT graphical client, its main class is org.eclipse.bittorrent.example.swt.SWTClient.

+

+

===org.eclipse.bittorrent.example.plugin===

+

This plug-in adds a "Torrents" view to the workbench to allow the user to download torrents whilst using Eclipse. A console is embedded within the view to allow debugging messages to be displayed.

+

+

===org.eclipse.ecf.example.rcpbittorrent===

+

This RCP application allows the user to download files through the BitTorrent protocol using ECF's file sharing APIs.

+

+

==BitTorrent plug-in data model==

+

+

The package name ''org.eclipse.bittorrent'' may be altered when the plug-in is released. All internal packages are not intended to be used by developers and the implementation will change even after the API has reached a 1.0 release.

+

+

Text in <font color="red">red</font> denotes that the code for that specified class or interface has not been written yet.

===org.eclipse.bittorrent===

===org.eclipse.bittorrent===

−

Host - reads in a Torrent connects to peers to begin seeding or downloading

+

Torrent - reads in a TorrentFile and connects to peers to begin seeding or downloading

−

*contains exactly one Torrent

+

−

*contains one or more DataFiles

+

−

*<font color="red">contains one or more Pieces</font>

+

−

Torrent - a representation of the metainfo stored within a ''.torrent'' file

+

TorrentFile - a representation of the metainfo stored within a ''.torrent'' file

ITorrentStateListener - reports what state the download is in right now, such as whether it has been 'stopped' or whether the download has 'completed'

+

+

ITorrentProgressListener - monitors how far the download has gone

+

+

IPieceProgressListener - monitors the download progress of a particular piece

===org.eclipse.bittorrent.internal.torrent===

===org.eclipse.bittorrent.internal.torrent===

DataFile - a representation of a file on the user's system for read/write operations

DataFile - a representation of a file on the user's system for read/write operations

−

*<font color="red">contains one or more Pieces</font>

+

*contains one or more Pieces

−

+

−

<font color="red">Piece - a piece of data that is needed to complete a download</font>

+

−

*<font color="red">contains one or more DataFiles</font>

+

+

Piece - a piece of data that is needed to complete a download

+

*contains one or more DataFiles

===org.eclipse.bittorrent.internal.net===

===org.eclipse.bittorrent.internal.net===

ConnectionPool - a thread pool that manages ConnectionThreads

ConnectionPool - a thread pool that manages ConnectionThreads

−

*contains exactly one Host

+

*contains exactly one TorrentManager

−

*contains one or more ConnectionThreads

+

*contains one or more PeerConnections

−

+

−

ConnectionThread - creates a PeerConnection to talk to a peer

+

−

*contains exactly one PeerConnection

+

PeerConnection - connects to a peer and exchanges information

PeerConnection - connects to a peer and exchanges information

*exactly one Host

*exactly one Host

+

TorrentManager - reads and writes to files and performs message processing with PeerConnections

+

*contains exactly one ConnectionPool

===org.eclipse.bittorrent.internal.encode===

===org.eclipse.bittorrent.internal.encode===

Line 46:

Line 84:

Encode - converts or alters information for use

Encode - converts or alters information for use

−

==Plug-in Usage==

==Plug-in Usage==

Line 53:

Line 90:

'''Use Cases'''

'''Use Cases'''

# - downloads a single file from a torrent until completion

# - downloads a single file from a torrent until completion

−

# - begin downloading a single file from a torrent and stop the download after a period of time

+

# - begin downloading a single file from a torrent and pause the download after a period of time

## - resume the download

## - resume the download

−

## - cancel the download and delete the downloaded files

+

# - start two downloads from two torrents until completion

−

# - start multiple downloads from different torrents until completion

+

# - begin two downloads from two torrent and then pause the second one after a period of time

+

# - begin downloading from a torrent and monitor its progress with a listener

+

# - start downloading multiple files from a torrent and select which files should be downloaded

+

# - begin downloading a file from a torrent and cap the download/upload speeds

−

==External Links==

+

The use cases listed below makes use of an implementation of the ITorrentStateListener interface. All references to ''stateListener'' can be referred back to the implementation provided below.

+

+

<source lang="java">

+

ITorrentStateListener stateListener = new ITorrentStateListener() {

+

public void stateChanged(int state) {

+

switch (state) {

+

case ITorrentStateListener.STARTED:

+

System.out.println("The torrent set-up is starting...");

+

break;

+

case ITorrentStateListener.EXCHANGING:

+

System.out.println("Exchanging pieces with peers...");

+

break;

+

case ITorrentStateListener.STOPPED:

+

System.out.println("The exchanging has stopped...");

+

break;

+

case ITorrentStateListener.FINISHED:

+

System.out.println("The download is now complete...");

+

break;

+

}

+

}

+

};

+

</source>

+

+

It is also assumed that a path has been set for the library to save configuration and state information to properly support the resuming of torrents without having to perform a hash check when the client has started.

Revision as of 14:26, 12 August 2008

The goal if this project is to create an implementation of the file sharing API provided by the Eclipse Communication Framework using the BitTorrent protocol. The BitTorrent protocol will be implemented in 100% Java in a clean room environment. It is currently under active development and is licensed under both the MIT License and the Eclipse Public License.

Getting the code

The 'Summer of Code' project component has been approved by Eclipse but the code has not yet been committed into CVS yet as it is currently questionable whether the base library itself will be hosted by Eclipse.org or not.

Features

select which files to try to download first and which files to not download at all

set up and down speeds

Examples

Currently, there are three example projects committed into CVS.

org.eclipse.bittorrent.example

org.eclipse.bittorrent.example.plugin

org.eclipse.ecf.example.rcpbittorrent

org.eclipse.bittorrent.example

This project contains two different classes each with a main method. The command line client's main class is org.eclipse.bittorrent.example.cli.CLI. The other client within this project is the SWT graphical client, its main class is org.eclipse.bittorrent.example.swt.SWTClient.

org.eclipse.bittorrent.example.plugin

This plug-in adds a "Torrents" view to the workbench to allow the user to download torrents whilst using Eclipse. A console is embedded within the view to allow debugging messages to be displayed.

org.eclipse.ecf.example.rcpbittorrent

This RCP application allows the user to download files through the BitTorrent protocol using ECF's file sharing APIs.

BitTorrent plug-in data model

The package name org.eclipse.bittorrent may be altered when the plug-in is released. All internal packages are not intended to be used by developers and the implementation will change even after the API has reached a 1.0 release.

Text in red denotes that the code for that specified class or interface has not been written yet.

org.eclipse.bittorrent

Torrent - reads in a TorrentFile and connects to peers to begin seeding or downloading

TorrentFile - a representation of the metainfo stored within a .torrent file

It is also assumed that a path has been set for the library to save configuration and state information to properly support the resuming of torrents without having to perform a hash check when the client has started.

Torrent torrent = TorrentFactory.createTorrent(new TorrentFile(newFile("eclipse-sdk.torrent")));
torrent.addTorrentStateListener(stateListener);
torrent.start();// after some amount of time has passed
torrent.stop();

Use Case 2.1 - resume downloading a torrent after pausing it for a period of time

Torrent torrent =new Torrent(newFile("eclipse-sdk.torrent"));
torrent.addTorrentStateListener(stateListener);
torrent.start();// after some amount of time has passed
torrent.stop();// more time passes
torrent.start();

Use Case 3 - begin downloading from two different torrents until completion

Use Case 6 - start downloading multiple files from a torrent and select which files should be downloaded

Torrent torrent = TorrentFactory.createTorrent(new TorrentFile(newFile("eclipse-all-in-one.torrent")));// assuming that this torrent has three files and the user only wants the first one
torrent.setFilesToDownload(newint[]{0, -1, -1});
torrent.start();

Use Case 7 - begin downloading a file from a torrent and cap the download/upload speeds