Search in sources :

Example 1 with KeyAnyValue

use of com.vmware.vim25.KeyAnyValue in project cloudstack by apache.

the class LicenseAssignmentManagerMO method isFeatureSupported.

public boolean isFeatureSupported(String featureKey, ManagedObjectReference hostMor) throws Exception {
    boolean featureSupported = false;
    // Retrieve host license properties
    List<KeyAnyValue> props = getHostLicenseProperties(hostMor);
    // Check host license properties to see if specified feature is supported by the license.
    for (KeyAnyValue prop : props) {
        String key = prop.getKey();
        if (key.equalsIgnoreCase(LICENSE_INFO_FEATURE)) {
            KeyValue propValue = (KeyValue) prop.getValue();
            if (propValue.getKey().equalsIgnoreCase(featureKey)) {
                featureSupported = true;
                break;
            }
        }
    }
    return featureSupported;
}
Also used : KeyValue(com.vmware.vim25.KeyValue) KeyAnyValue(com.vmware.vim25.KeyAnyValue)

Example 2 with KeyAnyValue

use of com.vmware.vim25.KeyAnyValue in project coprhd-controller by CoprHD.

the class VMWareException method getAsText.

/**
 * Gets the message text from a localizable message.
 *
 * @param message
 *            the message.
 * @return the message text.
 */
public static String getAsText(LocalizableMessage message) {
    if (StringUtils.isNotBlank(message.getMessage())) {
        return message.getMessage();
    } else {
        // No message, provide the message key and arguments
        StrBuilder sb = new StrBuilder();
        sb.append(message.getKey());
        KeyAnyValue[] args = message.getArg();
        if ((args != null) && (args.length > 0)) {
            sb.append("[");
            for (int i = 0; i < args.length; i++) {
                sb.appendSeparator(",", i);
                sb.append(args[i].key).append("=").append(args[i].value);
            }
            sb.append("]");
        }
        return sb.toString();
    }
}
Also used : KeyAnyValue(com.vmware.vim25.KeyAnyValue) StrBuilder(org.apache.commons.lang.text.StrBuilder)

Aggregations

KeyAnyValue (com.vmware.vim25.KeyAnyValue)2 KeyValue (com.vmware.vim25.KeyValue)1 StrBuilder (org.apache.commons.lang.text.StrBuilder)1