Skip to content

Package: AbstractConnector

AbstractConnector

nameinstructionbranchcomplexitylinemethod
AbstractConnector()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
begin()
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%
close()
M: 0 C: 8
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
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%
verifyTransactionActive()
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%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2023 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.rdf4j.connector;
19:
20: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
21: import cz.cvut.kbss.ontodriver.rdf4j.exception.Rdf4jDriverException;
22: import cz.cvut.kbss.ontodriver.util.Transaction;
23:
24: abstract class AbstractConnector implements Connector {
25:
26: protected final Transaction transaction;
27: protected boolean open;
28:
29: protected AbstractConnector() {
30: this.transaction = new Transaction();
31: }
32:
33: @Override
34: public boolean isOpen() {
35: return open;
36: }
37:
38: @Override
39: public void close() throws OntoDriverException {
40:• if (!open) {
41: return;
42: }
43: this.open = false;
44: }
45:
46: @Override
47: public void begin() throws Rdf4jDriverException {
48: transaction.begin();
49: }
50:
51: protected void verifyTransactionActive() {
52:• if (!transaction.isActive()) {
53: throw new IllegalStateException();
54: }
55: }
56: }