本文整理汇总了Java中net.floodlightcontroller.storage.IResultSet.next方法的典型用法代码示例。如果您正苦于以下问题:Java IResultSet.next方法的具体用法?Java IResultSet.next怎么用?Java IResultSet.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.storage.IResultSet
的用法示例。
在下文中一共展示了IResultSet.next方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
示例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;
}
示例3: 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);
}
示例4: 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);
}
示例5: 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);
}
示例6: testAsyncSave
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
@Test
public void testAsyncSave() {
// Get a result set and make some changes to it
IResultSet resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
resultSet.next();
resultSet.deleteRow();
resultSet.next();
resultSet.setString(PERSON_FIRST_NAME, "John");
Future<?> future = storageSource.saveAsync(resultSet);
waitForFuture(future);
try {
resultSet = storageSource.executeQuery(PERSON_TABLE_NAME, null, null, new RowOrdering(PERSON_SSN));
Object[][] expectedPersons = Arrays.copyOfRange(PERSON_INIT_DATA, 1, PERSON_INIT_DATA.length);
expectedPersons[0][1] = "John";
checkExpectedResults(resultSet, PERSON_COLUMN_LIST, expectedPersons);
}
catch (Exception e) {
fail("Exception thrown in async storage operation: " + e.toString());
}
}
示例7: readTopologyConfigFromStorage
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
protected void readTopologyConfigFromStorage() {
IResultSet topologyResult = storageSource.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");
}
示例8: getNodeIP
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
private String getNodeIP(String controllerID) {
String[] cols = {CONTROLLER_INTERFACE_CONTROLLER_ID,
CONTROLLER_INTERFACE_TYPE,
CONTROLLER_INTERFACE_NUMBER,
CONTROLLER_INTERFACE_DISCOVERED_IP};
IResultSet res = null;
try {
res = storageSource.executeQuery(CONTROLLER_INTERFACE_TABLE_NAME,
cols, null, null);
while (res.next()) {
logger.debug("{} {} {} {}",
new Object[] {res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID),
res.getString(CONTROLLER_INTERFACE_TYPE),
res.getIntegerObject(CONTROLLER_INTERFACE_NUMBER),
res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP)});
if ("Ethernet".equals(res.getString(CONTROLLER_INTERFACE_TYPE)) &&
Integer.valueOf(0).equals(res.getIntegerObject(CONTROLLER_INTERFACE_NUMBER)) &&
controllerID.equals(res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID)))
return res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP);
}
return null;
} finally {
if (res != null) res.close();
}
}
示例9: updateMatchingRowsImpl
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
@Override
public void updateMatchingRowsImpl(String tableName, IPredicate predicate, Map<String,Object> values) {
String primaryKeyName = getTablePrimaryKeyName(tableName);
String[] columnNameList = {primaryKeyName};
IResultSet resultSet = executeQuery(tableName, columnNameList, predicate, null);
Set<Object> rowKeys = new HashSet<Object>();
while (resultSet.next()) {
String rowKey = resultSet.getString(primaryKeyName);
rowKeys.add(rowKey);
}
updateRowsAndNotify(tableName, rowKeys, values);
}
示例10: checkExpectedResults
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
public void checkExpectedResults(IResultSet resultSet, String[] columnNameList, Object[][] expectedRowList) {
boolean nextResult;
for (Object[] expectedRow: expectedRowList) {
nextResult = resultSet.next();
assertEquals(nextResult,true);
assertEquals(expectedRow.length, columnNameList.length);
for (int i = 0; i < expectedRow.length; i++) {
Object expectedObject = expectedRow[i];
String columnName = columnNameList[i];
if (expectedObject instanceof Boolean)
assertEquals(((Boolean)expectedObject).booleanValue(), resultSet.getBoolean(columnName));
else if (expectedObject instanceof Byte)
assertEquals(((Byte)expectedObject).byteValue(), resultSet.getByte(columnName));
else if (expectedObject instanceof Short)
assertEquals(((Short)expectedObject).shortValue(), resultSet.getShort(columnName));
else if (expectedObject instanceof Integer)
assertEquals(((Integer)expectedObject).intValue(), resultSet.getInt(columnName));
else if (expectedObject instanceof Long)
assertEquals(((Long)expectedObject).longValue(), resultSet.getLong(columnName));
else if (expectedObject instanceof Float)
assertEquals(((Float)expectedObject).floatValue(), resultSet.getFloat(columnName), 0.00001);
else if (expectedObject instanceof Double)
assertEquals(((Double)expectedObject).doubleValue(), resultSet.getDouble(columnName), 0.00001);
else if (expectedObject instanceof byte[])
assertTrue(Arrays.equals((byte[])expectedObject, resultSet.getByteArray(columnName)));
else if (expectedObject instanceof String)
assertEquals((String)expectedObject, resultSet.getString(columnName));
else
assertTrue("Unexpected column value type", false);
}
}
nextResult = resultSet.next();
assertEquals(nextResult,false);
resultSet.close();
}
示例11: handleControllerNodeIPChanges
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
/**
* Handle changes to the controller nodes IPs and dispatch update.
*/
protected void handleControllerNodeIPChanges() {
HashMap<String,String> curControllerNodeIPs = new HashMap<String,String>();
HashMap<String,String> addedControllerNodeIPs = new HashMap<String,String>();
HashMap<String,String> removedControllerNodeIPs =new HashMap<String,String>();
String[] colNames = { CONTROLLER_INTERFACE_CONTROLLER_ID,
CONTROLLER_INTERFACE_TYPE,
CONTROLLER_INTERFACE_NUMBER,
CONTROLLER_INTERFACE_DISCOVERED_IP };
synchronized(controllerNodeIPsCache) {
// We currently assume that interface Ethernet0 is the relevant
// controller interface. Might change.
// We could (should?) implement this using
// predicates, but creating the individual and compound predicate
// seems more overhead then just checking every row. Particularly,
// since the number of rows is small and changes infrequent
IResultSet res = storageSourceService.executeQuery(CONTROLLER_INTERFACE_TABLE_NAME,
colNames,null, null);
while (res.next()) {
if (res.getString(CONTROLLER_INTERFACE_TYPE).equals("Ethernet") &&
res.getInt(CONTROLLER_INTERFACE_NUMBER) == 0) {
String controllerID = res.getString(CONTROLLER_INTERFACE_CONTROLLER_ID);
String discoveredIP = res.getString(CONTROLLER_INTERFACE_DISCOVERED_IP);
String curIP = controllerNodeIPsCache.get(controllerID);
curControllerNodeIPs.put(controllerID, discoveredIP);
if (curIP == null) {
// new controller node IP
addedControllerNodeIPs.put(controllerID, discoveredIP);
}
else if (!curIP.equals(discoveredIP)) {
// IP changed
removedControllerNodeIPs.put(controllerID, curIP);
addedControllerNodeIPs.put(controllerID, discoveredIP);
}
}
}
// Now figure out if rows have been deleted. We can't use the
// rowKeys from rowsDeleted directly, since the tables primary
// key is a compound that we can't disassemble
Set<String> curEntries = curControllerNodeIPs.keySet();
Set<String> removedEntries = controllerNodeIPsCache.keySet();
removedEntries.removeAll(curEntries);
for (String removedControllerID : removedEntries)
removedControllerNodeIPs.put(removedControllerID,
controllerNodeIPsCache.get(removedControllerID));
controllerNodeIPsCache.clear();
controllerNodeIPsCache.putAll(curControllerNodeIPs);
//counters.controllerNodeIpsChanged.updateCounterWithFlush();
HAControllerNodeIPUpdate update = new HAControllerNodeIPUpdate(
curControllerNodeIPs, addedControllerNodeIPs,
removedControllerNodeIPs);
if (!removedControllerNodeIPs.isEmpty() || !addedControllerNodeIPs.isEmpty()) {
addUpdateToQueue(update);
}
}
}