Skip to content

Commit 13dfec3

Browse files
committed
rest mantionf of Kentico
1 parent e8d6dae commit 13dfec3

File tree

20 files changed

+123
-121
lines changed

20 files changed

+123
-121
lines changed

delivery-sdk/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,11 @@ You need to instantiate the Delivery client with the constructor that disables t
285285
DeliveryClient client = new DeliveryClient(new DeliveryOptions(AppConfig.KONTENT_PROJECT_ID), null);
286286
```
287287

288-
See it [used in a sample app](../sample-app-android/src/main/java/com/github/kentico/delivery_android_sample/data/source/DeliveryClientProvider.java)).
288+
See it [used in a sample app](../sample-app-android/src/main/java/kontent/ai/delivery_android_sample/data/source/DeliveryClientProvider.java)).
289289

290290
### 2. Register strongly-typed models
291291

292-
Android applications must register the models using the `registerType` method. See a usage example in [DeliveryClientProvider.java](../sample-app-android/src/main/java/com/github/kentico/delivery_android_sample/data/source/DeliveryClientProvider.java).
292+
Android applications must register the models using the `registerType` method. See a usage example in [DeliveryClientProvider.java](../sample-app-android/src/main/java/kontent/ai/delivery_android_sample/data/source/DeliveryClientProvider.java).
293293

294294
You can still use the [model generator](../delivery-sdk-generators/README.md) for generating the models.
295295

delivery-sdk/src/main/java/kontent/ai/delivery/Asset.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void setDescription(String description) {
112112
/**
113113
* Absolute URL for the asset
114114
*
115-
* @return URL for the asset, hosted by Kentico
115+
* @return URL for the asset, hosted by Kontent.ai
116116
*/
117117
public String getUrl() {
118118
return url;

delivery-sdk/src/main/java/kontent/ai/delivery/DeliveryClient.java

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ private <T> CompletionStage<T> executeRequest(final String url, Class<T> tClass)
414414

415415

416416
if (skipCache) {
417-
return retrieveFromKentico(request, url, tClass, 0);
417+
return retrieveFromKontent(request, url, tClass, 0);
418418
} else {
419419
return cacheManager.get(url).thenApply(jsonNode -> {
420420
try {
@@ -423,20 +423,20 @@ private <T> CompletionStage<T> executeRequest(final String url, Class<T> tClass)
423423
}
424424
return objectMapper.treeToValue(jsonNode, tClass);
425425
} catch (JsonProcessingException e) {
426-
log.error("JsonProcessingException parsing Kentico object: {}", e.toString());
426+
log.error("JsonProcessingException parsing Kontent.ai object: {}", e.toString());
427427
}
428428
return null;
429429
}).thenCompose(result -> {
430430
if (result != null) {
431431
return CompletableFuture.completedFuture(result);
432432
} else {
433-
return retrieveFromKentico(request, url, tClass, 0);
433+
return retrieveFromKontent(request, url, tClass, 0);
434434
}
435435
});
436436
}
437437
}
438438

439-
private <T> CompletionStage<T> retrieveFromKentico(Request request, final String url, Class<T> tClass, int retryTurn) {
439+
private <T> CompletionStage<T> retrieveFromKontent(Request request, final String url, Class<T> tClass, int retryTurn) {
440440
return send(request)
441441
.thenApply(this::logResponseInfo)
442442
.thenApply(this::handleErrorIfNecessary)
@@ -471,16 +471,16 @@ private <T> CompletionStage<T> retrieveFromKentico(Request request, final String
471471
if (error instanceof CompletionException) {
472472
Throwable cause = error.getCause();
473473

474-
// Don't retry when when not KenticoException or not set to retry
475-
boolean retry = cause instanceof KenticoException && ((KenticoException) cause).shouldRetry();
474+
// Don't retry when when not KontentException or not set to retry
475+
boolean retry = cause instanceof KontentException && ((KontentException) cause).shouldRetry();
476476

477477
if (!retry) {
478478
throw (CompletionException) error;
479479
}
480480
}
481481

482482
if (counter.incrementAndGet() > deliveryOptions.getRetryAttempts()) {
483-
KenticoRetryException ex = new KenticoRetryException(deliveryOptions.getRetryAttempts());
483+
KontentRetryException ex = new KontentRetryException(deliveryOptions.getRetryAttempts());
484484
ex.initCause(error.getCause());
485485
throw ex;
486486
}
@@ -494,15 +494,15 @@ private <T> CompletionStage<T> retrieveFromKentico(Request request, final String
494494
return CompletableFuture.supplyAsync(
495495
() -> {
496496
try {
497-
return retrieveFromKentico(request, url, tClass, counter.get())
497+
return retrieveFromKontent(request, url, tClass, counter.get())
498498
.toCompletableFuture().get();
499499
} catch (InterruptedException e) {
500500
log.error(String.format("InterruptedException have been raised on retial no. %d", counter.get()));
501501
throw new CompletionException(e);
502502
} catch (ExecutionException e) {
503503
log.error(String.format("ExecutionException have been raised on retrial no. %d", counter.get()));
504-
if (e.getCause() instanceof KenticoRetryException) {
505-
KenticoRetryException exception = new KenticoRetryException(((KenticoRetryException) e.getCause()).getMaxRetryAttempts());
504+
if (e.getCause() instanceof KontentRetryException) {
505+
KontentRetryException exception = new KontentRetryException(((KontentRetryException) e.getCause()).getMaxRetryAttempts());
506506
exception.initCause(error.getCause());
507507
throw exception;
508508
}
@@ -518,8 +518,8 @@ private <T> CompletionStage<T> retrieveFromKentico(Request request, final String
518518
throw new CompletionException(e);
519519
} catch (ExecutionException e) {
520520
log.error("ExecutionException have been raised for timeout");
521-
if (e.getCause() instanceof KenticoRetryException) {
522-
KenticoRetryException exception = new KenticoRetryException(((KenticoRetryException) e.getCause()).getMaxRetryAttempts());
521+
if (e.getCause() instanceof KontentRetryException) {
522+
KontentRetryException exception = new KontentRetryException(((KontentRetryException) e.getCause()).getMaxRetryAttempts());
523523
exception.initCause(error.getCause());
524524
throw exception;
525525
}
@@ -529,33 +529,33 @@ private <T> CompletionStage<T> retrieveFromKentico(Request request, final String
529529
});
530530
}
531531

532-
private Response handleErrorIfNecessary(Response response) throws KenticoIOException, KenticoErrorException {
532+
private Response handleErrorIfNecessary(Response response) throws KontentIOException, KontentErrorException {
533533
final int status = response.code();
534534
if (RETRY_STATUSES.contains(status)) {
535-
log.error("Kentico API retry status returned: {} (one of {})", status, RETRY_STATUSES.toString());
535+
log.error("Kontent.ai API retry status returned: {} (one of {})", status, RETRY_STATUSES.toString());
536536
try {
537-
KenticoError kenticoError = objectMapper.readValue(response.body().bytes(), KenticoError.class);
538-
throw new KenticoErrorException(kenticoError, true);
537+
KontentError kontentError = objectMapper.readValue(response.body().bytes(), KontentError.class);
538+
throw new KontentErrorException(kontentError, true);
539539
} catch (IOException e) {
540540
log.error("IOException when trying to parse the error response body: {}", e.toString());
541-
throw new KenticoIOException(String.format("Kentico API retry status returned: %d (one of %s)", status, RETRY_STATUSES.toString()), true);
541+
throw new KontentIOException(String.format("Kontent.ai API retry status returned: %d (one of %s)", status, RETRY_STATUSES.toString()), true);
542542
}
543543
} else if (status >= 500) {
544-
log.error("Kentico API server error, status: {}", status);
544+
log.error("Kontent.ai API server error, status: {}", status);
545545
log.info("Request URL: ", response.request().url().toString());
546546
String message =
547547
String.format(
548-
"Unknown error with Kentico API. Kentico is likely suffering site issues. Status: %s",
548+
"Unknown error with Kontent.ai API. Kontent.ai is likely suffering site issues. Status: %s",
549549
status);
550-
throw new CompletionException(new KenticoIOException(message, false));
550+
throw new CompletionException(new KontentIOException(message, false));
551551
} else if (status >= 400) {
552-
log.error("Kentico API server error, status: {}", status);
552+
log.error("Kontent.ai API server error, status: {}", status);
553553
try {
554-
KenticoError kenticoError = objectMapper.readValue(response.body().bytes(), KenticoError.class);
555-
throw new CompletionException(new KenticoErrorException(kenticoError, false));
554+
KontentError kontentError = objectMapper.readValue(response.body().bytes(), KontentError.class);
555+
throw new CompletionException(new KontentErrorException(kontentError, false));
556556
} catch (IOException e) {
557-
log.error("IOException connecting to Kentico: {}", e.toString());
558-
throw new CompletionException(new KenticoIOException(e, false));
557+
log.error("IOException connecting to Kontent.ai: {}", e.toString());
558+
throw new CompletionException(new KontentIOException(e, false));
559559
}
560560
}
561561

delivery-sdk/src/main/java/kontent/ai/delivery/DeliveryParameterBuilder.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -602,8 +602,8 @@ public DeliveryParameterBuilder excludeLinkedItems() {
602602
*
603603
* @param language The language variant to return.
604604
* @return This DeliveryParameterBuilder with the added operator.
605-
* @see <a href="https://docs.kontent.ai/tutorials/set-up-projects/set-up-languages/localization-in-kentico-kontent">More on Localization</a>
606-
* @see <a href="https://docs.kontent.ai/tutorials/set-up-projects/set-up-languages/localization-in-kentico-kontent#section-language-fallbacks">
605+
* @see <a href="https://kontent.ai/learn/tutorials/manage-kontent-ai/projects/set-up-languages/">More on Localization</a>
606+
* @see <a href=https://kontent.ai/learn/tutorials/manage-kontent-ai/projects/set-up-languages/#section-language-fallbacks">
607607
* Language fallbacks</a>
608608
*/
609609
public DeliveryParameterBuilder language(String language) {
@@ -620,8 +620,8 @@ public DeliveryParameterBuilder language(String language) {
620620
*
621621
* @param language The language variant to return.
622622
* @return This DeliveryParameterBuilder with the added operator.
623-
* @see <a href="https://docs.kontent.ai/tutorials/set-up-projects/set-up-languages/localization-in-kentico-kontent">More on Localization</a>
624-
* @see <a href="https://docs.kontent.ai/tutorials/set-up-projects/set-up-languages/localization-in-kentico-kontent#section-language-fallbacks">
623+
* @see <a href="https://kontent.ai/learn/tutorials/manage-kontent-ai/projects/set-up-languages/">More on Localization</a>
624+
* @see <a href="https://kontent.ai/learn/tutorials/manage-kontent-ai/projects/set-up-languages/#section-language-fallbacks">
625625
* Language fallbacks</a>
626626
*/
627627
public DeliveryParameterBuilder language(Locale language) {

delivery-sdk/src/main/java/kontent/ai/delivery/Image.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class Image {
6464
* Absolute URL for the image
6565
*
6666
* @param url Sets the url of this
67-
* @return An absolute URL image hosted by Kentico
67+
* @return An absolute URL image hosted by Kontent.ai
6868
*/
6969
@JsonProperty("url")
7070
String url;

delivery-sdk/src/main/java/kontent/ai/delivery/KenticoError.java renamed to delivery-sdk/src/main/java/kontent/ai/delivery/KontentError.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import com.fasterxml.jackson.annotation.JsonProperty;
2828

2929
/**
30-
* Kentico error response
30+
* Kontent.ai error response
3131
* <p>
3232
* Kontent returns standard HTTP status codes to indicate success or failure of a request. In general, codes in
3333
* the 2xx range indicate a successful request, codes in the 4xx range indicate errors caused by an incorrect input
@@ -46,19 +46,19 @@
4646
@lombok.ToString
4747
@lombok.EqualsAndHashCode
4848
@lombok.NoArgsConstructor
49-
public class KenticoError implements java.io.Serializable {
49+
public class KontentError implements java.io.Serializable {
5050

5151
/**
52-
* Returns the error message provided by Kentico detailing the error.
52+
* Returns the error message provided by Kontent.ai detailing the error.
5353
*
5454
* @param message Sets the message of this.
55-
* @return The error message from Kentico.
55+
* @return The error message from Kontent.ai.
5656
*/
5757
@JsonProperty("message")
5858
String message;
5959

6060
/**
61-
* Returns a unique ID that can be provided to Kentico for support in relation to the error.
61+
* Returns a unique ID that can be provided to Kontent.ai for support in relation to the error.
6262
*
6363
* @param requestId Sets the request ID of this.
6464
* @return The unique ID for this error
@@ -67,7 +67,7 @@ public class KenticoError implements java.io.Serializable {
6767
String requestId;
6868

6969
/**
70-
* Returns the HTTP error code returned by Kentico.
70+
* Returns the HTTP error code returned by Kontent.ai.
7171
* <table>
7272
* <caption>HTTP error codes</caption>
7373
* <tr><td>400 - Bad Request</td><td>The request was not understood. Check for a missing required parameter, or an
@@ -86,10 +86,10 @@ public class KenticoError implements java.io.Serializable {
8686
int errorCode;
8787

8888
/**
89-
* Returns the specific code returned by the Kentico error response.
89+
* Returns the specific code returned by the Kontent.ai error response.
9090
*
9191
* @param specificCode Sets the specific code of this.
92-
* @return The specific code returned by the Kentico error response.
92+
* @return The specific code returned by the Kontent.ai error response.
9393
*/
9494
@JsonProperty("specific_code")
9595
int specificCode;

delivery-sdk/src/main/java/kontent/ai/delivery/KenticoErrorException.java renamed to delivery-sdk/src/main/java/kontent/ai/delivery/KontentErrorException.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,34 @@
2525
package kontent.ai.delivery;
2626

2727
/**
28-
* Thrown to indicate failure of a Kentico request.
28+
* Thrown to indicate failure of a Kontent.ai request.
2929
*
30-
* @see KenticoError
30+
* @see KontentError
3131
*/
32-
public class KenticoErrorException extends RuntimeException implements KenticoException {
32+
public class KontentErrorException extends RuntimeException implements KontentException {
3333

34-
private final KenticoError kenticoError;
34+
private final KontentError kontentError;
3535
private boolean shouldRetry;
3636

3737
/**
38-
* Thrown to indicate failure of a Kentico request
38+
* Thrown to indicate failure of a Kontent.ai request
3939
*
40-
* @param kenticoError The original KenticoError
40+
* @param kontentError The original KontentError
4141
*/
42-
public KenticoErrorException(KenticoError kenticoError, boolean shouldRetry) {
43-
super(kenticoError.getMessage());
44-
this.kenticoError = kenticoError;
42+
public KontentErrorException(KontentError kontentError, boolean shouldRetry) {
43+
super(kontentError.getMessage());
44+
this.kontentError = kontentError;
4545
this.shouldRetry = shouldRetry;
4646
}
4747

4848
/**
49-
* Returns the original error provided by Kentico. Useful for debugging.
49+
* Returns the original error provided by Kontent.ai. Useful for debugging.
5050
*
51-
* @return The original KenticoError
52-
* @see KenticoError
51+
* @return The original KontentError
52+
* @see KontentError
5353
*/
54-
public KenticoError getKenticoError() {
55-
return kenticoError;
54+
public KontentError getKontentError() {
55+
return kontentError;
5656
}
5757

5858
@Override
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package kontent.ai.delivery;
22

3-
public interface KenticoException {
3+
public interface KontentException {
44
boolean shouldRetry();
55
}

delivery-sdk/src/main/java/kontent/ai/delivery/KenticoIOException.java renamed to delivery-sdk/src/main/java/kontent/ai/delivery/KontentIOException.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,18 @@
2828

2929
/**
3030
* Thrown when an {@link IOException} is thrown when executing against the Kontent API. Generally means
31-
* connectivity problems with Kentico of problem parsing {@link KenticoError} from body.
31+
* connectivity problems with Kontent.ai of problem parsing {@link KontentError} from body.
3232
*/
33-
public class KenticoIOException extends RuntimeException implements KenticoException {
33+
public class KontentIOException extends RuntimeException implements KontentException {
3434

3535
private boolean shouldRetry;
3636

37-
KenticoIOException(String message, boolean shouldRetry) {
37+
KontentIOException(String message, boolean shouldRetry) {
3838
super(message);
3939
this.shouldRetry = shouldRetry;
4040
}
4141

42-
KenticoIOException(IOException cause, boolean shouldRetry) {
42+
KontentIOException(IOException cause, boolean shouldRetry) {
4343
super(cause);
4444
this.shouldRetry = shouldRetry;
4545
}

delivery-sdk/src/main/java/kontent/ai/delivery/KenticoRetryException.java renamed to delivery-sdk/src/main/java/kontent/ai/delivery/KontentRetryException.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* MIT License
33
*
4-
* Copyright (c) 2020
4+
* Copyright (c) 2022 Kontent s.r.o.
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -26,13 +26,13 @@
2626

2727
/**
2828
* Thrown when retry attempts are is thrown when executing against the Kontent API. Generally means
29-
* connectivity problems with Kentico.
29+
* connectivity problems with Kontent.ai.
3030
*/
31-
public class KenticoRetryException extends RuntimeException implements KenticoException {
31+
public class KontentRetryException extends RuntimeException implements KontentException {
3232

3333
private final int maxRetryAttempts;
3434

35-
KenticoRetryException(int maxRetryAttempts) {
35+
KontentRetryException(int maxRetryAttempts) {
3636
super(String.format("Retry attempty reached max retry attempts (%d) ", maxRetryAttempts));
3737
this.maxRetryAttempts = maxRetryAttempts;
3838
}

0 commit comments

Comments
 (0)