use of org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode in project bgpcep by opendaylight.
the class CodecsImpl method onCodecTreeUpdated.
@Override
@SuppressWarnings("unchecked")
public void onCodecTreeUpdated(final BindingCodecTree tree) {
@SuppressWarnings("rawtypes") final BindingDataObjectCodecTreeNode tableCodecContext = tree.getSubtreeCodec(TABLE_BASE_II);
final BindingDataObjectCodecTreeNode<? extends Route> routeListCodec = tableCodecContext.streamChild(Routes.class).streamChild(this.ribSupport.routesCaseClass()).streamChild(this.ribSupport.routesContainerClass()).streamChild(this.ribSupport.routesListClass());
this.attributesCodec = routeListCodec.streamChild(Attributes.class).createCachingCodec(this.cacheableAttributes);
this.reachNlriCodec = tree.getSubtreeCodec(MP_REACH_NLRI_II).createCachingCodec(this.ribSupport.cacheableNlriObjects());
this.unreachNlriCodec = tree.getSubtreeCodec(MP_UNREACH_NLRI_II).createCachingCodec(this.ribSupport.cacheableNlriObjects());
}
use of org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode in project mdsal by opendaylight.
the class LazyDataObjectModification method populateList.
private static void populateList(final List<LazyDataObjectModification<? extends DataObject>> result, final BindingDataObjectCodecTreeNode<?> parentCodec, final Collection<DataTreeCandidateNode> domChildNodes) {
for (final DataTreeCandidateNode domChildNode : domChildNodes) {
if (domChildNode.getModificationType() != UNMODIFIED) {
final BindingStructuralType type = BindingStructuralType.from(domChildNode);
if (type != BindingStructuralType.NOT_ADDRESSABLE) {
/*
* Even if type is UNKNOWN, from perspective of BindingStructuralType
* we try to load codec for it. We will use that type to further specify
* debug log.
*/
try {
final BindingCodecTreeNode childCodec = parentCodec.yangPathArgumentChild(domChildNode.getIdentifier());
verify(childCodec instanceof BindingDataObjectCodecTreeNode, "Unhandled codec %s for type %s", childCodec, type);
populateList(result, type, (BindingDataObjectCodecTreeNode<?>) childCodec, domChildNode);
} catch (final IllegalArgumentException e) {
if (type == BindingStructuralType.UNKNOWN) {
LOG.debug("Unable to deserialize unknown DOM node {}", domChildNode, e);
} else {
LOG.debug("Binding representation for DOM node {} was not found", domChildNode, e);
}
}
}
}
}
}
use of org.opendaylight.mdsal.binding.dom.codec.api.BindingDataObjectCodecTreeNode in project mdsal by opendaylight.
the class DefaultQueryResult method loadItemCodec.
private BindingDataObjectCodecTreeNode<T> loadItemCodec(final YangInstanceIdentifier domPath) {
final BindingCodecTreeNode codecNode = codec.getSubtreeCodec(domPath);
if (!(codecNode instanceof BindingDataObjectCodecTreeNode)) {
throw new VerifyException("Unexpected codec " + codecNode);
}
@SuppressWarnings("unchecked") final BindingDataObjectCodecTreeNode<T> ret = (BindingDataObjectCodecTreeNode<T>) codecNode;
final Object witness = ITEM_CODEC.compareAndExchangeRelease(this, null, ret);
return witness == null ? ret : (BindingDataObjectCodecTreeNode<T>) witness;
}
Aggregations