use of org.opendaylight.netconf.sal.connect.netconf.NetconfStateSchemasResolverImpl in project netconf by opendaylight.
the class DefaultSchemaResourceManager method createResources.
@NonNull
private SchemaResourcesDTO createResources(final String subdir) {
// Setup the baseline empty registry
final SharedSchemaRepository repository = new SharedSchemaRepository(subdir, parserFactory);
// Teach the registry how to transform YANG text to IRSchemaSource internally
repository.registerSchemaSourceListener(TextToIRTransformer.create(repository, repository));
// Attach a soft cache of IRSchemaSource instances. This is important during convergence when we are fishing
// for a consistent set of modules, as it skips the need to re-parse the text sources multiple times. It also
// helps establishing different sets of contexts, as they can share this pre-made cache.
repository.registerSchemaSourceListener(// FIXME: add knobs to control cache lifetime explicitly
GuavaSchemaSourceCache.createSoftCache(repository, IRSchemaSource.class));
// Attach the filesystem cache, providing persistence capability, so that restarts do not require us to
// re-populate the cache. This also acts as a side-load capability, as anything pre-populated into that
// directory will not be fetched from the device.
repository.registerSchemaSourceListener(new FilesystemSchemaSourceCache<>(repository, YangTextSchemaSource.class, new File(rootDirectory + File.separator + subdir)));
return new SchemaResourcesDTO(repository, repository, repository.createEffectiveModelContextFactory(SchemaContextFactoryConfiguration.getDefault()), new NetconfStateSchemasResolverImpl());
}
Aggregations