本文整理汇总了Java中com.orientechnologies.orient.core.db.ODatabaseInternal类的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseInternal类的具体用法?Java ODatabaseInternal怎么用?Java ODatabaseInternal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ODatabaseInternal类属于com.orientechnologies.orient.core.db包,在下文中一共展示了ODatabaseInternal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onOpen
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onOpen(final ODatabaseInternal iDatabase) {
if (iDatabase.getName().equalsIgnoreCase("OSystem"))
return;
OLogManager.instance().info(this, "loading ES conf for database %s", iDatabase.getName());
final OElasticSearchDatabaseSync db = new OElasticSearchDatabaseSync(iDatabase.getName(), getESClient(iDatabase.getName()));
iDatabase.registerHook(db);
}
示例2: onOpen
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onOpen(final ODatabaseInternal db) {
if (OSecurityNull.class.equals(db.getProperty(ODatabase.OPTIONS.SECURITY.toString()))) {
return; // ignore maintenance operations which run without security, such as index repair
}
if (!startRecording(db)) {
pendingDbs.add(db);
}
}
示例3: onClose
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onClose(final ODatabaseInternal db) {
if (!pendingDbs.remove(db)) {
stopRecording(db);
flushEvents(db);
}
}
示例4: recordEvent
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
private boolean recordEvent(final ODocument document, final EventKind eventKind) {
final OClass schemaType = document.getSchemaClass();
if (schemaType != null) {
final EntityAdapter adapter = recordingAdapters.get(schemaType);
if (adapter != null) {
final ODatabaseInternal db = ODatabaseRecordThreadLocal.INSTANCE.get();
if (db != null) {
// workaround OrientDB 2.1 issue where in-TX dictionary updates are not replicated
if (db.getStorage().isDistributed() && adapter instanceof SingletonEntityAdapter) {
((SingletonEntityAdapter) adapter).singleton.replicate(document, eventKind);
}
Map<ODocument, EventKind> events = dbEvents.get(db);
if (events == null) {
events = new LinkedHashMap<>();
dbEvents.put(db, events);
}
// replace mapping after merge so key always points to the latest document instance
// (avoids a risk that the original key became disconnected/detached at this point)
EventKind updatedEventKind = updateEventKind(events.remove(document), eventKind);
if (updatedEventKind != null) {
events.put(document, updatedEventKind);
}
return true;
}
}
}
return false;
}
示例5: onCreate
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onCreate(final ODatabaseInternal odi) {
appEventLogger.accept(AppEvent.info(ODATABASE_CREATE)
.setData(new ODatabaseLifecycleEvent(odi.getName()))
.build()
);
}
示例6: onOpen
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onOpen(final ODatabaseInternal odi) {
appEventLogger.accept(AppEvent.info(ODATABASE_OPEN)
.setData(new ODatabaseLifecycleEvent(odi.getName()))
.build()
);
}
示例7: onClose
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onClose(final ODatabaseInternal odi) {
appEventLogger.accept(AppEvent.info(ODATABASE_CLOSE)
.setData(new ODatabaseLifecycleEvent(odi.getName()))
.build()
);
}
示例8: onDrop
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onDrop(final ODatabaseInternal odi) {
appEventLogger.accept(AppEvent.info(ODATABASE_DROP)
.setData(new ODatabaseLifecycleEvent(odi.getName()))
.build()
);
}
示例9: onCreateClass
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onCreateClass(final ODatabaseInternal odi, final OClass oclass) {
appEventLogger.accept(AppEvent.info(ODATABASE_CREATE_CLASS)
.setData(new ODatabaseLifecycleClassEvent(odi.getName(), oclass.getName()))
.build()
);
}
示例10: onDropClass
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onDropClass(final ODatabaseInternal odi, final OClass oclass) {
appEventLogger.accept(AppEvent.info(ODATABASE_DROP_CLASS)
.setData(new ODatabaseLifecycleClassEvent(odi.getName(), oclass.getName()))
.build()
);
}
示例11: onDrop
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onDrop(final ODatabaseInternal iDatabase) {
try {
OLogManager.instance().debug(this, "Dropping spatial indexes...");
for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) {
if (idx.getInternal() instanceof OLuceneSpatialIndex) {
OLogManager.instance().debug(this, "- index '%s'", idx.getName());
idx.delete();
}
}
} catch (Exception e) {
OLogManager.instance().warn(this, "Error on dropping spatial indexes", e);
}
}
示例12: onDrop
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onDrop(final ODatabaseInternal iDatabase) {
OLogManager.instance().info(this, "Dropping spatial indexes...");
for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) {
if (idx.getInternal() instanceof OLuceneSpatialIndex) {
OLogManager.instance().info(this, "- index '%s'", idx.getName());
idx.delete();
}
}
}
示例13: castToODatabaseDocument
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
/**
* Utility method to obtain {@link ODatabaseDocument} from {@link ODatabase}
* @param db {@link ODatabase} to cast from
* @return {@link ODatabaseDocument} for a specified {@link ODatabase}
*/
public static ODatabaseDocument castToODatabaseDocument(ODatabase<?> db)
{
while(db!=null && !(db instanceof ODatabaseDocument))
{
if(db instanceof ODatabaseInternal<?>)
{
db = ((ODatabaseInternal<?>)db).getUnderlying();
}
}
return (ODatabaseDocument)db;
}
示例14: onDrop
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onDrop(final ODatabaseInternal iDatabase) {
OLogManager.instance().info(this, "Dropping Lucene indexes...");
for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) {
if (idx.getInternal() instanceof OLuceneIndex) {
OLogManager.instance().info(this, "- index '%s'", idx.getName());
idx.delete();
}
}
}
示例15: onDrop
import com.orientechnologies.orient.core.db.ODatabaseInternal; //导入依赖的package包/类
@Override
public void onDrop(final ODatabaseInternal iDatabase) {
try {
OLogManager.instance().debug(this, "Dropping Lucene indexes...");
for (OIndex idx : iDatabase.getMetadata().getIndexManager().getIndexes()) {
if (idx.getInternal() instanceof OLuceneIndex) {
OLogManager.instance().debug(this, "- index '%s'", idx.getName());
idx.delete();
}
}
} catch (Exception e) {
OLogManager.instance().warn(this, "Error on dropping Lucene indexes", e);
}
}