Skip to content

Package: AbstractSession

AbstractSession

nameinstructionbranchcomplexitylinemethod
AbstractSession(Configuration)
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%
getConfiguration()
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%

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.jopa.sessions;
19:
20: import cz.cvut.kbss.jopa.sessions.cache.CacheManager;
21: import cz.cvut.kbss.jopa.model.query.criteria.CriteriaBuilder;
22: import cz.cvut.kbss.jopa.utils.Configuration;
23:
24: import java.util.Objects;
25:
26: /**
27: * Defines common session-related methods.
28: */
29: abstract class AbstractSession implements MetamodelProvider, ConfigurationHolder {
30:
31: protected Configuration configuration;
32:
33: protected AbstractSession(Configuration configuration) {
34: this.configuration = Objects.requireNonNull(configuration);
35: }
36:
37: @Override
38: public Configuration getConfiguration() {
39: return configuration;
40: }
41:
42: /**
43: * Get the current live object cache.
44: * <p>
45: * This manager represents the second level cache.
46: *
47: * @return Second level cache manager
48: */
49: public abstract CacheManager getLiveObjectCache();
50:
51: /**
52: * Acquires connection to the underlying ontology storage.
53: *
54: * @return Connection
55: */
56: protected abstract ConnectionWrapper acquireConnection();
57:
58: /**
59: * Gets a {@link CriteriaBuilder} instance for building Criteria API queries.
60: *
61: * @return Criteria query builder
62: */
63: public abstract CriteriaBuilder getCriteriaBuilder();
64: }