Esempio n. 1
0
  private void loadMaxInstanceLimit(IaasProvider iaas, final OMElement iaasElt) {

    Iterator<?> it =
        iaasElt.getChildrenWithName(new QName(CloudControllerConstants.MAX_INSTANCE_LIMIT_ELEMENT));

    if (it.hasNext()) {
      OMElement maxInstanceLimitElt = (OMElement) it.next();

      try {
        iaas.setMaxInstanceLimit(Integer.parseInt(maxInstanceLimitElt.getText()));
      } catch (NumberFormatException e) {
        String msg =
            CloudControllerConstants.MAX_INSTANCE_LIMIT_ELEMENT
                + " element contained"
                + " in "
                + xmlSource
                + ""
                + " has a value which is not an Integer value.";
        handleException(msg, e);
      }
    }

    if (it.hasNext()) {
      log.warn(
          xmlSource
              + " contains more than one "
              + CloudControllerConstants.MAX_INSTANCE_LIMIT_ELEMENT
              + " elements!"
              + " Elements other than the first will be neglected.");
    }
  }