本文整理汇总了Java中org.onosproject.ovsdb.rfc.schema.ColumnSchema类的典型用法代码示例。如果您正苦于以下问题:Java ColumnSchema类的具体用法?Java ColumnSchema怎么用?Java ColumnSchema使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColumnSchema类属于org.onosproject.ovsdb.rfc.schema包,在下文中一共展示了ColumnSchema类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handlePortInsertTable
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
/**
* Handles port insert.
*
* @param tableName ovsdb table interface
* @param portRow row of port
* @return insert, empty if null
*/
private Insert handlePortInsertTable(String tableName, Row portRow) {
DatabaseSchema dbSchema = schema.get(OvsdbConstant.DATABASENAME);
TableSchema portTableSchema = dbSchema
.getTableSchema(OvsdbConstant.PORT);
ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");
String portName = (String) portRow.getColumn(portColumnSchema.name()).data();
Interface inf = (Interface) TableGenerator
.createTable(dbSchema, OvsdbTable.INTERFACE);
inf.setName(portName);
TableSchema intfTableSchema = dbSchema
.getTableSchema(OvsdbConstant.INTERFACE);
Insert insert = new Insert(intfTableSchema, OvsdbConstant.INTERFACE,
inf.getRow());
return insert;
}
示例2: createRow
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
/**
* Convert Operation JsonNode into Row.
* @param tableSchema TableSchema entity
* @param rowNode JsonNode
* @return Row
*/
private static Row createRow(TableSchema tableSchema, Uuid uuid, JsonNode rowNode) {
if (tableSchema == null) {
return null;
}
Map<String, Column> columns = Maps.newHashMap();
Iterator<Map.Entry<String, JsonNode>> rowIter = rowNode.fields();
while (rowIter.hasNext()) {
Map.Entry<String, JsonNode> next = rowIter.next();
ColumnSchema columnSchema = tableSchema.getColumnSchema(next.getKey());
if (columnSchema != null) {
String columnName = columnSchema.name();
Object obj = TransValueUtil.getValueFromJson(next.getValue(), columnSchema.type());
columns.put(columnName, new Column(columnName, obj));
}
}
return new Row(tableSchema.name(), uuid, columns);
}
示例3: jsonNodeToTableSchema
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
/**
* convert JsonNode into TableSchema.
* @param tableName table name
* @param tableJson table JsonNode
* @return TableSchema
* @throws AbnormalJsonNodeException this is an abnormal JsonNode exception
*/
private static TableSchema jsonNodeToTableSchema(String tableName, JsonNode tableJson) {
validateJsonNode(tableJson, "columns");
Map<String, ColumnSchema> columns = new HashMap<>();
Iterator<Map.Entry<String, JsonNode>> columnsIter = tableJson.get("columns").fields();
while (columnsIter.hasNext()) {
Map.Entry<String, JsonNode> column = columnsIter.next();
columns.put(column.getKey(), jsonNodeToColumnSchema(column.getKey(), column.getValue()));
}
return new TableSchema(tableName, columns);
}
示例4: getColumnHandler
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
@Override
public Column getColumnHandler(ColumnDescription columnDesc) {
if (!isValid()) {
return null;
}
String columnName = columnDesc.name();
checkColumnSchemaVersion(columnDesc);
ColumnSchema columnSchema = getColumnSchema(columnName);
if (row == null) {
return null;
}
return row.getColumn(columnSchema.name());
}
示例5: getDataHandler
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
@Override
public Object getDataHandler(ColumnDescription columnDesc) {
if (!isValid()) {
return null;
}
String columnName = columnDesc.name();
checkColumnSchemaVersion(columnDesc);
ColumnSchema columnSchema = getColumnSchema(columnName);
if (row == null || row.getColumn(columnSchema.name()) == null) {
return null;
}
return row.getColumn(columnSchema.name()).data();
}
示例6: setDataHandler
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
@Override
public void setDataHandler(ColumnDescription columnDesc, Object obj) {
if (!isValid()) {
return;
}
String columnName = columnDesc.name();
checkColumnSchemaVersion(columnDesc);
ColumnSchema columnSchema = getColumnSchema(columnName);
Column column = new Column(columnSchema.name(), obj);
row.addColumn(columnName, column);
}
示例7: handlePortInsertTable
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
/**
* Handles port insert.
*
* @param portRow row of port
* @return insert, empty if null
*/
private Insert handlePortInsertTable(Row portRow) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
TableSchema portTableSchema = dbSchema.getTableSchema(PORT);
ColumnSchema portColumnSchema = portTableSchema.getColumnSchema("name");
String portName = (String) portRow.getColumn(portColumnSchema.name()).data();
Interface inf = (Interface) TableGenerator.createTable(dbSchema, OvsdbTable.INTERFACE);
inf.setName(portName);
TableSchema intfTableSchema = dbSchema.getTableSchema(INTERFACE);
return new Insert(intfTableSchema, INTERFACE, inf.getRow());
}
示例8: unbindQueues
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void unbindQueues(QosId qosId, List<Long> queueKeys) {
DatabaseSchema dbSchema = schema.get(DATABASENAME);
OvsdbRowStore qosRowStore = getRowStore(DATABASENAME, QOS);
if (qosRowStore == null) {
return;
}
ConcurrentMap<String, Row> qosTableRows = qosRowStore.getRowStore();
Row qosRow = qosTableRows.values().stream().filter(r -> {
OvsdbMap ovsdbMap = (OvsdbMap) (r.getColumn(EXTERNAL_ID).data());
return qosId.name().equals(ovsdbMap.map().get(QOS_EXTERNAL_ID_KEY));
}).findFirst().orElse(null);
if (qosRow == null) {
log.warn("Can't find QoS {}", qosId);
return;
}
Map<Long, Uuid> deleteQueuesMap = new HashMap<>();
Map<Integer, Uuid> queuesMap = ((OvsdbMap) qosRow.getColumn(QUEUES).data()).map();
queueKeys.forEach(key -> {
if (queuesMap.containsKey(key.intValue())) {
deleteQueuesMap.put(key, queuesMap.get(key.intValue()));
}
});
if (deleteQueuesMap.size() != 0) {
TableSchema parentTableSchema = dbSchema
.getTableSchema(QOS);
ColumnSchema parentColumnSchema = parentTableSchema
.getColumnSchema(QUEUES);
Mutation mutation = MutationUtil.delete(parentColumnSchema.name(), OvsdbMap.ovsdbMap(deleteQueuesMap));
List<Mutation> mutations = Collections.singletonList(mutation);
Condition condition = ConditionUtil.isEqual(UUID, qosRow.uuid());
List<Condition> conditionList = Collections.singletonList(condition);
List<Operation> operations = Collections.singletonList(
new Mutate(parentTableSchema, conditionList, mutations));
transactConfig(DATABASENAME, operations);
}
}
示例9: jsonNodeToColumnSchema
import org.onosproject.ovsdb.rfc.schema.ColumnSchema; //导入依赖的package包/类
/**
* convert JsonNode into ColumnSchema.
* @param name column name
* @param columnJson column JsonNode
* @return ColumnSchema
* @throws AbnormalJsonNodeException this is an abnormal JsonNode exception
*/
private static ColumnSchema jsonNodeToColumnSchema(String name, JsonNode columnJson) {
validateJsonNode(columnJson, "type");
return new ColumnSchema(name, ColumnTypeFactory.getColumnTypeFromJson(columnJson
.get("type")));
}