com.agimatec.utility.fileimport
Class ImportJob

java.lang.Object
  extended by com.agimatec.utility.fileimport.ImportJob

public class ImportJob
extends Object

Job definition of a dbimport job. This class can be used to simplify the usage of the APIs of dbimport. User: roman.stumm Date: 09.04.2010
Time: 14:06:29
viaboxx GmbH, 2010

See Also:
ImportController, ImportControl, Importer, ImporterSpec

Field Summary
protected static String C_ProtocolClassPath
           
protected  Connection connection
           
protected  ImportControl control
           
protected  ImportController controller
           
protected  Importer importer
           
static int MAX_LENGTH
           
protected  InputStream readStream
           
 
Constructor Summary
ImportJob()
           
ImportJob(Connection connection)
           
 
Method Summary
protected  void close()
           
 Connection getConnection()
           
 ImportControl getControl()
          never null, but optional
 ImportController getController()
           
 Importer getImporter()
           
protected  void handleErrorMessage(Exception ex)
           
protected  void handleException(Exception ex)
           
 void importFromReader(ImporterSpec spec, String charset)
          API - start the import, close all resources afterwards
 void importFromStream(ImporterSpec spec)
          API - start the import, close all resources afterwards
 void importFromURL(ImporterSpec spec)
          API - start the import, close all resources afterwards
 void join()
          API - wait for other imports of the same kind.
protected  void openURL(ImporterSpec spec)
           
 void setConnection(Connection connection)
          set a connection before the import starts
 void setController(ImportController controller)
          optional: set the controller for the import
 void setImporter(Importer importer)
          need not call this
static URL toURL(String path)
          utility method - from the resource string create URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_LENGTH

public static int MAX_LENGTH

C_ProtocolClassPath

protected static final String C_ProtocolClassPath
See Also:
Constant Field Values

control

protected final ImportControl control

connection

protected Connection connection

controller

protected ImportController controller

importer

protected Importer importer

readStream

protected InputStream readStream
Constructor Detail

ImportJob

public ImportJob()

ImportJob

public ImportJob(Connection connection)
Method Detail

toURL

public static URL toURL(String path)
                 throws MalformedURLException
utility method - from the resource string create URL.

Parameters:
path - - cp:// for class path resource or and other protocol. if no protocol is given, assume file: protocol
Returns:
the URL to load the resource or null if not found
Throws:
MalformedURLException

importFromURL

public void importFromURL(ImporterSpec spec)
                   throws Exception
API - start the import, close all resources afterwards

Throws:
Exception

importFromStream

public void importFromStream(ImporterSpec spec)
                      throws Exception
API - start the import, close all resources afterwards

Throws:
Exception

importFromReader

public void importFromReader(ImporterSpec spec,
                             String charset)
                      throws Exception
API - start the import, close all resources afterwards

Throws:
Exception

handleException

protected void handleException(Exception ex)
                        throws Exception
Throws:
Exception

handleErrorMessage

protected void handleErrorMessage(Exception ex)

openURL

protected void openURL(ImporterSpec spec)
                throws IOException
Throws:
IOException

close

protected void close()
              throws SQLException,
                     IOException
Throws:
SQLException
IOException

join

public void join()
          throws SQLException
API - wait for other imports of the same kind. requires a controller being set before calling this method.

Throws:
SQLException

getConnection

public Connection getConnection()

setConnection

public void setConnection(Connection connection)
set a connection before the import starts

Parameters:
connection -

getController

public ImportController getController()

getControl

public ImportControl getControl()
never null, but optional

Returns:

getImporter

public Importer getImporter()

setController

public void setController(ImportController controller)
optional: set the controller for the import

Parameters:
controller -

setImporter

public void setImporter(Importer importer)
need not call this

Parameters:
importer -


Copyright © 2008-2011. All Rights Reserved.