Skip to content

Commit

Permalink
Merge pull request #1025 from eclipse-passage/1023
Browse files Browse the repository at this point in the history
#1023 publish cli license protection facilities
  • Loading branch information
ruspl-afed authored Feb 12, 2022
2 parents 579816e + a5fbd9c commit f2e4542
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.passage.lic.api.LicensedProduct;
import org.eclipse.passage.lic.api.LicensingException;
import org.eclipse.passage.lic.api.ServiceInvocationResult;
import org.eclipse.passage.lic.api.access.GrantLockAttempt;
import org.eclipse.passage.lic.base.diagnostic.DiagnosticExplained;
import org.eclipse.passage.lic.equinox.EquinoxPassage;
import org.eclipse.passage.lic.equinox.LicensedApplication;

public final class LicenseProtection {

Expand Down Expand Up @@ -71,12 +69,14 @@ private Optional<GrantLockAttempt> acquireLicense() {
}

private Optional<LicensedProduct> product() {
try {
return Optional.of(new LicensedApplication().product());
} catch (LicensingException e) {
log.error("Failed to read product credentials", e); //$NON-NLS-1$
return Optional.empty();
ServiceInvocationResult<LicensedProduct> product = new EquinoxPassage().product();
if (!product.data().isPresent()) {
log.error(String.format(//
"Failed to read product credentials:%s", //$NON-NLS-1$
new DiagnosticExplained(product.diagnostic()).get()));

}
return product.data();
}

private Optional<GrantLockAttempt> acquireLicense(LicensedProduct product) {
Expand Down

0 comments on commit f2e4542

Please sign in to comment.