-
Notifications
You must be signed in to change notification settings - Fork 14
/
ConnectorFactory.java
45 lines (37 loc) · 1.22 KB
/
ConnectorFactory.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package cz.cvut.kbss.ontodriver.jena.connector;
import cz.cvut.kbss.ontodriver.Closeable;
import cz.cvut.kbss.ontodriver.jena.exception.JenaDriverException;
public abstract class ConnectorFactory implements Closeable {
private boolean open = true;
@Override
public synchronized void close() throws JenaDriverException {
this.open = false;
}
@Override
public boolean isOpen() {
return open;
}
void ensureOpen() {
if (!open) {
throw new IllegalStateException("Factory is closed.");
}
}
/**
* Creates a storage connector.
*
* @return storage connector
*/
public abstract StorageConnector createConnector();
/**
* Creates an inference-supporting storage connector.
* <p>
* The {@code connector} parameter is required because both connector need to be kept in sync so that
* non-inferred data are consistent across both connectors.
*
* @param connector Existing storage connector
* @return New inference-supporting storage connector
*/
public InferredStorageConnector createInferredConnector(StorageConnector connector) {
return new DummyInferredStorageConnector(connector);
}
}