org.qtunes.scanner
Class Scanner

java.lang.Object
  extended by org.qtunes.scanner.Scanner
All Implemented Interfaces:
java.lang.Runnable, Service

public class Scanner
extends java.lang.Object
implements Service, java.lang.Runnable

The Scanner scans the disk looking for new files, and attempts to load them by calling TrackReader.read(java.io.File). If it succeeds it adds the tracks to the database.


Constructor Summary
Scanner()
           
 
Method Summary
 ServiceContext getContext()
          Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext)
 long getLastScan()
          Return the timestamp of the last scan in milliseconds
 java.io.File getRoot()
          Return a list of paths this Scanner will traverse
 java.util.Map<java.lang.String,java.lang.Object> reportState()
          Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects.
 void rescan()
          Rescan for any tracks changed since the last scan
 void rescan(long lastscan)
          Rescan for any tracks changed since the specified timestamp
 void run()
          The main scanning thread
 void startService(ServiceContext context)
          Start the Service
 void stopService(ServiceContext context)
          Stop the Service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scanner

public Scanner()
Method Detail

startService

public void startService(ServiceContext context)
Description copied from interface: Service
Start the Service

Specified by:
startService in interface Service
Parameters:
context - the ServiceContext for this Service

stopService

public void stopService(ServiceContext context)
Description copied from interface: Service
Stop the Service

Specified by:
stopService in interface Service
Parameters:
context - the ServiceContext for this Service (same as was passed into start)

getContext

public ServiceContext getContext()
Description copied from interface: Service
Return the ServiceContext that was passed into Service.startService(org.qtunes.core.ServiceContext)

Specified by:
getContext in interface Service

rescan

public void rescan()
Rescan for any tracks changed since the last scan


rescan

public void rescan(long lastscan)
Rescan for any tracks changed since the specified timestamp

Parameters:
lastscan - the timestamp in milliseconds

getRoot

public java.io.File getRoot()
Return a list of paths this Scanner will traverse


getLastScan

public long getLastScan()
Return the timestamp of the last scan in milliseconds


run

public void run()
The main scanning thread

Specified by:
run in interface java.lang.Runnable

reportState

public java.util.Map<java.lang.String,java.lang.Object> reportState()
Description copied from interface: Service
Return a Map describing the state of this Service, for serialization back to any client that needs to know (eg webplayer) - so values should be serializable objects, eg Lists, Maps or simple objects. If no useful state, return null.

Specified by:
reportState in interface Service