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


Java IResultSet类代码示例

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


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

示例1: readTopologyConfigFromStorage

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
protected void readTopologyConfigFromStorage() {
	IResultSet topologyResult = storageSourceService.executeQuery(TOPOLOGY_TABLE_NAME,
			null, null,
			null);

	if (topologyResult.next()) {
		boolean apf = topologyResult.getBoolean(TOPOLOGY_AUTOPORTFAST);
		autoPortFastFeature = apf;
	} else {
		this.autoPortFastFeature = AUTOPORTFAST_DEFAULT;
	}

	if (autoPortFastFeature)
		log.info("Setting autoportfast feature to ON");
	else
		log.info("Setting autoportfast feature to OFF");
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:LinkDiscoveryManager.java

示例2: readLinkValidTime

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
public Long readLinkValidTime(Link lt) {
	// FIXME: We're not currently using this right now, but if we start
	// to use this again, we probably shouldn't use it in its current
	// form, because it's doing synchronous storage calls. Depending
	// on the context this may still be OK, but if it's being called
	// on the packet in processing thread it should be reworked to
	// use asynchronous storage calls.
	Long validTime = null;
	IResultSet resultSet = null;
	try {
		String[] columns = { LINK_VALID_TIME };
		String id = getLinkId(lt);
		resultSet = storageSourceService.executeQuery(LINK_TABLE_NAME,
				columns,
				new OperatorPredicate(
						LINK_ID,
						OperatorPredicate.Operator.EQ,
						id),
						null);
		if (resultSet.next())
			validTime = resultSet.getLong(LINK_VALID_TIME);
	} finally {
		if (resultSet != null) resultSet.close();
	}
	return validTime;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:27,代码来源:LinkDiscoveryManager.java

示例3: readEntriesFromStorage

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
/**
 * Read entries from storageSource, and store them in a hash
 *
 * @return
 */
private Map<String, Map<String, OFFlowMod>> readEntriesFromStorage() {
	Map<String, Map<String, OFFlowMod>> entries = new ConcurrentHashMap<String, Map<String, OFFlowMod>>();
	try {
		Map<String, Object> row;
		// null1=no predicate, null2=no ordering
		IResultSet resultSet = storageSourceService.executeQuery(TABLE_NAME, ColumnNames, null, null);
		for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
			row = it.next().getRow();
			parseRow(row, entries);
		}
	} catch (StorageException e) {
		log.error("failed to access storage: {}", e.getMessage());
		// if the table doesn't exist, then wait to populate later via
		// setStorageSource()
	}
	return entries;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:23,代码来源:StaticFlowEntryPusher.java

示例4: getStorageRules

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Override
public List<Map<String, Object>> getStorageRules() {
	ArrayList<Map<String, Object>> l = new ArrayList<Map<String, Object>>();
	try {
		// null1=no predicate, null2=no ordering
		IResultSet resultSet = storageSource.executeQuery(TABLE_NAME, ColumnNames, null, null);
		for (Iterator<IResultSet> it = resultSet.iterator(); it.hasNext();) {
			l.add(it.next().getRow());
		}
	} catch (StorageException e) {
		logger.error("failed to access storage: {}", e.getMessage());
		// if the table doesn't exist, then wait to populate later via
		// setStorageSource()
	}
	return l;
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:17,代码来源:Firewall.java

示例5: testAndQuery

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testAndQuery() {
    String[] columnList = {PERSON_FIRST_NAME,PERSON_LAST_NAME};        
    Object[][] expectedResults = {
            {"Lisa", "Jones"},
            {"Susan", "Jones"},
            {"Jose", "Garcia"},
            {"Abigail", "Johnson"},
            {"John", "McEnroe"}
    };
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, columnList,
            new CompoundPredicate(CompoundPredicate.Operator.AND, false,
                    new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "G"),
                    new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.LT, "N")
            ),
            new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, columnList, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:19,代码来源:StorageTest.java

示例6: testEfficientOrQuery

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testEfficientOrQuery() {
    String[] columnList = {PERSON_FIRST_NAME,PERSON_LAST_NAME};
    Object[][] expectedResults = {
            {"John", "Smith"},
            {"Lisa", "Jones"},
            {"Susan", "Jones"}
    };
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, columnList,
            new CompoundPredicate(CompoundPredicate.Operator.OR, false,
                    new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.EQ, "Jones"),
                    new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.EQ, "Smith")
            ),
            new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, columnList, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:17,代码来源:StorageTest.java

示例7: testOrQuery

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
    public void testOrQuery() {
        String[] columnList = {PERSON_FIRST_NAME,PERSON_LAST_NAME, PERSON_AGE};        
        Object[][] expectedResults = {
                {"John", "Smith", 40},
                {"Lisa", "Jones", 27},
                {"Abigail", "Johnson", 35},
                {"Bjorn", "Borg", 55},
                {"John", "McEnroe", 53}
        };
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, columnList,
                new CompoundPredicate(CompoundPredicate.Operator.OR, false,
                        new OperatorPredicate(PERSON_AGE, OperatorPredicate.Operator.GTE, 35),
                        new OperatorPredicate(PERSON_FIRST_NAME, OperatorPredicate.Operator.EQ, "Lisa")
                ),
                new RowOrdering(PERSON_SSN));
        checkExpectedResults(resultSet, columnList, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:19,代码来源:StorageTest.java

示例8: testDeleteRowsDirect

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testDeleteRowsDirect() {
    
    storageSource.deleteRow(PERSON_TABLE_NAME, "111-11-1111");
    storageSource.deleteRow(PERSON_TABLE_NAME, "222-22-2222");
    storageSource.deleteRow(PERSON_TABLE_NAME, "333-33-3333");
    storageSource.deleteRow(PERSON_TABLE_NAME, "444-44-4444");
    
    Object[][] expectedResults = {
            {"555-55-5555", "Jose", "Garcia", 31, true},
            {"666-66-6666", "Abigail", "Johnson", 35, false},
            {"777-77-7777", "Bjorn", "Borg", 55, true},
            {"888-88-8888", "John", "McEnroe", 53, false}
    };
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, null, new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:18,代码来源:StorageTest.java

示例9: testDeleteRowsFromResultSet

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testDeleteRowsFromResultSet() {
    Object[][] expectedResults = {
            {"555-55-5555", "Jose", "Garcia", 31, true},
            {"666-66-6666", "Abigail", "Johnson", 35, false},
            {"777-77-7777", "Bjorn", "Borg", 55, true},
            {"888-88-8888", "John", "McEnroe", 53, false}
    };
    
    // Query once to delete the rows
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, null, new RowOrdering(PERSON_SSN));
    for (int i = 0; i < 4; i++) {
        resultSet.next();
        resultSet.deleteRow();
    }
    resultSet.save();
    resultSet.close();
    
    // Now query again to verify that the rows were deleted
    resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, null, new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:23,代码来源:StorageTest.java

示例10: testDeleteMatchingRows

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testDeleteMatchingRows() {
    Object[][] expectedResults = {
            {"111-11-1111", "John", "Smith", 40, true},
            {"777-77-7777", "Bjorn", "Borg", 55, true},
            {"888-88-8888", "John", "McEnroe", 53, false}
    };
    storageSource.deleteMatchingRows(PERSON_TABLE_NAME, new OperatorPredicate(PERSON_AGE, OperatorPredicate.Operator.LT, 40));
    
    // Now query again to verify that the rows were deleted
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, null, new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedResults);
    
    storageSource.deleteMatchingRows(PERSON_TABLE_NAME, null);

    // Now query again to verify that all rows were deleted
    resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, null, new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, PERSON_COLUMN_LIST, new Object[0][]);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:StorageTest.java

示例11: testUpdateRowsDirect

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testUpdateRowsDirect() {
    
    Object[][] expectedResults = {
            {"777-77-7777", "Tennis", "Borg", 60, true},
            {"888-88-8888", "Tennis", "McEnroe", 60, false}
    };
    Map<String,Object> updateValues = new HashMap<String,Object>();
    updateValues.put(PERSON_FIRST_NAME, "Tennis");
    updateValues.put(PERSON_AGE, 60);
    
    IPredicate predicate = new OperatorPredicate(PERSON_AGE, OperatorPredicate.Operator.GT, 50);
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, predicate, new RowOrdering(PERSON_SSN));
    while (resultSet.next()) {
        String key = resultSet.getString(PERSON_SSN);
        storageSource.updateRow(PERSON_TABLE_NAME, key, updateValues);
    }
    resultSet.close();
    
    resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, predicate, new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:23,代码来源:StorageTest.java

示例12: testUpdateRowsFromResultSet

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testUpdateRowsFromResultSet() {
    
    Object[][] expectedResults = {
            {"777-77-7777", "Tennis", "Borg", 60, true},
            {"888-88-8888", "Tennis", "McEnroe", 60, false}
    };
    
    IPredicate predicate = new OperatorPredicate(PERSON_AGE, OperatorPredicate.Operator.GT, 50);
    IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, predicate, null);
    while (resultSet.next()) {
        resultSet.setString(PERSON_FIRST_NAME, "Tennis");
        resultSet.setInt(PERSON_AGE, 60);
    }
    resultSet.save();
    resultSet.close();
    
    resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, PERSON_COLUMN_LIST, predicate, new RowOrdering(PERSON_SSN));
    checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedResults);
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:21,代码来源:StorageTest.java

示例13: testAsyncQuery1

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testAsyncQuery1() {
    Object[][] expectedResults = {
            {"John", "Smith", 40},
            {"Jim", "White", 24},
    };
    String[] columnList = {PERSON_FIRST_NAME,PERSON_LAST_NAME,PERSON_AGE};
    IPredicate predicate = new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "Sm");
    IQuery query = storageSource.createQuery(PERSON_TABLE_NAME, columnList, predicate, new RowOrdering(PERSON_SSN));
    Future<IResultSet> future = storageSource.executeQueryAsync(query);
    waitForFuture(future);
    try {
        IResultSet resultSet = future.get();
        checkExpectedResults(resultSet, columnList, expectedResults);
    }
    catch (Exception e) {
        fail("Exception thrown in async storage operation: " + e.toString());
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:StorageTest.java

示例14: testAsyncQuery2

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testAsyncQuery2() {
    Object[][] expectedResults = {
            {"John", "Smith", 40},
            {"Jim", "White", 24},
    };
    String[] columnList = {PERSON_FIRST_NAME,PERSON_LAST_NAME,PERSON_AGE};
    IPredicate predicate = new OperatorPredicate(PERSON_LAST_NAME, OperatorPredicate.Operator.GTE, "Sm");
    Future<IResultSet> future = storageSource.executeQueryAsync(PERSON_TABLE_NAME,
            columnList, predicate, new RowOrdering(PERSON_SSN));
    waitForFuture(future);
    try {
        IResultSet resultSet = future.get();
        checkExpectedResults(resultSet, columnList, expectedResults);
    }
    catch (Exception e) {
        fail("Exception thrown in async storage operation: " + e.toString());
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:20,代码来源:StorageTest.java

示例15: testAsyncInsertRow

import net.floodlightcontroller.storage.IResultSet; //导入依赖的package包/类
@Test
public void testAsyncInsertRow() {
    Object[][] newPersonInfo = {{"999-99-9999", "Ellen", "Wilson", 40, true}};
    Map<String,Object> rowValues = createPersonRowValues(newPersonInfo[0]);
    Future<?> future = storageSource.insertRowAsync(PERSON_TABLE_NAME, rowValues);
    waitForFuture(future);
    try {
        IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
        Object[][] expectedPersons = Arrays.copyOf(PERSON_INIT_DATA, PERSON_INIT_DATA.length + newPersonInfo.length);
        System.arraycopy(newPersonInfo, 0, expectedPersons, PERSON_INIT_DATA.length, newPersonInfo.length);
        checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
    }
    catch (Exception e) {
        fail("Exception thrown in async storage operation: " + e.toString());
    }
}
 
开发者ID:xuraylei,项目名称:fresco_floodlight,代码行数:17,代码来源:StorageTest.java


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