01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 2008.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.sail.rdbms.managers;
07:
08: import java.sql.SQLException;
09:
10: import org.openrdf.sail.rdbms.managers.base.ValueManagerBase;
11: import org.openrdf.sail.rdbms.model.RdbmsBNode;
12: import org.openrdf.sail.rdbms.schema.BNodeTable;
13:
14: /**
15: * Manages BNodes. Including creating, inserting, and looking up their
16: * IDs.
17: *
18: * @author James Leigh
19: *
20: */
21: public class BNodeManager extends ValueManagerBase<RdbmsBNode> {
22: public static BNodeManager instance;
23: private BNodeTable table;
24:
25: public BNodeManager() {
26: instance = this ;
27: }
28:
29: public void setTable(BNodeTable table) {
30: this .table = table;
31: }
32:
33: @Override
34: public void close() throws SQLException {
35: super .close();
36: table.close();
37: }
38:
39: @Override
40: protected boolean expungeRemovedStatements(int count,
41: String condition) throws SQLException {
42: return table.expungeRemovedStatements(count, condition);
43: }
44:
45: @Override
46: protected void optimize() throws SQLException {
47: super .optimize();
48: table.optimize();
49: }
50:
51: @Override
52: protected int getBatchSize() {
53: return table.getBatchSize();
54: }
55:
56: @Override
57: protected String key(RdbmsBNode value) {
58: return value.stringValue();
59: }
60:
61: @Override
62: protected void insert(Number id, RdbmsBNode resource)
63: throws SQLException, InterruptedException {
64: table.insert(id, resource.stringValue());
65: }
66:
67: }
|