Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.ByteOrder;
import java.text.MessageFormat;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
Expand All @@ -52,10 +51,10 @@

public class ApicurioCatalogHandler implements CatalogHandler
{
private static final String ARTIFACT_VERSION_PATH = "/apis/registry/v2/groups/{0}/artifacts/{1}/versions/{2}/meta";
private static final String ARTIFACT_BY_GLOBAL_ID_PATH = "/apis/registry/v2/ids/globalIds/{0}";
private static final String ARTIFACT_BY_CONTENT_ID_PATH = "/apis/registry/v2/ids/contentIds/{0}";
private static final String ARTIFACT_META_PATH = "/apis/registry/v2/groups/{0}/artifacts/{1}/meta";
private static final String ARTIFACT_VERSION_PATH = "/apis/registry/v2/groups/%s/artifacts/%s/versions/%s/meta";
private static final String ARTIFACT_BY_GLOBAL_ID_PATH = "/apis/registry/v2/ids/globalIds/%d";
private static final String ARTIFACT_BY_CONTENT_ID_PATH = "/apis/registry/v2/ids/contentIds/%d";
private static final String ARTIFACT_META_PATH = "/apis/registry/v2/groups/%s/artifacts/%s/meta";
private static final String VERSION_LATEST = "latest";
private static final int MAX_PADDING_LENGTH = SIZE_OF_BYTE + SIZE_OF_LONG;
private static final byte MAGIC_BYTE = 0x0;
Expand Down Expand Up @@ -156,7 +155,7 @@ public String resolve(
{
try
{
artifact = sendHttpRequest(MessageFormat.format(artifactPath, artifactId));
artifact = sendHttpRequest(artifactPath.formatted(artifactId));
if (artifact == null)
{
if (retryAttempts.getAndIncrement() == 0)
Expand Down Expand Up @@ -238,8 +237,8 @@ public int resolve(
{
try
{
String path = VERSION_LATEST.equals(version) ? MessageFormat.format(ARTIFACT_META_PATH, groupId, artifact) :
MessageFormat.format(ARTIFACT_VERSION_PATH, groupId, artifact, version);
String path = VERSION_LATEST.equals(version) ? ARTIFACT_META_PATH.formatted(groupId, artifact) :
ARTIFACT_VERSION_PATH.formatted(groupId, artifact, version);

String response = sendHttpRequest(path);
if (response == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import java.nio.ByteOrder;
import java.security.KeyStore;
import java.security.SecureRandom;
import java.text.MessageFormat;
import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentMap;
Expand Down Expand Up @@ -59,10 +58,10 @@

public class SchemaRegistryCatalogHandler implements CatalogHandler
{
private static final String SUBJECT_VERSION_PATH = "/subjects/{0}/versions/{1}";
private static final String REGISTER_SUBJECT_PATH = "/subjects/{0}/versions";
private static final String UNREGISTER_SUBJECT_PATH = "/subjects/{0}";
private static final String SCHEMA_PATH = "/schemas/ids/{0}";
private static final String SUBJECT_VERSION_PATH = "/subjects/%s/versions/%s";
private static final String REGISTER_SUBJECT_PATH = "/subjects/%s/versions";
private static final String UNREGISTER_SUBJECT_PATH = "/subjects/%s";
private static final String SCHEMA_PATH = "/schemas/ids/%d";
private static final String HTTPS = "https://";

private static final int MAX_PADDING_LENGTH = 5;
Expand Down Expand Up @@ -154,7 +153,7 @@ public int register(
{
int versionId = NO_VERSION_ID;

String response = sendPostHttpRequest(MessageFormat.format(REGISTER_SUBJECT_PATH, subject), schema);
String response = sendPostHttpRequest(REGISTER_SUBJECT_PATH.formatted(subject), schema);
if (response != null)
{
versionId = registerRequest.resolveResponse(response);
Expand All @@ -169,7 +168,7 @@ public int[] unregister(
{
int[] versions = NO_VERSIONS;

String response = sendDeleteHttpRequest(MessageFormat.format(UNREGISTER_SUBJECT_PATH, subject));
String response = sendDeleteHttpRequest(UNREGISTER_SUBJECT_PATH.formatted(subject));
if (response != null)
{
versions = unregisterRequest.resolveResponse(response);
Expand Down Expand Up @@ -215,7 +214,7 @@ public String resolve(
{
try
{
String response = sendHttpRequest(MessageFormat.format(SCHEMA_PATH, schemaId));
String response = sendHttpRequest(SCHEMA_PATH.formatted(schemaId));
if (response == null)
{
if (retryAttempts.getAndIncrement() == 0)
Expand Down Expand Up @@ -297,7 +296,7 @@ public int resolve(
{
try
{
String response = sendHttpRequest(MessageFormat.format(SUBJECT_VERSION_PATH, subject, version));
String response = sendHttpRequest(SUBJECT_VERSION_PATH.formatted(subject, version));
if (response == null)
{
if (retryAttempts.getAndIncrement() == 0)
Expand Down