Dekoh platform API

dekoh.portal.fwk.importer
Interface ImportProcessor

All Known Implementing Classes:
AbstractImportProcessor

public interface ImportProcessor

ImportProcessor provides methods to import files into Dekoh. Importing a file means creating instance of DigitalObject for a File.

Bunch of related Digital Objects may be organized into Collections. Collections can then be shared with other Dekoh users.

Since:
Nov 14, 2006

Method Summary
 void beginImport()
          Marks the begin for batched commit of files to Dekoh.
 void close()
          Close Resources (if any) used by processor.
 void commitChanges()
          Commit all the changes that have been batched since last ImportProcessor.beginImport() callback.
 List findFilesThatAreRemovedFromFileSystem(File dir)
          Find all files in the specified directory which are actually removed form the file system but are yet to be removed from Dekoh
 ImportStatusInfo importDigitalObject(ImportRequest importRequest)
           
 ImportStatusInfo importDigitalObject(RootFolder rootFolder, File file)
          Create a DigitalObject for this file in dekoh if it does not exist previously
 ImportStatusInfo importDigitalObject(RootFolder rootFolder, File file, String digitalObjectName)
           
 boolean isNewDirectory(File directory, RootFolder rootFolder)
          ImportService will use this method to check if Dekoh Database has DigitialObject representations of Files that are removed from filesystem.
 ImportStatusInfo removeFileFromDB(File file)
          Remove the digitalObject for this file from Dekoh.
 void rollback()
          Rollback if there is an active transaction started by ImportProcessor.beginImport()
 

Method Detail

importDigitalObject

ImportStatusInfo importDigitalObject(RootFolder rootFolder,
                                     File file)
Create a DigitalObject for this file in dekoh if it does not exist previously

Parameters:
rootFolder -
file - @return one of ImportStatus#digitalObjectStatus()
Throws:
IllegalStateException - if the method is while no transaction is active.

importDigitalObject

ImportStatusInfo importDigitalObject(RootFolder rootFolder,
                                     File file,
                                     String digitalObjectName)

importDigitalObject

ImportStatusInfo importDigitalObject(ImportRequest importRequest)

isNewDirectory

boolean isNewDirectory(File directory,
                       RootFolder rootFolder)
ImportService will use this method to check if Dekoh Database has DigitialObject representations of Files that are removed from filesystem.

This method is generally used when ImportedDirectories.getDirectoryStatus(java.io.File,RootFolder)} cannot determine the state of a directory.

Parameters:
directory -
rootFolder -
Returns:
true if a digitalObject for the directory exists in Dekoh
See Also:
ImportProcessor.findFilesThatAreRemovedFromFileSystem(java.io.File)

findFilesThatAreRemovedFromFileSystem

List findFilesThatAreRemovedFromFileSystem(File dir)
Find all files in the specified directory which are actually removed form the file system but are yet to be removed from Dekoh

Parameters:
dir -
Returns:
list of files to be removed

removeFileFromDB

ImportStatusInfo removeFileFromDB(File file)
Remove the digitalObject for this file from Dekoh. This method usually follows ImportProcessor.findFilesThatAreRemovedFromFileSystem(java.io.File), other cases when this mehtod may be called is when user triggers deletion.

Parameters:
file -
Throws:
IllegalStateException - if the method is while no transaction is active.

beginImport

void beginImport()
Marks the begin for batched commit of files to Dekoh. ImportService will call this method whenever it sees a new Directory or when a pre-set limit is reached while importing files in a directory.

Implementations are expected to start a new Transaction when this method is called.

See Also:
ImportProcessor.commitChanges(), ImportProcessor.isNewDirectory(java.io.File,RootFolder), ImportConfig.getNumberOfFilesInBatch(), dekoh.portal.fwk.persistence.DIOEntityManagerFactory#createDIOEntityManager()}

commitChanges

void commitChanges()
Commit all the changes that have been batched since last ImportProcessor.beginImport() callback. Batching of commits is required to control heap usage by the created but yet to be persisted DigitalObjects

See Also:
dekoh.portal.fwk.persistence.DIOEntityManager#commitTx()}

close

void close()
Close Resources (if any) used by processor.


rollback

void rollback()
Rollback if there is an active transaction started by ImportProcessor.beginImport()


Dekoh platform API

© 2009 Pramati Technologies - Dekoh - Portal for Developers