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 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
      • 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 with
        isPublic - true if entry should be returned by get*Entries calls, false to make entry be returned only by getBuildEntry(long, String) method.
        providerId - provider, see BuildMetadataProvider.getProviderId()
        action - action to be called on the index; action receives MetadataStorageWriter 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 id
        providerId - see BuildMetadataProvider.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 with
        providerId - see BuildMetadataProvider.getProviderId()
        key - metadata entry key
        data - metadata map
        isPublic - true if entry should be returned by get*Entries calls, false to make entry be returned only by getBuildEntry(long, String) method.
        Since:
        2017.1
      • 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 id
        value - value to search for in meta data value; search is done by contains; if value is empty all entries having provided metadata keys are returned
        metadataKeys - if not null, value is searched in metadata values for specified keys only; if null, value is searched in all metadata values
        caseInsensitiveValue - 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 processed
        keyValues - 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