1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package com.ontotext.ordi.tripleset;
19
20 import com.ontotext.ordi.Connection;
21 import com.ontotext.ordi.DataSource;
22 import com.ontotext.ordi.IsolationLevel;
23 import com.ontotext.ordi.exception.ORDIException;
24
25 public abstract class ConnectionImpl extends WarningAwareImpl implements
26 Connection {
27
28 protected final DataSource source;
29
30 protected IsolationLevel isolationLevel;
31
32 protected boolean isAutoCommit;
33
34 public ConnectionImpl(DataSource source) {
35 if (source == null) {
36 throw new IllegalArgumentException();
37 }
38 this.source = source;
39 }
40
41 public ConnectionImpl(DataSource source, IsolationLevel isolationLevel) {
42 if (source == null) {
43 throw new IllegalArgumentException();
44 }
45 this.source = source;
46 this.isolationLevel = isolationLevel;
47 }
48
49 public DataSource getDataSource() {
50 return source;
51 }
52
53 public IsolationLevel getTransactionIsolationLevel() {
54 return isolationLevel;
55 }
56
57 public boolean isAutoCommit() {
58 return isAutoCommit;
59 }
60
61 public void setAutoCommit(boolean mode) throws ORDIException {
62 isAutoCommit = mode;
63 }
64
65 public void setTransactionIsolationLevel(IsolationLevel isolationLevel)
66 throws ORDIException {
67 this.isolationLevel = isolationLevel;
68 }
69
70 public boolean isWrapperFor(Class<?> iface) throws ORDIException {
71 return false;
72 }
73
74 public <T> T unwrap(Class<T> iface) throws ORDIException {
75 throw new ORDIException(
76 "Invalid requested type to unwrap! Please use isWrappedFor method first!");
77 }
78 }