Class LicenseSystem

java.lang.Object
com.iizix.license.LicenseSystem

public class LicenseSystem extends Object
Instance used to load the license system.
Author:
Christopher Mindus
  • Field Details

    • PRODUCTS

      public static final String[] 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

      public static String formatProduct(int product)
      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

      public static LicenseSystem getInstance()
      Gets the instance of license system.
      Returns:
      The instance of the LicenseSystem.
    • getInstance

      public static LicenseSystem getInstance(Object caller)
      Gets the instance of license system.
      Parameters:
      caller - The special caller Object for testing, null for none.
      Returns:
      The instance of the LicenseSystem.
    • assignWebServerRoot

      public static void assignWebServerRoot(File root)
      Assigns the web server root directory for the license system.
      Parameters:
      root - The root directory.
    • prepare

      public boolean prepare(Object lock) throws IOException
      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

      public boolean prepare(Object lock, Class<?> loader) throws IOException
      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

      public <T> T getInstanceImplementation(Object caller, Class<T> implClass) throws Throwable
      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

      public static String getProfilePictureAsString(File file) throws IOException
      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.