public void buildFromXMLElement()

in uimaj-ep-runtime-deployeditor/src/main/java/org/apache/uima/aae/deployment/impl/RemoteAEDeploymentMetaData_Impl.java [92:211]


  public void buildFromXMLElement (Element aElement, XMLParser aParser, XMLParser.ParsingOptions aOptions)
  throws InvalidXMLException
  {
    String val;

    // Check for "key" and "remoteReplyQueueScaleout" attributes
    NamedNodeMap map = aElement.getAttributes();
    if (map != null) {
      for (int i=0; i<map.getLength(); ++i) {
        Node item = map.item(i);
        String name = item.getNodeName();
        val = item.getNodeValue();
        if (val == null) {
          val = "";
        } else {
          val = val.trim();
        }
        if (AEDeploymentConstants.TAG_ATTR_KEY.equalsIgnoreCase(name)) {
          // Set "key = ..." attribute
          setKey(val);
        } else if (AEDeploymentConstants.TAG_ATTR_REMOTE_REPLYQUEUE_SCALEOUT.equalsIgnoreCase(name)) {          
          // "remoteReplyQueueScaleout" attribute
          try {
            int n = Integer.parseInt(val);
            if (n > 0) {
              setRemoteReplyQueueScaleout(n);
            } else {
              throw new InvalidXMLException(InvalidXMLException.INVALID_ELEMENT_TEXT,
                      new Object[] { n, TAG_ATTR_REMOTE_REPLYQUEUE_SCALEOUT });
            }
          } catch (NumberFormatException e) {
            throw new InvalidXMLException(InvalidXMLException.UNKNOWN_ELEMENT,
                    new Object[] { TAG_ATTR_REMOTE_REPLYQUEUE_SCALEOUT }, e);
          }

        } else {
          throw new InvalidXMLException(InvalidXMLException.UNKNOWN_ELEMENT,
                  new Object[]{name});
        }
      }
    }

    NodeList childNodes = aElement.getChildNodes();
    for (int i = 0; i < childNodes.getLength(); i++) {
      Node curNode = childNodes.item(i);
      if (curNode instanceof Element) {
        Element elem = (Element)curNode;

        if (TAG_INPUT_QUEUE.equalsIgnoreCase(elem.getTagName())) {
          // inputQueue.setEndPoint(elem.getAttribute(TAG_ATTR_END_POINT));
          // inputQueue.setBrokerURL(elem.getAttribute(TAG_ATTR_BROKER_URL));
          checkAndSetInputQueueAttributes(elem);

        } else if (AEDeploymentConstants.TAG_CAS_MULTIPLIER.equalsIgnoreCase(elem.getTagName())) {
          // Get "poolSize" attribute
          int n;
          val = DDParserUtil.checkAndGetAttributeValue(TAG_CAS_MULTIPLIER, TAG_ATTR_POOL_SIZE, elem, true);
          if (val == null || val.trim().length() == 0) {
            n = 0;
          } else {
            try {
              n = Integer.parseInt(val);
            } catch (NumberFormatException e) {
              e.printStackTrace();
              throw new InvalidXMLException(InvalidXMLException.UNKNOWN_ELEMENT,
                      new Object[] { TAG_ATTR_POOL_SIZE }, e);
            }
          }
          setCasMultiplierPoolSize(n);

          // Check for Optional "initialFsHeapSize"
          val = DDParserUtil.checkAndGetAttributeValue(TAG_CAS_MULTIPLIER, TAG_ATTR_INIT_SIZE_OF_CAS_HEAP, elem, false);
          if (val != null && val.trim().length() > 0) {
            try {
              initialFsHeapSize = Integer.parseInt(val);
            } catch (NumberFormatException e) {
              e.printStackTrace();
              throw new InvalidXMLException(InvalidXMLException.UNKNOWN_ELEMENT,
                      new Object[] { TAG_ATTR_INIT_SIZE_OF_CAS_HEAP }, e);
            }
          }
          
        } else if (TAG_REPLY_QUEUE.equalsIgnoreCase(elem.getTagName())) {
          val = DDParserUtil.checkAndGetAttributeValue(TAG_REPLY_QUEUE, TAG_ATTR_LOCATION, elem, false);
          if (val != null && val.trim().length() > 0) {
            val = val.trim();
            if ( /*val.equalsIgnoreCase("local") ||*/  val.equalsIgnoreCase("remote")) {
              setReplyQueueLocation(val);
            } else {
              throw new InvalidXMLException(InvalidXMLException.INVALID_ELEMENT_TEXT,
                      new Object[] {val, TAG_ATTR_LOCATION });
            }
          }
          
        } else if (TAG_SERIALIZER.equalsIgnoreCase(elem.getTagName())) {
          // setSerializerMethod(elem.getAttribute(TAG_ATTR_METHOD));
          setSerializerMethod(DDParserUtil.checkAndGetAttributeValue(TAG_SERIALIZER, TAG_ATTR_METHOD, elem, true));

        } else if (TAG_ASYNC_AGGREGATE_ERROR_CONFIGURATION.equalsIgnoreCase(elem.getTagName())) {
          errorConfiguration = (AsyncAggregateErrorConfiguration) aParser.buildObject(elem, aOptions); 
          errorConfiguration.sParentObject(this);

        } else {
          throw new InvalidXMLException(
                  InvalidXMLException.UNKNOWN_ELEMENT,
                  new Object[]{elem.getTagName()});
        }
      }
    } // for
    
    // Create Error Config if not specified
    if (errorConfiguration == null) {
      errorConfiguration = (AsyncAEErrorConfiguration) UIMAFramework
                        .getResourceSpecifierFactory().createObject(AsyncAggregateErrorConfiguration.class);
      setErrorConfiguration(errorConfiguration);
      errorConfiguration.sParentObject(this);
    }

    
  }