Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "ECF BitTorrent Provider"
(→Plug-in Usage: Adding code for the use cases) |
(→Plug-in Usage) |
||
Line 51: | Line 51: | ||
This section will describe how a developer would create a client using the BitTorrent plug-in. | This section will describe how a developer would create a client using the BitTorrent plug-in. | ||
− | + | '''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 stop the download after a period of time | ||
Line 66: | Line 66: | ||
− | + | '''Use Case 1''' | |
− | + | Torrent torrent = new Torrent("eclipse-sdk.torrent"); | |
− | + | Host host = new Host(torrent); | |
− | + | host.connect(); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | '''Use Case 2''' | |
− | + | Torrent torrent = new Torrent("eclipse-sdk.torrent"); | |
− | + | Host host = new Host(torrent); | |
− | + | host.connect(); | |
− | + | // after some amount of time has passed | |
− | + | host.stop(); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | '''Use Case 2.1''' | |
− | + | Torrent torrent = new Torrent("eclipse-sdk.torrent"); | |
− | + | Host host = new Host(torrent); | |
− | + | host.connect(); | |
− | + | // after some amount of time has passed | |
− | + | host.stop(); | |
− | + | // more time passes | |
− | + | host.resume(); | |
− | + | ||
− | + | '''Use Case 2.2''' | |
− | + | ||
− | } | + | Torrent torrent = new Torrent("eclipse-sdk.torrent"); |
+ | Host host = new Host(torrent); | ||
+ | host.connect(); | ||
+ | // after some amount of time has passed | ||
+ | host.stop(); | ||
+ | host.end(); | ||
+ | host.remove(); | ||
+ | |||
+ | '''Use Case 3''' | ||
+ | |||
+ | Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host01 = new Host(torrent01); | ||
+ | host.connect(); | ||
+ | Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host02 = new Host(torrent02); | ||
+ | host.connect(); | ||
+ | |||
+ | '''Use Case 4''' | ||
+ | |||
+ | Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host01 = new Host(torrent01); | ||
+ | host.connect(); | ||
+ | Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host02 = new Host(torrent02); | ||
+ | host.connect(); | ||
+ | // some time passes | ||
+ | host02.stop(); | ||
+ | |||
+ | '''Use Case 4.1''' | ||
+ | |||
+ | Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host01 = new Host(torrent01); | ||
+ | host.connect(); | ||
+ | Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host02 = new Host(torrent02); | ||
+ | host.connect(); | ||
+ | // some time passes | ||
+ | host02.stop(); | ||
+ | while (!host.isCompleted()); | ||
+ | host02.resume(); | ||
+ | |||
+ | '''Use Case 4.2''' | ||
+ | |||
+ | Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host01 = new Host(torrent01); | ||
+ | host.connect(); | ||
+ | Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host02 = new Host(torrent02); | ||
+ | host.connect(); | ||
+ | // some time passes | ||
+ | host02.stop(); | ||
+ | // more time passes | ||
+ | host01.end(); | ||
+ | host02.resume(); | ||
+ | |||
+ | '''Use Case 5''' | ||
+ | |||
+ | Torrent torrent = new Torrent("eclipse-sdk.torrent"); | ||
+ | Host host = new Host(torrent); | ||
+ | host.addProgressListener(new ProgressListener() { | ||
+ | public void progressEvent(ProgressEvent event) { | ||
+ | System.out.println(event.getRemaining()); | ||
+ | } | ||
+ | }); | ||
==External Links== | ==External Links== |
Revision as of 20:07, 7 June 2006
Project Lead: Remy Chi Jian Suen
Mentor(s): Wayne Beaton, Scott Lewis, and Chris Aniszczyk
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.
Contents
BitTorrent Plug-in Data Model
The package name org.eclipse.bittorrent may be altered when the plug-in is released.
Text in red denotes that the code has not been written yet.
org.eclipse.bittorrent
Host - reads in a Torrent connects to peers to begin seeding or downloading
- contains exactly one Torrent
- contains one or more DataFiles
- contains one or more Pieces
Torrent - a representation of the metainfo stored within a .torrent file
org.eclipse.bittorrent.internal.torrent
DataFile - a representation of a file on the user's system for read/write operations
- contains one or more Pieces
Piece - a piece of data that is needed to complete a download
- contains one or more DataFiles
org.eclipse.bittorrent.internal.net
ConnectionPool - a thread pool that manages ConnectionThreads
- contains exactly one Host
- contains one or more ConnectionThreads
ConnectionThread - creates a PeerConnection to talk to a peer
- contains exactly one PeerConnection
PeerConnection - connects to a peer and exchanges information
- exactly one Host
org.eclipse.bittorrent.internal.encode
BEncodedDictionary - holds the key-value pairs stored within a bencoded string.
Decode - decodes information such as the contents of a torrent file
Encode - converts or alters information for use
Plug-in Usage
This section will describe how a developer would create a client using the BitTorrent plug-in.
Use Cases
- - 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
- - resume the download
- - cancel the download and delete the downloaded files
- - start two downloads from two torrents until completion
- - begin two downloads from two torrent and then stop the second one after a period of time
- - resume the second download after the first has completed
- - cancel the first download and start the second download
- - begin downloading from a torrent and monitor its progress with a listener
- - LATER start downloading multiple files from a torrent and select which files should be downloaded
- - LATER begin downloading a file from a torrent and cap the download/upload speeds
- - LATER start a download from a torrent and alter the number of connections that can be made
Use Case 1
Torrent torrent = new Torrent("eclipse-sdk.torrent"); Host host = new Host(torrent); host.connect();
Use Case 2
Torrent torrent = new Torrent("eclipse-sdk.torrent"); Host host = new Host(torrent); host.connect(); // after some amount of time has passed host.stop();
Use Case 2.1
Torrent torrent = new Torrent("eclipse-sdk.torrent"); Host host = new Host(torrent); host.connect(); // after some amount of time has passed host.stop(); // more time passes host.resume();
Use Case 2.2
Torrent torrent = new Torrent("eclipse-sdk.torrent"); Host host = new Host(torrent); host.connect(); // after some amount of time has passed host.stop(); host.end(); host.remove();
Use Case 3
Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); Host host01 = new Host(torrent01); host.connect(); Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); Host host02 = new Host(torrent02); host.connect();
Use Case 4
Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); Host host01 = new Host(torrent01); host.connect(); Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); Host host02 = new Host(torrent02); host.connect(); // some time passes host02.stop();
Use Case 4.1
Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); Host host01 = new Host(torrent01); host.connect(); Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); Host host02 = new Host(torrent02); host.connect(); // some time passes host02.stop(); while (!host.isCompleted()); host02.resume();
Use Case 4.2
Torrent torrent01 = new Torrent("eclipse-sdk.torrent"); Host host01 = new Host(torrent01); host.connect(); Torrent torrent02 = new Torrent("eclipse-sdk.torrent"); Host host02 = new Host(torrent02); host.connect(); // some time passes host02.stop(); // more time passes host01.end(); host02.resume();
Use Case 5
Torrent torrent = new Torrent("eclipse-sdk.torrent"); Host host = new Host(torrent); host.addProgressListener(new ProgressListener() { public void progressEvent(ProgressEvent event) { System.out.println(event.getRemaining()); } });