Class PluginsArchiver
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.contentio.archive.PluginsArchiver
-
- All Implemented Interfaces:
Archiver
,LogEnabled
,Serviceable
public class PluginsArchiver extends AbstractLogEnabled implements Archiver, Serviceable
Archives resources in /ametys:plugins
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
PluginsArchiver.PluginsArchiverManifestReaderWriter
-
Field Summary
Fields Modifier and Type Field Description private static String
__PARTIAL_IMPORT_PREFIX
private ManifestReaderWriter
_manifestReaderWriter
private PluginArchiverExtensionPoint
_pluginArchiverExtPoint
private Repository
_repository
static String
ID
Archiver id.
-
Constructor Summary
Constructors Constructor Description PluginsArchiver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
_closeSession(Session session)
private void
_exportPlugin(Node pluginNode, ZipOutputStream zos)
private static Node
_getAllPluginsNode(Session session)
private Map<String,String>
_getManifestData()
private static Iterator<Node>
_getPluginNodes(Session session)
private ImportReport
_importPlugin(String partialImport, Path zipPath, Merger merger, Node allPluginsNode, boolean deleteBefore)
private PluginArchiver
_retrievePluginArchiver(String pluginName)
void
export(ZipOutputStream zos)
Export data into the destination archiveManifestReaderWriter
getManifestReaderWriter()
Get theManifestReaderWriter
Collection<String>
managedPartialImports(Collection<String> partialImports)
Returns the partial imports, among the given ones, that thisArchiver
is able to manage.ImportReport
partialImport(Path zipPath, Collection<String> partialImports, Merger merger, boolean deleteBefore)
Import data (limited to the given partial imports) from the source archivevoid
service(ServiceManager manager)
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.ametys.plugins.contentio.archive.Archiver
additionalSuccessImportMail
-
-
-
-
Field Detail
-
ID
public static final String ID
Archiver id.- See Also:
- Constant Field Values
-
__PARTIAL_IMPORT_PREFIX
private static final String __PARTIAL_IMPORT_PREFIX
- See Also:
- Constant Field Values
-
_repository
private Repository _repository
-
_pluginArchiverExtPoint
private PluginArchiverExtensionPoint _pluginArchiverExtPoint
-
_manifestReaderWriter
private ManifestReaderWriter _manifestReaderWriter
-
-
Constructor Detail
-
PluginsArchiver
public PluginsArchiver()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getManifestReaderWriter
public ManifestReaderWriter getManifestReaderWriter()
Description copied from interface:Archiver
Get theManifestReaderWriter
- Specified by:
getManifestReaderWriter
in interfaceArchiver
- Returns:
- the
ManifestReaderWriter
-
_getManifestData
private Map<String,String> _getManifestData()
-
_getAllPluginsNode
private static Node _getAllPluginsNode(Session session) throws RepositoryException
- Throws:
RepositoryException
-
_getPluginNodes
private static Iterator<Node> _getPluginNodes(Session session) throws RepositoryException
- Throws:
RepositoryException
-
_closeSession
private static void _closeSession(Session session)
-
export
public void export(ZipOutputStream zos) throws IOException
Description copied from interface:Archiver
Export data into the destination archive- Specified by:
export
in interfaceArchiver
- Parameters:
zos
- the output data stream.- Throws:
IOException
- if an error occurs while writing entries to the archive.
-
_retrievePluginArchiver
private PluginArchiver _retrievePluginArchiver(String pluginName)
-
_exportPlugin
private void _exportPlugin(Node pluginNode, ZipOutputStream zos) throws Exception
- Throws:
Exception
-
managedPartialImports
public Collection<String> managedPartialImports(Collection<String> partialImports)
Description copied from interface:Archiver
Returns the partial imports, among the given ones, that thisArchiver
is able to manage.- Specified by:
managedPartialImports
in interfaceArchiver
- Parameters:
partialImports
- The partial imports to filter- Returns:
- The managed partial imports
-
partialImport
public ImportReport partialImport(Path zipPath, Collection<String> partialImports, Merger merger, boolean deleteBefore) throws IOException
Description copied from interface:Archiver
Import data (limited to the given partial imports) from the source archive- Specified by:
partialImport
in interfaceArchiver
- Parameters:
zipPath
- the input zip pathpartialImports
- The partial imports to do. The passed collection must already be filtered out byArchiver.managedPartialImports(java.util.Collection<java.lang.String>)
merger
- TheMerger
deleteBefore
-true
if objects need to be deleted before applying the partial imports- Returns:
- The
ImportReport
- Throws:
IOException
- if an error occurs while reading archive entries.
-
_importPlugin
private ImportReport _importPlugin(String partialImport, Path zipPath, Merger merger, Node allPluginsNode, boolean deleteBefore) throws IOException, RepositoryException
- Throws:
IOException
RepositoryException
-
-