1 /* 2 * Copyright 2012-2013 smartics, Kronseder & Reiner GmbH 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package de.smartics.properties.spi.config.ds; 17 18 /** 19 * A connector to interface with data sources. 20 */ 21 public interface DataSourceConnector 22 { 23 // ********************************* Fields ********************************* 24 25 // --- constants ------------------------------------------------------------ 26 27 // ****************************** Initializer ******************************* 28 29 // ****************************** Inner Classes ***************************** 30 31 // ********************************* Methods ******************************** 32 33 // --- get&set -------------------------------------------------------------- 34 35 // --- business ------------------------------------------------------------- 36 37 /** 38 * Checks if the implementation is designed to deal with a database identified 39 * by the given String. 40 * 41 * @param databaseId the identifier of the database. 42 * @return <code>true</code> if the proxy may interface with the given 43 * database, <code>false</code> otherwise. 44 */ 45 boolean accepts(String databaseId); 46 47 /** 48 * Creates a proxy for the given data source. 49 * 50 * @param dataSource the data source to proxy. 51 * @return a specialized proxy for the given data source. 52 */ 53 DataSourceProxy create(final JndiDataSourceProxy dataSource); 54 55 /** 56 * Creates a proxy with the given connection URL and credentials. 57 * 58 * @param connectionUrl the JDBC URL to connect to. 59 * @param userName the name of the user to access the data source. 60 * @param password the password of the user to access the data source. 61 * @return a specialized proxy for the given connection information. 62 */ 63 DataSourceProxy create(String connectionUrl, String userName, String password); 64 65 // --- object basics -------------------------------------------------------- 66 67 }