com.jp.protection.pub.pro
Class BackgroundLicenseCheck

java.lang.Object
  extended by com.jp.protection.pub.pro.BackgroundLicenseCheck

public class BackgroundLicenseCheck
extends java.lang.Object

Utility class to schedule background license check based on the specified license's check period. BackgroundLicenseCheck will perform optional license re-reading if the license file has been updated on the disk.
The usage would be: BackgroundLicenseCheck backgroundLicenseCheck = new BackgroundLicenseCheck(licenseHost, productInfo); backgroundLicenseCheck.start();

Since:
3.0

Field Summary
protected  boolean fCheckLicense
           
protected  java.lang.Thread fCheckLicenseThread
           
protected  long fCheckPeriod
           
protected  boolean fLicenseFileCanRead
           
protected  long fLicenseFileModificationTime
           
protected  LicenseHostPro fLicenseHost
           
protected  ProductInfo fProductInfo
           
 
Constructor Summary
BackgroundLicenseCheck(LicenseHostPro aLicenseHost, ProductInfo aProductInfo)
          Creates a new instance of the BackgroundLicenseCheck
BackgroundLicenseCheck(ProtectionLauncher aProtectionLauncher)
          Creates a new instance of the BackgroundLicenseCheck
 
Method Summary
 boolean checkLicense()
          Checks license and forces LicenseReader to re-read license if the license file has been updated on the disk.
 boolean checkLicense(boolean aForceLicenseRead)
          Checks license
protected  void checkLicenseImpl(boolean aForceLicenseRead)
           
protected  java.lang.Thread getCheckLicenseThread()
           
 long getCheckPeriod()
          Returns license check period
 boolean isRunning()
          Returns whether the license check backround procees is running
 void setCheckPeriod(long aCheckPeriod)
          Specifies license check period
 void start()
          Starts license check in the background
 void stop()
          Stops the license check background process
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLicenseHost

protected LicenseHostPro fLicenseHost

fProductInfo

protected ProductInfo fProductInfo

fCheckLicense

protected boolean fCheckLicense

fCheckLicenseThread

protected java.lang.Thread fCheckLicenseThread

fLicenseFileModificationTime

protected long fLicenseFileModificationTime

fLicenseFileCanRead

protected boolean fLicenseFileCanRead

fCheckPeriod

protected long fCheckPeriod
Constructor Detail

BackgroundLicenseCheck

public BackgroundLicenseCheck(LicenseHostPro aLicenseHost,
                              ProductInfo aProductInfo)
Creates a new instance of the BackgroundLicenseCheck

Parameters:
aLicenseHost - license host to work with
aProductInfo - product information

BackgroundLicenseCheck

public BackgroundLicenseCheck(ProtectionLauncher aProtectionLauncher)
Creates a new instance of the BackgroundLicenseCheck

Parameters:
aProtectionLauncher - Protection! launcher to work with
Method Detail

isRunning

public boolean isRunning()
Returns whether the license check backround procees is running

Returns:
true if license check is running; false otherwise

start

public void start()
Starts license check in the background


stop

public void stop()
Stops the license check background process


getCheckPeriod

public long getCheckPeriod()
Returns license check period

Returns:
license check period in milliseconds (60000L by default)

setCheckPeriod

public void setCheckPeriod(long aCheckPeriod)
Specifies license check period

Parameters:
aCheckPeriod - license check period to set in millis

getCheckLicenseThread

protected java.lang.Thread getCheckLicenseThread()

checkLicense

public boolean checkLicense()
Checks license and forces LicenseReader to re-read license if the license file has been updated on the disk.

Returns:
true if license is OK; false otherwise

checkLicense

public boolean checkLicense(boolean aForceLicenseRead)
Checks license

Parameters:
aForceLicenseRead - forces the LicenseReader to re-read license
Returns:
true if license is OK; false otherwise

checkLicenseImpl

protected void checkLicenseImpl(boolean aForceLicenseRead)