1. Getting started
- 1.1. Installing Javonet
- 1.2. Activating Javonet
- 1.3. Adding References to .NET Libraries
- 1.4. XML Configuration File
- 1.5. Using the Javonet Fluent Interface
- 1.7. Introduction to Using .NET Back-end and UI Components in Java
2. Calling methods
- 2.1. Invoking Static Methods
- 2.2. Creating Instance and Calling Instance Methods
- 2.3. Calling Generic Methods
3. Working with .NET Objects
- 3.1. Creating Instance Of Generic Object
- 3.2. Extending the .NET Class in Java and Wrapping .NET Methods
4. Fields and Properties
- 4.1. Get/Set Values for Static Fields and Properties
- 4.2. Get/Set Values for Instance Fields and Properties
5. Methods Arguments
- 5.1. Passing Reference-Type Arguments
- 5.2. Passing Arguments by Reference with “ref” and “out” Keywords
- 5.3. Passing typeof(Type) as Method Argument
- 5.4. Calling Overloaded Method Passing Null Argument
6. Nested Types
7. Enums
8. Arrays and Collections
- 8.1. Arrays: Using Value-Type and Reference-Type Arrays
- 8.2. Working with .NET arrays and collections from Java with Javonet
9. Embeding UI controls
10. Referencing libraries
11. Off-line activation
12. Events and Delegates
13. Disposing and Garabage Collection
14. .NET Configuration Files (AppConfig, WebConfig)
15. Exceptions, Debugging and Testing
- 15.. Handling Activation Issues
- 15.1. Handling .NET Exceptions
- 15.2. How to debug .NET code called from Java
- 15.3. Debugging Javonet Enabled Application
16. Strongly-Typed Wrappers
17. Advanced Activation and Licensing
- 17.1. Runtime vs. Offline vs. Compile Time Activation
- 17.2. Project Activation Tool
- 17.6. Delegating Activation Server
18 Other usage scenarios
Javonet activation works in two modes. Synchronous and asynchronous. The activation mode depends on the condition if the license file is available or provided as in code.
Using standard activation with license key
This chapter refers to standard activation where license key is passed either to activate method or configured in XML configuration file.
If there is no license file and standard activation method is called Javonet will execute synchronous activation. Once the activation is successful Javonet stores the javonet.lic file in the application working directory or directory indicated using Javonet.setLicenseDirectory(…). If you have offline generated license or license activated per project files it can be placed in the license or working directory manually or with your package deployment. Each execution of the application when license file is available will trigger the asynchronous activation mode.
- synchronous activation – call on Javonet.activate method or first usage of Javonet with XML config file, triggers the execution of activation logic which calls Javonet activation server and receives the activation confirmation and license file. Due to the cryptography operations and need to process the activation request by activation server this call might take up to few seconds.
- asynchronous activation – when license file is available call of Javonet.activate method or first usage of Javonet with XML config file will extract license limits from license file and trigger the asynchronous thread which will perform the license verification. During the license verification Javonet will work like it was activated properly. This approach guarantees fast execution of your application and no unnecessary delays. Asynchronous license verification will validate the license, machine hardware ID and license expiry date. If all checks are successful Javonet will become activated. If any check like hardware ID, license expiry date or license integrity is not fulfilled, Javonet will try to renew the license by contacting Javonet activation server and replacing the license file. If that will be successful Javonet will repeat the license verification, otherwise will get blocked and all further calls on Javonet API will be rejected.
Important! In case of license expiration if Javonet will not be able to contact activation server it will keep working properly for another 180 days of grace period. Read more in Subscription and License File Grace Period section.
Listening for Activation and License Verification Issues
It is important to properly handle the Javonet activation issues and potential license rejection and blocking of an API. For that purpose we have expose new method to subscribe for license activation state notifications Javonet.addActivationStateListener(…). Activation state listener passed to this method will be notified about each critical change in Javonet activation state both in synchronous and asynchronous mode. It can be used to detect the license grace period or activation rejection, to properly handle that in your application.
Check the code below to see how you can subscribe to activation state update events:
Javonet.addActivationStateListener(new JavonetActivationStateListener() { @Override public void activationStateUpdated(JavonetActivationState arg0, String arg1) { System.out.println("Notification Received: "+arg0.name()+" : " +arg1); } });
This method must be called before calling Javonet.activate and cannot be used with XML configuration file.
First argument of the method returns the enum value indicating the type of activation event and second argument provides detailed open text description. Possible activation states are:
- Started – activation has been initiated (not used in current release)
- Verified – license verification has been completed with success
- NewLicenseGenerated – new license file has been generated (not used in current release)
- LicenseInvalid – license is corrupted (not used in current release)
- LicenseExpired BLOCKING – license has expired and grace period has passed, Javonet usage will be blocked
- LicenseInGracePeriod – license has expired but is still within grace period, Javonet was not able to renew the license from the server. License renewal will be retried with next execution.
- LicenseFileNotExisting – license file does not exist (not used in current release)
- ActivationRejectedByServer BLOCKING – license file has expired, Javonet tried to renew the license but activation server rejected the activation. Detailed reason will be provided in second argument. Javonet usage will be blocked.
- Exception – other unknown exception occurred