org.xnap.plugin.jtella
Class JTellaDownloadContainer

java.lang.Object
  extended by org.xnap.transfer.AbstractTransfer
      extended by org.xnap.transfer.AbstractDownload
          extended by org.xnap.plugin.jtella.JTellaDownloadContainer
All Implemented Interfaces:
Download, Queueable, Transfer, TransferContainer

public class JTellaDownloadContainer
extends AbstractDownload
implements Queueable

Manages JTellaDownload objects.


Field Summary
 
Fields inherited from class org.xnap.transfer.AbstractTransfer
MIN_RECALC_INTERVAL, RECALC_INTERVAL, SOCKET_TIMEOUT
 
Fields inherited from interface org.xnap.transfer.Transfer
TRANSFER_TIMEOUT
 
Constructor Summary
JTellaDownloadContainer(JTellaSearchResult result)
          Constructs a JTellaDownload.
JTellaDownloadContainer(JTellaSearchResultContainer container)
          Constructs a JTellaDownload.
 
Method Summary
 void add(JTellaDownload d)
           
 javax.swing.Action[] getActions()
          Returns the actions that can performed by the transfer.
 long getBytesTransferred()
          Returns how many bytes have been transferred since the transfer was started.
 JTellaDownload getDownload()
           
 long getEnqueueTime()
          Returns the time when the queueable was enqueued in milli seconds.
 java.io.File getFile()
          Returns the file the transfer is using.
 java.lang.String getFilename()
          Returns the filename that should be presented to the user.
 long getFilesize()
          Returns the final filesize.
 Peer getPeer()
          Returns the peer.
 Plugin getPlugin()
          Returns the plugin.
 int getPriority()
          Returns 1.
 int getQueuePosition()
          Returns the position in the DownloadManager queue.
 java.lang.String getStatus()
          Returns the current status that should be presented to the user.
 long getTotalBytesTransferred()
          Returns how many bytes have been transferred.
 boolean isDone()
          Returns true if the transfer is finished.
 boolean isFailed()
           
 boolean isRunning()
          Returns true if the transfer is running.
 void setQueuePosition(int position)
          Invoked by the queue to update the position.
 void start()
           
 void startNextDownload()
           
 boolean startTransfer()
          Invoked by queue once the item moves to the top of the queue and is ready to run.
 
Methods inherited from class org.xnap.transfer.AbstractDownload
add, addListListener, clearDone, getChildCount, getChildren, iterator, remove, removeListListener
 
Methods inherited from class org.xnap.transfer.AbstractTransfer
addStateListener, cleared, getAverageRate, getCurrentRate, getDescription, getElapsedTime, getIcon, getRemainingTime, getSegments, removeStateListener, stateChanged, toString, transferStarted, transferStopped
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.xnap.transfer.Transfer
addStateListener, cleared, getAverageRate, getCurrentRate, getDescription, getIcon, getRemainingTime, getSegments, removeStateListener
 

Constructor Detail

JTellaDownloadContainer

public JTellaDownloadContainer(JTellaSearchResultContainer container)
Constructs a JTellaDownload. Creates JTellaDownload objects from the results contained in container. Sequentially tries each download until one succeeds.


JTellaDownloadContainer

public JTellaDownloadContainer(JTellaSearchResult result)
Constructs a JTellaDownload. Creates JTellaDownload objects from the result.

Method Detail

add

public void add(JTellaDownload d)

getActions

public javax.swing.Action[] getActions()
Description copied from interface: Transfer
Returns the actions that can performed by the transfer.

Specified by:
getActions in interface Transfer

getBytesTransferred

public long getBytesTransferred()
Description copied from class: AbstractTransfer
Returns how many bytes have been transferred since the transfer was started.

Specified by:
getBytesTransferred in class AbstractTransfer
Returns:
number of transferred bytes
See Also:
AbstractTransfer.getCurrentRate()

getDownload

public JTellaDownload getDownload()

getEnqueueTime

public long getEnqueueTime()
Description copied from interface: Queueable
Returns the time when the queueable was enqueued in milli seconds.

Specified by:
getEnqueueTime in interface Queueable

getFile

public java.io.File getFile()
Description copied from interface: Transfer
Returns the file the transfer is using.

Specified by:
getFile in interface Transfer
Returns:
null, if file is unknown; the file, otherwise

getFilename

public java.lang.String getFilename()
Description copied from interface: Transfer
Returns the filename that should be presented to the user.

Specified by:
getFilename in interface Queueable
Specified by:
getFilename in interface Transfer
Overrides:
getFilename in class AbstractTransfer
See Also:
Transfer.getFilename()

getFilesize

public long getFilesize()
Description copied from interface: Transfer
Returns the final filesize.

Specified by:
getFilesize in interface Queueable
Specified by:
getFilesize in interface Transfer
Overrides:
getFilesize in class AbstractTransfer
See Also:
Transfer.getFilesize()

getPeer

public Peer getPeer()
Description copied from interface: Transfer
Returns the peer.

Specified by:
getPeer in interface Queueable
Specified by:
getPeer in interface Transfer
See Also:
Transfer.getPeer()

getPlugin

public Plugin getPlugin()
Description copied from interface: Transfer
Returns the plugin.

Specified by:
getPlugin in interface Transfer

getStatus

public java.lang.String getStatus()
Description copied from interface: Transfer
Returns the current status that should be presented to the user.

Specified by:
getStatus in interface Transfer

getTotalBytesTransferred

public long getTotalBytesTransferred()
Description copied from interface: Transfer
Returns how many bytes have been transferred.

Specified by:
getTotalBytesTransferred in interface Transfer
Returns:
number of transferred bytes

isDone

public boolean isDone()
Description copied from interface: Transfer
Returns true if the transfer is finished.

Specified by:
isDone in interface Transfer
Returns:
true, if thread has ended and the transfer can be cleared; false if, not yet started or still running

isFailed

public boolean isFailed()

isRunning

public boolean isRunning()
Description copied from interface: Transfer
Returns true if the transfer is running.

Specified by:
isRunning in interface Transfer
Returns:
true, if data is transferred or a connect is in progress; false, if queued, not yet started or done

getPriority

public int getPriority()
Returns 1.

Specified by:
getPriority in interface Queueable

getQueuePosition

public int getQueuePosition()
Returns the position in the DownloadManager queue.

Specified by:
getQueuePosition in interface Queueable
Specified by:
getQueuePosition in interface Transfer
Overrides:
getQueuePosition in class AbstractTransfer
Returns:
-1, if the transfer is not queued, the position otherwise.

setQueuePosition

public void setQueuePosition(int position)
Description copied from interface: Queueable
Invoked by the queue to update the position.

Specified by:
setQueuePosition in interface Queueable
Parameters:
position - if 0, the item has been dequeued from the queue and startQueued() has been called.

start

public void start()

startNextDownload

public void startNextDownload()

startTransfer

public boolean startTransfer()
Description copied from interface: Queueable
Invoked by queue once the item moves to the top of the queue and is ready to run.

Specified by:
startTransfer in interface Queueable
Returns:
true, if item has accepted the running state and should be dequeued; false, if item wants to remain queued


Copyright © 2001-2005 XNap Team. All Rights Reserved.