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


Java VictimsDBInterface.synchronize方法代码示例

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


在下文中一共展示了VictimsDBInterface.synchronize方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testDerby

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
@Test(expected = VictimsException.class)
public void testDerby() throws IOException, VictimsException {
    String old = System.getProperty(VictimsConfig.Key.DB_DRIVER);
    try {
        System.setProperty(VictimsConfig.Key.DB_DRIVER,
                "org.apache.derby.jdbc.EmbeddedDriver");
        VictimsDBInterface vdb = VictimsDB.db();
        vdb.synchronize();
    } finally {
        if (old != null) {
            System.setProperty(VictimsConfig.Key.DB_DRIVER, old);
        } else {
            System.clearProperty(VictimsConfig.Key.DB_DRIVER);
        }
    }

}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:18,代码来源:VictimsDatabaseTest.java

示例2: getVictimsDB

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
/**
 * sync and return victims db
 *
 * @return victims db
 */
private VictimsDBInterface getVictimsDB() {
	VictimsDBInterface db = null;
	try {
		db = VictimsDB.db();
		//todo add option and logic to set update interval
		db.synchronize();
	} catch (Exception ex) {
		log.error(ex.getMessage(), ex);
	}
	return db;
}
 
开发者ID:skavanagh,项目名称:victims-plugin-nexus,代码行数:17,代码来源:VictimsNexusScanner.java

示例3: testPurgeOnSync

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
@Test
public void testPurgeOnSync() throws VictimsException {
    String hash = "0";
    VictimsResultCache vrc = prepareCache(hash);
    VictimsDBInterface vdb = VictimsDB.db();
    vdb.synchronize();
    assertTrue("Cache was not correctly purged on database sync.",
            !vrc.exists(hash));
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:10,代码来源:VictimsResultCacheTest.java

示例4: execute

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
@Override
public CommandResult execute(List<String> args) {
    try { 
        VictimsDBInterface db = VictimsDB.db();
        db.synchronize();
        ExitSuccess result = new ExitSuccess(null);
        result.addVerboseOutput("synchronization complete!");
        return result;
                
    } catch (VictimsException e){
        //e.printStackTrace();
        return new ExitFailure(e.getMessage());
    }
}
 
开发者ID:victims,项目名称:victims-client-java-legacy,代码行数:15,代码来源:SynchronizeCommand.java

示例5: updateDatabase

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
/**
 * Updates the database according to the given configuration
 * 
 * @param ctx
 * @throws VictimsException
 */
public void updateDatabase(ExecutionContext ctx) throws VictimsException {

	VictimsDBInterface db = ctx.getDatabase();
	LogOutputResource log = ctx.getLog();

	Date updated = db.lastUpdated();

	// update automatically every time
	if (ctx.updateAlways()) {
		log.log(TextUI.fmt(Resources.INFO_UPDATES, updated.toString(),
				VictimsConfig.uri()), LogLevel.INFO.getLevel());
		db.synchronize();

		// update once per day
	} else if (ctx.updateDaily()) {

		Date today = new Date();
		SimpleDateFormat cmp = new SimpleDateFormat("yyyMMdd");
		boolean updatedToday = cmp.format(today)
				.equals(cmp.format(updated));

		if (!updatedToday) {
			log.log(TextUI.fmt(Resources.INFO_UPDATES, updated.toString(),
					VictimsConfig.uri()), LogLevel.INFO.getLevel());
			db.synchronize();

		} else {
			log.log("Database last synchronized: " + updated.toString(),
					LogLevel.DEBUG.getLevel());
		}

		// updates disabled
	} else {
		log.log("Database synchronization disabled.",
				LogLevel.INFO.getLevel());
	}

}
 
开发者ID:victims,项目名称:victims-plugin-ant-legacy,代码行数:45,代码来源:VictimsTask.java

示例6: updateDatabase

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
/**
 * Updates the database according to the given configuration
 * 
 * @param ctx
 * @throws VictimsException
 */
private void updateDatabase(ExecutionContext context)
        throws VictimsException {
    VictimsDBInterface db = context.getDatabase();
    PrintStream log = context.getLog();

    Date updated = db.lastUpdated();

    // update: auto
    if (context.updateAlways()) {
        log.println("Updating database");
        db.synchronize();
    } else if (context.updateDaily()) { // update: daily
        Date today = new Date();
        SimpleDateFormat cmp = new SimpleDateFormat("yyyyMMdd");
        boolean updatedToday = cmp.format(today)
                .equals(cmp.format(updated));

        if (!updatedToday) {
            log.println("Updating database");
            db.synchronize();
        } else {
            log.println("Database last updated: "
                    + updated.toString());
        }
    } else { // update: disabled
        log.println("Database synchronization disabled.");
    }
}
 
开发者ID:victims,项目名称:victims-plugin-jenkins-legacy,代码行数:35,代码来源:VictimsPostBuildScanner.java

示例7: testResync

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
@Test
public void testResync() throws VictimsException {
    VictimsDBInterface vdb = VictimsDB.db();
    vdb.synchronize();
}
 
开发者ID:victims,项目名称:victims-lib-java,代码行数:6,代码来源:VictimsDatabaseTest.java

示例8: updateDatabase

import com.redhat.victims.database.VictimsDBInterface; //导入方法依赖的package包/类
/**
 * Updates the database according to the given configuration
 * 
 * @param ctx
 *            context setting for this execution of the scan
 * @throws VictimsException
 */
public void updateDatabase(ExecutionContext ctx) throws VictimsException {

	VictimsDBInterface db = ctx.getDatabase();
	ILog log = ctx.getLog();

	Date updated = db.lastUpdated();

	// update automatically every time
	if (ctx.updateAlways()) {
		log.log(new Status(Status.INFO, Activator.PLUGIN_ID, (TextUI.fmt(
				Resources.INFO_UPDATES, updated.toString(),
				VictimsConfig.uri()))));
		db.synchronize();

		// update once per day
	} else if (ctx.updateDaily()) {

		Date today = new Date();
		SimpleDateFormat cmp = new SimpleDateFormat("yyyMMdd");
		boolean updatedToday = cmp.format(today)
				.equals(cmp.format(updated));

		if (!updatedToday) {
			log.log(new Status(Status.INFO, Activator.PLUGIN_ID, TextUI
					.fmt(Resources.INFO_UPDATES, updated.toString(),
							VictimsConfig.uri())));

			db.synchronize();

		} else {
			log.log(new Status(Status.INFO, Activator.PLUGIN_ID,
					"Database last synchronized: " + updated.toString()));
		}

		// updates disabled
	} else {
		log.log(new Status(Status.INFO, Activator.PLUGIN_ID,
				"Database synchronization disabled."));
	}

}
 
开发者ID:victims,项目名称:victims-plugin-eclipse-legacy,代码行数:49,代码来源:VictimScan.java


注:本文中的com.redhat.victims.database.VictimsDBInterface.synchronize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。