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 void
contextualize(Context context)
void
exportCollection(ResourceCollection collection, ZipOutputStream zos, String prefix)
Exports aResourceCollection
as folders and files inside the ZIP archive.void
exportResource(Resource resource, ZipOutputStream zos, String prefix)
Exports aResource
as file inside the ZIP archive.ImportReport
importCollection(String commonPrefix, Node parentOfRootResources, Path zipPath, Merger merger)
Imports folders and files from the given ZIP archive and path, under the givenResourceCollection
void
service(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:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
exportCollection
public void exportCollection(ResourceCollection collection, ZipOutputStream zos, String prefix) throws IOException
Exports aResourceCollection
as folders and files inside the ZIP archive.- Parameters:
collection
- the rootResourceCollection
zos
- 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 aResource
as 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
-
-