1
2
3
4
5
6 package org.openrdf.repository.flushable;
7
8 import org.openrdf.repository.Repository;
9 import org.openrdf.repository.RepositoryConnection;
10 import org.openrdf.repository.RepositoryException;
11 import org.openrdf.repository.base.RepositoryWrapper;
12
13
14
15
16
17 public class FlushableRepository extends RepositoryWrapper {
18 private boolean autoFlush = true;
19
20 public FlushableRepository() {
21 super();
22 }
23
24 public FlushableRepository(Repository delegate) {
25 super(delegate);
26 }
27
28 public FlushableRepository(Repository delegate, boolean autoFlush) {
29 super(delegate);
30 this.autoFlush = autoFlush;
31 }
32
33 @Override
34 public RepositoryConnection getConnection() throws RepositoryException {
35 RepositoryConnection c = super.getConnection();
36 FlushableConnection conn = new FlushableConnection(this, c);
37 conn.setAutoFlush(autoFlush);
38 return conn;
39 }
40
41 public void setAutoFlush(boolean autoFlush) {
42 this.autoFlush = autoFlush;
43 }
44 }