Lightweight Bartering Grid

lbg.protocol.data
Class EmbeddedBitTorrentServer

java.lang.Object
  extended by lbg.protocol.data.EmbeddedBitTorrentServer

public class EmbeddedBitTorrentServer
extends java.lang.Object

An object with BT data tracking and sharing capabilities. Data downloading is not directly supported by this object, but you may require the service to be running in order to download BitTorrent data

Author:
Xavier Dalem

Constructor Summary
EmbeddedBitTorrentServer(java.lang.String cacheDirectory, java.lang.String trackerHost, int trackerPort, int btDataPort)
          Creates a BitTorrent server.
 
Method Summary
 void removeFromBitTorrent(Metadata<java.lang.String> meta)
          Removes all mention of an entry in BitTorrent structures.
 void start()
          Starts the BitTorrent service.
 void stop()
           
 java.lang.String toString()
           
 TorrentGridData track(Metadata<java.lang.String> meta)
          Hosts the GridData and render it available for torrenting.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EmbeddedBitTorrentServer

public EmbeddedBitTorrentServer(java.lang.String cacheDirectory,
                                java.lang.String trackerHost,
                                int trackerPort,
                                int btDataPort)
                         throws GridException
Creates a BitTorrent server. This server is backed by Azureus. For this reason, creating multiple servers is supported but won't actually create multiple services.

Parameters:
cacheDirectory -
trackerHost - The BitTorrent tracker host (i.e. the local host). Set to null for no tracking possibilites.
trackerPort - The desired BitTorrent tracker port. Will be ignored if trackerHHost is null.
btDataPort -
Throws:
GridException
Method Detail

start

public void start()
Starts the BitTorrent service. Has not effect if the service is already started.


stop

public void stop()

track

public TorrentGridData track(Metadata<java.lang.String> meta)
                      throws GridException
Hosts the GridData and render it available for torrenting. The data should already be stored in a local file. You shouldn't try to track the same data twice.

Throws:
GridException

removeFromBitTorrent

public void removeFromBitTorrent(Metadata<java.lang.String> meta)
                          throws GridException
Removes all mention of an entry in BitTorrent structures.

Parameters:
meta - The entry to remove
Throws:
GridException - If a step in removal failed.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.