Search in sources :

Example 1 with DatabaseNotFoundException

use of com.sleepycat.je.DatabaseNotFoundException in project qpid-broker-j by apache.

the class AbstractBDBPreferenceStore method getPreferencesVersionDb.

private Database getPreferencesVersionDb() {
    Database preferencesVersionDb;
    try {
        DatabaseConfig config = new DatabaseConfig().setTransactional(true).setAllowCreate(false);
        preferencesVersionDb = getEnvironmentFacade().openDatabase(PREFERENCES_VERSION_DB_NAME, config);
    } catch (DatabaseNotFoundException e) {
        preferencesVersionDb = updateVersion(null, BrokerModel.MODEL_VERSION);
    }
    return preferencesVersionDb;
}
Also used : DatabaseNotFoundException(com.sleepycat.je.DatabaseNotFoundException) Database(com.sleepycat.je.Database) DatabaseConfig(com.sleepycat.je.DatabaseConfig)

Example 2 with DatabaseNotFoundException

use of com.sleepycat.je.DatabaseNotFoundException in project qpid-broker-j by apache.

the class BDBLinkStore method getLinksVersionDb.

private Database getLinksVersionDb() {
    Database linksVersionDb;
    try {
        DatabaseConfig config = new DatabaseConfig().setTransactional(true).setAllowCreate(false);
        linksVersionDb = getEnvironmentFacade().openDatabase(LINKS_VERSION_DB_NAME, config);
    } catch (DatabaseNotFoundException e) {
        updateVersion(null, BrokerModel.MODEL_VERSION);
        linksVersionDb = getEnvironmentFacade().openDatabase(LINKS_VERSION_DB_NAME, DEFAULT_DATABASE_CONFIG);
    }
    return linksVersionDb;
}
Also used : DatabaseNotFoundException(com.sleepycat.je.DatabaseNotFoundException) Database(com.sleepycat.je.Database) DatabaseConfig(com.sleepycat.je.DatabaseConfig)

Example 3 with DatabaseNotFoundException

use of com.sleepycat.je.DatabaseNotFoundException in project BIMserver by opensourceBIM.

the class Database method initInternalStructure.

public void initInternalStructure(DatabaseSession databaseSession) throws BimserverLockConflictException, BimserverDatabaseException {
    RecordIterator recordIterator = keyValueStore.getRecordIterator(CLASS_LOOKUP_TABLE, databaseSession);
    try {
        Record record = recordIterator.next();
        while (record != null) {
            String packageAndClassName = BinUtils.byteArrayToString(record.getValue());
            String packageName = packageAndClassName.substring(0, packageAndClassName.indexOf("_"));
            String className = packageAndClassName.substring(packageAndClassName.indexOf("_") + 1);
            EClass eClass = (EClass) getEClassifier(packageName, className);
            // TODO geometry?
            boolean transactional = !(eClass.getEPackage() == Ifc2x3tc1Package.eINSTANCE || eClass.getEPackage() == Ifc4Package.eINSTANCE);
            keyValueStore.openTable(databaseSession, packageAndClassName, transactional);
            for (EStructuralFeature eStructuralFeature : eClass.getEAllStructuralFeatures()) {
                if (eStructuralFeature.getEAnnotation("singleindex") != null) {
                    String indexTableName = eClass.getEPackage().getName() + "_" + eClass.getName() + "_" + eStructuralFeature.getName();
                    try {
                        keyValueStore.openIndexTable(databaseSession, indexTableName, transactional);
                    } catch (DatabaseNotFoundException e) {
                    }
                }
            }
            Short cid = BinUtils.byteArrayToShort(record.getKey());
            cidToEclass[cid] = eClass;
            eClassToCid.put(eClass, cid);
            record = recordIterator.next();
        }
    } finally {
        recordIterator.close();
    }
}
Also used : EClass(org.eclipse.emf.ecore.EClass) DatabaseNotFoundException(com.sleepycat.je.DatabaseNotFoundException) EStructuralFeature(org.eclipse.emf.ecore.EStructuralFeature)

Aggregations

DatabaseNotFoundException (com.sleepycat.je.DatabaseNotFoundException)3 Database (com.sleepycat.je.Database)2 DatabaseConfig (com.sleepycat.je.DatabaseConfig)2 EClass (org.eclipse.emf.ecore.EClass)1 EStructuralFeature (org.eclipse.emf.ecore.EStructuralFeature)1