diff options
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VmMetaData.java')
-rw-r--r-- | src/main/java/org/openslx/util/vm/VmMetaData.java | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/src/main/java/org/openslx/util/vm/VmMetaData.java b/src/main/java/org/openslx/util/vm/VmMetaData.java index 29e2db9..714a7e4 100644 --- a/src/main/java/org/openslx/util/vm/VmMetaData.java +++ b/src/main/java/org/openslx/util/vm/VmMetaData.java @@ -20,9 +20,9 @@ import org.openslx.bwlp.thrift.iface.Virtualizer; */ public abstract class VmMetaData<T, U, V, W, X> { - private static final Logger LOGGER = Logger.getLogger( VmMetaData.class ); + private static final Logger LOGGER = Logger.getLogger(VmMetaData.class); - /* + /* * Helper types */ protected Map<SoundCardType, T> soundCards = new HashMap<>(); @@ -146,19 +146,19 @@ public abstract class VmMetaData<T, U, V, W, X> } /* * Members - */ + */ - protected final List<HardDisk> hdds = new ArrayList<>(); + protected final List<HardDisk> hdds = new ArrayList<>(); - private final List<OperatingSystem> osList; + private final List<OperatingSystem> osList; - private OperatingSystem os = null; + private OperatingSystem os = null; - protected String displayName = null; + protected String displayName = null; - protected boolean isMachineSnapshot; + protected boolean isMachineSnapshot; - /* + /* * Getters for virtual hardware */ public List<SoundCardType> getSupportedSoundCards() @@ -222,27 +222,25 @@ public abstract class VmMetaData<T, U, V, W, X> /* * Getter for isMachineSnapshot - */ - public boolean isMachineSnapshot() - { - return isMachineSnapshot; - } - - /** - * This method should return a minimal representation of the input meta data. - * The representation is platform dependent, and should be stripped of all - * non-essential configuration, such as CD/DVD/FLoppy drives, serial or parallel - * ports, shared folders, or anything else that could be considered sensible - * information (absolute paths containing the local user's name). - */ - public abstract byte[] getFilteredDefinitionArray(); - - public final ByteBuffer getFilteredDefinition() - { - return ByteBuffer.wrap( getFilteredDefinitionArray() ); - } - - /* + */ + public boolean isMachineSnapshot() { + return isMachineSnapshot; + } + + /** + * This method should return a minimal representation of the input meta + * data. The representation is platform dependent, and should be stripped of + * all non-essential configuration, such as CD/DVD/FLoppy drives, serial or + * parallel ports, shared folders, or anything else that could be considered + * sensible information (absolute paths containing the local user's name). + */ + public abstract byte[] getFilteredDefinitionArray(); + + public final ByteBuffer getFilteredDefinition() { + return ByteBuffer.wrap(getFilteredDefinitionArray()); + } + + /* * Methods */ @@ -338,6 +336,11 @@ public abstract class VmMetaData<T, U, V, W, X> } catch ( UnsupportedVirtualizerFormatException e ) { exceptions.put( "Not a VirtualBox file", e ); } + try { + return new QemuMetaData( osList, vmContent, length ); + } catch ( UnsupportedVirtualizerFormatException e ) { + exceptions.put( "Not a QEMU file", e ); + } // TODO QEmu -- hack above expects qcow2 file, so we can't do anything here yet LOGGER.error( "Could not detect any known virtualizer format" ); for ( Entry<String, Exception> e : exceptions.entrySet() ) { |