use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method listProperties.
@ConsoleCommand(description = "Display the database properties")
public void listProperties() {
if (currentDatabase == null)
return;
final OStorage stg = currentDatabase.getStorage();
final OStorageConfiguration dbCfg = stg.getConfiguration();
message("\n\nDATABASE PROPERTIES");
if (dbCfg.getProperties() != null) {
final List<ODocument> resultSet = new ArrayList<ODocument>();
if (dbCfg.name != null)
resultSet.add(new ODocument().field("NAME", "Name").field("VALUE", dbCfg.name));
resultSet.add(new ODocument().field("NAME", "Version").field("VALUE", dbCfg.version));
resultSet.add(new ODocument().field("NAME", "Conflict-Strategy").field("VALUE", dbCfg.getConflictStrategy()));
resultSet.add(new ODocument().field("NAME", "Date-Format").field("VALUE", dbCfg.dateFormat));
resultSet.add(new ODocument().field("NAME", "Datetime-Format").field("VALUE", dbCfg.dateTimeFormat));
resultSet.add(new ODocument().field("NAME", "Timezone").field("VALUE", dbCfg.getTimeZone().getID()));
resultSet.add(new ODocument().field("NAME", "Locale-Country").field("VALUE", dbCfg.getLocaleCountry()));
resultSet.add(new ODocument().field("NAME", "Locale-Language").field("VALUE", dbCfg.getLocaleLanguage()));
resultSet.add(new ODocument().field("NAME", "Charset").field("VALUE", dbCfg.getCharset()));
resultSet.add(new ODocument().field("NAME", "Schema-RID").field("VALUE", dbCfg.schemaRecordId, OType.LINK));
resultSet.add(new ODocument().field("NAME", "Index-Manager-RID").field("VALUE", dbCfg.indexMgrRecordId, OType.LINK));
resultSet.add(new ODocument().field("NAME", "Dictionary-RID").field("VALUE", dbCfg.dictionaryRecordId, OType.LINK));
final OTableFormatter formatter = new OTableFormatter(this);
formatter.writeRecords(resultSet, -1);
message("\n");
if (!dbCfg.getProperties().isEmpty()) {
message("\n\nDATABASE CUSTOM PROPERTIES:");
final List<ODocument> dbResultSet = new ArrayList<ODocument>();
for (OStorageEntryConfiguration cfg : dbCfg.getProperties()) dbResultSet.add(new ODocument().field("NAME", cfg.name).field("VALUE", cfg.value));
final OTableFormatter dbFormatter = new OTableFormatter(this);
dbFormatter.writeRecords(dbResultSet, -1);
}
}
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class LocalCreateBinaryDocumentSpeedTest method cycle.
@Override
@Test(enabled = false)
public void cycle() {
final OStorage storage = database.getStorage();
((OAbstractPaginatedStorage) storage).startGatheringPerformanceStatisticForCurrentThread();
record = new ORecordBytes(database, payload);
record.save();
if (data.getCyclesDone() == data.getCycles() - 1)
database.commit();
OSessionStoragePerformanceStatistic sessionStoragePerformanceStatistic = ((OAbstractPaginatedStorage) storage).completeGatheringPerformanceStatisticForCurrentThread();
System.out.println(sessionStoragePerformanceStatistic.toDocument().toJSON("prettyPrint"));
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class OConsoleDatabaseApp method info.
@ConsoleCommand(aliases = { "status" }, description = "Display information about the database", onlineHelp = "Console-Command-Info")
public void info() {
if (currentDatabaseName != null) {
message("\nCurrent database: " + currentDatabaseName + " (url=" + currentDatabase.getURL() + ")");
final OStorage stg = currentDatabase.getStorage();
if (stg instanceof OStorageRemote) {
listServers();
}
listProperties();
listClusters(null);
listClasses();
listIndexes();
}
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class OServerAdmin method dropDatabase.
/**
* Drops a database from a remote server instance.
*
* @param iDatabaseName The database name
* @param storageType Storage type between "plocal" or "memory".
* @return The instance itself. Useful to execute method in chain
* @throws IOException
*/
public synchronized OServerAdmin dropDatabase(final String iDatabaseName, final String storageType) throws IOException {
boolean retry = true;
while (retry) {
retry = networkAdminOperation(new OStorageRemoteOperation<Boolean>() {
@Override
public Boolean execute(final OChannelBinaryAsynchClient network, OStorageRemoteSession session) throws IOException {
try {
try {
storage.beginRequest(network, OChannelBinaryProtocol.REQUEST_DB_DROP, session);
network.writeString(iDatabaseName);
network.writeString(storageType);
} finally {
storage.endRequest(network);
}
storage.getResponse(network, session);
return false;
} catch (OModificationOperationProhibitedException oope) {
return handleDBFreeze();
}
}
}, "Cannot delete the remote storage: " + storage.getName());
}
final Set<OStorage> underlyingStorages = new HashSet<OStorage>();
for (OStorage s : Orient.instance().getStorages()) {
if (s.getType().equals(storage.getType()) && s.getName().equals(storage.getName())) {
underlyingStorages.add(s.getUnderlying());
}
}
for (OStorage s : underlyingStorages) {
s.close(true, true);
}
ODatabaseRecordThreadLocal.INSTANCE.remove();
return this;
}
use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.
the class OPartitionedDatabasePool method close.
public void close() {
if (closed)
return;
closed = true;
for (PoolPartition partition : partitions) {
if (partition == null)
continue;
final Queue<DatabaseDocumentTxPooled> queue = partition.queue;
while (!queue.isEmpty()) {
DatabaseDocumentTxPooled db = queue.poll();
db.activateOnCurrentThread();
OStorage storage = db.getStorage();
storage.close();
ODatabaseRecordThreadLocal.INSTANCE.remove();
}
}
partitions = null;
poolData = null;
}
Aggregations