use of org.apache.jena.dboe.base.file.Location in project jena by apache.
the class TDBInternal method expel.
/**
* Stop managing a DatasetGraph. Use with great care.
*/
public static synchronized void expel(DatasetGraph dsg, boolean force) {
Location locContainer = null;
Location locStorage = null;
if (dsg instanceof DatasetGraphSwitchable) {
locContainer = ((DatasetGraphSwitchable) dsg).getLocation();
dsg = ((DatasetGraphSwitchable) dsg).getWrapped();
}
if (dsg instanceof DatasetGraphTDB)
locStorage = ((DatasetGraphTDB) dsg).getLocation();
DatabaseConnection.internalExpel(locContainer, force);
StoreConnection.internalExpel(locStorage, force);
}
use of org.apache.jena.dboe.base.file.Location in project jena by apache.
the class TDBInternal method expel.
/**
* Stop managing a DatasetGraph. Use with great care.
*/
public static synchronized void expel(DatasetGraph dsg) {
Location locContainer = null;
Location locStorage = null;
if (dsg instanceof DatasetGraphSwitchable) {
locContainer = ((DatasetGraphSwitchable) dsg).getLocation();
dsg = ((DatasetGraphSwitchable) dsg).getWrapped();
}
if (dsg instanceof DatasetGraphTDB)
locStorage = ((DatasetGraphTDB) dsg).getLocation();
if (locContainer != null)
DatabaseConnection.internalExpel(locContainer, false);
StoreConnection.internalExpel(locStorage, false);
}
use of org.apache.jena.dboe.base.file.Location in project jena by apache.
the class TestStoreParamsChoose method params_choose_new_persist_1.
@Test
public void params_choose_new_persist_1() {
// new database, app defined.
Location loc = Location.create(DIR);
FileOps.clearAll(loc.getDirectoryPath());
// Clear.
StoreParams p = StoreParamsFactory.decideStoreParams(loc, true, pApp, null, pDft);
// Check location now has a pLoc.
String fn = loc.getPath(Names.TDB_CONFIG_FILE);
assertTrue(FileOps.exists(fn));
StoreParams pLoc2 = StoreParamsCodec.read(loc);
assertTrue(StoreParams.sameValues(pLoc2, p));
}
use of org.apache.jena.dboe.base.file.Location in project jena by apache.
the class TestDatabaseMgr method testDatabaseMgrDisk.
@Test
public void testDatabaseMgrDisk() {
TDBInternal.reset();
// The named disk location
String DIRx = ConfigTest.getCleanDir();
Location LOC = Location.create(DIRx);
FileOps.clearDirectory(DIRx);
try {
DatasetGraph dg1 = DatabaseMgr.connectDatasetGraph(LOC);
DatasetGraph dg2 = DatabaseMgr.connectDatasetGraph(Location.create(LOC.getDirectoryPath()));
assertSame(dg1, dg2);
Txn.executeWrite(dg1, () -> {
dg1.add(quad1);
});
Txn.executeRead(dg2, () -> {
assertTrue(dg2.contains(quad1));
});
} finally {
FileOps.clearDirectory(DIRx);
}
}
Aggregations