Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ jobs:
image_tag: ${{ steps.meta.outputs.image_tag }}
steps:
- uses: actions/checkout@v4

- name: Create /tmp/oci-tools directory on runner
run: mkdir /tmp/oci-tools

- name: Prepare and Build OCI tools on runner
run: |
cd emucon-tools/
. ./bootstrap.sh
./installer/install-oci-tools.sh --destination /tmp/oci-tools

- name: Extract metadata (tags, labels)
id: meta
Expand Down
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash


apt-get update && apt-get install -y curl unzip sudo \
&& rm -rf /var/lib/apt/lists/*

mkdir /tmp/oci-tools
./emucon-tools/installer/install-oci-tools.sh --destination /tmp/oci-tools
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,14 @@ public static MachineConfiguration clean(final MachineConfiguration original, bo
continue;
}

// if (r instanceof ImageArchiveBinding)
// {
//
// if(env.checkpointBindingId == null || env.checkpointBindingId.isEmpty()) {
// ImageArchiveBinding iab = (ImageArchiveBinding) r;
// if (iab.getId().equals("emucon-rootfs"))
// it.remove();
// }
// }
if (r instanceof ImageArchiveBinding)
{
if(env.checkpointBindingId == null || env.checkpointBindingId.isEmpty()) {
ImageArchiveBinding iab = (ImageArchiveBinding) r;
if (iab.getId().equals("emucon-rootfs"))
it.remove();
}
}

// resource was volatile (but not in use by a drive), remove it, too
for (AbstractDataResource origRes : original.getAbstractDataResource()) {
Expand Down Expand Up @@ -181,26 +180,6 @@ private static String _registerDataSource(String conf, String ref, String type)
}
}

// /**
// * Drives capable to accept ready made images.
// *
// * @return
// */
// public static List<String> getImageDrives(MachineConfiguration env) {
// List<String> emptyDrives = new ArrayList<>();
// Iterator<Drive> iterator = env.getDrive().iterator();
//
// while (iterator.hasNext()) {
// Drive d = iterator.next();
// if (d.getData() == null || d.getData().isEmpty()) {
// Drive.DriveType type = d.getType();
// emptyDrives.add(type.name());
// }
// }
//
// return emptyDrives;
// }

/**
* Drives require a file system helper (FS annotation is required)
*
Expand Down
169 changes: 75 additions & 94 deletions commons/src/main/java/de/bwl/bwfla/emucomp/common/FileCollection.java
Original file line number Diff line number Diff line change
@@ -1,113 +1,94 @@
package de.bwl.bwfla.emucomp.common;

import de.bwl.bwfla.emucomp.common.utils.jaxb.JaxbType;
import lombok.Getter;

import javax.xml.bind.JAXBException;
import javax.xml.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;

@Getter
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "fileCollection", namespace="http://bwfla.bwl.de/common/datatypes")
@XmlType(name = "fileCollection", namespace = "http://bwfla.bwl.de/common/datatypes")
@XmlRootElement(namespace = "http://bwfla.bwl.de/common/datatypes")
public class FileCollection extends JaxbType {
@XmlElement(name="file", namespace="http://bwfla.bwl.de/common/datatypes")
public List<FileCollectionEntry> files = new ArrayList<FileCollectionEntry>();

@XmlElement(namespace="http://bwfla.bwl.de/common/datatypes")
public String id;

@XmlElement
private String archive;

@XmlElement
private String label;

public FileCollection()
{
id = null;
}

public FileCollection(String id)
{
this.id = id;
}

@XmlElement(name = "file", namespace = "http://bwfla.bwl.de/common/datatypes")
public List<FileCollectionEntry> files = new ArrayList<FileCollectionEntry>();

@XmlElement(namespace = "http://bwfla.bwl.de/common/datatypes")
public String id;

@XmlElement
private String archive;

@XmlElement
private String label;

public FileCollection() {
id = null;
}

public FileCollection(String id) {
this.id = id;
}

public FileCollection(String id, String archive, String label) {
this.id = id;
this.archive = archive;
this.label = label;
}

public static FileCollection fromValue(String data) throws JAXBException {
return JaxbType.fromValue(data, FileCollection.class);
}

public FileCollectionEntry getDefaultEntry()
{
for(FileCollectionEntry fc : files)
if(fc.isDefault())
return fc;

return files.get(0);
}

public FileCollection copy()
{
try {
return fromValue(this.value());
}
catch(JAXBException e) {
// impossible
return null;
}
public FileCollectionEntry getDefaultEntry() {
for (FileCollectionEntry fc : files)
if (fc.isDefault())
return fc;

return files.get(0);
}

public void update()
{
for (final var file : files) {
file.setArchive(this.archive);
file.setObjectId(this.id);
}
}

public String getLabel() {
return label;
}

public void setLabel(String label) {
this.label = label;
}

public String getArchive()
{
return archive;
}

public void setArchive(String archive)
{
this.archive = archive;
}

public FileCollectionEntry find(String resourceId)
{
for (final var resource : files) {
if (!resourceId.equalsIgnoreCase(resource.getId()))
continue;

return resource;
}

return null;
}

public String resolve(String exportUrlPrefix, String resourceId)
{
final var resource = this.find(resourceId);
return (resource != null) ? resource.resolve(exportUrlPrefix) : null;
}

public boolean contains(Binding.ResourceType rt)
{
for (final var resource : files) {
if (resource.getResourceType() == rt)
return true;
}

return false;
}
public FileCollection copy() {
try {
return fromValue(this.value());
} catch (JAXBException e) {
// impossible
return null;
}
}

public void update() {
for (final var file : files) {
file.setArchive(this.archive);
file.setObjectId(this.id);
}
}

public FileCollectionEntry find(String resourceId) {
for (final var resource : files) {
if (!resourceId.equalsIgnoreCase(resource.getId()))
continue;

return resource;
}

return null;
}

public String resolve(String exportUrlPrefix, String resourceId) {
final var resource = this.find(resourceId);
return (resource != null) ? resource.resolve(exportUrlPrefix) : null;
}

public boolean contains(Binding.ResourceType rt) {
for (final var resource : files) {
if (resource.getResourceType() == rt)
return true;
}

return false;
}
}
Loading
Loading