Introduction of XSQL
[controller.git] / opendaylight / md-sal / sal-dom-xsql / src / main / java / org / opendaylight / controller / md / sal / dom / xsql / jdbc / JDBCDriver.java
1 package org.opendaylight.controller.md.sal.dom.xsql.jdbc;
2
3 import java.sql.Connection;
4 import java.sql.Driver;
5 import java.sql.DriverManager;
6 import java.sql.DriverPropertyInfo;
7 import java.sql.SQLException;
8 import java.sql.SQLFeatureNotSupportedException;
9 import java.util.Properties;
10 import java.util.logging.Logger;
11
12 public class JDBCDriver implements Driver {
13
14     public static JDBCDriver drv = new JDBCDriver();
15
16     public JDBCDriver() {
17         try {
18             DriverManager.registerDriver(this);
19         } catch (SQLException e) {
20             // TODO Auto-generated catch block
21             e.printStackTrace();
22         }
23     }
24
25     @Override
26     public boolean acceptsURL(String arg0) throws SQLException {
27         return true;
28     }
29
30     @Override
31     public Connection connect(String url, Properties arg1) throws SQLException {
32         System.err.println("JDBC Connection");
33         try {
34             if (url.equals("svr")) {
35                 return new JDBCConnection(true);
36             } else {
37                 return new JDBCConnection(url);
38             }
39         } catch (Exception err) {
40             err.printStackTrace();
41         }
42         return null;
43     }
44
45     @Override
46     public int getMajorVersion() {
47         return 1;
48     }
49
50     @Override
51     public int getMinorVersion() {
52         return 0;
53     }
54
55     @Override
56     public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1)
57         throws SQLException {
58         DriverPropertyInfo i = new DriverPropertyInfo("NQL", "NQL");
59         return new DriverPropertyInfo[] {i};
60     }
61
62     @Override
63     public boolean jdbcCompliant() {
64         return false;
65     }
66
67     @Override
68     public Logger getParentLogger() throws SQLFeatureNotSupportedException {
69         // TODO Auto-generated method stub
70         return null;
71     }
72
73 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.