01: /*
02: * Copyright 2004-2006 the original author or authors.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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:
17: package org.compass.core.lucene.engine.store.jdbc;
18:
19: import javax.sql.DataSource;
20:
21: import org.compass.core.CompassException;
22: import org.compass.core.config.CompassSettings;
23:
24: /**
25: * Resposible for providing a Jdbc {@link DataSource} for
26: * {@link org.compass.core.lucene.engine.store.JdbcLuceneSearchEngineStore}.
27: * <p/>
28: * The {@link DataSource} is a shared data source that should be used throughout
29: * the lifecycle of this class.
30: *
31: * @author kimchy
32: */
33: public interface DataSourceProvider {
34:
35: /**
36: * Configures the data source provider with the give settings and url,
37: * the configuration will control the {@link DataSource} that will be
38: * instansiated.
39: *
40: * @param url The jdbc url connection string
41: * @param settings The settings for the given data source provider (and the {@link DataSource}).
42: * @throws CompassException
43: */
44: void configure(String url, CompassSettings settings)
45: throws CompassException;
46:
47: /**
48: * Retuns an instance of the data source, as per the configuration set for it.
49: * <p/>
50: * Note, that the instance should be created (either in the configure method,
51: * or lazily in this method), and shared for all repeating calls. This will
52: * also allow {@link #closeDataSource()} to close the actual data source.
53: */
54: DataSource getDataSource();
55:
56: /**
57: * Closes the created data source.
58: */
59: void closeDataSource();
60: }
|