Package io.apicurio.registry.resolver
Class AbstractSchemaResolver<S,T>
- java.lang.Object
-
- io.apicurio.registry.resolver.AbstractSchemaResolver<S,T>
-
- All Implemented Interfaces:
SchemaResolver<S,T>,Closeable,AutoCloseable
- Direct Known Subclasses:
DefaultSchemaResolver
public abstract class AbstractSchemaResolver<S,T> extends Object implements SchemaResolver<S,T>
Base implementation ofSchemaResolver- Author:
- Fabian Martinez, Jakub Senko
-
-
Field Summary
Fields Modifier and Type Field Description protected ArtifactReferenceResolverStrategy<S,T>artifactResolverStrategyprotected io.apicurio.rest.client.spi.ApicurioHttpClientauthClientprotected RegistryClientclientprotected DefaultSchemaResolverConfigconfigprotected StringexplicitArtifactGroupIdprotected StringexplicitArtifactIdprotected StringexplicitArtifactVersionprotected ERCache<SchemaLookupResult<S>>schemaCacheprotected SchemaParser<S,T>schemaParser
-
Constructor Summary
Constructors Constructor Description AbstractSchemaResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidconfigure(Map<String,?> configs, SchemaParser<S,T> schemaParser)Configure, if supported.SchemaParser<S,T>getSchemaParser()protected voidloadFromArtifactMetaData(io.apicurio.registry.rest.v2.beans.ArtifactMetaData artifactMetadata, SchemaLookupResult.SchemaLookupResultBuilder<S> resultBuilder)protected voidloadFromArtifactMetaData(io.apicurio.registry.rest.v2.beans.VersionMetaData artifactMetadata, SchemaLookupResult.SchemaLookupResultBuilder<S> resultBuilder)voidreset()Hard reset cacheprotected ArtifactReferenceresolveArtifactReference(Record<T> data, ParsedSchema<S> parsedSchema)Resolve an artifact reference for the given record, and optional parsed schema.protected SchemaLookupResult<S>resolveSchemaByGlobalId(long globalId)voidsetArtifactResolverStrategy(ArtifactReferenceResolverStrategy<S,T> artifactResolverStrategy)voidsetClient(RegistryClient client)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.apicurio.registry.resolver.SchemaResolver
resolveSchema, resolveSchemaByArtifactReference
-
-
-
-
Field Detail
-
schemaCache
protected final ERCache<SchemaLookupResult<S>> schemaCache
-
config
protected DefaultSchemaResolverConfig config
-
schemaParser
protected SchemaParser<S,T> schemaParser
-
client
protected RegistryClient client
-
authClient
protected io.apicurio.rest.client.spi.ApicurioHttpClient authClient
-
artifactResolverStrategy
protected ArtifactReferenceResolverStrategy<S,T> artifactResolverStrategy
-
explicitArtifactGroupId
protected String explicitArtifactGroupId
-
explicitArtifactId
protected String explicitArtifactId
-
explicitArtifactVersion
protected String explicitArtifactVersion
-
-
Method Detail
-
configure
public void configure(Map<String,?> configs, SchemaParser<S,T> schemaParser)
Description copied from interface:SchemaResolverConfigure, if supported.- Specified by:
configurein interfaceSchemaResolver<S,T>- Parameters:
configs- the configs
-
setClient
public void setClient(RegistryClient client)
- Specified by:
setClientin interfaceSchemaResolver<S,T>- Parameters:
client- the client to set
-
setArtifactResolverStrategy
public void setArtifactResolverStrategy(ArtifactReferenceResolverStrategy<S,T> artifactResolverStrategy)
- Specified by:
setArtifactResolverStrategyin interfaceSchemaResolver<S,T>- Parameters:
artifactResolverStrategy- the artifactResolverStrategy to set
-
getSchemaParser
public SchemaParser<S,T> getSchemaParser()
- Specified by:
getSchemaParserin interfaceSchemaResolver<S,T>- See Also:
SchemaResolver.getSchemaParser()
-
resolveArtifactReference
protected ArtifactReference resolveArtifactReference(Record<T> data, ParsedSchema<S> parsedSchema)
Resolve an artifact reference for the given record, and optional parsed schema. This will use the artifact resolver strategy and then override the values from that strategy with any explicitly configured values (groupId, artifactId, version).- Parameters:
data-parsedSchema-- Returns:
- artifact reference
-
resolveSchemaByGlobalId
protected SchemaLookupResult<S> resolveSchemaByGlobalId(long globalId)
-
reset
public void reset()
Description copied from interface:SchemaResolverHard reset cache- Specified by:
resetin interfaceSchemaResolver<S,T>- See Also:
SchemaResolver.reset()
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- See Also:
Closeable.close()
-
loadFromArtifactMetaData
protected void loadFromArtifactMetaData(io.apicurio.registry.rest.v2.beans.ArtifactMetaData artifactMetadata, SchemaLookupResult.SchemaLookupResultBuilder<S> resultBuilder)
-
loadFromArtifactMetaData
protected void loadFromArtifactMetaData(io.apicurio.registry.rest.v2.beans.VersionMetaData artifactMetadata, SchemaLookupResult.SchemaLookupResultBuilder<S> resultBuilder)
-
-