/** * * @param node the node {@link Element} * @param attributeName the attribute name * @param defaultValue a default attribute value * @return the attribute value */ public static String getAttribute( Element node, String attributeName, String defaultValue ) { String attributeValue = getAttribute(node, attributeName); if (attributeValue == null) { attributeValue = defaultValue; } return attributeValue; }
/** * * @param node the node {@link Element} * @param attributeName the attribute name * @param defaultValue a default attribute value * @return the boolean attribute value */ public static boolean getBooleanAttribute( Element node, String attributeName, boolean defaultValue ) { String attributeValue = getAttribute(node, attributeName); if (attributeValue == null) { return defaultValue; } return Boolean.parseBoolean(attributeValue); }
@Override protected void loadMoreInfo( Element applicationNode ) { Element statusCommandNode = getNoMoreThanOneChild(applicationNode, NODE_STATUS_COMMAND); if (statusCommandNode != null) { statusCommandInfo.url = XmlUtils.getMandatoryAttribute(statusCommandNode, NODE_ATTRIBUTE_URL); statusCommandInfo.urlSearchToken = XmlUtils.getMandatoryAttribute(statusCommandNode, NODE_ATTRIBUTE_URL_SEARCH_TOKEN); statusCommandInfo.command = XmlUtils.getAttribute(statusCommandNode, NODE_ATTRIBUTE_COMMAND); statusCommandInfo.stdoutSearchToken = XmlUtils.getAttribute(statusCommandNode, NODE_ATTRIBUTE_STDOUT_SEARCH_TOKEN); } Element startCommandNode = getNoMoreThanOneChild(applicationNode, NODE_START_COMMAND); if (startCommandNode != null) { startCommandInfo.command = XmlUtils.getAttribute(startCommandNode, NODE_ATTRIBUTE_COMMAND); startCommandInfo.stdoutSearchToken = XmlUtils.getAttribute(startCommandNode, NODE_ATTRIBUTE_STDOUT_SEARCH_TOKEN); } Element stopCommandNode = getNoMoreThanOneChild(applicationNode, NODE_STOP_COMMAND); if (stopCommandNode != null) { stopCommandInfo.command = XmlUtils.getAttribute(stopCommandNode, NODE_ATTRIBUTE_COMMAND); stopCommandInfo.stdoutSearchToken = XmlUtils.getAttribute(stopCommandNode, NODE_ATTRIBUTE_STDOUT_SEARCH_TOKEN); } }
/** * * @param node the node {@link Element} * @param attributeName the attribute name * @return the attribute value * @throws XMLException if the mandatory attribute is missing or its value is empty */ public static String getMandatoryAttribute( Element node, String attributeName ) throws XMLException { String attributeValue = getAttribute(node, attributeName); if (StringUtils.isNullOrEmpty(attributeValue)) { throw new XMLException(node.getNodeName() + " is missing mandatory attribute '" + attributeName + "'"); } return attributeValue; }
this.port = XmlUtils.getAttribute(applicationNode, String sshPortString = XmlUtils.getAttribute(applicationNode, AtsProjectConfiguration.NODE_APPLICATION_PROPERTY_SSH_PORT); if (sshPortString != null) { this.systemPassword = XmlUtils.getAttribute(applicationNode, AtsProjectConfiguration.NODE_APPLICATION_PROPERTY_SYSTEM_PASSWORD); this.sshPrivateKey = XmlUtils.getAttribute(applicationNode, AtsProjectConfiguration.NODE_APPLICATION_PROPERTY_SSH_PRIVATE_KEY); this.sshPrivateKeyPassword = XmlUtils.getAttribute(applicationNode, AtsProjectConfiguration.NODE_APPLICATION_PROPERTY_SSH_PRIVATE_KEY_PASSWORD); this.javaExecutable = XmlUtils.getAttribute(applicationNode, this.memory = XmlUtils.getAttribute(applicationNode, AtsProjectConfiguration.NODE_APPLICATION_PROPERTY_MEMORY); String startupLatencyString = XmlUtils.getAttribute(applicationNode, AtsProjectConfiguration.NODE_APPLICATION_PROPERTY_STARTUP_LATENCY); if (startupLatencyString == null) {
this.home = IoUtils.normalizeDirPath(XmlUtils.getAttribute(sourceNode, AtsProjectConfiguration.NODE_ATTRIBUTE_HOME, ""));
for (Element commandNode : shellCommandsNodes) { String shellCommandAlias = XmlUtils.getAttribute(commandNode, NODE_ATTRIBUTE_ALIAS); String theCommand = commandNode.getTextContent();