Package tigase.licence

## Class LicenceChecker

- java.lang.Object
- - tigase.licence.LicenceChecker

-     public class LicenceChecker
      extends java.lang.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 java.lang.String` | `INSTALLATION_ID_KEY` |

  - ### Method Summary

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

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

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

- - ### Field Detail

    - #### INSTALLATION_ID_KEY

          public static final java.lang.String INSTALLATION_ID_KEY

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getCodeForLicenceRetrieval

          public static java.lang.String getCodeForLicenceRetrieval​(java.lang.String component)
                                                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### getInstallationId

          public static java.lang.String getInstallationId()

    - #### getLicenceChecker

          public static LicenceChecker getLicenceChecker​(java.lang.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​(java.lang.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 java.util.Set<java.lang.String> getLicencedComponents()

    - #### getLicencingDetails

          public static Element getLicencingDetails​(java.lang.String component)

    - #### main

          public static void main​(java.lang.String[] args)

    - #### isLicenceShown

          public boolean isLicenceShown()

    - #### reloadLicenceFromServer

          public Licence reloadLicenceFromServer()
                                          throws java.security.NoSuchAlgorithmException,
                                                 java.io.IOException,
                                                 java.security.spec.InvalidKeySpecException

      Throws:
        `java.security.NoSuchAlgorithmException`
        `java.io.IOException`
        `java.security.spec.InvalidKeySpecException`

    - #### getComponentName

          public java.lang.String getComponentName()

    - #### getLicenceDigest

          public java.lang.String getLicenceDigest()

      Returns Licence digest
      Returns:
        a `Date` representation of licence expiration date.

    - #### getValidUntil

          public java.util.Date getValidUntil()

      Returns date until which licence is valid.
      Returns:
        a `Date` representation of licence expiration date.

    - #### setLicenceShown

          public void setLicenceShown()

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`