Class DummyLicenseHandler

java.lang.Object
ch.autumo.commons.utils.license.DummyLicenseHandler
All Implemented Interfaces:
LicenseHandler

public class DummyLicenseHandler extends Object implements LicenseHandler
Dummy license handler implementation.
  • Constructor Details

    • DummyLicenseHandler

      public DummyLicenseHandler()
      Default constructor.
  • Method Details

    • runsOnDesktop

      public void runsOnDesktop(boolean desktop)
      Description copied from interface: LicenseHandler
      Initialize this handler for running on desktop (desktop = true) or within server or console (desktop = false).
      Specified by:
      runsOnDesktop in interface LicenseHandler
      Parameters:
      desktop - true, if environmnt is a desktop
    • runsInServerOrConsole

      public void runsInServerOrConsole(boolean serverOrConsole)
      Description copied from interface: LicenseHandler
      Initialize this handler for running within server or console (serverOrConsole = true) or on desktop (serverOrConsole = false).
      Specified by:
      runsInServerOrConsole in interface LicenseHandler
      Parameters:
      serverOrConsole - true, if environemnt is a server or console
    • register

      public void register()
      Description copied from interface: LicenseHandler
      Set register flag when application is registered.
      Specified by:
      register in interface LicenseHandler
    • isRegistered

      public boolean isRegistered()
      Description copied from interface: LicenseHandler
      Get registration flag for application.
      Specified by:
      isRegistered in interface LicenseHandler
      Returns:
      true when registered successfully
    • unregister

      public void unregister()
      Description copied from interface: LicenseHandler
      Unregister this application.
      Specified by:
      unregister in interface LicenseHandler
    • checkRuntimeLicense

      public boolean checkRuntimeLicense(LicensedApplication app, Properties baseProps, String baseFile) throws Exception
      Description copied from interface: LicenseHandler
      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!
      Specified by:
      checkRuntimeLicense in interface LicenseHandler
      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

      public String checkRegistration(LicensedApplication app)
      Description copied from interface: LicenseHandler
      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 LicenseHandler.checkRuntimeLicense(LicensedApplication, Properties, String) before.
      Specified by:
      checkRegistration in interface LicenseHandler
      Parameters:
      app - licensed application
      Returns:
      lic license state (INV|INIT|CHCK) or null
    • getLicenseKey

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

      public boolean validateLicenseKey(LicensedApplication app, String fname, String lname, String city, String company, String country, String email, String licKey)
      Description copied from interface: LicenseHandler
      Validate a license key given.
      Specified by:
      validateLicenseKey in interface LicenseHandler
      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

      public Properties loadLicenseInfo(LicensedApplication app)
      Description copied from interface: LicenseHandler
      Load license info from license.info.
      Specified by:
      loadLicenseInfo in interface LicenseHandler
      Parameters:
      app - licensed application
      Returns:
      lic info as props
    • storeLicenseInfo

      public void storeLicenseInfo(LicensedApplication app, String fname, String lname, String city, String company, String country, String email)
      Description copied from interface: LicenseHandler
      Store license info as license.info.
      Specified by:
      storeLicenseInfo in interface LicenseHandler
      Parameters:
      app - licensed application
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
    • createRegKey

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

      public void makeLicenseKeyFile(LicensedApplication app, String fname, String lname, String city, String company, String country, String email, String licState)
      Description copied from interface: LicenseHandler
      Make a license key with given registration key and state!
      Specified by:
      makeLicenseKeyFile in interface LicenseHandler
      Parameters:
      app - licensed application
      fname - first name
      lname - last name
      city - city
      company - company
      country - country
      email - email
      licState - license state
    • updateLicenseKeyFile

      public void updateLicenseKeyFile(LicensedApplication app, String licKey, String newLicState)
      Description copied from interface: LicenseHandler
      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!
      Specified by:
      updateLicenseKeyFile in interface LicenseHandler
      Parameters:
      app - licensed application
      licKey - license key
      newLicState - new state (INV|INIT|CHCK)
    • checkOnlineLicense

      public boolean checkOnlineLicense(LicensedApplication app)
      Description copied from interface: LicenseHandler
      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!
      Specified by:
      checkOnlineLicense in interface LicenseHandler
      Parameters:
      app - licensed application
      Returns:
      true if an online call has been made, not the result!
    • getOnlineLicState

      public String[] getOnlineLicState(LicensedApplication app, String fname, String lname, String city, String company, String country, String email)
      Description copied from interface: LicenseHandler
      Get online license state. Is it still good? - This call increases the license counter for the online license!
      Specified by:
      getOnlineLicState in interface LicenseHandler
      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

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

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

      public boolean decreaseOnlineLicense(LicensedApplication app) throws IOException
      Description copied from interface: LicenseHandler
      Decrease online license count. E.g. when application is un-installed.
      Specified by:
      decreaseOnlineLicense in interface LicenseHandler
      Parameters:
      app - licensed application
      Returns:
      true if successfull
      Throws:
      IOException - if registration server call fails