org.xnap.plugin.opennap.net
Class OpenNapDirectBrowse

java.lang.Object
  extended by org.xnap.transfer.AbstractTransfer
      extended by org.xnap.transfer.AbstractDownload
          extended by org.xnap.plugin.opennap.net.OpenNapDirectBrowse
All Implemented Interfaces:
ExceptionListener, MessageListener, OpenNapBrowseInterface, SocketListener, Search, Download, Transfer, TransferContainer

public class OpenNapDirectBrowse
extends AbstractDownload
implements ExceptionListener, MessageListener, OpenNapBrowseInterface, SocketListener


Field Summary
protected static org.apache.log4j.Logger logger
           
static int REQUEST_TIMEOUT
           
static int SOCKET_TIMEOUT
           
 
Fields inherited from class org.xnap.transfer.AbstractTransfer
MIN_RECALC_INTERVAL, RECALC_INTERVAL
 
Fields inherited from interface org.xnap.transfer.Transfer
TRANSFER_TIMEOUT
 
Constructor Summary
OpenNapDirectBrowse(OpenNapUser user)
           
 
Method Summary
 void exceptionThrown(java.lang.Exception e)
           
 javax.swing.Action[] getActions()
          Returns additional actions for this search that can be performed besides stop and requery.
 long getBytesTransferred()
          Returns how many bytes have been transferred since the transfer was started.
 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.
 SearchFilter getFilter()
          Returns null.
 javax.swing.Icon getIcon()
          Returns null.
 java.lang.String getName()
          Returns the name of the user that is browsed.
 Peer getPeer()
          Returns the peer.
 Plugin getPlugin()
          Returns the plugin.
 Segment[] getSegments()
          Returns the segments for segmented downloads.
 java.lang.String getStatus()
          Returns a string that describes the current status.
 long getTotalBytesTransferred()
          Returns how many bytes have been transferred.
 boolean isDone()
          Returns true, if this search is finished and can not be started again.
 boolean isFailed()
          Returns true, if the browse failed.
 boolean isRunning()
          Returns true if the transfer is running.
 void messageReceived(ServerMessage msg)
          Handles messages received from the server as response to the download request.
 boolean showTree()
          Returns true.
 boolean socketReceived(IncomingSocket s)
          Invoked when an incoming connect is recognized.
 void start(SearchHandler handler)
          Starts this search.
 void stop()
          Cancels this search.
 
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, getQueuePosition, getRemainingTime, 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, getQueuePosition, getRemainingTime, removeStateListener
 

Field Detail

REQUEST_TIMEOUT

public static final int REQUEST_TIMEOUT
See Also:
Constant Field Values

SOCKET_TIMEOUT

public static final int SOCKET_TIMEOUT
See Also:
Constant Field Values

logger

protected static org.apache.log4j.Logger logger
Constructor Detail

OpenNapDirectBrowse

public OpenNapDirectBrowse(OpenNapUser user)
Method Detail

exceptionThrown

public void exceptionThrown(java.lang.Exception e)
Specified by:
exceptionThrown in interface ExceptionListener

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 Transfer
Overrides:
getFilename in class AbstractTransfer

getFilesize

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

Specified by:
getFilesize in interface Transfer
Overrides:
getFilesize in class AbstractTransfer

getFilter

public SearchFilter getFilter()
Returns null.

Specified by:
getFilter in interface Search
Returns:
null, if no filter was used; the filter, otherwise

getName

public java.lang.String getName()
Returns the name of the user that is browsed.

Specified by:
getName in interface Search

getPlugin

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

Specified by:
getPlugin in interface Transfer

getActions

public javax.swing.Action[] getActions()
Description copied from interface: Search
Returns additional actions for this search that can be performed besides stop and requery.

Specified by:
getActions in interface Search
Specified by:
getActions in interface Transfer
See Also:
xnap.transfer.Transfer#getActions()

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()

getIcon

public javax.swing.Icon getIcon()
Description copied from class: AbstractTransfer
Returns null.

Specified by:
getIcon in interface Transfer
Overrides:
getIcon in class AbstractTransfer

getPeer

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

Specified by:
getPeer in interface Transfer
See Also:
xnap.transfer.Transfer#getPeer()

getSegments

public Segment[] getSegments()
Description copied from interface: Transfer
Returns the segments for segmented downloads.

Specified by:
getSegments in interface Transfer
Overrides:
getSegments in class AbstractTransfer
Returns:
null, if segments are not supported (which means that there is only one segment that represents the whole file)

getStatus

public java.lang.String getStatus()
Description copied from interface: Search
Returns a string that describes the current status.

Specified by:
getStatus in interface Search
Specified by:
getStatus in interface Transfer
See Also:
xnap.transfer.Transfer#getStatus()

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
See Also:
xnap.transfer.Transfer#getTotalBytesTransferred()

isDone

public boolean isDone()
Description copied from interface: Search
Returns true, if this search is finished and can not be started again.

Specified by:
isDone in interface Search
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()
Description copied from interface: OpenNapBrowseInterface
Returns true, if the browse failed.

Specified by:
isFailed in interface OpenNapBrowseInterface

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

messageReceived

public void messageReceived(ServerMessage msg)
Handles messages received from the server as response to the download request. Notifies the parent download container if download is ready to start or if it should be removed due to an error message received from the server.

Specified by:
messageReceived in interface MessageListener

showTree

public boolean showTree()
Returns true.

Specified by:
showTree in interface Search

socketReceived

public boolean socketReceived(IncomingSocket s)
Description copied from interface: SocketListener
Invoked when an incoming connect is recognized.

Specified by:
socketReceived in interface SocketListener
Returns:
true, if the socket was accepted

start

public void start(SearchHandler handler)
Starts this search.

Specified by:
start in interface Search
Parameters:
handler - the object that handles the results

stop

public void stop()
Cancels this search.

Specified by:
stop in interface Search


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