Package org.forgerock.openam.license
Class PropertiesFileLicenseLog
- java.lang.Object
-
- org.forgerock.openam.license.PropertiesFileLicenseLog
-
- All Implemented Interfaces:
LicenseLog
public class PropertiesFileLicenseLog extends Object implements LicenseLog
Stores acceptance of license terms in aPropertiesfile on disk. Uses a separate properties file for each license file with an entry for each user that has accepted the license, of the form:user=date-acceptedWhereuseris the user name of the user (usually fromuser.namesystem property), anddate-acceptedis the ISO-8601 formatted timestamp of when they accepted that license. Each license log file is placed in the given log directory and named by taking the root name of the license and changing the extension to.log. For example,license.txtwill produce alicense.logfile.- Since:
- 12.0.0
-
-
Constructor Summary
Constructors Constructor Description PropertiesFileLicenseLog(File logDirectory)Constructs the license log with the given log directory and log date format (seeSimpleDateFormatfor allowed format strings).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisLicenseAccepted(License license, String user)Determines whether the given user has accepted the given license according to the log.voidlogLicenseAccepted(License license, String user, Date acceptedDate)Logs that the given user has accepted the given license terms.
-
-
-
Constructor Detail
-
PropertiesFileLicenseLog
public PropertiesFileLicenseLog(File logDirectory)
Constructs the license log with the given log directory and log date format (seeSimpleDateFormatfor allowed format strings).- Parameters:
logDirectory- the directory to store log files in.- Throws:
NullPointerException- if either parameter is null.IllegalArgumentException- if the log directory does not exist, is not a directory or is not writeable or if the date format is invalid.
-
-
Method Detail
-
logLicenseAccepted
public void logLicenseAccepted(License license, String user, Date acceptedDate)
Logs that the given user has accepted the given license terms.- Specified by:
logLicenseAcceptedin interfaceLicenseLog- Parameters:
license- the license that the user accepteduser- the user who accepted the licenseacceptedDate- the timestamp at which the license was accepted.
-
isLicenseAccepted
public boolean isLicenseAccepted(License license, String user)
Determines whether the given user has accepted the given license according to the log.- Specified by:
isLicenseAcceptedin interfaceLicenseLog- Parameters:
license- the license to check acceptance for.user- the user to check.- Returns:
- true if the user has accepted the given license terms, or false if not.
-
-