org.archiviststoolkit.importer
Class ImportHandler

java.lang.Object
  extended by org.archiviststoolkit.importer.ImportHandler
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
AccessionImportXmlHandler, EADImportHandler, MARCImportHandler, TabImportHandler, XmlImportHandler

public abstract class ImportHandler
extends java.lang.Object
implements java.lang.Runnable

Base class for all import handlers.


Field Summary
 java.io.File file
          the file to import.
 DomainImportController importController
          the domain controller to use.
 
Constructor Summary
ImportHandler()
           
 
Method Summary
abstract  boolean canImportFile(java.io.File importFile)
          Can we import this file.
 java.io.File getFile()
          Get the file to use.
 DomainImportController getImportController()
          Get the domaincontroller to use.
 java.lang.String getInitialChunk(java.io.File importFile)
          Get the initial file chunk (32 bytes).
abstract  boolean importFile(java.io.File importFile, DomainImportController controller, InfiniteProgressPanel progressPanel)
          Import the file.
 void run()
          The import thread run method.
 boolean startImportThread(java.io.File importFile, DomainImportController controller)
          Kick off the import thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

public java.io.File file
the file to import.


importController

public DomainImportController importController
the domain controller to use.

Constructor Detail

ImportHandler

public ImportHandler()
Method Detail

getFile

public java.io.File getFile()
Get the file to use.

Returns:
the file.

getImportController

public DomainImportController getImportController()
Get the domaincontroller to use.

Returns:
the domain controller.

canImportFile

public abstract boolean canImportFile(java.io.File importFile)
Can we import this file.

Parameters:
importFile - the file to import.
Returns:
can we.

importFile

public abstract boolean importFile(java.io.File importFile,
                                   DomainImportController controller,
                                   InfiniteProgressPanel progressPanel)
                            throws ImportException
Import the file.

Parameters:
importFile - the file to import.
controller - the controller to use.
progressPanel -
Returns:
if we succeded
Throws:
ImportException

startImportThread

public boolean startImportThread(java.io.File importFile,
                                 DomainImportController controller)
Kick off the import thread.

Parameters:
importFile - the file to import
controller - the controller to use.
Returns:
if we succeeded or not

run

public void run()
The import thread run method.

Specified by:
run in interface java.lang.Runnable

getInitialChunk

public java.lang.String getInitialChunk(java.io.File importFile)
Get the initial file chunk (32 bytes).

Parameters:
importFile - the file to import
Returns:
the initial string