com.atlassian.confluence.importexport
Class Importer

java.lang.Object
  extended by com.atlassian.confluence.importexport.Importer
Direct Known Subclasses:
BackupImporter

public abstract class Importer
extends java.lang.Object

An importer is a single-use object for performing an import with a given ImportContext.

Subclasses must implement the doImportInternal() method to perform the actual import, and may optionally override preImport() and postImportAndCleanUp() to do additional processing.

See Also:
ImportExportManager

Field Summary
protected  ImportContext context
           
protected  net.sf.hibernate.SessionFactory sessionFactory
           
 
Constructor Summary
Importer()
           
 
Method Summary
 ImportProcessorSummary doImport()
          Executes an import with this importer.
protected abstract  ImportProcessorSummary doImportInternal()
          Performs the actual import.
protected  com.atlassian.event.api.EventPublisher getEventPublisher()
           
protected  void postImportAndCleanUp()
          Perform any special logic after the import and post-import tasks are complete.
protected  void preImport()
          Perform any special logic prior to the import starting.
protected  void publishEvent(java.lang.Object event)
          Publish an event to the rest of the system.
 void setContext(ImportContext context)
           
 void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)
           
 void setPostImportTasks(java.util.List<PostImportTask> postImportTasks)
           
 void setSessionFactory(net.sf.hibernate.SessionFactory sessionFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected ImportContext context

sessionFactory

protected net.sf.hibernate.SessionFactory sessionFactory
Constructor Detail

Importer

public Importer()
Method Detail

setContext

public final void setContext(ImportContext context)

setSessionFactory

public final void setSessionFactory(net.sf.hibernate.SessionFactory sessionFactory)

setPostImportTasks

public final void setPostImportTasks(java.util.List<PostImportTask> postImportTasks)

setEventPublisher

public final void setEventPublisher(com.atlassian.event.api.EventPublisher eventPublisher)

doImport

public final ImportProcessorSummary doImport()
                                      throws ImportExportException
Executes an import with this importer. Clients should not normally call this method directly, but instead use the ImportExportManager.

After the import is complete, runs the post-import tasks, published a ImportFinishedEvent, and deletes the import working file.

Throws:
ImportExportException - if there was a problem during the import or any of the post-import tasks failed.

preImport

protected void preImport()
                  throws ImportExportException
Perform any special logic prior to the import starting. Default implementation does nothing.

Throws:
ImportExportException - if the import should be aborted

postImportAndCleanUp

protected void postImportAndCleanUp()
                             throws ImportExportException
Perform any special logic after the import and post-import tasks are complete. This method will run even if the import fails. The default implementation does nothing.

Throws:
ImportExportException - if the import process should be aborted

doImportInternal

protected abstract ImportProcessorSummary doImportInternal()
                                                    throws ImportExportException
Performs the actual import.

Throws:
ImportExportException - if there was a problem executing the import
See Also:
ImportExportManager.performImport(ImportContext)

publishEvent

protected final void publishEvent(java.lang.Object event)
Publish an event to the rest of the system.

Parameters:
event - the event to publish

getEventPublisher

protected com.atlassian.event.api.EventPublisher getEventPublisher()


Copyright © 2003-2014 Atlassian. All Rights Reserved.