// Step 1 : Choose the best LicenseBase implementation class.
base = getLicenseBase();
if (base == null) {
// No license base class in the package!
// This should never happen. No I18N necessary.
throw new BrokerException(
"Could not find license base class." +
"This is a broker packaging error.");
}
// Step 2 : Load the specified license file. If no license
// file is specified, load all license files and select the
// one that is most generous.
FileLicense fl = null;
try {
fl = loadLicenseFile(filestr);
}
catch (BrokerException e) {
//BUG FIX 5025985
throw e;
}
// Step 3 : If a license file was loaded from the disk
// it must be re-written in order to handle the license
// expiration correctly.
if (fl != null) {
try {
fl.rewriteLicense();
} catch (IOException e) {
throw new BrokerException(
br.getString(br.E_BAD_LICENSE_DATA), e);
}
}
// Step 4 : Superimpose the license file contents on the
// base class chosen in step 1.
if (fl != null) {
if (filestr != null ||
fl.getPrecedence() > base.getPrecedence()) {
base.superimpose(fl.getProperties());
// log where the license comes from
logger.log(Logger.DEBUG, br.getString(br.I_LICENSE_FILE,
fl.getLicenseFile()));
}
}
else if (base.isLicenseFileRequired()) {
// If there is no license file, and the base class
// requires a license file, throw an exception.
throw new BrokerException(
br.getString(br.E_NO_VALID_LICENSE));
}
currentLicense = base;
return base;