com.ibm.adt.ovf.model.utility
Class ImportVMwareAction

java.lang.Object
  extended by com.ibm.adt.ovf.model.utility.ImportVMwareAction

public class ImportVMwareAction
extends java.lang.Object


Field Summary
protected static CommonFactory cf
          Instance of CommonFactory
protected  java.lang.String filename
          VMX file we are importing
protected static RasdFactory rf
          Instance of RasdFactory
 
Constructor Summary
ImportVMwareAction(java.lang.String filename)
           
 
Method Summary
protected  EObject createAnnotationFeature(EnvelopeType envelope, java.lang.String key, java.lang.String value)
          Creates the OVF entries specific to annotation remarks, and add to the envelope
protected  EObject createDisplayNameFeature(EnvelopeType envelope, java.lang.String key, java.lang.String value)
          Creates the OVF entries specific to display Name requirements, and add to the envelope
protected  DocumentRoot createEnvelopeFromVMX(java.util.Map<java.lang.String,com.ibm.adt.ovf.model.utility.VmxValues> prefixNameMap)
          Create the OVF Envelope model instance.
protected  EObject createEthernetFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to ethernet requirements, and add to the envelope
protected  EObject createFloppyFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to Floppy requirements, and add to the envelope
protected  EObject createIDEFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to IDE requirements, and add to the envelope
protected  EObject createMemoryFeature(EnvelopeType envelope, java.lang.String key, java.lang.String value)
          Creates the OVF entries specific to memory requirements, and add to the envelope
protected  EObject createParallelFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to Parallel port requirements, and add to the envelope
protected  EObject createProcessorFeature(EnvelopeType envelope, java.lang.String key, java.lang.String value)
          Creates the OVF entries specific to processor requirements, and add to the envelope
protected  EObject createSCSIFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to SCSI requirements, and add to the envelope
protected  EObject createSerialFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to Serial port requirements, and add to the envelope
protected  EObject createUSBFeature(EnvelopeType envelope, java.lang.String key, java.util.Map<java.lang.String,java.lang.String> values)
          Creates the OVF entries specific to USB requirements, and add to the envelope
protected  AnnotationSectionType extractAnnotationSection(EnvelopeType envelope)
          Locate or create the AnnotationSection.
protected  VirtualDiskDescType extractDisk(EnvelopeType envelope, java.lang.String diskId, java.lang.String fileRef)
          Locate or create the Disk
protected  DiskSectionType extractDiskSection(EnvelopeType envelope)
          Locate or create the DiskSection
protected  FileType extractFile(EnvelopeType envelope, java.lang.String fileId, java.lang.String fileRef)
          Locate or create the File
protected  NetworkType extractNetwork(EnvelopeType envelope, java.lang.String name)
          Locate or create the Network
protected  NetworkSectionType extractNetworkSection(EnvelopeType envelope)
          Locate or create the NetworkSection
protected  ReferencesType extractReferences(EnvelopeType envelope)
          Locate or create the References
protected  VirtualHardwareSectionType extractVirtualHardwareSection(EnvelopeType envelope)
          Locate or create the VirtualHardwareSection.
protected  VirtualSystemType extractVirtualSystem(EnvelopeType envelope)
          Locate or create the VirtualSystem Assumes a single virtual machine appliance
 java.util.List<java.io.File> findVmdkFiles(java.io.File searchPath)
          Find the list of VMDK files for a specified directory
 DocumentRoot parseVmxFile()
           
protected  DocumentRoot parseVmxFile(java.io.InputStream inputStream)
           
protected  void updateVMDKDisk(java.io.File vmdk, FileType file)
          Updates a element with information from the VMDK file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filename

protected java.lang.String filename
VMX file we are importing


cf

protected static final CommonFactory cf
Instance of CommonFactory


rf

protected static final RasdFactory rf
Instance of RasdFactory

Constructor Detail

ImportVMwareAction

public ImportVMwareAction(java.lang.String filename)
Method Detail

parseVmxFile

public DocumentRoot parseVmxFile()
                          throws java.io.IOException,
                                 java.lang.RuntimeException,
                                 java.net.URISyntaxException
Throws:
java.io.IOException
java.lang.RuntimeException
java.net.URISyntaxException

parseVmxFile

protected DocumentRoot parseVmxFile(java.io.InputStream inputStream)
                             throws java.io.IOException,
                                    java.lang.RuntimeException,
                                    java.net.URISyntaxException
Throws:
java.io.IOException
java.lang.RuntimeException
java.net.URISyntaxException

createEnvelopeFromVMX

protected DocumentRoot createEnvelopeFromVMX(java.util.Map<java.lang.String,com.ibm.adt.ovf.model.utility.VmxValues> prefixNameMap)
                                      throws java.net.URISyntaxException
Create the OVF Envelope model instance.

Parameters:
prefixNameMap - a map of VMX attributes to their serialized values.
Returns:
Document Root element
Throws:
java.net.URISyntaxException

createMemoryFeature

protected EObject createMemoryFeature(EnvelopeType envelope,
                                      java.lang.String key,
                                      java.lang.String value)
Creates the OVF entries specific to memory requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. memsize)
value - the attribute value associated with the key.
Returns:
Eobject or null

createIDEFeature

protected EObject createIDEFeature(EnvelopeType envelope,
                                   java.lang.String key,
                                   java.util.Map<java.lang.String,java.lang.String> values)
                            throws java.net.URISyntaxException
Creates the OVF entries specific to IDE requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. ide1:0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null
Throws:
java.net.URISyntaxException

createFloppyFeature

protected EObject createFloppyFeature(EnvelopeType envelope,
                                      java.lang.String key,
                                      java.util.Map<java.lang.String,java.lang.String> values)
                               throws java.net.URISyntaxException
Creates the OVF entries specific to Floppy requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. ide1:0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null
Throws:
java.net.URISyntaxException

createEthernetFeature

protected EObject createEthernetFeature(EnvelopeType envelope,
                                        java.lang.String key,
                                        java.util.Map<java.lang.String,java.lang.String> values)
Creates the OVF entries specific to ethernet requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. ethernet0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null

createSCSIFeature

protected EObject createSCSIFeature(EnvelopeType envelope,
                                    java.lang.String key,
                                    java.util.Map<java.lang.String,java.lang.String> values)
                             throws java.net.URISyntaxException
Creates the OVF entries specific to SCSI requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. ide1:0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null
Throws:
java.net.URISyntaxException

createParallelFeature

protected EObject createParallelFeature(EnvelopeType envelope,
                                        java.lang.String key,
                                        java.util.Map<java.lang.String,java.lang.String> values)
                                 throws java.net.URISyntaxException
Creates the OVF entries specific to Parallel port requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. parallel0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null
Throws:
java.net.URISyntaxException

createSerialFeature

protected EObject createSerialFeature(EnvelopeType envelope,
                                      java.lang.String key,
                                      java.util.Map<java.lang.String,java.lang.String> values)
                               throws java.net.URISyntaxException
Creates the OVF entries specific to Serial port requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. serial0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null
Throws:
java.net.URISyntaxException

createUSBFeature

protected EObject createUSBFeature(EnvelopeType envelope,
                                   java.lang.String key,
                                   java.util.Map<java.lang.String,java.lang.String> values)
Creates the OVF entries specific to USB requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. ide1:0)
values - the attribute value entries associated with the key.
Returns:
Eobject or null

createDisplayNameFeature

protected EObject createDisplayNameFeature(EnvelopeType envelope,
                                           java.lang.String key,
                                           java.lang.String value)
Creates the OVF entries specific to display Name requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. displayname)
value - the attribute value entries associated with the key.
Returns:
Eobject or null

createProcessorFeature

protected EObject createProcessorFeature(EnvelopeType envelope,
                                         java.lang.String key,
                                         java.lang.String value)
Creates the OVF entries specific to processor requirements, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. ide1:0)
value - the attribute value entries associated with the key.
Returns:
Eobject or null

createAnnotationFeature

protected EObject createAnnotationFeature(EnvelopeType envelope,
                                          java.lang.String key,
                                          java.lang.String value)
Creates the OVF entries specific to annotation remarks, and add to the envelope

Parameters:
envelope - the envelope element to add the features to.
key - the configuration key (e.g. annotation)
value - the attribute value associated with the key.
Returns:
Eobject or null

extractVirtualSystem

protected VirtualSystemType extractVirtualSystem(EnvelopeType envelope)
Locate or create the VirtualSystem Assumes a single virtual machine appliance

Parameters:
envelope -
Returns:
VirtualSystemType

extractVirtualHardwareSection

protected VirtualHardwareSectionType extractVirtualHardwareSection(EnvelopeType envelope)
Locate or create the VirtualHardwareSection. Assumes a single virtual machine appliance

Parameters:
envelope -
Returns:
VirtualHardwareSectionType

extractReferences

protected ReferencesType extractReferences(EnvelopeType envelope)
Locate or create the References

Parameters:
envelope -
Returns:
ReferencesType

extractNetworkSection

protected NetworkSectionType extractNetworkSection(EnvelopeType envelope)
Locate or create the NetworkSection

Parameters:
envelope -
Returns:
NetworkSectionType

extractNetwork

protected NetworkType extractNetwork(EnvelopeType envelope,
                                     java.lang.String name)
Locate or create the Network

Parameters:
envelope -
name - - the network name
Returns:
NetworkType

extractDiskSection

protected DiskSectionType extractDiskSection(EnvelopeType envelope)
Locate or create the DiskSection

Parameters:
envelope -
Returns:
DiskSectionType

extractDisk

protected VirtualDiskDescType extractDisk(EnvelopeType envelope,
                                          java.lang.String diskId,
                                          java.lang.String fileRef)
                                   throws java.net.URISyntaxException
Locate or create the Disk

Parameters:
envelope -
Returns:
VirtualDiskDescType
Throws:
java.net.URISyntaxException

extractFile

protected FileType extractFile(EnvelopeType envelope,
                               java.lang.String fileId,
                               java.lang.String fileRef)
                        throws java.net.URISyntaxException
Locate or create the File

Parameters:
envelope -
Returns:
FileType
Throws:
java.net.URISyntaxException

extractAnnotationSection

protected AnnotationSectionType extractAnnotationSection(EnvelopeType envelope)
Locate or create the AnnotationSection. Assumes a single virtual machine appliance

Parameters:
envelope -
Returns:
AnnotationSectionType

findVmdkFiles

public java.util.List<java.io.File> findVmdkFiles(java.io.File searchPath)
Find the list of VMDK files for a specified directory

Parameters:
searchPath - the path to search for VMDK files
Returns:
List or null

updateVMDKDisk

protected void updateVMDKDisk(java.io.File vmdk,
                              FileType file)
Updates a element with information from the VMDK file

Parameters:
vmdk - Actual file reference to the vmdk file
file - OVF reference to the vmdk file


© Copyright 2008 IBM Corp. 2008 All Rights Reserved