if (hostNameAttrValue != null && hostNameAttrValue.length() != 0) {
hostAddress = hostNameAttrValue;
}
}
SecretResolver secretResolver = SecretResolverFactory.create(rootEle, false);
NodeList childNodes = rootEle.getElementsByTagName("transport");
for (int i = 0; i < childNodes.getLength(); i++) {
Element transportEle = (Element) childNodes.item(i);
NamedNodeMap transportAttribs = transportEle.getAttributes();
//Create the password manager
Node nameAttrib = transportAttribs.getNamedItem("name");
String transportName;
if (nameAttrib == null ||
(transportName = nameAttrib.getNodeValue()) == null ||
transportName.trim().length() == 0) {
throw new RuntimeException("Required attribute, transport name is not specified.");
}
Node classAttrib = transportAttribs.getNamedItem("class");
String clazz;
if (classAttrib == null ||
(clazz = classAttrib.getNodeValue()) == null ||
clazz.trim().length() == 0) {
throw new RuntimeException("Required attribute, transport class is not specified.");
}
Transport transportImpl = (Transport) Class.forName(clazz).newInstance();
transports.put(transportName, transportImpl);
Map<String, TransportParameter> transportParameters =
new HashMap<String, TransportParameter>();
NodeList parameterList = transportEle.getElementsByTagName("parameter");
for (int j = 0; j < parameterList.getLength(); j++) {
Element paramEle = (Element) parameterList.item(j);
String value = null;
NodeList values = paramEle.getChildNodes();
for (int k = 0; k < values.getLength(); k++) {
Node node = values.item(k);
if ((value = node.getNodeValue().trim()).length() != 0) {
break;
}
}
String paramName = paramEle.getAttribute("name");
if (secretResolver != null && secretResolver.isInitialized() &&
secretResolver.isTokenProtected("transports." + transportName + "." + paramName)) {
value = secretResolver.resolve("transports." + transportName + "." + paramName);
}
value = replaceSystemProperty(value);
transportParameters.put(paramName, new TransportParameter(paramName, value));
}
transportImpl.setName(transportName);