void finish() { if ( ! recording ) throw new TDBException("Recorder not recording") ; // null out, not .clear. blockMgrs = null ; objectFiles = null ; bufferChannels = null ; recording = false ; }
@Override public void startUpdate() { throw new TDBException("Read-only") ; }
private static String key(String string) { if ( string.startsWith(jsonKeyPrefix)) throw new TDBException("Key name already starts with '"+jsonKeyPrefix+"'") ; return jsonKeyPrefix+string ; }
public static void error(Logger log, String msg) { if ( log != null ) log.error(msg) ; throw new TDBException(msg) ; }
private static void error(Logger log, String msg) { if ( log != null ) log.error(msg) ; throw new TDBException(msg) ; }
private static String unkey(String string) { if ( ! string.startsWith(jsonKeyPrefix) ) throw new TDBException("JSON key name does not start with '"+jsonKeyPrefix+"'") ; return string.substring(jsonKeyPrefix.length()) ; }
public static Symbol allocSymbol(String shortName) { if ( shortName.startsWith(SystemTDB.tdbSymbolPrefix)) throw new TDBException("Symbol short name begins with the TDB namespace prefix: "+shortName) ; if ( shortName.startsWith("http:")) throw new TDBException("Symbol short name begins with http: "+shortName) ; return allocSymbol(SystemTDB.symbolNamespace, shortName) ; }
void start() { if ( recording ) throw new TDBException("Recorder already recording") ; recording = true ; blockMgrs = new HashMap<>() ; objectFiles = new HashMap<>() ; bufferChannels = new HashMap<>() ; nodeTables = new HashMap<>() ; } void finish() {
public static void panic(Class<?> clazz, String string) { Log.error(clazz, string) ; throw new TDBException(string) ; }
protected PageBase(Block block) { this.block = block ; long x = block.getId() ; if ( x < 0 ) throw new TDBException("Page id is negative: "+x) ; if ( x > Integer.MAX_VALUE ) throw new TDBException("Page id is large than MAX_INT: "+x) ; this.id = block.getId().intValue() ; }
public static Predicate<Tuple<NodeId>> getFilter(Context context) { Object x = context.get(SystemTDB.symTupleFilter) ; try { @SuppressWarnings("unchecked") Predicate<Tuple<NodeId>> f = (Predicate<Tuple<NodeId>>)x ; return f ; } catch (ClassCastException ex) { throw new TDBException("Not a Filter<Tuple<NodeId>>:"+x, ex) ; } }
public TupleIndexRecord(int N, ColumnMap colMapping, String name, RecordFactory factory, RangeIndex index) { super(N, colMapping, name); this.factory = factory; this.index = index; if ( factory.keyLength() != N * SizeOfNodeId ) throw new TDBException(format("Mismatch: TupleIndex of length %d is not comparative with a factory for key length %d", N, factory.keyLength())); }
@Override public BlockMgr buildBlockMgr(FileSet fileSet, String ext, IndexParams params) { FileRef ref = FileRef.create(fileSet, ext) ; BlockMgr blockMgr = blockMgrs.get(ref) ; if ( blockMgr == null ) throw new TDBException("No BlockMgr for " + ref) ; blockMgr = new BlockMgrReadonly(blockMgr) ; return blockMgr ; } }
@Override public NodeId getAllocateNodeId(Node node) { NodeId nodeId = getNodeIdForNode(node) ; if ( NodeId.isDoesNotExist(nodeId) ) throw new TDBException("Allocation attempt on NodeTableReadonly") ; return nodeId ; } }
protected final NodeId idForNode(Node node) { if (node == null || node == Node.ANY) return NodeId.NodeIdAny ; if (node.isVariable()) throw new TDBException("Can't pass variables to NodeTupleTable.find*") ; return nodeTable.getNodeIdForNode(node) ; }
private static Integer getInt(JsonObject json, String key) { if ( ! json.hasKey(key) ) throw new TDBException("StoreParamsCodec.getInt: no such key: "+key) ; Integer x = json.get(key).getAsNumber().value().intValue() ; return x ; }
/** Create a BlockMgr backed by a real file */ public static BlockMgr createFile(String filename, FileMode fileMode, int blockSize, int readBlockCacheSize, int writeBlockCacheSize) { 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: " + fileMode) ; }
private void checkEmpty(String string, Multiset<Long> blocks) { if ( ! blocks.isEmpty() ) { error(string) ; for ( Long id : blocks ) info(" Block: "+id) ; history() ; throw new TDBException() ; //debugPoint() ; } }
private static Triple triple(NodeTable nodeTable, Tuple<NodeId> tuple) { if ( tuple.len() != 3 ) throw new TDBException("Tuple is not of length 3: "+tuple) ; return triple(nodeTable, tuple.get(0), tuple.get(1), tuple.get(2)) ; }
private static String[] getStringArray(JsonObject json, String key) { if ( ! json.hasKey(key) ) throw new TDBException("StoreParamsCodec.getStringArray: no such key: "+key) ; JsonArray a = json.get(key).getAsArray() ; String[] x = new String[a.size()] ; for ( int i = 0 ; i < a.size() ; i++ ) { x[i] = a.get(i).getAsString().value() ; } return x ; }