Skip to content

Package: DataSource

DataSource

Coverage

1: /**
2: * Copyright (C) 2016 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. </p>
23: * <p/>
24: * This could be either a single ontology or a storage with multiple named
25: * graphs or ontology modules.
26: * <p/>
27: * The implementations are required to have a public no-arg constructor. Connection settings are passed through the setter methods.
28: *
29: * @author kidney
30: */
31: public interface DataSource extends Closeable {
32:
33: /**
34: * Requests a connection to the underlying data source. </p>
35: *
36: * @return A {@code Connection} to the data source
37: * @throws OntoDriverException If an ontology access error occurs
38: */
39: public Connection getConnection() throws OntoDriverException;
40:
41: /**
42: * Sets storage properties for this data source.
43: * <p/>
44: * Note that if the data source is already connected to the underlying storage, the outcome of this method is not 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: public 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: public void setProperties(Map<String, String> properties) throws OntoDriverException;
58: }