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 Summary
ModifierConstructorDescriptionprotected
AbstractSchemaSourceCache
(SchemaSourceRegistry consumer, Class<T> representation, PotentialSchemaSource.Costs cost) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
Offer a schema source in requested representation for caching.protected final SchemaSourceRegistration<T>
register
(SourceIdentifier sourceIdentifier) Register the presence of a cached schema source with the consumer.void
Invoked when the registry sees a concrete source.final void
schemaSourceRegistered
(Iterable<PotentialSchemaSource<?>> sources) Invoked when a new schema source is registered by a provider.final void
schemaSourceUnregistered
(PotentialSchemaSource<?> source) Invoked when a schema source is unregistered.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider
getSource
-
Constructor Details
-
AbstractSchemaSourceCache
protected AbstractSchemaSourceCache(SchemaSourceRegistry consumer, Class<T> representation, PotentialSchemaSource.Costs cost)
-
-
Method Details
-
offer
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 callregister(SourceIdentifier)
.- Parameters:
source
- schema source
-
register
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
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 interfaceSchemaSourceListener
- Parameters:
source
- Schema source
-
schemaSourceRegistered
Description copied from interface:SchemaSourceListener
Invoked when a new schema source is registered by a provider. This call callback, along withSchemaSourceListener.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 interfaceSchemaSourceListener
- Parameters:
sources
- Newly available sources
-
schemaSourceUnregistered
Description copied from interface:SchemaSourceListener
Invoked when a schema source is unregistered.- Specified by:
schemaSourceUnregistered
in interfaceSchemaSourceListener
- Parameters:
source
- Schema source representation
-