Overview

The TrueLicense JSF module provides a web user interface for consuming license keys.

Features

Using the Truelicense JSF you can…

  • Consume license keys using a web user interface based on Facelets.
  • Take advantage of an internationalized API with English and German localizations.
  • Customize the display using Cascading Style Sheets (CSS).

Usage

This is a simple using page for the Facelet based wizard component:

<?xml version='1.0'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:html="http://java.sun.com/jsf/html"
      xmlns:tl="http://java.sun.com/jsf/composite/truelicense">
    <html:head>
        <title>TrueLicense JSF Test</title>
    </html:head>
    <html:body>
        <tl:wizard id="wizard" manager="${licensingSchema.manager()}"
                   uninstallable="true"/>
        <html:messages showDetail="false"/>
    </html:body>
</html>

The <tl:wizard> component renders a dialog for license consumer management. The output is bare-boned HTML - no CSS decoration is provided. However, all rendered HTML tags use the id and class attributes so that you can easily style them with your own CSS.

The boolean attribute uninstallable controls whether license key uninstallation shall be supported by the wizard component.

The EL expression for the manager attribute needs to resolve to a license consumer manager of the interface type net.java.truelicense.core.LicenseConsumerManager. If you have used the TrueLicense Maven Archetype to generate a project, then you just need to annotate the LicensingSchema class in the KeyMgr module like this:

package ${package}.keymgr;

import javax.inject.Named
import net.java.truelicense.core.LicenseConsumerManager;
[...]

@Named
public class LicensingSchema {

    [...]

    /** Returns the first license consumer manager in the configured chain-of-responsibility. [...] */
    public static LicenseConsumerManager manager() { [...] }
}

The @Named annotation makes the LicensingSchema class available to EL. The returned license consumer manager has singleton scope, nevertheless what the framework thinks it is.