summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openslx/util/vm/VboxMetaData.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/openslx/util/vm/VboxMetaData.java')
-rw-r--r--src/main/java/org/openslx/util/vm/VboxMetaData.java77
1 files changed, 66 insertions, 11 deletions
diff --git a/src/main/java/org/openslx/util/vm/VboxMetaData.java b/src/main/java/org/openslx/util/vm/VboxMetaData.java
index 0446d2a..dac8e78 100644
--- a/src/main/java/org/openslx/util/vm/VboxMetaData.java
+++ b/src/main/java/org/openslx/util/vm/VboxMetaData.java
@@ -1,6 +1,5 @@
package org.openslx.util.vm;
-
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -17,13 +16,12 @@ import javax.xml.transform.stream.StreamResult;
import org.openslx.bwlp.thrift.iface.OperatingSystem;
import org.openslx.bwlp.thrift.iface.Virtualizer;
-
public class VboxMetaData extends VmMetaData
{
private static final Virtualizer virtualizer = new Virtualizer( "virtualbox", "VirtualBox" );
private final VboxConfig config;
-
+
public VboxMetaData( List<OperatingSystem> osList, File file ) throws IOException, UnsupportedVirtualizerFormatException
{
super( osList );
@@ -33,12 +31,20 @@ public class VboxMetaData extends VmMetaData
init();
}
-
- private void init() {
- this.config.init();
+ public VboxMetaData( List<OperatingSystem> osList, byte[] vmContent, int length ) throws IOException, UnsupportedVirtualizerFormatException
+ {
+ super( osList );
+ this.config = new VboxConfig( vmContent.toString(), length );
+ init();
+ }
+
+ private void init()
+ {
+ this.config.init();
+
displayName = config.getDisplayName();
-
+
setOs( "virtualbox", config.getOsName() );
for ( HardDisk hardDisk : config.getHdds() ) {
@@ -51,12 +57,12 @@ public class VboxMetaData extends VmMetaData
e.printStackTrace();
}
}
-
+
// --TODO will be needed later again
private void WriteToFile() throws TransformerFactoryConfigurationError, TransformerException
{
Transformer transformer = TransformerFactory.newInstance().newTransformer();
- StreamResult output = new StreamResult(new File( "output.xml" ));
+ StreamResult output = new StreamResult( new File( "output.xml" ) );
Source input = new DOMSource( config.getConfigDoc() );
transformer.transform( input, output );
}
@@ -78,13 +84,62 @@ public class VboxMetaData extends VmMetaData
{
// TODO Auto-generated method stub
}
+
@Override
public byte[] getFilteredDefinitionArray()
{
// TODO Auto-generated method stub
return config.toString().getBytes( StandardCharsets.UTF_8 );
}
-
-
+
+ @Override
+ public boolean addHddTemplate( String diskImagePath, String hddMode, String redoDir )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean addDefaultNat()
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void setOs( String vendorOsId )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean addDisplayName( String name )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public boolean addRam( int mem )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public void addFloppy( int index, String image, boolean readOnly )
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public boolean addCdrom( String image )
+ {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
// TODO: the part after getting the byte[] from the Server and doing stuff with it...SoundCard types etc...
}