Search in sources :

Example 1 with BindingRuntimeGenerator

use of org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator in project lighty-netconf-simulator by PANTHEONtech.

the class NetconfDeviceServicesImpl method createAdapterContext.

private AdapterContext createAdapterContext(Collection<YangModuleInfo> moduleInfos) {
    final YangParserFactory yangParserFactory = new DefaultYangParserFactory();
    ModuleInfoSnapshotResolver snapshotResolver = new ModuleInfoSnapshotResolver("netconf-simulator", yangParserFactory);
    snapshotResolver.registerModuleInfos(moduleInfos);
    ModuleInfoSnapshot moduleInfoSnapshot = snapshotResolver.takeSnapshot();
    final BindingRuntimeGenerator bindingRuntimeGenerator = new DefaultBindingRuntimeGenerator();
    final BindingRuntimeTypes bindingRuntimeTypes = bindingRuntimeGenerator.generateTypeMapping(moduleInfoSnapshot.getEffectiveModelContext());
    final DefaultBindingRuntimeContext bindingRuntimeContext = new DefaultBindingRuntimeContext(bindingRuntimeTypes, moduleInfoSnapshot);
    final BindingCodecContext bindingCodecContext = new BindingCodecContext(bindingRuntimeContext);
    return new ConstantAdapterContext(bindingCodecContext);
}
Also used : ModuleInfoSnapshot(org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot) ConstantAdapterContext(org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext) DefaultBindingRuntimeGenerator(org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator) BindingCodecContext(org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext) BindingRuntimeTypes(org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeTypes) DefaultYangParserFactory(org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory) ModuleInfoSnapshotResolver(org.opendaylight.mdsal.binding.runtime.spi.ModuleInfoSnapshotResolver) DefaultBindingRuntimeContext(org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext) YangParserFactory(org.opendaylight.yangtools.yang.parser.api.YangParserFactory) DefaultYangParserFactory(org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory) DefaultBindingRuntimeGenerator(org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator) BindingRuntimeGenerator(org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator)

Aggregations

ConstantAdapterContext (org.opendaylight.mdsal.binding.dom.adapter.ConstantAdapterContext)1 BindingCodecContext (org.opendaylight.mdsal.binding.dom.codec.impl.BindingCodecContext)1 DefaultBindingRuntimeGenerator (org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator)1 BindingRuntimeGenerator (org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator)1 BindingRuntimeTypes (org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeTypes)1 DefaultBindingRuntimeContext (org.opendaylight.mdsal.binding.runtime.api.DefaultBindingRuntimeContext)1 ModuleInfoSnapshot (org.opendaylight.mdsal.binding.runtime.api.ModuleInfoSnapshot)1 ModuleInfoSnapshotResolver (org.opendaylight.mdsal.binding.runtime.spi.ModuleInfoSnapshotResolver)1 YangParserFactory (org.opendaylight.yangtools.yang.parser.api.YangParserFactory)1 DefaultYangParserFactory (org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory)1