Class LicenseManager


  • @PublicAPI
    public class LicenseManager
    extends Object
    LicenseManager is a helper class to manage licenses of Chemaxon products. The licenses are stored in xml files (license.cxl) and are digitally signatured by Chemaxon. The default location of the license file is USER_HOME/chemaxon/license.cxl, but this can arbitrarily be changed. The old license files (licenses.dat) are supported till September 2008.
    Since:
    Marvin 5.0.1
    • Constructor Detail

      • LicenseManager

        public LicenseManager()
    • Method Detail

      • getProductList

        public static ArrayList<String> getProductList​(boolean includePlugins)
        Returns the list of the product identifiers known by the license manager.
        Parameters:
        includePlugins - whether the list should contain the name of the plugins as well
        Returns:
        list containing names as identifiers
      • getPluginList

        public static ArrayList<String> getPluginList()
        Returns the list of the plugin identifiers known by the license manager.
        Returns:
        list containing names as identifiers
      • getLicenseExceptionMessage

        public static String getLicenseExceptionMessage()
        Returns the common message used at license problems.
        Returns:
        error message string
      • getLicenseExceptionPanel

        public static JPanel getLicenseExceptionPanel​(String product)
        Returns the common swing component used to indicate missing license.
        Parameters:
        product - identifier of a product
        Returns:
        JPanel with detailed information about the missing license
      • getLicenseExceptionPanel

        public static JPanel getLicenseExceptionPanel​(chemaxon.license.LicenseException exc)
        Returns the common swing component used to indicate missing license.
        Parameters:
        exc - a LicenseException thrown at license checking
        Returns:
        JPanel with detailed information about the missing license
      • createLicenseManagerPanel

        public static JPanel createLicenseManagerPanel()
        Creates the main panel which is used for end-user license managing.
        Returns:
        JPanel
      • setLicenseFile

        public static void setLicenseFile​(String licensePath)
                                   throws chemaxon.license.LicenseProcessingException
        Sets the license file location to the license manager to read and validate licenses from. This additive setting will not clear already read licenses. The old license file, licenses.dat is not allowed to set for security reasons.
        Parameters:
        licensePath - path of the license file that can be absolute file location or URL
        Throws:
        chemaxon.license.LicenseProcessingException - when a problem occurs reading or validating licenses
      • setLicense

        public static void setLicense​(String s)
                               throws chemaxon.license.LicenseProcessingException
        Sets a pre-read license file to the license manager to read and validate licenses from. This additive setting will not clear already read licenses. Non-server mode licenses and the old license keys are not allowed to set with this method for security reasons.
        Parameters:
        s - license file content as String
        Throws:
        chemaxon.license.LicenseProcessingException - when a problem occurs reading or validating licenses
      • refresh

        public static void refresh()
        Re-reads licenses from the default locations.
      • isLicensed

        public static boolean isLicensed​(String product)
        Returns true if the license manager recognizes the given product to be licensed.
        Parameters:
        product - identifier of a product
        Returns:
        informative state value