forked from quarkusio/quarkus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for providing a custom extension registry client impl in a ma…
…ven artifact
- Loading branch information
1 parent
17645be
commit 00cffa9
Showing
12 changed files
with
212 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 2 additions & 46 deletions
48
...ojects/tools/registry-client/src/main/java/io/quarkus/registry/client/RegistryClient.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,11 @@ | ||
package io.quarkus.registry.client; | ||
|
||
import io.quarkus.maven.ArtifactCoords; | ||
import io.quarkus.registry.RegistryResolutionException; | ||
import io.quarkus.registry.catalog.ExtensionCatalog; | ||
import io.quarkus.registry.catalog.PlatformCatalog; | ||
import io.quarkus.registry.config.RegistryConfig; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Implements the basic queries a registry client is supposed to handle. | ||
* Although there are only a few kinds of queries, a registry is not required to support | ||
* all of them. For example, a registry may be configured to only provide platform extensions or | ||
* the other way around - provide only non-platform extensions but not platforms. | ||
*/ | ||
public class RegistryClient | ||
implements RegistryNonPlatformExtensionsResolver, RegistryPlatformExtensionsResolver, RegistryPlatformsResolver, | ||
RegistryConfigResolver { | ||
|
||
private final RegistryPlatformsResolver platforms; | ||
private final RegistryPlatformExtensionsResolver platformExtensions; | ||
private final RegistryNonPlatformExtensionsResolver nonPlatformExtensions; | ||
protected RegistryConfig config; | ||
|
||
public RegistryClient(RegistryConfig config, RegistryPlatformsResolver platforms, | ||
RegistryPlatformExtensionsResolver platformExtensions, | ||
RegistryNonPlatformExtensionsResolver nonPlatformExtensions) { | ||
this.config = config; | ||
this.platforms = platforms; | ||
this.platformExtensions = Objects.requireNonNull(platformExtensions); | ||
this.nonPlatformExtensions = nonPlatformExtensions; | ||
} | ||
|
||
@Override | ||
public PlatformCatalog resolvePlatforms(String quarkusVersion) throws RegistryResolutionException { | ||
return platforms == null ? null : platforms.resolvePlatforms(quarkusVersion); | ||
} | ||
|
||
@Override | ||
public ExtensionCatalog resolvePlatformExtensions(ArtifactCoords platformCoords) | ||
throws RegistryResolutionException { | ||
return platformExtensions.resolvePlatformExtensions(platformCoords); | ||
} | ||
|
||
@Override | ||
public ExtensionCatalog resolveNonPlatformExtensions(String quarkusVersion) throws RegistryResolutionException { | ||
return nonPlatformExtensions == null ? null | ||
: nonPlatformExtensions.resolveNonPlatformExtensions(quarkusVersion); | ||
} | ||
|
||
@Override | ||
public RegistryConfig resolveRegistryConfig() throws RegistryResolutionException { | ||
return config; | ||
} | ||
public interface RegistryClient extends RegistryNonPlatformExtensionsResolver, RegistryPlatformExtensionsResolver, | ||
RegistryPlatformsResolver, RegistryConfigResolver { | ||
} |
47 changes: 47 additions & 0 deletions
47
...ls/registry-client/src/main/java/io/quarkus/registry/client/RegistryClientDispatcher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.quarkus.registry.client; | ||
|
||
import io.quarkus.maven.ArtifactCoords; | ||
import io.quarkus.registry.RegistryResolutionException; | ||
import io.quarkus.registry.catalog.ExtensionCatalog; | ||
import io.quarkus.registry.catalog.PlatformCatalog; | ||
import io.quarkus.registry.config.RegistryConfig; | ||
import java.util.Objects; | ||
|
||
public class RegistryClientDispatcher implements RegistryClient { | ||
|
||
private final RegistryPlatformsResolver platforms; | ||
private final RegistryPlatformExtensionsResolver platformExtensions; | ||
private final RegistryNonPlatformExtensionsResolver nonPlatformExtensions; | ||
protected RegistryConfig config; | ||
|
||
public RegistryClientDispatcher(RegistryConfig config, RegistryPlatformsResolver platforms, | ||
RegistryPlatformExtensionsResolver platformExtensions, | ||
RegistryNonPlatformExtensionsResolver nonPlatformExtensions) { | ||
this.config = config; | ||
this.platforms = platforms; | ||
this.platformExtensions = Objects.requireNonNull(platformExtensions); | ||
this.nonPlatformExtensions = nonPlatformExtensions; | ||
} | ||
|
||
@Override | ||
public PlatformCatalog resolvePlatforms(String quarkusVersion) throws RegistryResolutionException { | ||
return platforms == null ? null : platforms.resolvePlatforms(quarkusVersion); | ||
} | ||
|
||
@Override | ||
public ExtensionCatalog resolvePlatformExtensions(ArtifactCoords platformCoords) | ||
throws RegistryResolutionException { | ||
return platformExtensions.resolvePlatformExtensions(platformCoords); | ||
} | ||
|
||
@Override | ||
public ExtensionCatalog resolveNonPlatformExtensions(String quarkusVersion) throws RegistryResolutionException { | ||
return nonPlatformExtensions == null ? null | ||
: nonPlatformExtensions.resolveNonPlatformExtensions(quarkusVersion); | ||
} | ||
|
||
@Override | ||
public RegistryConfig resolveRegistryConfig() throws RegistryResolutionException { | ||
return config; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...gistry-client/src/main/java/io/quarkus/registry/client/spi/RegistryClientEnvironment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package io.quarkus.registry.client.spi; | ||
|
||
import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; | ||
import io.quarkus.devtools.messagewriter.MessageWriter; | ||
|
||
public interface RegistryClientEnvironment { | ||
|
||
MessageWriter log(); | ||
|
||
MavenArtifactResolver resolver(); | ||
} |
12 changes: 12 additions & 0 deletions
12
...ry-client/src/main/java/io/quarkus/registry/client/spi/RegistryClientFactoryProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package io.quarkus.registry.client.spi; | ||
|
||
import io.quarkus.registry.client.RegistryClientFactory; | ||
|
||
/** | ||
* Registry client factory service provider interface that will be looked up on the class path using the ServiceLoader | ||
* mechanism. | ||
*/ | ||
public interface RegistryClientFactoryProvider { | ||
|
||
RegistryClientFactory newRegistryClientFactory(RegistryClientEnvironment env); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.