use of com.orientechnologies.orient.core.storage.impl.memory.ODirectMemoryStorage in project orientdb by orientechnologies.
the class OServer method openDatabase.
public ODatabase<?> openDatabase(final String iDbUrl, final OToken iToken) {
final String path = getStoragePath(iDbUrl);
final ODatabaseInternal<?> database = new ODatabaseDocumentTx(path);
if (database.isClosed()) {
final OStorage storage = database.getStorage();
if (storage instanceof ODirectMemoryStorage && !storage.exists())
database.create();
else
database.open(iToken);
}
return database;
}
use of com.orientechnologies.orient.core.storage.impl.memory.ODirectMemoryStorage in project orientdb by orientechnologies.
the class OServer method openDatabase.
public ODatabaseDocumentTx openDatabase(final ODatabaseDocumentTx database, final String user, final String password, final ONetworkProtocolData data, final boolean iBypassAccess) {
final OStorage storage = database.getStorage();
if (database.isClosed()) {
if (storage instanceof ODirectMemoryStorage && !storage.exists()) {
try {
database.create();
} catch (OStorageException e) {
}
} else {
if (iBypassAccess) {
// BYPASS SECURITY
openDatabaseBypassingSecurity(database, data, user);
} else {
// TRY WITH SERVER'S AUTHENTICATION
OServerUserConfiguration serverUser = serverLogin(user, password, "database.passthrough");
if (serverUser != null) {
// Why do we use the returned serverUser name instead of just passing-in user?
// Because in some security implementations the user is embedded inside a ticket of some kind
// that must be decrypted to retrieve the actual user identity. If serverLogin() is successful,
// that user identity is returned.
// SERVER AUTHENTICATED, BYPASS SECURITY
openDatabaseBypassingSecurity(database, data, serverUser.name);
} else {
// TRY DATABASE AUTHENTICATION
database.open(user, password);
if (data != null) {
data.serverUser = false;
data.serverUsername = null;
}
}
}
}
}
return database;
}
Aggregations