• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ODatabaseDocumentInternal类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.orientechnologies.orient.core.db.ODatabaseDocumentInternal的典型用法代码示例。如果您正苦于以下问题:Java ODatabaseDocumentInternal类的具体用法?Java ODatabaseDocumentInternal怎么用?Java ODatabaseDocumentInternal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ODatabaseDocumentInternal类属于com.orientechnologies.orient.core.db包,在下文中一共展示了ODatabaseDocumentInternal类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doFilter

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws ServletException
{
    try
    {
        chain.doFilter(request, response);
    }
    catch (IOException e)
    {
        throw new ServletException(e);
    }
    finally
    {
        ODatabaseDocumentInternal database = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
        if (database != null)
        {
            database.close();
            ODatabaseRecordThreadLocal.INSTANCE.remove();
        }
    }
}
 
开发者ID:geekflow,项目名称:light,代码行数:22,代码来源:OrientDBFilter.java


示例2: withActiveDb

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
private static <T> T withActiveDb(final ODatabase db, final Supplier<T> supplier) {
  @SuppressWarnings("resource")
  final ODatabaseDocumentInternal currentDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
  if (db.equals(currentDb) || !(db instanceof ODatabaseDocumentInternal)) {
    return supplier.get();
  }
  try {
    ODatabaseRecordThreadLocal.INSTANCE.set((ODatabaseDocumentInternal) db);
    return supplier.get();
  }
  finally {
    if (currentDb != null) {
      ODatabaseRecordThreadLocal.INSTANCE.set(currentDb);
    }
    else {
      ODatabaseRecordThreadLocal.INSTANCE.remove();
    }
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:20,代码来源:EntityHook.java


示例3: createIndex

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@Override
public OIndexInternal<?> createIndex(String name, ODatabaseDocumentInternal database, String indexType, String algorithm,
                                     String valueContainerAlgorithm, ODocument metadata, int version)
    throws OConfigurationException {

  OAbstractPaginatedStorage storage = (OAbstractPaginatedStorage) database.getStorage()
                                                                          .getUnderlying();

  OBinarySerializer<?> objectSerializer = storage.getComponentsFactory().binarySerializerFactory
      .getObjectSerializer(OLuceneMockSpatialSerializer.INSTANCE.getId());

  if (objectSerializer == null) {
    storage.getComponentsFactory().binarySerializerFactory
        .registerSerializer(OLuceneMockSpatialSerializer.INSTANCE, OType.EMBEDDED);
  }

  if (metadata == null)
    metadata = new ODocument().field("analyzer", StandardAnalyzer.class.getName());

  if (OClass.INDEX_TYPE.SPATIAL.toString()
                               .equals(indexType)) {

    return new OLuceneSpatialIndex(name, indexType, LUCENE_ALGORITHM, version, storage, valueContainerAlgorithm, metadata);
  }
  throw new OConfigurationException("Unsupported type : " + algorithm);
}
 
开发者ID:orientechnologies,项目名称:orientdb-spatial,代码行数:27,代码来源:OLuceneSpatialIndexFactory.java


示例4: execute

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
/**
 * @return result of execution
 */
public final V execute()
{
	ODatabaseDocument db = null;
	ODatabaseDocument oldDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
	if(oldDb!=null) ODatabaseRecordThreadLocal.INSTANCE.remove(); //Required to avoid stack of transactions
	try
	{
		db = getSettings().getDatabasePoolFactory().get(getDBUrl(), getUsername(), getPassword()).acquire();
		db.activateOnCurrentThread();
		return execute(db);
	} 
	finally
	{
		if(db!=null) db.close();
		if(oldDb!=null) ODatabaseRecordThreadLocal.INSTANCE.set((ODatabaseDocumentInternal)oldDb);
		else ODatabaseRecordThreadLocal.INSTANCE.remove();
	}
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:22,代码来源:DBClosure.java


示例5: getThreadDatabase

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@Override
public ODatabaseDocumentInternal getThreadDatabase() {
	IOrientDbSettings settings = app.getOrientDbSettings();
	OrientDbWebSession session = OrientDbWebSession.exists()?OrientDbWebSession.get():null;
	ODatabaseDocumentInternal db;
	String username;
	String password;
	if(session!=null && session.isSignedIn())
	{
		username = session.getUsername();
		password = session.getPassword();
	}
	else
	{
		username = settings.getGuestUserName();
		password = settings.getGuestPassword();
	}
	db = settings.getDatabasePoolFactory().get(settings.getDBUrl(), username, password).acquire();
	return db;
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:21,代码来源:DefaultODatabaseThreadLocalFactory.java


示例6: buildFacetIndexIfNeeded

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
protected void buildFacetIndexIfNeeded() throws IOException {

    if (metadata != null && metadata.containsField(FACET_FIELDS)) {
      ODatabaseDocumentInternal database = owner.getDatabase();
      Iterable<String> iterable = metadata.field(FACET_FIELDS);
      if (iterable != null) {
        Directory dir = getTaxDirectory(database);
        taxonomyWriter = new DirectoryTaxonomyWriter(dir, IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
        for (String s : iterable) {
          facetField = s;
          // facetField = "facet_" + s;
          // facetDim = s;
          // config.setIndexFieldName(s, "facet_" + s);
          config.setHierarchical(s, true);
        }
      }

    }
  }
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:20,代码来源:OLuceneFacetManager.java


示例7: internalDelete

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
protected void internalDelete(String indexName) {
  try {
    if (mgrWriter != null && mgrWriter.getIndexWriter() != null) {
      closeIndex();
    }
    ODatabaseDocumentInternal database = getDatabase();
    final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
    if (storageLocalAbstract instanceof OLocalPaginatedStorage) {

      OLocalPaginatedStorage localAbstract = (OLocalPaginatedStorage) storageLocalAbstract;

      File f = new File(getIndexPath(localAbstract, indexName));
      OLuceneIndexUtils.deleteFolder(f);
      f = new File(getIndexBasePath(localAbstract));
      OLuceneIndexUtils.deleteFolderIfEmpty(f);
    }
  } catch (IOException e) {
    OLogManager.instance().error(this, "Error on deleting Lucene index", e);
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:21,代码来源:OLuceneIndexManagerAbstract.java


示例8: delete

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
public void delete() {
  if (mgrWriter == null)
    // INDEX NOT COMPLETELY INITIALIZED, SKIP IT
    return;

  try {
    if (mgrWriter.getIndexWriter() != null) {
      closeIndex();
    }
    ODatabaseDocumentInternal database = getDatabase();
    final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
    if (storageLocalAbstract instanceof OLocalPaginatedStorage) {

      File f = new File(getIndexPath((OLocalPaginatedStorage) storageLocalAbstract));
      OLuceneIndexUtils.deleteFolder(f);
      f = new File(getIndexBasePath((OLocalPaginatedStorage) storageLocalAbstract));
      OLuceneIndexUtils.deleteFolderIfEmpty(f);
    }
  } catch (IOException e) {
    OLogManager.instance().error(this, "Error on deleting Lucene index", e);
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:23,代码来源:OLuceneIndexManagerAbstract.java


示例9: getSyncFields

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
/**
 * Returns null if the record must be not synchronized, other wise the set of fields to synchronize. An empty set means all the
 * fields.
 */
public Set<String> getSyncFields(final ODocument record) {
  final String className = record.getClassName();
  if (className == null)
    return null;

  if (excludeClasses.contains(className))
    return null;

  final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.get();

  final String clusterName = db.getClusterNameById(record.getIdentity().getClusterId());
  if (excludeClasses.contains(clusterName))
    return null;

  if (!includeClasses.isEmpty()) {
    if (includeClasses.containsKey(className))
      return includeClasses.get(className);
  }

  if (!includeClusters.isEmpty()) {
    if (includeClusters.containsKey(clusterName))
      return includeClusters.get(clusterName);
  }

  // SYNCHRONIZE ALL FIELDS
  return Collections.EMPTY_SET;
}
 
开发者ID:orientechnologies,项目名称:orientdb-elasticsearch,代码行数:32,代码来源:OElasticSearchDatabaseConfiguration.java


示例10: storage

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
private OLocalPaginatedStorage storage() {
  if (storage == null || storage.isClosed()) {
    // use temp TX to get local storage; note we don't need a TX when reading write-ahead-log
    ODatabaseDocumentInternal currentDb = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
    try (ODatabaseDocumentInternal db = databaseProvider.get().acquire()) {
      storage = (OLocalPaginatedStorage) db.getStorage().getUnderlying();
    }
    finally {
      ODatabaseRecordThreadLocal.INSTANCE.set(currentDb);
    }
  }
  return storage;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:EntityLog.java


示例11: browseComponentAssets

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
private Iterable<ODocument> browseComponentAssets(final ODocument component) {
  checkNotNull(component);
  OIdentifiable bucket = component.field(ComponentEntityAdapter.P_BUCKET, OIdentifiable.class);
  ODatabaseDocumentInternal db = component.getDatabase();
  Iterable<ODocument> results = db
      .command(new OCommandSQL("select from asset where bucket = :bucket and component = :component")).execute(
          new ImmutableMap.Builder<String, Object>()
              .put("bucket", bucket.getIdentity())
              .put("component", component.getIdentity())
              .build()
      );
  return results;
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:14,代码来源:ContentAuth.java


示例12: withOtherDatabase

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
/**
 * Utility function for working around "ODatabaseException: Database instance is not set in current thread" issues.
 * The current database ThreadLocal is preserved and restored after calling the lambda.
 */
public static <T> T withOtherDatabase(Callable<T> function) {
  final ODatabaseDocumentInternal db = ODatabaseRecordThreadLocal.INSTANCE.getIfDefined();
  try {
    return function.call();
  }
  catch (Exception e) {
    Throwables.throwIfUnchecked(e);
    throw new RuntimeException(e);
  }
  finally {
    ODatabaseRecordThreadLocal.INSTANCE.set(db);
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:18,代码来源:DatabaseThreadUtils.java


示例13: authenticate

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@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;
		}
	}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:28,代码来源:OrientDbWebSession.java


示例14: start

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@Override
public void start(RequestCycle cycle) {
	OrientDbWebSession session = OrientDbWebSession.get();
	ODatabaseDocumentInternal db = session.getDatabase();
	//It's required to have ability to check security rights locally
	OSecurityUser oUser = session.getUser();
	OSecurityUser dbUser = db.getUser();
	if(oUser!=null && oUser.getDocument()!=null 
			&& oUser.getDocument().getIdentity()!=null 
			&& (!oUser.getDocument().getIdentity().isValid() || dbUser==null || !Objects.equal(dbUser.getName(), oUser.getName())))
	{
		db.setUser(db.getMetadata().getSecurity().getUser(oUser.getName()));
	}
	db.begin();
}
 
开发者ID:OrienteerBAP,项目名称:wicket-orientdb,代码行数:16,代码来源:TransactionRequestCycleListener.java


示例15: getTaxDirectory

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
private Directory getTaxDirectory(ODatabaseDocumentInternal database) throws IOException {
  Directory dir = null;
  final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
  if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
    String pathname = getIndexFacetPath((OLocalPaginatedStorage) storageLocalAbstract);
    dir = NIOFSDirectory.open(new File(pathname));
  } else {
    dir = new RAMDirectory();
  }
  return dir;
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:12,代码来源:OLuceneFacetManager.java


示例16: delete

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
public void delete() {
  ODatabaseDocumentInternal database = owner.getDatabase();
  final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
  if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
    File f = new File(getIndexFacetPath((OLocalPaginatedStorage) storageLocalAbstract));
    OLuceneIndexUtils.deleteFolder(f);
    f = new File(owner.getIndexBasePath((OLocalPaginatedStorage) storageLocalAbstract));
    OLuceneIndexUtils.deleteFolderIfEmpty(f);
  }
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:11,代码来源:OLuceneFacetManager.java


示例17: reOpen

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
private void reOpen(final ODocument metadata) throws IOException {
  ODatabaseDocumentInternal database = getDatabase();

  final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
  Directory dir = null;
  if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
    String pathname = getIndexPath((OLocalPaginatedStorage) storageLocalAbstract);

    OLogManager.instance().debug(this, "Opening NIOFS Lucene db=%s, path=%s", database.getName(), pathname);

    dir = NIOFSDirectory.open(new File(pathname));
  } else {

    OLogManager.instance().debug(this, "Opening RAM Lucene index db=%s", database.getName());
    dir = new RAMDirectory();

  }

  final IndexWriter indexWriter = createIndexWriter(dir, metadata);
  mgrWriter = new TrackingIndexWriter(indexWriter);
  searcherManager = new SearcherManager(indexWriter, true, null);
  if (nrt != null) {
    nrt.close();
  }

  nrt = new ControlledRealTimeReopenThread(mgrWriter, searcherManager, 60.00, 0.1);
  nrt.setDaemon(true);
  nrt.start();
  flush();
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:31,代码来源:OLuceneIndexManagerAbstract.java


示例18: createLuceneIndex

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
private OIndexInternal<?> createLuceneIndex(String name, ODatabaseDocumentInternal oDatabaseRecord, String indexType,
    String valueContainerAlgorithm, ODocument metadata) {
  if (OClass.INDEX_TYPE.FULLTEXT.toString().equals(indexType)) {
    return new OLuceneFullTextIndex(name, indexType, LUCENE_ALGORITHM, new OLuceneIndexEngine<Set<OIdentifiable>>(
        new OLuceneFullTextIndexManager(), indexType), valueContainerAlgorithm, metadata);
  } else if (OClass.INDEX_TYPE.SPATIAL.toString().equals(indexType)) {
    return new OLuceneSpatialIndex(name, indexType, LUCENE_ALGORITHM, new OLuceneIndexEngine<Set<OIdentifiable>>(
        new OLuceneSpatialIndexManager(OShapeFactoryImpl.INSTANCE), indexType), valueContainerAlgorithm, metadata);
  }
  throw new OConfigurationException("Unsupported type : " + indexType);
}
 
开发者ID:orientechnologies,项目名称:orientdb-lucene,代码行数:12,代码来源:OLuceneIndexFactory.java


示例19: getThreadDatabase

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@Override
public ODatabaseDocumentInternal getThreadDatabase() {
    return ODatabaseDocumentPool.global().acquire(url, user, passwd).getUnderlying();
}
 
开发者ID:mdre,项目名称:odbogm,代码行数:5,代码来源:ThreadedGraphRecordFactory.java


示例20: getThreadDatabase

import com.orientechnologies.orient.core.db.ODatabaseDocumentInternal; //导入依赖的package包/类
@Override
public ODatabaseDocumentInternal getThreadDatabase() {
	return poolFactory.get("memory:tinkerpop", "admin", "admin").acquire();
}
 
开发者ID:gentics,项目名称:mesh,代码行数:5,代码来源:MeshRecordFactory.java



注:本文中的com.orientechnologies.orient.core.db.ODatabaseDocumentInternal类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MetricType类代码示例发布时间:2022-05-22
下一篇:
Java DstReference类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap