001
014
015 package com.liferay.portal.license.util;
016
017 import com.liferay.portal.kernel.json.JSONObject;
018 import com.liferay.portal.kernel.security.pacl.permission.PortalRuntimePermission;
019 import com.liferay.portal.license.LicenseInfo;
020
021 import java.util.List;
022 import java.util.Map;
023 import java.util.Set;
024
025
028 public class LicenseManagerUtil {
029
030
033 public static final int STATE_ABSENT = LicenseManager.STATE_ABSENT;
034
035
038 public static final int STATE_EXPIRED = LicenseManager.STATE_EXPIRED;
039
040
043 public static final int STATE_GOOD = LicenseManager.STATE_GOOD;
044
045
049 public static final int STATE_INACTIVE = LicenseManager.STATE_INACTIVE;
050
051
054 public static final int STATE_INVALID = LicenseManager.STATE_INVALID;
055
056
060 public static final int STATE_OVERLOAD = LicenseManager.STATE_OVERLOAD;
061
062 public static void checkLicense(String productId) {
063 getLicenseManager().checkLicense(productId);
064 }
065
066 public static List<Map<String, String>> getClusterLicenseProperties(
067 String clusterNodeId) {
068
069 return getLicenseManager().getClusterLicenseProperties(clusterNodeId);
070 }
071
072 public static String getHostName() {
073 return getLicenseManager().getHostName();
074 }
075
076 public static Set<String> getIpAddresses() {
077 return getLicenseManager().getIpAddresses();
078 }
079
080 public static LicenseInfo getLicenseInfo(String productId) {
081 return getLicenseManager().getLicenseInfo(productId);
082 }
083
084 public static LicenseManager getLicenseManager() {
085 PortalRuntimePermission.checkGetBeanProperty(LicenseManagerUtil.class);
086
087 return _licenseManager;
088 }
089
090 public static List<Map<String, String>> getLicenseProperties() {
091 return getLicenseManager().getLicenseProperties();
092 }
093
094 public static Map<String, String> getLicenseProperties(String productId) {
095 return getLicenseManager().getLicenseProperties(productId);
096 }
097
098 public static int getLicenseState(Map<String, String> licenseProperties) {
099 return getLicenseManager().getLicenseState(licenseProperties);
100 }
101
102 public static int getLicenseState(String productId) {
103 return getLicenseManager().getLicenseState(productId);
104 }
105
106 public static Set<String> getMacAddresses() {
107 return getLicenseManager().getMacAddresses();
108 }
109
110 public static void registerLicense(JSONObject jsonObject) throws Exception {
111 getLicenseManager().registerLicense(jsonObject);
112 }
113
114 public void setLicenseManager(LicenseManager licenseManager) {
115 PortalRuntimePermission.checkSetBeanProperty(getClass());
116
117 _licenseManager = licenseManager;
118 }
119
120 private static LicenseManager _licenseManager;
121
122 }