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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.importCollection
(String commonPrefix, javax.jcr.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
-
Field Details
-
ROLE
Avalon role.
-
-
Constructor Details
-
ResourcesArchiverHelper
public ResourcesArchiverHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
contextualize
- 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, 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
-