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 theRegistryStorageinterface. This impl does not use any ORM technology - it simply uses native SQL for all operations.- Author:
- eric.wittmann@gmail.com
-
-
Constructor Summary
Constructors Constructor Description AbstractSqlRegistryStorage()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ContentHandlecanonicalizeContent(ArtifactType artifactType, ContentHandle content)Canonicalize the given content, returns the content unchanged in the case of an error.DownloadContextDtoconsumeDownload(String downloadId)Called to consume a download from the DB (single-use) and return its context info.longcountArtifacts()Counts the total number of artifactslongcountArtifactVersions(String groupId, String artifactId)Counts the total number of versions for one artifactlongcountTotalArtifactVersions()Counts the total number of versions for all artifactsArtifactMetaDataDtocreateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content)Creates a new artifact (from the given value) in the artifactStore.protected ArtifactMetaDataDtocreateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator)voidcreateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)Creates an artifact rule for a specific Artifact.protected ArtifactMetaDataDtocreateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, long contentId, String createdBy, Date createdOn, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)ArtifactMetaDataDtocreateArtifactWithMetadata(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 ArtifactMetaDataDtocreateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)StringcreateDownload(DownloadContextDto context)Called to create a single-use download "link".voidcreateGlobalRule(RuleType rule, RuleConfigurationDto config)Creates a single global rule.voidcreateGroup(GroupMetaDataDto group)Creates a new empty group and stores it's metadata.protected LongcreateOrUpdateContent(Handle handle, ArtifactType artifactType, ContentHandle content)Store the content in the database and return the ID of the new row.voidcreateRoleMapping(String principalId, String role, String principalName)Creates a role mapping for a user.voiddeleteAllExpiredDownloads()Called to delete any expired rows in the downloads table.protected voiddeleteAllOrphanedContent()voiddeleteAllUserData()Deletes ALL user (tenant) data.List<String>deleteArtifact(String groupId, String artifactId)Deletes an artifact by its group and unique id.voiddeleteArtifactRule(String groupId, String artifactId, RuleType rule)Deletes a single stored/configured rule for a given artifact.voiddeleteArtifactRules(String groupId, String artifactId)Deletes all rules stored/configured for the artifact.voiddeleteArtifacts(String groupId)Deletes all artifacts in the given group.voiddeleteArtifactVersion(String groupId, String artifactId, String version)Deletes a single version of a given artifact.voiddeleteArtifactVersionMetaData(String groupId, String artifactId, String version)Deletes the user-editable meta-data for a singel version of a given artifact.voiddeleteGlobalRule(RuleType rule)Deletes a single global rule.voiddeleteGlobalRules()Deletes all of the globally configured rules.voiddeleteGroup(String groupId)Deletes a group intified by the given groupId and DELETES ALL resources related to this groupvoiddeleteRoleMapping(String principalId)Deletes a single role mapping.voidexportData(Function<Entity,Void> handler)Called to export all data in the registry.protected EditableArtifactMetaDataDtoextractMetaData(ArtifactType artifactType, ContentHandle content)StoredArtifactDtogetArtifact(String groupId, String artifactId)Gets the most recent version of the value of the artifact with the given group and ID.ContentHandlegetArtifactByContentHash(String contentHash)Gets some artifact content by the SHA-256 hash of that content.ContentHandlegetArtifactByContentId(long contentId)Gets some artifact content by the unique contentId.Set<String>getArtifactIds(Integer limit)Get all artifact ids.ArtifactMetaDataDtogetArtifactMetaData(long globalId)Gets the stored meta-data for an artifact by global ID.ArtifactMetaDataDtogetArtifactMetaData(String groupId, String artifactId)Gets the stored meta-data for an artifact by group and ID.RuleConfigurationDtogetArtifactRule(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).StoredArtifactDtogetArtifactVersion(long globalId)Gets the stored artifact content for the artifact version with the given unique global ID.StoredArtifactDtogetArtifactVersion(String groupId, String artifactId, String version)Gets the stored value for a single version of a given artifact.ArtifactVersionMetaDataDtogetArtifactVersionMetaData(String groupId, String artifactId, boolean canonical, ContentHandle content)Gets the metadata of the version that matches content.ArtifactVersionMetaDataDtogetArtifactVersionMetaData(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 contentIdRuleConfigurationDtogetGlobalRule(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 groupIdsGroupMetaDataDtogetGroupMetaData(String groupId)Get the metadata information for a group identified by the given groupIdLogConfigurationDtogetLogConfiguration(String logger)Returns the log configuration persisted in the storage for the given loggerStringgetRoleForPrincipal(String principalId)Gets the role for a single user.RoleMappingDtogetRoleMapping(String principalId)Gets the details of a single role mapping.List<RoleMappingDto>getRoleMappings()Gets the list of all the role mappings in the registry.protected voidimportArtifactRule(Handle handle, ArtifactRuleEntity entity)protected voidimportArtifactVersion(Handle handle, ArtifactVersionEntity entity)protected voidimportContent(Handle handle, ContentEntity entity)voidimportData(EntityInputStream entities)Called to import previously exported data into the registry.protected voidimportEntity(Handle handle, Entity entity)protected voidimportGlobalRule(Handle handle, GlobalRuleEntity entity)protected voidimportGroup(Handle handle, GroupEntity entity)protected voidinitialize()booleanisArtifactExists(String groupId, String artifactId)booleanisContentExists(long contentId)protected booleanisGlobalIdExists(long globalId)List<LogConfigurationDto>listLogConfigurations()Returns the list of log configuration persisted in the storageprotected longnextContentId(Handle handle)protected longnextGlobalId(Handle handle)voidremoveLogConfiguration(String logger)Removes the persisted log configuration for the given loggerprotected voidresetContentId(Handle handle)protected voidresetGlobalId(Handle handle)ArtifactSearchResultsDtosearchArtifacts(Set<SearchFilter> filters, OrderBy orderBy, OrderDirection orderDirection, int offset, int limit)Search artifacts by given criteriaVersionSearchResultsDtosearchVersions(String groupId, String artifactId, int offset, int limit)Fetch the versions of the given artifactvoidsetLogConfiguration(LogConfigurationDto logConfiguration)Persists the given log configurationprotected SqlStatementssqlStatements()StringstorageName()The storage namebooleansupportsMultiTenancy()Returns true if the storage implementation supports multitenancy.protected TenantContexttenantContext()ArtifactMetaDataDtoupdateArtifact(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 ArtifactMetaDataDtoupdateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator)voidupdateArtifactMetaData(String groupId, String artifactId, EditableArtifactMetaDataDto metaData)Updates the stored meta-data for an artifact by group and ID.voidupdateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)Updates the configuration information for a single rule on a given artifact.voidupdateArtifactState(String groupId, String artifactId, ArtifactState state)Update artifact state.voidupdateArtifactState(String groupId, String artifactId, String version, ArtifactState state)Update artifact state.voidupdateArtifactVersionMetaData(String groupId, String artifactId, String version, EditableArtifactMetaDataDto metaData)Updates the user-editable meta-data for a single version of a given artifact.protected ArtifactMetaDataDtoupdateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, long contentId, String createdBy, Date createdOn, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)ArtifactMetaDataDtoupdateArtifactWithMetadata(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 ArtifactMetaDataDtoupdateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator)voidupdateGlobalRule(RuleType rule, RuleConfigurationDto config)Updates the configuration settings for a single global rule.voidupdateGroupMetaData(GroupMetaDataDto group)Updates the metadata of an existent group.voidupdateRoleMapping(String principalId, String role)Updates a single role mapping.-
Methods inherited from class io.apicurio.registry.storage.impl.AbstractRegistryStorage
isAlive, isReady
-
-
-
-
Method Detail
-
tenantContext
protected TenantContext tenantContext()
-
sqlStatements
protected SqlStatements sqlStatements()
-
initialize
@PostConstruct protected void initialize()
-
storageName
public String storageName()
Description copied from interface:RegistryStorageThe storage name- See Also:
RegistryStorage.storageName()
-
supportsMultiTenancy
public boolean supportsMultiTenancy()
Description copied from interface:RegistryStorageReturns 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:RegistryStorageGets 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:RegistryStorageGets 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:RegistryStorageGet 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:RegistryStorageUpdate artifact state.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- 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:RegistryStorageUpdate artifact state.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionVersionNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.updateArtifactState(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactState)
-
createArtifact
public ArtifactMetaDataDto createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content) throws ArtifactAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorageCreates 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:
ArtifactAlreadyExistsExceptionRegistryStorageException- 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 ArtifactMetaDataDto createArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator) throws ArtifactAlreadyExistsException, RegistryStorageException
-
createOrUpdateContent
protected Long createOrUpdateContent(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 ArtifactMetaDataDto createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData) throws ArtifactAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorageCreates 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)version- (optional)- Throws:
ArtifactAlreadyExistsExceptionRegistryStorageException- 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 ArtifactMetaDataDto createArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator) throws ArtifactAlreadyExistsException, RegistryStorageException
-
createArtifactWithMetadata
protected 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:RegistryStorageDeletes an artifact by its group and unique id. Returns list of artifact versions.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteArtifact(java.lang.String, java.lang.String)
-
deleteArtifacts
public void deleteArtifacts(String groupId) throws RegistryStorageException
Description copied from interface:RegistryStorageDeletes 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:RegistryStorageGets the most recent version of the value of the artifact with the given group and ID.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.getArtifact(java.lang.String, java.lang.String)
-
updateArtifact
public ArtifactMetaDataDto updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageUpdates 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:
ArtifactNotFoundExceptionRegistryStorageException- 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 ArtifactMetaDataDto updateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, GlobalIdGenerator globalIdGenerator) throws ArtifactNotFoundException, RegistryStorageException
-
updateArtifactWithMetadata
public ArtifactMetaDataDto updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageUpdates 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:
ArtifactNotFoundExceptionRegistryStorageException- 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 ArtifactMetaDataDto updateArtifactWithMetadata(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metaData, GlobalIdGenerator globalIdGenerator) throws ArtifactNotFoundException, RegistryStorageException
-
updateArtifactWithMetadata
protected 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:RegistryStorageGet 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:RegistryStorageSearch 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:RegistryStorageGets 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:
ArtifactNotFoundExceptionRegistryStorageException- 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:RegistryStorageGets the metadata of the version that matches content.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- 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:RegistryStorageGets 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:RegistryStorageUpdates 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:
ArtifactNotFoundExceptionRegistryStorageException- 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:RegistryStorageGets 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:
ArtifactNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.getArtifactRules(java.lang.String, java.lang.String)
-
createArtifactRule
public void createArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleAlreadyExistsException, RegistryStorageException
Description copied from interface:RegistryStorageCreates an artifact rule for a specific Artifact. If the named rule already exists for the artifact, then this should fail.
-
deleteArtifactRules
public void deleteArtifactRules(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageDeletes all rules stored/configured for the artifact.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- 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:RegistryStorageGets all of the information for a single rule configured on a given artifact.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRuleNotFoundExceptionRegistryStorageException- 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:RegistryStorageUpdates 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:RegistryStorageDeletes a single stored/configured rule for a given artifact.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRuleNotFoundExceptionRegistryStorageException- 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:RegistryStorageGets a sorted set of all artifact versions that exist for a given artifact.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- 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:RegistryStorageFetch 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:RegistryStorageGets 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:RegistryStorageGets the stored value for a single version of a given artifact.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionVersionNotFoundExceptionRegistryStorageException- 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:RegistryStorageDeletes a single version of a given artifact.- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionVersionNotFoundExceptionRegistryStorageException- 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:RegistryStorageGets 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:
ArtifactNotFoundExceptionVersionNotFoundExceptionRegistryStorageException- 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:RegistryStorageUpdates 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:RegistryStorageDeletes 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:
ArtifactNotFoundExceptionVersionNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteArtifactVersionMetaData(java.lang.String, java.lang.String, java.lang.String)
-
getGlobalRules
public List<RuleType> getGlobalRules() throws RegistryStorageException
Description copied from interface:RegistryStorageGets 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:RegistryStorageCreates a single global rule. Duplicates (by name) are not allowed. Stores the rule name and configuration.
-
deleteGlobalRules
public void deleteGlobalRules() throws RegistryStorageExceptionDescription copied from interface:RegistryStorageDeletes 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:RegistryStorageGets all information about a single global rule.
-
updateGlobalRule
public void updateGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageUpdates the configuration settings for a single global rule.
-
deleteGlobalRule
public void deleteGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageDeletes a single global rule.
-
getLogConfiguration
public LogConfigurationDto getLogConfiguration(String logger) throws RegistryStorageException, LogConfigurationNotFoundException
Description copied from interface:RegistryStorageReturns the log configuration persisted in the storage for the given logger
-
setLogConfiguration
public void setLogConfiguration(LogConfigurationDto logConfiguration) throws RegistryStorageException
Description copied from interface:RegistryStoragePersists the given log configuration
-
removeLogConfiguration
public void removeLogConfiguration(String logger) throws RegistryStorageException, LogConfigurationNotFoundException
Description copied from interface:RegistryStorageRemoves the persisted log configuration for the given logger
-
listLogConfigurations
public List<LogConfigurationDto> listLogConfigurations() throws RegistryStorageException
Description copied from interface:RegistryStorageReturns 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:RegistryStorageCreates 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:RegistryStorageUpdates the metadata of an existent group.
-
deleteGroup
public void deleteGroup(String groupId) throws GroupNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageDeletes a group intified by the given groupId and DELETES ALL resources related to this group- Parameters:
groupId- (optional)- Throws:
GroupNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteGroup(java.lang.String)
-
getGroupIds
public List<String> getGroupIds(Integer limit) throws RegistryStorageException
Description copied from interface:RegistryStorageGet all groupIds- Throws:
RegistryStorageException- See Also:
RegistryStorage.getGroupIds(java.lang.Integer)
-
getGroupMetaData
public GroupMetaDataDto getGroupMetaData(String groupId) throws GroupNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageGet the metadata information for a group identified by the given groupId- Parameters:
groupId- (optional)- Throws:
GroupNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.getGroupMetaData(java.lang.String)
-
exportData
public void exportData(Function<Entity,Void> handler) throws RegistryStorageException
Description copied from interface:RegistryStorageCalled 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:RegistryStorageCalled to import previously exported data into the registry.
-
countArtifacts
public long countArtifacts() throws RegistryStorageExceptionDescription copied from interface:RegistryStorageCounts the total number of artifacts- Returns:
- artifacts count
- Throws:
RegistryStorageException- See Also:
RegistryStorage.countArtifacts()
-
countArtifactVersions
public long countArtifactVersions(String groupId, String artifactId) throws RegistryStorageException
Description copied from interface:RegistryStorageCounts the total number of versions for one artifact- Returns:
- Throws:
RegistryStorageException- See Also:
RegistryStorage.countArtifactVersions(java.lang.String, java.lang.String)
-
countTotalArtifactVersions
public long countTotalArtifactVersions() throws RegistryStorageExceptionDescription copied from interface:RegistryStorageCounts the total number of versions for all artifacts- Returns:
- Throws:
RegistryStorageException- See Also:
RegistryStorage.countTotalArtifactVersions()
-
createRoleMapping
public void createRoleMapping(String principalId, String role, String principalName) throws RegistryStorageException
Description copied from interface:RegistryStorageCreates a role mapping for a user.
-
deleteRoleMapping
public void deleteRoleMapping(String principalId) throws RegistryStorageException
Description copied from interface:RegistryStorageDeletes a single role mapping.- Throws:
RegistryStorageException- See Also:
RegistryStorage.deleteRoleMapping(java.lang.String)
-
getRoleMapping
public RoleMappingDto getRoleMapping(String principalId) throws RegistryStorageException
Description copied from interface:RegistryStorageGets the details of a single role mapping.- Throws:
RegistryStorageException- See Also:
RegistryStorage.getRoleMapping(java.lang.String)
-
getRoleForPrincipal
public String getRoleForPrincipal(String principalId) throws RegistryStorageException
Description copied from interface:RegistryStorageGets the role for a single user. This returns null if there is no role mapped for the given principal.
-
getRoleMappings
public List<RoleMappingDto> getRoleMappings() throws RegistryStorageException
Description copied from interface:RegistryStorageGets the list of all the role mappings in the registry.- Throws:
RegistryStorageException- See Also:
RegistryStorage.getRoleMappings()
-
updateRoleMapping
public void updateRoleMapping(String principalId, String role) throws RegistryStorageException
Description copied from interface:RegistryStorageUpdates a single role mapping.
-
createDownload
public String createDownload(DownloadContextDto context) throws RegistryStorageException
Description copied from interface:RegistryStorageCalled to create a single-use download "link". This can then be consumed using "consumeDownload()". Used to support browser flows for features like /admin/export.
-
consumeDownload
public DownloadContextDto consumeDownload(String downloadId) throws RegistryStorageException
Description copied from interface:RegistryStorageCalled to consume a download from the DB (single-use) and return its context info.- Throws:
RegistryStorageException- See Also:
RegistryStorage.consumeDownload(java.lang.String)
-
deleteAllExpiredDownloads
public void deleteAllExpiredDownloads() throws RegistryStorageExceptionDescription copied from interface:RegistryStorageCalled to delete any expired rows in the downloads table. This is basically cleaning up any single-use download links that were never "clicked".- Throws:
RegistryStorageException- See Also:
RegistryStorage.deleteAllExpiredDownloads()
-
deleteAllUserData
public void deleteAllUserData()
Description copied from interface:RegistryStorageDeletes ALL user (tenant) data. Does not delete global data, such as log configuration.
-
deleteAllOrphanedContent
protected void deleteAllOrphanedContent()
-
resetGlobalId
protected void resetGlobalId(Handle handle)
-
resetContentId
protected void resetContentId(Handle handle)
-
importEntity
protected void importEntity(Handle handle, Entity entity) throws RegistryStorageException
- Throws:
RegistryStorageException
-
importArtifactRule
protected void importArtifactRule(Handle handle, ArtifactRuleEntity entity)
-
importArtifactVersion
protected void importArtifactVersion(Handle handle, ArtifactVersionEntity entity)
-
importContent
protected void importContent(Handle handle, ContentEntity entity)
-
importGlobalRule
protected void importGlobalRule(Handle handle, GlobalRuleEntity entity)
-
importGroup
protected void importGroup(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
protected 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 long nextContentId(Handle handle)
-
nextGlobalId
protected long nextGlobalId(Handle handle)
-
-