Class ArchiveService


  • public class ArchiveService
    extends Object
    Since:
    30/11/15
    Author:
    roland
    • Method Detail

      • extractDockerCopyArchive

        public void extractDockerCopyArchive​(File archiveFile,
                                             File destinationDirectory)
                                      throws org.apache.maven.plugin.MojoExecutionException
        Extracts an archive returned when copying file or directory from container.
        Parameters:
        archiveFile - a tar archive to extract
        destinationDirectory - directory where to place extracted content
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if an error occurs during extracting.
      • createDockerBuildArchive

        public File createDockerBuildArchive​(ImageConfiguration imageConfig,
                                             MojoParameters params)
                                      throws org.apache.maven.plugin.MojoExecutionException
        Create the tar file container the source for building an image. This tar can be used directly for uploading to a Docker daemon for creating the image
        Parameters:
        imageConfig - the image configuration
        params - mojo params for the project
        Returns:
        file for holding the sources
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if during creation of the tar an error occurs.
      • createDockerBuildArchive

        public File createDockerBuildArchive​(ImageConfiguration imageConfig,
                                             MojoParameters params,
                                             ArchiverCustomizer customizer)
                                      throws org.apache.maven.plugin.MojoExecutionException
        Create the tar file container the source for building an image. This tar can be used directly for uploading to a Docker daemon for creating the image
        Parameters:
        imageConfig - the image configuration
        params - mojo params for the project
        customizer - final customizer to be applied to the tar before being generated
        Returns:
        file for holding the sources
        Throws:
        org.apache.maven.plugin.MojoExecutionException - if during creation of the tar an error occurs.
      • getAssemblyFiles

        public AssemblyFiles getAssemblyFiles​(ImageConfiguration imageConfig,
                                              String assemblyName,
                                              MojoParameters mojoParameters)
                                       throws org.apache.maven.plugin.MojoExecutionException
        Get a mapping of original to destination files which a covered by an assembly. This can be used to watch the source files for changes in order to update the target (either by recreating a docker image or by copying it into a running container)
        Parameters:
        imageConfig - image config for which to get files. The build- and assembly configuration in this image config must not be null.
        mojoParameters - needed for tracking the assembly
        Returns:
        mapping of assembly files
        Throws:
        org.apache.maven.plugin.MojoExecutionException
      • createChangedFilesArchive

        public File createChangedFilesArchive​(List<AssemblyFiles.Entry> entries,
                                              File assemblyDir,
                                              String imageName,
                                              MojoParameters mojoParameters)
                                       throws org.apache.maven.plugin.MojoExecutionException
        Create an tar archive from a set of assembly files. Only files which changed since the last call are included.
        Parameters:
        entries - changed files. List must not be empty or null
        imageName - image's name
        mojoParameters -
        Returns:
        created archive
        Throws:
        org.apache.maven.plugin.MojoExecutionException