001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.license.util;
016    
017    import com.liferay.portal.license.LicenseInfo;
018    
019    import java.util.Set;
020    
021    /**
022     * @author Amos Fong
023     */
024    public class LicenseManagerUtil {
025    
026            public static final int STATE_ABSENT = 1;
027    
028            public static final int STATE_EXPIRED = 2;
029    
030            public static final int STATE_GOOD = 3;
031    
032            public static final int STATE_INACTIVE = 4;
033    
034            public static final int STATE_INVALID = 5;
035    
036            public static final int STATE_OVERLOAD = 6;
037    
038            public static void checkLicense(String productId) {
039                    getLicenseManager().checkLicense(productId);
040            }
041    
042            public static String getHostName() {
043                    return getLicenseManager().getHostName();
044            }
045    
046            public static Set<String> getIpAddresses() {
047                    return getLicenseManager().getIpAddresses();
048            }
049    
050            public static LicenseInfo getLicenseInfo(String productId) {
051                    return getLicenseManager().getLicenseInfo(productId);
052            }
053    
054            public static LicenseManager getLicenseManager() {
055                    return _licenseManager;
056            }
057    
058            public static int getLicenseState(String productId) {
059                    return getLicenseManager().getLicenseState(productId);
060            }
061    
062            public static Set<String> getMacAddresses() {
063                    return getLicenseManager().getMacAddresses();
064            }
065    
066            public void setLicenseManager(LicenseManager licenseManager) {
067                    _licenseManager = licenseManager;
068            }
069    
070            private static LicenseManager _licenseManager;
071    
072    }