public class BindingToNormalizedNodeCodec extends Object implements BindingCodecTreeFactory, BindingNormalizedNodeSerializer, org.opendaylight.yangtools.yang.model.api.SchemaContextListener, AutoCloseable
BindingCodecTreeFactory
and BindingNormalizedNodeSerializer
, with internal
caching of instance identifiers.
NOTE: this class is non-final to allow controller adapter migration without duplicated code.
Constructor and Description |
---|
BindingToNormalizedNodeCodec(ClassLoadingStrategy classLoadingStrategy,
BindingNormalizedNodeCodecRegistry codecRegistry) |
BindingToNormalizedNodeCodec(ClassLoadingStrategy classLoadingStrategy,
BindingNormalizedNodeCodecRegistry codecRegistry,
boolean waitForSchema) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
BindingCodecTree |
create(BindingRuntimeContext context)
Creates Binding Codec Tree for specified Binding runtime context.
|
BindingCodecTree |
create(org.opendaylight.yangtools.yang.model.api.SchemaContext context,
Class<?>... bindingClasses)
Creates Binding Codec Tree for specified Binding runtime context.
|
<T extends DataObject> |
deserializeFunction(InstanceIdentifier<T> path)
|
Map.Entry<InstanceIdentifier<?>,DataObject> |
fromNormalizedNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path,
org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> data)
Translates supplied YANG Instance Identifier and NormalizedNode into Binding data.
|
<T extends RpcInput> |
fromNormalizedNodeActionInput(Class<? extends Action<?,?,?>> action,
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode input)
Translates supplied ContainerNode action input.
|
<T extends RpcOutput> |
fromNormalizedNodeActionOutput(Class<? extends Action<?,?,?>> action,
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode output)
Translates supplied ContainerNode action output.
|
Notification |
fromNormalizedNodeNotification(org.opendaylight.yangtools.yang.model.api.SchemaPath path,
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode data)
Translates supplied NormalizedNode Notification into Binding data.
|
DataObject |
fromNormalizedNodeRpcData(org.opendaylight.yangtools.yang.model.api.SchemaPath path,
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode data)
Translates supplied NormalizedNode RPC input or output into Binding data.
|
InstanceIdentifier<?> |
fromYangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier dom)
Translates supplied YANG Instance Identifier into Binding instance identifier.
|
BindingNormalizedNodeCodecRegistry |
getCodecFactory() |
BindingNormalizedNodeCodecRegistry |
getCodecRegistry() |
org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> |
getDefaultNodeFor(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentMapPath)
Deprecated.
This method is not generally useful, as empty lists do not convey information in YANG (they are
equivalent to non-present lists). It also leaks implementation details to a broader scope and should
never have been public in the first place.
|
Set<Class<? extends Notification>> |
getNotificationClasses(Set<org.opendaylight.yangtools.yang.model.api.SchemaPath> interested) |
protected com.google.common.collect.ImmutableBiMap<Method,org.opendaylight.yangtools.yang.model.api.RpcDefinition> |
getRpcMethodToSchema(Class<? extends RpcService> key) |
com.google.common.collect.ImmutableBiMap<Method,org.opendaylight.yangtools.yang.model.api.SchemaPath> |
getRpcMethodToSchemaPath(Class<? extends RpcService> key) |
protected @NonNull Map.Entry<InstanceIdentifier<?>,BindingCodecTreeNode<?>> |
getSubtreeCodec(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domIdentifier) |
protected org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> |
instanceIdentifierToNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath) |
static BindingToNormalizedNodeCodec |
newInstance(ClassLoadingStrategy classLoadingStrategy,
DOMSchemaService schemaService) |
void |
onGlobalContextUpdated(org.opendaylight.yangtools.yang.model.api.SchemaContext context) |
Optional<Map.Entry<InstanceIdentifier<? extends DataObject>,DataObject>> |
toBinding(@NonNull Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier,? extends org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>> normalized) |
Optional<InstanceIdentifier<? extends DataObject>> |
toBinding(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized)
Returns a Binding-Aware instance identifier from normalized
instance-identifier if it is possible to create representation.
|
protected DOMDataTreeIdentifier |
toDOMDataTreeIdentifier(DataTreeIdentifier<?> path) |
protected Collection<DOMDataTreeIdentifier> |
toDOMDataTreeIdentifiers(Collection<DataTreeIdentifier<?>> subtrees) |
BindingLazyContainerNode<RpcInput> |
toLazyNormalizedNodeActionInput(Class<? extends Action<?,?,?>> action,
org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier identifier,
RpcInput input)
Lazily translates supplied Binding action input into NormalizedNode data.
|
BindingLazyContainerNode<RpcOutput> |
toLazyNormalizedNodeActionOutput(Class<? extends Action<?,?,?>> action,
org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier identifier,
RpcOutput output)
Lazily translates supplied Binding action output into NormalizedNode data.
|
org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier |
toNormalized(InstanceIdentifier<? extends DataObject> binding)
Translates supplied Binding Instance Identifier into NormalizedNode
instance identifier.
|
<T extends DataObject> |
toNormalizedNode(InstanceIdentifier<T> path,
T data)
Translates supplied Binding Instance Identifier and data into NormalizedNode representation.
|
Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier,org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>> |
toNormalizedNode(Map.Entry<InstanceIdentifier<? extends DataObject>,DataObject> binding)
Converts Binding Map.Entry to DOM Map.Entry.
|
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode |
toNormalizedNodeActionInput(Class<? extends Action<?,?,?>> action,
RpcInput input)
Translates supplied Binding action input into NormalizedNode data.
|
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode |
toNormalizedNodeActionOutput(Class<? extends Action<?,?,?>> action,
RpcOutput output)
Translates supplied Binding action output into NormalizedNode data.
|
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode |
toNormalizedNodeNotification(Notification data)
Translates supplied Binding Notification or output into NormalizedNode notification.
|
org.opendaylight.yangtools.yang.data.api.schema.ContainerNode |
toNormalizedNodeRpcData(DataContainer data)
Translates supplied Binding RPC input or output into NormalizedNode data.
|
org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier |
toYangInstanceIdentifier(InstanceIdentifier<?> binding)
Translates supplied Binding Instance Identifier into NormalizedNode instance identifier.
|
protected org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier |
toYangInstanceIdentifierBlocking(InstanceIdentifier<? extends DataObject> binding) |
protected org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier |
toYangInstanceIdentifierCached(InstanceIdentifier<?> binding) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toLazyNormalizedNodeActionInput, toLazyNormalizedNodeActionOutput
public BindingToNormalizedNodeCodec(ClassLoadingStrategy classLoadingStrategy, BindingNormalizedNodeCodecRegistry codecRegistry)
public BindingToNormalizedNodeCodec(ClassLoadingStrategy classLoadingStrategy, BindingNormalizedNodeCodecRegistry codecRegistry, boolean waitForSchema)
public static BindingToNormalizedNodeCodec newInstance(ClassLoadingStrategy classLoadingStrategy, DOMSchemaService schemaService)
protected org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toYangInstanceIdentifierBlocking(InstanceIdentifier<? extends DataObject> binding)
public final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toNormalized(InstanceIdentifier<? extends DataObject> binding)
binding
- Binding Instance IdentifierIllegalArgumentException
- If supplied Instance Identifier is not valid.public final org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toYangInstanceIdentifier(InstanceIdentifier<?> binding)
BindingNormalizedNodeSerializer
toYangInstanceIdentifier
in interface BindingNormalizedNodeSerializer
binding
- Binding Instance Identifierprotected org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier toYangInstanceIdentifierCached(InstanceIdentifier<?> binding)
public final <T extends DataObject> Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier,org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>> toNormalizedNode(InstanceIdentifier<T> path, T data)
BindingNormalizedNodeSerializer
toNormalizedNode
in interface BindingNormalizedNodeSerializer
path
- Binding Instance Identifier pointing to datadata
- Data object representing datapublic final Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier,org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>> toNormalizedNode(Map.Entry<InstanceIdentifier<? extends DataObject>,DataObject> binding)
binding
- Map Entry with InstanceIdentifier as key and DataObject as value.YangInstanceIdentifier
as key and NormalizedNode
as value.public final Map.Entry<InstanceIdentifier<?>,DataObject> fromNormalizedNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier path, org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> data)
BindingNormalizedNodeSerializer
fromNormalizedNode
in interface BindingNormalizedNodeSerializer
path
- Binding Instance Identifierdata
- NormalizedNode representing datapublic final Notification fromNormalizedNodeNotification(org.opendaylight.yangtools.yang.model.api.SchemaPath path, org.opendaylight.yangtools.yang.data.api.schema.ContainerNode data)
BindingNormalizedNodeSerializer
fromNormalizedNodeNotification
in interface BindingNormalizedNodeSerializer
path
- Schema Path of Notification, schema path is absolute, and consists of Notification QName.data
- NormalizedNode representing datapublic final DataObject fromNormalizedNodeRpcData(org.opendaylight.yangtools.yang.model.api.SchemaPath path, org.opendaylight.yangtools.yang.data.api.schema.ContainerNode data)
BindingNormalizedNodeSerializer
fromNormalizedNodeRpcData
in interface BindingNormalizedNodeSerializer
path
- Schema path of RPC data, Schema path consists of rpc QName and input / output QName.data
- NormalizedNode representing datapublic <T extends RpcInput> T fromNormalizedNodeActionInput(Class<? extends Action<?,?,?>> action, org.opendaylight.yangtools.yang.data.api.schema.ContainerNode input)
BindingNormalizedNodeSerializer
fromNormalizedNodeActionInput
in interface BindingNormalizedNodeSerializer
action
- Binding action classinput
- ContainerNode representing datapublic <T extends RpcOutput> T fromNormalizedNodeActionOutput(Class<? extends Action<?,?,?>> action, org.opendaylight.yangtools.yang.data.api.schema.ContainerNode output)
BindingNormalizedNodeSerializer
fromNormalizedNodeActionOutput
in interface BindingNormalizedNodeSerializer
action
- Binding action classoutput
- ContainerNode representing datapublic final InstanceIdentifier<?> fromYangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier dom)
BindingNormalizedNodeSerializer
fromYangInstanceIdentifier
in interface BindingNormalizedNodeSerializer
dom
- YANG Instance Identifierpublic final org.opendaylight.yangtools.yang.data.api.schema.ContainerNode toNormalizedNodeNotification(Notification data)
BindingNormalizedNodeSerializer
toNormalizedNodeNotification
in interface BindingNormalizedNodeSerializer
data
- NormalizedNode representing notification datapublic final org.opendaylight.yangtools.yang.data.api.schema.ContainerNode toNormalizedNodeRpcData(DataContainer data)
BindingNormalizedNodeSerializer
toNormalizedNodeRpcData
in interface BindingNormalizedNodeSerializer
data
- NormalizedNode representing rpc datapublic org.opendaylight.yangtools.yang.data.api.schema.ContainerNode toNormalizedNodeActionInput(Class<? extends Action<?,?,?>> action, RpcInput input)
BindingNormalizedNodeSerializer
toNormalizedNodeActionInput
in interface BindingNormalizedNodeSerializer
action
- Binding action classinput
- Binding action inputpublic org.opendaylight.yangtools.yang.data.api.schema.ContainerNode toNormalizedNodeActionOutput(Class<? extends Action<?,?,?>> action, RpcOutput output)
BindingNormalizedNodeSerializer
toNormalizedNodeActionOutput
in interface BindingNormalizedNodeSerializer
output
- Binding action outputpublic BindingLazyContainerNode<RpcInput> toLazyNormalizedNodeActionInput(Class<? extends Action<?,?,?>> action, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier identifier, RpcInput input)
BindingNormalizedNodeSerializer
toLazyNormalizedNodeActionInput
in interface BindingNormalizedNodeSerializer
action
- Binding action classinput
- Binding action inputpublic BindingLazyContainerNode<RpcOutput> toLazyNormalizedNodeActionOutput(Class<? extends Action<?,?,?>> action, org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier identifier, RpcOutput output)
BindingNormalizedNodeSerializer
toLazyNormalizedNodeActionOutput
in interface BindingNormalizedNodeSerializer
action
- Binding action classoutput
- Binding action outputpublic final Optional<InstanceIdentifier<? extends DataObject>> toBinding(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier normalized) throws org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException
Returns Optional.empty for cases where target is mixin node except augmentation.
org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException
public final Optional<Map.Entry<InstanceIdentifier<? extends DataObject>,DataObject>> toBinding(@NonNull Map.Entry<org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier,? extends org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>> normalized) throws org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException
org.opendaylight.yangtools.yang.data.impl.codec.DeserializationException
public void onGlobalContextUpdated(org.opendaylight.yangtools.yang.model.api.SchemaContext context)
onGlobalContextUpdated
in interface org.opendaylight.yangtools.yang.model.api.SchemaContextListener
@Deprecated public final <T extends DataObject> Function<Optional<org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?>>,Optional<T>> deserializeFunction(InstanceIdentifier<T> path)
BindingNormalizedNodeCodecRegistry.deserializeFunction(org.opendaylight.yangtools.yang.binding.InstanceIdentifier<T>)
instead.public final BindingNormalizedNodeCodecRegistry getCodecRegistry()
public void close()
close
in interface AutoCloseable
public final BindingNormalizedNodeCodecRegistry getCodecFactory()
public final com.google.common.collect.ImmutableBiMap<Method,org.opendaylight.yangtools.yang.model.api.SchemaPath> getRpcMethodToSchemaPath(Class<? extends RpcService> key)
protected com.google.common.collect.ImmutableBiMap<Method,org.opendaylight.yangtools.yang.model.api.RpcDefinition> getRpcMethodToSchema(Class<? extends RpcService> key)
public final BindingCodecTree create(BindingRuntimeContext context)
BindingCodecTreeFactory
create
in interface BindingCodecTreeFactory
context
- Binding Runtime Context for which Binding codecs should be
instantiated.public final BindingCodecTree create(org.opendaylight.yangtools.yang.model.api.SchemaContext context, Class<?>... bindingClasses)
BindingCodecTreeFactory
create
in interface BindingCodecTreeFactory
context
- Binding Runtime Context for which Binding codecs should be
instantiated.bindingClasses
- Binding Runtime Context will be constructed using bindings
which contains specified classes, in order to support
deserialization in multi-classloader environment.protected @NonNull Map.Entry<InstanceIdentifier<?>,BindingCodecTreeNode<?>> getSubtreeCodec(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier domIdentifier)
public final Set<Class<? extends Notification>> getNotificationClasses(Set<org.opendaylight.yangtools.yang.model.api.SchemaPath> interested)
protected org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> instanceIdentifierToNode(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentPath)
@Deprecated public org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode<?,?> getDefaultNodeFor(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier parentMapPath)
protected Collection<DOMDataTreeIdentifier> toDOMDataTreeIdentifiers(Collection<DataTreeIdentifier<?>> subtrees)
protected DOMDataTreeIdentifier toDOMDataTreeIdentifier(DataTreeIdentifier<?> path)
Copyright © 2019 OpenDaylight. All rights reserved.