use of org.sirix.cache.BufferManagerImpl in project sirix by sirixdb.
the class DatabaseImpl method getResourceManager.
// //////////////////////////////////////////////////////////
// END resource name <=> ID handling ////////////////////////
// //////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////
// START DB-Operations //////////////////////////////////////
// //////////////////////////////////////////////////////////
@Override
public synchronized ResourceManager getResourceManager(final ResourceManagerConfiguration resourceManagerConfig) throws SirixException {
final Path resourceFile = mDBConfig.getFile().resolve(DatabaseConfiguration.DatabasePaths.DATA.getFile()).resolve(resourceManagerConfig.getResource());
if (!Files.exists(resourceFile)) {
throw new SirixUsageException("Resource could not be opened (since it was not created?) at location", resourceFile.toString());
}
if (mResourceStore.hasOpenResourceManager(resourceFile))
return mResourceStore.getOpenResourceManager(resourceFile);
final ResourceConfiguration resourceConfig = ResourceConfiguration.deserialize(resourceFile);
// Resource of must be associated to this database.
assert resourceConfig.mPath.getParent().getParent().equals(mDBConfig.getFile());
if (!mBufferManagers.containsKey(resourceFile))
mBufferManagers.put(resourceFile, new BufferManagerImpl());
final ResourceManager resourceManager = mResourceStore.openResource(this, resourceConfig, resourceManagerConfig, mBufferManagers.get(resourceFile), resourceFile);
return resourceManager;
}
Aggregations