public class ZipHandler extends DefaultHandler
ZipHandler
imports and extracts Zip files and exported nodes
(an their subnodes) to a Zip file. Please not that for the export the selected
export root must have the property ZIP_MIMETYPE
defined with its
content. Furthermore the content must not represent a zip-file that has
been imported to a binary property
, which is properly
handled by the DefaultHandler
.Modifier and Type | Field and Description |
---|---|
static String |
ZIP_MIMETYPE
the zip mimetype
|
Constructor and Description |
---|
ZipHandler()
Creates a new
ZipHandler with default nodetype definitions
and without setting the IOManager. |
ZipHandler(IOManager ioManager)
Creates a new
ZipHandler with default nodetype definitions:Nodetype for Collection: nt:unstructured
Nodetype for Non-Collection: nt:file
Nodetype for Non-Collection content: nt:unstructured
|
ZipHandler(IOManager ioManager,
String collectionNodetype,
String defaultNodetype,
String contentNodetype)
Creates a new
ZipHandler |
Modifier and Type | Method and Description |
---|---|
boolean |
canExport(ExportContext context,
boolean isCollection)
Returns true if the export root is a node and if it contains a child node
with name
jcr:content in case this
export is not intended for a collection. |
boolean |
canImport(ImportContext context,
boolean isCollection)
Returns true, if this handler can run a successful import based on the
specified context.
|
protected void |
exportData(ExportContext context,
boolean isCollection,
Node contentNode)
Checks if the given content node contains a jcr:data property
and spools its value to the output stream of the export context.
Please note, that subclasses that define a different structure of the content node should create their own exportData method. |
protected boolean |
importData(ImportContext context,
boolean isCollection,
Node contentNode)
Imports the data present on the import context to the specified content
node.
|
void |
setIntermediateSave(boolean intermediateSave)
If set to
true the import root will be saved
after every imported zip entry. |
canCopy, canDelete, canExport, canExport, canImport, canImport, canMove, copy, delete, detect, exportContent, exportContent, exportProperties, exportProperties, forceCompatibleContentNodes, getCollectionNodeType, getContentNode, getContentNode, getContentNodeType, getIOManager, getName, getNodeType, importContent, importContent, importProperties, importProperties, move, setCollectionNodetype, setContentNodetype, setDefaultNodetype, setIOManager
public static final String ZIP_MIMETYPE
public ZipHandler()
ZipHandler
with default nodetype definitions
and without setting the IOManager.IOHandler.setIOManager(IOManager)
public ZipHandler(IOManager ioManager)
ZipHandler
with default nodetype definitions:nt:unstructured
nt:file
nt:unstructured
ioManager
- IllegalArgumentException
- if the specified IOManager
is null
public ZipHandler(IOManager ioManager, String collectionNodetype, String defaultNodetype, String contentNodetype)
ZipHandler
ioManager
- collectionNodetype
- defaultNodetype
- contentNodetype
- IllegalArgumentException
- if the specified IOManager
is null
public void setIntermediateSave(boolean intermediateSave)
true
the import root will be saved
after every imported zip entry. Note however, that this removes the possibility
to revert all modifications if the import cannot be completed successfully.
By default the intermediate save is disabled.intermediateSave
- public boolean canImport(ImportContext context, boolean isCollection)
IOHandler
canImport
in interface IOHandler
canImport
in class DefaultHandler
IOHandler.canImport(ImportContext, boolean)
protected boolean importData(ImportContext context, boolean isCollection, Node contentNode) throws IOException, RepositoryException
DefaultHandler
importData
in class DefaultHandler
IOException
RepositoryException
DefaultHandler.importData(ImportContext, boolean, Node)
public boolean canExport(ExportContext context, boolean isCollection)
DefaultHandler
jcr:content
in case this
export is not intended for a collection.canExport
in interface IOHandler
canExport
in class DefaultHandler
jcr:content
.IOHandler.canExport(ExportContext, boolean)
protected void exportData(ExportContext context, boolean isCollection, Node contentNode) throws IOException, RepositoryException
DefaultHandler
exportData
method.exportData
in class DefaultHandler
context
- export contextisCollection
- true
if collectioncontentNode
- the content nodeIOException
- if an I/O error occursRepositoryException
DefaultHandler.exportData(ExportContext,boolean,Node)
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.