Search in sources :

Example 1 with LicenseInfo

use of com.emc.storageos.coordinator.client.service.LicenseInfo in project coprhd-controller by CoprHD.

the class CoordinatorClientImpl method getLicenseInfo.

/**
 * get License Info from coordinator for the specified license type
 *
 * @param licenseType
 * @return LicenseInfo
 */
private LicenseInfo getLicenseInfo(LicenseType licenseType) {
    final Configuration config = queryConfiguration(LicenseInfo.LICENSE_INFO_TARGET_PROPERTY, TARGET_PROPERTY_ID);
    if (config == null || config.getConfig(TARGET_INFO) == null) {
        return null;
    }
    final String infoStr = config.getConfig(TARGET_INFO);
    try {
        List<LicenseInfo> licenseInfoList = LicenseInfo.decodeLicenses(infoStr);
        for (LicenseInfo licenseInfo : licenseInfoList) {
            if (licenseType.equals(licenseInfo.getLicenseType())) {
                log.debug("getLicenseInfo: " + licenseInfo);
                return licenseInfo;
            }
        }
    } catch (final Exception e) {
        throw CoordinatorException.fatals.unableToDecodeLicense(e);
    }
    log.warn("getLicenseInfo: null");
    return null;
}
Also used : LicenseInfo(com.emc.storageos.coordinator.client.service.LicenseInfo) Configuration(com.emc.storageos.coordinator.common.Configuration) PropertyInfoMapper.decodeFromString(com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString) CoordinatorException(com.emc.storageos.coordinator.exceptions.CoordinatorException) RetryableCoordinatorException(com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException)

Aggregations

LicenseInfo (com.emc.storageos.coordinator.client.service.LicenseInfo)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 RetryableCoordinatorException (com.emc.storageos.coordinator.exceptions.RetryableCoordinatorException)1 PropertyInfoMapper.decodeFromString (com.emc.storageos.coordinator.mapper.PropertyInfoMapper.decodeFromString)1 IOException (java.io.IOException)1 UnknownHostException (java.net.UnknownHostException)1 KeeperException (org.apache.zookeeper.KeeperException)1