Quantum version 2.4.1
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.quantum.sql / src / com / quantum / adapters / InformixAdapter.java
diff --git a/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/InformixAdapter.java b/archive/net.sourceforge.phpeclipse.quantum.sql/src/com/quantum/adapters/InformixAdapter.java
new file mode 100644 (file)
index 0000000..46862e0
--- /dev/null
@@ -0,0 +1,43 @@
+package com.quantum.adapters;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author BC Holmes
+ */
+public class InformixAdapter extends GenericAdapter {
+
+       /**
+        * @param type
+        */
+       protected InformixAdapter() {
+               super(AdapterFactory.INFORMIX);
+       }
+
+       /**
+        * Get the default connection properties for Informix.  These defaults assume that 
+        * the database is located on the user's local machine.  Informix doesn't allow 
+        * for "localhost".
+        */
+       public Map getDefaultConnectionParameters() {
+               Map map = new HashMap();
+               map.put("hostname", getHostName());
+               map.put("informixserver", "ol_" + getHostName());
+               map.put("port", "1526");
+               return map;
+       }
+
+       /**
+        * @return
+        */
+       private String getHostName() {
+               try {
+                       return InetAddress.getLocalHost().getHostName();
+               } catch (UnknownHostException e) {
+                       return "localhost";
+               }
+       }
+}