public static VMDefinitionsContainer parseXMLIntoContainer(InputStream inputStream) throws IOException { VMDefinitionsContainer container = new VMDefinitionsContainer(); parseXMLIntoContainer(inputStream, container); return container; }
public static VMDefinitionsContainer parseXMLIntoContainer(InputStream inputStream) throws IOException { VMDefinitionsContainer container = new VMDefinitionsContainer(); parseXMLIntoContainer(inputStream, container); return container; }
/** * Parse the given XML into a VM definitions container, returning an empty * container if an exception occurs. * * @param xml the XML to parse for VM descriptions * @return VMDefinitionsContainer */ private VMDefinitionsContainer getVMDefinitions(String xml) { if (xml.length() > 0) { try { ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF8")); //$NON-NLS-1$ return VMDefinitionsContainer.parseXMLIntoContainer(stream); } catch (IOException e) { LaunchingPlugin.log(e); } } return new VMDefinitionsContainer(); }
/** * Parse the given XML into a VM definitions container, returning an empty * container if an exception occurs. * * @param xml the XML to parse for VM descriptions * @return VMDefinitionsContainer */ private VMDefinitionsContainer getVMDefinitions(String xml) { if (xml.length() > 0) { try { ByteArrayInputStream stream = new ByteArrayInputStream(xml.getBytes("UTF8")); //$NON-NLS-1$ return VMDefinitionsContainer.parseXMLIntoContainer(stream); } catch (IOException e) { LaunchingPlugin.log(e); } } return new VMDefinitionsContainer(); }
/** * Updates VM settings and returns whether the update was successful. * * @param jres new installed JREs * @param defaultJRE new default VM * @return whether the update was successful */ public boolean updateJRESettings(IVMInstall[] jres, IVMInstall defaultJRE) { // Create a VM definition container VMDefinitionsContainer vmContainer = new VMDefinitionsContainer(); // Set the default VM Id on the container String defaultVMId = JavaRuntime.getCompositeIdFromVM(defaultJRE); vmContainer.setDefaultVMInstallCompositeID(defaultVMId); // Set the VMs on the container for (int i = 0; i < jres.length; i++) { vmContainer.addVM(jres[i]); } // Generate XML for the VM defs and save it as the new value of the VM preference saveVMDefinitions(vmContainer); return true; }
String jresXML = node.get(JavaRuntime.PREF_VM_XML, null); if (jresXML != null) { VMDefinitionsContainer vms = new VMDefinitionsContainer(); String pref = InstanceScope.INSTANCE.getNode(LaunchingPlugin.ID_PLUGIN).get(JavaRuntime.PREF_VM_XML, ""); //$NON-NLS-1$
String jresXML = node.get(JavaRuntime.PREF_VM_XML, null); if (jresXML != null) { VMDefinitionsContainer vms = new VMDefinitionsContainer(); String pref = InstanceScope.INSTANCE.getNode(LaunchingPlugin.ID_PLUGIN).get(JavaRuntime.PREF_VM_XML, ""); //$NON-NLS-1$
/** * Contstructs a new VM updater to update VM install settings. */ public JREsUpdater() { fOriginalVMs = new VMDefinitionsContainer(); IVMInstall def = JavaRuntime.getDefaultVMInstall(); if (def != null) { fOriginalVMs.setDefaultVMInstallCompositeID(JavaRuntime.getCompositeIdFromVM(def)); } IVMInstallType[] types = JavaRuntime.getVMInstallTypes(); for (int i = 0; i < types.length; i++) { IVMInstall[] vms = types[i].getVMInstalls(); for (int j = 0; j < vms.length; j++) { fOriginalVMs.addVM(vms[j]); } } }
/** * Returns the listing of currently installed VMs as a single XML file * @return an XML representation of all of the currently installed VMs * @throws CoreException if trying to compute the XML for the VM state encounters a problem */ private static String getVMsAsXML() throws CoreException { VMDefinitionsContainer container = new VMDefinitionsContainer(); container.setDefaultVMInstallCompositeID(getDefaultVMId()); container.setDefaultVMInstallConnectorTypeID(getDefaultVMConnectorId()); IVMInstallType[] vmTypes = getVMInstallTypes(); IVMInstall[] vms = null; for (int i = 0; i < vmTypes.length; ++i) { vms = vmTypes[i].getVMInstalls(); for (int j = 0; j < vms.length; j++) { container.addVM(vms[j]); } } return container.getAsXML(); }
/** * Returns the listing of currently installed VMs as a single XML file * @return an XML representation of all of the currently installed VMs * @throws CoreException if trying to compute the XML for the VM state encounters a problem */ private static String getVMsAsXML() throws CoreException { VMDefinitionsContainer container = new VMDefinitionsContainer(); container.setDefaultVMInstallCompositeID(getDefaultVMId()); container.setDefaultVMInstallConnectorTypeID(getDefaultVMConnectorId()); IVMInstallType[] vmTypes = getVMInstallTypes(); IVMInstall[] vms = null; for (int i = 0; i < vmTypes.length; ++i) { vms = vmTypes[i].getVMInstalls(); for (int j = 0; j < vms.length; j++) { container.addVM(vms[j]); } } return container.getAsXML(); }