Package io.fabric8.maven.docker.util
Class ImageArchiveUtil
- java.lang.Object
-
- io.fabric8.maven.docker.util.ImageArchiveUtil
-
public class ImageArchiveUtil extends Object
Helper functions for working with Docker image archives, as produced by the docker:save mojo.
-
-
Field Summary
Fields Modifier and Type Field Description static StringMANIFEST_JSON
-
Constructor Summary
Constructors Constructor Description ImageArchiveUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,ImageArchiveManifestEntry>findEntriesByRepoTagPattern(String repoTagPattern, ImageArchiveManifest manifest)Search the manifest for an entry that has a repository and tag matching the provided pattern.static Map<String,ImageArchiveManifestEntry>findEntriesByRepoTagPattern(Pattern repoTagPattern, ImageArchiveManifest manifest)Search the manifest for an entry that has a repository and tag matching the provided pattern.static ImageArchiveManifestEntryfindEntryByRepoTag(String repoTag, ImageArchiveManifest manifest)Search the manifest for an entry that has the repository and tag provided.static org.apache.commons.lang3.tuple.Pair<String,ImageArchiveManifestEntry>findEntryByRepoTagPattern(String repoTagPattern, ImageArchiveManifest manifest)Search the manifest for an entry that has a repository and tag matching the provided pattern.static org.apache.commons.lang3.tuple.Pair<String,ImageArchiveManifestEntry>findEntryByRepoTagPattern(Pattern repoTagPattern, ImageArchiveManifest manifest)Search the manifest for an entry that has a repository and tag matching the provided pattern.static Map<String,ImageArchiveManifestEntry>mapEntriesById(Iterable<ImageArchiveManifestEntry> entries)Build a map of entries by id from an iterable of entries.static ImageArchiveManifestreadManifest(File file)Read the (possibly compressed) image archive provided and return the archive manifest.static ImageArchiveManifestreadManifest(InputStream inputStream)Read the (possibly compressed) image archive stream provided and return the archive manifest.
-
-
-
Field Detail
-
MANIFEST_JSON
public static final String MANIFEST_JSON
- See Also:
- Constant Field Values
-
-
Method Detail
-
readManifest
public static ImageArchiveManifest readManifest(File file) throws IOException, com.google.gson.JsonParseException
Read the (possibly compressed) image archive provided and return the archive manifest. If there is no manifest found, then null is returned. Incomplete manifests are returned with as much information parsed as possible.- Parameters:
file-- Returns:
- the parsed manifest, or null if none found.
- Throws:
IOExceptioncom.google.gson.JsonParseException
-
readManifest
public static ImageArchiveManifest readManifest(InputStream inputStream) throws IOException, com.google.gson.JsonParseException
Read the (possibly compressed) image archive stream provided and return the archive manifest. If there is no manifest found, then null is returned. Incomplete manifests are returned with as much information parsed as possible.- Parameters:
inputStream-- Returns:
- the parsed manifest, or null if none found.
- Throws:
IOExceptioncom.google.gson.JsonParseException
-
findEntryByRepoTag
public static ImageArchiveManifestEntry findEntryByRepoTag(String repoTag, ImageArchiveManifest manifest)
Search the manifest for an entry that has the repository and tag provided.- Parameters:
repoTag- the repository and tag to search (e.g. busybox:latest).manifest- the manifest to be searched- Returns:
- the entry found, or null if no match.
-
findEntryByRepoTagPattern
public static org.apache.commons.lang3.tuple.Pair<String,ImageArchiveManifestEntry> findEntryByRepoTagPattern(String repoTagPattern, ImageArchiveManifest manifest) throws PatternSyntaxException
Search the manifest for an entry that has a repository and tag matching the provided pattern.- Parameters:
repoTagPattern- the repository and tag to search (e.g. busybox:latest).manifest- the manifest to be searched- Returns:
- a pair containing the matched tag and the entry found, or null if no match.
- Throws:
PatternSyntaxException
-
findEntryByRepoTagPattern
public static org.apache.commons.lang3.tuple.Pair<String,ImageArchiveManifestEntry> findEntryByRepoTagPattern(Pattern repoTagPattern, ImageArchiveManifest manifest) throws PatternSyntaxException
Search the manifest for an entry that has a repository and tag matching the provided pattern.- Parameters:
repoTagPattern- the repository and tag to search (e.g. busybox:latest).manifest- the manifest to be searched- Returns:
- a pair containing the matched tag and the entry found, or null if no match.
- Throws:
PatternSyntaxException
-
findEntriesByRepoTagPattern
public static Map<String,ImageArchiveManifestEntry> findEntriesByRepoTagPattern(String repoTagPattern, ImageArchiveManifest manifest) throws PatternSyntaxException
Search the manifest for an entry that has a repository and tag matching the provided pattern.- Parameters:
repoTagPattern- the repository and tag to search (e.g. busybox:latest).manifest- the manifest to be searched- Returns:
- a pair containing the matched tag and the entry found, or null if no match.
- Throws:
PatternSyntaxException
-
findEntriesByRepoTagPattern
public static Map<String,ImageArchiveManifestEntry> findEntriesByRepoTagPattern(Pattern repoTagPattern, ImageArchiveManifest manifest) throws PatternSyntaxException
Search the manifest for an entry that has a repository and tag matching the provided pattern.- Parameters:
repoTagPattern- the repository and tag to search (e.g. busybox:latest).manifest- the manifest to be searched- Returns:
- a pair containing the matched tag and the entry found, or null if no match.
- Throws:
PatternSyntaxException
-
mapEntriesById
public static Map<String,ImageArchiveManifestEntry> mapEntriesById(Iterable<ImageArchiveManifestEntry> entries)
Build a map of entries by id from an iterable of entries.- Parameters:
entries-- Returns:
- a map of entries by id
-
-