本文整理汇总了Java中net.floodlightcontroller.storage.IResultSet.iterator方法的典型用法代码示例。如果您正苦于以下问题:Java IResultSet.iterator方法的具体用法?Java IResultSet.iterator怎么用?Java IResultSet.iterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.floodlightcontroller.storage.IResultSet
的用法示例。
在下文中一共展示了IResultSet.iterator方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: readEntriesFromStorage
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
/**
* Read entries from storageSource, and store them in a hash
*
* @return
*/
@LogMessageDoc(level="ERROR",
message="failed to access storage: {reason}",
explanation="Could not retrieve static flows from the system " +
"database",
recommendation=LogMessageDoc.CHECK_CONTROLLER)
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;
}
示例4: readEntriesFromStorage
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
/**
* Read entries from storageSource, and store them in a hash
*
* @return
*/
@LogMessageDoc(level="ERROR",
message="failed to access storage: {reason}",
explanation="Could not retrieve static flows from the system " +
"database",
recommendation=LogMessageDoc.CHECK_CONTROLLER)
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 = storageSource.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;
}
示例5: 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;
}
示例6: readPropertyFromStorage
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
/**
* Read switch properties from storage and set switch attributes accordingly
*/
private void readPropertyFromStorage() {
// At this time, also set other switch properties from storage
boolean is_core_switch = false;
IResultSet resultSet = null;
try {
String swid = sw.getStringId();
resultSet = this.controller.getStorageSourceService()
.getRow(Controller.SWITCH_CONFIG_TABLE_NAME, swid);
for (Iterator<IResultSet> it =
resultSet.iterator(); it.hasNext();) {
is_core_switch = it.next()
.getBoolean(Controller.SWITCH_CONFIG_CORE_SWITCH);
if (log.isDebugEnabled()) {
log.debug("Reading SWITCH_IS_CORE_SWITCH " +
"config for switch={}, is-core={}",
sw, is_core_switch);
}
}
}
finally {
if (resultSet != null)
resultSet.close();
}
if (is_core_switch) {
sw.setAttribute(IOFSwitch.SWITCH_IS_CORE_SWITCH,
Boolean.valueOf(true));
}
}
示例7: rowsModified
import net.floodlightcontroller.storage.IResultSet; //导入方法依赖的package包/类
@Override
public void rowsModified(String tableName, Set<Object> rowKeys) {
// This handles both rowInsert() and rowUpdate()
log.debug("Modifying Table {}", tableName);
HashMap<String, Map<String, OFFlowMod>> entriesToAdd =
new HashMap<String, Map<String, OFFlowMod>>();
// build up list of what was added
for (Object key: rowKeys) {
IResultSet resultSet = storageSource.getRow(tableName, key);
Iterator<IResultSet> it = resultSet.iterator();
while (it.hasNext()) {
Map<String, Object> row = it.next().getRow();
parseRow(row, entriesToAdd);
}
}
// batch updates by switch and blast them out
for (String dpid : entriesToAdd.keySet()) {
if (!entriesFromStorage.containsKey(dpid))
entriesFromStorage.put(dpid, new HashMap<String, OFFlowMod>());
List<OFMessage> outQueue = new ArrayList<OFMessage>();
for(String entry : entriesToAdd.get(dpid).keySet()) {
OFFlowMod newFlowMod = entriesToAdd.get(dpid).get(entry);
//OFFlowMod oldFlowMod = entriesFromStorage.get(dpid).get(entry);
OFFlowMod oldFlowMod = null;
String dpidOldFlowMod = entry2dpid.get(entry);
if (dpidOldFlowMod != null) {
oldFlowMod = entriesFromStorage.get(dpidOldFlowMod).remove(entry);
}
if (oldFlowMod != null && newFlowMod != null) {
// set the new flow mod to modify a pre-existing rule if these fields match
if(oldFlowMod.getMatch().equals(newFlowMod.getMatch())
&& oldFlowMod.getCookie() == newFlowMod.getCookie()
&& oldFlowMod.getPriority() == newFlowMod.getPriority()){
newFlowMod.setCommand(OFFlowMod.OFPFC_MODIFY_STRICT);
// if they don't match delete the old flow
} else{
oldFlowMod.setCommand(OFFlowMod.OFPFC_DELETE_STRICT);
if (dpidOldFlowMod.equals(dpid)) {
outQueue.add(oldFlowMod);
} else {
writeOFMessageToSwitch(HexString.toLong(dpidOldFlowMod), oldFlowMod);
}
}
}
// write the new flow
if (newFlowMod != null) {
entriesFromStorage.get(dpid).put(entry, newFlowMod);
outQueue.add(newFlowMod);
entry2dpid.put(entry, dpid);
} else {
entriesFromStorage.get(dpid).remove(entry);
entry2dpid.remove(entry);
}
}
writeOFMessagesToSwitch(HexString.toLong(dpid), outQueue);
}
}