}
throw ex;
}
// Create Result
GatewayListConnectionsResponse result = null;
// Deserialize Response
InputStream responseContent = httpResponse.getEntity().getContent();
result = new GatewayListConnectionsResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element connectionsSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "Connections");
if (connectionsSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(connectionsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Connection").size(); i1 = i1 + 1) {
org.w3c.dom.Element connectionsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(connectionsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Connection").get(i1));
GatewayListConnectionsResponse.GatewayConnection connectionInstance = new GatewayListConnectionsResponse.GatewayConnection();
result.getConnections().add(connectionInstance);
Element localNetworkSiteNameElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "LocalNetworkSiteName");
if (localNetworkSiteNameElement != null) {
String localNetworkSiteNameInstance;
localNetworkSiteNameInstance = localNetworkSiteNameElement.getTextContent();
connectionInstance.setLocalNetworkSiteName(localNetworkSiteNameInstance);
}
Element connectivityStateElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "ConnectivityState");
if (connectivityStateElement != null) {
GatewayConnectivityState connectivityStateInstance;
connectivityStateInstance = GatewayConnectivityState.valueOf(connectivityStateElement.getTextContent());
connectionInstance.setConnectivityState(connectivityStateInstance);
}
Element lastEventElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "LastEvent");
if (lastEventElement != null) {
GatewayEvent lastEventInstance = new GatewayEvent();
connectionInstance.setLastEvent(lastEventInstance);
Element timestampElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Timestamp");
if (timestampElement != null) {
Calendar timestampInstance;
timestampInstance = DatatypeConverter.parseDateTime(timestampElement.getTextContent());
lastEventInstance.setTimestamp(timestampInstance);
}
Element idElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Id");
if (idElement != null) {
String idInstance;
idInstance = idElement.getTextContent();
lastEventInstance.setId(idInstance);
}
Element messageElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Message");
if (messageElement != null) {
String messageInstance;
messageInstance = messageElement.getTextContent();
lastEventInstance.setMessage(messageInstance);
}
Element dataElement = XmlUtility.getElementByTagNameNS(lastEventElement, "http://schemas.microsoft.com/windowsazure", "Data");
if (dataElement != null) {
String dataInstance;
dataInstance = dataElement.getTextContent();
lastEventInstance.setData(dataInstance);
}
}
Element ingressBytesTransferredElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "IngressBytesTransferred");
if (ingressBytesTransferredElement != null) {
long ingressBytesTransferredInstance;
ingressBytesTransferredInstance = DatatypeConverter.parseLong(ingressBytesTransferredElement.getTextContent());
connectionInstance.setIngressBytesTransferred(ingressBytesTransferredInstance);
}
Element egressBytesTransferredElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "EgressBytesTransferred");
if (egressBytesTransferredElement != null) {
long egressBytesTransferredInstance;
egressBytesTransferredInstance = DatatypeConverter.parseLong(egressBytesTransferredElement.getTextContent());
connectionInstance.setEgressBytesTransferred(egressBytesTransferredInstance);
}
Element lastConnectionEstablishedElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "LastConnectionEstablished");
if (lastConnectionEstablishedElement != null) {
Calendar lastConnectionEstablishedInstance;
lastConnectionEstablishedInstance = DatatypeConverter.parseDateTime(lastConnectionEstablishedElement.getTextContent());
connectionInstance.setLastConnectionEstablished(lastConnectionEstablishedInstance);
}
Element allocatedIPAddressesSequenceElement = XmlUtility.getElementByTagNameNS(connectionsElement, "http://schemas.microsoft.com/windowsazure", "AllocatedIPAddresses");
if (allocatedIPAddressesSequenceElement != null) {
for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(allocatedIPAddressesSequenceElement, "http://schemas.microsoft.com/windowsazure", "string").size(); i2 = i2 + 1) {
org.w3c.dom.Element allocatedIPAddressesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(allocatedIPAddressesSequenceElement, "http://schemas.microsoft.com/windowsazure", "string").get(i2));
connectionInstance.getAllocatedIPAddresses().add(allocatedIPAddressesElement.getTextContent());
}
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}