|
Holger's Java API |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.antelmann.LicenseManager
public final class LicenseManager
LicenseManager provides the ability to use limited licenses based on classes and package names. Note that the LicenseManager only accepts Licenses that are properly signed, i.e. they will have to be created by an authorized issuer.
Once the LicenseManager is initialized, a set of licenses is installed from the licenses.dat file in the resource directory from the distribution; if any licenses therein are invalid or the file is non-existent, the resulting errors are ignored and the LicenseManager contains no licenses to begin with.
Generally, an application can go without using the LicenseManager explicitly.
The class com.antelmann.util.Settings provides a few convenience
methods that may suffice for a standard application.
Settings,
License,
Licensed,
LicenseHandler,
LicensingException,
Settings.checkLicense(Object),
Settings.installLicense(com.antelmann.License)| Method Summary | |
|---|---|
void |
check(Object licensee)
checks for a valid license for the given object and only returns gracefully if a valid license was found. |
JTable |
createTable()
creates a table containing all licenses of this manager. |
License |
getLicense(Object licensee)
returns the license used for the given licensee. |
static LicenseManager |
getLicenseManager()
returns the global LicenseManager object (there is only one) |
Collection<License> |
getLicenses()
returns an unmodifiable view of the embedded licenses |
License |
install(License l)
installs the given license into this LicenseManager, so that it can be found if a check on the licensee is made. |
Iterator<License> |
iterator()
|
void |
loadFrom(File file)
a convenience method that installs serialized licenses from a file |
void |
loadFrom(InputStream stream)
a convenience method that installs serialized licenses from a stream. |
void |
loadFrom(URL url)
a convenience method that installs serialized licenses from a URL |
void |
removeAllLicenses()
|
License |
removeLicense(License l)
|
License |
signLicense(License l)
requires a certain developer class as well as a developer private key to be present - not shipped with the distribution. |
void |
store(OutputStream stream)
every license contained within is written as a serialized byte array |
void |
verifyLicense(License l)
checks the signature against the certificate. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public JTable createTable()
LicenseTableModel
public static LicenseManager getLicenseManager()
throws SecurityException
SecurityException - if the correct certificate cannot be found
public License signLicense(License l)
throws Exception
Exception - whenever the special developer class is not present (which is usually the case).
public void loadFrom(File file)
throws IOException
IOException
public void loadFrom(URL url)
throws IOException
IOException
public void loadFrom(InputStream stream)
throws IOException
IOException - if a license to be imported is not valid
public void store(OutputStream stream)
throws IOException
IOExceptionpublic Collection<License> getLicenses()
public Iterator<License> iterator()
iterator in interface Iterable<License>
public void check(Object licensee)
throws LicensingException
use() method
of the license object will be called if a valid license was found.
LicensingException - if either no license was found or the found
license was invalidLicense.use(),
getLicense(Object)
public License install(License l)
throws LicensingException
LicensingException - if the license cannot be verified (i.e. if it is
not properly signed)check(Object),
verifyLicense(License)public License removeLicense(License l)
public void removeAllLicenses()
public License getLicense(Object licensee)
public void verifyLicense(License l)
throws LicensingException
LicensingException
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||