Skip to content

Commit 6849bf9

Browse files
authored
Merge pull request #88 from SLASCONE/documentation
Documentation
2 parents c71b5fb + daa633b commit 6849bf9

2 files changed

Lines changed: 54 additions & 7 deletions

File tree

README.md

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,24 @@ It includes examples for the most important licensing, analytics, and resilience
1313
* response and file integrity validation
1414
* error handling and retry logic
1515

16-
For more information, see the [SLASCONE website](https://slascone.com/), the [support center](https://support.slascone.com/), and the [SLASCONE API](https://api365.slascone.com/swagger).
16+
For more information, see the [SLASCONE website](https://slascone.com/), the [Help Center](https://support.slascone.com/), and the [API Test Center](https://api365.slascone.com/swagger).
17+
18+
## Quick Start
19+
20+
```bash
21+
# Build the project
22+
mvn clean compile
23+
24+
# Run the interactive sample
25+
cd slascone-provisioning-sample
26+
mvn exec:java
27+
```
28+
29+
The application starts with an interactive menu. By default, it connects to a SLASCONE demo environment so you can explore the licensing and analytics scenarios immediately.
1730

1831
## Table of Contents
1932

33+
* [Quick Start](#quick-start)
2034
* [What This Sample Demonstrates](#what-this-sample-demonstrates)
2135
* [Getting Started](#getting-started)
2236
* [Connecting to Your SLASCONE Environment](#connecting-to-your-slascone-environment)
@@ -44,6 +58,27 @@ This sample application showcases the following key features of the SLASCONE lic
4458
* Sends periodic license verification requests to the SLASCONE server
4559
* Retrieves up-to-date license information including features, limitations, and expiration details
4660
* Caches license information for offline use
61+
62+
```java
63+
// Build the heartbeat request with the current device and product info
64+
AddHeartbeatDto heartbeat = new AddHeartbeatDto()
65+
.clientId(DeviceInfoService.getUniqueDeviceId())
66+
.productId(UUID.fromString(Settings.PRODUCT_ID))
67+
.softwareVersion("25.2.0");
68+
69+
// Execute with automatic retry logic for transient failures
70+
var result = ErrorHandlingHelper.execute(
71+
provisioningApi::addHeartbeatWithHttpInfo, heartbeat, "addHeartbeat");
72+
73+
if (result.hasError()) {
74+
// On network/technical errors, fall back to cached license data
75+
// On functional errors (e.g., 2006 = unknown client), handle accordingly
76+
}
77+
78+
// On success, the CombinedInterceptor automatically caches the license
79+
// response (license.txt + license_signature.txt) for offline use
80+
LicenseInfoDto licenseInfo = result.getResult();
81+
```
4782
4883
**License Activation (offline)**
4984
* Validates the digital signature of license files to prevent tampering
@@ -54,6 +89,18 @@ This sample application showcases the following key features of the SLASCONE lic
5489
* Reads license information when temporarily disconnected from the internet
5590
* Uses cached license data stored during the last successful heartbeat
5691
* Ensures the software can continue to function during temporary network outages
92+
93+
```java
94+
// Read and validate the cached license when the server is unreachable
95+
LicenseInfoDto licenseInfo = fileService.GetOfflineLicense();
96+
97+
if (licenseInfo != null) {
98+
// The signature was verified — the cached data has not been tampered with
99+
// Use licenseInfo to enforce features, limitations, and expiration as usual
100+
} else {
101+
// No valid cached license available (missing, expired, or tampered)
102+
}
103+
```
57104
58105
**License Unassignment**
59106
* Demonstrates how to unassign a license from a device
@@ -144,7 +191,7 @@ To connect it to your own SLASCONE environment, adjust the values in `Settings.j
144191

145192
You can find these values as explained [here](https://support.slascone.com/hc/en-us/articles/360016153358#common-parameters). For meaningful testing and evaluation, your SLASCONE environment should have at least one active license.
146193

147-
Keep provisioning keys secure and do not embed production secrets in publicly accessible repositories. More about secrets, see the [Secrets](https://support.slascone.com/hc/en-us/articles/7702036319261#secrets) section in the SLASCONE Help Center.
194+
> ⚠️ **Security Warning**: Keep provisioning keys secure and do not embed production secrets in publicly accessible repositories. More about secrets, see the [Secrets](https://support.slascone.com/hc/en-us/articles/7702036319261#secrets) section in the SLASCONE Help Center.
148195
149196
## Typical Licensing Flow
150197

@@ -311,7 +358,7 @@ The `ErrorHandlingHelper` classifies API errors into three categories.
311358
2. **Technical Errors (HTTP 4xx and 5xx)**
312359

313360
* Represent server-side or request issues such as internal server errors, bad gateways, or service unavailability
314-
* Transient HTTP errors such as `408`, `429`, `500`, `502`, `503`, `504`, and `507` are automatically retried
361+
* Transient HTTP errors such as `408`, `429`, `502`, `503`, `504`, and `507` are automatically retried
315362
* Non-transient errors such as `401`, `403`, or `404` are returned immediately without retry
316363
3. **Network Errors**
317364

@@ -452,14 +499,15 @@ slascone-demo-java/
452499
│ │ ├── Model/ # Data models specific to the sample application
453500
│ │ └── Program/ # Main program and helper classes
454501
│ ├── assets/ # License file examples
502+
│ ├── lib/ # Additional library references
455503
│ └── pom.xml # Maven configuration for the sample
456504
├── slascone-client/ # Generated API client module
457505
│ ├── src/main/java/ # Auto-generated API client code
458506
│ ├── docs/ # API documentation
459507
│ └── pom.xml # Maven configuration for the client
508+
├── .devcontainer/ # Development container configuration
460509
├── pom.xml # Parent Maven configuration
461-
├── run.sh # Convenience script to run the application
462-
└── build-and-run.sh # Script to build and run the application
510+
└── run.sh # Convenience script to run the application
463511
```
464512

465513
## API Client
@@ -483,7 +531,7 @@ If you use the generated client in your own application, it is recommended to ke
483531

484532
## Further Reading
485533

486-
* [SLASCONE API](https://api365.slascone.com/swagger)
534+
* [API Test Center](https://api365.slascone.com/swagger)
487535
* [What and How to Save in Your Client](https://support.slascone.com/hc/en-us/articles/7702036319261)
488536
* [Digital Signature and Data Integrity](https://support.slascone.com/hc/en-us/articles/360016063637)
489537
* [Error Handling](https://support.slascone.com/hc/en-us/articles/360016160398)

slascone-provisioning-sample/src/Program/ErrorHandlingHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ public boolean hasError() {
265265
private static boolean isTransientHttpError(int httpStatusCode) {
266266
return httpStatusCode == 408 || // Request Timeout
267267
httpStatusCode == 429 || // Too Many Requests
268-
httpStatusCode == 500 || // Internal Server Error
269268
httpStatusCode == 502 || // Bad Gateway
270269
httpStatusCode == 503 || // Service Unavailable
271270
httpStatusCode == 504 || // Gateway Timeout

0 commit comments

Comments
 (0)