01: /*
02: * Copyright (C) 1999-2004 <a href="mailto:mandarax@jbdietrich.com">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package org.mandarax.jdbc;
20:
21: import java.sql.DriverPropertyInfo;
22: import java.sql.SQLException;
23: import java.util.Properties;
24: import org.mandarax.util.logging.LogCategories;
25:
26: /**
27: * A superclass for mandarax jdbc driver implementations.
28: * @author <A HREF="mailto:mandarax@jbdietrich.com">Jens Dietrich</A>
29: * @version 3.3.2 <29 December 2004>
30: * @since 3.0
31: */
32:
33: public abstract class AbstractDriverImpl implements java.sql.Driver,
34: LogCategories {
35:
36: /**
37: * Constructor.
38: */
39: public AbstractDriverImpl() {
40: super ();
41: }
42:
43: /**
44: * Get the major version of this driver.
45: * @return a version number
46: */
47: public int getMajorVersion() {
48: return 0;
49: }
50:
51: /**
52: * Get the minor version of this driver.
53: * @return a version number
54: */
55: public int getMinorVersion() {
56: return 1;
57: }
58:
59: /**
60: * Return whether this driver is jdbc compliant.
61: * It is not - supporting INSERT etc does not make sense, only certain SELECT
62: * statements are supported.
63: */
64: public boolean jdbcCompliant() {
65: return false;
66: }
67:
68: /**
69: * Get the driver property info.
70: * Not yet implemented.
71: * TODO
72: */
73: public DriverPropertyInfo[] getPropertyInfo(String url,
74: Properties info) throws SQLException {
75: return null;
76: }
77:
78: /**
79: * Indicates whether this is a server side mandarax url.
80: * @param url an url
81: * @return a boolean
82: */
83: protected boolean isServerUrl(String url) {
84: return url != null && url.indexOf(JDBCUtils.URL_PREFIX) > -1
85: && url.indexOf(JDBCUtils.URL_NET_PREFIX) == -1;
86: }
87:
88: /**
89: * Indicates whether this is a client side mandarax url.
90: * @param url an url
91: * @return a boolean
92: */
93: protected boolean isClientUrl(String url) {
94: return url != null
95: && url.indexOf(JDBCUtils.URL_NET_PREFIX) > -1;
96: }
97: }
|