Dekoh platform API

dekoh.portal.fwk.importer
Class ImportServiceImpl

java.lang.Object
  extended by dekoh.portal.fwk.importer.ImportServiceImpl
All Implemented Interfaces:
ImportService

public class ImportServiceImpl
extends Object
implements ImportService

Implementation of ImportService that imports matching file types from selected directories in local file system.

Users are expected to Register a call back ImportProcessor by calling ImportService.registerObserver(ScanObserver) method.It maintains a hash for each directory to be imported. The value of hash for each directory is determined by (immediate filename+size+lasModifiedTime). Addition/Changes are commited after each directory or max 100 photos

Since:
Nov 14, 2006

Field Summary
static ImportLogger importLogger
           
protected  ImportProcessor importProcessor
           
 
Constructor Summary
ImportServiceImpl(String id)
          Deprecated. use ImportServiceImpl.ImportServiceImpl(String,ImportProcessor)
ImportServiceImpl(String id, ImportProcessor importProcessor)
           
 
Method Summary
 long getLastImportTime()
           
protected  void initService(ImportContext importContext, ImportProgressObject importProgressObject)
           
 void registerObserver(ScanObserver scanObserver)
          Method to register the scanObserver to ImportService
 void setLastImportTime(long lastImportTime, String id)
           
 ImportProgressObject start(ImportContext importContext)
          Starts importing files in a separate thread and returns the progressObject to the caller.
 ImportProgressObject start(ImportContext importContext, ImportProgressObject importProgressObject)
          Starts importing files in a separate thread and returns the progressObject to the caller.
protected  ImportProgressObject startImporterThread(ImportContext importContext, ImportProgressObject importProgressObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

importLogger

public static final ImportLogger importLogger

importProcessor

protected ImportProcessor importProcessor
Constructor Detail

ImportServiceImpl

public ImportServiceImpl(String id)
Deprecated. use ImportServiceImpl.ImportServiceImpl(String,ImportProcessor)

Parameters:
id -

ImportServiceImpl

public ImportServiceImpl(String id,
                         ImportProcessor importProcessor)
Method Detail

registerObserver

public void registerObserver(ScanObserver scanObserver)
Method to register the scanObserver to ImportService

Specified by:
registerObserver in interface ImportService
Parameters:
scanObserver -

start

public ImportProgressObject start(ImportContext importContext)
Starts importing files in a separate thread and returns the progressObject to the caller.

Specified by:
start in interface ImportService
Parameters:
importContext -
Returns:
ImportProgressObject

start

public ImportProgressObject start(ImportContext importContext,
                                  ImportProgressObject importProgressObject)
Starts importing files in a separate thread and returns the progressObject to the caller. An implementation of ImportProcessor must be registered with this importService before this method can be executed.

Specified by:
start in interface ImportService
Parameters:
importContext -
importProgressObject -
Returns:
ImportProgressObject
Throws:
IllegalStateException - if instance of importProcessor is not registered

initService

protected void initService(ImportContext importContext,
                           ImportProgressObject importProgressObject)

startImporterThread

protected ImportProgressObject startImporterThread(ImportContext importContext,
                                                   ImportProgressObject importProgressObject)

getLastImportTime

public long getLastImportTime()
Specified by:
getLastImportTime in interface ImportService
Returns:
-1 if this import service was never triggered otherwise the time when import was last run.

setLastImportTime

public void setLastImportTime(long lastImportTime,
                              String id)

Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers