Skip to contentPackage: ConnectorFactory
ConnectorFactory
Coverage
1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: * <p>
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: * <p>
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.sesame.connector;
16:
17: import cz.cvut.kbss.ontodriver.config.DriverConfiguration;
18: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
19: import cz.cvut.kbss.ontodriver.sesame.exceptions.SesameDriverException;
20: import org.eclipse.rdf4j.repository.Repository;
21:
22: public interface ConnectorFactory {
23:
24: /**
25: * Creates a storage connector.
26: * <p>
27: * It is possible that the underlying implementation will return some sort of proxy for a single storage connector.
28: *
29: * @param configuration Connector configuration
30: * @return New storage connector
31: * @throws SesameDriverException When storage access error occurs
32: */
33: Connector createStorageConnector(DriverConfiguration configuration) throws SesameDriverException;
34:
35: /**
36: * Closes this factory
37: *
38: * @throws SesameDriverException When storage access error occurs
39: */
40: void close() throws OntoDriverException;
41:
42: /**
43: * Whether this factory is open.
44: *
45: * @return Factory status
46: */
47: boolean isOpen();
48:
49: /**
50: * Sets the underlying repository.
51: * <p>
52: * Note that this functionality is supported only for in-memory stores.
53: *
54: * @param repository The new repository
55: * @param configuration Original driver configuration. May be necessary if the factory has not been initialized, yet
56: */
57: void setRepository(Repository repository, DriverConfiguration configuration) throws SesameDriverException;
58:
59: static ConnectorFactory getInstance() {
60: return new ConnectorFactoryImpl();
61: }
62: }