public abstract class AbstractMapRegistryStorage extends AbstractRegistryStorage
Modifier and Type | Field and Description |
---|---|
protected MultiMap<String,String,String> |
artifactRules |
protected ArtifactTypeUtilProviderFactory |
factory |
protected Map<Long,TupleId> |
global |
protected Map<String,String> |
globalRules |
protected StorageMap |
storage |
Constructor and Description |
---|
AbstractMapRegistryStorage() |
Modifier and Type | Method and Description |
---|---|
protected void |
afterInit() |
protected void |
beforeInit() |
CompletionStage<ArtifactMetaDataDto> |
createArtifact(String artifactId,
ArtifactType artifactType,
ContentHandle content)
Creates a new artifact (from the given value) in the storage.
|
CompletionStage<Void> |
createArtifactRuleAsync(String artifactId,
RuleType rule,
RuleConfigurationDto config) |
protected abstract MultiMap<String,String,String> |
createArtifactRulesMap() |
CompletionStage<ArtifactMetaDataDto> |
createArtifactWithMetadata(String artifactId,
ArtifactType artifactType,
ContentHandle content,
EditableArtifactMetaDataDto metadata)
Creates a new artifact (from the given value including metadata) in the storage.
|
protected abstract Map<Long,TupleId> |
createGlobalMap() |
void |
createGlobalRule(RuleType rule,
RuleConfigurationDto config)
Creates a single global rule.
|
protected abstract Map<String,String> |
createGlobalRulesMap() |
protected ArtifactMetaDataDto |
createOrUpdateArtifact(String artifactId,
ArtifactType artifactType,
ContentHandle content,
boolean create,
long globalId) |
protected abstract StorageMap |
createStorageMap() |
SortedSet<Long> |
deleteArtifact(String artifactId)
Deletes an artifact by its unique id.
|
void |
deleteArtifactRule(String artifactId,
RuleType rule)
Deletes a single stored/configured rule for a given artifact.
|
void |
deleteArtifactRules(String artifactId)
Deletes all rules stored/configured for the artifact.
|
protected void |
deleteArtifactRulesInternal(String artifactId)
Internal delete of artifact rules without checking for existence of artifact first.
|
void |
deleteArtifactVersion(String artifactId,
long version)
Deletes a single version of a given artifact.
|
void |
deleteArtifactVersionMetaData(String artifactId,
long 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.
|
StoredArtifact |
getArtifact(String artifactId)
Gets the most recent version of the value of the artifact with the given ID.
|
Set<String> |
getArtifactIds(Integer limit)
Get all artifact ids.
|
ArtifactMetaDataDto |
getArtifactMetaData(long id)
Gets the stored meta-data for an artifact by global ID.
|
ArtifactMetaDataDto |
getArtifactMetaData(String artifactId)
Gets the stored meta-data for an artifact by ID.
|
ArtifactMetaDataDto |
getArtifactMetaData(String artifactId,
ContentHandle content)
Gets the metadata of the version that matches content, or 404
|
RuleConfigurationDto |
getArtifactRule(String artifactId,
RuleType rule)
Gets all of the information for a single rule configured on a given artifact.
|
List<RuleType> |
getArtifactRules(String artifactId)
Gets a list of rules configured for a specific Artifact (by ID).
|
StoredArtifact |
getArtifactVersion(long id)
Gets the most recent version of the content of the artifact with the given global ID.
|
StoredArtifact |
getArtifactVersion(String artifactId,
long version)
Gets the stored value for a single version of a given artifact.
|
ArtifactVersionMetaDataDto |
getArtifactVersionMetaData(String artifactId,
long version)
Gets the stored meta-data for a single version of an artifact.
|
SortedSet<Long> |
getArtifactVersions(String artifactId)
Gets a sorted set of all artifact versions that exist for a given artifact.
|
protected Map<String,String> |
getContentMap(long id) |
RuleConfigurationDto |
getGlobalRule(RuleType rule)
Gets all information about a single global rule.
|
List<RuleType> |
getGlobalRules()
Gets a list of all global rule names.
|
void |
init() |
protected BiFunction<String,Map<Long,Map<String,String>>,Map<Long,Map<String,String>>> |
lookupFn() |
protected abstract long |
nextGlobalId() |
ArtifactSearchResults |
searchArtifacts(String search,
int offset,
int limit,
SearchOver over,
SortOrder order)
Search artifacts by given criteria
|
VersionSearchResults |
searchVersions(String artifactId,
int offset,
int limit)
Fetch the versions of the given artifact
|
static Predicate<Map.Entry<Long,Map<String,String>>> |
statesFilter(EnumSet<ArtifactState> states) |
static StoredArtifact |
toStoredArtifact(Map<String,String> content) |
CompletionStage<ArtifactMetaDataDto> |
updateArtifact(String artifactId,
ArtifactType artifactType,
ContentHandle content)
Updates the artifact value by storing the given value as a new version of the artifact.
|
void |
updateArtifactMetaData(String artifactId,
EditableArtifactMetaDataDto metaData)
Updates the stored meta-data for an artifact by ID.
|
void |
updateArtifactRule(String artifactId,
RuleType rule,
RuleConfigurationDto config)
Updates the configuration information for a single rule on a given artifact.
|
void |
updateArtifactState(String artifactId,
ArtifactState state)
Update artifact state.
|
void |
updateArtifactState(String artifactId,
ArtifactState state,
Integer version)
Update artifact state.
|
void |
updateArtifactVersionMetaData(String artifactId,
long version,
EditableArtifactMetaDataDto metaData)
Updates the user-editable meta-data for a single version of a given artifact.
|
CompletionStage<ArtifactMetaDataDto> |
updateArtifactWithMetadata(String artifactId,
ArtifactType artifactType,
ContentHandle content,
EditableArtifactMetaDataDto metadata)
Updates the artifact value by storing the given value and metadata as a new version of the artifact.
|
void |
updateGlobalRule(RuleType rule,
RuleConfigurationDto config)
Updates the configuration settings for a single global rule.
|
createArtifactRule, isAlive, isReady
@Inject protected ArtifactTypeUtilProviderFactory factory
protected StorageMap storage
protected void beforeInit()
@PostConstruct public void init()
protected void afterInit()
protected abstract long nextGlobalId()
protected abstract StorageMap createStorageMap()
public static Predicate<Map.Entry<Long,Map<String,String>>> statesFilter(EnumSet<ArtifactState> states)
public static StoredArtifact toStoredArtifact(Map<String,String> content)
protected BiFunction<String,Map<Long,Map<String,String>>,Map<Long,Map<String,String>>> lookupFn()
protected ArtifactMetaDataDto createOrUpdateArtifact(String artifactId, ArtifactType artifactType, ContentHandle content, boolean create, long globalId) throws ArtifactAlreadyExistsException, ArtifactNotFoundException, RegistryStorageException
public void updateArtifactState(String artifactId, ArtifactState state)
RegistryStorage
public void updateArtifactState(String artifactId, ArtifactState state, Integer version)
RegistryStorage
public CompletionStage<ArtifactMetaDataDto> createArtifact(String artifactId, ArtifactType artifactType, ContentHandle content) throws ArtifactAlreadyExistsException, RegistryStorageException
RegistryStorage
public CompletionStage<ArtifactMetaDataDto> createArtifactWithMetadata(String artifactId, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metadata) throws ArtifactAlreadyExistsException, RegistryStorageException
RegistryStorage
public SortedSet<Long> deleteArtifact(String artifactId) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public StoredArtifact getArtifact(String artifactId) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public CompletionStage<ArtifactMetaDataDto> updateArtifact(String artifactId, ArtifactType artifactType, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public CompletionStage<ArtifactMetaDataDto> updateArtifactWithMetadata(String artifactId, ArtifactType artifactType, ContentHandle content, EditableArtifactMetaDataDto metadata) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public Set<String> getArtifactIds(Integer limit)
RegistryStorage
limit
- the limit of artifactsRegistryStorage.getArtifactIds(Integer limit)
public ArtifactSearchResults searchArtifacts(String search, int offset, int limit, SearchOver over, SortOrder order)
RegistryStorage
search
- the text to search in the artifact metadataoffset
- the number of artifacts to skiplimit
- the result size limitover
- the fields to search overorder
- the ordering used()
public ArtifactMetaDataDto getArtifactMetaData(String artifactId) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public ArtifactMetaDataDto getArtifactMetaData(String artifactId, ContentHandle content) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public ArtifactMetaDataDto getArtifactMetaData(long id) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public void updateArtifactMetaData(String artifactId, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, RegistryStorageException, InvalidPropertiesException
RegistryStorage
public List<RuleType> getArtifactRules(String artifactId) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public CompletionStage<Void> createArtifactRuleAsync(String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleAlreadyExistsException, RegistryStorageException
public void deleteArtifactRules(String artifactId) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
protected void deleteArtifactRulesInternal(String artifactId) throws RegistryStorageException
artifactId
- RegistryStorageException
public RuleConfigurationDto getArtifactRule(String artifactId, RuleType rule) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
RegistryStorage
public void updateArtifactRule(String artifactId, RuleType rule, RuleConfigurationDto config) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
RegistryStorage
public void deleteArtifactRule(String artifactId, RuleType rule) throws ArtifactNotFoundException, RuleNotFoundException, RegistryStorageException
RegistryStorage
public SortedSet<Long> getArtifactVersions(String artifactId) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public VersionSearchResults searchVersions(String artifactId, int offset, int limit) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
artifactId
- the artifact used to fetch versionsoffset
- the number of versions to skiplimit
- the result size limitArtifactNotFoundException
RegistryStorageException
(java.lang.String)
public StoredArtifact getArtifactVersion(long id) throws ArtifactNotFoundException, RegistryStorageException
RegistryStorage
public StoredArtifact getArtifactVersion(String artifactId, long version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
RegistryStorage
public void deleteArtifactVersion(String artifactId, long version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
RegistryStorage
public ArtifactVersionMetaDataDto getArtifactVersionMetaData(String artifactId, long version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
RegistryStorage
public void updateArtifactVersionMetaData(String artifactId, long version, EditableArtifactMetaDataDto metaData) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
RegistryStorage
public void deleteArtifactVersionMetaData(String artifactId, long version) throws ArtifactNotFoundException, VersionNotFoundException, RegistryStorageException
RegistryStorage
public List<RuleType> getGlobalRules() throws RegistryStorageException
RegistryStorage
RegistryStorageException
RegistryStorage.getGlobalRules()
public void createGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleAlreadyExistsException, RegistryStorageException
RegistryStorage
public void deleteGlobalRules() throws RegistryStorageException
RegistryStorage
RegistryStorageException
RegistryStorage.deleteGlobalRules()
public RuleConfigurationDto getGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
RegistryStorage
public void updateGlobalRule(RuleType rule, RuleConfigurationDto config) throws RuleNotFoundException, RegistryStorageException
RegistryStorage
public void deleteGlobalRule(RuleType rule) throws RuleNotFoundException, RegistryStorageException
RegistryStorage
Copyright © 2020 Red Hat. All rights reserved.