use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.
the class IndexManager method prepare.
/**
* Registers the indexes specified in
* the global configuration object, i.e. in the :
* <pre>
* <modules>
* <module id="foo" class="bar" foo1="bar1" ... />
* </modules>
* </pre>
* section of the configuration file.
*/
@Override
public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceException {
try {
if (modConfigs != null) {
for (final Configuration.IndexModuleConfig modConfig : modConfigs) {
final String className = modConfig.getClassName();
initIndex(pool, modConfig.getId(), modConfig.getConfig(), dataDir, className);
}
}
// check if a structural index was configured. If not, create one based on default settings.
AbstractIndex structural = (AbstractIndex) indexers.get(StructuralIndex.STRUCTURAL_INDEX_ID);
if (structural == null) {
structural = initIndex(pool, StructuralIndex.STRUCTURAL_INDEX_ID, null, dataDir, StructuralIndex.DEFAULT_CLASS);
if (structural != null) {
structural.setName(StructuralIndex.STRUCTURAL_INDEX_ID);
}
}
} catch (final DatabaseConfigurationException e) {
throw new BrokerPoolServiceException(e);
} finally {
configurationChanged();
}
}
use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.
the class FileLockService method configure.
@Override
public void configure(final Configuration configuration) throws BrokerPoolServiceException {
dataDir = Optional.ofNullable((Path) configuration.getProperty(confDirPropName)).orElse(Paths.get(defaultDirName));
if (!Files.exists(dataDir)) {
try {
// TODO : shall we force the creation ? use a parameter to decide ?
LOG.info("Data directory '{}' does not exist. Creating one ...", dataDir.toAbsolutePath().toString());
Files.createDirectories(dataDir);
} catch (final SecurityException | IOException e) {
throw new BrokerPoolServiceException("Cannot create data directory '" + dataDir.toAbsolutePath().toString() + "'", e);
}
}
// Save it for further use.
configuration.setProperty(confDirPropName, dataDir);
if (!Files.isWritable(dataDir)) {
LOG.warn("Cannot write to data directory: {}", dataDir.toAbsolutePath().toString());
writable = false;
} else {
writable = true;
}
}
use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.
the class FileLockService method prepare.
@Override
public void prepare(final BrokerPool brokerPool) throws BrokerPoolServiceException {
// try to acquire lock on the data dir
final FileLock fileLock = new FileLock(brokerPool, dataDir.resolve(lockFileName));
this.dataLock.compareAndSet(null, fileLock);
try {
final boolean locked = fileLock.tryLock();
if (!locked) {
throw new BrokerPoolServiceException(new EXistException("The directory seems to be locked by another " + "database instance. Found a valid lock file: " + fileLock.getFile().toAbsolutePath().toString()));
}
} catch (final ReadOnlyException e) {
LOG.warn(e);
writable = false;
}
if (!writable) {
brokerPool.setReadOnly();
}
}
use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.
the class JournalManager method prepare.
@Override
public synchronized void prepare(final BrokerPool pool) throws BrokerPoolServiceException {
if (!journallingDisabled) {
try {
this.journal = new Journal(pool, journalDir);
this.journal.initialize();
this.initialized = true;
} catch (final EXistException | ReadOnlyException e) {
throw new BrokerPoolServiceException(e);
}
}
}
use of org.exist.storage.BrokerPoolServiceException in project exist by eXist-db.
the class BlobStoreImplService method startSystem.
@Override
public void startSystem(final DBBroker systemBroker, final Txn transaction) throws BrokerPoolServiceException {
try {
this.blobStore.open();
LOG.info("Opened de-duplicating Blob Store v" + BlobStoreImpl.BLOB_STORE_VERSION + ". metadata={}, store={}/", dataDir.relativize(persistentFile), dataDir.relativize(blobDir));
} catch (final IOException e) {
throw new BrokerPoolServiceException(e);
}
}
Aggregations