You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2014/09/05 17:09:05 UTC
svn commit: r1622717 - in /jena/trunk/jena-tdb/src:
main/java/com/hp/hpl/jena/tdb/base/block/
main/java/com/hp/hpl/jena/tdb/mgt/ main/java/com/hp/hpl/jena/tdb/nodetable/
main/java/com/hp/hpl/jena/tdb/setup/ main/java/com/hp/hpl/jena/tdb/store/
main/jav...
Author: andy
Date: Fri Sep 5 15:09:05 2014
New Revision: 1622717
URL: http://svn.apache.org/r1622717
Log:
SystemParamsBuidler
Added:
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams1.java
- copied, changed from r1622698, jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java
Removed:
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java
Modified:
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrFactory.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfo.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderBasic.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetPrefixesTDB.java
jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java
jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/graph/TestPrefixMappingTDB.java
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrFactory.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrFactory.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrFactory.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/base/block/BlockMgrFactory.java Fri Sep 5 15:09:05 2014
@@ -55,9 +55,17 @@ public class BlockMgrFactory
if ( fileSet.isMem() )
return createMem(fileSet.filename(ext), blockSize) ;
else
- return createFile(fileSet.filename(ext), blockSize, readBlockCacheSize, writeBlockCacheSize) ;
+ return createFile(fileSet.filename(ext), null, blockSize, readBlockCacheSize, writeBlockCacheSize) ;
}
+ public static BlockMgr create(FileSet fileSet, FileMode fileMode, String ext, int blockSize, int readBlockCacheSize, int writeBlockCacheSize)
+ {
+ if ( fileSet.isMem() )
+ return createMem(fileSet.filename(ext), blockSize) ;
+ else
+ return createFile(fileSet.filename(ext), fileMode, blockSize, readBlockCacheSize, writeBlockCacheSize) ;
+ }
+
/** Create an in-memory block manager */
public static BlockMgr createMem(String indexName, int blockSize)
{
@@ -72,16 +80,23 @@ public class BlockMgrFactory
}
/** Create a BlockMgr backed by a file */
- public static BlockMgr createFile(String filename, int blockSize, int readBlockCacheSize, int writeBlockCacheSize)
+ public static BlockMgr createFile(String filename, int blockSize, int readBlockCacheSize, int writeBlockCacheSize) {
+ return createFile(filename, null,blockSize, readBlockCacheSize, writeBlockCacheSize) ;
+ }
+
+ /** Create a BlockMgr backed by a file */
+ public static BlockMgr createFile(String filename, FileMode fileMode, int blockSize, int readBlockCacheSize, int writeBlockCacheSize)
{
- switch ( SystemTDB.fileMode() )
+ if ( fileMode == null )
+ fileMode = SystemTDB.fileMode() ;
+ switch ( fileMode )
{
case mapped:
return createMMapFile(filename, blockSize) ;
case direct:
return createStdFile(filename, blockSize, readBlockCacheSize, writeBlockCacheSize) ;
}
- throw new TDBException("Unknown file mode: "+SystemTDB.fileMode()) ;
+ throw new TDBException("Unknown file mode: "+fileMode) ;
}
/** Create a NIO Block Manager */
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfo.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfo.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfo.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfo.java Fri Sep 5 15:09:05 2014
@@ -23,7 +23,7 @@ import com.hp.hpl.jena.tdb.sys.SystemTDB
public class TDBSystemInfo implements TDBSystemInfoMBean
{
- private static SystemParams params = SystemParams.getStdSystemParams() ;
+ private static SystemParams params = SystemParams.getDftSystemParams() ;
@Override
public int getSegmentSize() { return SystemTDB.SegmentSize; }
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java Fri Sep 5 15:09:05 2014
@@ -44,7 +44,7 @@ public class NodeTableFactory
if ( location != null )
filesetIdx = new FileSet(location, Names.indexNode2Id) ;
- SystemParams params = SystemParams.getStdSystemParams() ;
+ SystemParams params = SystemParams.getDftSystemParams() ;
return create(indexBuilder, filesetNodeTable, filesetIdx,
params.getNode2NodeIdCacheSize() ,
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderBasic.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderBasic.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderBasic.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderBasic.java Fri Sep 5 15:09:05 2014
@@ -63,7 +63,7 @@ public class DatasetBuilderBasic //imple
params = config ;
if ( config == null )
- params = SystemParams.getStdSystemParams() ;
+ params = SystemParams.getDftSystemParams() ;
NodeTable nodeTable = makeNodeTable(location, params.getIndexNode2Id(), params.getIndexId2Node(),
-1, -1, -1) ; // No caches
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java Fri Sep 5 15:09:05 2014
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package com.hp.hpl.jena.tdb.setup;
+package com.hp.hpl.jena.tdb.setup ;
import java.util.HashMap ;
import java.util.Map ;
@@ -42,231 +42,223 @@ import com.hp.hpl.jena.tdb.solver.OpExec
import com.hp.hpl.jena.tdb.store.* ;
import com.hp.hpl.jena.tdb.sys.* ;
-/** This class is the process of building a dataset.
- * Records BlockMgr/BufferChannel/NodeTable for use by the transaction builder.
+/**
+ * This class is the process of building a dataset. Records
+ * BlockMgr/BufferChannel/NodeTable for use by the transaction builder.
*/
-public class DatasetBuilderStd implements DatasetBuilder
-{
- private static final Logger log = TDB.logInfo ;
-
- private NodeTableBuilder nodeTableBuilder ;
- private TupleIndexBuilder tupleIndexBuilder ;
-
- private SystemParams params ;
+public class DatasetBuilderStd implements DatasetBuilder {
+ private static final Logger log = TDB.logInfo ;
- private Map<FileRef, BlockMgr> blockMgrs = new HashMap<>() ;
+ private NodeTableBuilder nodeTableBuilder ;
+ private TupleIndexBuilder tupleIndexBuilder ;
+
+ private SystemParams params ;
+
+ private Map<FileRef, BlockMgr> blockMgrs = new HashMap<>() ;
private Map<FileRef, BufferChannel> bufferChannels = new HashMap<>() ;
- private Map<FileRef, NodeTable> nodeTables = new HashMap<>() ;
+ private Map<FileRef, NodeTable> nodeTables = new HashMap<>() ;
- public static DatasetGraphTDB build(Location location)
- {
+ public static DatasetGraphTDB build(Location location) {
DatasetBuilderStd x = new DatasetBuilderStd() ;
- x.setup() ;
+ x.standardSetup() ;
return x.build(location, null) ;
}
-
- public static DatasetGraphTDB build()
- {
+
+ public static DatasetGraphTDB build() {
return build(Location.mem()) ;
}
-
- public static DatasetBuilderStd stdBuilder()
- {
+
+ public static DatasetBuilderStd stdBuilder() {
DatasetBuilderStd x = new DatasetBuilderStd() ;
- x.setup() ;
- return x ;
+ x.standardSetup() ;
+ return x ;
}
-
- protected DatasetBuilderStd() { }
-
- // Used by DatasetBuilderTxn
- public DatasetBuilderStd(BlockMgrBuilder blockMgrBuilder,
- NodeTableBuilder nodeTableBuilder)
- {
+
+ protected DatasetBuilderStd() {}
+
+ // Used by DatasetBuilderTxn
+ public DatasetBuilderStd(BlockMgrBuilder blockMgrBuilder, NodeTableBuilder nodeTableBuilder) {
set(blockMgrBuilder, nodeTableBuilder) ;
}
-
- protected void set(NodeTableBuilder nodeTableBuilder,
- TupleIndexBuilder tupleIndexBuilder)
- {
+
+ protected void set(NodeTableBuilder nodeTableBuilder, TupleIndexBuilder tupleIndexBuilder) {
this.nodeTableBuilder = nodeTableBuilder ;
this.tupleIndexBuilder = tupleIndexBuilder ;
}
-
- protected void set(BlockMgrBuilder blockMgrBuilder,
- NodeTableBuilder nodeTableBuilder)
- {
+
+ protected void set(BlockMgrBuilder blockMgrBuilder, NodeTableBuilder nodeTableBuilder) {
Recorder recorder = new Recorder(this) ;
BlockMgrBuilder blockMgrBuilderRec = new BlockMgrBuilderRecorder(blockMgrBuilder, recorder) ;
- IndexBuilder indexBuilder = new Builder.IndexBuilderStd(blockMgrBuilderRec, blockMgrBuilderRec) ;
- RangeIndexBuilder rangeIndexBuilder = new Builder.RangeIndexBuilderStd(blockMgrBuilderRec, blockMgrBuilderRec) ;
-
+ IndexBuilder indexBuilder = new Builder.IndexBuilderStd(blockMgrBuilderRec, blockMgrBuilderRec) ;
+ RangeIndexBuilder rangeIndexBuilder = new Builder.RangeIndexBuilderStd(blockMgrBuilderRec, blockMgrBuilderRec) ;
+
this.nodeTableBuilder = nodeTableBuilder ;
nodeTableBuilder = new NodeTableBuilderRecorder(nodeTableBuilder, recorder) ;
-
- TupleIndexBuilder tupleIndexBuilder = new Builder.TupleIndexBuilderStd(rangeIndexBuilder) ;
+
+ TupleIndexBuilder tupleIndexBuilder = new Builder.TupleIndexBuilderStd(rangeIndexBuilder) ;
set(nodeTableBuilder, tupleIndexBuilder) ;
}
-
- protected void setup()
- {
- ObjectFileBuilder objectFileBuilder = new Builder.ObjectFileBuilderStd() ;
- BlockMgrBuilder blockMgrBuilder = new Builder.BlockMgrBuilderStd() ;
- IndexBuilder indexBuilderNT = new Builder.IndexBuilderStd(blockMgrBuilder, blockMgrBuilder) ;
- NodeTableBuilder nodeTableBuilder = new Builder.NodeTableBuilderStd(indexBuilderNT, objectFileBuilder) ;
-
- set(blockMgrBuilder, nodeTableBuilder) ;
+
+ private void standardSetup() {
+ ObjectFileBuilder objectFileBuilder = new Builder.ObjectFileBuilderStd() ;
+ BlockMgrBuilder blockMgrBuilder = new Builder.BlockMgrBuilderStd() ;
+ IndexBuilder indexBuilderNT = new Builder.IndexBuilderStd(blockMgrBuilder, blockMgrBuilder) ;
+ NodeTableBuilder nodeTableBuilder = new Builder.NodeTableBuilderStd(indexBuilderNT, objectFileBuilder) ;
+
+ set(blockMgrBuilder, nodeTableBuilder) ;
}
@Override
- public DatasetGraphTDB build(Location location, SystemParams params)
- {
+ public DatasetGraphTDB build(Location location, SystemParams params) {
if ( params == null )
- params = SystemParams.getStdSystemParams() ;
-
+ params = SystemParams.getDftSystemParams() ;
+
// Ensure that there is global synchronization
- synchronized(DatasetBuilderStd.class)
- {
+ synchronized (DatasetBuilderStd.class) {
return _build(location, params, true, null) ;
}
}
-
+
// Main engine for building.
// Called by DatasetBuilderTxn
- public DatasetGraphTDB _build(Location location, SystemParams _params, boolean readonly, ReorderTransformation _transform)
- {
+ public DatasetGraphTDB _build(Location location, SystemParams _params, boolean readonly,
+ ReorderTransformation _transform) {
params = _params ;
init(location) ;
DatasetControl policy = createConcurrencyPolicy() ;
-
- NodeTable nodeTable = makeNodeTable(location,
- params.getIndexNode2Id(), params.getIndexId2Node(),
- params.getNode2NodeIdCacheSize(), params.getNodeId2NodeCacheSize(), params.getNodeMissCacheSize()) ;
-
- TripleTable tripleTable = makeTripleTable(location, nodeTable, policy) ;
+
+ NodeTable nodeTable = makeNodeTable(location, params.getIndexNode2Id(), params.getIndexId2Node(),
+ params.getNode2NodeIdCacheSize(), params.getNodeId2NodeCacheSize(),
+ params.getNodeMissCacheSize()) ;
+
+ TripleTable tripleTable = makeTripleTable(location, nodeTable, policy) ;
QuadTable quadTable = makeQuadTable(location, nodeTable, policy) ;
DatasetPrefixesTDB prefixes = makePrefixTable(location, policy) ;
-
- ReorderTransformation transform = (_transform==null) ? chooseReorderTransformation(location) : _transform ;
-
- StorageConfig storageConfig = new StorageConfig(location, params, readonly, blockMgrs, bufferChannels, nodeTables) ;
+
+ ReorderTransformation transform = (_transform == null) ? chooseReorderTransformation(location) : _transform ;
+
+ StorageConfig storageConfig = new StorageConfig(location, params, readonly, blockMgrs, bufferChannels,
+ nodeTables) ;
DatasetGraphTDB dsg = new DatasetGraphTDB(tripleTable, quadTable, prefixes, transform, storageConfig) ;
// TDB does filter placement on BGPs itself.
- dsg.getContext().set(ARQ.optFilterPlacementBGP, false);
+ dsg.getContext().set(ARQ.optFilterPlacementBGP, false) ;
QC.setFactory(dsg.getContext(), OpExecutorTDB1.OpExecFactoryTDB) ;
return dsg ;
}
-
- protected DatasetControl createConcurrencyPolicy() { return new DatasetControlMRSW() ; }
-
- protected void init(Location location)
- {
- // Build params.
+
+ protected DatasetControl createConcurrencyPolicy() {
+ return new DatasetControlMRSW() ;
}
-
+
+ protected void init(Location location) {
+ // A last chance to change things.
+ }
+
// ==== TODO makeNodeTupleTable.
-
+
// ======== Dataset level
- protected TripleTable makeTripleTable(Location location, NodeTable nodeTable, DatasetControl policy)
- {
+ protected TripleTable makeTripleTable(Location location, NodeTable nodeTable, DatasetControl policy) {
String primary = params.getPrimaryIndexTriples() ;
String[] indexes = params.getTripleIndexes() ;
- // Allow experimentation of other index layouts.
-// if ( indexes.length != 3 )
-// error(log, "Wrong number of triple table indexes: "+StrUtils.strjoin(",", indexes)) ;
- log.debug("Triple table: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
-
+ // Allow experimentation of other index layouts.
+ // if ( indexes.length != 3 )
+ // error(log,
+ // "Wrong number of triple table indexes: "+StrUtils.strjoin(",",
+ // indexes)) ;
+ log.debug("Triple table: " + primary + " :: " + StrUtils.strjoin(",", indexes)) ;
+
TupleIndex tripleIndexes[] = makeTupleIndexes(location, primary, indexes) ;
-
+
if ( tripleIndexes.length != indexes.length )
- error(log, "Wrong number of triple table tuples indexes: "+tripleIndexes.length) ;
+ error(log, "Wrong number of triple table tuples indexes: " + tripleIndexes.length) ;
TripleTable tripleTable = new TripleTable(tripleIndexes, nodeTable, policy) ;
return tripleTable ;
}
-
- protected QuadTable makeQuadTable(Location location, NodeTable nodeTable, DatasetControl policy)
- {
+
+ protected QuadTable makeQuadTable(Location location, NodeTable nodeTable, DatasetControl policy) {
String primary = params.getPrimaryIndexQuads() ;
String[] indexes = params.getQuadIndexes() ;
-
- // Allow experimentation of other index layouts.
-// if ( indexes.length != 6 )
-// error(log, "Wrong number of quad table indexes: "+StrUtils.strjoin(",", indexes)) ;
-
- log.debug("Quad table: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
-
+
+ // Allow experimentation of other index layouts.
+ // if ( indexes.length != 6 )
+ // error(log,
+ // "Wrong number of quad table indexes: "+StrUtils.strjoin(",",
+ // indexes)) ;
+
+ log.debug("Quad table: " + primary + " :: " + StrUtils.strjoin(",", indexes)) ;
+
TupleIndex quadIndexes[] = makeTupleIndexes(location, primary, indexes) ;
if ( quadIndexes.length != indexes.length )
- error(log, "Wrong number of quad table tuples indexes: "+quadIndexes.length) ;
+ error(log, "Wrong number of quad table tuples indexes: " + quadIndexes.length) ;
QuadTable quadTable = new QuadTable(quadIndexes, nodeTable, policy) ;
return quadTable ;
}
- protected DatasetPrefixesTDB makePrefixTable(Location location, DatasetControl policy)
- {
+ protected DatasetPrefixesTDB makePrefixTable(Location location, DatasetControl policy) {
String primary = params.getPrimaryIndexPrefix() ;
String[] indexes = params.getPrefixIndexes() ;
-
+
TupleIndex prefixIndexes[] = makeTupleIndexes(location, primary, indexes, new String[]{params.getIndexPrefix()}) ;
if ( prefixIndexes.length != 1 )
- error(log, "Wrong number of triple table tuples indexes: "+prefixIndexes.length) ;
-
+ error(log, "Wrong number of triple table tuples indexes: " + prefixIndexes.length) ;
+
String pnNode2Id = params.getPrefixNode2Id() ;
String pnId2Node = params.getPrefixId2Node() ;
-
+
// No cache - the prefix mapping is a cache
- NodeTable prefixNodes = makeNodeTable(location, pnNode2Id, pnId2Node, -1, -1, -1) ;
-
- DatasetPrefixesTDB prefixes = new DatasetPrefixesTDB(prefixIndexes, prefixNodes, policy) ;
-
- log.debug("Prefixes: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
-
+ NodeTable prefixNodes = makeNodeTable(location, pnNode2Id, pnId2Node, -1, -1, -1) ;
+
+ DatasetPrefixesTDB prefixes = new DatasetPrefixesTDB(prefixIndexes, prefixNodes, policy) ;
+
+ log.debug("Prefixes: " + primary + " :: " + StrUtils.strjoin(",", indexes)) ;
+
return prefixes ;
}
-
- protected ReorderTransformation chooseReorderTransformation(Location location)
- {
+ protected ReorderTransformation chooseReorderTransformation(Location location) {
return chooseOptimizer(location) ;
}
// ======== Components level
-
-// // This is not actually used in main dataset builder because it's done inside TripleTable/QuadTable.
-// protected NodeTupleTable makeNodeTupleTable(Location location, String primary, String[] indexes, NodeTable nodeTable, ConcurrencyPolicy policy)
-// {
-// int N = indexes.length ;
-// TupleIndex tripleIndexes[] = makeTupleIndexes(location, primary, indexes) ;
-// if ( tripleIndexes.length != indexes.length )
-// error(log, "Wrong number of node table tuples indexes: expected="+N+" : actual="+tripleIndexes.length) ;
-// NodeTupleTable ntt = new NodeTupleTableConcrete(N, tripleIndexes, nodeTable, policy) ;
-// return ntt ;
-// }
-
- private TupleIndex[] makeTupleIndexes(Location location, String primary, String[] indexNames)
- {
+
+ // // This is not actually used in main dataset builder because it's done
+ // inside TripleTable/QuadTable.
+ // protected NodeTupleTable makeNodeTupleTable(Location location, String
+ // primary, String[] indexes, NodeTable nodeTable, ConcurrencyPolicy policy)
+ // {
+ // int N = indexes.length ;
+ // TupleIndex tripleIndexes[] = makeTupleIndexes(location, primary, indexes)
+ // ;
+ // if ( tripleIndexes.length != indexes.length )
+ // error(log,
+ // "Wrong number of node table tuples indexes: expected="+N+" : actual="+tripleIndexes.length)
+ // ;
+ // NodeTupleTable ntt = new NodeTupleTableConcrete(N, tripleIndexes,
+ // nodeTable, policy) ;
+ // return ntt ;
+ // }
+
+ private TupleIndex[] makeTupleIndexes(Location location, String primary, String[] indexNames) {
return makeTupleIndexes(location, primary, indexNames, indexNames) ;
}
-
- private TupleIndex[] makeTupleIndexes(Location location, String primary, String[] indexNames, String[] filenames)
- {
+
+ private TupleIndex[] makeTupleIndexes(Location location, String primary, String[] indexNames, String[] filenames) {
if ( primary.length() != 3 && primary.length() != 4 )
- error(log, "Bad primary key length: "+primary.length()) ;
-
- int indexRecordLen = primary.length()*NodeId.SIZE ;
+ error(log, "Bad primary key length: " + primary.length()) ;
+
+ int indexRecordLen = primary.length() * NodeId.SIZE ;
TupleIndex indexes[] = new TupleIndex[indexNames.length] ;
- for (int i = 0 ; i < indexes.length ; i++)
+ for ( int i = 0 ; i < indexes.length ; i++ )
indexes[i] = makeTupleIndex(location, filenames[i], primary, indexNames[i]) ;
return indexes ;
}
// ----
- protected TupleIndex makeTupleIndex(Location location, String name, String primary, String indexOrder)
- {
- // Commonly, name == indexOrder.
+ protected TupleIndex makeTupleIndex(Location location, String name, String primary, String indexOrder) {
+ // Commonly, name == indexOrder.
// FileSet
FileSet fs = new FileSet(location, name) ;
ColumnMap colMap = new ColumnMap(primary, indexOrder) ;
@@ -274,62 +266,64 @@ public class DatasetBuilderStd implement
}
// ----
-
- protected NodeTable makeNodeTable(Location location, String indexNode2Id, String indexId2Node,
- int sizeNode2NodeIdCache, int sizeNodeId2NodeCache, int sizeNodeMissCache)
- {
+
+ protected NodeTable makeNodeTable(Location location, String indexNode2Id, String indexId2Node,
+ int sizeNode2NodeIdCache, int sizeNodeId2NodeCache, int sizeNodeMissCache) {
FileSet fsNodeToId = new FileSet(location, indexNode2Id) ;
FileSet fsId2Node = new FileSet(location, indexId2Node) ;
- NodeTable nt = nodeTableBuilder.buildNodeTable(fsNodeToId, fsId2Node, sizeNode2NodeIdCache, sizeNodeId2NodeCache, sizeNodeMissCache) ;
+ NodeTable nt = nodeTableBuilder.buildNodeTable(fsNodeToId, fsId2Node, sizeNode2NodeIdCache,
+ sizeNodeId2NodeCache, sizeNodeMissCache) ;
return nt ;
}
- private static void error(Logger log, String msg)
- {
+ private static void error(Logger log, String msg) {
if ( log != null )
log.error(msg) ;
throw new TDBException(msg) ;
}
-
- private static int parseInt(String str, String messageBase)
- {
- try { return Integer.parseInt(str) ; }
- catch (NumberFormatException ex) { error(log, messageBase+": "+str) ; return -1 ; }
+
+ private static int parseInt(String str, String messageBase) {
+ try {
+ return Integer.parseInt(str) ;
+ }
+ catch (NumberFormatException ex) {
+ error(log, messageBase + ": " + str) ;
+ return -1 ;
+ }
}
-
- /** Set the global flag that control the "No BGP optimizer" warning.
- * Set to false to silence the warning
+ /**
+ * Set the global flag that control the "No BGP optimizer" warning. Set to
+ * false to silence the warning
*/
- public static void setOptimizerWarningFlag(boolean b) { warnAboutOptimizer = b ; }
+ public static void setOptimizerWarningFlag(boolean b) {
+ warnAboutOptimizer = b ;
+ }
private static boolean warnAboutOptimizer = true ;
- public static ReorderTransformation chooseOptimizer(Location location)
- {
+ public static ReorderTransformation chooseOptimizer(Location location) {
if ( location == null )
return ReorderLib.identity() ;
ReorderTransformation reorder = null ;
- if ( location.exists(Names.optStats) )
- {
+ if ( location.exists(Names.optStats) ) {
try {
reorder = ReorderLib.weighted(location.getPath(Names.optStats)) ;
- log.debug("Statistics-based BGP optimizer") ;
- } catch (SSEParseException ex) {
- log.warn("Error in stats file: "+ex.getMessage()) ;
+ log.debug("Statistics-based BGP optimizer") ;
+ }
+ catch (SSEParseException ex) {
+ log.warn("Error in stats file: " + ex.getMessage()) ;
reorder = null ;
}
}
- if ( reorder == null && location.exists(Names.optFixed) )
- {
+ if ( reorder == null && location.exists(Names.optFixed) ) {
// Not as good but better than nothing.
reorder = ReorderLib.fixed() ;
- log.debug("Fixed pattern BGP optimizer") ;
+ log.debug("Fixed pattern BGP optimizer") ;
}
- if ( location.exists(Names.optNone) )
- {
+ if ( location.exists(Names.optNone) ) {
reorder = ReorderLib.identity() ;
log.debug("Optimizer explicitly turned off") ;
}
@@ -340,86 +334,74 @@ public class DatasetBuilderStd implement
if ( reorder == null && warnAboutOptimizer )
ARQ.getExecLogger().warn("No BGP optimizer") ;
- return reorder ;
+ return reorder ;
}
-
- interface RecordBlockMgr
- {
+ interface RecordBlockMgr {
void record(FileRef fileRef, BlockMgr blockMgr) ;
}
-
- interface RecordNodeTable
- {
+
+ interface RecordNodeTable {
void record(FileRef fileRef, NodeTable nodeTable) ;
}
- static class NodeTableBuilderRecorder implements NodeTableBuilder
- {
+ static class NodeTableBuilderRecorder implements NodeTableBuilder {
private NodeTableBuilder builder ;
- private RecordNodeTable recorder ;
+ private RecordNodeTable recorder ;
- NodeTableBuilderRecorder(NodeTableBuilder ntb, RecordNodeTable recorder)
- {
+ NodeTableBuilderRecorder(NodeTableBuilder ntb, RecordNodeTable recorder) {
this.builder = ntb ;
this.recorder = recorder ;
}
-
+
@Override
public NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile, int sizeNode2NodeIdCache,
- int sizeNodeId2NodeCache, int sizeNodeMissCacheSize)
- {
- NodeTable nt = builder.buildNodeTable(fsIndex, fsObjectFile, sizeNode2NodeIdCache, sizeNodeId2NodeCache, sizeNodeMissCacheSize) ;
+ int sizeNodeId2NodeCache, int sizeNodeMissCacheSize) {
+ NodeTable nt = builder.buildNodeTable(fsIndex, fsObjectFile, sizeNode2NodeIdCache, sizeNodeId2NodeCache,
+ sizeNodeMissCacheSize) ;
// It just knows, right?
FileRef ref = FileRef.create(fsObjectFile.filename(Names.extNodeData)) ;
recorder.record(ref, nt) ;
return nt ;
}
-
+
}
-
- static class BlockMgrBuilderRecorder implements BlockMgrBuilder
- {
+
+ static class BlockMgrBuilderRecorder implements BlockMgrBuilder {
private BlockMgrBuilder builder ;
- private RecordBlockMgr recorder ;
+ private RecordBlockMgr recorder ;
- BlockMgrBuilderRecorder(BlockMgrBuilder blkMgrBuilder, RecordBlockMgr recorder)
- {
+ BlockMgrBuilderRecorder(BlockMgrBuilder blkMgrBuilder, RecordBlockMgr recorder) {
this.builder = blkMgrBuilder ;
this.recorder = recorder ;
}
-
+
@Override
- public BlockMgr buildBlockMgr(FileSet fileSet, String ext, int blockSize)
- {
+ public BlockMgr buildBlockMgr(FileSet fileSet, String ext, int blockSize) {
BlockMgr blkMgr = builder.buildBlockMgr(fileSet, ext, blockSize) ;
FileRef ref = FileRef.create(fileSet, ext) ;
recorder.record(ref, blkMgr) ;
return blkMgr ;
}
}
-
- static class Recorder implements RecordBlockMgr, RecordNodeTable
- {
+
+ static class Recorder implements RecordBlockMgr, RecordNodeTable {
private DatasetBuilderStd dsBuilder ;
- Recorder(DatasetBuilderStd dsBuilder)
- {
+ Recorder(DatasetBuilderStd dsBuilder) {
this.dsBuilder = dsBuilder ;
}
-
+
@Override
- public void record(FileRef fileRef, BlockMgr blockMgr)
- {
- //log.info("BlockMgr: "+fileRef) ;
+ public void record(FileRef fileRef, BlockMgr blockMgr) {
+ // log.info("BlockMgr: "+fileRef) ;
dsBuilder.blockMgrs.put(fileRef, blockMgr) ;
}
@Override
- public void record(FileRef fileRef, NodeTable nodeTable)
- {
- //log.info("NodeTable: "+fileRef) ;
+ public void record(FileRef fileRef, NodeTable nodeTable) {
+ // log.info("NodeTable: "+fileRef) ;
dsBuilder.nodeTables.put(fileRef, nodeTable) ;
}
}
Copied: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams1.java (from r1622698, jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java)
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams1.java?p2=jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams1.java&p1=jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java&r1=1622698&r2=1622717&rev=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams1.java Fri Sep 5 15:09:05 2014
@@ -25,7 +25,7 @@ import com.hp.hpl.jena.tdb.sys.Names ;
import com.hp.hpl.jena.tdb.sys.SystemTDB ;
/** System parameters for a TDB database instance. */
-public class SystemParams
+public class SystemParams1
{
private FileMode fileMode = SystemTDB.fileMode() ;
private int blockSize = SystemTDB.BlockSize ;
@@ -49,10 +49,10 @@ public class SystemParams
private String prefixNode2Id = Names.prefixNode2Id ;
private String prefixId2Node = Names.prefixId2Node ;
- public SystemParams() {}
+ public SystemParams1() {}
- public static SystemParams getStdSystemParams() {
- return new SystemParams() ;
+ public static SystemParams1 getStdSystemParams() {
+ return new SystemParams1() ;
}
@Override
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetPrefixesTDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetPrefixesTDB.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetPrefixesTDB.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/store/DatasetPrefixesTDB.java Fri Sep 5 15:09:05 2014
@@ -62,10 +62,11 @@ public class DatasetPrefixesTDB implemen
private final NodeTupleTable nodeTupleTable ;
@Deprecated
- public static DatasetPrefixesTDB create(Location location, DatasetControl policy) { return create(IndexBuilder.get(), location, policy) ; }
+ public static DatasetPrefixesTDB createTesting(Location location, DatasetControl policy)
+ { return create(IndexBuilder.get(), location, policy) ; }
@Deprecated
- public static DatasetPrefixesTDB create(IndexBuilder indexBuilder, Location location, DatasetControl policy)
+ private static DatasetPrefixesTDB create(IndexBuilder indexBuilder, Location location, DatasetControl policy)
{ return new DatasetPrefixesTDB(indexBuilder, location, policy) ; }
@Deprecated
Modified: jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java (original)
+++ jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java Fri Sep 5 15:09:05 2014
@@ -68,7 +68,7 @@ public class SetupTDB
throw new TDBException(msg) ;
}
- private static SystemParams params = SystemParams.getStdSystemParams() ;
+ private static SystemParams params = SystemParams.getDftSystemParams() ;
// And here we make datasets ...
public static DatasetGraphTDB buildDataset(Location location)
Modified: jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/graph/TestPrefixMappingTDB.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/graph/TestPrefixMappingTDB.java?rev=1622717&r1=1622716&r2=1622717&view=diff
==============================================================================
--- jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/graph/TestPrefixMappingTDB.java (original)
+++ jena/trunk/jena-tdb/src/test/java/com/hp/hpl/jena/tdb/graph/TestPrefixMappingTDB.java Fri Sep 5 15:09:05 2014
@@ -86,7 +86,7 @@ public class TestPrefixMappingTDB extend
String dir = ConfigTest.getTestingDir() ;
FileOps.clearDirectory(dir) ;
- DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new DatasetControlMRSW()) ;
+ DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.createTesting(new Location(dir), new DatasetControlMRSW()) ;
PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
String x = pmap1.getNsPrefixURI("x") ;
@@ -101,13 +101,13 @@ public class TestPrefixMappingTDB extend
String dir = ConfigTest.getTestingDir() ;
FileOps.clearDirectory(dir) ;
- DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(new Location(dir), new DatasetControlMRSW()) ;
+ DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.createTesting(new Location(dir), new DatasetControlMRSW()) ;
PrefixMapping pmap1 = prefixes.getPrefixMapping() ;
pmap1.setNsPrefix("x", "http://foo/") ;
prefixes.close() ;
- prefixes = DatasetPrefixesTDB.create(new Location(dir), new DatasetControlMRSW()) ;
+ prefixes = DatasetPrefixesTDB.createTesting(new Location(dir), new DatasetControlMRSW()) ;
assertEquals("http://foo/", pmap1.getNsPrefixURI("x")) ;
prefixes.close();
}