Improved unit tests for AveragingProgressTracker class
[controller.git] / opendaylight / md-sal / sal-dom-xsql / src / main / java / org / odl / xsql / JDBCDriver.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.odl.xsql;
9
10 import java.sql.Connection;
11 import java.sql.Driver;
12 import java.sql.DriverManager;
13 import java.sql.DriverPropertyInfo;
14 import java.sql.SQLException;
15 import java.sql.SQLFeatureNotSupportedException;
16 import java.util.Properties;
17 import java.util.logging.Logger;
18
19 import org.opendaylight.controller.md.sal.dom.xsql.jdbc.JDBCConnection;
20 /**
21  * @author Sharon Aicler(saichler@gmail.com)
22  **/
23 /**
24  * To be removed in Nitrogen
25  */
26 @Deprecated
27 public class JDBCDriver implements Driver {
28
29     public static JDBCDriver drv = new JDBCDriver();
30
31     public JDBCDriver() {
32         try {
33             DriverManager.registerDriver(this);
34         } catch (SQLException e) {
35             // TODO Auto-generated catch block
36             e.printStackTrace();
37         }
38     }
39
40     @Override
41     public boolean acceptsURL(String arg0) throws SQLException {
42         return true;
43     }
44
45     @Override
46     public Connection connect(String url, Properties arg1) throws SQLException {
47         System.err.println("JDBC Connection");
48         try {
49             if (url.equals("svr")) {
50                 return new JDBCConnection(true);
51             } else {
52                 return new JDBCConnection(url).getProxy();
53             }
54         } catch (Exception err) {
55             err.printStackTrace();
56         }
57         System.err.println("Error JDBC Connection");
58         return null;
59     }
60
61     @Override
62     public int getMajorVersion() {
63         return 1;
64     }
65
66     @Override
67     public int getMinorVersion() {
68         return 0;
69     }
70
71     @Override
72     public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1)
73         throws SQLException {
74         DriverPropertyInfo i = new DriverPropertyInfo("OpenDayLight", "OpenDayLight");
75         return new DriverPropertyInfo[] {i};
76     }
77
78     @Override
79     public boolean jdbcCompliant() {
80         return false;
81     }
82
83     @Override
84     public Logger getParentLogger() throws SQLFeatureNotSupportedException {
85         // TODO Auto-generated method stub
86         return null;
87     }
88
89 }