Class FilesystemSchemaSourceCache<T extends SourceRepresentation>
java.lang.Object
org.opendaylight.yangtools.yang.model.repo.spi.AbstractSchemaSourceCache<T>
org.opendaylight.yangtools.yang.model.repo.fs.FilesystemSchemaSourceCache<T>
- All Implemented Interfaces:
SchemaSourceListener
,SchemaSourceProvider<T>
public final class FilesystemSchemaSourceCache<T extends SourceRepresentation>
extends AbstractSchemaSourceCache<T>
Cache implementation that stores schemas in form of files under provided folder.
-
Constructor Summary
ConstructorsConstructorDescriptionFilesystemSchemaSourceCache
(SchemaSourceRegistry consumer, Class<T> representation, File storageDirectory) -
Method Summary
Modifier and TypeMethodDescriptionFluentFuture<? extends T>
getSource
(SourceIdentifier sourceIdentifier) Returns a representation a for supplied YANG source identifier.protected void
Offer a schema source in requested representation for caching.Methods inherited from class org.opendaylight.yangtools.yang.model.repo.spi.AbstractSchemaSourceCache
register, schemaSourceEncountered, schemaSourceRegistered, schemaSourceUnregistered
-
Constructor Details
-
FilesystemSchemaSourceCache
public FilesystemSchemaSourceCache(SchemaSourceRegistry consumer, Class<T> representation, File storageDirectory)
-
-
Method Details
-
getSource
Description copied from interface:SchemaSourceProvider
Returns a representation a for supplied YANG source identifier. The resolution criteria are as follows:- If the source identifier specifies a revision, this method returns either a representation of that
particular revision or throw
MissingSchemaSourceException
- If the source identifier does not specify a revision, this method returns the newest available revision,
or throws
MissingSchemaSourceException
In either case the returned representation is required to report a non-null revision in the
SourceIdentifier
returned fromSourceRepresentation.sourceId()
.Implementations are not required to provide constant behavior in time, notably this different invocation of this method may produce different results.
- Parameters:
sourceIdentifier
- source identifier- Returns:
- future source representation, if supplied YANG module is available
- If the source identifier specifies a revision, this method returns either a representation of that
particular revision or throw
-
offer
Description copied from class:AbstractSchemaSourceCache
Offer a schema source in requested representation for caching. Subclasses need to implement this method to store the schema source. Once they have determined to cache the source, they should callAbstractSchemaSourceCache.register(SourceIdentifier)
.- Specified by:
offer
in classAbstractSchemaSourceCache<T extends SourceRepresentation>
- Parameters:
source
- schema source
-