public class AdhocTorrentRegistry extends Object implements TorrentRegistry
Note that this class implements a service. Hence, is not a part of the public API and is a subject to change.
Constructor and Description |
---|
AdhocTorrentRegistry(IDataDescriptorFactory dataDescriptorFactory,
EventSource eventSource) |
Modifier and Type | Method and Description |
---|---|
Optional<TorrentDescriptor> |
getDescriptor(Torrent torrent)
Get a torrent descriptor for a given torrent, if exists.
|
Optional<TorrentDescriptor> |
getDescriptor(TorrentId torrentId)
Get a torrent descriptor for a given torrent, if exists.
|
TorrentDescriptor |
getOrCreateDescriptor(Torrent torrent,
Storage storage)
Get an existing torrent descriptor for a given torrent
or create a new one if it does not exist.
|
Optional<Torrent> |
getTorrent(TorrentId torrentId)
Get a torrent with a given torrent ID, if exists.
|
Collection<TorrentId> |
getTorrentIds()
Get all torrents, that have been registered in the runtime.
|
Collection<Torrent> |
getTorrents()
Get all torrents, that have been registered in the runtime.
|
boolean |
isSupportedAndActive(TorrentId torrentId) |
TorrentDescriptor |
register(TorrentId torrentId)
Get an existing torrent descriptor for a given torrent ID
or create a new one if it does not exist.
|
TorrentDescriptor |
register(Torrent torrent,
Storage storage,
FileDownloadCompleteCallback completedFileCallbacks)
Get an existing torrent descriptor for a given torrent
or create a new one if it does not exist.
|
void |
registerSessionState(TorrentId torrentId,
TorrentSessionState state)
Register a session state for the specified torrent
|
@Inject public AdhocTorrentRegistry(IDataDescriptorFactory dataDescriptorFactory, EventSource eventSource)
public Collection<Torrent> getTorrents()
TorrentRegistry
getTorrents
in interface TorrentRegistry
public Collection<TorrentId> getTorrentIds()
TorrentRegistry
getTorrentIds
in interface TorrentRegistry
public Optional<Torrent> getTorrent(TorrentId torrentId)
TorrentRegistry
getTorrent
in interface TorrentRegistry
Optional.empty()
if this torrent ID is not known to the current runtime.public Optional<TorrentDescriptor> getDescriptor(Torrent torrent)
TorrentRegistry
getDescriptor
in interface TorrentRegistry
Optional.empty()
if torrent descriptor hasn't been created yet.public Optional<TorrentDescriptor> getDescriptor(TorrentId torrentId)
TorrentRegistry
getDescriptor
in interface TorrentRegistry
Optional.empty()
if torrent descriptor hasn't been created yet.public TorrentDescriptor getOrCreateDescriptor(Torrent torrent, Storage storage)
TorrentRegistry
getOrCreateDescriptor
in interface TorrentRegistry
storage
- Storage to use for storing this torrent's files.
Will be used when creating a new torrent descriptor.public TorrentDescriptor register(Torrent torrent, Storage storage, FileDownloadCompleteCallback completedFileCallbacks)
TorrentRegistry
register
in interface TorrentRegistry
storage
- Storage to use for storing this torrent's files.
Will be used when creating a new torrent descriptor.public TorrentDescriptor register(TorrentId torrentId)
TorrentRegistry
register
in interface TorrentRegistry
public boolean isSupportedAndActive(TorrentId torrentId)
isSupportedAndActive
in interface TorrentRegistry
public void registerSessionState(TorrentId torrentId, TorrentSessionState state)
TorrentRegistry
registerSessionState
in interface TorrentRegistry
torrentId
- the torrent idstate
- the session state of the torrentCopyright © 2016–2021. All rights reserved.