|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jp.protection.pub.LicenseAdapter com.jp.protection.pub.pro.LicensingServiceSupport
public class LicensingServiceSupport
Utility class that encapsulates all the code required to connect and work with the Licensing Server. An instance of this class is used by the Licensing Assistant and the License Host providing support for getting licenses and handling of concurrent user models.
Field Summary | |
---|---|
protected boolean |
fAcquireMACAddress
|
protected LicensingServiceResult.CheckoutResult |
fCheckoutLicenseResult
|
protected LicensingServiceResult |
fConfirmLockResult
|
protected LicenseHostPro |
fLicenseHost
|
protected LicensePass |
fLicensePass
|
protected java.lang.String |
fLicensingServerAddress
|
protected LicensingService |
fLicensingService
|
protected LicensingServiceProvider |
fLicensingServiceProvider
|
protected LicensingServiceProviderListener |
fLicensingServiceProviderListener
|
protected LicensingServiceResult |
fLockResult
|
protected LicensingServiceResult |
fObtainLicenseResult
|
protected java.util.prefs.Preferences |
fPreferences
|
protected java.lang.String |
fProviderName
|
protected dev.net.NetworkResourceStatus |
fServerStatus
|
protected java.lang.Thread |
fShutdownHook
|
protected LicensingServiceResult |
fUnlockLicenseResult
|
Fields inherited from class com.jp.protection.pub.LicenseAdapter |
---|
fVerbose |
Constructor Summary | |
---|---|
LicensingServiceSupport(LicenseHostPro aLicenseHost)
Creates a new instance of given License Host |
Method Summary | |
---|---|
protected void |
applyHttpProxy()
|
boolean |
canCheckoutLicense()
Checks whether license can be checked out from the Licensing Server |
LicensingServiceResult |
canLockLicense()
Query the Licensing Server to check whether license lock can be acquired |
boolean |
canTerminateLicensePass()
Tests whether License Pass can be terminated |
boolean |
checkoutLicense()
Check outs license for offline use |
protected boolean |
checkServerStatus()
|
static LicensingServiceResult.CheckoutResult |
createCheckoutResult(java.lang.Exception ex)
Creates result object for a given exception |
LicensingService |
createLicensingService(LicensingServiceProvider aLicensingServiceProvider)
Creates a new instance of Licensing Service using specified provider |
LicensingServiceProvider |
createLicensingServiceProvider(java.lang.String aLicensingServerAddress)
Creates a new instance Licensing Service Provider for the given address |
static LicenseData.Request |
createRequest(ProductInfo aProductInfo)
Creates request for given product information |
static LicensingServiceResult |
createResult(dev.net.NetworkResourceStatus aServerStatus)
Creates result object for a given server status object |
static LicensingServiceResult |
createResult(java.lang.RuntimeException ex)
Creates result object for given exception |
protected void |
error(java.lang.String aMessage)
|
protected void |
error(java.lang.Throwable ex)
|
LicensingServiceResult.CheckoutResult |
getCheckoutLicenseResult()
|
LicensingServiceResult |
getConfirmLockResult()
Returns result of last license lock confirm operation |
LicensePass |
getLicensePass()
|
protected java.io.File |
getLicensePassFile()
|
java.lang.String |
getLicensingServerAddress()
Returns address of the Licensing Server used when no corresponding address is specified for the license |
LicensingService |
getLicensingService()
Returns cached Licensing Service instance |
LicensingService |
getLicensingService(boolean aForceCreate)
Returns cached Licensing Service instance |
protected LicensingServiceProvider |
getLicensingServiceProvider()
|
LicensingServiceResult |
getLockResult()
Returns result of last license lock operation |
byte[] |
getObtainedLicenseBytes()
Returns license bytes obtained during last obtainLicense(...) call |
LicensingServiceResult |
getObtainLicenseResult()
Returns result of last obtain license operation |
java.util.prefs.Preferences |
getPreferences()
|
java.lang.String |
getProviderName()
Returns name of the Licensing Service Provider to use |
dev.net.NetworkResourceStatus |
getServerStatus()
|
java.net.URL |
getServerStatusURL()
|
LicensingServiceResult |
getUnlockLicenseResult()
Return result of last unlock license operation |
static java.lang.String |
getUserMessage(java.lang.Throwable ex)
Compose message can be shown to the end user for the given exception |
boolean |
hasLicensingServiceProvider()
Checks whether Licensing Service Provider is already created |
boolean |
isAcquireMACAddress()
Returns whether MAC address(es) of the network card(s) must be acquired during composing requests for the Licensing Server |
protected boolean |
isHttpProxyChanged()
|
boolean |
isLicensingServerAddressKnown()
Returns if Licensing Server address is specified for the license |
boolean |
isLockExpired()
Returns whether license lock is already expired. |
boolean |
isLockOK()
Returns whether license lock is OK: license is locked and lock is neither expired nor revoked. |
boolean |
isLockRevoked()
Returns whether license lock revocation has been requested by the administrator. |
void |
licenseAboutToRead(LicenseReader aSource,
java.lang.String aProductID)
Releases all the resources when new license is about to read. |
boolean |
lockLicense(boolean isForceLock)
Acquires license lock using the Licensing Server. |
boolean |
obtainLicense(LicensingService aLicensingService,
ProductInfo aProductInfo)
Obtains a license identified by the product information from the Licensing Server. |
boolean |
obtainLicense(LicensingService aLicensingService,
ProductInfo aProductInfo,
java.util.Map anAttributes)
Obtains a license identified by the product information from the Licensing Server. |
boolean |
obtainLicense(java.lang.String aServerAddress,
ProductInfo aProductInfo)
Obtains a license identified by the product information from the Licensing Server. |
void |
release()
Releases all the acquired resources including Licensing Service provider, Licensing Service services and license locks |
void |
release(boolean isShutdown)
Releases all the acquired resources including Licensing Service provider, Licensing Service services and license locks |
void |
setAcquireMACAddress(boolean aAcquireMACAddress)
Specifies that MAC address(es) of the network card(s) must be acquired during composing requests for the Licensing Server |
void |
setLicensingServerAddress(java.lang.String aLicensingServerAddress)
Specifies address of the Licensing Server should be used when no corresponding address is specified for the license. |
void |
setLockResult(LicensingServiceResult aLockResult)
Specifies result of last license lock operation |
void |
setPreferences(java.util.prefs.Preferences aPreferences)
|
void |
setProviderName(java.lang.String aProviderName)
Specifies the name of the Licensing Service Provider to use |
void |
setServerStatusURL(java.net.URL anURL)
|
boolean |
terminateLicensePass()
Terminate ability to use a License offline by removing corresponding License Pass |
boolean |
unlockLicense()
Releases license lock |
Methods inherited from class com.jp.protection.pub.LicenseAdapter |
---|
featureChecked, isVerbose, licenseAboutToExpire, licenseAccepted, licenseAvailable, licenseCorrupted, licenseExpired, licenseInvalid, licenseLockExpired, licenseLockRevoked, licenseLockViolation, licenseMissing, licenseNeedActivation, licenseNeedLock, licenseNotActivated, licenseNotLocked, licenseOk, licenseRemoved, licenseUpdated, licenseUseLimitAboutReach, message, numberCopiesViolation, setVerbose |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LicenseHostPro fLicenseHost
protected java.lang.String fProviderName
protected LicensingServiceProvider fLicensingServiceProvider
protected LicensingService fLicensingService
protected java.lang.Thread fShutdownHook
protected java.lang.String fLicensingServerAddress
protected LicensingServiceProviderListener fLicensingServiceProviderListener
protected LicensingServiceResult fObtainLicenseResult
protected LicensingServiceResult fLockResult
protected LicensingServiceResult fConfirmLockResult
protected LicensingServiceResult fUnlockLicenseResult
protected LicensingServiceResult.CheckoutResult fCheckoutLicenseResult
protected LicensePass fLicensePass
protected boolean fAcquireMACAddress
protected java.util.prefs.Preferences fPreferences
protected dev.net.NetworkResourceStatus fServerStatus
Constructor Detail |
---|
public LicensingServiceSupport(LicenseHostPro aLicenseHost)
aLicenseHost
- License HostMethod Detail |
---|
public void licenseAboutToRead(LicenseReader aSource, java.lang.String aProductID)
licenseAboutToRead
in interface LicenseReaderListener
licenseAboutToRead
in class LicenseAdapter
aSource
- the license reader.aProductID
- ID of the product this license is issued for.public java.lang.String getProviderName()
public void setProviderName(java.lang.String aProviderName)
aProviderName
- name of the Licensing Service Providerpublic java.lang.String getLicensingServerAddress()
public void setLicensingServerAddress(java.lang.String aLicensingServerAddress)
aLicensingServerAddress
- address of the Licensing Serverpublic boolean isLicensingServerAddressKnown()
true
if Licensing Server address is specified for the license; false
otherwisepublic boolean hasLicensingServiceProvider()
true
if Licensing Service Provider is already created; false
otherwisepublic LicensingServiceProvider createLicensingServiceProvider(java.lang.String aLicensingServerAddress)
aLicensingServerAddress
- address of the Licensing Server
public LicensingService createLicensingService(LicensingServiceProvider aLicensingServiceProvider)
aLicensingServiceProvider
- Licensing Service Provider used to create Licensing Service
protected LicensingServiceProvider getLicensingServiceProvider()
public LicensingServiceResult getLockResult()
public LicensingServiceResult getConfirmLockResult()
public LicensingServiceResult getObtainLicenseResult()
public void setLockResult(LicensingServiceResult aLockResult)
aLockResult
- result of last license lock operationpublic static LicenseData.Request createRequest(ProductInfo aProductInfo)
aProductInfo
- product information
public boolean lockLicense(boolean isForceLock)
isForceLock
- specifies whether license lock should be re-acquired.
true
if license lock is acquired; false
otherwise. Full result of the
operation can be obtained by the getLockResult()
call.public boolean obtainLicense(java.lang.String aServerAddress, ProductInfo aProductInfo)
aServerAddress
- Licensing Server address to obtain a license fromaProductInfo
- product information identifies a license to obtain
true
if license is obtained; false
otherwise.
Full result of the operation can be obtained by a getObtainLicenseResult()
call and
license bytes for the license can be got by a getObtainedLicenseBytes()
call.public boolean obtainLicense(LicensingService aLicensingService, ProductInfo aProductInfo)
aLicensingService
- instance of the Licensing Service to useaProductInfo
- product information identifies a license to obtain
true
if license is obtained; false
otherwise.
Full result of the operation can be obtained by a getObtainLicenseResult()
call and
license bytes for the license can be got by a getObtainedLicenseBytes()
call.public boolean obtainLicense(LicensingService aLicensingService, ProductInfo aProductInfo, java.util.Map anAttributes)
aLicensingService
- instance of the Licensing Service to useaProductInfo
- product information identifies a license to obtainanAttributes
- attributes to pass to Licensing Server
true
if license is obtained; false
otherwise.
Full result of the operation can be obtained by a getObtainLicenseResult()
call and
license bytes for the license can be got by a getObtainedLicenseBytes()
call.public byte[] getObtainedLicenseBytes()
obtainLicense(...)
call
public static LicensingServiceResult createResult(java.lang.RuntimeException ex)
ex
- exception to get result object for
public LicensingServiceResult canLockLicense()
public boolean isLockOK()
true
if license lock is OK; false
otherwise.public boolean isLockRevoked()
true
if license lock revocation has been requested; false
otherwise.public boolean isLockExpired()
true
if license lock is already expired; false
otherwise.public boolean unlockLicense()
true
if license lock released; false
otherwise. Full result of the
operation can be obtained by the getUnlockLicenseResult()
call.public LicensingServiceResult getUnlockLicenseResult()
public LicensingServiceResult.CheckoutResult getCheckoutLicenseResult()
protected java.io.File getLicensePassFile()
public LicensePass getLicensePass()
public boolean checkoutLicense()
true
if license was successfully checked out; false
otherwisepublic static LicensingServiceResult.CheckoutResult createCheckoutResult(java.lang.Exception ex)
ex
- exception to get result object for
public boolean canCheckoutLicense()
true
if the license can be checked out from the Licensing Server; false
otherwisepublic boolean terminateLicensePass()
true
if License Pass has been terminated; false
otherwisepublic boolean canTerminateLicensePass()
true
if License can be terminated; false
otherwisepublic boolean isAcquireMACAddress()
true
if MAC address(es) must be acquired; false
otherwisepublic void setAcquireMACAddress(boolean aAcquireMACAddress)
aAcquireMACAddress
- true
if MAC address(es) must be acquired; false
otherwisepublic LicensingService getLicensingService()
public LicensingService getLicensingService(boolean aForceCreate)
aForceCreate
- specifies that cached instance (if any) must be recreated
public static java.lang.String getUserMessage(java.lang.Throwable ex)
ex
- exceptions to compose message for
protected void error(java.lang.String aMessage)
error
in class LicenseAdapter
protected void error(java.lang.Throwable ex)
public void release(boolean isShutdown)
isShutdown
- identifies whether release is called during the application shutdown (exit).public void release()
public java.util.prefs.Preferences getPreferences()
public void setPreferences(java.util.prefs.Preferences aPreferences)
protected boolean isHttpProxyChanged()
protected void applyHttpProxy()
public java.net.URL getServerStatusURL()
public void setServerStatusURL(java.net.URL anURL)
public dev.net.NetworkResourceStatus getServerStatus()
protected boolean checkServerStatus()
public static LicensingServiceResult createResult(dev.net.NetworkResourceStatus aServerStatus)
aServerStatus
- server status to get result object for
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |