Search in sources :

Example 1 with ORecordSerializerFactory

use of com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializerFactory in project orientdb by orientechnologies.

the class ODatabaseDocumentTx method initAtFirstOpen.

private void initAtFirstOpen(String iUserName, String iUserPassword) {
    if (initialized)
        return;
    ORecordSerializerFactory serializerFactory = ORecordSerializerFactory.instance();
    String serializeName = getStorage().getConfiguration().getRecordSerializer();
    if (serializeName == null) {
        throw new ODatabaseException("Database created with orientdb version not supported anymore, use export+import to migrate the database");
    }
    serializer = serializerFactory.getFormat(serializeName);
    if (serializer == null)
        throw new ODatabaseException("RecordSerializer with name '" + serializeName + "' not found ");
    if (getStorage().getConfiguration().getRecordSerializerVersion() > serializer.getMinSupportedVersion())
        throw new ODatabaseException("Persistent record serializer version is not support by the current implementation");
    componentsFactory = getStorage().getComponentsFactory();
    localCache.startup();
    user = null;
    metadata = new OMetadataDefault(this);
    metadata.load();
    recordFormat = DEF_RECORD_FORMAT;
    if (!(getStorage() instanceof OStorageProxy)) {
        if (metadata.getIndexManager().autoRecreateIndexesAfterCrash()) {
            metadata.getIndexManager().recreateIndexes();
            activateOnCurrentThread();
            user = null;
        }
        installHooksEmbedded();
        registerHook(new OCommandCacheHook(this), ORecordHook.HOOK_POSITION.REGULAR);
        registerHook(new OSecurityTrackerHook(metadata.getSecurity(), this), ORecordHook.HOOK_POSITION.LAST);
        user = null;
    } else if (iUserName != null && iUserPassword != null) {
        user = new OImmutableUser(-1, new OUser(iUserName, OUser.encryptPassword(iUserPassword)).addRole(new ORole("passthrough", null, ORole.ALLOW_MODES.ALLOW_ALL_BUT)));
        installHooksRemote();
    }
    initialized = true;
}
Also used : ORecordSerializerFactory(com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializerFactory) OMetadataDefault(com.orientechnologies.orient.core.metadata.OMetadataDefault) OCommandCacheHook(com.orientechnologies.orient.core.cache.OCommandCacheHook)

Aggregations

OCommandCacheHook (com.orientechnologies.orient.core.cache.OCommandCacheHook)1 OMetadataDefault (com.orientechnologies.orient.core.metadata.OMetadataDefault)1 ORecordSerializerFactory (com.orientechnologies.orient.core.serialization.serializer.record.ORecordSerializerFactory)1