com.jp.protection.pub.launch
Class HeadlessProtectionLauncher

java.lang.Object
  extended by com.jp.protection.pub.launch.HeadlessProtectionLauncher
Direct Known Subclasses:
ProtectionLauncher

public class HeadlessProtectionLauncher
extends java.lang.Object

This class represents the entry point to the licensing functionality. It holds all the Protection! configuration data and provides various access and utility methods. The sample use case would be as follows:


 ProtectionLauncherConfigReader reader = new ProtectionLauncherConfigReader();
 reader.setDecryptKeyBytes(...);
 reader.setSecurityAlgorithm("RSA - 512");
 ProtectionLauncher launcher = ProtectionLauncher.getProtectionLauncher(reader, ProtectionLauncher.class,
   "DemoCalc.launcher", owner);
 launcher.checkLicense();
 

Note, launcher can be generated via Products Screen | Build | Build Launcher.

Since:
3.5

Field Summary
protected  ProtectionLauncherConfig fLauncherConfig
           
protected  LicenseHost fLicenseHost
           
protected  LicenseListener fLicenseListener
           
protected  LicenseReader fLicenseReader
           
protected  boolean fVerbose
           
 
Constructor Summary
HeadlessProtectionLauncher(ProtectionLauncherConfig aLauncherConfig)
          Creates a new instance of the launcher.
HeadlessProtectionLauncher(ProtectionLauncherConfig aLauncherConfig, LicenseReader aLicenseReader)
          Creates a new instance of the launcher.
 
Method Summary
 boolean canCheckoutLicense()
          Tests whether a License can be checked out for offline use
 boolean canTerminateLicensePass()
          Tests whether License Pass can be terminated
 boolean checkLicense()
          Reads the license and check it against specified configuration
 boolean checkLicense(boolean aForceLicenseRead)
          Reads the license and check it against specified configuration
 boolean checkoutLicense()
          Checks out a License for offline use without need to lock the License using Licensing Server
protected  LicenseAcceptanceDelegate createLicenseAcceptanceDelegate()
           
protected  LicenseHost createLicenseHost()
           
protected  LicenseHostIssueResolver createLicenseHostIssueResolver()
           
protected  LicenseReader createLicenseReader()
           
protected  LicenseReaderIssueResolver createLicenseReaderIssueResolver()
           
protected  void error(java.lang.Exception ex)
           
static HeadlessProtectionLauncher getHeadlessProtectionLauncher(ProtectionLauncherConfigReader aReader, java.lang.Class aBaseCLass, java.lang.String aLauncherConfigResourceName)
          Creates a new launcher instance and initializes it with configuration loaded from resource.
static HeadlessProtectionLauncher getHeadlessProtectionLauncher(ProtectionLauncherConfigReader aReader, java.lang.Class aBaseCLass, java.lang.String aLauncherConfigResourceName, LicenseReader aLicenseReader)
          Creates a new launcher instance and initializes it with configuration loaded from resource.
 ProtectionLauncherConfig getLauncherConfig()
          Returns launcher configuration
 LicenseHost getLicenseHost()
          Returns license host used by the launcher to check licenses
 LicenseReader getLicenseReader()
          Returns license reader used by the launcher to locate and read licenses
protected  java.util.prefs.Preferences getPreferences()
           
protected  java.lang.String getProductEditionName(License license)
           
 ProductInfo getProductInfo()
          Returns product information
 void init()
          Initializes launcher instance
protected  void initLicenseHost()
           
protected  void initLicenseListener()
           
protected  void initLicenseReader()
           
protected  void initLicensingFacades()
           
protected  void initLicensingServerConnections()
           
protected  void initProfessional(ProtectionLauncherConfig config)
           
protected  void initSecretStorages()
           
 boolean isVerbose()
          Checks whether launcher runs in verbose mode.
 void replaceDefaultLicenseListener(LicenseListener aLicenseListener)
          Replaces default license listener with supplied one
 void setVerbose(boolean aVerbose)
          Specifies that launcher should be run in verbose mode.
 boolean terminateLicensePass()
          Terminate ability to use a License offline by removing corresponding License Pass
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLauncherConfig

protected ProtectionLauncherConfig fLauncherConfig

fLicenseReader

protected LicenseReader fLicenseReader

fLicenseHost

protected LicenseHost fLicenseHost

fLicenseListener

protected LicenseListener fLicenseListener

fVerbose

protected boolean fVerbose
Constructor Detail

HeadlessProtectionLauncher

public HeadlessProtectionLauncher(ProtectionLauncherConfig aLauncherConfig)
Creates a new instance of the launcher.

Parameters:
aLauncherConfig - launcher configuration

HeadlessProtectionLauncher

public HeadlessProtectionLauncher(ProtectionLauncherConfig aLauncherConfig,
                                  LicenseReader aLicenseReader)
Creates a new instance of the launcher.

Parameters:
aLauncherConfig - launcher configuration
aLicenseReader - LicenseReader custom license reader should be used by the launcher to locate and read licenses
Method Detail

getProductInfo

public ProductInfo getProductInfo()
Returns product information

Returns:
product information

getLauncherConfig

public ProtectionLauncherConfig getLauncherConfig()
Returns launcher configuration

Returns:
launcher configuration

getProductEditionName

protected java.lang.String getProductEditionName(License license)

getLicenseHost

public LicenseHost getLicenseHost()
Returns license host used by the launcher to check licenses

Returns:
license host

getLicenseReader

public LicenseReader getLicenseReader()
Returns license reader used by the launcher to locate and read licenses

Returns:
license reader

initLicenseReader

protected void initLicenseReader()

createLicenseReaderIssueResolver

protected LicenseReaderIssueResolver createLicenseReaderIssueResolver()

createLicenseReader

protected LicenseReader createLicenseReader()

initLicenseListener

protected void initLicenseListener()

initLicenseHost

protected void initLicenseHost()

error

protected void error(java.lang.Exception ex)

createLicenseHostIssueResolver

protected LicenseHostIssueResolver createLicenseHostIssueResolver()

createLicenseAcceptanceDelegate

protected LicenseAcceptanceDelegate createLicenseAcceptanceDelegate()

createLicenseHost

protected LicenseHost createLicenseHost()

init

public void init()
Initializes launcher instance


initProfessional

protected void initProfessional(ProtectionLauncherConfig config)

initSecretStorages

protected void initSecretStorages()

initLicensingFacades

protected void initLicensingFacades()

initLicensingServerConnections

protected void initLicensingServerConnections()

checkLicense

public boolean checkLicense(boolean aForceLicenseRead)
Reads the license and check it against specified configuration

Parameters:
aForceLicenseRead - forces LicenseReader to re-read license
Returns:
true if license is properly read and validated; false otherwise

checkLicense

public boolean checkLicense()
Reads the license and check it against specified configuration

Returns:
true if license is properly read and validated; false otherwise

isVerbose

public boolean isVerbose()
Checks whether launcher runs in verbose mode.

Returns:
true if launcher runs in verbose mode, false otherwise.

setVerbose

public void setVerbose(boolean aVerbose)
Specifies that launcher should be run in verbose mode. If launcher run in verbose mode all exceptions stack traces and error messages, if any, will be printed to stderr. Otherwise there is no output in order to prevent the code flow analysis.

Parameters:
aVerbose - true if launcher should run in verbose mode, false otherwise.

getHeadlessProtectionLauncher

public static HeadlessProtectionLauncher getHeadlessProtectionLauncher(ProtectionLauncherConfigReader aReader,
                                                                       java.lang.Class aBaseCLass,
                                                                       java.lang.String aLauncherConfigResourceName,
                                                                       LicenseReader aLicenseReader)
                                                                throws java.io.IOException
Creates a new launcher instance and initializes it with configuration loaded from resource.

Parameters:
aReader - reader used to read launcher configuration
aBaseCLass - base class used to to load configuration resource
aLauncherConfigResourceName - name of resource
aLicenseReader - LicenseReader custom license reader should be used by the launcher to locate and read licenses
Returns:
launcher instance
Throws:
java.io.IOException - when any error occured during configuration load

getHeadlessProtectionLauncher

public static HeadlessProtectionLauncher getHeadlessProtectionLauncher(ProtectionLauncherConfigReader aReader,
                                                                       java.lang.Class aBaseCLass,
                                                                       java.lang.String aLauncherConfigResourceName)
                                                                throws java.io.IOException
Creates a new launcher instance and initializes it with configuration loaded from resource.

Parameters:
aReader - reader used to read launcher configuration
aBaseCLass - base class used to to load configuration resource
aLauncherConfigResourceName - name of resource
Returns:
launcher instance
Throws:
java.io.IOException - when any error occured during configuration load

replaceDefaultLicenseListener

public void replaceDefaultLicenseListener(LicenseListener aLicenseListener)
Replaces default license listener with supplied one

Parameters:
aLicenseListener - a new license listener to setup

getPreferences

protected java.util.prefs.Preferences getPreferences()

checkoutLicense

public boolean checkoutLicense()
Checks out a License for offline use without need to lock the License using Licensing Server

Returns:
true if license has been successfully checked out; false otherwise
Since:
v5.0

canCheckoutLicense

public boolean canCheckoutLicense()
Tests whether a License can be checked out for offline use

Returns:
true if license can be checked out; false otherwise
Since:
v5.0

terminateLicensePass

public boolean terminateLicensePass()
Terminate ability to use a License offline by removing corresponding License Pass

Returns:
true if License Pass has been terminated; false otherwise
Since:
v5.0

canTerminateLicensePass

public boolean canTerminateLicensePass()
Tests whether License Pass can be terminated

Returns:
true if License can be terminated; false otherwise
Since:
v5.0