Interface MetadataStorage
-
- All Known Subinterfaces:
MetadataStorageEx
- All Known Implementing Classes:
HSQLMetadataStorage
,MetadataStorageBean
@SystemProvided public interface MetadataStorage
Service to access metadata that is provided by a plugins. For most cases this metadata is associated with build artifacts. Access to this data is read-only. Write interface is provided only for ArtifactsMetadataIndexer.- Since:
- 7.0
- Author:
- Eugene Petrenko (eugene.petrenko@gmail.com) Date: 14.10.11 18:55
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addBuildEntry(long buildId, String providerId, String key, Map<String,String> data, boolean isPublic)
Adds a new metadata entry for specified provider.Iterator<BuildMetadataEntry>
findEntriesWithKeyValuePairs(String providerId, Map<String,String> keyValues, boolean caseInsensitiveValue)
Returns iterator over entries having the specified key value pairs in their metadata.Iterator<BuildMetadataEntry>
findEntriesWithValue(String providerId, String value, Collection<String> metadataKeys)
Same as {@link #findEntriesWithValue(String, String, Collection, false)}Iterator<BuildMetadataEntry>
findEntriesWithValue(String providerId, String value, Collection<String> metadataKeys, boolean caseInsensitiveValue)
Searches for build metadata entries for specified provider having specified value in metadata values.Iterator<BuildMetadataEntry>
getAllEntries(String providerId)
Iterator<BuildMetadataEntry>
getBuildEntry(long buildId, String providerId)
Searches metadata index for entry for a given build.Iterator<BuildMetadataEntry>
getEntriesByKey(String providerId, String key)
int
getNumberOfEntries(String providerId)
boolean
removeBuildEntries(long buildId, String providerId)
Removes build metadata entries associated with specified build id and provider id.boolean
updateCache(long buildId, boolean isPublic, String providerId, Action<MetadataStorageWriter> action)
Writes metadata for specified buildId and provider.
-
-
-
Method Detail
-
getAllEntries
@NotNull Iterator<BuildMetadataEntry> getAllEntries(@NotNull String providerId)
- Returns:
- iterator among all reported build's metadata. From newer builds to older builds.
- Since:
- 7.0
-
getNumberOfEntries
int getNumberOfEntries(@NotNull String providerId)
- Parameters:
providerId
- provider id- Returns:
- total number of metadata entries for specified provider
- Since:
- 9.0
-
getEntriesByKey
@NotNull Iterator<BuildMetadataEntry> getEntriesByKey(@NotNull String providerId, @NotNull String key)
- Parameters:
providerId
- build metadata provide id, seeBuildMetadataProvider.getProviderId()
key
- build metadata provider reported key to search- Returns:
- all found entries reported with given key. From newer builds to older builds.
- Since:
- 7.0
- See Also:
BuildMetadataEntry.getKey()
-
getBuildEntry
@NotNull Iterator<BuildMetadataEntry> getBuildEntry(long buildId, @NotNull String providerId)
Searches metadata index for entry for a given build. No reindex attempt will be performed if there is no data in index- Parameters:
buildId
-providerId
-- Returns:
- found data or null
- Since:
- 7.1
- See Also:
BuildMetadataEntry.getKey()
-
updateCache
boolean updateCache(long buildId, boolean isPublic, @NotNull String providerId, @NotNull Action<MetadataStorageWriter> action)
Writes metadata for specified buildId and provider. Before storing new data, data associated with this build and provider is removed from metadata storage.- Parameters:
buildId
- id of the build to associate metadata withisPublic
- true if entry should be returned by get*Entries calls, false to make entry be returned only bygetBuildEntry(long, String)
method.providerId
- provider, seeBuildMetadataProvider.getProviderId()
action
- action to be called on the index; action receivesMetadataStorageWriter
which should be used to write metadata map in storage.- Returns:
- true if metadata storage was updated
-
removeBuildEntries
boolean removeBuildEntries(long buildId, @NotNull String providerId)
Removes build metadata entries associated with specified build id and provider id.- Parameters:
buildId
- build idproviderId
- seeBuildMetadataProvider.getProviderId()
- Returns:
- see above
- Since:
- 2017.1
-
addBuildEntry
void addBuildEntry(long buildId, @NotNull String providerId, @NotNull String key, @NotNull Map<String,String> data, boolean isPublic)
Adds a new metadata entry for specified provider. If metadata map was already associated with specified key, old values are removed and new values are inserted instead. If metadata map is empty method does not modify storage anyhow.- Parameters:
buildId
- id of the build to associate metadata withproviderId
- seeBuildMetadataProvider.getProviderId()
key
- metadata entry keydata
- metadata mapisPublic
- true if entry should be returned by get*Entries calls, false to make entry be returned only bygetBuildEntry(long, String)
method.- Since:
- 2017.1
-
findEntriesWithValue
@NotNull Iterator<BuildMetadataEntry> findEntriesWithValue(@NotNull String providerId, @NotNull String value, @Nullable Collection<String> metadataKeys)
Same as {@link #findEntriesWithValue(String, String, Collection, false)}- Since:
- 9.0
-
findEntriesWithValue
@NotNull Iterator<BuildMetadataEntry> findEntriesWithValue(@NotNull String providerId, @NotNull String value, @Nullable Collection<String> metadataKeys, boolean caseInsensitiveValue)
Searches for build metadata entries for specified provider having specified value in metadata values.- Parameters:
providerId
- provider idvalue
- value to search for in meta data value; search is done by contains; if value is empty all entries having provided metadata keys are returnedmetadataKeys
- if not null, value is searched in metadata values for specified keys only; if null, value is searched in all metadata valuescaseInsensitiveValue
- true if search by value should be performed case insensitively- Returns:
- found entries, newer builds first
- Since:
- 2017.1
-
findEntriesWithKeyValuePairs
@NotNull Iterator<BuildMetadataEntry> findEntriesWithKeyValuePairs(@NotNull String providerId, @NotNull Map<String,String> keyValues, boolean caseInsensitiveValue)
Returns iterator over entries having the specified key value pairs in their metadata. Key is always compared case sensitively, comparison of value depends on caseInsensitiveValue parameter.- Parameters:
providerId
- id of provider whose entries should be processedkeyValues
- map of key value pairs to look in metadata entry (nulls are not allowed)caseInsensitiveValue
- if true value value is compared case insensitively- Returns:
- iterator over found entries, entries are sorted by build id
- Since:
- 2017.1
-
-