website logo
⌘K
Getting Started
Introduction
Basic Concepts
Opening an Account
Creating & Configuring Products
Integrating SDK and Configuring License Fulfillment
Activate a Key-Based License
Vendor Platform
Issuing New Licenses
License Detail View
Order Detail View
Customer Detail View
Metadata
Analytics
Settings
Product Configuration
Product Features
Product Custom Fields
Product Versioning
License Policies
Product Bundles
License Entitlements
License Types
Activations & Device Transfers
Features
Custom Fields
License Start Date
License Note
Maintenance Period
Trial Licenses
Floating Licenses
License Activation Types
Portals
End-User Portal
Offline Portal
Air-Gapped Portal
License API
License API Authorization
License Activation/Deactivation
License Check
Consumption
Floating
Trial Key
Product Details
Device Variables
Changing Password
Management API
Making API Requests
Management API Authorization
Customer
Product
Order
License
Device
Analytics
SDKs
Tutorials
.NET/C# SDK
.NET/C# Management SDK
C++ SDK
Java SDK
Python SDK
Go SDK
Delphi SDK
Swift/Objective-C SDK
Android SDK
Unity SDK
Errors and Response Codes
Floating Server
API Reference
Deployment
Configuration
Floating Server UI
Securing the Server
Whitelabeling
FAQ
Floating Server Changelog
Integrations
Salesforce
FastSpring
Stripe
Shopify
Common Scenarios
Single Sign On (SSO)
Glossary
General
SDK Glossary
Vendor Platform
Product Configuration Glossary
License Configuration
Postman Collections
Frequently Asked Questions
Changelog
License API changelog
Platform changelog
Docs powered by
Archbee
SDKs
...
Java SDK
Java Modules

Proxy Floating

11min

The ProxyFloatingService is intended to be used with the on-premise Floating Server and is part of the Floating Client module.

Initializing the Proxy Floating Client module

At the minimum there are three parameters you will need to initialize the SDK:

  • apiKey, your company API key
  • sharedKey, company-specific encryption key, used when signing requests
  • productCode, an alphanumeric code identifying a specific product

The productCode is tied to a specific product the license applies to and is defined while creating the product.

Optional Configuration parameters for initializing the Floating Client SDK:

  • addShutdownHook indicates if you want the SDK to automatically release any currently active licenses on the device before you shut down the runtime process. Default is true.
  • enablePeriodicRegister enables periodic calls to register method to prolong the license usage. It will be prolonged every time the license has passed half of its floating timeout time. Usage time is set through the LicenseSpring platform with the floatingTimeout parameter in the product configuration
  • proxyRegisterSubscriber subscriber on periodic register, default implementation is IgnoreRegisterEventSubscriber, but you can add your own implementation to handle the onSuccess and onError of the periodic register. This, of course, isn't a parameter you need to worry about if you chose not to enable periodic checks.
  • requestLogging request logging for debug purposes, default is no request logging.
  • appVersion manually set the version of the application that's using the SDK.
  • enableRetrying enables the retry option on failed API call to the server. The call can be repeated for up to 4 times. Default is false
  • identityProvider set a custom IdentityProvider which generates unique keys for a particular device. Default implementation is based on ONCE_PER_PROCESS. More details on our Java Hardware (Device) IDs
  • requestTimeout set the timeout of requests make to API (in seconds), default is 10 seconds
Java
|
// configuration with only required parameters
// NOTE building a LicenseSpringConfiguration without required parameters will throw a ConfigurationException
try {
  ProxyConfiguration configuration = ProxyConfiguration.builder()
    .host("localhost")
    .port(8080)
    .product("pc")
    .build();
} catch (ConfigurationException e) {
  log.error(e.getCause().getMessage());
}

// Configuration with more parameters
try {
  ProxyConfiguration configuration = ProxyConfiguration.builder()
    .host("localhost")
    .port(8080)
    .product("pc")
    .addShutdownHook(false)
    .enablePeriodicCheck(false)
    .enableRetrying(true)
    .requestTimeout(60L)
    .build();
} catch (ConfigurationException e) {
  log.error(e.getCause().getMessage());
}


ProxyFloatingService

After setting up the SDK configuration, there are a number of methods and objects available to the app developer.

To make the ProxyFloatingService, initialize it by passing the ProxyConfiguration object you set up earlier.

Java
|
ProxyFloatingService service = new ProxyFloatingService(configuration);


Now you can use the methods that the ProxyFloatingService provides.

register()

Registers the user by making a ProxyRequest which contains the product code from the ProxyConfiguration and the device ID which is provided by the IdentityProvider. Each registration lasts for the time specified in the LicenseSpring platform (floating timeout). In order to prolong the usage of the product, this method needs to be called periodically (this is automatically called in the background if the property enablePeriodicRegister in the ProxyConfiguration was set to true). Returns the LicenseData object which contains information about the license.

Java
|
try {
  LicenseData licenseData = service.register();
  System.out.println("You have " + licenseData.getFloatingTimeout() + " more minutes.");
} catch (LicenseSpringException e) {
  log.error(e.getCause().getMessage());
}


unregister()

Unregisters the user, which by definition, frees up one user slot on the server. Returns true if the action was successful.

Java
|
try {
  if (service.unregister()) {
    System.out.println("You have been successfully unregistered from product " + configuration.getProduct());
  }
} catch (LicenseSpringException e) {
  log.error(e.getCause().getMessage());
}


getLicense()

Fetches the license information from the server for the product specified in the ProxyConfiguration object.

Java
|
try {
  if (service.unregister()) {
    System.out.println("You have been successfully unregistered from product " + configuration.getProduct());
  }
} catch (LicenseSpringException e) {
  log.error(e.getCause().getMessage());
}


getSettings()

Retrievers the server settings. The returned Settings object contains registrationExpiryMinutes, and an array of server addresses.

Java
|
try {
  Settings settings = service.getSettings();
  System.out.println("There are " + settings.getServers().length + "in your proxy network.");
  System.out.println("The registration expiry time for product " + configuration.getProduct() + " is " +
                     settings.getRegistrationExpiryMinutes() + " minutes");
} catch (LicenseSpringException e) {
  log.error(e.getCause().getMessage());
}try {
  if (service.unregister()) {
    System.out.println("You have been successfully unregistered from product " + configuration.getProduct());
  }
} catch (LicenseSpringException e) {
  log.error(e.getCause().getMessage());
}


pingServer()

Pings the local proxy server.

Java
|
try {
  service.pingServer();
  System.out.println("The proxy server is up and running. :)");
} catch (LicenseSpringException e) {
  System.out.println("There is something wrong with your local server, this application cannot connect to it.");
  System.out.println("Please check why: " + e.getCause().getMessage());
}




Updated 05 Sep 2023
Did this page help you?
PREVIOUS
Floating Client
NEXT
Management SDK
Docs powered by
Archbee
TABLE OF CONTENTS
Initializing the Proxy Floating Client module
ProxyFloatingService
register()
unregister()
getLicense()
getSettings()
pingServer()
Docs powered by
Archbee