Class ResourcesArchiverHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.contentio.archive.ResourcesArchiverHelper
- All Implemented Interfaces:
 LogEnabled,Component,Contextualizable,Serviceable
public class ResourcesArchiverHelper
extends AbstractLogEnabled
implements Component, Serviceable, Contextualizable
Export a resources collection as individual files.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidcontextualize(Context context) voidexportCollection(ResourceCollection collection, ZipOutputStream zos, String prefix) Exports aResourceCollectionas folders and files inside the ZIP archive.voidexportResource(Resource resource, ZipOutputStream zos, String prefix) Exports aResourceas file inside the ZIP archive.importCollection(String commonPrefix, javax.jcr.Node parentOfRootResources, Path zipPath, Merger merger) Imports folders and files from the given ZIP archive and path, under the givenResourceCollectionvoidservice(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger 
- 
Field Details
- 
ROLE
Avalon role. 
 - 
 - 
Constructor Details
- 
ResourcesArchiverHelper
public ResourcesArchiverHelper() 
 - 
 - 
Method Details
- 
service
- Specified by:
 servicein interfaceServiceable- Throws:
 ServiceException
 - 
contextualize
- Specified by:
 contextualizein interfaceContextualizable- Throws:
 ContextException
 - 
exportCollection
public void exportCollection(ResourceCollection collection, ZipOutputStream zos, String prefix) throws IOException Exports aResourceCollectionas folders and files inside the ZIP archive.- Parameters:
 collection- the rootResourceCollectionzos- the ZIP OutputStream.prefix- the prefix for the ZIP archive.- Throws:
 IOException- if an error occurs while archiving
 - 
exportResource
public void exportResource(Resource resource, ZipOutputStream zos, String prefix) throws IOException Exports aResourceas file inside the ZIP archive.- Parameters:
 resource- theResource.zos- the ZIP OutputStream.prefix- the prefix for the ZIP archive.- Throws:
 IOException- if an error occurs while archiving
 - 
importCollection
public ImportReport importCollection(String commonPrefix, javax.jcr.Node parentOfRootResources, Path zipPath, Merger merger) throws IOException Imports folders and files from the given ZIP archive and path, under the givenResourceCollection- Parameters:
 commonPrefix- The common prefix in the ZIP archiveparentOfRootResources- the parent of the rootResourceCollection(the root will also be created)zipPath- the input zip pathmerger- TheMerger- Returns:
 - The 
ImportReport - Throws:
 IOException- if an error occurs while importing archive
 
 -