Package tigase.licence

# Class LicenceChecker

java.lang.Object
tigase.licence.LicenceChecker

public class LicenceChecker extends Object
Class used to perform periodic licence check and/or upload of statistics data.

Author:
  Wojciech Kapcia

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `INSTALLATION_ID_KEY`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static String`
  `getCodeForLicenceRetrieval(String component)`
  `String`
  `getComponentName()`
  `static String`
  `getInstallationId()`
  `static LicenceChecker`
  `getLicenceChecker(String cmpName)`
  Creates a `LicenceChecker` with default update callback `LicenceCheckerUpdateCallbackImpl` for the component which name was provided as parameter.
  `static LicenceChecker`
  `getLicenceChecker(String cmpName, LicenceCheckerUpdateCallback call)`
  Creates a `LicenceChecker` with custom implementation of `LicenceCheckerUpdateCallback` interface for the component which name was provided as parameter.
  `static Set<String>`
  `getLicencedComponents()`
  `String`
  `getLicenceDigest()`
  Returns Licence digest
  `static Element`
  `getLicencingDetails(String component)`
  `Date`
  `getValidUntil()`
  Returns date until which licence is valid.
  `boolean`
  `isLicenceShown()`
  `static void`
  `main(String[] args)`
  `Licence`
  `reloadLicenceFromServer()`
  `void`
  `setLicenceShown()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### INSTALLATION_ID_KEY

    public static final String INSTALLATION_ID_KEY
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getCodeForLicenceRetrieval

    public static String getCodeForLicenceRetrieval(String component) throws Exception
    Throws:
      `Exception`

  - ### getInstallationId

    public static String getInstallationId()

  - ### getLicenceChecker

    public static LicenceChecker getLicenceChecker(String cmpName)
    Creates a `LicenceChecker` with default update callback `LicenceCheckerUpdateCallbackImpl` for the component which name was provided as parameter. Component name will be used to find licence file with the pattern of `etc/${cmpName}.licence`

    Parameters:
      `cmpName` - name of the component for which `LicenceChecker` will be instantiated.
    Returns:
      `LicenceChecker` for the given cmpName

  - ### getLicenceChecker

    public static LicenceChecker getLicenceChecker(String cmpName, LicenceCheckerUpdateCallback call)
    Creates a `LicenceChecker` with custom implementation of `LicenceCheckerUpdateCallback` interface for the component which name was provided as parameter. Component name will be used to find licence file with the pattern of `etc/${cmpName}.licence`

    Parameters:
      `cmpName` - name of the component for which `LicenceChecker` will be instantiated.
      `call` - custom implementation of `LicenceCheckerUpdateCallback`
    Returns:
      `LicenceChecker` for the given cmpName

  - ### getLicencedComponents

    public static Set<String> getLicencedComponents()

  - ### getLicencingDetails

    public static Element getLicencingDetails(String component)

  - ### main

    public static void main(String[] args)

  - ### isLicenceShown

    public boolean isLicenceShown()

  - ### reloadLicenceFromServer

    public Licence reloadLicenceFromServer() throws NoSuchAlgorithmException, IOException, InvalidKeySpecException
    Throws:
      `NoSuchAlgorithmException`
      `IOException`
      `InvalidKeySpecException`

  - ### getComponentName

    public String getComponentName()

  - ### getLicenceDigest

    public String getLicenceDigest()
    Returns Licence digest
    Returns:
      a `Date` representation of licence expiration date.

  - ### getValidUntil

    public Date getValidUntil()
    Returns date until which licence is valid.
    Returns:
      a `Date` representation of licence expiration date.

  - ### setLicenceShown

    public void setLicenceShown()

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`