Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: google/jdbc/driver/GoogleDriver.java


1   /**
2    * Z39.50/XML Interoperability Framework (ZiFX).
3    * Copyright (C) 2000, 2003 ZiFX Project.
4    * Francisco Queiros Pinto and Nick Ryan.
5    * ZiFX is a SourceForge Project: http://zifx.sourceforge.net/
6    *
7    * This package is free software; you can redistribute it and/or
8    * modify it under the terms of the GNU General Public License
9    * as published by the Free Software Foundation; either version 2
10   * of the License, or (at your option) any later version.
11   *
12   * This package is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15   * GNU General Public License for more details.
16   *
17   * You should have received a copy of the GNU General Public
18   * License along with this package; if not, write to the Free
19   * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20   * MA 02111-1307 USA.
21   */
22  package google.jdbc.driver;
23  
24  import java.sql.*;
25  import java.util.*;
26  
27  import zava.utilities.*;
28  
29  /**
30   * GoogleDriver
31   */
32  public class GoogleDriver implements Driver {
33  
34     static {
35        try {
36           DriverManager.registerDriver(new GoogleDriver());        
37        } 
38        catch(Exception e) {
39           e.printStackTrace();
40        }
41     }
42      
43     /**
44      * 
45      */
46     public boolean acceptsURL(String url) throws SQLException {
47        return true;
48     }  
49  
50     /**
51      * 
52      */
53     public Connection connect(String url, Properties info) throws SQLException {
54  
55        if(url.startsWith("jdbc:")) {
56           if(url.length() < 6)
57              return(null);
58           url = url.substring(5);
59        }
60        if( !url.startsWith("http://") ) {
61           return(null);
62        } 
63        Logs.writeLog("Google Driver Connected...", Logs.logDEBUG);
64        return(new GoogleConnection(url));
65     }  
66  
67     /**
68      * 
69      */
70     public int getMajorVersion() {
71  
72        return 1;
73     }  
74  
75     /**
76      * 
77      */
78     public int getMinorVersion() {
79  
80        return 0;
81     }  
82  
83     /**
84      * 
85      */
86     public boolean jdbcCompliant() {
87  
88        return false;
89     }   
90  
91  
92  // Not Implemented
93  
94     /**
95      * 
96      */
97     public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) 
98                                                             throws SQLException {
99  
100       throw new MethodNotSupportedException();
101    }  
102 
103 }
104