I am using virtualbox api 4.3 in java and i am trying to clone a machine using this piece of code. But, i am having problem in making a list of cloneoptions enumeration. I am unable to add cloneoptions.KeepAllMACs in to the list.
Code: Select all
IMachine m = vbox.getMachines().get(0);
String ostype = m.getOSTypeId();
ISession iSession = mgr.getSessionObject();
vbox.getMachines().get(0).lockMachine(iSession, LockType.Shared);
IMachine mac = vbox.createMachine(vbox.composeMachineFilename("Wal",null,null,"/home/waleed/Documents"),"Waleed", null, ostype,"forceOverwrite=1");
mac.saveSettings();
List<CloneOptions> cloneOptionsList = new ArrayList<CloneOptions>();
cloneOptionsList.add(CloneOptions.KeepAllMACs); // i am having problems here
IProgress progr = m.cloneTo(mac, CloneMode.MachineState,cloneOptionsList);