sk.baka.ambient.collection.sync
Class CollectionSynchronizer

java.lang.Object
  extended by sk.baka.ambient.collection.sync.CollectionSynchronizer
All Implemented Interfaces:
java.util.concurrent.Callable<java.lang.Void>

public class CollectionSynchronizer
extends java.lang.Object
implements java.util.concurrent.Callable<java.lang.Void>

Downloads tracks from given collection which are missing in the reference collection. All work is done in the call() method.

Author:
mvy

Constructor Summary
CollectionSynchronizer(android.content.Context context, ICollection reference, ICollection downloadFrom, TagFormatter pathFormatter, java.lang.String rootPath, IBackgroundTask task)
          Creates new synchronizer.
 
Method Summary
 java.lang.Void call()
           
 void downloadEntireCollection()
          Configures the synchronizer to download entire collection (the default).
 void setCategoriesToDownload(java.util.Collection<? extends CategoryItem> items)
          Sets the synchronizer to download tracks from these categories, instead of performing a full synchronization.
 void setTracksToDownload(java.util.Collection<? extends TrackMetadataBean> tracks)
          Sets the synchronizer to download these tracks, instead of performing a full synchronization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionSynchronizer

public CollectionSynchronizer(android.content.Context context,
                              ICollection reference,
                              ICollection downloadFrom,
                              TagFormatter pathFormatter,
                              java.lang.String rootPath,
                              IBackgroundTask task)
Creates new synchronizer.

Parameters:
context - owner's context.
reference - This is the reference collection, i.e. tracks which are not to be synchronized.
downloadFrom - Download excess tracks from this collection.
pathFormatter - produces a relative path where the music file should be stored. Must produce valid paths! Paths are created automatically.
rootPath - this path is automatically prepended to paths produced by the pathFormatter formatter.
task - used for progress reporting, may be null.
Method Detail

setTracksToDownload

public void setTracksToDownload(java.util.Collection<? extends TrackMetadataBean> tracks)
Sets the synchronizer to download these tracks, instead of performing a full synchronization.

Parameters:
tracks - the tracks to download.

setCategoriesToDownload

public void setCategoriesToDownload(java.util.Collection<? extends CategoryItem> items)
Sets the synchronizer to download tracks from these categories, instead of performing a full synchronization.

Parameters:
items - the items to download.

downloadEntireCollection

public void downloadEntireCollection()
Configures the synchronizer to download entire collection (the default).


call

public java.lang.Void call()
                    throws java.lang.Exception
Specified by:
call in interface java.util.concurrent.Callable<java.lang.Void>
Throws:
java.lang.Exception


Copyright © 2007-2009. All Rights Reserved.