com.jp.protection.pub.pro.lserver
Class LicensingServiceProviderFactory

java.lang.Object
  extended by com.jp.protection.pub.pro.lserver.LicensingServiceProviderFactory

public class LicensingServiceProviderFactory
extends java.lang.Object

The factory for registering and creation of the providers

Since:
3.0

Field Summary
static java.lang.String ATTR_LS_ADDRESS
           
static java.lang.String ATTR_LS_LOGIN
           
static java.lang.String ATTR_LS_PASSWORD
           
protected  java.lang.String fDefaultProviderName
           
protected static LicensingServiceProviderFactory fInstance
           
protected static int fLicenseLockConfirmPeriod
           
protected static java.util.Map fProtocolProviderMap
           
protected  java.util.HashMap fProviderAttrsMap
           
protected  java.util.HashMap fProviderMap
           
 
Constructor Summary
LicensingServiceProviderFactory()
           
 
Method Summary
 LicensingServiceProvider createProvider(java.lang.String anAddress, java.util.Map aProviderAttrs)
          Creates a new instance of the LicensingServiceProvider
 LicensingServiceProvider createProvider(java.lang.String aName, java.lang.String anAddress, java.util.Map aProviderAttrs)
          Creates a new instance of the LicensingServiceProvider
static LicensingServiceProviderFactory getInstance()
          Returns shared instance of the factory
static int getLicenseLockConfirmPeriod()
          Returns the default value for the license lock confirmation period in milliseconds.
 java.lang.String getProviderAddress(java.lang.String aName)
          Returns default Licensing Server address for given provider name
 java.lang.String[] getProviderAddresses()
          Returns Licensing Server addresses for all registered providers
 java.lang.String getProviderProtocol()
          Returns protocol for a default provider
 java.lang.String getProviderProtocol(java.lang.String aName)
          Returns protocol for a specified provider
 boolean hasProviders()
          Returns if there are any registered providers
protected  void noSuchProviderError(java.lang.String aName)
           
 void registerProvider(java.lang.String aName, java.lang.Class aProviderClass, java.util.Map aProviderAttrs, boolean isDefault)
          Registers a Licensing Service provider implementation
 void registerProvider(java.lang.String aName, java.lang.Class aProviderClass, java.lang.String anAddress, java.lang.String aLogin, java.lang.String aPassword, boolean isDefault)
          Registers Licensing Service provider implementation
 void release()
          Releases the factory and all of its acquired resources
static void setLicenseLockConfirmPeriod(int aLicenseLockConfirmPeriod)
          Specifies default value for the license lock confirmation period in milliseconds.
 void unRegisterProvider(java.lang.String aName)
          Unregisters a Licensing Service provider implementation for the given name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fLicenseLockConfirmPeriod

protected static int fLicenseLockConfirmPeriod

fInstance

protected static LicensingServiceProviderFactory fInstance

fProviderMap

protected java.util.HashMap fProviderMap

fProviderAttrsMap

protected java.util.HashMap fProviderAttrsMap

fDefaultProviderName

protected java.lang.String fDefaultProviderName

ATTR_LS_ADDRESS

public static final java.lang.String ATTR_LS_ADDRESS
See Also:
Constant Field Values

ATTR_LS_LOGIN

public static final java.lang.String ATTR_LS_LOGIN
See Also:
Constant Field Values

ATTR_LS_PASSWORD

public static final java.lang.String ATTR_LS_PASSWORD
See Also:
Constant Field Values

fProtocolProviderMap

protected static java.util.Map fProtocolProviderMap
Constructor Detail

LicensingServiceProviderFactory

public LicensingServiceProviderFactory()
Method Detail

getLicenseLockConfirmPeriod

public static int getLicenseLockConfirmPeriod()
Returns the default value for the license lock confirmation period in milliseconds. This value is used to determine how often the license lock should be confirmed when it's not possible to obtain corresponding value from the Licensing Server

Returns:
license lock confirmation period

setLicenseLockConfirmPeriod

public static void setLicenseLockConfirmPeriod(int aLicenseLockConfirmPeriod)
Specifies default value for the license lock confirmation period in milliseconds.

Parameters:
aLicenseLockConfirmPeriod - default value for the license lock confirmation period to set

getInstance

public static LicensingServiceProviderFactory getInstance()
Returns shared instance of the factory

Returns:
shared instance of the factory

registerProvider

public void registerProvider(java.lang.String aName,
                             java.lang.Class aProviderClass,
                             java.lang.String anAddress,
                             java.lang.String aLogin,
                             java.lang.String aPassword,
                             boolean isDefault)
Registers Licensing Service provider implementation

Parameters:
aName - name of the provider implementation
aProviderClass - class of provider implementation
anAddress - default address of the Licensing Server to connect
aLogin - login
aPassword - password
isDefault - specifies whether this implementation is default one

registerProvider

public void registerProvider(java.lang.String aName,
                             java.lang.Class aProviderClass,
                             java.util.Map aProviderAttrs,
                             boolean isDefault)
Registers a Licensing Service provider implementation

Parameters:
aName - name of the provider implementation
aProviderClass - class of provider implementation
aProviderAttrs - attributes for provider initialization.
isDefault - specifies whether this implementation is default one

unRegisterProvider

public void unRegisterProvider(java.lang.String aName)
Unregisters a Licensing Service provider implementation for the given name

Parameters:
aName - name of the Licensing Service provider to unregister

release

public void release()
Releases the factory and all of its acquired resources


createProvider

public LicensingServiceProvider createProvider(java.lang.String anAddress,
                                               java.util.Map aProviderAttrs)
Creates a new instance of the LicensingServiceProvider

Parameters:
anAddress - address of the Licensing Server to connect
aProviderAttrs - provider initialization attributes
Returns:
new instance of the LicensingServiceProvider

getProviderAddress

public java.lang.String getProviderAddress(java.lang.String aName)
Returns default Licensing Server address for given provider name

Parameters:
aName - provider name to get default Licensing Server address for
Returns:
default Licensing Server address

getProviderAddresses

public java.lang.String[] getProviderAddresses()
Returns Licensing Server addresses for all registered providers

Returns:
Licensing Server addresses for all registered providers
Since:
v4.6.3

noSuchProviderError

protected void noSuchProviderError(java.lang.String aName)
                            throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

getProviderProtocol

public java.lang.String getProviderProtocol(java.lang.String aName)
Returns protocol for a specified provider

Parameters:
aName - provider name
Returns:
protocol

getProviderProtocol

public java.lang.String getProviderProtocol()
Returns protocol for a default provider

Returns:
protocol
Since:
v5.0

createProvider

public LicensingServiceProvider createProvider(java.lang.String aName,
                                               java.lang.String anAddress,
                                               java.util.Map aProviderAttrs)
Creates a new instance of the LicensingServiceProvider

Parameters:
aName - provider name
anAddress - address of the Licensing Server to connect
aProviderAttrs - provider initialization attributes
Returns:
new instance of LicensingServiceProvider

hasProviders

public boolean hasProviders()
Returns if there are any registered providers

Returns:
true if there are providers registered; false otherwise