use of org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method printSMCMappings.
public static String printSMCMappings(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
sb.append("Keys\tValues\n");
final IRowVisitor innerVisitor = (new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("\n" + key + "\t");
}
sb.append(valueKey + "=" + value + "\t");
lastKey = key;
}
});
dao.getAll(new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("\n" + key + "\t");
}
if (valueKey.equals(SubKeys.VNI)) {
sb.append(valueKey + "= { ");
((ILispDAO) value).getAll(innerVisitor);
sb.append("}\t");
} else {
sb.append(valueKey + "=" + value + "\t");
}
lastKey = key;
}
});
sb.append("\n");
return sb.toString();
}
use of org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method printKeys.
public static String printKeys(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
sb.append("Keys\tValues\n");
final IRowVisitor innerVisitor = (new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("\n" + key + "\t");
}
sb.append(valueKey + "=" + value + "\t");
lastKey = key;
}
});
dao.getAll(new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("\n" + key + "\t");
}
if (valueKey.equals(SubKeys.VNI)) {
sb.append(valueKey + "= { ");
((ILispDAO) value).getAll(innerVisitor);
sb.append("}\t");
} else {
sb.append(valueKey + "=" + value + "\t");
}
lastKey = key;
}
});
sb.append("\n");
return sb.toString();
}
use of org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method prettyPrintFMCMappings.
public static String prettyPrintFMCMappings(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
dao.getAll(new IRowVisitor() {
public void visitRow(Object keyId, String valueKey, Object value) {
switch(valueKey) {
case SubKeys.RECORD:
MappingData md = (MappingData) value;
sb.append(Stringifier.getString(md.getRecord(), 2));
sb.append("\n");
break;
default:
break;
}
}
});
sb.append("\n");
return sb.toString();
}
use of org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method prettyPrintSMCMappings.
@SuppressWarnings("unchecked")
public static String prettyPrintSMCMappings(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
final IRowVisitor mappingVisitor = (new IRowVisitor() {
public void visitRow(Object keyId, String valueKey, Object value) {
switch(valueKey) {
case SubKeys.RECORD:
MappingData md = (MappingData) value;
sb.append(Stringifier.getString(md.getRecord(), 2));
sb.append("\n");
break;
case SubKeys.SUBSCRIBERS:
Set<Subscriber> subscribers = (Set<Subscriber>) value;
sb.append(prettyPrintSubscriberSet(subscribers, 4));
sb.append("\n");
break;
default:
break;
}
}
});
dao.getAll(new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("Instance ID " + keyId + "\n");
}
if (valueKey.equals(SubKeys.VNI)) {
((ILispDAO) value).getAll(mappingVisitor);
}
lastKey = key;
}
});
return sb.toString();
}
use of org.opendaylight.lispflowmapping.interfaces.dao.IRowVisitor in project lispflowmapping by opendaylight.
the class LispMapCacheStringifier method printFMCMappings.
public static String printFMCMappings(ILispDAO dao) {
final StringBuilder sb = new StringBuilder();
sb.append("Keys\tValues\n");
dao.getAll(new IRowVisitor() {
String lastKey = "";
public void visitRow(Object keyId, String valueKey, Object value) {
String key = keyId.getClass().getSimpleName() + "#" + keyId;
if (!lastKey.equals(key)) {
sb.append("\n" + key + "\t");
}
sb.append(valueKey + "=" + value + "\t");
lastKey = key;
}
});
sb.append("\n");
return sb.toString();
}
Aggregations