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;
}
Aggregations