10Duke Scale SDK for Java
|
This documentation gives high level overview of the 10Duke SDK for Java and introduces some fundamental concepts.
Central contracts have been defined as interfaces. A default implementation is provided for each such Java API. The SDK user can choose to replace default implementations by suppling own implementations per case.
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 what is called a producer pattern (e.g. method annotated @Produces
in a managed bean). See more about the producer pattern in e.g. 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.:
State is defined of user authentication status and by licenses that have been consumed. Storage for such state is recommended to be persistent. That way the application can continue operating after restarting with less need to make expensive network calls.
The 10Duke Scale SDK for Java covers implementation for calling the license checkout API. Reusing an HTTP client instance and an existing authorization provider instance is recommended when (if) making calls to other 10Duke Scale API endpoints from 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 detail in package tenduke.scale.api.exception
.
The 10Duke Scale SDK for Java code depends on a HTTP client, JSON processing, Private and Public key use, ability to parse and validate JSON Web Tokens and to run user authentication / authorization using OpenID Connect.
The 10Duke Java Core project provides most of these basics.
The main 3rd party dependencies used are: