2018年5月11日 星期五
他山之石 Openbravo ERP 收費制度下 版本與人數控管機制
先去授權檔案抓"lincensetype"授權型式
1.DMD :: LicenseType.ON_DEMAND 即選需求
2.USR :: LicenseType.CONCURRENT_USERS 同時上線人數
3.以上全非 :: 就用 LicenseType.CONCURRENT_USERS 同時上線人數
String pLicenseType = getProperty("lincensetype");
if ("DMD".equals(pLicenseType)) {
licenseType = LicenseType.ON_DEMAND;
} else if ("USR".equals(pLicenseType)) {
licenseType = LicenseType.CONCURRENT_USERS;
} else {
log4j.warn("Unknown license type:" + pLicenseType + ". Using Concurrent Users!.");
licenseType = LicenseType.CONCURRENT_USERS;
}
即選需求
假如不是"即選需求"
if (licenseType == LicenseType.ON_DEMAND) {
if (!checkInOnDemandPlatform()) {
outOfPlatform = true;
String limitusers = getProperty("limitusers");
maxUsers = StringUtils.isEmpty(limitusers) ? 0L : Long.valueOf(limitusers);
if (maxUsers == 0L) {
maxUsers = OUT_OF_PLATFORM_DEMAND_MAX_USERS;
}
log.warn("On Demand license ouf of platform limiting to " + maxUsers + " concurrent users");
} else {
maxUsers = 0L;
}
}
if (licenseType == LicenseType.CONCURRENT_USERS) {
String limitusers = getProperty("limitusers");
maxUsers = StringUtils.isEmpty(limitusers) ? 0L : Long.valueOf(limitusers);
}
// Check for dates to know if the instance is active
subscriptionConvertedProperty = "true".equals(getProperty("subscriptionConverted"));
trial = "true".equals(getProperty("trial"));
golden = "true".equals(getProperty("golden"));
String strUnlimitedWsAccess = getProperty("unlimitedWsAccess");
if (StringUtils.isEmpty(strUnlimitedWsAccess)) {
// old license, setting defaults
if (trial || golden) {
limitedWsAccess = true;
maxWsCalls = 500L;
instanceProperties.put("wsPacks", "1");
instanceProperties.put("wsUnitsPerUnit", "500");
initializeWsCounter();
} else {
limitedWsAccess = false;
}
} else {
limitedWsAccess = "false".equals(getProperty("unlimitedWsAccess"));
if (limitedWsAccess) {
String packs = getProperty("wsPacks");
String unitsPack = getProperty("wsUnitsPerUnit");
if (StringUtils.isEmpty(packs) || StringUtils.isEmpty(unitsPack)) {
log.warn("Couldn't determine ws call limitation, setting unlimited.");
limitedWsAccess = false;
} else {
try {
Integer nPacks = Integer.parseInt(packs);
Integer nUnitsPack = Integer.parseInt(unitsPack);
maxWsCalls = nPacks * nUnitsPack;
log.debug("Maximum ws calls: " + maxWsCalls);
initializeWsCounter();
} catch (Exception e) {
log.error("Error setting ws call limitation, setting unlimited.", e);
limitedWsAccess = false;
}
}
}
}
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言