public class SchemaRegistryClient extends Object implements ISchemaRegistryClient
ISchemaRegistryClient which connects to the given rootCatalogURL.
An instance of SchemaRegistryClient can be instantiated by passing configuration properties like below.
SchemaRegistryClient schemaRegistryClient = new SchemaRegistryClient(config);
There are different options available as mentioned in SchemaRegistryClient.Configuration like
-SchemaRegistryClient.Configuration.SCHEMA_REGISTRY_URL. -SchemaRegistryClient.Configuration.SCHEMA_METADATA_CACHE_SIZE. -SchemaRegistryClient.Configuration.SCHEMA_METADATA_CACHE_EXPIRY_INTERVAL_SECS. -SchemaRegistryClient.Configuration.SCHEMA_VERSION_CACHE_SIZE. -SchemaRegistryClient.Configuration.SCHEMA_VERSION_CACHE_EXPIRY_INTERVAL_SECS. -SchemaRegistryClient.Configuration.SCHEMA_TEXT_CACHE_SIZE. -SchemaRegistryClient.Configuration.SCHEMA_TEXT_CACHE_EXPIRY_INTERVAL_SECS. and many other properties likeClientProperties
This can be used to
- register schema metadata
- add new versions of a schema
- fetch different versions of schema
- fetch latest version of a schema
- check whether the given schema text is compatible with a latest version of the schema
- register serializer/deserializer for a schema
- fetch serializer/deserializer for a schema
| Modifier and Type | Class and Description |
|---|---|
static class |
SchemaRegistryClient.Configuration |
| Constructor and Description |
|---|
SchemaRegistryClient(File confFile)
Creates
SchemaRegistryClient instance with the given yaml config. |
SchemaRegistryClient(Map<String,?> conf) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddSchemaVersion, addSchemaVersion, addSchemaVersion, addSchemaVersion, mergeSchemaVersionpublic SchemaRegistryClient(File confFile) throws IOException
SchemaRegistryClient instance with the given yaml config.confFile - config file which contains the configuration entries.IOException - when any IOException occurs while reading the given confFileprotected void initializeSecurityContext()
protected SSLContext createSSLContext(Map<String,String> sslConfigurations)
protected com.hortonworks.registries.shaded.org.glassfish.jersey.client.ClientConfig createClientConfig(Map<String,?> conf)
public SchemaRegistryClient.Configuration getConfiguration()
public Collection<SchemaProviderInfo> getSupportedSchemaProviders()
getSupportedSchemaProviders in interface ISchemaRegistryServicepublic Long registerSchemaMetadata(SchemaMetadata schemaMetadata)
registerSchemaMetadata in interface ISchemaRegistryServicepublic Long addSchemaMetadata(SchemaMetadata schemaMetadata)
addSchemaMetadata in interface ISchemaRegistryServicepublic SchemaMetadataInfo updateSchemaMetadata(String schemaName, SchemaMetadata schemaMetadata)
updateSchemaMetadata in interface ISchemaRegistryServicepublic SchemaMetadataInfo getSchemaMetadataInfo(String schemaName)
getSchemaMetadataInfo in interface ISchemaRegistryServicepublic SchemaMetadataInfo getSchemaMetadataInfo(Long schemaMetadataId)
getSchemaMetadataInfo in interface ISchemaRegistryServicepublic void deleteSchema(String schemaName) throws SchemaNotFoundException
deleteSchema in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic SchemaIdVersion addSchemaVersion(SchemaMetadata schemaMetadata, SchemaVersion schemaVersion, boolean disableCanonicalCheck) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException
addSchemaVersion in interface ISchemaRegistryServiceInvalidSchemaExceptionIncompatibleSchemaExceptionSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic SchemaIdVersion addSchemaVersion(String schemaBranchName, SchemaMetadata schemaMetadata, SchemaVersion schemaVersion, boolean disableCanonicalCheck) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException
addSchemaVersion in interface ISchemaRegistryServiceInvalidSchemaExceptionIncompatibleSchemaExceptionSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic SchemaIdVersion uploadSchemaVersion(String schemaName, String description, InputStream schemaVersionTextFile) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException
uploadSchemaVersion in interface ISchemaRegistryClientInvalidSchemaExceptionIncompatibleSchemaExceptionSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic SchemaIdVersion uploadSchemaVersion(String schemaBranchName, String schemaName, String description, InputStream schemaVersionInputStream) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException
uploadSchemaVersion in interface ISchemaRegistryClientInvalidSchemaExceptionIncompatibleSchemaExceptionSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic SchemaIdVersion addSchemaVersion(String schemaName, SchemaVersion schemaVersion, boolean disableCanonicalCheck) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException
addSchemaVersion in interface ISchemaRegistryServiceInvalidSchemaExceptionIncompatibleSchemaExceptionSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic SchemaIdVersion addSchemaVersion(String schemaBranchName, String schemaName, SchemaVersion schemaVersion, boolean disableCanonicalCheck) throws InvalidSchemaException, IncompatibleSchemaException, SchemaNotFoundException, SchemaBranchNotFoundException
addSchemaVersion in interface ISchemaRegistryServiceInvalidSchemaExceptionIncompatibleSchemaExceptionSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic void deleteSchemaVersion(SchemaVersionKey schemaVersionKey) throws SchemaNotFoundException, SchemaLifecycleException
deleteSchemaVersion in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionpublic static CatalogResponse readCatalogResponse(String msg)
public SchemaVersionInfo getSchemaVersionInfo(SchemaIdVersion schemaIdVersion) throws SchemaNotFoundException
getSchemaVersionInfo in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic SchemaVersionInfo getLatestSchemaVersionInfo(String schemaName) throws SchemaNotFoundException
getLatestSchemaVersionInfo in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic SchemaVersionInfo getSchemaVersionInfo(SchemaVersionKey schemaVersionKey) throws SchemaNotFoundException
getSchemaVersionInfo in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic SchemaVersionInfo getLatestSchemaVersionInfo(String schemaBranchName, String schemaName) throws SchemaNotFoundException
getLatestSchemaVersionInfo in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic Collection<SchemaVersionInfo> getAllVersions(String schemaName) throws SchemaNotFoundException
getAllVersions in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic void enableSchemaVersion(Long schemaVersionId) throws SchemaNotFoundException, SchemaLifecycleException, IncompatibleSchemaException
enableSchemaVersion in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionIncompatibleSchemaExceptionpublic void disableSchemaVersion(Long schemaVersionId) throws SchemaNotFoundException, SchemaLifecycleException
disableSchemaVersion in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionpublic void deleteSchemaVersion(Long schemaVersionId) throws SchemaNotFoundException, SchemaLifecycleException
deleteSchemaVersion in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionpublic void archiveSchemaVersion(Long schemaVersionId) throws SchemaNotFoundException, SchemaLifecycleException
archiveSchemaVersion in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionpublic void startSchemaVersionReview(Long schemaVersionId) throws SchemaNotFoundException, SchemaLifecycleException
startSchemaVersionReview in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionpublic SchemaVersionMergeResult mergeSchemaVersion(Long schemaVersionId, boolean disableCanonicalCheck) throws SchemaNotFoundException, IncompatibleSchemaException
mergeSchemaVersion in interface ISchemaRegistryServiceSchemaNotFoundExceptionIncompatibleSchemaExceptionpublic void transitionState(Long schemaVersionId, Byte targetStateId, byte[] transitionDetails) throws SchemaNotFoundException, SchemaLifecycleException
transitionState in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaLifecycleExceptionpublic SchemaVersionLifecycleStateMachineInfo getSchemaVersionLifecycleStateMachineInfo()
getSchemaVersionLifecycleStateMachineInfo in interface ISchemaRegistryServicepublic SchemaBranch createSchemaBranch(Long schemaVersionId, SchemaBranch schemaBranch) throws SchemaBranchAlreadyExistsException, SchemaNotFoundException
createSchemaBranch in interface ISchemaRegistryServiceSchemaBranchAlreadyExistsExceptionSchemaNotFoundExceptionpublic Collection<SchemaBranch> getSchemaBranches(String schemaName) throws SchemaNotFoundException
getSchemaBranches in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic void deleteSchemaBranch(Long schemaBranchId) throws SchemaBranchNotFoundException, InvalidSchemaBranchDeletionException
deleteSchemaBranch in interface ISchemaRegistryServiceSchemaBranchNotFoundExceptionInvalidSchemaBranchDeletionExceptionpublic Collection<SchemaVersionInfo> getAllVersions(String schemaBranchName, String schemaName, List<Byte> stateIds) throws SchemaNotFoundException, SchemaBranchNotFoundException
getAllVersions in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic Collection<SchemaVersionInfo> getAllVersions(String schemaBranchName, String schemaName) throws SchemaNotFoundException
getAllVersions in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic CompatibilityResult checkCompatibility(String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException
checkCompatibility in interface ISchemaRegistryServiceSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic CompatibilityResult checkCompatibility(String schemaBranchName, String schemaName, String toSchemaText) throws SchemaNotFoundException
checkCompatibility in interface ISchemaRegistryServiceSchemaNotFoundExceptionpublic boolean isCompatibleWithAllVersions(String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException
isCompatibleWithAllVersions in interface ISchemaRegistryClientSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic boolean isCompatibleWithAllVersions(String schemaBranchName, String schemaName, String toSchemaText) throws SchemaNotFoundException, SchemaBranchNotFoundException
isCompatibleWithAllVersions in interface ISchemaRegistryClientSchemaNotFoundExceptionSchemaBranchNotFoundExceptionpublic Collection<SchemaVersionKey> findSchemasByFields(SchemaFieldQuery schemaFieldQuery)
findSchemasByFields in interface ISchemaRegistryServicepublic String uploadFile(InputStream inputStream)
uploadFile in interface ISchemaRegistryServicepublic InputStream downloadFile(String fileId)
downloadFile in interface ISchemaRegistryServicepublic Long addSerDes(SerDesPair serDesPair)
addSerDes in interface ISchemaRegistryServicepublic void mapSchemaWithSerDes(String schemaName, Long serDesId)
mapSchemaWithSerDes in interface ISchemaRegistryServicepublic <T> T getDefaultSerializer(String type) throws SerDesException
getDefaultSerializer in interface ISchemaRegistryClientSerDesExceptionpublic <T> T getDefaultDeserializer(String type) throws SerDesException
getDefaultDeserializer in interface ISchemaRegistryClientSerDesExceptionpublic Collection<SerDesInfo> getSerDes(String schemaName)
getSerDes in interface ISchemaRegistryServicepublic <T> T createSerializerInstance(SerDesInfo serDesInfo)
createSerializerInstance in interface ISchemaRegistryClientpublic <T> T createDeserializerInstance(SerDesInfo serDesInfo)
createDeserializerInstance in interface ISchemaRegistryClientpublic void close()
close in interface AutoCloseablepublic SchemaRegistryVersion clientVersion()
Copyright © 2020. All rights reserved.