Skip to content

Package: AbstractConnector

AbstractConnector

nameinstructionbranchcomplexitylinemethod
AbstractConnector(OntologyStorageProperties, Configuration)
M: 8 C: 20
71%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 0 C: 8
100%
M: 0 C: 1
100%
close()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
ensureOpen()
M: 0 C: 9
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
isOpen()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

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.owlapi.connector;
16:
17: import cz.cvut.kbss.ontodriver.Closeable;
18: import cz.cvut.kbss.ontodriver.OntologyStorageProperties;
19: import cz.cvut.kbss.ontodriver.config.Configuration;
20: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
21: import cz.cvut.kbss.ontodriver.owlapi.exception.OwlapiDriverException;
22:
23: /**
24: * Common superclass for the storage connectors.
25: * <p>
26: * Declares the basic interface and stores storage info.
27: *
28: * @author ledvima1
29: */
30: abstract class AbstractConnector implements Closeable, Connector {
31:
32: protected OntologyStorageProperties storageProperties;
33: Configuration configuration;
34:
35: private volatile boolean open;
36:
37: public AbstractConnector(OntologyStorageProperties storageProperties, Configuration configuration) throws
38: OwlapiDriverException {
39:• assert storageProperties != null;
40:• assert configuration != null;
41:
42: this.storageProperties = storageProperties;
43: this.configuration = configuration;
44: initializeConnector();
45: this.open = true;
46: }
47:
48: @Override
49: public boolean isOpen() {
50: return open;
51: }
52:
53: @Override
54: public void close() throws OntoDriverException {
55: this.open = false;
56: }
57:
58: protected void ensureOpen() {
59:• if (!open) {
60: throw new IllegalStateException("The connector is closed.");
61: }
62: }
63:
64: /**
65: * Initializes the connector.
66: */
67: protected abstract void initializeConnector() throws OwlapiDriverException;
68: }