Skip to content

Package: AbstractConnector

AbstractConnector

nameinstructionbranchcomplexitylinemethod
AbstractConnector(DriverConfiguration)
M: 4 C: 14
78%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 6
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%
reloadData()
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
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: * 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.owlapi.connector;
19:
20: import cz.cvut.kbss.ontodriver.Closeable;
21: import cz.cvut.kbss.ontodriver.config.DriverConfiguration;
22: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
23: import cz.cvut.kbss.ontodriver.owlapi.exception.OwlapiDriverException;
24:
25: /**
26: * Common superclass for the storage connectors.
27: * <p>
28: * Declares the basic interface and stores storage info.
29: */
30: abstract class AbstractConnector implements Closeable, Connector {
31:
32: final DriverConfiguration configuration;
33:
34: private volatile boolean open;
35:
36: AbstractConnector(DriverConfiguration configuration) throws OwlapiDriverException {
37:• assert configuration != null;
38:
39: this.configuration = configuration;
40: initializeConnector();
41: this.open = true;
42: }
43:
44: @Override
45: public boolean isOpen() {
46: return open;
47: }
48:
49: @Override
50: public void close() throws OntoDriverException {
51: this.open = false;
52: }
53:
54: protected void ensureOpen() {
55:• if (!open) {
56: throw new IllegalStateException("The connector is closed.");
57: }
58: }
59:
60: /**
61: * Reloads ontology from the underlying storage.
62: */
63: void reloadData() throws OwlapiDriverException {
64: // Do nothing by default
65: }
66:
67: /**
68: * Initializes the connector.
69: *
70: * @throws OwlapiDriverException When storage access error occurs
71: */
72: protected abstract void initializeConnector() throws OwlapiDriverException;
73: }