Package tigase.licence
Class LicenceChecker
- java.lang.Object
-
- tigase.licence.LicenceChecker
-
public class LicenceChecker extends java.lang.ObjectClass 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.StringINSTALLATION_ID_KEY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringgetCodeForLicenceRetrieval(java.lang.String component)java.lang.StringgetComponentName()static java.lang.StringgetInstallationId()static LicenceCheckergetLicenceChecker(java.lang.String cmpName)Creates aLicenceCheckerwith default update callbackLicenceCheckerUpdateCallbackImplfor the component which name was provided as parameter.static LicenceCheckergetLicenceChecker(java.lang.String cmpName, LicenceCheckerUpdateCallback call)Creates aLicenceCheckerwith custom implementation ofLicenceCheckerUpdateCallbackinterface for the component which name was provided as parameter.static java.util.Set<java.lang.String>getLicencedComponents()java.lang.StringgetLicenceDigest()Returns Licence digeststatic ElementgetLicencingDetails(java.lang.String component)java.util.DategetValidUntil()Returns date until which licence is valid.booleanisLicenceShown()static voidmain(java.lang.String[] args)LicencereloadLicenceFromServer()voidsetLicenceShown()java.lang.StringtoString()
-
-
-
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 aLicenceCheckerwith default update callbackLicenceCheckerUpdateCallbackImplfor the component which name was provided as parameter. Component name will be used to find licence file with the pattern ofetc/${cmpName}.licence- Parameters:
cmpName- name of the component for whichLicenceCheckerwill be instantiated.- Returns:
LicenceCheckerfor the given cmpName
-
getLicenceChecker
public static LicenceChecker getLicenceChecker(java.lang.String cmpName, LicenceCheckerUpdateCallback call)
Creates aLicenceCheckerwith custom implementation ofLicenceCheckerUpdateCallbackinterface for the component which name was provided as parameter. Component name will be used to find licence file with the pattern ofetc/${cmpName}.licence- Parameters:
cmpName- name of the component for whichLicenceCheckerwill be instantiated.call- custom implementation ofLicenceCheckerUpdateCallback- Returns:
LicenceCheckerfor 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.NoSuchAlgorithmExceptionjava.io.IOExceptionjava.security.spec.InvalidKeySpecException
-
getComponentName
public java.lang.String getComponentName()
-
getLicenceDigest
public java.lang.String getLicenceDigest()
Returns Licence digest- Returns:
- a
Daterepresentation of licence expiration date.
-
getValidUntil
public java.util.Date getValidUntil()
Returns date until which licence is valid.- Returns:
- a
Daterepresentation of licence expiration date.
-
setLicenceShown
public void setLicenceShown()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-