Package io.apicurio.registry.events
Class EventSourcedRegistryStorage
- java.lang.Object
-
- io.apicurio.registry.storage.decorator.RegistryStorageDecorator
-
- io.apicurio.registry.events.EventSourcedRegistryStorage
-
- All Implemented Interfaces:
RegistryStorage
@ApplicationScoped public class EventSourcedRegistryStorage extends RegistryStorageDecorator
- Author:
- Fabian Martinez
-
-
Field Summary
-
Fields inherited from class io.apicurio.registry.storage.decorator.RegistryStorageDecorator
delegate
-
-
Constructor Summary
Constructors Constructor Description EventSourcedRegistryStorage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ArtifactMetaDataDtocreateArtifact(String groupId, String artifactId, String version, ArtifactType artifactType, ContentHandle content)Creates a new artifact (from the given value) in the artifactStore.voidcreateArtifactRule(String groupId, String artifactId, RuleType rule, RuleConfigurationDto config)Creates an artifact rule for a specific Artifact.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.voidcreateGlobalRule(RuleType rule, RuleConfigurationDto config)Creates a single global rule.voidcreateGroup(GroupMetaDataDto group)Creates a new empty group and stores it's metadata.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.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 groupStoredArtifactDtogetArtifact(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.List<RuleType>getArtifactRules(String groupId, String artifactId)Gets a list of rules configured for a specific Artifact (by group and ID).booleanisEnabled()intorder()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.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.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.voidupdateGlobalRule(RuleType rule, RuleConfigurationDto config)Updates the configuration settings for a single global rule.voidupdateGroupMetaData(GroupMetaDataDto group)Updates the metadata of an existent group.-
Methods inherited from class io.apicurio.registry.storage.decorator.RegistryStorageDecorator
consumeDownload, countArtifacts, countArtifactVersions, countTotalArtifactVersions, createDownload, createRoleMapping, deleteAllExpiredDownloads, deleteAllUserData, deleteArtifactVersionMetaData, deleteRoleMapping, exportData, getArtifactIds, getArtifactMetaData, getArtifactMetaData, getArtifactRule, getArtifactVersion, getArtifactVersion, getArtifactVersionMetaData, getArtifactVersionMetaData, getArtifactVersions, getArtifactVersionsByContentId, getGlobalRule, getGlobalRules, getGroupIds, getGroupMetaData, getLogConfiguration, getRoleForPrincipal, getRoleMapping, getRoleMappings, importData, isAlive, isReady, listLogConfigurations, removeLogConfiguration, searchArtifacts, searchVersions, setDelegate, setLogConfiguration, storageName, supportsMultiTenancy, updateArtifactVersionMetaData, updateRoleMapping
-
-
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabledin classRegistryStorageDecorator- See Also:
io.apicurio.registry.delegate.decorator.RegistryStorageDecorator#isEnabled()
-
order
public int order()
- Specified by:
orderin classRegistryStorageDecorator- See Also:
io.apicurio.registry.delegate.decorator.RegistryStorageDecorator#order()
-
updateArtifactState
public void updateArtifactState(String groupId, String artifactId, ArtifactState state) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageUpdate artifact state.- Specified by:
updateArtifactStatein interfaceRegistryStorage- Overrides:
updateArtifactStatein classRegistryStorageDecorator- 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.- Specified by:
updateArtifactStatein interfaceRegistryStorage- Overrides:
updateArtifactStatein classRegistryStorageDecorator- 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.- Specified by:
createArtifactin interfaceRegistryStorage- Overrides:
createArtifactin classRegistryStorageDecorator- 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)
-
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.- Specified by:
createArtifactWithMetadatain interfaceRegistryStorage- Overrides:
createArtifactWithMetadatain classRegistryStorageDecorator- Parameters:
groupId- (optional)version- (optional)- Throws:
ArtifactAlreadyExistsExceptionRegistryStorageException- See Also:
io.apicurio.registry.delegate.RegistryStorage#createArtifactWithMetadata(java.lang.String, java.lang.String, java.lang.String, io.apicurio.registry.types.ArtifactType, io.apicurio.registry.content.ContentHandle, io.apicurio.registry.delegate.dto.EditableArtifactMetaDataDto)
-
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.- Specified by:
deleteArtifactin interfaceRegistryStorage- Overrides:
deleteArtifactin classRegistryStorageDecorator- 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.- Specified by:
deleteArtifactsin interfaceRegistryStorage- Overrides:
deleteArtifactsin classRegistryStorageDecorator- 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.- Specified by:
getArtifactin interfaceRegistryStorage- Overrides:
getArtifactin classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.getArtifact(java.lang.String, java.lang.String)
-
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.- Specified by:
getArtifactByContentHashin interfaceRegistryStorage- Overrides:
getArtifactByContentHashin classRegistryStorageDecorator- Throws:
ContentNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.getArtifactByContentHash(java.lang.String)
-
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.- Specified by:
getArtifactByContentIdin interfaceRegistryStorage- Overrides:
getArtifactByContentIdin classRegistryStorageDecorator- Throws:
ContentNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.getArtifactByContentId(long)
-
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.- Specified by:
updateArtifactin interfaceRegistryStorage- Overrides:
updateArtifactin classRegistryStorageDecorator- 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)
-
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.- Specified by:
updateArtifactWithMetadatain interfaceRegistryStorage- Overrides:
updateArtifactWithMetadatain classRegistryStorageDecorator- 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)
-
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?- Specified by:
updateArtifactMetaDatain interfaceRegistryStorage- Overrides:
updateArtifactMetaDatain classRegistryStorageDecorator- 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.- Specified by:
getArtifactRulesin interfaceRegistryStorage- Overrides:
getArtifactRulesin classRegistryStorageDecorator- 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.- Specified by:
createArtifactRulein interfaceRegistryStorage- Overrides:
createArtifactRulein classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRuleAlreadyExistsExceptionRegistryStorageException- See Also:
io.apicurio.registry.delegate.RegistryStorage#createArtifactRule(java.lang.String, java.lang.String, io.apicurio.registry.types.RuleType, io.apicurio.registry.delegate.dto.RuleConfigurationDto)
-
deleteArtifactRules
public void deleteArtifactRules(String groupId, String artifactId) throws ArtifactNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageDeletes all rules stored/configured for the artifact.- Specified by:
deleteArtifactRulesin interfaceRegistryStorage- Overrides:
deleteArtifactRulesin classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteArtifactRules(java.lang.String, java.lang.String)
-
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.- Specified by:
updateArtifactRulein interfaceRegistryStorage- Overrides:
updateArtifactRulein classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRuleNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.updateArtifactRule(java.lang.String, java.lang.String, io.apicurio.registry.types.RuleType, io.apicurio.registry.storage.dto.RuleConfigurationDto)
-
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.- Specified by:
deleteArtifactRulein interfaceRegistryStorage- Overrides:
deleteArtifactRulein classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionRuleNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteArtifactRule(java.lang.String, java.lang.String, io.apicurio.registry.types.RuleType)
-
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.- Specified by:
deleteArtifactVersionin interfaceRegistryStorage- Overrides:
deleteArtifactVersionin classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
ArtifactNotFoundExceptionVersionNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteArtifactVersion(java.lang.String, java.lang.String, java.lang.String)
-
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.- Specified by:
createGlobalRulein interfaceRegistryStorage- Overrides:
createGlobalRulein classRegistryStorageDecorator- Throws:
RuleAlreadyExistsExceptionRegistryStorageException- See Also:
RegistryStorage.createGlobalRule(io.apicurio.registry.types.RuleType, io.apicurio.registry.storage.dto.RuleConfigurationDto)
-
deleteGlobalRules
public void deleteGlobalRules() throws RegistryStorageExceptionDescription copied from interface:RegistryStorageDeletes all of the globally configured rules.- Specified by:
deleteGlobalRulesin interfaceRegistryStorage- Overrides:
deleteGlobalRulesin classRegistryStorageDecorator- Throws:
RegistryStorageException- See Also:
RegistryStorage.deleteGlobalRules()
-
updateGlobalRule
public void updateGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageUpdates the configuration settings for a single global rule.- Specified by:
updateGlobalRulein interfaceRegistryStorage- Overrides:
updateGlobalRulein classRegistryStorageDecorator- Throws:
RuleNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.updateGlobalRule(io.apicurio.registry.types.RuleType, io.apicurio.registry.storage.dto.RuleConfigurationDto)
-
deleteGlobalRule
public void deleteGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageDeletes a single global rule.- Specified by:
deleteGlobalRulein interfaceRegistryStorage- Overrides:
deleteGlobalRulein classRegistryStorageDecorator- Throws:
RuleNotFoundExceptionRegistryStorageException- See Also:
RegistryStorage.deleteGlobalRule(io.apicurio.registry.types.RuleType)
-
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.- Specified by:
createGroupin interfaceRegistryStorage- Overrides:
createGroupin classRegistryStorageDecorator- Throws:
GroupAlreadyExistsExceptionRegistryStorageException- See Also:
io.apicurio.registry.delegate.RegistryStorage#createGroup(io.apicurio.registry.delegate.dto.GroupMetaDataDto)
-
updateGroupMetaData
public void updateGroupMetaData(GroupMetaDataDto group) throws GroupNotFoundException, RegistryStorageException
Description copied from interface:RegistryStorageUpdates the metadata of an existent group.- Specified by:
updateGroupMetaDatain interfaceRegistryStorage- Overrides:
updateGroupMetaDatain classRegistryStorageDecorator- Throws:
RegistryStorageExceptionGroupNotFoundException- See Also:
io.apicurio.registry.delegate.RegistryStorage#updateGroupMetaData(io.apicurio.registry.delegate.dto.GroupMetaDataDto)
-
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- Specified by:
deleteGroupin interfaceRegistryStorage- Overrides:
deleteGroupin classRegistryStorageDecorator- Parameters:
groupId- (optional)- Throws:
GroupNotFoundExceptionRegistryStorageException- See Also:
io.apicurio.registry.delegate.RegistryStorage#deleteGroup(java.lang.String)
-
-