001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.sql.framework.model;
042:
043: import java.sql.Connection;
044: import java.util.List;
045: import java.util.Properties;
046:
047: /**
048: * @author Girish Patil
049: */
050: public interface JDBCConnectionProvider {
051: public static int JDBC_TYPE_1 = 1;
052:
053: public static int JDBC_TYPE_2 = 2;
054:
055: public static int JDBC_TYPE_3 = 3;
056:
057: public static int JDBC_TYPE_4 = 4;
058:
059: /**
060: * Returns list of valid Driver names for this Database implementing
061: * java.sql.Driver.
062: */
063: public List getJDBCDriverClassNames() throws Exception;
064:
065: /**
066: * Returns valid Driver names for this Database implementing java.sql.Driver.
067: */
068: public String getJDBCDriverClassName() throws Exception;
069:
070: /**
071: * Returns default driver type.
072: */
073: public int getJDBCDriverType() throws Exception;
074:
075: /**
076: * Returns driver type for the driver name passed.
077: */
078: public int getJDBCDriverTypes(String driverClassName)
079: throws Exception;
080:
081: /**
082: * Returns Connection object using the properties supplied to while defining
083: * Database.
084: */
085: public Connection getJDBCConnection() throws Exception;
086:
087: /**
088: * Returns JDBC Connection using the parameter set in the Database wizard.
089: *
090: * @param cl
091: * ClassLoader to use to get connection.
092: */
093: public Connection getJDBCConnection(ClassLoader cl)
094: throws Exception;
095:
096: /**
097: * Gets the connection using the connection properties passed.
098: *
099: * @param props
100: *
101: */
102: public Connection getJDBCConnection(Properties props)
103: throws Exception;
104:
105: /**
106: * Gets the JDBC connection using the properties passed. JDBC URL used is
107: * one entered while creating Database.
108: *
109: * @param prop
110: * @param cl
111: */
112: public Connection getJDBCConnection(Properties prop, ClassLoader cl)
113: throws Exception;
114:
115: /**
116: * Gets the JDBC connection using the properties passed.
117: *
118: * @param url
119: * @param uid
120: * @param pswd
121: */
122: public Connection getJDBCConnection(String jdbcUrl, String uid,
123: String pswd) throws Exception;
124:
125: /**
126: * Gets the JDBC connection using the properties passed.
127: *
128: * @param url
129: * @param uid
130: * @param pswd
131: * @param cl
132: */
133: public Connection getJDBCConnection(String jdbcUrl, String uid,
134: String pswd, ClassLoader cl) throws Exception;
135: }
|