Interface LicenseHandler

All Known Implementing Classes:
DummyLicenseHandler

public interface LicenseHandler
License Handler Interface.
  • Field Details

  • Method Details

    • runsOnDesktop

      void runsOnDesktop(boolean desktop)
      Initialize this handler for running on desktop (desktop = true) or within server or console (desktop = false).
      Parameters:
      desktop - true, if environmnt is a desktop
    • runsInServerOrConsole

      void runsInServerOrConsole(boolean serverOrConsole)
      Initialize this handler for running within server or console (serverOrConsole = true) or on desktop (serverOrConsole = false).
      Parameters:
      serverOrConsole - true, if environemnt is a server or console
    • register

      void register()
      Set register flag when application is registered.
    • isRegistered

      boolean isRegistered()
      Get registration flag for application.
      Returns:
      true when registered successfully
    • unregister

      void unregister()
      Unregister this application.
    • checkRuntimeLicense

      boolean checkRuntimeLicense(LicensedApplication app, Properties baseProps, String baseFile) throws Exception
      Check runtime license, is it a limited or unlimited version.

      Also see 'rt_type' in decrypted 'cfg/base.cfg' (in production encrypted version 'cfg/base.ifc' is used):
      rtType:date:internalSecKey

      Possible values:
      limited|unlimited|numberOfDays:dd.MM.yyyy:internalSecKeyInHex

      Examples:
      'unlimited:01.01.2199:abcdabcdabcdabcdabcdabcdabcdabcd'
      --> Usually a full version

      '30:14.02.1975:abcdabcdabcdabcdabcdabcdabcdabcd'
      --> Usually a trial version; the first value will be replaced with 'limited' and the second with a real date in future calculated on the days specified after calling this method!
      Parameters:
      app - application
      baseProps - the loaded base configuration file properties
      baseFile - the base configuration file ('cfg/base.ifc')
      Returns:
      true, if runtime license is good, otherwise false
      Throws:
      Exception - if runtime cannot be checked
    • checkRegistration

      String checkRegistration(LicensedApplication app)
      Check registration state and set application to registered or unregistered.

      NOTE: This should be called first after creating a handler, this checks the license! But you can call checkRuntimeLicense(LicensedApplication, Properties, String) before.
      Parameters:
      app - licensed application
      Returns:
      lic license state (INV|INIT|CHCK) or null
    • getLicenseKey

      String[] getLicenseKey(LicensedApplication app)
      Get license key and state from key file. Should be a synchronized implementation.
      Parameters:
      app - licensed application
      Returns:
      key & state [key,state(INV|INIT|CHCK)]
    • validateLicenseKey

      boolean validateLicenseKey(LicensedApplication app, String fname, String lname, String city, String company, String country, String email, String licKey)
      Validate a license key given.
      Parameters:
      app - licensed app
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
      licKey - license key
      Returns:
      true, if license key is valid
    • loadLicenseInfo

      Properties loadLicenseInfo(LicensedApplication app)
      Load license info from license.info.
      Parameters:
      app - licensed application
      Returns:
      lic info as props
    • storeLicenseInfo

      void storeLicenseInfo(LicensedApplication app, String fname, String lname, String city, String company, String country, String email)
      Store license info as license.info.
      Parameters:
      app - licensed application
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
    • createRegKey

      String createRegKey(LicensedApplication app, String fname, String lname, String city, String company, String country, String email)
      Create a register key that can be converted to a license key.
      Parameters:
      app - licensed application
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
      Returns:
      registration key
    • makeLicenseKeyFile

      void makeLicenseKeyFile(LicensedApplication app, String fname, String lname, String city, String company, String country, String email, String licState)
      Make a license key with given registration key and state!
      Parameters:
      app - licensed application
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
      licState - license state
    • updateLicenseKeyFile

      void updateLicenseKeyFile(LicensedApplication app, String licKey, String newLicState)
      Update license key with new state. This is necessary if we have a software that can or must be licensed. If the license check somehow fails for that software, we can update the license and invalidate it for example; the software will never be valid again after that!
      Parameters:
      app - licensed application
      licKey - license key
      newLicState - new state (INV|INIT|CHCK)
    • checkOnlineLicense

      boolean checkOnlineLicense(LicensedApplication app)
      Read license key file and unregister if invalid. If state = CHCK all good, if state = INIT we call the online check! If online check is bad, we invalidate. - This call increases the license counter for the online license! - This call manipulates the local license!
      Parameters:
      app - licensed application
      Returns:
      true if an online call has been made, not the result!
    • getOnlineLicState

      String[] getOnlineLicState(LicensedApplication app, String fname, String lname, String city, String company, String country, String email)
      Get online license state. Is it still good? - This call increases the license counter for the online license!
      Parameters:
      app - licensed application
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
      Returns:
      online license state and license type or null if state is not CHCK
    • getOnlineLicState

      String[] getOnlineLicState(LicensedApplication app, Properties userInfo)
      Get online license state. Is it still good? - This call increases the license counter for the online license!
      Parameters:
      app - licensed application
      userInfo - license user info properties
      Returns:
      online license state and license type or null if state is not CHCK
    • getOnlineLicState

      String[] getOnlineLicState(LicensedApplication app)
      Get online license state. Is it still good? - This call increases the license counter for the online license!
      Parameters:
      app - licensed application
      Returns:
      online license state and license type or null if state is not CHCK
    • decreaseOnlineLicense

      boolean decreaseOnlineLicense(LicensedApplication app) throws IOException
      Decrease online license count. E.g. when application is un-installed.
      Parameters:
      app - licensed application
      Returns:
      true if successfull
      Throws:
      IOException - if registration server call fails