@Override public Void call(ODatabaseDocumentInternal database) { database.close(); return null; } });
@Override public Void call(ODatabaseDocumentInternal database) { database.close(); return null; } });
public void close() { database.close(); }
@Override public void close() { db.close(); orientDB.close(); }
@Override public void close() { clearOwner(); if (internal != null) { delegateStorage = internal.getStorage(); internal.close(); internal = null; } }
public void switchUser(final String iUserName, final String iUserPassword) { if (!database.isClosed()) database.close(); database.open(iUserName, iUserPassword); }
/** * Closes the console freeing all the used resources. */ public void close() { if (currentDatabase != null) { currentDatabase.activateOnCurrentThread(); currentDatabase.close(); currentDatabase = null; } if (orientDB != null) { orientDB.close(); } currentResultSet = null; currentRecord = null; currentResult = null; commandBuffer.setLength(0); }
@ConsoleCommand(description = "Delete the current database", onlineHelp = "Console-Command-Drop-Database") public void dropDatabase( @ConsoleParameter(name = "storage-type", description = "Storage type of server database", optional = true) String storageType) throws IOException { checkForDatabase(); final String dbName = currentDatabase.getName(); currentDatabase.close(); if (storageType != null && !"plocal".equalsIgnoreCase(storageType)&& !"local".equalsIgnoreCase(storageType)&& !"memory".equalsIgnoreCase(storageType)) { message("\n\nInvalid storage type for db: '" + storageType + "'"); return; } orientDB.drop(dbName); currentDatabase = null; currentDatabaseName = null; message("\n\nDatabase '" + dbName + "' deleted successfully"); }
db.activateOnCurrentThread(); db.declareIntent(null); db.close(); if (walActive) OGlobalConfiguration.USE_WAL.setValue(true);
@Override public void drop(String name, String user, String password) { synchronized (this) { checkOpen(); } ODatabaseDocumentInternal db = openNoAuthenticate(name, user); for (Iterator<ODatabaseLifecycleListener> it = orient.getDbLifecycleListeners(); it.hasNext(); ) { it.next().onDrop(db); } db.close(); synchronized (this) { if (exists(name, user, password)) { OAbstractPaginatedStorage storage = getOrInitStorage(name); ODatabaseDocumentEmbedded.deInit(storage); storage.delete(); storages.remove(name); } } }
@ConsoleCommand(aliases = { "close database" }, description = "Disconnect from the current database", onlineHelp = "Console-Command-Disconnect") public void disconnect() { if (currentDatabase != null) { message("\nDisconnecting from the database [" + currentDatabaseName + "]..."); final OStorage stg = currentDatabase.getStorage(); currentDatabase.activateOnCurrentThread(); if (!currentDatabase.isClosed()) currentDatabase.close(); // FORCE CLOSING OF STORAGE: THIS CLEAN UP REMOTE CONNECTIONS if (stg != null) stg.close(true, false); currentDatabase = null; currentDatabaseName = null; currentRecord = null; message("OK"); out.println(); } urlConnection = null; if (orientDB != null) { orientDB.close(); } }
} finally { if (tx) { db.close();
} finally { if (tx) { db.close();
} finally { if (tx) { db.close();
localDatabase.close();
if (db != null) { try { db.close(); } catch (Exception e) { OLogManager.instance().error(this, "Error during database close", e);
@Override public boolean authenticate(String username, String password) { ODatabaseDocumentInternal currentDB = getDatabase(); try { boolean inTransaction = currentDB.getTransaction().isActive(); IOrientDbSettings settings = OrientDbWebApplication.get().getOrientDbSettings(); ODatabaseDocumentInternal newDB = settings.getDatabasePoolFactory().get(settings.getDBUrl(), username, password).acquire(); if(newDB!=currentDB) { currentDB.activateOnCurrentThread(); currentDB.commit(); currentDB.close(); newDB.activateOnCurrentThread(); } setUser(username, password); userModel.setObject(newDB.getUser().getDocument()); // user = newDB.getMetadata().getSecurity().getUser(username); // newDB.setUser(user); if(inTransaction && !newDB.getTransaction().isActive()) newDB.begin(); return true; } catch (OSecurityAccessException e) { currentDB.activateOnCurrentThread(); return false; } }
@Override public boolean authenticate(String username, String password) { ODatabaseDocumentInternal currentDB = getDatabase(); try { boolean inTransaction = currentDB.getTransaction().isActive(); IOrientDbSettings settings = OrientDbWebApplication.get().getOrientDbSettings(); ODatabaseDocumentInternal newDB = settings.getDatabasePoolFactory().get(settings.getDBUrl(), username, password).acquire(); if(newDB!=currentDB) { currentDB.activateOnCurrentThread(); currentDB.commit(); currentDB.close(); newDB.activateOnCurrentThread(); } setUser(username, password); userModel.setObject(newDB.getUser().getDocument()); // user = newDB.getMetadata().getSecurity().getUser(username); // newDB.setUser(user); if(inTransaction && !newDB.getTransaction().isActive()) newDB.begin(); return true; } catch (OSecurityAccessException e) { currentDB.activateOnCurrentThread(); return false; } }
try { if (closeDb) { getDatabase().close(); if (getDatabase().isPooled()) { database = null;