public class FileLicenseProvider extends DeserializingLicenseProvider
LicenseProvider that assumes the binary data from the signed and serialized
license is stored in a file. Various properties of this provider allow configuration of file prefixes (such as
a directory), file suffixes (such as an extension), whether or not the file can be found on the classpath, and
whether or not the contents of the file are Base64 encoded.Object.toString() implementation that can be used within the file name.| Modifier and Type | Field and Description |
|---|---|
protected ClassLoader |
classLoader |
| Constructor and Description |
|---|
FileLicenseProvider()
Constructs a file-based license provider with the same class loader as the loader of this class and
fileOnClasspath set to false. |
FileLicenseProvider(ClassLoader classLoader)
Constructs a file-based license provider with the provided class loader and
fileOnClasspath set to true. |
| Modifier and Type | Method and Description |
|---|---|
String |
getFilePrefix()
Gets the prefix that will be prepended to the file name before looking for it.
|
String |
getFileSuffix()
Gets the file suffix that will be appended to the file name before looking for it.
|
protected byte[] |
getLicenseData(Object context)
Gets the stored, still-encrypted, still-serialized license content and signature from the persistence store.
|
protected File |
getLicenseFile(Object context)
Gets the license file handle.
|
boolean |
isBase64Encoded()
Indicates whether the file is Base64 encoded.
|
boolean |
isFileOnClasspath()
Indicates whether the file should be found on the file system or on the classpath via a class loader.
|
void |
setBase64Encoded(boolean base64Encoded)
Sets whether the file is Base64 encoded.
|
void |
setFileOnClasspath(boolean fileOnClasspath)
Sets whether the file should be found on the file system or on the classpath via a class loader.
|
void |
setFilePrefix(String filePrefix)
Sets the prefix that will be prepended to the file name before looking for it.
|
void |
setFileSuffix(String fileSuffix)
Sets the file suffix that will be appended to the file name before looking for it.
|
deserializeLicense, getLicenseprotected ClassLoader classLoader
public FileLicenseProvider()
fileOnClasspath set to false. The class loader is only used if
fileOnClasspath is subsequently changed to true.public FileLicenseProvider(ClassLoader classLoader)
fileOnClasspath set to true. The class loader will be used to
locate the file unless fileOnClasspath is subsequently changed to false.classLoader - The class loader to use for finding the fileprotected byte[] getLicenseData(Object context)
getLicenseData in class DeserializingLicenseProvidercontext - The context for which to get the licenseprotected File getLicenseFile(Object context)
context - The context for which to get the licensepublic String getFilePrefix()
public void setFilePrefix(String filePrefix)
filePrefix - The file prefixpublic String getFileSuffix()
public void setFileSuffix(String fileSuffix)
fileSuffix - The file suffixpublic boolean isFileOnClasspath()
false it will be looked for on the file system; if true it will be looked for on the classpath.
If true, the file prefix should be the package-path and prefix and the suffix the suffix.public void setFileOnClasspath(boolean fileOnClasspath)
false it will be looked for on the file system; if true it will be looked for on the classpath.
If true, the file prefix should be the package-path and prefix and the suffix the suffix.fileOnClasspath - Whether the file is on the classpathpublic boolean isBase64Encoded()
getLicenseData(Object).public void setBase64Encoded(boolean base64Encoded)
getLicenseData(Object).base64Encoded - Whether the file is Base64 encoded.Copyright © 2010-2013 NWTS Java Code. All Rights Reserved. Licensed Under the Apache License version 2.0.