Search in sources :

Example 16 with OStorage

use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.

the class OPropertyImpl method setLinkedType.

public OProperty setLinkedType(final OType linkedType) {
    getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE);
    checkLinkTypeSupport(getType());
    acquireSchemaWriteLock();
    try {
        final ODatabaseDocumentInternal database = getDatabase();
        final OStorage storage = database.getStorage();
        if (storage instanceof OStorageProxy) {
            final String cmd = String.format("alter property %s linkedtype %s", getFullNameQuoted(), linkedType);
            database.command(new OCommandSQL(cmd)).execute();
        } else if (isDistributedCommand()) {
            final String cmd = String.format("alter property %s linkedtype %s", getFullNameQuoted(), linkedType);
            final OCommandSQL commandSQL = new OCommandSQL(cmd);
            commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId());
            database.command(commandSQL).execute();
            setLinkedTypeInternal(linkedType);
        } else
            setLinkedTypeInternal(linkedType);
    } finally {
        releaseSchemaWriteLock();
    }
    return this;
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) OAutoshardedStorage(com.orientechnologies.orient.core.storage.OAutoshardedStorage) OStorageProxy(com.orientechnologies.orient.core.storage.OStorageProxy) OStorage(com.orientechnologies.orient.core.storage.OStorage) ODatabaseDocumentInternal(com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)

Example 17 with OStorage

use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.

the class OPropertyImpl method setCustom.

public OPropertyImpl setCustom(final String name, final String value) {
    getDatabase().checkSecurity(ORule.ResourceGeneric.SCHEMA, ORole.PERMISSION_UPDATE);
    acquireSchemaWriteLock();
    try {
        final String cmd = String.format("alter property %s custom %s=%s", getFullNameQuoted(), name, quoteString(value));
        final ODatabaseDocumentInternal database = getDatabase();
        final OStorage storage = database.getStorage();
        if (storage instanceof OStorageProxy) {
            database.command(new OCommandSQL(cmd)).execute();
        } else if (isDistributedCommand()) {
            final OCommandSQL commandSQL = new OCommandSQL(cmd);
            commandSQL.addExcludedNode(((OAutoshardedStorage) storage).getNodeId());
            database.command(commandSQL).execute();
            setCustomInternal(name, value);
        } else
            setCustomInternal(name, value);
    } finally {
        releaseSchemaWriteLock();
    }
    return this;
}
Also used : OCommandSQL(com.orientechnologies.orient.core.sql.OCommandSQL) OAutoshardedStorage(com.orientechnologies.orient.core.storage.OAutoshardedStorage) OStorageProxy(com.orientechnologies.orient.core.storage.OStorageProxy) OStorage(com.orientechnologies.orient.core.storage.OStorage) ODatabaseDocumentInternal(com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)

Example 18 with OStorage

use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.

the class OIndexManagerAbstract method getServerLocale.

protected Locale getServerLocale() {
    ODatabaseDocumentInternal db = getDatabase();
    OStorage storage = db.getStorage();
    OStorageConfiguration configuration = storage.getConfiguration();
    return configuration.getLocaleInstance();
}
Also used : OStorage(com.orientechnologies.orient.core.storage.OStorage) OStorageConfiguration(com.orientechnologies.orient.core.config.OStorageConfiguration) ODatabaseDocumentInternal(com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)

Example 19 with OStorage

use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.

the class OIndexManagerShared method autoRecreateIndexesAfterCrash.

public boolean autoRecreateIndexesAfterCrash() {
    if (rebuildCompleted)
        return false;
    final ODatabaseDocumentInternal database = ODatabaseRecordThreadLocal.INSTANCE.get();
    final OStorage storage = database.getStorage().getUnderlying();
    if (storage instanceof OAbstractPaginatedStorage) {
        OAbstractPaginatedStorage paginatedStorage = (OAbstractPaginatedStorage) storage;
        return paginatedStorage.wereDataRestoredAfterOpen() && paginatedStorage.wereNonTxOperationsPerformedInPreviousOpen();
    }
    return false;
}
Also used : OStorage(com.orientechnologies.orient.core.storage.OStorage) OAbstractPaginatedStorage(com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage) ODatabaseDocumentInternal(com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)

Example 20 with OStorage

use of com.orientechnologies.orient.core.storage.OStorage in project orientdb by orientechnologies.

the class OIndexDefinitionFactory method getServerLocale.

private static Locale getServerLocale() {
    ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.get();
    OStorage storage = db.getStorage();
    OStorageConfiguration configuration = storage.getConfiguration();
    return configuration.getLocaleInstance();
}
Also used : OStorage(com.orientechnologies.orient.core.storage.OStorage) OStorageConfiguration(com.orientechnologies.orient.core.config.OStorageConfiguration) ODatabaseDocumentInternal(com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)

Aggregations

OStorage (com.orientechnologies.orient.core.storage.OStorage)90 ODatabaseDocumentInternal (com.orientechnologies.orient.core.db.ODatabaseDocumentInternal)31 OCommandSQL (com.orientechnologies.orient.core.sql.OCommandSQL)23 ODocument (com.orientechnologies.orient.core.record.impl.ODocument)22 ODatabaseDocumentTx (com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx)21 ORecordId (com.orientechnologies.orient.core.id.ORecordId)20 OAutoshardedStorage (com.orientechnologies.orient.core.storage.OAutoshardedStorage)18 OStorageProxy (com.orientechnologies.orient.core.storage.OStorageProxy)18 OPhysicalPosition (com.orientechnologies.orient.core.storage.OPhysicalPosition)12 OAbstractPaginatedStorage (com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage)11 File (java.io.File)11 ORID (com.orientechnologies.orient.core.id.ORID)10 OIdentifiable (com.orientechnologies.orient.core.db.record.OIdentifiable)7 ORidBag (com.orientechnologies.orient.core.db.record.ridbag.ORidBag)7 Test (org.testng.annotations.Test)7 OClass (com.orientechnologies.orient.core.metadata.schema.OClass)6 OSchema (com.orientechnologies.orient.core.metadata.schema.OSchema)6 OCommandOutputListener (com.orientechnologies.orient.core.command.OCommandOutputListener)5 OSchemaException (com.orientechnologies.orient.core.exception.OSchemaException)5 AtomicLong (java.util.concurrent.atomic.AtomicLong)5