Package com.iizix.license
Class LicenseSystem
java.lang.Object
com.iizix.license.LicenseSystem
Instance used to load the license system.
- Author:
- Christopher Mindus
Field Summary
Method Summary
Modifier and TypeMethodDescriptionstatic void
assignWebServerRoot
(File root) Assigns the web server root directory for the license system.void
cleanUp()
Cleans up any temporary files and directories.static String
formatProduct
(int product) Formats the product.static LicenseSystem
Gets the instance of license system.static LicenseSystem
getInstance
(Object caller) Gets the instance of license system.<T> T
getInstanceImplementation
(Object caller, Class<T> implClass) Gets the instance of the license system implementation.static String
Converts a profile picture file of file extension ".png", ".jpg" or ".jpeg" to a Base64 encoded string with the file name.static byte[]
getProfilePictureFromString
(String string, StringBuilder buf) Returns a Base64 encoded profile picture as a byte array that can be written to file.boolean
Prepares the license system.boolean
Prepares the license system.
Field Details
PRODUCTS
The product names according to:0=other,
1=designer,
2=development server,
3=standard production server,
4=container production server (JakartaEE or other), or
5=cluster.
Method Details
formatProduct
Formats the product.- Parameters:
product
- The produce code as:0=other,
1=designer,
2=development server,
3=standard production server,
4=container production server (JakartaEE or other), or
5=cluster.- Returns:
- The name of the product.
getInstance
Gets the instance of license system.- Returns:
- The instance of the LicenseSystem.
getInstance
Gets the instance of license system.- Parameters:
caller
- The special caller Object for testing, null for none.- Returns:
- The instance of the LicenseSystem.
assignWebServerRoot
Assigns the web server root directory for the license system.- Parameters:
root
- The root directory.
prepare
Prepares the license system.- Parameters:
lock
- The lock object for synchronization.- Returns:
- Success flag (or failure).
- Throws:
IOException
- For I/O exception preparing the license system.
prepare
Prepares the license system.- Parameters:
lock
- The lock object for synchronization.loader
- The class used for class loading, null for default.- Returns:
- Success flag (or failure).
- Throws:
IOException
- For I/O exception preparing the license system.
getInstanceImplementation
Gets the instance of the license system implementation.- Parameters:
caller
- The caller.implClass
- The implementation interface class.- Throws:
Throwable
- For errors in initialization.
cleanUp
public void cleanUp()Cleans up any temporary files and directories.getProfilePictureAsString
Converts a profile picture file of file extension ".png", ".jpg" or ".jpeg" to a Base64 encoded string with the file name.- Parameters:
file
- The profile picture file (maximum size 1 MB).- Returns:
- The Base64 encoded String that includes the file name part.
- Throws:
FileNotFoundException
- If file is not found.IOException
- For read errors.
getProfilePictureFromString
public static byte[] getProfilePictureFromString(String string, StringBuilder buf) throws IOException Returns a Base64 encoded profile picture as a byte array that can be written to file.- Parameters:
string
- The Base64 encoded string of the profile picture.buf
- Buffer that is filled with the file name upon return, null for none (file name is ignored).- Throws:
IOException
- If the string is badly encoded.