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.
-
-
Constructor Summary
Constructors Constructor Description ResourcesArchiverHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcontextualize(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.ImportReportimportCollection(String commonPrefix, 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
-
-
-
-
Constructor Detail
-
ResourcesArchiverHelper
public ResourcesArchiverHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- 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, 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
-
-