Class SoftSchemaSourceCache<T extends org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation>

java.lang.Object
org.opendaylight.yangtools.yang.model.repo.spi.AbstractSchemaSourceCache<T>
org.opendaylight.yangtools.yang.model.repo.spi.SoftSchemaSourceCache<T>
Type Parameters:
T - SchemaSourceRepresentation type stored in this cache
All Implemented Interfaces:
AutoCloseable, EventListener, SchemaSourceListener, SchemaSourceProvider<T>

@Beta public final class SoftSchemaSourceCache<T extends org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation> extends AbstractSchemaSourceCache<T> implements AutoCloseable
A simple AbstractSchemaSourceCache maintaining soft references.
  • Constructor Details

  • Method Details

    • getSource

      public com.google.common.util.concurrent.ListenableFuture<? extends T> getSource(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier sourceIdentifier)
      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 from SchemaSourceRepresentation.getIdentifier().

      Implementations are not required to provide constant behavior in time, notably this different invocation of this method may produce different results.

      Specified by:
      getSource in interface SchemaSourceProvider<T extends org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation>
      Parameters:
      sourceIdentifier - source identifier
      Returns:
      future source representation, if supplied YANG module is available
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • offer

      protected void offer(T source)
      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 call AbstractSchemaSourceCache.register(SourceIdentifier).
      Specified by:
      offer in class AbstractSchemaSourceCache<T extends org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation>
      Parameters:
      source - schema source