Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Register MediaTypes through SPI #9045

Merged
merged 1 commit into from
Aug 1, 2023

Conversation

opensearch-trigger-bot[bot]
Copy link
Contributor

Backport 3952d5e from #8938.

* Register MediaTypes through SPI

This commit provides a new SPI interface MediaContentProvider. Modules,
Plugins, Extensions, implement this interface and provide the concrete
MediaType implementations (and MIME aliases) through getMediaTypes and
getAdditionalMediaTypes, respectively. This enables downstream
extensions (e.g., serverless or cloud native implementations) to
register their own custom MediaType and define the serialization format
that is registered when the classloader loads the MediaTypeRegistry
instead of having to register the types explicitly in application code.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>

* pass the MediaTypeProvider classloader to the SPI ServiceLoader

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>

---------

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
(cherry picked from commit 3952d5e)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Aug 1, 2023

Codecov Report

Merging #9045 (1b440a2) into 2.x (f25e217) will decrease coverage by 0.18%.
Report is 1 commits behind head on 2.x.
The diff coverage is 100.00%.

@@             Coverage Diff              @@
##                2.x    #9045      +/-   ##
============================================
- Coverage     70.91%   70.73%   -0.18%     
+ Complexity    57488    57374     -114     
============================================
  Files          4748     4749       +1     
  Lines        271368   271380      +12     
  Branches      40047    40048       +1     
============================================
- Hits         192436   191961     -475     
- Misses        62429    62977     +548     
+ Partials      16503    16442      -61     
Files Changed Coverage Δ
...a/org/opensearch/common/xcontent/XContentType.java 100.00% <ø> (ø)
...ava/org/opensearch/transport/TransportService.java 78.98% <ø> (+0.66%) ⬆️
...rg/opensearch/core/xcontent/MediaTypeRegistry.java 85.29% <100.00%> (+3.15%) ⬆️
...ensearch/common/xcontent/spi/XContentProvider.java 100.00% <100.00%> (ø)

... and 485 files with indirect coverage changes

@nknize nknize added skip-changelog v2.10.0 enhancement Enhancement or improvement to existing feature or request labels Aug 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 1, 2023

Gradle Check (Jenkins) Run Completed with:

@nknize nknize merged commit 2d67a53 into 2.x Aug 1, 2023
@nknize nknize deleted the backport/backport-8938-to-2.x branch August 1, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement or improvement to existing feature or request skip-changelog v2.10.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant