@Override public ProtocolStatInfo decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } log.debug("name={}, full json={} ", json.get("name"), json); final String name = json.get("name").asText(); final String breed = json.get("breed").asText(); final long packets = json.get("packets").asLong(); final long bytes = json.get("bytes").asLong(); final int flows = json.get("flows").asInt(); return new ProtocolStatInfo(name, breed, packets, bytes, flows); } }
private static Sort create(ObjectNode node) { try { // ensure our jsonnode is an object - and doesn't have multiple children at this stage! if (!node.isObject()) throw new RuntimeException("Node specified is not an object"); // Copy all the fields onto our Filter node. Sort sort = new Sort(); sort.setAll(node); return sort; } catch (Exception ex) { throw new RuntimeException(ex); } }
@Override public ApplicationId decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse application identifier int id = nullIsIllegal(json.get(APP_ID), APP_ID + MISSING_MEMBER_MESSAGE).asInt(); // parse application name String name = nullIsIllegal(json.get(APP_NAME), APP_NAME + MISSING_MEMBER_MESSAGE).asText(); return new DefaultApplicationId(id, name); } }
public static Filter create( ObjectNode node ) { try { // ensure our jsonnode is an object - and doesnt' have multiple children at this stage! if (!node.isObject()) throw new RuntimeException("Node specified is not an object"); // Copy all the fields onto our Filter node. Filter filter = new Filter(); filter.putAll(node); return filter; } catch (Exception ex) { throw new RuntimeException(ex); } }
@Override public NiciraSetNshSi decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse service index port short serviceIndexShort = (short) nullIsIllegal(json.get(NSH_SERVICE_INDEX), NSH_SERVICE_INDEX + MISSING_MEMBER_MESSAGE).asInt(); NshServiceIndex index = NshServiceIndex.of(serviceIndexShort); return new NiciraSetNshSi(index); } }
@Override public NiciraMatchNshSi decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse nsh service index short nshSiShort = (short) nullIsIllegal(json.get(NSH_SERVICE_INDEX), NSH_SERVICE_INDEX + MISSING_MEMBER_MESSAGE).asInt(); NshServiceIndex nshSi = NshServiceIndex.of(nshSiShort); return new NiciraMatchNshSi(nshSi); } }
@Override public TenantId decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } TenantId tenantId = TenantId.tenantId(extractMember(TENANT_ID, json)); return tenantId; }
@Override public NiciraMatchNshSpi decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse nsh path id int nshSpiInt = nullIsIllegal(json.get(NSH_PATH_ID), NSH_PATH_ID + MISSING_MEMBER_MESSAGE).asInt(); NshServicePathId nshSpi = NshServicePathId.of(nshSpiInt); return new NiciraMatchNshSpi(nshSpi); } }
@Override public OfdpaMatchVlanVid decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse ofdpa match vlan vid short vlanVid = (short) nullIsIllegal(json.get(VLAN_ID), VLAN_ID + MISSING_MEMBER_MESSAGE).asInt(); return new OfdpaMatchVlanVid(VlanId.vlanId(vlanVid)); } }
@Override public Instruction decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } return new DecodeInstructionCodecHelper(json, context).decode(); } }
@Override public NiciraSetNshSpi decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse service path id int servicePathIdInt = nullIsIllegal(json.get(NSH_PATH_ID), NSH_PATH_ID + MISSING_MEMBER_MESSAGE).asInt(); NshServicePathId pathId = NshServicePathId.of(servicePathIdInt); return new NiciraSetNshSpi(pathId); } }
@Override public NiciraResubmit decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse in port number long portNumberLong = nullIsIllegal(json.get(RESUBMIT_PORT), RESUBMIT_PORT + MISSING_MEMBER_MESSAGE).asLong(); PortNumber portNumber = PortNumber.portNumber(portNumberLong); return new NiciraResubmit(portNumber); } }
@Override public NiciraSetTunnelDst decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse tunnel destination IP address String dstIp = nullIsIllegal(json.get(TUNNEL_DST), TUNNEL_DST + MISSING_MEMBER_MESSAGE).asText(); Ip4Address tunnelDst = Ip4Address.valueOf(dstIp); return new NiciraSetTunnelDst(tunnelDst); } }
@Override public OfdpaSetVlanVid decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // parse ofdpa set vlan vid short vlanVid = (short) nullIsIllegal(json.get(VLAN_ID), VLAN_ID + MISSING_MEMBER_MESSAGE).asInt(); return new OfdpaSetVlanVid(VlanId.vlanId(vlanVid)); } }
@Override public MastershipTerm decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } // node identifier of master NodeId nodeId = NodeId.nodeId(nullIsIllegal(json.get(MASTER), MASTER + MISSING_MEMBER_MESSAGE).asText()); // term number long termNumber = nullIsIllegal(json.get(TERM_NUMBER), TERM_NUMBER + MISSING_MEMBER_MESSAGE).asLong(); return MastershipTerm.of(nodeId, termNumber); } }
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character seperator) { ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId); if ( propertiesNode.get("id") != null ) { builder.append("id text PRIMARY KEY,"); builder.append(LS); propertiesNode.remove("id"); } if ( propertiesNode.isObject() && propertiesNode.size() > 0) { builder = appendPropertiesNode(builder, schema, propertiesNode, seperator); } return builder; }
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character seperator) { ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId); if ( propertiesNode.get("id") != null ) { builder.append("id text PRIMARY KEY,"); builder.append(LS); propertiesNode.remove("id"); } if ( propertiesNode != null && propertiesNode.isObject() && propertiesNode.size() > 0) { builder = appendPropertiesNode(builder, schema, propertiesNode, seperator); } return builder; }
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character seperator) { ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId); if ( propertiesNode != null && propertiesNode.isObject() && propertiesNode.size() > 0) { builder = appendPropertiesNode(builder, schema, propertiesNode, seperator); } return builder; }
protected StringBuilder appendRootObject(StringBuilder builder, Schema schema, String resourceId, Character separator) { ObjectNode propertiesNode = schemaStore.resolveProperties(schema, null, resourceId); if (propertiesNode != null && propertiesNode.isObject() && propertiesNode.size() > 0) { builder = appendPropertiesNode(builder, schema, propertiesNode, separator); } return builder; }
@Override public McastRoute decode(ObjectNode json, CodecContext context) { if (json == null || !json.isObject()) { return null; } IpAddress source = IpAddress.valueOf(json.path(SOURCE).asText()); IpAddress group = IpAddress.valueOf(json.path(GROUP).asText()); McastRoute route = new McastRoute(source, group, McastRoute.Type.STATIC); return route; } }