summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java
diff options
context:
space:
mode:
authorralph isenmann2020-08-11 16:03:46 +0200
committerralph isenmann2020-08-11 16:03:46 +0200
commita0d3ea8e2c175afa651806d3fe22116d013f8e8a (patch)
tree96ebdff389c9d463f2c86e40e00b6fe88d8c7fae /src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java
parentworkaround for Java8 runtime error (diff)
downloadmaster-sync-shared-a0d3ea8e2c175afa651806d3fe22116d013f8e8a.tar.gz
master-sync-shared-a0d3ea8e2c175afa651806d3fe22116d013f8e8a.tar.xz
master-sync-shared-a0d3ea8e2c175afa651806d3fe22116d013f8e8a.zip
add dockerfile as byte array to DockerMetaDataDummy.java
This allows to store the content of a dockerfile in the imageversion table
Diffstat (limited to 'src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java')
-rw-r--r--src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java b/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java
index 0144d65..473f1c0 100644
--- a/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java
+++ b/src/main/java/org/openslx/util/vm/DockerMetaDataDummy.java
@@ -4,22 +4,38 @@ import org.apache.log4j.Logger;
import org.openslx.bwlp.thrift.iface.Virtualizer;
import org.openslx.thrifthelper.TConst;
-import java.io.File;
+import java.io.*;
import java.util.List;
public class DockerMetaDataDummy extends VmMetaData {
// TODO Define DOCKER CONSTANT
- private static final Logger LOGGER = Logger.getLogger( DockerMetaDataDummy.class );
+ private static final Logger LOGGER = Logger.getLogger( DockerMetaDataDummy.class);
private final Virtualizer virtualizer = new Virtualizer( TConst.VIRT_DOCKER, "Docker" );
- public DockerMetaDataDummy(List osList) {
+ private byte[] dockerfile;
+
+ public DockerMetaDataDummy(List osList, File file) {
super(osList);
+
+ try {
+ BufferedInputStream bis = new BufferedInputStream(new FileInputStream(file));
+ dockerfile = new byte[(int) file.length()];
+ bis.read(dockerfile);
+ } catch (IOException e) {
+ LOGGER.error("Couldn't read dockerfile",e);
+ }
+ }
+
+ public DockerMetaDataDummy(List osList, byte[] vmContent, int length) {
+ super(osList);
+
+ dockerfile = vmContent;
}
@Override public byte[] getFilteredDefinitionArray() {
- return new byte[0];
+ return dockerfile;
}
@Override public void applySettingsForLocalEdit() {