Application Programming Interfaces

This document defines the APIs that are being produced or consumed by the license management sub-component in Acumos.

LicenseCreator.createRTU

User specific RTU with generated RTU id in library and generated RTU reference in library

Examples:

Simple example:

// where client is instance of ICommonDataServiceRestClient
ILicenseCreator licenseCreator = new LicenseCreator(client);
CreateRTURequest createRTURequest = new CreateRTURequest(solutionId, userId);
ICreatedRtu createdRtuInfo = licenseCreator.createRTU(createRTURequest);

Site specific RTU as well as all options provided:

CreateRTURequest createSiteWideRTURequest = new CreateRTURequest();

// solutionId, userId
createSiteWideRTURequest.setSiteWide(true);
createSiteWideRTURequest.setSolutionId(solutionId);
createSiteWideRTURequest.addUserId(userId);
createSiteWideRTURequest.setRtuId(new Random().nextLong());
createSiteWideRTURequest.setRtuRefs(new String[] { UUID.randomUUID().toString() });
ICreatedRtu createdRtuInfo = licenseCreator.createRtu(createSiteWideRTURequest);

More info see LicenseCreator javadocs

LicenseCreator is using CDS RTU APIs

LicenseVerifier.verifyRTU

Verification of a rtu for a solutionId and userId provided by CDS.

// where client is instance of ICommonDataServiceRestClient
ILicenseVerifier licenseVerifier = new LicenseVerifier(client);
VerifyLicenseRequest licenseDownloadRequest = new VerifyLicenseRequest(LicenseAction.deploy, "solutionid", "userid");
licenseDownloadRequest.addAction(LicenseAction.download);
ILicenseVerification verifyUserRTU = licenseVerifier.verifyRtu(licenseDownloadRequest);
verifyUserRTU.isAllowed(LicenseAction.download) // returns true / false if rtu exists
verifyUserRTU.isAllowed(LicenseAction.deploy) // returns true / false if rtu exists

Learn more in LicenseVerifier java docs

License Verification is using CDS RTU APIs

LicenseJsonValidationResults.validateLicenseJson

Example api call:

LicenseJsonValidator validator = new LicenseJsonValidator();
LicenseJsonValidationResults results = validator.validateLicenseJson(goodJson);
boolean isValid = results.getJsonSchemaErrors().isEmpty();

Learn more in LicenseJsonValidationResults java docs

Json Schema