Class AbstractSchemaSourceCache<T extends SchemaSourceRepresentation>

java.lang.Object
org.opendaylight.yangtools.yang.model.repo.spi.AbstractSchemaSourceCache<T>
Type Parameters:
T - Cached schema source type.
All Implemented Interfaces:
EventListener, SchemaSourceListener, SchemaSourceProvider<T>
Direct Known Subclasses:
FilesystemSchemaSourceCache, GuavaSchemaSourceCache, SoftSchemaSourceCache

public abstract class AbstractSchemaSourceCache<T extends SchemaSourceRepresentation> extends Object implements SchemaSourceListener, SchemaSourceProvider<T>
Abstract base class for cache-type SchemaSourceListeners. It needs to be registered with a SchemaSourceRegistry, where it gets notifications from. It performs filtering and offer(SchemaSourceRepresentation)s conforming sources to the subclass.
  • Constructor Details

  • Method Details

    • offer

      protected abstract void offer(T source)
      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 register(SourceIdentifier).
      Parameters:
      source - schema source
    • register

      protected final SchemaSourceRegistration<T> register(SourceIdentifier sourceIdentifier)
      Register the presence of a cached schema source with the consumer. Subclasses need to call this method once they have cached a schema source representation, or when they have determined they have a schema source is available -- like when a persistent cache reads its cache index.
      Parameters:
      sourceIdentifier - Source identifier
      Returns:
      schema source registration, which the subclass needs to SchemaSourceRegistration.close() once it expunges the source from the cache.
    • schemaSourceEncountered

      public void schemaSourceEncountered(SchemaSourceRepresentation source)
      Description copied from interface: SchemaSourceListener
      Invoked when the registry sees a concrete source. This callback is typically used by cache-type listeners, who intercept the source, store it locally and announce themselves as a provider of that particular schema source.
      Specified by:
      schemaSourceEncountered in interface SchemaSourceListener
      Parameters:
      source - Schema source
    • schemaSourceRegistered

      public final void schemaSourceRegistered(Iterable<PotentialSchemaSource<?>> sources)
      Description copied from interface: SchemaSourceListener
      Invoked when a new schema source is registered by a provider. This call callback, along with SchemaSourceListener.schemaSourceUnregistered(PotentialSchemaSource) is typically used by transformer-type listeners, who intercept the registration if the advertised representation matches their input type and register themselves as a potential provider of the same source in their output representation type.
      Specified by:
      schemaSourceRegistered in interface SchemaSourceListener
      Parameters:
      sources - Newly available sources
    • schemaSourceUnregistered

      public final void schemaSourceUnregistered(PotentialSchemaSource<?> source)
      Description copied from interface: SchemaSourceListener
      Invoked when a schema source is unregistered.
      Specified by:
      schemaSourceUnregistered in interface SchemaSourceListener
      Parameters:
      source - Schema source representation