当前位置: 首页>>代码示例>>Java>>正文


Java ODatabaseExport.exportDatabase方法代码示例

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


在下文中一共展示了ODatabaseExport.exportDatabase方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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.exportDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。