synchronized from quantum plugin
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / model / xml / ModelToXMLConverter.java
index 908b239..fc282e6 100644 (file)
@@ -4,6 +4,7 @@ import com.quantum.Messages;
 import com.quantum.model.Bookmark;
 import com.quantum.model.Column;
 import com.quantum.model.Entity;
+import com.quantum.model.JDBCDriver;
 import com.quantum.model.Schema;
 import com.quantum.sql.metadata.MetaDataXMLInterface;
 
@@ -28,6 +29,15 @@ public class ModelToXMLConverter {
     public void createRoot(Document document) {
         document.appendChild(document.createElement("SAVED_DATA"));
     }
+    public void convert(Element bookmarkRoot, JDBCDriver jdbcDriver) {
+        Document document = bookmarkRoot.getOwnerDocument();
+        Element driverNode = document.createElement("jdbcDriver");
+        driverNode.setAttribute("name", jdbcDriver.getName());
+        driverNode.setAttribute("version", jdbcDriver.getVersion());
+        driverNode.setAttribute("jarFileName", jdbcDriver.getJarFileName());
+        driverNode.setAttribute("className", jdbcDriver.getClassName());
+        bookmarkRoot.appendChild(driverNode);
+    }
 
     public void convert(Element bookmarkRoot, Bookmark b) {
         Document document = bookmarkRoot.getOwnerDocument();
@@ -39,9 +49,9 @@ public class ModelToXMLConverter {
         MetaDataXMLInterface.createElementText(bookmark,"connect", b.getConnect()); //$NON-NLS-1$
                MetaDataXMLInterface.createElementText(bookmark,"autoCommit", b.isAutoCommit() ? "true" : "false"); //$NON-NLS-1$
                MetaDataXMLInterface.createElementText(bookmark,"autoCommitPreference", b.getAutoCommitPreference()); //$NON-NLS-1$
-        MetaDataXMLInterface.createElementText(bookmark,"driver", b.getDriver()); //$NON-NLS-1$
+        MetaDataXMLInterface.createElementText(bookmark,"driver", b.getJDBCDriver().getClassName()); //$NON-NLS-1$
         MetaDataXMLInterface.createElementText(bookmark,"type", b.getType()); //$NON-NLS-1$
-               MetaDataXMLInterface.createElementText(bookmark,"driverLocation", b.getDriverFile()); //$NON-NLS-1$
+               MetaDataXMLInterface.createElementText(bookmark,"driverLocation", b.getJDBCDriver().getJarFileName()); //$NON-NLS-1$
         Element otherSchemas = (Element) bookmark.appendChild(document.createElement(Messages.getString("ExportXMLAction.OtherSchemas"))); //$NON-NLS-1$
         Schema[] schemas = b.getSchemas();
         for (int i = 0, length = (schemas == null) ? 0 : schemas.length;