Class AbstractSqlRegistryStorage
- java.lang.Object
-
- io.apicurio.registry.storage.impl.AbstractRegistryStorage
-
- io.apicurio.registry.storage.impl.sql.AbstractSqlRegistryStorage
-
- All Implemented Interfaces:
RegistryStorage
- Direct Known Subclasses:
InMemoryRegistryStorage
public abstract class AbstractSqlRegistryStorage extends AbstractRegistryStorage
A SQL implementation of theRegistryStorage
interface. This impl does not use any ORM technology - it simply uses native SQL for all operations.- Author:
- eric.wittmann@gmail.com
-
-
Field Summary
Fields Modifier and Type Field Description protected org.jdbi.v3.core.Jdbi
jdbi
-
Constructor Summary
Constructors Constructor Description AbstractSqlRegistryStorage()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ContentHandle
canonicalizeContent(ArtifactType artifactType, ContentHandle content)
Canonicalize the given content, returns the content unchanged in the case of an error.CompletionStage<ArtifactMetaDataDto>
createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content)
Creates a new artifact (from the given value) in the artifactStore.protected CompletionStage<ArtifactMetaDataDto>
createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator)
CompletionStage<Void>
createArtifactRuleAsync(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)
protected CompletionStage<ArtifactMetaDataDto>
createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, long contentId, String createdBy, Date createdOn, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)
CompletionStage<ArtifactMetaDataDto>
createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData)
Creates a new artifact (from the given value including metadata) in the artifactStore.protected CompletionStage<ArtifactMetaDataDto>
createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)
void
createGlobalRule(RuleType rule, RuleConfigurationDto config)
Creates a single global rule.void
createGroup(GroupMetaDataDto group)
Creates a new empty group and stores it's metadata.protected Long
createOrUpdateContent(org.jdbi.v3.core.Handle handle, ArtifactType artifactType, ContentHandle content)
Store the content in the database and return the ID of the new row.List<String>
deleteArtifact(String groupId, String artifactId)
Deletes an artifact by its group and unique id.void
deleteArtifactRule(String groupId, String artifactId, RuleType rule)
Deletes a single stored/configured rule for a given artifact.void
deleteArtifactRules(String groupId, String artifactId)
Deletes all rules stored/configured for the artifact.void
deleteArtifacts(String groupId)
Deletes all artifacts in the given group.void
deleteArtifactVersion(String groupId, String artifactId, String version)
Deletes a single version of a given artifact.void
deleteArtifactVersionMetaData(String groupId, String artifactId, String version)
Deletes the user-editable meta-data for a singel version of a given artifact.void
deleteGlobalRule(RuleType rule)
Deletes a single global rule.void
deleteGlobalRules()
Deletes all of the globally configured rules.void
deleteGroup(String groupId)
Deletes a group intified by the given groupId and DELETES ALL resources related to this groupvoid
exportData(Function<Entity,Void> handler)
Called to export all data in the registry.protected EditableArtifactMetaDataDto
extractMetaData(ArtifactType artifactType, ContentHandle content)
StoredArtifactDto
getArtifact(String groupId, String artifactId)
Gets the most recent version of the value of the artifact with the given group and ID.ContentHandle
getArtifactByContentHash(String contentHash)
Gets some artifact content by the SHA-256 hash of that content.ContentHandle
getArtifactByContentId(long contentId)
Gets some artifact content by the unique contentId.Set<String>
getArtifactIds(Integer limit)
Get all artifact ids.ArtifactMetaDataDto
getArtifactMetaData(long globalId)
Gets the stored meta-data for an artifact by global ID.ArtifactMetaDataDto
getArtifactMetaData(String groupId, String artifactId)
Gets the stored meta-data for an artifact by group and ID.RuleConfigurationDto
getArtifactRule(String groupId, String artifactId, RuleType rule)
Gets all of the information for a single rule configured on a given artifact.List<RuleType>
getArtifactRules(String groupId, String artifactId)
Gets a list of rules configured for a specific Artifact (by group and ID).StoredArtifactDto
getArtifactVersion(long globalId)
Gets the stored artifact content for the artifact version with the given unique global ID.StoredArtifactDto
getArtifactVersion(String groupId, String artifactId, String version)
Gets the stored value for a single version of a given artifact.ArtifactVersionMetaDataDto
getArtifactVersionMetaData(String groupId, String artifactId, boolean canonical, ContentHandle content)
Gets the metadata of the version that matches content.ArtifactVersionMetaDataDto
getArtifactVersionMetaData(String groupId, String artifactId, String version)
Gets the stored meta-data for a single version of an artifact.List<String>
getArtifactVersions(String groupId, String artifactId)
Gets a sorted set of all artifact versions that exist for a given artifact.List<ArtifactMetaDataDto>
getArtifactVersionsByContentId(long contentId)
Get artifact metadata for a given contentIdRuleConfigurationDto
getGlobalRule(RuleType rule)
Gets all information about a single global rule.List<RuleType>
getGlobalRules()
Gets a list of all global rule names.List<String>
getGroupIds(Integer limit)
Get all groupIdsGroupMetaDataDto
getGroupMetaData(String groupId)
Get the metadata information for a group identified by the given groupIdLogConfigurationDto
getLogConfiguration(String logger)
Returns the log configuration persisted in the storage for the given loggerprotected void
importArtifactRule(org.jdbi.v3.core.Handle handle, ArtifactRuleEntity entity)
protected void
importArtifactVersion(org.jdbi.v3.core.Handle handle, ArtifactVersionEntity entity)
protected void
importContent(org.jdbi.v3.core.Handle handle, ContentEntity entity)
void
importData(EntityInputStream entities)
Called to import previously exported data into the registry.protected void
importEntity(org.jdbi.v3.core.Handle handle, Entity entity)
protected void
importGlobalRule(org.jdbi.v3.core.Handle handle, GlobalRuleEntity entity)
protected void
importGroup(org.jdbi.v3.core.Handle handle, GroupEntity entity)
protected void
initialize()
boolean
isArtifactExists(String groupId, String artifactId)
boolean
isContentExists(long contentId)
boolean
isGlobalIdExists(long globalId)
List<LogConfigurationDto>
listLogConfigurations()
Returns the list of log configuration persisted in the storageprotected static long
nextContentId(org.jdbi.v3.core.Handle handle)
protected static long
nextGlobalId(org.jdbi.v3.core.Handle handle)
void
removeLogConfiguration(String logger)
Removes the persisted log configuration for the given loggerprotected void
resetContentId(org.jdbi.v3.core.Handle handle)
protected void
resetGlobalId(org.jdbi.v3.core.Handle handle)
ArtifactSearchResultsDto
searchArtifacts(Set<SearchFilter> filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit)
Search artifacts by given criteriaVersionSearchResultsDto
searchVersions(String groupId, String artifactId, int offset, int limit)
Fetch the versions of the given artifactvoid
setLogConfiguration(LogConfigurationDto logConfiguration)
Persists the given log configurationprotected SqlStatements
sqlStatements()
String
storageName()
The storage nameboolean
supportsMultiTenancy()
Returns true if the storage implementation supports multitenancy.protected TenantContext
tenantContext()
CompletionStage<ArtifactMetaDataDto>
updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content)
Updates the artifact value by storing the given value as a new version of the artifact.protected CompletionStage<ArtifactMetaDataDto>
updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator)
void
updateArtifactMetaData(String groupId, String artifactId, EditableArtifactMetaDataDto metaData)
Updates the stored meta-data for an artifact by group and ID.void
updateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)
Updates the configuration information for a single rule on a given artifact.void
updateArtifactState(String groupId, String artifactId, ArtifactState state)
Update artifact state.void
updateArtifactState(String groupId, String artifactId, String version, ArtifactState state)
Update artifact state.void
updateArtifactVersionMetaData(String groupId, String artifactId, String version, EditableArtifactMetaDataDto metaData)
Updates the user-editable meta-data for a single version of a given artifact.protected CompletionStage<ArtifactMetaDataDto>
updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, long contentId, String createdBy, Date createdOn, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)
CompletionStage<ArtifactMetaDataDto>
updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData)
Updates the artifact value by storing the given value and metadata as a new version of the artifact.protected CompletionStage<ArtifactMetaDataDto>
updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)
void
updateGlobalRule(RuleType rule, RuleConfigurationDto config)
Updates the configuration settings for a single global rule.void
updateGroupMetaData(GroupMetaDataDto group)
Updates the metadata of an existent group.protected <R,X extends Exception>
RwithHandle(org.jdbi.v3.core.HandleCallback<R,X> callback)
-
Methods inherited from class io.apicurio.registry.storage.impl.AbstractRegistryStorage
createArtifactRule, isAlive, isReady
-
-
-
-
Method Detail
-
tenantContext
protected TenantContext tenantContext()
-
sqlStatements
protected SqlStatements sqlStatements()
-
withHandle
protected <R,X extends Exception> R withHandle(org.jdbi.v3.core.HandleCallback<R,X> callback)
-
initialize
@PostConstruct protected void initialize()
-
storageName
public String storageName()
Description copied from interface:RegistryStorage
The storage name- See Also:
RegistryStorage.storageName()
-
supportsMultiTenancy
public boolean supportsMultiTenancy()
Description copied from interface:RegistryStorage
Returns true if the storage implementation supports multitenancy. If the storage supports multitenancy, it will get the tenant information from theTenantContext
- Returns:
- if multitenancy is supported
- See Also:
RegistryStorage.supportsMultiTenancy()
-
getArtifactByContentId
public ContentHandle getArtifactByContentId(long contentId) throws ContentNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets some artifact content by the unique contentId. This method of getting content from storage does not allow extra meta-data to be returned, because the contentId only points to a piece of content/data - it is divorced from any artifact version.
-
getArtifactByContentHash
public ContentHandle getArtifactByContentHash(String contentHash) throws ContentNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets some artifact content by the SHA-256 hash of that content. This method of getting content from storage does not allow extra meta-data to be returned, because the content hash only points to a piece of content/data - it is divorced from any artifact version.
-
getArtifactVersionsByContentId
public List<ArtifactMetaDataDto> getArtifactVersionsByContentId(long contentId)
Description copied from interface:RegistryStorage
Get artifact metadata for a given contentId- Returns:
- See Also:
RegistryStorage.getArtifactByContentId(long)
-
updateArtifactState
public void updateArtifactState(String groupId, String artifactId, ArtifactState state) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Update artifact state.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.updateArtifactState(java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactState)
-
updateArtifactState
public void updateArtifactState(String groupId, String artifactId, String version, ArtifactState state) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Update artifact state.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.updateArtifactState(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactState)
-
createArtifact
public CompletionStage<ArtifactMetaDataDto> createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content) throws ArtifactAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorage
Creates a new artifact (from the given value) in the artifactStore. The artifactId must be unique within the given artifact group. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value. If the group did not exist previously it is created automatically.- Parameters:
groupId
- (optional)version
- (optional)- Throws:
ArtifactAlreadyExistsException
RegistryStorageException
- See Also:
RegistryStorage.createArtifact(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactType, io.apicurio.registry.content.ContentHandle)
-
createArtifact
protected CompletionStage<ArtifactMetaDataDto> createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator) throws ArtifactAlreadyExistsException, RegistryStorageException
-
createOrUpdateContent
protected Long createOrUpdateContent(org.jdbi.v3.core.Handle handle, ArtifactType artifactType, ContentHandle content)
Store the content in the database and return the ID of the new row. If the content already exists, just return the content ID of the existing row.- Parameters:
handle
-artifactType
-content
-
-
createArtifactWithMetadata
public CompletionStage<ArtifactMetaDataDto> createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData) throws ArtifactAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorage
Creates a new artifact (from the given value including metadata) in the artifactStore. The artifactId must be unique within the given artifact group. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value.- Parameters:
groupId
- (optional) (optional)version
- (optional)- Throws:
ArtifactAlreadyExistsException
RegistryStorageException
- See Also:
RegistryStorage.createArtifactWithMetadata(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactType, io.apicurio.registry.content.ContentHandle, io.apicurio.registry.storage.dto.EditableArtifactMetaDataDto)
-
createArtifactWithMetadata
protected CompletionStage<ArtifactMetaDataDto> createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator) throws ArtifactAlreadyExistsException, RegistryStorageException
-
createArtifactWithMetadata
protected CompletionStage<ArtifactMetaDataDto> createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, long contentId, String createdBy, Date createdOn, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)
-
deleteArtifact
public List<String> deleteArtifact(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes an artifact by its group and unique id. Returns list of artifact versions.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.deleteArtifact(java.lang.String, java.lang.String)
-
deleteArtifacts
public void deleteArtifacts(String groupId) throws RegistryStorageException
Description copied from interface:RegistryStorage
Deletes all artifacts in the given group. DOES NOT delete the group.- Parameters:
groupId
- (optional)- Throws:
RegistryStorageException
- See Also:
RegistryStorage.deleteArtifacts(java.lang.String)
-
getArtifact
public StoredArtifactDto getArtifact(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the most recent version of the value of the artifact with the given group and ID.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifact(java.lang.String, java.lang.String)
-
updateArtifact
public CompletionStage<ArtifactMetaDataDto> updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the artifact value by storing the given value as a new version of the artifact. Previous value is NOT overwitten. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value.- Parameters:
groupId
- (optional)version
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.updateArtifact(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactType, io.apicurio.registry.content.ContentHandle)
-
updateArtifact
protected CompletionStage<ArtifactMetaDataDto> updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator) throws ArtifactNotFoundException, RegistryStorageException
-
updateArtifactWithMetadata
public CompletionStage<ArtifactMetaDataDto> updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the artifact value by storing the given value and metadata as a new version of the artifact. Previous value is NOT overwitten. Returns a map of meta-data generated by the artifactStore layer, such as the generated, globally unique globalId of the new value.- Parameters:
groupId
- (optional)version
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.updateArtifactWithMetadata(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactType, io.apicurio.registry.content.ContentHandle, io.apicurio.registry.storage.dto.EditableArtifactMetaDataDto)
-
updateArtifactWithMetadata
protected CompletionStage<ArtifactMetaDataDto> updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator) throws ArtifactNotFoundException, RegistryStorageException
-
updateArtifactWithMetadata
protected CompletionStage<ArtifactMetaDataDto> updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, long contentId, String createdBy, Date createdOn, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator) throws ArtifactNotFoundException, RegistryStorageException
-
getArtifactIds
public Set<String> getArtifactIds(Integer limit)
Description copied from interface:RegistryStorage
Get all artifact ids. --- Note: This should only be used in older APIs such as the registry V1 REST API and the Confluent API ---- Parameters:
limit
- the limit of artifacts- Returns:
- all artifact ids
- See Also:
RegistryStorage.getArtifactIds(java.lang.Integer)
-
searchArtifacts
public ArtifactSearchResultsDto searchArtifacts(Set<SearchFilter> filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit)
Description copied from interface:RegistryStorage
Search artifacts by given criteria- Parameters:
filters
- the set of filters to apply when searchingorderBy
- the field to order byorderDirection
- the direction to order the resultsoffset
- the number of artifacts to skiplimit
- the result size limit- See Also:
RegistryStorage.searchArtifacts(java.util.Set, io.apicurio.registry.storage.dto.OrderBy, io.apicurio.registry.storage.dto.OrderDirection, int, int)
-
getArtifactMetaData
public ArtifactMetaDataDto getArtifactMetaData(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the stored meta-data for an artifact by group and ID. This will include client-editable meta-data such as name and description, but also generated meta-data such as "modifedOn" and "globalId".- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactMetaData(java.lang.String, java.lang.String)
-
getArtifactVersionMetaData
public ArtifactVersionMetaDataDto getArtifactVersionMetaData(String groupId, String artifactId, boolean canonical, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the metadata of the version that matches content.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactVersionMetaData(java.lang.String, java.lang.String, boolean, io.apicurio.registry.content.ContentHandle)
-
getArtifactMetaData
public ArtifactMetaDataDto getArtifactMetaData(long globalId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the stored meta-data for an artifact by global ID. This will include client-editable meta-data such as name and description, but also generated meta-data such as "modifedOn" and "globalId".
-
updateArtifactMetaData
public void updateArtifactMetaData(String groupId, String artifactId, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the stored meta-data for an artifact by group and ID. Only the client-editable meta-data can be updated. Client editable meta-data includes e.g. name and description. TODO what if set to null?- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.updateArtifactMetaData(java.lang.String, java.lang.String, io.apicurio.registry.storage.dto.EditableArtifactMetaDataDto)
-
getArtifactRules
public List<RuleType> getArtifactRules(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets a list of rules configured for a specific Artifact (by group and ID). This will return only the names of the rules.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactRules(java.lang.String, java.lang.String)
-
createArtifactRuleAsync
public CompletionStage<Void> createArtifactRuleAsync(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleAlreadyExistsException, RegistryStorageException
-
deleteArtifactRules
public void deleteArtifactRules(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes all rules stored/configured for the artifact.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.deleteArtifactRules(java.lang.String, java.lang.String)
-
getArtifactRule
public RuleConfigurationDto getArtifactRule(String groupId, String artifactId, RuleType rule) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets all of the information for a single rule configured on a given artifact.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RuleNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactRule(java.lang.String, java.lang.String, io.apicurio.registry.types.RuleType)
-
updateArtifactRule
public void updateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the configuration information for a single rule on a given artifact.
-
deleteArtifactRule
public void deleteArtifactRule(String groupId, String artifactId, RuleType rule) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes a single stored/configured rule for a given artifact.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RuleNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.deleteArtifactRule(java.lang.String, java.lang.String, io.apicurio.registry.types.RuleType)
-
getArtifactVersions
public List<String> getArtifactVersions(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets a sorted set of all artifact versions that exist for a given artifact.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactVersions(java.lang.String, java.lang.String)
-
searchVersions
public VersionSearchResultsDto searchVersions(String groupId, String artifactId, int offset, int limit)
Description copied from interface:RegistryStorage
Fetch the versions of the given artifact- Parameters:
groupId
- (optional)artifactId
- the artifact used to fetch versionsoffset
- the number of versions to skiplimit
- the result size limit- Returns:
- the artifact versions, limited
- See Also:
RegistryStorage.searchVersions(java.lang.String, java.lang.String, int, int)
-
getArtifactVersion
public StoredArtifactDto getArtifactVersion(long globalId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the stored artifact content for the artifact version with the given unique global ID.
-
getArtifactVersion
public StoredArtifactDto getArtifactVersion(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the stored value for a single version of a given artifact.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactVersion(java.lang.String, java.lang.String, java.lang.String)
-
deleteArtifactVersion
public void deleteArtifactVersion(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes a single version of a given artifact.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.deleteArtifactVersion(java.lang.String, java.lang.String, java.lang.String)
-
getArtifactVersionMetaData
public ArtifactVersionMetaDataDto getArtifactVersionMetaData(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets the stored meta-data for a single version of an artifact. This will return all meta-data for the version, including any user edited meta-data along with anything generated by the artifactStore.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getArtifactVersionMetaData(java.lang.String, java.lang.String, java.lang.String)
-
updateArtifactVersionMetaData
public void updateArtifactVersionMetaData(String groupId, String artifactId, String version, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the user-editable meta-data for a single version of a given artifact. Only the client-editable meta-data can be updated. Client editable meta-data includes e.g. name and description.
-
deleteArtifactVersionMetaData
public void deleteArtifactVersionMetaData(String groupId, String artifactId, String version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes the user-editable meta-data for a singel version of a given artifact. Only the client-editable meta-data is deleted. Any meta-data generated by the artifactStore is preserved.- Parameters:
groupId
- (optional)- Throws:
ArtifactNotFoundException
VersionNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.deleteArtifactVersionMetaData(java.lang.String, java.lang.String, java.lang.String)
-
getGlobalRules
public List<RuleType> getGlobalRules() throws RegistryStorageException
Description copied from interface:RegistryStorage
Gets a list of all global rule names.- Throws:
RegistryStorageException
- See Also:
RegistryStorage.getGlobalRules()
-
createGlobalRule
public void createGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorage
Creates a single global rule. Duplicates (by name) are not allowed. Stores the rule name and configuration.
-
deleteGlobalRules
public void deleteGlobalRules() throws RegistryStorageException
Description copied from interface:RegistryStorage
Deletes all of the globally configured rules.- Throws:
RegistryStorageException
- See Also:
RegistryStorage.deleteGlobalRules()
-
getGlobalRule
public RuleConfigurationDto getGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Gets all information about a single global rule.
-
updateGlobalRule
public void updateGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the configuration settings for a single global rule.
-
deleteGlobalRule
public void deleteGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes a single global rule.
-
getLogConfiguration
public LogConfigurationDto getLogConfiguration(String logger) throws RegistryStorageException, LogConfigurationNotFoundException
Description copied from interface:RegistryStorage
Returns the log configuration persisted in the storage for the given logger
-
setLogConfiguration
public void setLogConfiguration(LogConfigurationDto logConfiguration) throws RegistryStorageException
Description copied from interface:RegistryStorage
Persists the given log configuration
-
removeLogConfiguration
public void removeLogConfiguration(String logger) throws RegistryStorageException, LogConfigurationNotFoundException
Description copied from interface:RegistryStorage
Removes the persisted log configuration for the given logger
-
listLogConfigurations
public List<LogConfigurationDto> listLogConfigurations() throws RegistryStorageException
Description copied from interface:RegistryStorage
Returns the list of log configuration persisted in the storage- Throws:
RegistryStorageException
- See Also:
RegistryStorage.listLogConfigurations()
-
createGroup
public void createGroup(GroupMetaDataDto group) throws GroupAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorage
Creates a new empty group and stores it's metadata. When creating an artifact the group is automatically created in it does not exist.
-
updateGroupMetaData
public void updateGroupMetaData(GroupMetaDataDto group) throws GroupNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Updates the metadata of an existent group.
-
deleteGroup
public void deleteGroup(String groupId) throws GroupNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Deletes a group intified by the given groupId and DELETES ALL resources related to this group- Parameters:
groupId
- (optional)- Throws:
GroupNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.deleteGroup(java.lang.String)
-
getGroupIds
public List<String> getGroupIds(Integer limit) throws RegistryStorageException
Description copied from interface:RegistryStorage
Get all groupIds- Throws:
RegistryStorageException
- See Also:
RegistryStorage.getGroupIds(java.lang.Integer)
-
getGroupMetaData
public GroupMetaDataDto getGroupMetaData(String groupId) throws GroupNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorage
Get the metadata information for a group identified by the given groupId- Parameters:
groupId
- (optional)- Throws:
GroupNotFoundException
RegistryStorageException
- See Also:
RegistryStorage.getGroupMetaData(java.lang.String)
-
exportData
public void exportData(Function<Entity,Void> handler) throws RegistryStorageException
Description copied from interface:RegistryStorage
Called to export all data in the registry. Caller provides a handle to handle the data/entities. This should be used to stream the data from the storage to some output source (e.g. a HTTP response). It is important that the full dataset is *not* kept in memory.
-
importData
public void importData(EntityInputStream entities) throws RegistryStorageException
Description copied from interface:RegistryStorage
Called to import previously exported data into the registry.
-
resetGlobalId
protected void resetGlobalId(org.jdbi.v3.core.Handle handle)
-
resetContentId
protected void resetContentId(org.jdbi.v3.core.Handle handle)
-
importEntity
protected void importEntity(org.jdbi.v3.core.Handle handle, Entity entity) throws RegistryStorageException
- Throws:
RegistryStorageException
-
importArtifactRule
protected void importArtifactRule(org.jdbi.v3.core.Handle handle, ArtifactRuleEntity entity)
-
importArtifactVersion
protected void importArtifactVersion(org.jdbi.v3.core.Handle handle, ArtifactVersionEntity entity)
-
importContent
protected void importContent(org.jdbi.v3.core.Handle handle, ContentEntity entity)
-
importGlobalRule
protected void importGlobalRule(org.jdbi.v3.core.Handle handle, GlobalRuleEntity entity)
-
importGroup
protected void importGroup(org.jdbi.v3.core.Handle handle, GroupEntity entity)
-
isArtifactExists
public boolean isArtifactExists(String groupId, String artifactId) throws RegistryStorageException
- Throws:
RegistryStorageException
-
isContentExists
public boolean isContentExists(long contentId) throws RegistryStorageException
- Throws:
RegistryStorageException
-
isGlobalIdExists
public boolean isGlobalIdExists(long globalId) throws RegistryStorageException
- Throws:
RegistryStorageException
-
canonicalizeContent
protected ContentHandle canonicalizeContent(ArtifactType artifactType, ContentHandle content)
Canonicalize the given content, returns the content unchanged in the case of an error.- Parameters:
artifactType
-content
-
-
extractMetaData
protected EditableArtifactMetaDataDto extractMetaData(ArtifactType artifactType, ContentHandle content)
-
nextContentId
protected static long nextContentId(org.jdbi.v3.core.Handle handle)
-
nextGlobalId
protected static long nextGlobalId(org.jdbi.v3.core.Handle handle)
-
-