Class AbstractSchemaSourceCache<T extends org.opendaylight.yangtools.yang.model.repo.api.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:
GuavaSchemaSourceCache
public abstract class AbstractSchemaSourceCache<T extends org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation> extends Object implements SchemaSourceListener, SchemaSourceProvider<T>
Abstract base class for cache-type SchemaSourceListeners. It needs to be registered with aSchemaSourceRegistry, where it gets notifications from. It performs filtering andoffer(SchemaSourceRepresentation)s conforming sources to the subclass.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSchemaSourceCache(SchemaSourceRegistry consumer, Class<T> representation, PotentialSchemaSource.Costs cost)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract voidoffer(T source)Offer a schema source in requested representation for caching.protected SchemaSourceRegistration<T>register(org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier sourceIdentifier)Register the presence of a cached schema source with the consumer.voidschemaSourceEncountered(org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation source)Invoked when the registry sees a concrete source.voidschemaSourceRegistered(Iterable<PotentialSchemaSource<?>> sources)Invoked when a new schema source is registered by a provider.voidschemaSourceUnregistered(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 Detail
-
AbstractSchemaSourceCache
protected AbstractSchemaSourceCache(SchemaSourceRegistry consumer, Class<T> representation, PotentialSchemaSource.Costs cost)
-
-
Method Detail
-
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 callregister(SourceIdentifier).- Parameters:
source- schema source
-
register
protected final SchemaSourceRegistration<T> register(org.opendaylight.yangtools.yang.model.repo.api.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(org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation source)
Description copied from interface:SchemaSourceListenerInvoked 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:
schemaSourceEncounteredin interfaceSchemaSourceListener- Parameters:
source- Schema source
-
schemaSourceRegistered
public final void schemaSourceRegistered(Iterable<PotentialSchemaSource<?>> sources)
Description copied from interface:SchemaSourceListenerInvoked 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:
schemaSourceRegisteredin interfaceSchemaSourceListener- Parameters:
sources- Newly available sources
-
schemaSourceUnregistered
public final void schemaSourceUnregistered(PotentialSchemaSource<?> source)
Description copied from interface:SchemaSourceListenerInvoked when a schema source is unregistered.- Specified by:
schemaSourceUnregisteredin interfaceSchemaSourceListener- Parameters:
source- Schema source representation
-
-