info.magnolia.module.data.importer
Class SimpleImportHandler

java.lang.Object
  extended by info.magnolia.module.data.importer.ImportHandler
      extended by info.magnolia.module.data.importer.SimpleImportHandler

public abstract class SimpleImportHandler
extends ImportHandler

Import handler implementation capable of importing content in xml format from external url including importin the zip file with content.

Version:
$Id$

Field Summary
 
Fields inherited from class info.magnolia.module.data.importer.ImportHandler
activateImport, automatedExecution, backup, backupFile, deleteOldData, lockDuringImport, MILLI_2_HOUR, name, NODE_DATA_IMPORT_STATE, NODE_DATA_IMPORT_STATE_NEW, NODE_DATA_IMPORT_STATE_OLD, NODE_DATA_USED_IMPORTER_TARGET, repository, running, targets
 
Constructor Summary
SimpleImportHandler()
           
 
Method Summary
protected  Set<String> doImport(ImportTarget traget, info.magnolia.cms.core.Content parent, Set<String> uuids)
          Imports.
protected  ZipFile getAdditonalFilesZip(SimpleImportTarget target, File tempFile)
          Streams the images and saves them into a temporary zip file.
protected  InputStream getInputStream(SimpleImportTarget target)
           
protected  URL getURL(String url)
          Returns a URL for the given string.
protected abstract  void onDoImport(info.magnolia.cms.core.Content parent, SimpleImportTarget target, Set<String> createdNodesUuids, ZipFile additionalFilesZip, InputStream stream)
           
 
Methods inherited from class info.magnolia.module.data.importer.ImportHandler
addTarget, backup, checkPreConditions, collectOldContent, destroy, doPostImport, execute, executeImport, getAutomatedExecution, getName, getParent, getRepository, getTargets, isActivateImport, isBackup, isDeleteOldData, isLockDuringImport, lock, restore, setActivateImport, setAutomatedExecution, setBackup, setDeleteOldData, setImportState, setLockDuringImport, setName, setRepository, setTargets, unlock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleImportHandler

public SimpleImportHandler()
Method Detail

doImport

protected Set<String> doImport(ImportTarget traget,
                               info.magnolia.cms.core.Content parent,
                               Set<String> uuids)
                        throws ImportException
Imports.

Specified by:
doImport in class ImportHandler
Parameters:
traget - the import target to use
parent - the node to import below
uuids - ordered set containing the uuids
Returns:
uuids of the imported nodes
Throws:
ImportException

getURL

protected URL getURL(String url)
              throws MalformedURLException
Returns a URL for the given string.

Parameters:
url - The URL string representation
Returns:
a URL for the given string
Throws:
MalformedURLException

getInputStream

protected InputStream getInputStream(SimpleImportTarget target)
                              throws ImportException
Throws:
ImportException

getAdditonalFilesZip

protected ZipFile getAdditonalFilesZip(SimpleImportTarget target,
                                       File tempFile)
                                throws IOException
Streams the images and saves them into a temporary zip file. Returns the file.

Parameters:
target - the import target
tempFile - the temporary file for saving the images
Returns:
a temporary file including the images
Throws:
IOException

onDoImport

protected abstract void onDoImport(info.magnolia.cms.core.Content parent,
                                   SimpleImportTarget target,
                                   Set<String> createdNodesUuids,
                                   ZipFile additionalFilesZip,
                                   InputStream stream)
                            throws Exception
Throws:
Exception


Copyright © 2012 Magnolia International Ltd.. All Rights Reserved.