Skip to contentPackage: DataSource
DataSource
Coverage
1: /**
2: * Copyright (C) 2020 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.ontodriver;
16:
17: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
18:
19: import java.util.Map;
20:
21: /**
22: * Represents an ontology data source.
23: * <p>
24: * This could be either a single ontology or a storage with multiple named graphs or ontology modules.
25: * <p>
26: * The implementations are required to have a public no-arg constructor. Connection settings are passed through the
27: * setter methods.
28: */
29: public interface DataSource extends Closeable {
30:
31: /**
32: * Requests a connection to the underlying data source.
33: *
34: * @return A {@code Connection} to the data source
35: * @throws OntoDriverException If an ontology access error occurs
36: * @throws IllegalStateException If called on a closed data source
37: */
38: Connection getConnection() throws OntoDriverException;
39:
40: /**
41: * Sets storage properties for this data source.
42: * <p>
43: * Note that if the data source is already connected to the underlying storage, the outcome of this method is not
44: * specified and is likely to have no effect.
45: *
46: * @param storageProperties The properties to use
47: * @throws OntoDriverException If an ontology access error occurs
48: */
49: void setStorageProperties(OntologyStorageProperties storageProperties) throws OntoDriverException;
50:
51: /**
52: * Sets additional configuration properties on the data source.
53: *
54: * @param properties Map of properties
55: * @throws OntoDriverException If an ontology access error occurs
56: */
57: void setProperties(Map<String, String> properties) throws OntoDriverException;
58: }