001/* 002 * HA-JDBC: High-Availability JDBC 003 * Copyright (C) 2012 Paul Ferraro 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Lesser General Public License as published by 007 * the Free Software Foundation, either version 3 of the License, or 008 * (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Lesser General Public License for more details. 014 * 015 * You should have received a copy of the GNU Lesser General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018package net.sf.hajdbc.pool.sql; 019 020import java.sql.Connection; 021import java.sql.DriverManager; 022import java.sql.DriverPropertyInfo; 023import java.sql.SQLException; 024import java.util.Properties; 025import java.util.regex.Pattern; 026 027import net.sf.hajdbc.AbstractDriver; 028import net.sf.hajdbc.Messages; 029import net.sf.hajdbc.logging.Level; 030import net.sf.hajdbc.logging.Logger; 031import net.sf.hajdbc.logging.LoggerFactory; 032 033/** 034 * @author Paul Ferraro 035 */ 036public class PoolingDriver extends AbstractDriver 037{ 038 private static final Pattern URL_PATTERN = Pattern.compile("jdbc:ha-jdbc:pool:(.+)"); //$NON-NLS-1$ 039 040 private static final Logger logger = LoggerFactory.getLogger(PoolingDriver.class); 041 042 static 043 { 044 try 045 { 046 DriverManager.registerDriver(new PoolingDriver()); 047 } 048 catch (SQLException e) 049 { 050 logger.log(Level.ERROR, e, Messages.DRIVER_REGISTER_FAILED.getMessage(), PoolingDriver.class.getName()); 051 } 052 } 053 054 /** 055 * {@inheritDoc} 056 * @see java.sql.Driver#connect(java.lang.String, java.util.Properties) 057 */ 058 @Override 059 public Connection connect(String arg0, Properties arg1) 060 { 061 // TODO Auto-generated method stub 062 return null; 063 } 064 065 /** 066 * {@inheritDoc} 067 * @see java.sql.Driver#getPropertyInfo(java.lang.String, java.util.Properties) 068 */ 069 @Override 070 public DriverPropertyInfo[] getPropertyInfo(String arg0, Properties arg1) 071 { 072 // TODO Auto-generated method stub 073 return null; 074 } 075 076 /** 077 * {@inheritDoc} 078 * @see net.sf.hajdbc.AbstractDriver#getUrlPattern() 079 */ 080 @Override 081 protected Pattern getUrlPattern() 082 { 083 return URL_PATTERN; 084 } 085 086 @Override 087 public java.util.logging.Logger getParentLogger() 088 { 089 // TODO Auto-generated method stub 090 return null; 091 } 092}