本文整理了Java中org.apache.jena.tdb.base.file.Location.isMem()
方法的一些代码示例,展示了Location.isMem()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Location.isMem()
方法的具体详情如下:
包路径:org.apache.jena.tdb.base.file.Location
类名称:Location
方法名:isMem
暂无
代码示例来源:origin: apache/jena
/**
* Gets whether the location is lockable i.e. is it an on-disk location
* where we can use a lock file to prevent multi-process access and the
* potential data corruption that ensues
*
* @return True if the location is lockable
*/
public boolean canLock() {
return !location.isMem();
}
代码示例来源:origin: apache/jena
/** Test whether a location already has a TDB database or whether a call to TDBFactory
* will cause a new, fresh TDB database to be created (pragmatic tests).
* The directory may be empty, or not exist.
* Existing databases return "true".
*/
public static boolean inUseLocation(Location location) {
if ( location.isMemUnique() )
return false ;
if ( location.isMem() )
return StoreConnection.getExisting(location) != null ;
String dirname = location.getDirectoryPath() ;
File d = new File(dirname) ;
if ( ! d.exists() )
// TDB autocreates directories one level.
return ! FileOps.exists(d.getParent()) ;
return ! TDBInternal.isNewDatabaseArea(location) ;
}
代码示例来源:origin: apache/jena
public boolean isMem()
{
return location.isMem() ;
}
代码示例来源:origin: apache/jena
public boolean exists(String ext)
{
if ( location.isMem() )
return true ;
String fn = filename(ext) ;
File f = new File(fn) ;
if ( f.isDirectory() )
log.warn("File clashes with a directory") ;
return f.exists() && f.isFile() ;
}
代码示例来源:origin: apache/jena
/**
* Gets whether the location is currently locked
*
* @return boolean
*/
public boolean isLocked() {
// Memory locations are never considered locked
if (location.isMem())
return false;
return getOwner() != NO_OWNER;
}
代码示例来源:origin: apache/jena
private void ensure(String dirname) {
if ( isMem() )
return ;
File file = new File(dirname) ;
if ( file.exists() && !file.isDirectory() )
throw new FileException("Existing file: " + file.getAbsolutePath()) ;
if ( !file.exists() )
file.mkdir() ;
}
代码示例来源:origin: apache/jena
private String fixupName(String fsName) {
if ( isMem() )
return fsName ;
File file = new File(fsName) ;
try {
fsName = file.getCanonicalPath() ;
} catch (IOException ex) {
throw new FileException("Failed to get canoncial path: " + file.getAbsolutePath(), ex) ;
}
if ( !fsName.endsWith(File.separator) && !fsName.endsWith(pathSeparator) )
fsName = fsName + pathSeparator ;
return fsName ;
}
代码示例来源:origin: apache/jena
/** Look at a directory and see if it is a new area */
public static boolean isNewDatabaseArea(Location location) {
StoreConnection sConn = StoreConnection.getExisting(location) ;
if ( sConn != null )
// Already has a StoreConnection
return false ;
if ( location.isMem() )
return true ;
File d = new File(location.getDirectoryPath()) ;
if ( !d.exists() )
return true ;
FileFilter ff = fileFilterNewDB ;
File[] entries = d.listFiles(ff) ;
return entries.length == 0 ;
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-base
/** Convert a {@link Location} to a {@link Path}. */
public static Path asPath(Location location) {
if ( location.isMem() )
throw new RuntimeIOException("Location is a memory location: "+location);
return Paths.get(location.getDirectoryPath());
}
代码示例来源:origin: apache/jena
public static boolean exists(Location location)
{
if ( location.isMem() ) return false ;
return FileOps.exists(journalFilename(location)) ;
}
代码示例来源:origin: apache/jena
/**
* Read from a file if possible.
* Return null for memory locations, file not found or syntax errors.
*/
public static StoreParams read(Location location) {
if ( location.isMem() )
return null ;
return read(location.getPath(TDB_CONFIG_FILE)) ;
}
代码示例来源:origin: apache/jena
/**
* Gets whether the lock is owned by the current process
*
* @return True if the location is locked and owned by the process, false
* otherwise
*/
public boolean isOwned() {
// Memory locations are never considered locked
if (location.isMem())
return false;
int owner = getOwner();
if (owner == NO_OWNER)
return false;
return owner == ProcessUtils.getPid(NO_OWNER);
}
代码示例来源:origin: apache/jena
private static void checkLocation(Location location) {
if ( location.isMem() )
return ;
String dirname = location.getDirectoryPath() ;
File dir = new File(dirname) ;
// File location.
if ( ! dir.exists() )
error(log, "Does not exist: "+dirname) ;
if ( ! dir.isDirectory() )
error(log, "Not a directory: "+dirname) ;
if ( ! dir.canRead() )
error(log, "Directory not readable: "+dirname) ;
if ( ! dir.canWrite() )
error(log, "Directory not writeable: "+dirname) ;
}
代码示例来源:origin: org.seaborne.rdf-delta/rdf-delta-client
private void init() {
if ( INITIALIZED ) {
checkInit(stateLocation);
return;
}
synchronized(zoneLock) {
if ( INITIALIZED ) {
checkInit(stateLocation);
return;
}
INITIALIZED = true;
if ( stateLocation == null || stateLocation.isMem() ) {
// In-memory only.
stateArea = null;
return ;
}
stateArea = IOX.asPath(stateLocation);
List<Path> x = scanForDataState(stateLocation);
x.forEach(p->LOG.info("Connection : "+p));
x.forEach(p->fromOnDiskState(p));
}
}
代码示例来源:origin: apache/jena
public static Journal create(Location location)
{
BufferChannel chan ;
String channelName = journalFilename(location) ;
if ( location.isMem() )
chan = BufferChannelMem.create(channelName) ;
else
chan = BufferChannelFile.create(channelName) ;
return new Journal(chan) ;
}
代码示例来源:origin: apache/jena
public /* for testing */ static void init$() {
if ( initialized )
return ;
initialized = true ;
if ( location == null )
location = Location.create(FusekiWebapp.dirSystemDatabase.toString()) ;
if ( ! location.isMem() )
FileOps.ensureDir(location.getDirectoryPath()) ;
// Force it into the store connection as a low footprint
if ( StoreConnection.getExisting(location) != null )
Fuseki.serverLog.warn("System database already in the StoreConnection cache") ;
StoreConnection.make(location, systemDatabaseParams) ;
dataset = TDBFactory.createDataset(location) ;
dsg = (DatasetGraphTransaction)(dataset.asDatasetGraph()) ;
dsg.getContext().set(TDB.symUnionDefaultGraph, false) ;
}
}
代码示例来源:origin: org.apache.jena/jena-fuseki-webapp
public /* for testing */ static void init$() {
if ( initialized )
return ;
initialized = true ;
if ( location == null )
location = Location.create(FusekiWebapp.dirSystemDatabase.toString()) ;
if ( ! location.isMem() )
FileOps.ensureDir(location.getDirectoryPath()) ;
// Force it into the store connection as a low footprint
if ( StoreConnection.getExisting(location) != null )
Fuseki.serverLog.warn("System database already in the StoreConnection cache") ;
StoreConnection.make(location, systemDatabaseParams) ;
dataset = TDBFactory.createDataset(location) ;
dsg = (DatasetGraphTransaction)(dataset.asDatasetGraph()) ;
dsg.getContext().set(TDB.symUnionDefaultGraph, false) ;
}
}
代码示例来源:origin: apache/jena
@Override
final public void finishBulk() {
loaderTriples.loadDataFinish() ;
loaderTriples.loadIndexStart() ;
loaderTriples.loadIndexFinish() ;
loaderTriples.loadFinish() ;
if ( !dsg.getLocation().isMem() && startedEmpty && stats != null ) {
String filename = dsg.getLocation().getPath(Names.optStats) ;
Stats.write(filename, stats.results()) ;
}
forceSync(dsg) ;
}
代码示例来源:origin: apache/jena
/** Recover a base storage DatasetGraph */
public static void recovery(DatasetGraphTDB dsg)
{
if ( dsg.getLocation().isMem() )
return ;
// Do we need to recover?
Journal journal = findJournal(dsg) ;
if ( journal == null || journal.isEmpty() )
return ;
recoverFromJournal(dsg.getConfig(), journal) ;
journal.close();
// Recovery complete. Tidy up. Node journal files have already been handled.
if ( journal.getFilename() != null )
{
if ( FileOps.exists(journal.getFilename()) )
FileOps.delete(journal.getFilename()) ;
}
}
代码示例来源:origin: apache/jena
@Override
public void finishBulk() {
loaderTriples.loadDataFinish() ;
loaderQuads.loadDataFinish() ;
loaderTriples.loadIndexStart() ;
loaderQuads.loadIndexStart() ;
loaderTriples.loadIndexFinish() ;
loaderQuads.loadIndexFinish() ;
loaderTriples.loadFinish() ;
loaderQuads.loadFinish() ;
if ( !dsg.getLocation().isMem() && startedEmpty && stats != null ) {
String filename = dsg.getLocation().getPath(Names.optStats) ;
Stats.write(filename, stats.results()) ;
}
forceSync(dsg) ;
}
内容来源于网络,如有侵权,请联系作者删除!