Skip to content

Package: DataSource

DataSource

Coverage

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