use of org.sirix.access.conf.DatabaseConfiguration in project sirix by sirixdb.
the class DBStore method drop.
@Override
public void drop(final String name) throws DocumentException {
final DatabaseConfiguration dbConfig = new DatabaseConfiguration(mLocation.resolve(name));
if (Databases.existsDatabase(dbConfig)) {
try {
Databases.truncateDatabase(dbConfig);
final Database database = Databases.openDatabase(dbConfig.getFile());
mDatabases.remove(database);
mCollections.remove(database);
} catch (final SirixRuntimeException e) {
throw new DocumentException(e);
}
}
throw new DocumentException("No collection with the specified name found!");
}
use of org.sirix.access.conf.DatabaseConfiguration in project sirix by sirixdb.
the class BookShredding method shredder.
private static void shredder(final File pBooks) throws Exception {
final DatabaseConfiguration config = new DatabaseConfiguration(TestHelper.PATHS.PATH1.getFile());
Databases.truncateDatabase(config);
Databases.createDatabase(config);
final Database database = Databases.openDatabase(config.getFile());
database.createResource(new ResourceConfiguration.Builder(TestHelper.RESOURCE, PATHS.PATH1.getConfig()).build());
final Session session = database.getSession(new SessionConfiguration.Builder(TestHelper.RESOURCE).build());
final NodeWriteTrx wtx = session.beginNodeWriteTrx();
final XMLEventReader reader = XMLShredder.createFileReader(pBooks);
final XMLShredder shredder = new XMLShredder.Builder(wtx, reader, Insert.ASFIRSTCHILD).commitAfterwards().build();
shredder.call();
wtx.close();
session.close();
}
use of org.sirix.access.conf.DatabaseConfiguration in project sirix by sirixdb.
the class TestNodeWrapper method generateSession.
@Ignore
public Session generateSession() throws SirixException {
final DatabaseConfiguration dbConfig = new DatabaseConfiguration(TestHelper.PATHS.PATH2.getFile());
Databases.truncateDatabase(dbConfig);
Databases.createDatabase(dbConfig);
mDatabase = Databases.openDatabase(dbConfig.getFile());
mDatabase.createResource(new ResourceConfiguration.Builder(TestHelper.RESOURCE, dbConfig).build());
return mDatabase.getSession(new SessionConfiguration.Builder(TestHelper.RESOURCE).build());
}
use of org.sirix.access.conf.DatabaseConfiguration in project sirix by sirixdb.
the class VersioningTest method setUp.
@Before
public void setUp() throws SirixException {
TestHelper.deleteEverything();
Databases.createDatabase(new DatabaseConfiguration(TestHelper.PATHS.PATH1.getFile()));
mDatabase = Databases.openDatabase(TestHelper.PATHS.PATH1.getFile());
}
Aggregations