Search in sources :

Example 1 with LicenseState

use of com.emc.fapiclient.ws.LicenseState in project coprhd-controller by CoprHD.

the class RecoverPointUtils method isSiteLicensed.

/**
 * Returns true if the specified RecoverPoint site is licensed.
 *
 * @param impl
 * @return boolean
 * @throws Exception
 */
public static boolean isSiteLicensed(FunctionalAPIImpl impl) throws Exception {
    // A bad license will be caught hear 99% of the time.
    try {
        AccountState accountState = impl.getAccountState();
        List<LicenseState> licenseStates = accountState.getLicensesStates();
        for (LicenseState licenseState : licenseStates) {
            if (licenseState.getLicenseStatus().equals(LicenseStatus.ACTIVE)) {
                logger.info("Found an active license");
                return true;
            }
        }
        logger.error("RecoverPoint licenses do not exist, are invalid, or have expired.  Check your RP configuration");
    } catch (FunctionalAPIActionFailedException_Exception e) {
        return false;
    } catch (FunctionalAPIInternalError_Exception e) {
        ;
        return false;
    } catch (Exception f) {
        throw f;
    }
    return false;
}
Also used : LicenseState(com.emc.fapiclient.ws.LicenseState) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) AccountState(com.emc.fapiclient.ws.AccountState) FunctionalAPIActionFailedException_Exception(com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception) FunctionalAPIValidationException_Exception(com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception) FunctionalAPIInternalError_Exception(com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception) RecoverPointException(com.emc.storageos.recoverpoint.exceptions.RecoverPointException)

Aggregations

AccountState (com.emc.fapiclient.ws.AccountState)1 FunctionalAPIActionFailedException_Exception (com.emc.fapiclient.ws.FunctionalAPIActionFailedException_Exception)1 FunctionalAPIInternalError_Exception (com.emc.fapiclient.ws.FunctionalAPIInternalError_Exception)1 FunctionalAPIValidationException_Exception (com.emc.fapiclient.ws.FunctionalAPIValidationException_Exception)1 LicenseState (com.emc.fapiclient.ws.LicenseState)1 RecoverPointException (com.emc.storageos.recoverpoint.exceptions.RecoverPointException)1