|
10Duke Scale SDK for Java
|
This article provides a high-level overview of the 10Duke SDK for Java and introduces some fundamental concepts.
The central contracts have been defined as interfaces. A default implementation is provided for each Java API. The SDK user can choose to replace default implementations by supplying their own implementations as needed.
The interfaces and default implementations support use via dependency injection. Some implementation classes require construction other than using a no-argument constructor. In those cases, the SDK user must implement a producer pattern (for example, a method annotated with @Produces in a managed bean). See more about the producer pattern for example in the WELD documentation: (https://docs.jboss.org/weld/reference/latest/en-US/html_single/#_producer_methods) or in the Quarkus docs: (https://quarkus.io/guides/cdi-reference).
TendukeScaleConfig is used as an example of the producer pattern. The task is to satisfy injection points that require an instance of TendukeScaleConfig. This can be achieved by e.g.:
Client state is defined by the user's authentication status and the consumed licenses. We recommend that storage for this state is persistent. This allows the application to continue operating after a restart with fewer expensive network calls.
The 10Duke Scale SDK for Java covers implementation for calling the license checkout API. We recommend reusing an HTTP client instance and an existing authorization provider instance when making calls to other 10Duke Scale API endpoints from the application code.
API errors and SDK (application) related errors are communicated using exceptions. The 10Duke Scale SDK for Java uses and extends exceptions provided by the JDK and by the 10Duke Java Core project.
See more details in the tenduke.scale.api.exception package.
The 10Duke Scale SDK for Java depends on an HTTP client, JSON processing, Private and Public key use, ability to parse and validate JSON Web Tokens, and user authentication / authorization using OpenID Connect.
The 10Duke Java Core project provides most of these basics.
The main 3rd party dependencies used are: