private boolean canHandleLbRules(final List<LoadBalancingRule> rules) {
   final Map<Capability, String> lbCaps = getCapabilities().get(Service.Lb);
   if (!lbCaps.isEmpty()) {
     final String schemeCaps = lbCaps.get(Capability.LbSchemes);
     if (schemeCaps != null) {
       for (final LoadBalancingRule rule : rules) {
         if (!schemeCaps.contains(rule.getScheme().toString())) {
           s_logger.debug(
               "Scheme "
                   + rules.get(0).getScheme()
                   + " is not supported by the provider "
                   + getName());
           return false;
         }
       }
     }
   }
   return true;
 }
  public static boolean validateHAProxyLBRule(final LoadBalancingRule rule) {
    final String timeEndChar = "dhms";

    for (final LbStickinessPolicy stickinessPolicy : rule.getStickinessPolicies()) {
      final List<Pair<String, String>> paramsList = stickinessPolicy.getParams();

      if (StickinessMethodType.LBCookieBased.getName()
          .equalsIgnoreCase(stickinessPolicy.getMethodName())) {

      } else if (StickinessMethodType.SourceBased.getName()
          .equalsIgnoreCase(stickinessPolicy.getMethodName())) {
        String tablesize = "200k"; // optional
        String expire = "30m"; // optional

        /* overwrite default values with the stick parameters */
        for (final Pair<String, String> paramKV : paramsList) {
          final String key = paramKV.first();
          final String value = paramKV.second();
          if ("tablesize".equalsIgnoreCase(key)) {
            tablesize = value;
          }
          if ("expire".equalsIgnoreCase(key)) {
            expire = value;
          }
        }
        if (expire != null && !containsOnlyNumbers(expire, timeEndChar)) {
          throw new InvalidParameterValueException(
              "Failed LB in validation rule id: "
                  + rule.getId()
                  + " Cause: expire is not in timeformat: "
                  + expire);
        }
        if (tablesize != null && !containsOnlyNumbers(tablesize, "kmg")) {
          throw new InvalidParameterValueException(
              "Failed LB in validation rule id: "
                  + rule.getId()
                  + " Cause: tablesize is not in size format: "
                  + tablesize);
        }
      } else if (StickinessMethodType.AppCookieBased.getName()
          .equalsIgnoreCase(stickinessPolicy.getMethodName())) {
        String length = null; // optional
        String holdTime = null; // optional

        for (final Pair<String, String> paramKV : paramsList) {
          final String key = paramKV.first();
          final String value = paramKV.second();
          if ("length".equalsIgnoreCase(key)) {
            length = value;
          }
          if ("holdtime".equalsIgnoreCase(key)) {
            holdTime = value;
          }
        }

        if (length != null && !containsOnlyNumbers(length, null)) {
          throw new InvalidParameterValueException(
              "Failed LB in validation rule id: "
                  + rule.getId()
                  + " Cause: length is not a number: "
                  + length);
        }
        if (holdTime != null
            && !containsOnlyNumbers(holdTime, timeEndChar)
            && !containsOnlyNumbers(holdTime, null)) {
          throw new InvalidParameterValueException(
              "Failed LB in validation rule id: "
                  + rule.getId()
                  + " Cause: holdtime is not in timeformat: "
                  + holdTime);
        }
      }
    }
    return true;
  }