|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blackboard.platform.License
public final class License
Object to represent different options in the license file. Each license is identified by a "component" name, which is a simple string. There are additional attributes for expiration, key (a validation digest), allowed IP addresses, and a generic "unit" facility to represent any additional, integer-based component-specific options. There is also a facility for free-form "parameters" for additiona, string-based component-specific options.
Nested Class Summary | |
---|---|
static class |
License.XmlDef
Class to wrap String constants used in XML parsing. |
Field Summary | |
---|---|
protected java.lang.String[] |
_allowedIps
|
protected java.lang.String |
_component
|
protected java.util.Date |
_expiration
|
protected java.lang.String |
_key
|
protected java.util.Properties |
_params
|
protected java.util.Hashtable |
_unitProps
|
static java.lang.String[] |
ALLOW_ANY_SERVER_IP
|
static java.util.Date |
NO_EXPIRATION
|
static java.lang.Integer |
UNLIMITED_UNITS
|
static java.lang.String |
UNLIMITED_UNITS_DB_STRING
|
static java.lang.String |
UNLIMITED_UNITS_STRING
|
Constructor Summary | |
---|---|
License(java.lang.String component,
java.lang.String[] allowedIps,
java.util.Date expiration,
java.lang.String key,
java.util.Hashtable unitProps,
java.util.Properties params)
Constructor initializing License with specified parameters |
Method Summary | |
---|---|
void |
assertHasValidKey()
Identical to hasValidKey() , except that a checked exception is thrown if the key is not valid. |
void |
assertIsLicensed()
Assertion that a valid license exists, including validating expiration and valid IP addresses. |
java.lang.String[] |
getAllowedIps()
Returns the set of IP addresses that this license is restricted to run on. |
java.lang.String |
getComponent()
Returns the component name. |
java.util.Date |
getExpiration()
Returns the expiration date for this component. |
java.lang.String |
getKey()
Returns the validation digest for this component. |
java.lang.String |
getParameter(java.lang.String name)
Returns the value for the specified custom parameter. |
java.lang.Integer |
getUnitsParameter(java.lang.String propertyName)
Returns the value for the specified unit. |
boolean |
hasValidKey()
Returns whether this component's validation key is correct. |
boolean |
isExpired()
Returns whether this component has expired. |
boolean |
isValidForThisServer()
Check to see if this server is in the set of valid IP addresses associated for this license component. |
void |
serializeAsProperties(java.util.Properties p,
java.lang.String namePrefix)
Writes component out in property (name/value) format. |
java.lang.String |
serializeAsXml(java.lang.String lineSeparator)
Writes out this license as a String, using the specified lineSeparator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String _component
protected java.lang.String[] _allowedIps
protected java.util.Date _expiration
protected java.lang.String _key
protected java.util.Properties _params
protected java.util.Hashtable _unitProps
public static final java.util.Date NO_EXPIRATION
public static final java.lang.Integer UNLIMITED_UNITS
public static final java.lang.String UNLIMITED_UNITS_STRING
public static final java.lang.String UNLIMITED_UNITS_DB_STRING
public static final java.lang.String[] ALLOW_ANY_SERVER_IP
Constructor Detail |
---|
public License(java.lang.String component, java.lang.String[] allowedIps, java.util.Date expiration, java.lang.String key, java.util.Hashtable unitProps, java.util.Properties params)
component
- Component nameallowedIps
- IP addresses this license is valid forexpiration
- Expiration date for this licensekey
- Calculated key for this licenseunitProps
- Any "unit" parametersparams
- Any String parametersMethod Detail |
---|
public java.lang.String getComponent()
public java.lang.String[] getAllowedIps()
public java.util.Date getExpiration()
public java.lang.String getKey()
public java.lang.Integer getUnitsParameter(java.lang.String propertyName)
propertyName
- Name of the unit to retrieve the value for
public java.lang.String getParameter(java.lang.String name)
name
- Parameter to retrieve.
public boolean isExpired()
public boolean hasValidKey()
public void assertHasValidKey() throws BadLicenseKeyException
hasValidKey()
, except that a checked exception is thrown if the key is not valid.
BadLicenseKeyException
- Thrown if hasValidKey()
evaluates to false.public boolean isValidForThisServer()
public void assertIsLicensed() throws LicenseExpiredException, UnlicensedServerException
LicenseExpiredException
- If the license is expired
UnlicensedServerException
- If the IP address for the server is not validpublic void serializeAsProperties(java.util.Properties p, java.lang.String namePrefix)
p
- Properties object to insert values intonamePrefix
- Prefix for property namespublic java.lang.String serializeAsXml(java.lang.String lineSeparator)
lineSeparator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |