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

Java ODatabaseExport类代码示例

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

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



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

示例1: exportGraph

import com.orientechnologies.orient.core.db.tool.ODatabaseExport; //导入依赖的package包/类
@Override
public void exportGraph(String outputDirectory) throws IOException {
	if (log.isDebugEnabled()) {
		log.debug("Running export to {" + outputDirectory + "} directory.");
	}
	ODatabaseDocumentTx db = factory.getDatabase();
	try {
		OCommandOutputListener listener = new OCommandOutputListener() {
			@Override
			public void onMessage(String iText) {
				System.out.println(iText);
			}
		};

		String dateString = formatter.format(new Date());
		String exportFile = "export_" + dateString;
		new File(outputDirectory).mkdirs();
		ODatabaseExport export = new ODatabaseExport(db, new File(outputDirectory, exportFile).getAbsolutePath(), listener);
		export.exportDatabase();
		export.close();
	} finally {
		db.close();
	}
}
 
开发者ID:gentics,项目名称:mesh,代码行数:25,代码来源:OrientDBDatabase.java


示例2: export

import com.orientechnologies.orient.core.db.tool.ODatabaseExport; //导入依赖的package包/类
@Override
public void export(final OutputStream output, final Set<String> excludedClassNames) throws IOException {
  checkNotNull(output);
  checkNotNull(excludedClassNames);

  log.debug("Exporting database: {}", name);

  try (ODatabaseDocumentTx db = openDb()) {
    checkState(db.exists(), "Database does not exist: %s", name);

    log.debug("Starting export");
    ODatabaseExport exporter = new ODatabaseExport(db, output, new LoggingCommandOutputListener("EXPORT"));

    if (!excludedClassNames.isEmpty()) {
      // orientdb maps to classnames to uppercase
      Set<String> upperCasedExcludedClassNames = excludedClassNames.stream()
          .map(String::toUpperCase)
          .collect(Collectors.toSet());
      log.debug("excluding : {}", upperCasedExcludedClassNames);
      exporter.setExcludeClasses(upperCasedExcludedClassNames);
    }

    exporter.exportDatabase();
    log.debug("Completed export");
  }
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:27,代码来源:DatabaseExternalizerImpl.java


示例3: connect

import com.orientechnologies.orient.core.db.tool.ODatabaseExport; //导入依赖的package包/类
@Override
public OrientConnection connect() throws Exception {
    final OrientGraphFactory graphFactory = new OrientGraphFactory("memory:graph", userName, password);

    graphFactory.setAutoStartTx(false);
    graphFactory.declareIntent(new OIntentMassiveInsert().setEnableCache(false));

    return new AbstractOrientConnection(graphFactory.getNoTx()) {
        @Override
        public void close() throws Exception {
            graph.commit();
            new ODatabaseExport(graph.getRawGraph(), url.getDbName(), System.err::print).exportDatabase();
            graph.getRawGraph().close();
        }
    };
}
 
开发者ID:gsson,项目名称:dependency-grapher,代码行数:17,代码来源:OrientDB.java


示例4: backupDatabase

import com.orientechnologies.orient.core.db.tool.ODatabaseExport; //导入依赖的package包/类
private void backupDatabase (Task task) throws NdexException {

		task.setStartTime(new Timestamp(Calendar.getInstance().getTimeInMillis()));
   		 String ndexRoot = Configuration.getInstance().getNdexRoot();
   		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   		 String strDate = sdf.format(Calendar.getInstance().getTime());

   		 try (ODatabaseDocumentTx db = NdexDatabase.getInstance().getAConnection()){
		
       		 String exportFile = ndexRoot + "/dbbackups/db_"+ strDate + ".export";

       		 logger.info("Backing up database to " + exportFile);
       		 
       		 try{
       			  OCommandOutputListener listener = new OCommandOutputListener() {
       			    @Override
       			    public void onMessage(String iText) {
       			      logger.info(iText);
       			    }
       			  };

       			  ODatabaseExport export = new ODatabaseExport(db, exportFile, listener);
       			  export.setIncludeIndexDefinitions(false);
       			  export.exportDatabase();
       			  export.close();
       			  task.setFinishTime(new Timestamp(Calendar.getInstance().getTimeInMillis()));
       			  task.setStatus(Status.COMPLETED);
       			  task.setMessage("Db exported to " + exportFile);
           		 logger.info("Database back up fininished succefully.");
       			} catch (Exception e) {
       				task.setMessage(e.getMessage());
       				task.setStatus(Status.FAILED);
					logger.severe("IO exception when backing up database. " + e.getMessage());
					e.printStackTrace();
				} 

 			try (TaskDAO taskdao = new TaskDAO (NdexDatabase.getInstance().getAConnection())) {
 				taskdao.createTask(null, task);
 				taskdao.commit();
 				taskdao.close();
 			}

       	 } 	
	}
 
开发者ID:ndexbio,项目名称:ndex-common,代码行数:45,代码来源:SystemTaskProcessor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java MessageObserver类代码示例发布时间:2022-05-22
下一篇:
Java Callback类代码示例发布时间: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