Skip to content

Method: isOpen()

1: /**
2: * Copyright (C) 2022 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.sesame.connector;
16:
17:
18: import org.eclipse.rdf4j.IsolationLevel;
19: import org.eclipse.rdf4j.common.iteration.Iteration;
20: import org.eclipse.rdf4j.model.*;
21: import org.eclipse.rdf4j.query.*;
22: import org.eclipse.rdf4j.repository.Repository;
23: import org.eclipse.rdf4j.repository.RepositoryConnection;
24: import org.eclipse.rdf4j.repository.RepositoryResult;
25: import org.eclipse.rdf4j.rio.ParserConfig;
26: import org.eclipse.rdf4j.rio.RDFFormat;
27: import org.eclipse.rdf4j.rio.RDFHandler;
28:
29: import java.io.File;
30: import java.io.IOException;
31: import java.io.InputStream;
32: import java.io.Reader;
33: import java.net.URL;
34:
35: /**
36: * Wraps a standard Sesame {@link RepositoryConnection} and prevents its closing.
37: * <p>
38: * This is because the connector will handle closing when a transaction finishes or the connector is closed.
39: *
40: * @see PoolingStorageConnector
41: */
42: class TransactionalRepositoryConnection implements RepositoryConnection {
43:
44: private final RepositoryConnection wrappedConnection;
45:
46: TransactionalRepositoryConnection(RepositoryConnection wrappedConnection) {
47: this.wrappedConnection = wrappedConnection;
48: }
49:
50: @Override
51: public Repository getRepository() {
52: return wrappedConnection.getRepository();
53: }
54:
55: @Override
56: public void setParserConfig(ParserConfig config) {
57: wrappedConnection.setParserConfig(config);
58: }
59:
60: @Override
61: public ParserConfig getParserConfig() {
62: return wrappedConnection.getParserConfig();
63: }
64:
65: @Override
66: public ValueFactory getValueFactory() {
67: return wrappedConnection.getValueFactory();
68: }
69:
70: @Override
71: public boolean isOpen() {
72: return wrappedConnection.isOpen();
73: }
74:
75: @Override
76: public void close() {
77: // Do nothing !!!
78: }
79:
80: @Override
81: public Query prepareQuery(QueryLanguage ql, String query) {
82: return wrappedConnection.prepareQuery(ql, query);
83: }
84:
85: @Override
86: public Query prepareQuery(QueryLanguage ql, String query, String baseURI) {
87: return wrappedConnection.prepareQuery(ql, query, baseURI);
88: }
89:
90: @Override
91: public TupleQuery prepareTupleQuery(QueryLanguage ql, String query) {
92: return wrappedConnection.prepareTupleQuery(ql, query);
93: }
94:
95: @Override
96: public TupleQuery prepareTupleQuery(QueryLanguage ql, String query, String baseURI) {
97: return wrappedConnection.prepareTupleQuery(ql, query, baseURI);
98: }
99:
100: @Override
101: public GraphQuery prepareGraphQuery(QueryLanguage ql, String query) {
102: return wrappedConnection.prepareGraphQuery(ql, query);
103: }
104:
105: @Override
106: public GraphQuery prepareGraphQuery(QueryLanguage ql, String query, String baseURI) {
107: return wrappedConnection.prepareGraphQuery(ql, query, baseURI);
108: }
109:
110: @Override
111: public BooleanQuery prepareBooleanQuery(QueryLanguage ql, String query) {
112: return wrappedConnection.prepareBooleanQuery(ql, query);
113: }
114:
115: @Override
116: public BooleanQuery prepareBooleanQuery(QueryLanguage ql, String query, String baseURI) {
117: return wrappedConnection.prepareBooleanQuery(ql, query, baseURI);
118: }
119:
120: @Override
121: public Update prepareUpdate(QueryLanguage ql, String update) {
122: return wrappedConnection.prepareUpdate(ql, update);
123: }
124:
125: @Override
126: public Update prepareUpdate(QueryLanguage ql, String update, String baseURI) {
127: return wrappedConnection.prepareUpdate(ql, update, baseURI);
128: }
129:
130: @Override
131: public RepositoryResult<Resource> getContextIDs() {
132: return wrappedConnection.getContextIDs();
133: }
134:
135: @Override
136: public RepositoryResult<Statement> getStatements(Resource subj, IRI pred, Value obj, boolean includeInferred,
137: Resource... contexts) {
138: return wrappedConnection.getStatements(subj, pred, obj, includeInferred, contexts);
139: }
140:
141: @Override
142: public boolean hasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) {
143: return wrappedConnection.hasStatement(subj, pred, obj, includeInferred, contexts);
144: }
145:
146: @Override
147: public boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts) {
148: return wrappedConnection.hasStatement(st, includeInferred, contexts);
149: }
150:
151: @Override
152: public void exportStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, RDFHandler handler,
153: Resource... contexts) {
154: wrappedConnection.exportStatements(subj, pred, obj, includeInferred, handler, contexts);
155: }
156:
157: @Override
158: public void export(RDFHandler handler, Resource... contexts) {
159: wrappedConnection.export(handler, contexts);
160: }
161:
162: @Override
163: public long size(Resource... contexts) {
164: return wrappedConnection.size(contexts);
165: }
166:
167: @Override
168: public boolean isEmpty() {
169: return wrappedConnection.isEmpty();
170: }
171:
172: @Deprecated
173: @Override
174: public void setAutoCommit(boolean autoCommit) {
175: wrappedConnection.setAutoCommit(autoCommit);
176: }
177:
178: @Deprecated
179: @Override
180: public boolean isAutoCommit() {
181: return wrappedConnection.isAutoCommit();
182: }
183:
184: @Override
185: public boolean isActive() {
186: return wrappedConnection.isActive();
187: }
188:
189: @Override
190: public void setIsolationLevel(IsolationLevel level) {
191: wrappedConnection.setIsolationLevel(level);
192: }
193:
194: @Override
195: public IsolationLevel getIsolationLevel() {
196: return wrappedConnection.getIsolationLevel();
197: }
198:
199: @Override
200: public void begin() {
201: wrappedConnection.begin();
202: }
203:
204: @Override
205: public void begin(IsolationLevel level) {
206: wrappedConnection.begin(level);
207: }
208:
209: @Override
210: public void commit() {
211: wrappedConnection.commit();
212: }
213:
214: @Override
215: public void rollback() {
216: wrappedConnection.rollback();
217: }
218:
219: @Override
220: public void add(InputStream in, String baseURI, RDFFormat dataFormat, Resource... contexts)
221: throws IOException {
222: wrappedConnection.add(in, baseURI, dataFormat, contexts);
223: }
224:
225: @Override
226: public void add(Reader reader, String baseURI, RDFFormat dataFormat, Resource... contexts)
227: throws IOException {
228: wrappedConnection.add(reader, baseURI, dataFormat, contexts);
229: }
230:
231: @Override
232: public void add(URL url, String baseURI, RDFFormat dataFormat, Resource... contexts)
233: throws IOException {
234: wrappedConnection.add(url, baseURI, dataFormat, contexts);
235: }
236:
237: @Override
238: public void add(File file, String baseURI, RDFFormat dataFormat, Resource... contexts)
239: throws IOException {
240: wrappedConnection.add(file, baseURI, dataFormat, contexts);
241: }
242:
243: @Override
244: public void add(Resource subject, IRI predicate, Value object, Resource... contexts) {
245: wrappedConnection.add(subject, predicate, object, contexts);
246: }
247:
248: @Override
249: public void add(Statement st, Resource... contexts) {
250: wrappedConnection.add(st, contexts);
251: }
252:
253: @Override
254: public void add(Iterable<? extends Statement> statements, Resource... contexts) {
255: wrappedConnection.add(statements, contexts);
256: }
257:
258: @Override
259: public <E extends Exception> void add(Iteration<? extends Statement, E> statements, Resource... contexts) throws E {
260: wrappedConnection.add(statements, contexts);
261: }
262:
263: @Override
264: public void remove(Resource subject, IRI predicate, Value object, Resource... contexts) {
265: wrappedConnection.remove(subject, predicate, object, contexts);
266: }
267:
268: @Override
269: public void remove(Statement st, Resource... contexts) {
270: wrappedConnection.remove(st, contexts);
271: }
272:
273: @Override
274: public void remove(Iterable<? extends Statement> statements, Resource... contexts) {
275: wrappedConnection.remove(statements, contexts);
276: }
277:
278: @Override
279: public <E extends Exception> void remove(Iteration<? extends Statement, E> statements, Resource... contexts)
280: throws E {
281: wrappedConnection.remove(statements, contexts);
282: }
283:
284: @Override
285: public void clear(Resource... contexts) {
286: wrappedConnection.clear(contexts);
287: }
288:
289: @Override
290: public RepositoryResult<Namespace> getNamespaces() {
291: return wrappedConnection.getNamespaces();
292: }
293:
294: @Override
295: public String getNamespace(String prefix) {
296: return wrappedConnection.getNamespace(prefix);
297: }
298:
299: @Override
300: public void setNamespace(String prefix, String name) {
301: wrappedConnection.setNamespace(prefix, name);
302: }
303:
304: @Override
305: public void removeNamespace(String prefix) {
306: wrappedConnection.removeNamespace(prefix);
307: }
308:
309: @Override
310: public void clearNamespaces() {
311: wrappedConnection.clearNamespaces();
312: }
313: }