public DatasetGraphText(DatasetGraph dsg, TextIndex index, TextDocProducer producer, boolean closeIndexOnClose) { super(dsg, producer) ; this.textIndex = index ; dftGraph = GraphView.createDefaultGraph(this) ; this.closeIndexOnClose = closeIndexOnClose; if ( org.apache.jena.tdb.sys.TDBInternal.isTDB1(dsg) ) { TransactionManager txnMgr = org.apache.jena.tdb.sys.TDBInternal.getTransactionManager(dsg); txnMgr.addAdditionComponent(new TextIndexTDB1(textIndex)); commitAction = delegateCommit; abortAction = delegateAbort; } else if ( org.apache.jena.tdb2.sys.TDBInternal.isTDB2(dsg) ) { TransactionCoordinator coord = org.apache.jena.tdb2.sys.TDBInternal.getTransactionCoordinator(dsg); // Does not overlap with the ids used by TDB2. byte[] componentID = { 2,4,6,10 } ; TransactionalComponent tc = new TextIndexDB(ComponentId.create(null, componentID), textIndex); coord.modify(()->coord.add(tc)); commitAction = delegateCommit; abortAction = delegateAbort; } else { commitAction = nonDelegatedCommit; abortAction = nonDelegatedAbort; } }
public DatasetGraphText(DatasetGraph dsg, TextIndex index, TextDocProducer producer, boolean closeIndexOnClose) { super(dsg, producer) ; this.textIndex = index ; dftGraph = GraphView.createDefaultGraph(this) ; this.closeIndexOnClose = closeIndexOnClose; if ( org.apache.jena.tdb.sys.TDBInternal.isTDB1(dsg) ) { TransactionManager txnMgr = org.apache.jena.tdb.sys.TDBInternal.getTransactionManager(dsg); txnMgr.addAdditionComponent(new TextIndexTDB1(textIndex)); commitAction = delegateCommit; abortAction = delegateAbort; } else if ( org.apache.jena.tdb2.sys.TDBInternal.isTDB2(dsg) ) { TransactionCoordinator coord = org.apache.jena.tdb2.sys.TDBInternal.getTransactionCoordinator(dsg); // Does not overlap with the ids used by TDB2. byte[] componentID = { 2,4,6,10 } ; TransactionalComponent tc = new TextIndexDB(ComponentId.create(null, componentID), textIndex); coord.modify(()->coord.add(tc)); commitAction = delegateCommit; abortAction = delegateAbort; } else { commitAction = nonDelegatedCommit; abortAction = nonDelegatedAbort; } }