Example usage for javax.xml.bind DatatypeConverter parseBoolean

List of usage examples for javax.xml.bind DatatypeConverter parseBoolean

Introduction

In this page you can find the example usage for javax.xml.bind DatatypeConverter parseBoolean.

Prototype

public static boolean parseBoolean(String lexicalXSDBoolean) 

Source Link

Document

Converts the string argument into a boolean value.

Usage

From source file:com.microsoft.windowsazure.management.websites.WebSiteOperationsImpl.java

/**
* Returns list of all backups which are tracked by the system.
*
* @param webSpaceName Required. The name of the web space.
* @param webSiteName Required. The name of the web site.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.//from www  . j a v a  2  s  . c o  m
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @return List of backups for the website.
*/
@Override
public WebSiteGetBackupsResponse listBackups(String webSpaceName, String webSiteName)
        throws IOException, ServiceException, ParserConfigurationException, SAXException {
    // Validate
    if (webSpaceName == null) {
        throw new NullPointerException("webSpaceName");
    }
    if (webSiteName == null) {
        throw new NullPointerException("webSiteName");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("webSpaceName", webSpaceName);
        tracingParameters.put("webSiteName", webSiteName);
        CloudTracing.enter(invocationId, this, "listBackupsAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/WebSpaces/";
    url = url + URLEncoder.encode(webSpaceName, "UTF-8");
    url = url + "/sites/";
    url = url + URLEncoder.encode(webSiteName, "UTF-8");
    url = url + "/restore";
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2014-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        WebSiteGetBackupsResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new WebSiteGetBackupsResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element backupItemsElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "BackupItems");
            if (backupItemsElement != null) {
                if (backupItemsElement != null) {
                    for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(backupItemsElement,
                                    "http://schemas.microsoft.com/windowsazure", "BackupItem")
                            .size(); i1 = i1 + 1) {
                        org.w3c.dom.Element backupItemsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(backupItemsElement,
                                        "http://schemas.microsoft.com/windowsazure", "BackupItem")
                                .get(i1));
                        BackupItem backupItemInstance = new BackupItem();
                        result.getBackupItems().add(backupItemInstance);

                        Element storageAccountUrlElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "StorageAccountUrl");
                        if (storageAccountUrlElement != null) {
                            String storageAccountUrlInstance;
                            storageAccountUrlInstance = storageAccountUrlElement.getTextContent();
                            backupItemInstance.setStorageAccountUrl(storageAccountUrlInstance);
                        }

                        Element blobNameElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "BlobName");
                        if (blobNameElement != null) {
                            String blobNameInstance;
                            blobNameInstance = blobNameElement.getTextContent();
                            backupItemInstance.setBlobName(blobNameInstance);
                        }

                        Element nameElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement != null) {
                            String nameInstance;
                            nameInstance = nameElement.getTextContent();
                            backupItemInstance.setName(nameInstance);
                        }

                        Element statusElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "Status");
                        if (statusElement != null && statusElement.getTextContent() != null
                                && !statusElement.getTextContent().isEmpty()) {
                            BackupItemStatus statusInstance;
                            statusInstance = BackupItemStatus.valueOf(statusElement.getTextContent());
                            backupItemInstance.setStatus(statusInstance);
                        }

                        Element sizeInBytesElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "SizeInBytes");
                        if (sizeInBytesElement != null) {
                            long sizeInBytesInstance;
                            sizeInBytesInstance = DatatypeConverter
                                    .parseLong(sizeInBytesElement.getTextContent());
                            backupItemInstance.setSizeInBytes(sizeInBytesInstance);
                        }

                        Element createdElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "Created");
                        if (createdElement != null && createdElement.getTextContent() != null
                                && !createdElement.getTextContent().isEmpty()) {
                            Calendar createdInstance;
                            createdInstance = DatatypeConverter.parseDateTime(createdElement.getTextContent());
                            backupItemInstance.setCreated(createdInstance);
                        }

                        Element logElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "Log");
                        if (logElement != null) {
                            String logInstance;
                            logInstance = logElement.getTextContent();
                            backupItemInstance.setLog(logInstance);
                        }

                        Element databasesSequenceElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "Databases");
                        if (databasesSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(databasesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "DatabaseBackupSetting")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element databasesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(databasesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DatabaseBackupSetting")
                                        .get(i2));
                                DatabaseBackupSetting databaseBackupSettingInstance = new DatabaseBackupSetting();
                                backupItemInstance.getDatabases().add(databaseBackupSettingInstance);

                                Element connectionStringElement = XmlUtility.getElementByTagNameNS(
                                        databasesElement, "http://schemas.microsoft.com/windowsazure",
                                        "ConnectionString");
                                if (connectionStringElement != null) {
                                    String connectionStringInstance;
                                    connectionStringInstance = connectionStringElement.getTextContent();
                                    databaseBackupSettingInstance.setConnectionString(connectionStringInstance);
                                }

                                Element connectionStringNameElement = XmlUtility.getElementByTagNameNS(
                                        databasesElement, "http://schemas.microsoft.com/windowsazure",
                                        "ConnectionStringName");
                                if (connectionStringNameElement != null) {
                                    String connectionStringNameInstance;
                                    connectionStringNameInstance = connectionStringNameElement.getTextContent();
                                    databaseBackupSettingInstance
                                            .setConnectionStringName(connectionStringNameInstance);
                                }

                                Element databaseTypeElement = XmlUtility.getElementByTagNameNS(databasesElement,
                                        "http://schemas.microsoft.com/windowsazure", "DatabaseType");
                                if (databaseTypeElement != null) {
                                    String databaseTypeInstance;
                                    databaseTypeInstance = databaseTypeElement.getTextContent();
                                    databaseBackupSettingInstance.setDatabaseType(databaseTypeInstance);
                                }

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(databasesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    databaseBackupSettingInstance.setName(nameInstance2);
                                }
                            }
                        }

                        Element scheduledElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "Scheduled");
                        if (scheduledElement != null) {
                            boolean scheduledInstance;
                            scheduledInstance = DatatypeConverter
                                    .parseBoolean(scheduledElement.getTextContent().toLowerCase());
                            backupItemInstance.setScheduled(scheduledInstance);
                        }

                        Element lastRestoreTimeStampElement = XmlUtility.getElementByTagNameNS(
                                backupItemsElement2, "http://schemas.microsoft.com/windowsazure",
                                "LastRestoreTimeStamp");
                        if (lastRestoreTimeStampElement != null
                                && lastRestoreTimeStampElement.getTextContent() != null
                                && !lastRestoreTimeStampElement.getTextContent().isEmpty()) {
                            Calendar lastRestoreTimeStampInstance;
                            lastRestoreTimeStampInstance = DatatypeConverter
                                    .parseDateTime(lastRestoreTimeStampElement.getTextContent());
                            backupItemInstance.setLastRestoreTimeStamp(lastRestoreTimeStampInstance);
                        }

                        Element finishedTimeStampElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "FinishedTimeStamp");
                        if (finishedTimeStampElement != null
                                && finishedTimeStampElement.getTextContent() != null
                                && !finishedTimeStampElement.getTextContent().isEmpty()) {
                            Calendar finishedTimeStampInstance;
                            finishedTimeStampInstance = DatatypeConverter
                                    .parseDateTime(finishedTimeStampElement.getTextContent());
                            backupItemInstance.setFinishedTimeStamp(finishedTimeStampInstance);
                        }

                        Element correlationIdElement = XmlUtility.getElementByTagNameNS(backupItemsElement2,
                                "http://schemas.microsoft.com/windowsazure", "CorrelationId");
                        if (correlationIdElement != null) {
                            String correlationIdInstance;
                            correlationIdInstance = correlationIdElement.getTextContent();
                            backupItemInstance.setCorrelationId(correlationIdInstance);
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.HostedServiceOperationsImpl.java

/**
* The List Available Extensions operation lists the extensions that are
* available to add to your cloud service. In Windows Azure, a process can
* run as an extension of a cloud service. For example, Remote Desktop
* Access or the Azure Diagnostics Agent can run as extensions to the cloud
* service.  (see//www .  j a va 2 s .c om
* http://msdn.microsoft.com/en-us/library/windowsazure/dn169559.aspx for
* more information)
*
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The List Available Extensions operation response.
*/
@Override
public HostedServiceListAvailableExtensionsResponse listAvailableExtensions()
        throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
    // Validate

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        CloudTracing.enter(invocationId, this, "listAvailableExtensionsAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/extensions";
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        HostedServiceListAvailableExtensionsResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new HostedServiceListAvailableExtensionsResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element extensionImagesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "ExtensionImages");
            if (extensionImagesSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                        .getElementsByTagNameNS(extensionImagesSequenceElement,
                                "http://schemas.microsoft.com/windowsazure", "ExtensionImage")
                        .size(); i1 = i1 + 1) {
                    org.w3c.dom.Element extensionImagesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(extensionImagesSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "ExtensionImage")
                            .get(i1));
                    ExtensionImage extensionImageInstance = new ExtensionImage();
                    result.getExtensionImages().add(extensionImageInstance);

                    Element providerNameSpaceElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "ProviderNameSpace");
                    if (providerNameSpaceElement != null) {
                        String providerNameSpaceInstance;
                        providerNameSpaceInstance = providerNameSpaceElement.getTextContent();
                        extensionImageInstance.setProviderNameSpace(providerNameSpaceInstance);
                    }

                    Element typeElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Type");
                    if (typeElement != null) {
                        String typeInstance;
                        typeInstance = typeElement.getTextContent();
                        extensionImageInstance.setType(typeInstance);
                    }

                    Element versionElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Version");
                    if (versionElement != null) {
                        String versionInstance;
                        versionInstance = versionElement.getTextContent();
                        extensionImageInstance.setVersion(versionInstance);
                    }

                    Element labelElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Label");
                    if (labelElement != null) {
                        String labelInstance;
                        labelInstance = labelElement.getTextContent();
                        extensionImageInstance.setLabel(labelInstance);
                    }

                    Element hostingResourcesElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "HostingResources");
                    if (hostingResourcesElement != null) {
                        String hostingResourcesInstance;
                        hostingResourcesInstance = hostingResourcesElement.getTextContent();
                        extensionImageInstance.setHostingResources(hostingResourcesInstance);
                    }

                    Element mediaLinkElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "MediaLink");
                    if (mediaLinkElement != null) {
                        URI mediaLinkInstance;
                        mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
                        extensionImageInstance.setMediaLink(mediaLinkInstance);
                    }

                    Element certificateElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Certificate");
                    if (certificateElement != null) {
                        ExtensionCertificateConfiguration certificateInstance = new ExtensionCertificateConfiguration();
                        extensionImageInstance.setCertificate(certificateInstance);

                        Element storeLocationElement = XmlUtility.getElementByTagNameNS(certificateElement,
                                "http://schemas.microsoft.com/windowsazure", "StoreLocation");
                        if (storeLocationElement != null) {
                            String storeLocationInstance;
                            storeLocationInstance = storeLocationElement.getTextContent();
                            certificateInstance.setStoreLocation(storeLocationInstance);
                        }

                        Element storeNameElement = XmlUtility.getElementByTagNameNS(certificateElement,
                                "http://schemas.microsoft.com/windowsazure", "StoreName");
                        if (storeNameElement != null) {
                            String storeNameInstance;
                            storeNameInstance = storeNameElement.getTextContent();
                            certificateInstance.setStoreName(storeNameInstance);
                        }

                        Element thumbprintRequiredElement = XmlUtility.getElementByTagNameNS(certificateElement,
                                "http://schemas.microsoft.com/windowsazure", "ThumbprintRequired");
                        if (thumbprintRequiredElement != null
                                && thumbprintRequiredElement.getTextContent() != null
                                && !thumbprintRequiredElement.getTextContent().isEmpty()) {
                            boolean thumbprintRequiredInstance;
                            thumbprintRequiredInstance = DatatypeConverter
                                    .parseBoolean(thumbprintRequiredElement.getTextContent().toLowerCase());
                            certificateInstance.setThumbprintRequired(thumbprintRequiredInstance);
                        }

                        Element thumbprintAlgorithmElement = XmlUtility.getElementByTagNameNS(
                                certificateElement, "http://schemas.microsoft.com/windowsazure",
                                "ThumbprintAlgorithm");
                        if (thumbprintAlgorithmElement != null) {
                            String thumbprintAlgorithmInstance;
                            thumbprintAlgorithmInstance = thumbprintAlgorithmElement.getTextContent();
                            certificateInstance.setThumbprintAlgorithm(thumbprintAlgorithmInstance);
                        }
                    }

                    Element endpointsElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Endpoints");
                    if (endpointsElement != null) {
                        ExtensionEndpointConfiguration endpointsInstance = new ExtensionEndpointConfiguration();
                        extensionImageInstance.setExtensionEndpoints(endpointsInstance);

                        Element inputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                endpointsElement, "http://schemas.microsoft.com/windowsazure",
                                "InputEndpoints");
                        if (inputEndpointsSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InputEndpoint")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InputEndpoint")
                                        .get(i2));
                                ExtensionEndpointConfiguration.InputEndpoint inputEndpointInstance = new ExtensionEndpointConfiguration.InputEndpoint();
                                endpointsInstance.getInputEndpoints().add(inputEndpointInstance);

                                Element nameElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement != null) {
                                    String nameInstance;
                                    nameInstance = nameElement.getTextContent();
                                    inputEndpointInstance.setName(nameInstance);
                                }

                                Element protocolElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement != null) {
                                    String protocolInstance;
                                    protocolInstance = protocolElement.getTextContent();
                                    inputEndpointInstance.setProtocol(protocolInstance);
                                }

                                Element portElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Port");
                                if (portElement != null) {
                                    int portInstance;
                                    portInstance = DatatypeConverter.parseInt(portElement.getTextContent());
                                    inputEndpointInstance.setPort(portInstance);
                                }

                                Element localPortElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LocalPort");
                                if (localPortElement != null) {
                                    String localPortInstance;
                                    localPortInstance = localPortElement.getTextContent();
                                    inputEndpointInstance.setLocalPort(localPortInstance);
                                }
                            }
                        }

                        Element internalEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                endpointsElement, "http://schemas.microsoft.com/windowsazure",
                                "InternalEndpoints");
                        if (internalEndpointsSequenceElement != null) {
                            for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(internalEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InternalEndpoint")
                                    .size(); i3 = i3 + 1) {
                                org.w3c.dom.Element internalEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(internalEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InternalEndpoint")
                                        .get(i3));
                                ExtensionEndpointConfiguration.InternalEndpoint internalEndpointInstance = new ExtensionEndpointConfiguration.InternalEndpoint();
                                endpointsInstance.getInternalEndpoints().add(internalEndpointInstance);

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(
                                        internalEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    internalEndpointInstance.setName(nameInstance2);
                                }

                                Element protocolElement2 = XmlUtility.getElementByTagNameNS(
                                        internalEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement2 != null) {
                                    String protocolInstance2;
                                    protocolInstance2 = protocolElement2.getTextContent();
                                    internalEndpointInstance.setProtocol(protocolInstance2);
                                }

                                Element portElement2 = XmlUtility.getElementByTagNameNS(
                                        internalEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Port");
                                if (portElement2 != null) {
                                    int portInstance2;
                                    portInstance2 = DatatypeConverter.parseInt(portElement2.getTextContent());
                                    internalEndpointInstance.setPort(portInstance2);
                                }
                            }
                        }

                        Element instanceInputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                endpointsElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceInputEndpoints");
                        if (instanceInputEndpointsSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(instanceInputEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "InstanceInputEndpoint")
                                    .size(); i4 = i4 + 1) {
                                org.w3c.dom.Element instanceInputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(instanceInputEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "InstanceInputEndpoint")
                                        .get(i4));
                                ExtensionEndpointConfiguration.InstanceInputEndpoint instanceInputEndpointInstance = new ExtensionEndpointConfiguration.InstanceInputEndpoint();
                                endpointsInstance.getInstanceInputEndpoints()
                                        .add(instanceInputEndpointInstance);

                                Element nameElement3 = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement3 != null) {
                                    String nameInstance3;
                                    nameInstance3 = nameElement3.getTextContent();
                                    instanceInputEndpointInstance.setName(nameInstance3);
                                }

                                Element protocolElement3 = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Protocol");
                                if (protocolElement3 != null) {
                                    String protocolInstance3;
                                    protocolInstance3 = protocolElement3.getTextContent();
                                    instanceInputEndpointInstance.setProtocol(protocolInstance3);
                                }

                                Element localPortElement2 = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "LocalPort");
                                if (localPortElement2 != null) {
                                    String localPortInstance2;
                                    localPortInstance2 = localPortElement2.getTextContent();
                                    instanceInputEndpointInstance.setLocalPort(localPortInstance2);
                                }

                                Element fixedPortMinElement = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "FixedPortMin");
                                if (fixedPortMinElement != null) {
                                    int fixedPortMinInstance;
                                    fixedPortMinInstance = DatatypeConverter
                                            .parseInt(fixedPortMinElement.getTextContent());
                                    instanceInputEndpointInstance.setFixedPortMin(fixedPortMinInstance);
                                }

                                Element fixedPortMaxElement = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "FixedPortMax");
                                if (fixedPortMaxElement != null) {
                                    int fixedPortMaxInstance;
                                    fixedPortMaxInstance = DatatypeConverter
                                            .parseInt(fixedPortMaxElement.getTextContent());
                                    instanceInputEndpointInstance.setFixedPortMax(fixedPortMaxInstance);
                                }
                            }
                        }
                    }

                    Element publicConfigurationSchemaElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "PublicConfigurationSchema");
                    if (publicConfigurationSchemaElement != null) {
                        String publicConfigurationSchemaInstance;
                        publicConfigurationSchemaInstance = publicConfigurationSchemaElement
                                .getTextContent() != null ? new String(
                                        Base64.decode(publicConfigurationSchemaElement.getTextContent()))
                                        : null;
                        extensionImageInstance.setPublicConfigurationSchema(publicConfigurationSchemaInstance);
                    }

                    Element privateConfigurationSchemaElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "PrivateConfigurationSchema");
                    if (privateConfigurationSchemaElement != null) {
                        String privateConfigurationSchemaInstance;
                        privateConfigurationSchemaInstance = privateConfigurationSchemaElement
                                .getTextContent() != null ? new String(
                                        Base64.decode(privateConfigurationSchemaElement.getTextContent()))
                                        : null;
                        extensionImageInstance
                                .setPrivateConfigurationSchema(privateConfigurationSchemaInstance);
                    }

                    Element descriptionElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Description");
                    if (descriptionElement != null) {
                        String descriptionInstance;
                        descriptionInstance = descriptionElement.getTextContent();
                        extensionImageInstance.setDescription(descriptionInstance);
                    }

                    Element publisherNameElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "PublisherName");
                    if (publisherNameElement != null) {
                        String publisherNameInstance;
                        publisherNameInstance = publisherNameElement.getTextContent();
                        extensionImageInstance.setPublisherName(publisherNameInstance);
                    }

                    Element publishedDateElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "PublishedDate");
                    if (publishedDateElement != null && publishedDateElement.getTextContent() != null
                            && !publishedDateElement.getTextContent().isEmpty()) {
                        Calendar publishedDateInstance;
                        publishedDateInstance = DatatypeConverter
                                .parseDateTime(publishedDateElement.getTextContent());
                        extensionImageInstance.setPublishedDate(publishedDateInstance);
                    }

                    Element localResourcesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "LocalResources");
                    if (localResourcesSequenceElement != null) {
                        for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(localResourcesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "LocalResource")
                                .size(); i5 = i5 + 1) {
                            org.w3c.dom.Element localResourcesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(localResourcesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "LocalResource")
                                    .get(i5));
                            ExtensionLocalResourceConfiguration localResourceInstance = new ExtensionLocalResourceConfiguration();
                            extensionImageInstance.getLocalResources().add(localResourceInstance);

                            Element nameElement4 = XmlUtility.getElementByTagNameNS(localResourcesElement,
                                    "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement4 != null) {
                                String nameInstance4;
                                nameInstance4 = nameElement4.getTextContent();
                                localResourceInstance.setName(nameInstance4);
                            }

                            Element sizeInMBElement = XmlUtility.getElementByTagNameNS(localResourcesElement,
                                    "http://schemas.microsoft.com/windowsazure", "SizeInMB");
                            if (sizeInMBElement != null && sizeInMBElement.getTextContent() != null
                                    && !sizeInMBElement.getTextContent().isEmpty()) {
                                int sizeInMBInstance;
                                sizeInMBInstance = DatatypeConverter.parseInt(sizeInMBElement.getTextContent());
                                localResourceInstance.setSizeInMB(sizeInMBInstance);
                            }
                        }
                    }

                    Element blockRoleUponFailureElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "BlockRoleUponFailure");
                    if (blockRoleUponFailureElement != null
                            && blockRoleUponFailureElement.getTextContent() != null
                            && !blockRoleUponFailureElement.getTextContent().isEmpty()) {
                        boolean blockRoleUponFailureInstance;
                        blockRoleUponFailureInstance = DatatypeConverter
                                .parseBoolean(blockRoleUponFailureElement.getTextContent().toLowerCase());
                        extensionImageInstance.setBlockRoleUponFailure(blockRoleUponFailureInstance);
                    }

                    Element isInternalExtensionElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "IsInternalExtension");
                    if (isInternalExtensionElement != null
                            && isInternalExtensionElement.getTextContent() != null
                            && !isInternalExtensionElement.getTextContent().isEmpty()) {
                        boolean isInternalExtensionInstance;
                        isInternalExtensionInstance = DatatypeConverter
                                .parseBoolean(isInternalExtensionElement.getTextContent().toLowerCase());
                        extensionImageInstance.setIsInternalExtension(isInternalExtensionInstance);
                    }

                    Element sampleConfigElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "SampleConfig");
                    if (sampleConfigElement != null) {
                        String sampleConfigInstance;
                        sampleConfigInstance = sampleConfigElement.getTextContent() != null
                                ? new String(Base64.decode(sampleConfigElement.getTextContent()))
                                : null;
                        extensionImageInstance.setSampleConfig(sampleConfigInstance);
                    }

                    Element replicationCompletedElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "ReplicationCompleted");
                    if (replicationCompletedElement != null
                            && replicationCompletedElement.getTextContent() != null
                            && !replicationCompletedElement.getTextContent().isEmpty()) {
                        boolean replicationCompletedInstance;
                        replicationCompletedInstance = DatatypeConverter
                                .parseBoolean(replicationCompletedElement.getTextContent().toLowerCase());
                        extensionImageInstance.setReplicationCompleted(replicationCompletedInstance);
                    }

                    Element eulaElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Eula");
                    if (eulaElement != null) {
                        URI eulaInstance;
                        eulaInstance = new URI(eulaElement.getTextContent());
                        extensionImageInstance.setEula(eulaInstance);
                    }

                    Element privacyUriElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "PrivacyUri");
                    if (privacyUriElement != null) {
                        URI privacyUriInstance;
                        privacyUriInstance = new URI(privacyUriElement.getTextContent());
                        extensionImageInstance.setPrivacyUri(privacyUriInstance);
                    }

                    Element homepageUriElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "HomepageUri");
                    if (homepageUriElement != null) {
                        URI homepageUriInstance;
                        homepageUriInstance = new URI(homepageUriElement.getTextContent());
                        extensionImageInstance.setHomepageUri(homepageUriInstance);
                    }

                    Element isJsonExtensionElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "IsJsonExtension");
                    if (isJsonExtensionElement != null && isJsonExtensionElement.getTextContent() != null
                            && !isJsonExtensionElement.getTextContent().isEmpty()) {
                        boolean isJsonExtensionInstance;
                        isJsonExtensionInstance = DatatypeConverter
                                .parseBoolean(isJsonExtensionElement.getTextContent().toLowerCase());
                        extensionImageInstance.setIsJsonExtension(isJsonExtensionInstance);
                    }

                    Element disallowMajorVersionUpgradeElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "DisallowMajorVersionUpgrade");
                    if (disallowMajorVersionUpgradeElement != null
                            && disallowMajorVersionUpgradeElement.getTextContent() != null
                            && !disallowMajorVersionUpgradeElement.getTextContent().isEmpty()) {
                        boolean disallowMajorVersionUpgradeInstance;
                        disallowMajorVersionUpgradeInstance = DatatypeConverter.parseBoolean(
                                disallowMajorVersionUpgradeElement.getTextContent().toLowerCase());
                        extensionImageInstance
                                .setDisallowMajorVersionUpgrade(disallowMajorVersionUpgradeInstance);
                    }

                    Element supportedOSElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "SupportedOS");
                    if (supportedOSElement != null) {
                        String supportedOSInstance;
                        supportedOSInstance = supportedOSElement.getTextContent();
                        extensionImageInstance.setSupportedOS(supportedOSInstance);
                    }

                    Element companyNameElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "CompanyName");
                    if (companyNameElement != null) {
                        String companyNameInstance;
                        companyNameInstance = companyNameElement.getTextContent();
                        extensionImageInstance.setCompanyName(companyNameInstance);
                    }

                    Element regionsElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Regions");
                    if (regionsElement != null) {
                        String regionsInstance;
                        regionsInstance = regionsElement.getTextContent();
                        extensionImageInstance.setRegions(regionsInstance);
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.websites.WebSiteOperationsImpl.java

/**
* You can update the settings for a web site by using the HTTP PUT method
* and by specifying the settings in the request body.  (see
* http://msdn.microsoft.com/en-us/library/windowsazure/dn167005.aspx for
* more information)//from   w w w .jav  a  2 s.  c o m
*
* @param webSpaceName Required. The name of the web space.
* @param webSiteName Required. The name of the web site.
* @param parameters Required. Parameters supplied to the Update Web Site
* operation.
* @throws ParserConfigurationException Thrown if there was an error
* configuring the parser for the response body.
* @throws SAXException Thrown if there was an error parsing the response
* body.
* @throws TransformerException Thrown if there was an error creating the
* DOM transformer.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The Update Web Site operation response.
*/
@Override
public WebSiteUpdateResponse update(String webSpaceName, String webSiteName, WebSiteUpdateParameters parameters)
        throws ParserConfigurationException, SAXException, TransformerException, IOException, ServiceException,
        URISyntaxException {
    // Validate
    if (webSpaceName == null) {
        throw new NullPointerException("webSpaceName");
    }
    if (webSiteName == null) {
        throw new NullPointerException("webSiteName");
    }
    if (parameters == null) {
        throw new NullPointerException("parameters");
    }
    if (parameters.getHostNameSslStates() != null) {
        for (WebSiteUpdateParameters.WebSiteHostNameSslState hostNameSslStatesParameterItem : parameters
                .getHostNameSslStates()) {
            if (hostNameSslStatesParameterItem.getName() == null) {
                throw new NullPointerException("parameters.HostNameSslStates.Name");
            }
            if (hostNameSslStatesParameterItem.getSslState() == null) {
                throw new NullPointerException("parameters.HostNameSslStates.SslState");
            }
        }
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("webSpaceName", webSpaceName);
        tracingParameters.put("webSiteName", webSiteName);
        tracingParameters.put("parameters", parameters);
        CloudTracing.enter(invocationId, this, "updateAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/WebSpaces/";
    url = url + URLEncoder.encode(webSpaceName, "UTF-8");
    url = url + "/sites/";
    url = url + URLEncoder.encode(webSiteName, "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpPut httpRequest = new HttpPut(url);

    // Set Headers
    httpRequest.setHeader("Content-Type", "application/xml");
    httpRequest.setHeader("x-ms-version", "2014-04-01");

    // Serialize Request
    String requestContent = null;
    DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
    DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
    Document requestDoc = documentBuilder.newDocument();

    Element siteElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "Site");
    requestDoc.appendChild(siteElement);

    if (parameters.getHostNameSslStates() != null) {
        if (parameters.getHostNameSslStates() instanceof LazyCollection == false
                || ((LazyCollection) parameters.getHostNameSslStates()).isInitialized()) {
            Element hostNameSslStatesSequenceElement = requestDoc
                    .createElementNS("http://schemas.microsoft.com/windowsazure", "HostNameSslStates");
            for (WebSiteUpdateParameters.WebSiteHostNameSslState hostNameSslStatesItem : parameters
                    .getHostNameSslStates()) {
                Element webSiteHostNameSslStateElement = requestDoc.createElementNS(
                        "http://schemas.microsoft.com/windowsazure", "WebSiteHostNameSslState");
                hostNameSslStatesSequenceElement.appendChild(webSiteHostNameSslStateElement);

                Element nameElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure",
                        "Name");
                nameElement.appendChild(requestDoc.createTextNode(hostNameSslStatesItem.getName()));
                webSiteHostNameSslStateElement.appendChild(nameElement);

                Element sslStateElement = requestDoc
                        .createElementNS("http://schemas.microsoft.com/windowsazure", "SslState");
                sslStateElement
                        .appendChild(requestDoc.createTextNode(hostNameSslStatesItem.getSslState().toString()));
                webSiteHostNameSslStateElement.appendChild(sslStateElement);

                if (hostNameSslStatesItem.getThumbprint() != null) {
                    Element thumbprintElement = requestDoc
                            .createElementNS("http://schemas.microsoft.com/windowsazure", "Thumbprint");
                    thumbprintElement
                            .appendChild(requestDoc.createTextNode(hostNameSslStatesItem.getThumbprint()));
                    webSiteHostNameSslStateElement.appendChild(thumbprintElement);
                } else {
                    Element emptyElement = requestDoc
                            .createElementNS("http://schemas.microsoft.com/windowsazure", "Thumbprint");
                    Attr nilAttribute = requestDoc
                            .createAttributeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                    nilAttribute.setValue("true");
                    emptyElement.setAttributeNode(nilAttribute);
                    webSiteHostNameSslStateElement.appendChild(emptyElement);
                }

                Element toUpdateElement = requestDoc
                        .createElementNS("http://schemas.microsoft.com/windowsazure", "ToUpdate");
                toUpdateElement.appendChild(requestDoc.createTextNode("true"));
                webSiteHostNameSslStateElement.appendChild(toUpdateElement);
            }
            siteElement.appendChild(hostNameSslStatesSequenceElement);
        }
    }

    if (parameters.getHostNames() != null) {
        if (parameters.getHostNames() instanceof LazyCollection == false
                || ((LazyCollection) parameters.getHostNames()).isInitialized()) {
            Element hostNamesSequenceElement = requestDoc
                    .createElementNS("http://schemas.microsoft.com/windowsazure", "HostNames");
            for (String hostNamesItem : parameters.getHostNames()) {
                Element hostNamesItemElement = requestDoc
                        .createElementNS("http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string");
                hostNamesItemElement.appendChild(requestDoc.createTextNode(hostNamesItem));
                hostNamesSequenceElement.appendChild(hostNamesItemElement);
            }
            siteElement.appendChild(hostNamesSequenceElement);
        }
    }

    if (parameters.getServerFarm() != null) {
        Element serverFarmElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure",
                "ServerFarm");
        serverFarmElement.appendChild(requestDoc.createTextNode(parameters.getServerFarm()));
        siteElement.appendChild(serverFarmElement);
    }

    if (parameters.getState() != null) {
        Element stateElement = requestDoc.createElementNS("http://schemas.microsoft.com/windowsazure", "State");
        stateElement.appendChild(requestDoc.createTextNode(parameters.getState()));
        siteElement.appendChild(stateElement);
    }

    DOMSource domSource = new DOMSource(requestDoc);
    StringWriter stringWriter = new StringWriter();
    StreamResult streamResult = new StreamResult(stringWriter);
    TransformerFactory transformerFactory = TransformerFactory.newInstance();
    Transformer transformer = transformerFactory.newTransformer();
    transformer.transform(domSource, streamResult);
    requestContent = stringWriter.toString();
    StringEntity entity = new StringEntity(requestContent);
    httpRequest.setEntity(entity);
    httpRequest.setHeader("Content-Type", "application/xml");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, requestContent, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        WebSiteUpdateResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new WebSiteUpdateResponse();
            DocumentBuilderFactory documentBuilderFactory2 = DocumentBuilderFactory.newInstance();
            documentBuilderFactory2.setNamespaceAware(true);
            DocumentBuilder documentBuilder2 = documentBuilderFactory2.newDocumentBuilder();
            Document responseDoc = documentBuilder2.parse(new BOMInputStream(responseContent));

            Element siteElement2 = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "Site");
            if (siteElement2 != null) {
                WebSite webSiteInstance = new WebSite();
                result.setWebSite(webSiteInstance);

                Element adminEnabledElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "AdminEnabled");
                if (adminEnabledElement != null && adminEnabledElement.getTextContent() != null
                        && !adminEnabledElement.getTextContent().isEmpty()) {
                    boolean adminEnabledInstance;
                    adminEnabledInstance = DatatypeConverter
                            .parseBoolean(adminEnabledElement.getTextContent().toLowerCase());
                    webSiteInstance.setAdminEnabled(adminEnabledInstance);
                }

                Element availabilityStateElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "AvailabilityState");
                if (availabilityStateElement != null && availabilityStateElement.getTextContent() != null
                        && !availabilityStateElement.getTextContent().isEmpty()) {
                    WebSpaceAvailabilityState availabilityStateInstance;
                    availabilityStateInstance = WebSpaceAvailabilityState
                            .valueOf(availabilityStateElement.getTextContent());
                    webSiteInstance.setAvailabilityState(availabilityStateInstance);
                }

                Element sKUElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "SKU");
                if (sKUElement != null && sKUElement.getTextContent() != null
                        && !sKUElement.getTextContent().isEmpty()) {
                    SkuOptions sKUInstance;
                    sKUInstance = SkuOptions.valueOf(sKUElement.getTextContent());
                    webSiteInstance.setSku(sKUInstance);
                }

                Element enabledElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "Enabled");
                if (enabledElement != null && enabledElement.getTextContent() != null
                        && !enabledElement.getTextContent().isEmpty()) {
                    boolean enabledInstance;
                    enabledInstance = DatatypeConverter
                            .parseBoolean(enabledElement.getTextContent().toLowerCase());
                    webSiteInstance.setEnabled(enabledInstance);
                }

                Element enabledHostNamesSequenceElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "EnabledHostNames");
                if (enabledHostNamesSequenceElement != null) {
                    for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(enabledHostNamesSequenceElement,
                                    "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string")
                            .size(); i1 = i1 + 1) {
                        org.w3c.dom.Element enabledHostNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(enabledHostNamesSequenceElement,
                                        "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string")
                                .get(i1));
                        webSiteInstance.getEnabledHostNames().add(enabledHostNamesElement.getTextContent());
                    }
                }

                Element hostNameSslStatesSequenceElement2 = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "HostNameSslStates");
                if (hostNameSslStatesSequenceElement2 != null) {
                    for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(hostNameSslStatesSequenceElement2,
                                    "http://schemas.microsoft.com/windowsazure", "HostNameSslState")
                            .size(); i2 = i2 + 1) {
                        org.w3c.dom.Element hostNameSslStatesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(hostNameSslStatesSequenceElement2,
                                        "http://schemas.microsoft.com/windowsazure", "HostNameSslState")
                                .get(i2));
                        WebSite.WebSiteHostNameSslState hostNameSslStateInstance = new WebSite.WebSiteHostNameSslState();
                        webSiteInstance.getHostNameSslStates().add(hostNameSslStateInstance);

                        Element nameElement2 = XmlUtility.getElementByTagNameNS(hostNameSslStatesElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement2 != null) {
                            String nameInstance;
                            nameInstance = nameElement2.getTextContent();
                            hostNameSslStateInstance.setName(nameInstance);
                        }

                        Element sslStateElement2 = XmlUtility.getElementByTagNameNS(hostNameSslStatesElement,
                                "http://schemas.microsoft.com/windowsazure", "SslState");
                        if (sslStateElement2 != null && sslStateElement2.getTextContent() != null
                                && !sslStateElement2.getTextContent().isEmpty()) {
                            WebSiteSslState sslStateInstance;
                            sslStateInstance = WebSiteSslState.valueOf(sslStateElement2.getTextContent());
                            hostNameSslStateInstance.setSslState(sslStateInstance);
                        }

                        Element thumbprintElement2 = XmlUtility.getElementByTagNameNS(hostNameSslStatesElement,
                                "http://schemas.microsoft.com/windowsazure", "Thumbprint");
                        if (thumbprintElement2 != null) {
                            boolean isNil = false;
                            Attr nilAttribute2 = thumbprintElement2
                                    .getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                            if (nilAttribute2 != null) {
                                isNil = "true".equals(nilAttribute2.getValue());
                            }
                            if (isNil == false) {
                                String thumbprintInstance;
                                thumbprintInstance = thumbprintElement2.getTextContent();
                                hostNameSslStateInstance.setThumbprint(thumbprintInstance);
                            }
                        }

                        Element virtualIPElement = XmlUtility.getElementByTagNameNS(hostNameSslStatesElement,
                                "http://schemas.microsoft.com/windowsazure", "VirtualIP");
                        if (virtualIPElement != null) {
                            boolean isNil2 = false;
                            Attr nilAttribute3 = virtualIPElement
                                    .getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
                            if (nilAttribute3 != null) {
                                isNil2 = "true".equals(nilAttribute3.getValue());
                            }
                            if (isNil2 == false) {
                                InetAddress virtualIPInstance;
                                virtualIPInstance = InetAddress.getByName(virtualIPElement.getTextContent());
                                hostNameSslStateInstance.setVirtualIP(virtualIPInstance);
                            }
                        }
                    }
                }

                Element hostNamesSequenceElement2 = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "HostNames");
                if (hostNamesSequenceElement2 != null) {
                    for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(hostNamesSequenceElement2,
                                    "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string")
                            .size(); i3 = i3 + 1) {
                        org.w3c.dom.Element hostNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(hostNamesSequenceElement2,
                                        "http://schemas.microsoft.com/2003/10/Serialization/Arrays", "string")
                                .get(i3));
                        webSiteInstance.getHostNames().add(hostNamesElement.getTextContent());
                    }
                }

                Element lastModifiedTimeUtcElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "LastModifiedTimeUtc");
                if (lastModifiedTimeUtcElement != null && lastModifiedTimeUtcElement.getTextContent() != null
                        && !lastModifiedTimeUtcElement.getTextContent().isEmpty()) {
                    Calendar lastModifiedTimeUtcInstance;
                    lastModifiedTimeUtcInstance = DatatypeConverter
                            .parseDateTime(lastModifiedTimeUtcElement.getTextContent());
                    webSiteInstance.setLastModifiedTimeUtc(lastModifiedTimeUtcInstance);
                }

                Element nameElement3 = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement3 != null) {
                    String nameInstance2;
                    nameInstance2 = nameElement3.getTextContent();
                    webSiteInstance.setName(nameInstance2);
                }

                Element repositorySiteNameElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "RepositorySiteName");
                if (repositorySiteNameElement != null) {
                    String repositorySiteNameInstance;
                    repositorySiteNameInstance = repositorySiteNameElement.getTextContent();
                    webSiteInstance.setRepositorySiteName(repositorySiteNameInstance);
                }

                Element runtimeAvailabilityStateElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "RuntimeAvailabilityState");
                if (runtimeAvailabilityStateElement != null
                        && runtimeAvailabilityStateElement.getTextContent() != null
                        && !runtimeAvailabilityStateElement.getTextContent().isEmpty()) {
                    WebSiteRuntimeAvailabilityState runtimeAvailabilityStateInstance;
                    runtimeAvailabilityStateInstance = WebSiteRuntimeAvailabilityState
                            .valueOf(runtimeAvailabilityStateElement.getTextContent());
                    webSiteInstance.setRuntimeAvailabilityState(runtimeAvailabilityStateInstance);
                }

                Element selfLinkElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "SelfLink");
                if (selfLinkElement != null) {
                    URI selfLinkInstance;
                    selfLinkInstance = new URI(selfLinkElement.getTextContent());
                    webSiteInstance.setUri(selfLinkInstance);
                }

                Element serverFarmElement2 = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "ServerFarm");
                if (serverFarmElement2 != null) {
                    String serverFarmInstance;
                    serverFarmInstance = serverFarmElement2.getTextContent();
                    webSiteInstance.setServerFarm(serverFarmInstance);
                }

                Element sitePropertiesElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "SiteProperties");
                if (sitePropertiesElement != null) {
                    WebSite.WebSiteProperties sitePropertiesInstance = new WebSite.WebSiteProperties();
                    webSiteInstance.setSiteProperties(sitePropertiesInstance);

                    Element appSettingsSequenceElement = XmlUtility.getElementByTagNameNS(sitePropertiesElement,
                            "http://schemas.microsoft.com/windowsazure", "AppSettings");
                    if (appSettingsSequenceElement != null) {
                        for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(appSettingsSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "NameValuePair")
                                .size(); i4 = i4 + 1) {
                            org.w3c.dom.Element appSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(appSettingsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NameValuePair")
                                    .get(i4));
                            String appSettingsKey = XmlUtility
                                    .getElementByTagNameNS(appSettingsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name")
                                    .getTextContent();
                            String appSettingsValue = XmlUtility
                                    .getElementByTagNameNS(appSettingsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Value")
                                    .getTextContent();
                            sitePropertiesInstance.getAppSettings().put(appSettingsKey, appSettingsValue);
                        }
                    }

                    Element metadataSequenceElement = XmlUtility.getElementByTagNameNS(sitePropertiesElement,
                            "http://schemas.microsoft.com/windowsazure", "Metadata");
                    if (metadataSequenceElement != null) {
                        for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(metadataSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "NameValuePair")
                                .size(); i5 = i5 + 1) {
                            org.w3c.dom.Element metadataElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(metadataSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NameValuePair")
                                    .get(i5));
                            String metadataKey = XmlUtility
                                    .getElementByTagNameNS(metadataElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name")
                                    .getTextContent();
                            String metadataValue = XmlUtility
                                    .getElementByTagNameNS(metadataElement,
                                            "http://schemas.microsoft.com/windowsazure", "Value")
                                    .getTextContent();
                            sitePropertiesInstance.getMetadata().put(metadataKey, metadataValue);
                        }
                    }

                    Element propertiesSequenceElement = XmlUtility.getElementByTagNameNS(sitePropertiesElement,
                            "http://schemas.microsoft.com/windowsazure", "Properties");
                    if (propertiesSequenceElement != null) {
                        for (int i6 = 0; i6 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(propertiesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "NameValuePair")
                                .size(); i6 = i6 + 1) {
                            org.w3c.dom.Element propertiesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(propertiesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NameValuePair")
                                    .get(i6));
                            String propertiesKey = XmlUtility
                                    .getElementByTagNameNS(propertiesElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name")
                                    .getTextContent();
                            String propertiesValue = XmlUtility
                                    .getElementByTagNameNS(propertiesElement,
                                            "http://schemas.microsoft.com/windowsazure", "Value")
                                    .getTextContent();
                            sitePropertiesInstance.getProperties().put(propertiesKey, propertiesValue);
                        }
                    }
                }

                Element stateElement2 = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "State");
                if (stateElement2 != null) {
                    String stateInstance;
                    stateInstance = stateElement2.getTextContent();
                    webSiteInstance.setState(stateInstance);
                }

                Element usageStateElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "UsageState");
                if (usageStateElement != null && usageStateElement.getTextContent() != null
                        && !usageStateElement.getTextContent().isEmpty()) {
                    WebSiteUsageState usageStateInstance;
                    usageStateInstance = WebSiteUsageState.valueOf(usageStateElement.getTextContent());
                    webSiteInstance.setUsageState(usageStateInstance);
                }

                Element webSpaceElement = XmlUtility.getElementByTagNameNS(siteElement2,
                        "http://schemas.microsoft.com/windowsazure", "WebSpace");
                if (webSpaceElement != null) {
                    String webSpaceInstance;
                    webSpaceInstance = webSpaceElement.getTextContent();
                    webSiteInstance.setWebSpace(webSpaceInstance);
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.network.GatewayOperationsImpl.java

/**
* The Get Virtual Network Gateway operation gets information about the
* virtual network gateway//from w  w  w.  j ava 2s  .c  om
*
* @param gatewayId Required. The virtual network gateway id.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @return A standard service response including an HTTP status code and
* request ID.
*/
@Override
public VirtualNetworkGatewayGetResponse getVirtualNetworkGateway(String gatewayId)
        throws IOException, ServiceException, ParserConfigurationException, SAXException {
    // Validate
    if (gatewayId == null) {
        throw new NullPointerException("gatewayId");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("gatewayId", gatewayId);
        CloudTracing.enter(invocationId, this, "getVirtualNetworkGatewayAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/networking/virtualnetworkgateways/";
    url = url + URLEncoder.encode(gatewayId, "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        VirtualNetworkGatewayGetResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new VirtualNetworkGatewayGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element virtualNetworkGatewayElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "VirtualNetworkGateway");
            if (virtualNetworkGatewayElement != null) {
                Element gatewayIdElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "GatewayId");
                if (gatewayIdElement != null && gatewayIdElement.getTextContent() != null
                        && !gatewayIdElement.getTextContent().isEmpty()) {
                    String gatewayIdInstance;
                    gatewayIdInstance = gatewayIdElement.getTextContent();
                    result.setGatewayId(gatewayIdInstance);
                }

                Element lastEventElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "LastEvent");
                if (lastEventElement != null) {
                    GatewayEvent lastEventInstance = new GatewayEvent();
                    result.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 gatewayNameElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "GatewayName");
                if (gatewayNameElement != null) {
                    String gatewayNameInstance;
                    gatewayNameInstance = gatewayNameElement.getTextContent();
                    result.setGatewayName(gatewayNameInstance);
                }

                Element gatewayTypeElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "GatewayType");
                if (gatewayTypeElement != null) {
                    String gatewayTypeInstance;
                    gatewayTypeInstance = gatewayTypeElement.getTextContent();
                    result.setGatewayType(gatewayTypeInstance);
                }

                Element gatewaySizeElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "GatewaySize");
                if (gatewaySizeElement != null) {
                    String gatewaySizeInstance;
                    gatewaySizeInstance = gatewaySizeElement.getTextContent();
                    result.setGatewaySKU(gatewaySizeInstance);
                }

                Element stateElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "State");
                if (stateElement != null) {
                    String stateInstance;
                    stateInstance = stateElement.getTextContent();
                    result.setState(stateInstance);
                }

                Element vIPAddressElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "VIPAddress");
                if (vIPAddressElement != null) {
                    String vIPAddressInstance;
                    vIPAddressInstance = vIPAddressElement.getTextContent();
                    result.setVipAddress(vIPAddressInstance);
                }

                Element locationElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "Location");
                if (locationElement != null) {
                    String locationInstance;
                    locationInstance = locationElement.getTextContent();
                    result.setLocation(locationInstance);
                }

                Element vnetIdElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "VnetId");
                if (vnetIdElement != null) {
                    String vnetIdInstance;
                    vnetIdInstance = vnetIdElement.getTextContent();
                    result.setVnetId(vnetIdInstance);
                }

                Element subnetIdElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "SubnetId");
                if (subnetIdElement != null) {
                    String subnetIdInstance;
                    subnetIdInstance = subnetIdElement.getTextContent();
                    result.setSubnetId(subnetIdInstance);
                }

                Element defaultSitesElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "DefaultSites");
                if (defaultSitesElement != null) {
                    GatewayDefaultSite defaultSitesInstance = new GatewayDefaultSite();
                    result.setDefaultSite(defaultSitesInstance);

                    Element stringElement = XmlUtility.getElementByTagNameNS(defaultSitesElement,
                            "http://schemas.microsoft.com/windowsazure", "string");
                    if (stringElement != null) {
                        String stringInstance;
                        stringInstance = stringElement.getTextContent();
                        defaultSitesInstance.setName(stringInstance);
                    }
                }

                Element enableBgpElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewayElement,
                        "http://schemas.microsoft.com/windowsazure", "EnableBgp");
                if (enableBgpElement != null) {
                    boolean enableBgpInstance;
                    enableBgpInstance = DatatypeConverter
                            .parseBoolean(enableBgpElement.getTextContent().toLowerCase());
                    result.setEnableBgp(enableBgpInstance);
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.DeploymentOperationsImpl.java

/**
* The Get Deployment By Name operation returns configuration information,
* status, and system properties for a deployment.  (see
* http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx for
* more information)/*from  ww  w .j  a v a2  s . c  om*/
*
* @param serviceName Required. The name of the cloud service.
* @param deploymentName Required. The name of the deployment.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return A deployment that exists in the cloud service.
*/
@Override
public DeploymentGetResponse getByName(String serviceName, String deploymentName)
        throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
    // Validate
    if (serviceName == null) {
        throw new NullPointerException("serviceName");
    }
    if (deploymentName == null) {
        throw new NullPointerException("deploymentName");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("serviceName", serviceName);
        tracingParameters.put("deploymentName", deploymentName);
        CloudTracing.enter(invocationId, this, "getByNameAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/hostedservices/";
    url = url + URLEncoder.encode(serviceName, "UTF-8");
    url = url + "/deployments/";
    url = url + URLEncoder.encode(deploymentName, "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        DeploymentGetResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new DeploymentGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element deploymentElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "Deployment");
            if (deploymentElement != null) {
                Element nameElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    String nameInstance;
                    nameInstance = nameElement.getTextContent();
                    result.setName(nameInstance);
                }

                Element deploymentSlotElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "DeploymentSlot");
                if (deploymentSlotElement != null && deploymentSlotElement.getTextContent() != null
                        && !deploymentSlotElement.getTextContent().isEmpty()) {
                    DeploymentSlot deploymentSlotInstance;
                    deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent());
                    result.setDeploymentSlot(deploymentSlotInstance);
                }

                Element privateIDElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "PrivateID");
                if (privateIDElement != null) {
                    String privateIDInstance;
                    privateIDInstance = privateIDElement.getTextContent();
                    result.setPrivateId(privateIDInstance);
                }

                Element statusElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null && statusElement.getTextContent() != null
                        && !statusElement.getTextContent().isEmpty()) {
                    DeploymentStatus statusInstance;
                    statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }

                Element labelElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Label");
                if (labelElement != null) {
                    String labelInstance;
                    labelInstance = labelElement.getTextContent() != null
                            ? new String(Base64.decode(labelElement.getTextContent()))
                            : null;
                    result.setLabel(labelInstance);
                }

                Element urlElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Url");
                if (urlElement != null) {
                    URI urlInstance;
                    urlInstance = new URI(urlElement.getTextContent());
                    result.setUri(urlInstance);
                }

                Element configurationElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Configuration");
                if (configurationElement != null) {
                    String configurationInstance;
                    configurationInstance = configurationElement.getTextContent() != null
                            ? new String(Base64.decode(configurationElement.getTextContent()))
                            : null;
                    result.setConfiguration(configurationInstance);
                }

                Element roleInstanceListSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleInstanceList");
                if (roleInstanceListSequenceElement != null) {
                    for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(roleInstanceListSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "RoleInstance")
                            .size(); i1 = i1 + 1) {
                        org.w3c.dom.Element roleInstanceListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(roleInstanceListSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "RoleInstance")
                                .get(i1));
                        RoleInstance roleInstanceInstance = new RoleInstance();
                        result.getRoleInstances().add(roleInstanceInstance);

                        Element roleNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleName");
                        if (roleNameElement != null) {
                            String roleNameInstance;
                            roleNameInstance = roleNameElement.getTextContent();
                            roleInstanceInstance.setRoleName(roleNameInstance);
                        }

                        Element instanceNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "InstanceName");
                        if (instanceNameElement != null) {
                            String instanceNameInstance;
                            instanceNameInstance = instanceNameElement.getTextContent();
                            roleInstanceInstance.setInstanceName(instanceNameInstance);
                        }

                        Element instanceStatusElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceStatus");
                        if (instanceStatusElement != null) {
                            String instanceStatusInstance;
                            instanceStatusInstance = instanceStatusElement.getTextContent();
                            roleInstanceInstance.setInstanceStatus(instanceStatusInstance);
                        }

                        Element instanceUpgradeDomainElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceUpgradeDomain");
                        if (instanceUpgradeDomainElement != null
                                && instanceUpgradeDomainElement.getTextContent() != null
                                && !instanceUpgradeDomainElement.getTextContent().isEmpty()) {
                            int instanceUpgradeDomainInstance;
                            instanceUpgradeDomainInstance = DatatypeConverter
                                    .parseInt(instanceUpgradeDomainElement.getTextContent());
                            roleInstanceInstance.setInstanceUpgradeDomain(instanceUpgradeDomainInstance);
                        }

                        Element instanceFaultDomainElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceFaultDomain");
                        if (instanceFaultDomainElement != null
                                && instanceFaultDomainElement.getTextContent() != null
                                && !instanceFaultDomainElement.getTextContent().isEmpty()) {
                            int instanceFaultDomainInstance;
                            instanceFaultDomainInstance = DatatypeConverter
                                    .parseInt(instanceFaultDomainElement.getTextContent());
                            roleInstanceInstance.setInstanceFaultDomain(instanceFaultDomainInstance);
                        }

                        Element instanceSizeElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "InstanceSize");
                        if (instanceSizeElement != null) {
                            String instanceSizeInstance;
                            instanceSizeInstance = instanceSizeElement.getTextContent();
                            roleInstanceInstance.setInstanceSize(instanceSizeInstance);
                        }

                        Element instanceStateDetailsElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceStateDetails");
                        if (instanceStateDetailsElement != null) {
                            String instanceStateDetailsInstance;
                            instanceStateDetailsInstance = instanceStateDetailsElement.getTextContent();
                            roleInstanceInstance.setInstanceStateDetails(instanceStateDetailsInstance);
                        }

                        Element instanceErrorCodeElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceErrorCode");
                        if (instanceErrorCodeElement != null) {
                            String instanceErrorCodeInstance;
                            instanceErrorCodeInstance = instanceErrorCodeElement.getTextContent();
                            roleInstanceInstance.setInstanceErrorCode(instanceErrorCodeInstance);
                        }

                        Element ipAddressElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "IpAddress");
                        if (ipAddressElement != null) {
                            InetAddress ipAddressInstance;
                            ipAddressInstance = InetAddress.getByName(ipAddressElement.getTextContent());
                            roleInstanceInstance.setIPAddress(ipAddressInstance);
                        }

                        Element instanceEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceEndpoints");
                        if (instanceEndpointsSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(instanceEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InstanceEndpoint")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element instanceEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(instanceEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InstanceEndpoint")
                                        .get(i2));
                                InstanceEndpoint instanceEndpointInstance = new InstanceEndpoint();
                                roleInstanceInstance.getInstanceEndpoints().add(instanceEndpointInstance);

                                Element localPortElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LocalPort");
                                if (localPortElement != null && localPortElement.getTextContent() != null
                                        && !localPortElement.getTextContent().isEmpty()) {
                                    int localPortInstance;
                                    localPortInstance = DatatypeConverter
                                            .parseInt(localPortElement.getTextContent());
                                    instanceEndpointInstance.setLocalPort(localPortInstance);
                                }

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    instanceEndpointInstance.setName(nameInstance2);
                                }

                                Element publicPortElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "PublicPort");
                                if (publicPortElement != null) {
                                    int publicPortInstance;
                                    publicPortInstance = DatatypeConverter
                                            .parseInt(publicPortElement.getTextContent());
                                    instanceEndpointInstance.setPort(publicPortInstance);
                                }

                                Element protocolElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement != null) {
                                    String protocolInstance;
                                    protocolInstance = protocolElement.getTextContent();
                                    instanceEndpointInstance.setProtocol(protocolInstance);
                                }

                                Element vipElement = XmlUtility.getElementByTagNameNS(instanceEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Vip");
                                if (vipElement != null) {
                                    InetAddress vipInstance;
                                    vipInstance = InetAddress.getByName(vipElement.getTextContent());
                                    instanceEndpointInstance.setVirtualIPAddress(vipInstance);
                                }

                                Element idleTimeoutInMinutesElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement != null
                                        && idleTimeoutInMinutesElement.getTextContent() != null
                                        && !idleTimeoutInMinutesElement.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance;
                                    idleTimeoutInMinutesInstance = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement.getTextContent());
                                    instanceEndpointInstance
                                            .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance);
                                }
                            }
                        }

                        Element guestAgentStatusElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "GuestAgentStatus");
                        if (guestAgentStatusElement != null) {
                            GuestAgentStatus guestAgentStatusInstance = new GuestAgentStatus();
                            roleInstanceInstance.setGuestAgentStatus(guestAgentStatusInstance);

                            Element protocolVersionElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "ProtocolVersion");
                            if (protocolVersionElement != null) {
                                String protocolVersionInstance;
                                protocolVersionInstance = protocolVersionElement.getTextContent();
                                guestAgentStatusInstance.setProtocolVersion(protocolVersionInstance);
                            }

                            Element timestampElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Timestamp");
                            if (timestampElement != null && timestampElement.getTextContent() != null
                                    && !timestampElement.getTextContent().isEmpty()) {
                                Calendar timestampInstance;
                                timestampInstance = DatatypeConverter
                                        .parseDateTime(timestampElement.getTextContent());
                                guestAgentStatusInstance.setTimestamp(timestampInstance);
                            }

                            Element guestAgentVersionElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "GuestAgentVersion");
                            if (guestAgentVersionElement != null) {
                                String guestAgentVersionInstance;
                                guestAgentVersionInstance = guestAgentVersionElement.getTextContent();
                                guestAgentStatusInstance.setGuestAgentVersion(guestAgentVersionInstance);
                            }

                            Element statusElement2 = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Status");
                            if (statusElement2 != null) {
                                String statusInstance2;
                                statusInstance2 = statusElement2.getTextContent();
                                guestAgentStatusInstance.setStatus(statusInstance2);
                            }

                            Element codeElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Code");
                            if (codeElement != null && codeElement.getTextContent() != null
                                    && !codeElement.getTextContent().isEmpty()) {
                                int codeInstance;
                                codeInstance = DatatypeConverter.parseInt(codeElement.getTextContent());
                                guestAgentStatusInstance.setCode(codeInstance);
                            }

                            Element messageElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Message");
                            if (messageElement != null) {
                                GuestAgentMessage messageInstance = new GuestAgentMessage();
                                guestAgentStatusInstance.setMessage(messageInstance);

                                Element messageResourceIdElement = XmlUtility.getElementByTagNameNS(
                                        messageElement, "http://schemas.microsoft.com/windowsazure",
                                        "MessageResourceId");
                                if (messageResourceIdElement != null) {
                                    String messageResourceIdInstance;
                                    messageResourceIdInstance = messageResourceIdElement.getTextContent();
                                    messageInstance.setMessageResourceId(messageResourceIdInstance);
                                }

                                Element paramListSequenceElement = XmlUtility.getElementByTagNameNS(
                                        messageElement, "http://schemas.microsoft.com/windowsazure",
                                        "ParamList");
                                if (paramListSequenceElement != null) {
                                    for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(paramListSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Param")
                                            .size(); i3 = i3 + 1) {
                                        org.w3c.dom.Element paramListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(paramListSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Param")
                                                .get(i3));
                                        messageInstance.getParamList().add(paramListElement.getTextContent());
                                    }
                                }
                            }

                            Element formattedMessageElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "FormattedMessage");
                            if (formattedMessageElement != null) {
                                GuestAgentFormattedMessage formattedMessageInstance = new GuestAgentFormattedMessage();
                                guestAgentStatusInstance.setFormattedMessage(formattedMessageInstance);

                                Element languageElement = XmlUtility.getElementByTagNameNS(
                                        formattedMessageElement, "http://schemas.microsoft.com/windowsazure",
                                        "Language");
                                if (languageElement != null) {
                                    String languageInstance;
                                    languageInstance = languageElement.getTextContent();
                                    formattedMessageInstance.setLanguage(languageInstance);
                                }

                                Element messageElement2 = XmlUtility.getElementByTagNameNS(
                                        formattedMessageElement, "http://schemas.microsoft.com/windowsazure",
                                        "Message");
                                if (messageElement2 != null) {
                                    String messageInstance2;
                                    messageInstance2 = messageElement2.getTextContent();
                                    formattedMessageInstance.setMessage(messageInstance2);
                                }
                            }
                        }

                        Element resourceExtensionStatusListSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "ResourceExtensionStatusList");
                        if (resourceExtensionStatusListSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(resourceExtensionStatusListSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ResourceExtensionStatus")
                                    .size(); i4 = i4 + 1) {
                                org.w3c.dom.Element resourceExtensionStatusListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(resourceExtensionStatusListSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionStatus")
                                        .get(i4));
                                ResourceExtensionStatus resourceExtensionStatusInstance = new ResourceExtensionStatus();
                                roleInstanceInstance.getResourceExtensionStatusList()
                                        .add(resourceExtensionStatusInstance);

                                Element handlerNameElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "HandlerName");
                                if (handlerNameElement != null) {
                                    String handlerNameInstance;
                                    handlerNameInstance = handlerNameElement.getTextContent();
                                    resourceExtensionStatusInstance.setHandlerName(handlerNameInstance);
                                }

                                Element versionElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Version");
                                if (versionElement != null) {
                                    String versionInstance;
                                    versionInstance = versionElement.getTextContent();
                                    resourceExtensionStatusInstance.setVersion(versionInstance);
                                }

                                Element statusElement3 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Status");
                                if (statusElement3 != null) {
                                    String statusInstance3;
                                    statusInstance3 = statusElement3.getTextContent();
                                    resourceExtensionStatusInstance.setStatus(statusInstance3);
                                }

                                Element codeElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Code");
                                if (codeElement2 != null && codeElement2.getTextContent() != null
                                        && !codeElement2.getTextContent().isEmpty()) {
                                    int codeInstance2;
                                    codeInstance2 = DatatypeConverter.parseInt(codeElement2.getTextContent());
                                    resourceExtensionStatusInstance.setCode(codeInstance2);
                                }

                                Element messageElement3 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Message");
                                if (messageElement3 != null) {
                                    GuestAgentMessage messageInstance3 = new GuestAgentMessage();
                                    resourceExtensionStatusInstance.setMessage(messageInstance3);

                                    Element messageResourceIdElement2 = XmlUtility.getElementByTagNameNS(
                                            messageElement3, "http://schemas.microsoft.com/windowsazure",
                                            "MessageResourceId");
                                    if (messageResourceIdElement2 != null) {
                                        String messageResourceIdInstance2;
                                        messageResourceIdInstance2 = messageResourceIdElement2.getTextContent();
                                        messageInstance3.setMessageResourceId(messageResourceIdInstance2);
                                    }

                                    Element paramListSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                            messageElement3, "http://schemas.microsoft.com/windowsazure",
                                            "ParamList");
                                    if (paramListSequenceElement2 != null) {
                                        for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(paramListSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure", "Param")
                                                .size(); i5 = i5 + 1) {
                                            org.w3c.dom.Element paramListElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(paramListSequenceElement2,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Param")
                                                    .get(i5));
                                            messageInstance3.getParamList()
                                                    .add(paramListElement2.getTextContent());
                                        }
                                    }
                                }

                                Element formattedMessageElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "FormattedMessage");
                                if (formattedMessageElement2 != null) {
                                    GuestAgentFormattedMessage formattedMessageInstance2 = new GuestAgentFormattedMessage();
                                    resourceExtensionStatusInstance
                                            .setFormattedMessage(formattedMessageInstance2);

                                    Element languageElement2 = XmlUtility.getElementByTagNameNS(
                                            formattedMessageElement2,
                                            "http://schemas.microsoft.com/windowsazure", "Language");
                                    if (languageElement2 != null) {
                                        String languageInstance2;
                                        languageInstance2 = languageElement2.getTextContent();
                                        formattedMessageInstance2.setLanguage(languageInstance2);
                                    }

                                    Element messageElement4 = XmlUtility.getElementByTagNameNS(
                                            formattedMessageElement2,
                                            "http://schemas.microsoft.com/windowsazure", "Message");
                                    if (messageElement4 != null) {
                                        String messageInstance4;
                                        messageInstance4 = messageElement4.getTextContent();
                                        formattedMessageInstance2.setMessage(messageInstance4);
                                    }
                                }

                                Element extensionSettingStatusElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "ExtensionSettingStatus");
                                if (extensionSettingStatusElement != null) {
                                    ResourceExtensionConfigurationStatus extensionSettingStatusInstance = new ResourceExtensionConfigurationStatus();
                                    resourceExtensionStatusInstance
                                            .setExtensionSettingStatus(extensionSettingStatusInstance);

                                    Element timestampElement2 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Timestamp");
                                    if (timestampElement2 != null && timestampElement2.getTextContent() != null
                                            && !timestampElement2.getTextContent().isEmpty()) {
                                        Calendar timestampInstance2;
                                        timestampInstance2 = DatatypeConverter
                                                .parseDateTime(timestampElement2.getTextContent());
                                        extensionSettingStatusInstance.setTimestamp(timestampInstance2);
                                    }

                                    Element configurationAppliedTimeElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ConfigurationAppliedTime");
                                    if (configurationAppliedTimeElement != null
                                            && configurationAppliedTimeElement.getTextContent() != null
                                            && !configurationAppliedTimeElement.getTextContent().isEmpty()) {
                                        Calendar configurationAppliedTimeInstance;
                                        configurationAppliedTimeInstance = DatatypeConverter.parseDateTime(
                                                configurationAppliedTimeElement.getTextContent());
                                        extensionSettingStatusInstance
                                                .setConfigurationAppliedTime(configurationAppliedTimeInstance);
                                    }

                                    Element nameElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement3 != null) {
                                        String nameInstance3;
                                        nameInstance3 = nameElement3.getTextContent();
                                        extensionSettingStatusInstance.setName(nameInstance3);
                                    }

                                    Element operationElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Operation");
                                    if (operationElement != null) {
                                        String operationInstance;
                                        operationInstance = operationElement.getTextContent();
                                        extensionSettingStatusInstance.setOperation(operationInstance);
                                    }

                                    Element statusElement4 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Status");
                                    if (statusElement4 != null) {
                                        String statusInstance4;
                                        statusInstance4 = statusElement4.getTextContent();
                                        extensionSettingStatusInstance.setStatus(statusInstance4);
                                    }

                                    Element codeElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Code");
                                    if (codeElement3 != null && codeElement3.getTextContent() != null
                                            && !codeElement3.getTextContent().isEmpty()) {
                                        int codeInstance3;
                                        codeInstance3 = DatatypeConverter
                                                .parseInt(codeElement3.getTextContent());
                                        extensionSettingStatusInstance.setCode(codeInstance3);
                                    }

                                    Element messageElement5 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Message");
                                    if (messageElement5 != null) {
                                        GuestAgentMessage messageInstance5 = new GuestAgentMessage();
                                        extensionSettingStatusInstance.setMessage(messageInstance5);

                                        Element messageResourceIdElement3 = XmlUtility.getElementByTagNameNS(
                                                messageElement5, "http://schemas.microsoft.com/windowsazure",
                                                "MessageResourceId");
                                        if (messageResourceIdElement3 != null) {
                                            String messageResourceIdInstance3;
                                            messageResourceIdInstance3 = messageResourceIdElement3
                                                    .getTextContent();
                                            messageInstance5.setMessageResourceId(messageResourceIdInstance3);
                                        }

                                        Element paramListSequenceElement3 = XmlUtility.getElementByTagNameNS(
                                                messageElement5, "http://schemas.microsoft.com/windowsazure",
                                                "ParamList");
                                        if (paramListSequenceElement3 != null) {
                                            for (int i6 = 0; i6 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(paramListSequenceElement3,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Param")
                                                    .size(); i6 = i6 + 1) {
                                                org.w3c.dom.Element paramListElement3 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(paramListSequenceElement3,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "Param")
                                                        .get(i6));
                                                messageInstance5.getParamList()
                                                        .add(paramListElement3.getTextContent());
                                            }
                                        }
                                    }

                                    Element formattedMessageElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "FormattedMessage");
                                    if (formattedMessageElement3 != null) {
                                        GuestAgentFormattedMessage formattedMessageInstance3 = new GuestAgentFormattedMessage();
                                        extensionSettingStatusInstance
                                                .setFormattedMessage(formattedMessageInstance3);

                                        Element languageElement3 = XmlUtility.getElementByTagNameNS(
                                                formattedMessageElement3,
                                                "http://schemas.microsoft.com/windowsazure", "Language");
                                        if (languageElement3 != null) {
                                            String languageInstance3;
                                            languageInstance3 = languageElement3.getTextContent();
                                            formattedMessageInstance3.setLanguage(languageInstance3);
                                        }

                                        Element messageElement6 = XmlUtility.getElementByTagNameNS(
                                                formattedMessageElement3,
                                                "http://schemas.microsoft.com/windowsazure", "Message");
                                        if (messageElement6 != null) {
                                            String messageInstance6;
                                            messageInstance6 = messageElement6.getTextContent();
                                            formattedMessageInstance3.setMessage(messageInstance6);
                                        }
                                    }

                                    Element subStatusListSequenceElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "SubStatusList");
                                    if (subStatusListSequenceElement != null) {
                                        for (int i7 = 0; i7 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(subStatusListSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubStatus")
                                                .size(); i7 = i7 + 1) {
                                            org.w3c.dom.Element subStatusListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(subStatusListSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "SubStatus")
                                                    .get(i7));
                                            ResourceExtensionSubStatus subStatusInstance = new ResourceExtensionSubStatus();
                                            extensionSettingStatusInstance.getSubStatusList()
                                                    .add(subStatusInstance);

                                            Element nameElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Name");
                                            if (nameElement4 != null) {
                                                String nameInstance4;
                                                nameInstance4 = nameElement4.getTextContent();
                                                subStatusInstance.setName(nameInstance4);
                                            }

                                            Element statusElement5 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Status");
                                            if (statusElement5 != null) {
                                                String statusInstance5;
                                                statusInstance5 = statusElement5.getTextContent();
                                                subStatusInstance.setStatus(statusInstance5);
                                            }

                                            Element codeElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Code");
                                            if (codeElement4 != null && codeElement4.getTextContent() != null
                                                    && !codeElement4.getTextContent().isEmpty()) {
                                                int codeInstance4;
                                                codeInstance4 = DatatypeConverter
                                                        .parseInt(codeElement4.getTextContent());
                                                subStatusInstance.setCode(codeInstance4);
                                            }

                                            Element messageElement7 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Message");
                                            if (messageElement7 != null) {
                                                GuestAgentMessage messageInstance7 = new GuestAgentMessage();
                                                subStatusInstance.setMessage(messageInstance7);

                                                Element messageResourceIdElement4 = XmlUtility
                                                        .getElementByTagNameNS(messageElement7,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "MessageResourceId");
                                                if (messageResourceIdElement4 != null) {
                                                    String messageResourceIdInstance4;
                                                    messageResourceIdInstance4 = messageResourceIdElement4
                                                            .getTextContent();
                                                    messageInstance7
                                                            .setMessageResourceId(messageResourceIdInstance4);
                                                }

                                                Element paramListSequenceElement4 = XmlUtility
                                                        .getElementByTagNameNS(messageElement7,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "ParamList");
                                                if (paramListSequenceElement4 != null) {
                                                    for (int i8 = 0; i8 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(paramListSequenceElement4,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Param")
                                                            .size(); i8 = i8 + 1) {
                                                        org.w3c.dom.Element paramListElement4 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                                .getElementsByTagNameNS(
                                                                        paramListSequenceElement4,
                                                                        "http://schemas.microsoft.com/windowsazure",
                                                                        "Param")
                                                                .get(i8));
                                                        messageInstance7.getParamList()
                                                                .add(paramListElement4.getTextContent());
                                                    }
                                                }
                                            }

                                            Element formattedMessageElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "FormattedMessage");
                                            if (formattedMessageElement4 != null) {
                                                GuestAgentFormattedMessage formattedMessageInstance4 = new GuestAgentFormattedMessage();
                                                subStatusInstance
                                                        .setFormattedMessage(formattedMessageInstance4);

                                                Element languageElement4 = XmlUtility.getElementByTagNameNS(
                                                        formattedMessageElement4,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "Language");
                                                if (languageElement4 != null) {
                                                    String languageInstance4;
                                                    languageInstance4 = languageElement4.getTextContent();
                                                    formattedMessageInstance4.setLanguage(languageInstance4);
                                                }

                                                Element messageElement8 = XmlUtility.getElementByTagNameNS(
                                                        formattedMessageElement4,
                                                        "http://schemas.microsoft.com/windowsazure", "Message");
                                                if (messageElement8 != null) {
                                                    String messageInstance8;
                                                    messageInstance8 = messageElement8.getTextContent();
                                                    formattedMessageInstance4.setMessage(messageInstance8);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        Element powerStateElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "PowerState");
                        if (powerStateElement != null && powerStateElement.getTextContent() != null
                                && !powerStateElement.getTextContent().isEmpty()) {
                            RoleInstancePowerState powerStateInstance;
                            powerStateInstance = RoleInstancePowerState
                                    .valueOf(powerStateElement.getTextContent());
                            roleInstanceInstance.setPowerState(powerStateInstance);
                        }

                        Element hostNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "HostName");
                        if (hostNameElement != null) {
                            String hostNameInstance;
                            hostNameInstance = hostNameElement.getTextContent();
                            roleInstanceInstance.setHostName(hostNameInstance);
                        }

                        Element remoteAccessCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "RemoteAccessCertificateThumbprint");
                        if (remoteAccessCertificateThumbprintElement != null) {
                            String remoteAccessCertificateThumbprintInstance;
                            remoteAccessCertificateThumbprintInstance = remoteAccessCertificateThumbprintElement
                                    .getTextContent();
                            roleInstanceInstance.setRemoteAccessCertificateThumbprint(
                                    remoteAccessCertificateThumbprintInstance);
                        }

                        Element publicIPsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "PublicIPs");
                        if (publicIPsSequenceElement != null) {
                            for (int i9 = 0; i9 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(publicIPsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                    .size(); i9 = i9 + 1) {
                                org.w3c.dom.Element publicIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(publicIPsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                        .get(i9));
                                RoleInstance.PublicIP publicIPInstance = new RoleInstance.PublicIP();
                                roleInstanceInstance.getPublicIPs().add(publicIPInstance);

                                Element nameElement5 = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement5 != null) {
                                    String nameInstance5;
                                    nameInstance5 = nameElement5.getTextContent();
                                    publicIPInstance.setName(nameInstance5);
                                }

                                Element addressElement = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Address");
                                if (addressElement != null) {
                                    InetAddress addressInstance;
                                    addressInstance = InetAddress.getByName(addressElement.getTextContent());
                                    publicIPInstance.setAddress(addressInstance);
                                }

                                Element idleTimeoutInMinutesElement2 = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement2 != null
                                        && idleTimeoutInMinutesElement2.getTextContent() != null
                                        && !idleTimeoutInMinutesElement2.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance2;
                                    idleTimeoutInMinutesInstance2 = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement2.getTextContent());
                                    publicIPInstance.setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance2);
                                }

                                Element domainNameLabelElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainNameLabel");
                                if (domainNameLabelElement != null) {
                                    String domainNameLabelInstance;
                                    domainNameLabelInstance = domainNameLabelElement.getTextContent();
                                    publicIPInstance.setDomainNameLabel(domainNameLabelInstance);
                                }

                                Element fqdnsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure", "Fqdns");
                                if (fqdnsSequenceElement != null) {
                                    for (int i10 = 0; i10 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(fqdnsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fqdn")
                                            .size(); i10 = i10 + 1) {
                                        org.w3c.dom.Element fqdnsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(fqdnsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Fqdn")
                                                .get(i10));
                                        publicIPInstance.getFqdns().add(fqdnsElement.getTextContent());
                                    }
                                }
                            }
                        }

                        Element networkInterfacesSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "NetworkInterfaces");
                        if (networkInterfacesSequenceElement != null) {
                            for (int i11 = 0; i11 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                    .size(); i11 = i11 + 1) {
                                org.w3c.dom.Element networkInterfacesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                        .get(i11));
                                NetworkInterfaceInstance networkInterfaceInstance = new NetworkInterfaceInstance();
                                roleInstanceInstance.getNetworkInterfaces().add(networkInterfaceInstance);

                                Element nameElement6 = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement6 != null) {
                                    String nameInstance6;
                                    nameInstance6 = nameElement6.getTextContent();
                                    networkInterfaceInstance.setName(nameInstance6);
                                }

                                Element macAddressElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "MacAddress");
                                if (macAddressElement != null) {
                                    String macAddressInstance;
                                    macAddressInstance = macAddressElement.getTextContent();
                                    networkInterfaceInstance.setMacAddress(macAddressInstance);
                                }

                                Element iPConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPConfigurations");
                                if (iPConfigurationsSequenceElement != null) {
                                    for (int i12 = 0; i12 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IPConfiguration")
                                            .size(); i12 = i12 + 1) {
                                        org.w3c.dom.Element iPConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfiguration")
                                                .get(i12));
                                        IPConfigurationInstance iPConfigurationInstance = new IPConfigurationInstance();
                                        networkInterfaceInstance.getIPConfigurations()
                                                .add(iPConfigurationInstance);

                                        Element subnetNameElement = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "SubnetName");
                                        if (subnetNameElement != null) {
                                            String subnetNameInstance;
                                            subnetNameInstance = subnetNameElement.getTextContent();
                                            iPConfigurationInstance.setSubnetName(subnetNameInstance);
                                        }

                                        Element addressElement2 = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Address");
                                        if (addressElement2 != null) {
                                            String addressInstance2;
                                            addressInstance2 = addressElement2.getTextContent();
                                            iPConfigurationInstance.setAddress(addressInstance2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                Element upgradeStatusElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "UpgradeStatus");
                if (upgradeStatusElement != null) {
                    UpgradeStatus upgradeStatusInstance = new UpgradeStatus();
                    result.setUpgradeStatus(upgradeStatusInstance);

                    Element upgradeTypeElement = XmlUtility.getElementByTagNameNS(upgradeStatusElement,
                            "http://schemas.microsoft.com/windowsazure", "UpgradeType");
                    if (upgradeTypeElement != null && upgradeTypeElement.getTextContent() != null
                            && !upgradeTypeElement.getTextContent().isEmpty()) {
                        DeploymentUpgradeType upgradeTypeInstance;
                        upgradeTypeInstance = DeploymentUpgradeType
                                .valueOf(upgradeTypeElement.getTextContent());
                        upgradeStatusInstance.setUpgradeType(upgradeTypeInstance);
                    }

                    Element currentUpgradeDomainStateElement = XmlUtility.getElementByTagNameNS(
                            upgradeStatusElement, "http://schemas.microsoft.com/windowsazure",
                            "CurrentUpgradeDomainState");
                    if (currentUpgradeDomainStateElement != null
                            && currentUpgradeDomainStateElement.getTextContent() != null
                            && !currentUpgradeDomainStateElement.getTextContent().isEmpty()) {
                        UpgradeDomainState currentUpgradeDomainStateInstance;
                        currentUpgradeDomainStateInstance = UpgradeDomainState
                                .valueOf(currentUpgradeDomainStateElement.getTextContent());
                        upgradeStatusInstance.setCurrentUpgradeDomainState(currentUpgradeDomainStateInstance);
                    }

                    Element currentUpgradeDomainElement = XmlUtility.getElementByTagNameNS(upgradeStatusElement,
                            "http://schemas.microsoft.com/windowsazure", "CurrentUpgradeDomain");
                    if (currentUpgradeDomainElement != null) {
                        int currentUpgradeDomainInstance;
                        currentUpgradeDomainInstance = DatatypeConverter
                                .parseInt(currentUpgradeDomainElement.getTextContent());
                        upgradeStatusInstance.setCurrentUpgradeDomain(currentUpgradeDomainInstance);
                    }
                }

                Element upgradeDomainCountElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "UpgradeDomainCount");
                if (upgradeDomainCountElement != null) {
                    int upgradeDomainCountInstance;
                    upgradeDomainCountInstance = DatatypeConverter
                            .parseInt(upgradeDomainCountElement.getTextContent());
                    result.setUpgradeDomainCount(upgradeDomainCountInstance);
                }

                Element roleListSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleList");
                if (roleListSequenceElement != null) {
                    for (int i13 = 0; i13 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(roleListSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "Role")
                            .size(); i13 = i13 + 1) {
                        org.w3c.dom.Element roleListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(roleListSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Role")
                                .get(i13));
                        Role roleInstance = new Role();
                        result.getRoles().add(roleInstance);

                        Element roleNameElement2 = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleName");
                        if (roleNameElement2 != null) {
                            String roleNameInstance2;
                            roleNameInstance2 = roleNameElement2.getTextContent();
                            roleInstance.setRoleName(roleNameInstance2);
                        }

                        Element osVersionElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "OsVersion");
                        if (osVersionElement != null) {
                            String osVersionInstance;
                            osVersionInstance = osVersionElement.getTextContent();
                            roleInstance.setOSVersion(osVersionInstance);
                        }

                        Element roleTypeElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleType");
                        if (roleTypeElement != null) {
                            String roleTypeInstance;
                            roleTypeInstance = roleTypeElement.getTextContent();
                            roleInstance.setRoleType(roleTypeInstance);
                        }

                        Element configurationSetsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "ConfigurationSets");
                        if (configurationSetsSequenceElement != null) {
                            for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(configurationSetsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                    .size(); i14 = i14 + 1) {
                                org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(configurationSetsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                        .get(i14));
                                ConfigurationSet configurationSetInstance = new ConfigurationSet();
                                roleInstance.getConfigurationSets().add(configurationSetInstance);

                                Element configurationSetTypeElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ConfigurationSetType");
                                if (configurationSetTypeElement != null) {
                                    String configurationSetTypeInstance;
                                    configurationSetTypeInstance = configurationSetTypeElement.getTextContent();
                                    configurationSetInstance
                                            .setConfigurationSetType(configurationSetTypeInstance);
                                }

                                Element inputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "InputEndpoints");
                                if (inputEndpointsSequenceElement != null) {
                                    for (int i15 = 0; i15 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "InputEndpoint")
                                            .size(); i15 = i15 + 1) {
                                        org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "InputEndpoint")
                                                .get(i15));
                                        InputEndpoint inputEndpointInstance = new InputEndpoint();
                                        configurationSetInstance.getInputEndpoints().add(inputEndpointInstance);

                                        Element loadBalancedEndpointSetNameElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "LoadBalancedEndpointSetName");
                                        if (loadBalancedEndpointSetNameElement != null) {
                                            String loadBalancedEndpointSetNameInstance;
                                            loadBalancedEndpointSetNameInstance = loadBalancedEndpointSetNameElement
                                                    .getTextContent();
                                            inputEndpointInstance.setLoadBalancedEndpointSetName(
                                                    loadBalancedEndpointSetNameInstance);
                                        }

                                        Element localPortElement2 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "LocalPort");
                                        if (localPortElement2 != null
                                                && localPortElement2.getTextContent() != null
                                                && !localPortElement2.getTextContent().isEmpty()) {
                                            int localPortInstance2;
                                            localPortInstance2 = DatatypeConverter
                                                    .parseInt(localPortElement2.getTextContent());
                                            inputEndpointInstance.setLocalPort(localPortInstance2);
                                        }

                                        Element nameElement7 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Name");
                                        if (nameElement7 != null) {
                                            String nameInstance7;
                                            nameInstance7 = nameElement7.getTextContent();
                                            inputEndpointInstance.setName(nameInstance7);
                                        }

                                        Element portElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Port");
                                        if (portElement != null && portElement.getTextContent() != null
                                                && !portElement.getTextContent().isEmpty()) {
                                            int portInstance;
                                            portInstance = DatatypeConverter
                                                    .parseInt(portElement.getTextContent());
                                            inputEndpointInstance.setPort(portInstance);
                                        }

                                        Element loadBalancerProbeElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "LoadBalancerProbe");
                                        if (loadBalancerProbeElement != null) {
                                            LoadBalancerProbe loadBalancerProbeInstance = new LoadBalancerProbe();
                                            inputEndpointInstance
                                                    .setLoadBalancerProbe(loadBalancerProbeInstance);

                                            Element pathElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement != null) {
                                                String pathInstance;
                                                pathInstance = pathElement.getTextContent();
                                                loadBalancerProbeInstance.setPath(pathInstance);
                                            }

                                            Element portElement2 = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Port");
                                            if (portElement2 != null) {
                                                int portInstance2;
                                                portInstance2 = DatatypeConverter
                                                        .parseInt(portElement2.getTextContent());
                                                loadBalancerProbeInstance.setPort(portInstance2);
                                            }

                                            Element protocolElement2 = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Protocol");
                                            if (protocolElement2 != null
                                                    && protocolElement2.getTextContent() != null
                                                    && !protocolElement2.getTextContent().isEmpty()) {
                                                LoadBalancerProbeTransportProtocol protocolInstance2;
                                                protocolInstance2 = com.microsoft.windowsazure.management.compute.ComputeManagementClientImpl
                                                        .parseLoadBalancerProbeTransportProtocol(
                                                                protocolElement2.getTextContent());
                                                loadBalancerProbeInstance.setProtocol(protocolInstance2);
                                            }

                                            Element intervalInSecondsElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IntervalInSeconds");
                                            if (intervalInSecondsElement != null
                                                    && intervalInSecondsElement.getTextContent() != null
                                                    && !intervalInSecondsElement.getTextContent().isEmpty()) {
                                                int intervalInSecondsInstance;
                                                intervalInSecondsInstance = DatatypeConverter
                                                        .parseInt(intervalInSecondsElement.getTextContent());
                                                loadBalancerProbeInstance
                                                        .setIntervalInSeconds(intervalInSecondsInstance);
                                            }

                                            Element timeoutInSecondsElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "TimeoutInSeconds");
                                            if (timeoutInSecondsElement != null
                                                    && timeoutInSecondsElement.getTextContent() != null
                                                    && !timeoutInSecondsElement.getTextContent().isEmpty()) {
                                                int timeoutInSecondsInstance;
                                                timeoutInSecondsInstance = DatatypeConverter
                                                        .parseInt(timeoutInSecondsElement.getTextContent());
                                                loadBalancerProbeInstance
                                                        .setTimeoutInSeconds(timeoutInSecondsInstance);
                                            }
                                        }

                                        Element protocolElement3 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Protocol");
                                        if (protocolElement3 != null) {
                                            String protocolInstance3;
                                            protocolInstance3 = protocolElement3.getTextContent();
                                            inputEndpointInstance.setProtocol(protocolInstance3);
                                        }

                                        Element vipElement2 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Vip");
                                        if (vipElement2 != null) {
                                            InetAddress vipInstance2;
                                            vipInstance2 = InetAddress.getByName(vipElement2.getTextContent());
                                            inputEndpointInstance.setVirtualIPAddress(vipInstance2);
                                        }

                                        Element enableDirectServerReturnElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "EnableDirectServerReturn");
                                        if (enableDirectServerReturnElement != null
                                                && enableDirectServerReturnElement.getTextContent() != null
                                                && !enableDirectServerReturnElement.getTextContent()
                                                        .isEmpty()) {
                                            boolean enableDirectServerReturnInstance;
                                            enableDirectServerReturnInstance = DatatypeConverter
                                                    .parseBoolean(enableDirectServerReturnElement
                                                            .getTextContent().toLowerCase());
                                            inputEndpointInstance.setEnableDirectServerReturn(
                                                    enableDirectServerReturnInstance);
                                        }

                                        Element loadBalancerNameElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "LoadBalancerName");
                                        if (loadBalancerNameElement != null) {
                                            String loadBalancerNameInstance;
                                            loadBalancerNameInstance = loadBalancerNameElement.getTextContent();
                                            inputEndpointInstance.setLoadBalancerName(loadBalancerNameInstance);
                                        }

                                        Element endpointAclElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "EndpointAcl");
                                        if (endpointAclElement != null) {
                                            EndpointAcl endpointAclInstance = new EndpointAcl();
                                            inputEndpointInstance.setEndpointAcl(endpointAclInstance);

                                            Element rulesSequenceElement = XmlUtility.getElementByTagNameNS(
                                                    endpointAclElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Rules");
                                            if (rulesSequenceElement != null) {
                                                for (int i16 = 0; i16 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(rulesSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "Rule")
                                                        .size(); i16 = i16 + 1) {
                                                    org.w3c.dom.Element rulesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(rulesSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Rule")
                                                            .get(i16));
                                                    AccessControlListRule ruleInstance = new AccessControlListRule();
                                                    endpointAclInstance.getRules().add(ruleInstance);

                                                    Element orderElement = XmlUtility.getElementByTagNameNS(
                                                            rulesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Order");
                                                    if (orderElement != null
                                                            && orderElement.getTextContent() != null
                                                            && !orderElement.getTextContent().isEmpty()) {
                                                        int orderInstance;
                                                        orderInstance = DatatypeConverter
                                                                .parseInt(orderElement.getTextContent());
                                                        ruleInstance.setOrder(orderInstance);
                                                    }

                                                    Element actionElement = XmlUtility.getElementByTagNameNS(
                                                            rulesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Action");
                                                    if (actionElement != null) {
                                                        String actionInstance;
                                                        actionInstance = actionElement.getTextContent();
                                                        ruleInstance.setAction(actionInstance);
                                                    }

                                                    Element remoteSubnetElement = XmlUtility
                                                            .getElementByTagNameNS(rulesElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "RemoteSubnet");
                                                    if (remoteSubnetElement != null) {
                                                        String remoteSubnetInstance;
                                                        remoteSubnetInstance = remoteSubnetElement
                                                                .getTextContent();
                                                        ruleInstance.setRemoteSubnet(remoteSubnetInstance);
                                                    }

                                                    Element descriptionElement = XmlUtility
                                                            .getElementByTagNameNS(rulesElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Description");
                                                    if (descriptionElement != null) {
                                                        String descriptionInstance;
                                                        descriptionInstance = descriptionElement
                                                                .getTextContent();
                                                        ruleInstance.setDescription(descriptionInstance);
                                                    }
                                                }
                                            }
                                        }

                                        Element idleTimeoutInMinutesElement3 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "IdleTimeoutInMinutes");
                                        if (idleTimeoutInMinutesElement3 != null
                                                && idleTimeoutInMinutesElement3.getTextContent() != null
                                                && !idleTimeoutInMinutesElement3.getTextContent().isEmpty()) {
                                            int idleTimeoutInMinutesInstance3;
                                            idleTimeoutInMinutesInstance3 = DatatypeConverter
                                                    .parseInt(idleTimeoutInMinutesElement3.getTextContent());
                                            inputEndpointInstance
                                                    .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance3);
                                        }

                                        Element loadBalancerDistributionElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "LoadBalancerDistribution");
                                        if (loadBalancerDistributionElement != null) {
                                            String loadBalancerDistributionInstance;
                                            loadBalancerDistributionInstance = loadBalancerDistributionElement
                                                    .getTextContent();
                                            inputEndpointInstance.setLoadBalancerDistribution(
                                                    loadBalancerDistributionInstance);
                                        }

                                        Element virtualIPNameElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "VirtualIPName");
                                        if (virtualIPNameElement != null) {
                                            String virtualIPNameInstance;
                                            virtualIPNameInstance = virtualIPNameElement.getTextContent();
                                            inputEndpointInstance.setVirtualIPName(virtualIPNameInstance);
                                        }
                                    }
                                }

                                Element subnetNamesSequenceElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "SubnetNames");
                                if (subnetNamesSequenceElement != null) {
                                    for (int i17 = 0; i17 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "SubnetName")
                                            .size(); i17 = i17 + 1) {
                                        org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubnetName")
                                                .get(i17));
                                        configurationSetInstance.getSubnetNames()
                                                .add(subnetNamesElement.getTextContent());
                                    }
                                }

                                Element staticVirtualNetworkIPAddressElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "StaticVirtualNetworkIPAddress");
                                if (staticVirtualNetworkIPAddressElement != null) {
                                    String staticVirtualNetworkIPAddressInstance;
                                    staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement
                                            .getTextContent();
                                    configurationSetInstance.setStaticVirtualNetworkIPAddress(
                                            staticVirtualNetworkIPAddressInstance);
                                }

                                Element publicIPsSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "PublicIPs");
                                if (publicIPsSequenceElement2 != null) {
                                    for (int i18 = 0; i18 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(publicIPsSequenceElement2,
                                                    "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                            .size(); i18 = i18 + 1) {
                                        org.w3c.dom.Element publicIPsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(publicIPsSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                                .get(i18));
                                        ConfigurationSet.PublicIP publicIPInstance2 = new ConfigurationSet.PublicIP();
                                        configurationSetInstance.getPublicIPs().add(publicIPInstance2);

                                        Element nameElement8 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "Name");
                                        if (nameElement8 != null) {
                                            String nameInstance8;
                                            nameInstance8 = nameElement8.getTextContent();
                                            publicIPInstance2.setName(nameInstance8);
                                        }

                                        Element idleTimeoutInMinutesElement4 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "IdleTimeoutInMinutes");
                                        if (idleTimeoutInMinutesElement4 != null
                                                && idleTimeoutInMinutesElement4.getTextContent() != null
                                                && !idleTimeoutInMinutesElement4.getTextContent().isEmpty()) {
                                            int idleTimeoutInMinutesInstance4;
                                            idleTimeoutInMinutesInstance4 = DatatypeConverter
                                                    .parseInt(idleTimeoutInMinutesElement4.getTextContent());
                                            publicIPInstance2
                                                    .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance4);
                                        }

                                        Element domainNameLabelElement2 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "DomainNameLabel");
                                        if (domainNameLabelElement2 != null) {
                                            String domainNameLabelInstance2;
                                            domainNameLabelInstance2 = domainNameLabelElement2.getTextContent();
                                            publicIPInstance2.setDomainNameLabel(domainNameLabelInstance2);
                                        }
                                    }
                                }

                                Element networkInterfacesSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkInterfaces");
                                if (networkInterfacesSequenceElement2 != null) {
                                    for (int i19 = 0; i19 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(networkInterfacesSequenceElement2,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "NetworkInterface")
                                            .size(); i19 = i19 + 1) {
                                        org.w3c.dom.Element networkInterfacesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(networkInterfacesSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "NetworkInterface")
                                                .get(i19));
                                        NetworkInterface networkInterfaceInstance2 = new NetworkInterface();
                                        configurationSetInstance.getNetworkInterfaces()
                                                .add(networkInterfaceInstance2);

                                        Element nameElement9 = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure", "Name");
                                        if (nameElement9 != null) {
                                            String nameInstance9;
                                            nameInstance9 = nameElement9.getTextContent();
                                            networkInterfaceInstance2.setName(nameInstance9);
                                        }

                                        Element iPConfigurationsSequenceElement2 = XmlUtility
                                                .getElementByTagNameNS(networkInterfacesElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfigurations");
                                        if (iPConfigurationsSequenceElement2 != null) {
                                            for (int i20 = 0; i20 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(iPConfigurationsSequenceElement2,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "IPConfiguration")
                                                    .size(); i20 = i20 + 1) {
                                                org.w3c.dom.Element iPConfigurationsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(
                                                                iPConfigurationsSequenceElement2,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "IPConfiguration")
                                                        .get(i20));
                                                IPConfiguration iPConfigurationInstance2 = new IPConfiguration();
                                                networkInterfaceInstance2.getIPConfigurations()
                                                        .add(iPConfigurationInstance2);

                                                Element subnetNameElement2 = XmlUtility.getElementByTagNameNS(
                                                        iPConfigurationsElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubnetName");
                                                if (subnetNameElement2 != null) {
                                                    String subnetNameInstance2;
                                                    subnetNameInstance2 = subnetNameElement2.getTextContent();
                                                    iPConfigurationInstance2.setSubnetName(subnetNameInstance2);
                                                }

                                                Element staticVirtualNetworkIPAddressElement2 = XmlUtility
                                                        .getElementByTagNameNS(iPConfigurationsElement2,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "StaticVirtualNetworkIPAddress");
                                                if (staticVirtualNetworkIPAddressElement2 != null) {
                                                    String staticVirtualNetworkIPAddressInstance2;
                                                    staticVirtualNetworkIPAddressInstance2 = staticVirtualNetworkIPAddressElement2
                                                            .getTextContent();
                                                    iPConfigurationInstance2.setStaticVirtualNetworkIPAddress(
                                                            staticVirtualNetworkIPAddressInstance2);
                                                }
                                            }
                                        }

                                        Element networkSecurityGroupElement = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "NetworkSecurityGroup");
                                        if (networkSecurityGroupElement != null) {
                                            String networkSecurityGroupInstance;
                                            networkSecurityGroupInstance = networkSecurityGroupElement
                                                    .getTextContent();
                                            networkInterfaceInstance2
                                                    .setNetworkSecurityGroup(networkSecurityGroupInstance);
                                        }

                                        Element iPForwardingElement = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure", "IPForwarding");
                                        if (iPForwardingElement != null) {
                                            String iPForwardingInstance;
                                            iPForwardingInstance = iPForwardingElement.getTextContent();
                                            networkInterfaceInstance2.setIPForwarding(iPForwardingInstance);
                                        }
                                    }
                                }

                                Element networkSecurityGroupElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkSecurityGroup");
                                if (networkSecurityGroupElement2 != null) {
                                    String networkSecurityGroupInstance2;
                                    networkSecurityGroupInstance2 = networkSecurityGroupElement2
                                            .getTextContent();
                                    configurationSetInstance
                                            .setNetworkSecurityGroup(networkSecurityGroupInstance2);
                                }

                                Element iPForwardingElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPForwarding");
                                if (iPForwardingElement2 != null) {
                                    String iPForwardingInstance2;
                                    iPForwardingInstance2 = iPForwardingElement2.getTextContent();
                                    configurationSetInstance.setIPForwarding(iPForwardingInstance2);
                                }

                                Element computerNameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ComputerName");
                                if (computerNameElement != null) {
                                    String computerNameInstance;
                                    computerNameInstance = computerNameElement.getTextContent();
                                    configurationSetInstance.setComputerName(computerNameInstance);
                                }

                                Element adminPasswordElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdminPassword");
                                if (adminPasswordElement != null) {
                                    String adminPasswordInstance;
                                    adminPasswordInstance = adminPasswordElement.getTextContent();
                                    configurationSetInstance.setAdminPassword(adminPasswordInstance);
                                }

                                Element resetPasswordOnFirstLogonElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ResetPasswordOnFirstLogon");
                                if (resetPasswordOnFirstLogonElement != null
                                        && resetPasswordOnFirstLogonElement.getTextContent() != null
                                        && !resetPasswordOnFirstLogonElement.getTextContent().isEmpty()) {
                                    boolean resetPasswordOnFirstLogonInstance;
                                    resetPasswordOnFirstLogonInstance = DatatypeConverter.parseBoolean(
                                            resetPasswordOnFirstLogonElement.getTextContent().toLowerCase());
                                    configurationSetInstance
                                            .setResetPasswordOnFirstLogon(resetPasswordOnFirstLogonInstance);
                                }

                                Element enableAutomaticUpdatesElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "EnableAutomaticUpdates");
                                if (enableAutomaticUpdatesElement != null
                                        && enableAutomaticUpdatesElement.getTextContent() != null
                                        && !enableAutomaticUpdatesElement.getTextContent().isEmpty()) {
                                    boolean enableAutomaticUpdatesInstance;
                                    enableAutomaticUpdatesInstance = DatatypeConverter.parseBoolean(
                                            enableAutomaticUpdatesElement.getTextContent().toLowerCase());
                                    configurationSetInstance
                                            .setEnableAutomaticUpdates(enableAutomaticUpdatesInstance);
                                }

                                Element timeZoneElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "TimeZone");
                                if (timeZoneElement != null) {
                                    String timeZoneInstance;
                                    timeZoneInstance = timeZoneElement.getTextContent();
                                    configurationSetInstance.setTimeZone(timeZoneInstance);
                                }

                                Element domainJoinElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainJoin");
                                if (domainJoinElement != null) {
                                    DomainJoinSettings domainJoinInstance = new DomainJoinSettings();
                                    configurationSetInstance.setDomainJoin(domainJoinInstance);

                                    Element credentialsElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "Credentials");
                                    if (credentialsElement != null) {
                                        DomainJoinCredentials credentialsInstance = new DomainJoinCredentials();
                                        domainJoinInstance.setCredentials(credentialsInstance);

                                        Element domainElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Domain");
                                        if (domainElement != null) {
                                            String domainInstance;
                                            domainInstance = domainElement.getTextContent();
                                            credentialsInstance.setDomain(domainInstance);
                                        }

                                        Element usernameElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Username");
                                        if (usernameElement != null) {
                                            String usernameInstance;
                                            usernameInstance = usernameElement.getTextContent();
                                            credentialsInstance.setUserName(usernameInstance);
                                        }

                                        Element passwordElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Password");
                                        if (passwordElement != null) {
                                            String passwordInstance;
                                            passwordInstance = passwordElement.getTextContent();
                                            credentialsInstance.setPassword(passwordInstance);
                                        }
                                    }

                                    Element joinDomainElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "JoinDomain");
                                    if (joinDomainElement != null) {
                                        String joinDomainInstance;
                                        joinDomainInstance = joinDomainElement.getTextContent();
                                        domainJoinInstance.setDomainToJoin(joinDomainInstance);
                                    }

                                    Element machineObjectOUElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "MachineObjectOU");
                                    if (machineObjectOUElement != null) {
                                        String machineObjectOUInstance;
                                        machineObjectOUInstance = machineObjectOUElement.getTextContent();
                                        domainJoinInstance.setLdapMachineObjectOU(machineObjectOUInstance);
                                    }

                                    Element provisioningElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "Provisioning");
                                    if (provisioningElement != null) {
                                        DomainJoinProvisioning provisioningInstance = new DomainJoinProvisioning();
                                        domainJoinInstance.setProvisioning(provisioningInstance);

                                        Element accountDataElement = XmlUtility.getElementByTagNameNS(
                                                provisioningElement,
                                                "http://schemas.microsoft.com/windowsazure", "AccountData");
                                        if (accountDataElement != null) {
                                            String accountDataInstance;
                                            accountDataInstance = accountDataElement.getTextContent();
                                            provisioningInstance.setAccountData(accountDataInstance);
                                        }
                                    }
                                }

                                Element storedCertificateSettingsSequenceElement = XmlUtility
                                        .getElementByTagNameNS(configurationSetsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "StoredCertificateSettings");
                                if (storedCertificateSettingsSequenceElement != null) {
                                    for (int i21 = 0; i21 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(storedCertificateSettingsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "CertificateSetting")
                                            .size(); i21 = i21 + 1) {
                                        org.w3c.dom.Element storedCertificateSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(
                                                        storedCertificateSettingsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "CertificateSetting")
                                                .get(i21));
                                        StoredCertificateSettings certificateSettingInstance = new StoredCertificateSettings();
                                        configurationSetInstance.getStoredCertificateSettings()
                                                .add(certificateSettingInstance);

                                        Element storeLocationElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "StoreLocation");
                                        if (storeLocationElement != null) {
                                        }

                                        Element storeNameElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "StoreName");
                                        if (storeNameElement != null) {
                                            String storeNameInstance;
                                            storeNameInstance = storeNameElement.getTextContent();
                                            certificateSettingInstance.setStoreName(storeNameInstance);
                                        }

                                        Element thumbprintElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Thumbprint");
                                        if (thumbprintElement != null) {
                                            String thumbprintInstance;
                                            thumbprintInstance = thumbprintElement.getTextContent();
                                            certificateSettingInstance.setThumbprint(thumbprintInstance);
                                        }
                                    }
                                }

                                Element winRMElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "WinRM");
                                if (winRMElement != null) {
                                    WindowsRemoteManagementSettings winRMInstance = new WindowsRemoteManagementSettings();
                                    configurationSetInstance.setWindowsRemoteManagement(winRMInstance);

                                    Element listenersSequenceElement = XmlUtility.getElementByTagNameNS(
                                            winRMElement, "http://schemas.microsoft.com/windowsazure",
                                            "Listeners");
                                    if (listenersSequenceElement != null) {
                                        for (int i22 = 0; i22 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(listenersSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Listener")
                                                .size(); i22 = i22 + 1) {
                                            org.w3c.dom.Element listenersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(listenersSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Listener")
                                                    .get(i22));
                                            WindowsRemoteManagementListener listenerInstance = new WindowsRemoteManagementListener();
                                            winRMInstance.getListeners().add(listenerInstance);

                                            Element protocolElement4 = XmlUtility.getElementByTagNameNS(
                                                    listenersElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Protocol");
                                            if (protocolElement4 != null
                                                    && protocolElement4.getTextContent() != null
                                                    && !protocolElement4.getTextContent().isEmpty()) {
                                                VirtualMachineWindowsRemoteManagementListenerType protocolInstance4;
                                                protocolInstance4 = VirtualMachineWindowsRemoteManagementListenerType
                                                        .valueOf(protocolElement4.getTextContent());
                                                listenerInstance.setListenerType(protocolInstance4);
                                            }

                                            Element certificateThumbprintElement = XmlUtility
                                                    .getElementByTagNameNS(listenersElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "CertificateThumbprint");
                                            if (certificateThumbprintElement != null) {
                                                String certificateThumbprintInstance;
                                                certificateThumbprintInstance = certificateThumbprintElement
                                                        .getTextContent();
                                                listenerInstance.setCertificateThumbprint(
                                                        certificateThumbprintInstance);
                                            }
                                        }
                                    }
                                }

                                Element adminUsernameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdminUsername");
                                if (adminUsernameElement != null) {
                                    String adminUsernameInstance;
                                    adminUsernameInstance = adminUsernameElement.getTextContent();
                                    configurationSetInstance.setAdminUserName(adminUsernameInstance);
                                }

                                Element additionalUnattendContentElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdditionalUnattendContent");
                                if (additionalUnattendContentElement != null) {
                                    AdditionalUnattendContentSettings additionalUnattendContentInstance = new AdditionalUnattendContentSettings();
                                    configurationSetInstance
                                            .setAdditionalUnattendContent(additionalUnattendContentInstance);

                                    Element passesSequenceElement = XmlUtility.getElementByTagNameNS(
                                            additionalUnattendContentElement,
                                            "http://schemas.microsoft.com/windowsazure", "Passes");
                                    if (passesSequenceElement != null) {
                                        for (int i23 = 0; i23 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(passesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "UnattendPass")
                                                .size(); i23 = i23 + 1) {
                                            org.w3c.dom.Element passesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(passesSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "UnattendPass")
                                                    .get(i23));
                                            UnattendPassSettings unattendPassInstance = new UnattendPassSettings();
                                            additionalUnattendContentInstance.getUnattendPasses()
                                                    .add(unattendPassInstance);

                                            Element passNameElement = XmlUtility.getElementByTagNameNS(
                                                    passesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "PassName");
                                            if (passNameElement != null) {
                                                String passNameInstance;
                                                passNameInstance = passNameElement.getTextContent();
                                                unattendPassInstance.setPassName(passNameInstance);
                                            }

                                            Element componentsSequenceElement = XmlUtility
                                                    .getElementByTagNameNS(passesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Components");
                                            if (componentsSequenceElement != null) {
                                                for (int i24 = 0; i24 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(componentsSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "UnattendComponent")
                                                        .size(); i24 = i24 + 1) {
                                                    org.w3c.dom.Element componentsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(componentsSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "UnattendComponent")
                                                            .get(i24));
                                                    UnattendComponent unattendComponentInstance = new UnattendComponent();
                                                    unattendPassInstance.getUnattendComponents()
                                                            .add(unattendComponentInstance);

                                                    Element componentNameElement = XmlUtility
                                                            .getElementByTagNameNS(componentsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentName");
                                                    if (componentNameElement != null) {
                                                        String componentNameInstance;
                                                        componentNameInstance = componentNameElement
                                                                .getTextContent();
                                                        unattendComponentInstance
                                                                .setComponentName(componentNameInstance);
                                                    }

                                                    Element componentSettingsSequenceElement = XmlUtility
                                                            .getElementByTagNameNS(componentsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentSettings");
                                                    if (componentSettingsSequenceElement != null) {
                                                        for (int i25 = 0; i25 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                                .getElementsByTagNameNS(
                                                                        componentSettingsSequenceElement,
                                                                        "http://schemas.microsoft.com/windowsazure",
                                                                        "ComponentSetting")
                                                                .size(); i25 = i25 + 1) {
                                                            org.w3c.dom.Element componentSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                                    .getElementsByTagNameNS(
                                                                            componentSettingsSequenceElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "ComponentSetting")
                                                                    .get(i25));
                                                            ComponentSetting componentSettingInstance = new ComponentSetting();
                                                            unattendComponentInstance
                                                                    .getUnattendComponentSettings()
                                                                    .add(componentSettingInstance);

                                                            Element settingNameElement = XmlUtility
                                                                    .getElementByTagNameNS(
                                                                            componentSettingsElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "SettingName");
                                                            if (settingNameElement != null) {
                                                                String settingNameInstance;
                                                                settingNameInstance = settingNameElement
                                                                        .getTextContent();
                                                                componentSettingInstance
                                                                        .setSettingName(settingNameInstance);
                                                            }

                                                            Element contentElement = XmlUtility
                                                                    .getElementByTagNameNS(
                                                                            componentSettingsElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "Content");
                                                            if (contentElement != null) {
                                                                String contentInstance;
                                                                contentInstance = contentElement
                                                                        .getTextContent() != null ? new String(
                                                                                Base64.decode(contentElement
                                                                                        .getTextContent()))
                                                                                : null;
                                                                componentSettingInstance
                                                                        .setContent(contentInstance);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                Element hostNameElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "HostName");
                                if (hostNameElement2 != null) {
                                    String hostNameInstance2;
                                    hostNameInstance2 = hostNameElement2.getTextContent();
                                    configurationSetInstance.setHostName(hostNameInstance2);
                                }

                                Element userNameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "UserName");
                                if (userNameElement != null) {
                                    String userNameInstance;
                                    userNameInstance = userNameElement.getTextContent();
                                    configurationSetInstance.setUserName(userNameInstance);
                                }

                                Element userPasswordElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "UserPassword");
                                if (userPasswordElement != null) {
                                    String userPasswordInstance;
                                    userPasswordInstance = userPasswordElement.getTextContent();
                                    configurationSetInstance.setUserPassword(userPasswordInstance);
                                }

                                Element disableSshPasswordAuthenticationElement = XmlUtility
                                        .getElementByTagNameNS(configurationSetsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DisableSshPasswordAuthentication");
                                if (disableSshPasswordAuthenticationElement != null
                                        && disableSshPasswordAuthenticationElement.getTextContent() != null
                                        && !disableSshPasswordAuthenticationElement.getTextContent()
                                                .isEmpty()) {
                                    boolean disableSshPasswordAuthenticationInstance;
                                    disableSshPasswordAuthenticationInstance = DatatypeConverter
                                            .parseBoolean(disableSshPasswordAuthenticationElement
                                                    .getTextContent().toLowerCase());
                                    configurationSetInstance.setDisableSshPasswordAuthentication(
                                            disableSshPasswordAuthenticationInstance);
                                }

                                Element sSHElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                        "http://schemas.microsoft.com/windowsazure", "SSH");
                                if (sSHElement != null) {
                                    SshSettings sSHInstance = new SshSettings();
                                    configurationSetInstance.setSshSettings(sSHInstance);

                                    Element publicKeysSequenceElement = XmlUtility.getElementByTagNameNS(
                                            sSHElement, "http://schemas.microsoft.com/windowsazure",
                                            "PublicKeys");
                                    if (publicKeysSequenceElement != null) {
                                        for (int i26 = 0; i26 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(publicKeysSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "PublicKey")
                                                .size(); i26 = i26 + 1) {
                                            org.w3c.dom.Element publicKeysElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(publicKeysSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "PublicKey")
                                                    .get(i26));
                                            SshSettingPublicKey publicKeyInstance = new SshSettingPublicKey();
                                            sSHInstance.getPublicKeys().add(publicKeyInstance);

                                            Element fingerprintElement = XmlUtility.getElementByTagNameNS(
                                                    publicKeysElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fingerprint");
                                            if (fingerprintElement != null) {
                                                String fingerprintInstance;
                                                fingerprintInstance = fingerprintElement.getTextContent();
                                                publicKeyInstance.setFingerprint(fingerprintInstance);
                                            }

                                            Element pathElement2 = XmlUtility.getElementByTagNameNS(
                                                    publicKeysElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement2 != null) {
                                                String pathInstance2;
                                                pathInstance2 = pathElement2.getTextContent();
                                                publicKeyInstance.setPath(pathInstance2);
                                            }
                                        }
                                    }

                                    Element keyPairsSequenceElement = XmlUtility.getElementByTagNameNS(
                                            sSHElement, "http://schemas.microsoft.com/windowsazure",
                                            "KeyPairs");
                                    if (keyPairsSequenceElement != null) {
                                        for (int i27 = 0; i27 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(keyPairsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "KeyPair")
                                                .size(); i27 = i27 + 1) {
                                            org.w3c.dom.Element keyPairsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(keyPairsSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "KeyPair")
                                                    .get(i27));
                                            SshSettingKeyPair keyPairInstance = new SshSettingKeyPair();
                                            sSHInstance.getKeyPairs().add(keyPairInstance);

                                            Element fingerprintElement2 = XmlUtility.getElementByTagNameNS(
                                                    keyPairsElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fingerprint");
                                            if (fingerprintElement2 != null) {
                                                String fingerprintInstance2;
                                                fingerprintInstance2 = fingerprintElement2.getTextContent();
                                                keyPairInstance.setFingerprint(fingerprintInstance2);
                                            }

                                            Element pathElement3 = XmlUtility.getElementByTagNameNS(
                                                    keyPairsElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement3 != null) {
                                                String pathInstance3;
                                                pathInstance3 = pathElement3.getTextContent();
                                                keyPairInstance.setPath(pathInstance3);
                                            }
                                        }
                                    }
                                }

                                Element customDataElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "CustomData");
                                if (customDataElement != null) {
                                    String customDataInstance;
                                    customDataInstance = customDataElement.getTextContent();
                                    configurationSetInstance.setCustomData(customDataInstance);
                                }
                            }
                        }

                        Element resourceExtensionReferencesSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "ResourceExtensionReferences");
                        if (resourceExtensionReferencesSequenceElement != null) {
                            for (int i28 = 0; i28 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(resourceExtensionReferencesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ResourceExtensionReference")
                                    .size(); i28 = i28 + 1) {
                                org.w3c.dom.Element resourceExtensionReferencesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(resourceExtensionReferencesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionReference")
                                        .get(i28));
                                ResourceExtensionReference resourceExtensionReferenceInstance = new ResourceExtensionReference();
                                roleInstance.getResourceExtensionReferences()
                                        .add(resourceExtensionReferenceInstance);

                                Element referenceNameElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "ReferenceName");
                                if (referenceNameElement != null) {
                                    String referenceNameInstance;
                                    referenceNameInstance = referenceNameElement.getTextContent();
                                    resourceExtensionReferenceInstance.setReferenceName(referenceNameInstance);
                                }

                                Element publisherElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Publisher");
                                if (publisherElement != null) {
                                    String publisherInstance;
                                    publisherInstance = publisherElement.getTextContent();
                                    resourceExtensionReferenceInstance.setPublisher(publisherInstance);
                                }

                                Element nameElement10 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement10 != null) {
                                    String nameInstance10;
                                    nameInstance10 = nameElement10.getTextContent();
                                    resourceExtensionReferenceInstance.setName(nameInstance10);
                                }

                                Element versionElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Version");
                                if (versionElement2 != null) {
                                    String versionInstance2;
                                    versionInstance2 = versionElement2.getTextContent();
                                    resourceExtensionReferenceInstance.setVersion(versionInstance2);
                                }

                                Element resourceExtensionParameterValuesSequenceElement = XmlUtility
                                        .getElementByTagNameNS(resourceExtensionReferencesElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionParameterValues");
                                if (resourceExtensionParameterValuesSequenceElement != null) {
                                    for (int i29 = 0; i29 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(
                                                    resourceExtensionParameterValuesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "ResourceExtensionParameterValue")
                                            .size(); i29 = i29 + 1) {
                                        org.w3c.dom.Element resourceExtensionParameterValuesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(
                                                        resourceExtensionParameterValuesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "ResourceExtensionParameterValue")
                                                .get(i29));
                                        ResourceExtensionParameterValue resourceExtensionParameterValueInstance = new ResourceExtensionParameterValue();
                                        resourceExtensionReferenceInstance.getResourceExtensionParameterValues()
                                                .add(resourceExtensionParameterValueInstance);

                                        Element keyElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Key");
                                        if (keyElement != null) {
                                            String keyInstance;
                                            keyInstance = keyElement.getTextContent();
                                            resourceExtensionParameterValueInstance.setKey(keyInstance);
                                        }

                                        Element valueElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Value");
                                        if (valueElement != null) {
                                            String valueInstance;
                                            valueInstance = valueElement.getTextContent() != null
                                                    ? new String(Base64.decode(valueElement.getTextContent()))
                                                    : null;
                                            resourceExtensionParameterValueInstance.setValue(valueInstance);
                                        }

                                        Element typeElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Type");
                                        if (typeElement != null) {
                                            String typeInstance;
                                            typeInstance = typeElement.getTextContent();
                                            resourceExtensionParameterValueInstance.setType(typeInstance);
                                        }
                                    }
                                }

                                Element stateElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "State");
                                if (stateElement != null) {
                                    String stateInstance;
                                    stateInstance = stateElement.getTextContent();
                                    resourceExtensionReferenceInstance.setState(stateInstance);
                                }

                                Element forceUpdateElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "ForceUpdate");
                                if (forceUpdateElement != null && forceUpdateElement.getTextContent() != null
                                        && !forceUpdateElement.getTextContent().isEmpty()) {
                                    boolean forceUpdateInstance;
                                    forceUpdateInstance = DatatypeConverter
                                            .parseBoolean(forceUpdateElement.getTextContent().toLowerCase());
                                    resourceExtensionReferenceInstance.setForceUpdate(forceUpdateInstance);
                                }
                            }
                        }

                        Element vMImageNameElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "VMImageName");
                        if (vMImageNameElement != null) {
                            String vMImageNameInstance;
                            vMImageNameInstance = vMImageNameElement.getTextContent();
                            roleInstance.setVMImageName(vMImageNameInstance);
                        }

                        Element mediaLocationElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "MediaLocation");
                        if (mediaLocationElement != null) {
                            URI mediaLocationInstance;
                            mediaLocationInstance = new URI(mediaLocationElement.getTextContent());
                            roleInstance.setMediaLocation(mediaLocationInstance);
                        }

                        Element availabilitySetNameElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "AvailabilitySetName");
                        if (availabilitySetNameElement != null) {
                            String availabilitySetNameInstance;
                            availabilitySetNameInstance = availabilitySetNameElement.getTextContent();
                            roleInstance.setAvailabilitySetName(availabilitySetNameInstance);
                        }

                        Element dataVirtualHardDisksSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "DataVirtualHardDisks");
                        if (dataVirtualHardDisksSequenceElement != null) {
                            for (int i30 = 0; i30 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "DataVirtualHardDisk")
                                    .size(); i30 = i30 + 1) {
                                org.w3c.dom.Element dataVirtualHardDisksElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DataVirtualHardDisk")
                                        .get(i30));
                                DataVirtualHardDisk dataVirtualHardDiskInstance = new DataVirtualHardDisk();
                                roleInstance.getDataVirtualHardDisks().add(dataVirtualHardDiskInstance);

                                Element hostCachingElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "HostCaching");
                                if (hostCachingElement != null) {
                                    String hostCachingInstance;
                                    hostCachingInstance = hostCachingElement.getTextContent();
                                    dataVirtualHardDiskInstance.setHostCaching(hostCachingInstance);
                                }

                                Element diskLabelElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "DiskLabel");
                                if (diskLabelElement != null) {
                                    String diskLabelInstance;
                                    diskLabelInstance = diskLabelElement.getTextContent();
                                    dataVirtualHardDiskInstance.setLabel(diskLabelInstance);
                                }

                                Element diskNameElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "DiskName");
                                if (diskNameElement != null) {
                                    String diskNameInstance;
                                    diskNameInstance = diskNameElement.getTextContent();
                                    dataVirtualHardDiskInstance.setName(diskNameInstance);
                                }

                                Element lunElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "Lun");
                                if (lunElement != null && lunElement.getTextContent() != null
                                        && !lunElement.getTextContent().isEmpty()) {
                                    int lunInstance;
                                    lunInstance = DatatypeConverter.parseInt(lunElement.getTextContent());
                                    dataVirtualHardDiskInstance.setLogicalUnitNumber(lunInstance);
                                }

                                Element logicalDiskSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "LogicalDiskSizeInGB");
                                if (logicalDiskSizeInGBElement != null
                                        && logicalDiskSizeInGBElement.getTextContent() != null
                                        && !logicalDiskSizeInGBElement.getTextContent().isEmpty()) {
                                    int logicalDiskSizeInGBInstance;
                                    logicalDiskSizeInGBInstance = DatatypeConverter
                                            .parseInt(logicalDiskSizeInGBElement.getTextContent());
                                    dataVirtualHardDiskInstance
                                            .setLogicalDiskSizeInGB(logicalDiskSizeInGBInstance);
                                }

                                Element mediaLinkElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "MediaLink");
                                if (mediaLinkElement != null) {
                                    URI mediaLinkInstance;
                                    mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
                                    dataVirtualHardDiskInstance.setMediaLink(mediaLinkInstance);
                                }

                                Element sourceMediaLinkElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "SourceMediaLink");
                                if (sourceMediaLinkElement != null) {
                                    URI sourceMediaLinkInstance;
                                    sourceMediaLinkInstance = new URI(sourceMediaLinkElement.getTextContent());
                                    dataVirtualHardDiskInstance.setSourceMediaLink(sourceMediaLinkInstance);
                                }

                                Element iOTypeElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "IOType");
                                if (iOTypeElement != null) {
                                    String iOTypeInstance;
                                    iOTypeInstance = iOTypeElement.getTextContent();
                                    dataVirtualHardDiskInstance.setIOType(iOTypeInstance);
                                }
                            }
                        }

                        Element labelElement2 = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "Label");
                        if (labelElement2 != null) {
                            String labelInstance2;
                            labelInstance2 = labelElement2.getTextContent();
                            roleInstance.setLabel(labelInstance2);
                        }

                        Element oSVirtualHardDiskElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "OSVirtualHardDisk");
                        if (oSVirtualHardDiskElement != null) {
                            OSVirtualHardDisk oSVirtualHardDiskInstance = new OSVirtualHardDisk();
                            roleInstance.setOSVirtualHardDisk(oSVirtualHardDiskInstance);

                            Element hostCachingElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "HostCaching");
                            if (hostCachingElement2 != null) {
                                String hostCachingInstance2;
                                hostCachingInstance2 = hostCachingElement2.getTextContent();
                                oSVirtualHardDiskInstance.setHostCaching(hostCachingInstance2);
                            }

                            Element diskLabelElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "DiskLabel");
                            if (diskLabelElement2 != null) {
                                String diskLabelInstance2;
                                diskLabelInstance2 = diskLabelElement2.getTextContent();
                                oSVirtualHardDiskInstance.setLabel(diskLabelInstance2);
                            }

                            Element diskNameElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "DiskName");
                            if (diskNameElement2 != null) {
                                String diskNameInstance2;
                                diskNameInstance2 = diskNameElement2.getTextContent();
                                oSVirtualHardDiskInstance.setName(diskNameInstance2);
                            }

                            Element mediaLinkElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "MediaLink");
                            if (mediaLinkElement2 != null) {
                                URI mediaLinkInstance2;
                                mediaLinkInstance2 = new URI(mediaLinkElement2.getTextContent());
                                oSVirtualHardDiskInstance.setMediaLink(mediaLinkInstance2);
                            }

                            Element sourceImageNameElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "SourceImageName");
                            if (sourceImageNameElement != null) {
                                String sourceImageNameInstance;
                                sourceImageNameInstance = sourceImageNameElement.getTextContent();
                                oSVirtualHardDiskInstance.setSourceImageName(sourceImageNameInstance);
                            }

                            Element osElement = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                                    "http://schemas.microsoft.com/windowsazure", "OS");
                            if (osElement != null) {
                                String osInstance;
                                osInstance = osElement.getTextContent();
                                oSVirtualHardDiskInstance.setOperatingSystem(osInstance);
                            }

                            Element remoteSourceImageLinkElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "RemoteSourceImageLink");
                            if (remoteSourceImageLinkElement != null) {
                                URI remoteSourceImageLinkInstance;
                                remoteSourceImageLinkInstance = new URI(
                                        remoteSourceImageLinkElement.getTextContent());
                                oSVirtualHardDiskInstance
                                        .setRemoteSourceImageLink(remoteSourceImageLinkInstance);
                            }

                            Element iOTypeElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                                    "http://schemas.microsoft.com/windowsazure", "IOType");
                            if (iOTypeElement2 != null) {
                                String iOTypeInstance2;
                                iOTypeInstance2 = iOTypeElement2.getTextContent();
                                oSVirtualHardDiskInstance.setIOType(iOTypeInstance2);
                            }

                            Element resizedSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "ResizedSizeInGB");
                            if (resizedSizeInGBElement != null
                                    && resizedSizeInGBElement.getTextContent() != null
                                    && !resizedSizeInGBElement.getTextContent().isEmpty()) {
                                int resizedSizeInGBInstance;
                                resizedSizeInGBInstance = DatatypeConverter
                                        .parseInt(resizedSizeInGBElement.getTextContent());
                                oSVirtualHardDiskInstance.setResizedSizeInGB(resizedSizeInGBInstance);
                            }
                        }

                        Element roleSizeElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleSize");
                        if (roleSizeElement != null) {
                            String roleSizeInstance;
                            roleSizeInstance = roleSizeElement.getTextContent();
                            roleInstance.setRoleSize(roleSizeInstance);
                        }

                        Element defaultWinRmCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "DefaultWinRmCertificateThumbprint");
                        if (defaultWinRmCertificateThumbprintElement != null) {
                            String defaultWinRmCertificateThumbprintInstance;
                            defaultWinRmCertificateThumbprintInstance = defaultWinRmCertificateThumbprintElement
                                    .getTextContent();
                            roleInstance.setDefaultWinRmCertificateThumbprint(
                                    defaultWinRmCertificateThumbprintInstance);
                        }

                        Element provisionGuestAgentElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "ProvisionGuestAgent");
                        if (provisionGuestAgentElement != null
                                && provisionGuestAgentElement.getTextContent() != null
                                && !provisionGuestAgentElement.getTextContent().isEmpty()) {
                            boolean provisionGuestAgentInstance;
                            provisionGuestAgentInstance = DatatypeConverter
                                    .parseBoolean(provisionGuestAgentElement.getTextContent().toLowerCase());
                            roleInstance.setProvisionGuestAgent(provisionGuestAgentInstance);
                        }

                        Element vMImageInputElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "VMImageInput");
                        if (vMImageInputElement != null) {
                            VMImageInput vMImageInputInstance = new VMImageInput();
                            roleInstance.setVMImageInput(vMImageInputInstance);

                            Element oSDiskConfigurationElement = XmlUtility.getElementByTagNameNS(
                                    vMImageInputElement, "http://schemas.microsoft.com/windowsazure",
                                    "OSDiskConfiguration");
                            if (oSDiskConfigurationElement != null) {
                                OSDiskConfiguration oSDiskConfigurationInstance = new OSDiskConfiguration();
                                vMImageInputInstance.setOSDiskConfiguration(oSDiskConfigurationInstance);

                                Element resizedSizeInGBElement2 = XmlUtility.getElementByTagNameNS(
                                        oSDiskConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                        "ResizedSizeInGB");
                                if (resizedSizeInGBElement2 != null
                                        && resizedSizeInGBElement2.getTextContent() != null
                                        && !resizedSizeInGBElement2.getTextContent().isEmpty()) {
                                    int resizedSizeInGBInstance2;
                                    resizedSizeInGBInstance2 = DatatypeConverter
                                            .parseInt(resizedSizeInGBElement2.getTextContent());
                                    oSDiskConfigurationInstance.setResizedSizeInGB(resizedSizeInGBInstance2);
                                }
                            }

                            Element dataDiskConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                    vMImageInputElement, "http://schemas.microsoft.com/windowsazure",
                                    "DataDiskConfigurations");
                            if (dataDiskConfigurationsSequenceElement != null) {
                                for (int i31 = 0; i31 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(dataDiskConfigurationsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DataDiskConfiguration")
                                        .size(); i31 = i31 + 1) {
                                    org.w3c.dom.Element dataDiskConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(dataDiskConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "DataDiskConfiguration")
                                            .get(i31));
                                    DataDiskConfiguration dataDiskConfigurationInstance = new DataDiskConfiguration();
                                    vMImageInputInstance.getDataDiskConfigurations()
                                            .add(dataDiskConfigurationInstance);

                                    Element nameElement11 = XmlUtility.getElementByTagNameNS(
                                            dataDiskConfigurationsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement11 != null) {
                                        String nameInstance11;
                                        nameInstance11 = nameElement11.getTextContent();
                                        dataDiskConfigurationInstance.setDiskName(nameInstance11);
                                    }

                                    Element resizedSizeInGBElement3 = XmlUtility.getElementByTagNameNS(
                                            dataDiskConfigurationsElement,
                                            "http://schemas.microsoft.com/windowsazure", "ResizedSizeInGB");
                                    if (resizedSizeInGBElement3 != null
                                            && resizedSizeInGBElement3.getTextContent() != null
                                            && !resizedSizeInGBElement3.getTextContent().isEmpty()) {
                                        int resizedSizeInGBInstance3;
                                        resizedSizeInGBInstance3 = DatatypeConverter
                                                .parseInt(resizedSizeInGBElement3.getTextContent());
                                        dataDiskConfigurationInstance
                                                .setResizedSizeInGB(resizedSizeInGBInstance3);
                                    }
                                }
                            }
                        }
                    }
                }

                Element sdkVersionElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "SdkVersion");
                if (sdkVersionElement != null) {
                    String sdkVersionInstance;
                    sdkVersionInstance = sdkVersionElement.getTextContent();
                    result.setSdkVersion(sdkVersionInstance);
                }

                Element lockedElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Locked");
                if (lockedElement != null && lockedElement.getTextContent() != null
                        && !lockedElement.getTextContent().isEmpty()) {
                    boolean lockedInstance;
                    lockedInstance = DatatypeConverter
                            .parseBoolean(lockedElement.getTextContent().toLowerCase());
                    result.setLocked(lockedInstance);
                }

                Element rollbackAllowedElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RollbackAllowed");
                if (rollbackAllowedElement != null && rollbackAllowedElement.getTextContent() != null
                        && !rollbackAllowedElement.getTextContent().isEmpty()) {
                    boolean rollbackAllowedInstance;
                    rollbackAllowedInstance = DatatypeConverter
                            .parseBoolean(rollbackAllowedElement.getTextContent().toLowerCase());
                    result.setRollbackAllowed(rollbackAllowedInstance);
                }

                Element virtualNetworkNameElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "VirtualNetworkName");
                if (virtualNetworkNameElement != null) {
                    String virtualNetworkNameInstance;
                    virtualNetworkNameInstance = virtualNetworkNameElement.getTextContent();
                    result.setVirtualNetworkName(virtualNetworkNameInstance);
                }

                Element createdTimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "CreatedTime");
                if (createdTimeElement != null) {
                    Calendar createdTimeInstance;
                    createdTimeInstance = DatatypeConverter.parseDateTime(createdTimeElement.getTextContent());
                    result.setCreatedTime(createdTimeInstance);
                }

                Element lastModifiedTimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "LastModifiedTime");
                if (lastModifiedTimeElement != null) {
                    Calendar lastModifiedTimeInstance;
                    lastModifiedTimeInstance = DatatypeConverter
                            .parseDateTime(lastModifiedTimeElement.getTextContent());
                    result.setLastModifiedTime(lastModifiedTimeInstance);
                }

                Element extendedPropertiesSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ExtendedProperties");
                if (extendedPropertiesSequenceElement != null) {
                    for (int i32 = 0; i32 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(extendedPropertiesSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "ExtendedProperty")
                            .size(); i32 = i32 + 1) {
                        org.w3c.dom.Element extendedPropertiesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(extendedPropertiesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "ExtendedProperty")
                                .get(i32));
                        String extendedPropertiesKey = XmlUtility
                                .getElementByTagNameNS(extendedPropertiesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name")
                                .getTextContent();
                        String extendedPropertiesValue = XmlUtility
                                .getElementByTagNameNS(extendedPropertiesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Value")
                                .getTextContent();
                        result.getExtendedProperties().put(extendedPropertiesKey, extendedPropertiesValue);
                    }
                }

                Element dnsElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Dns");
                if (dnsElement != null) {
                    DnsSettings dnsInstance = new DnsSettings();
                    result.setDnsSettings(dnsInstance);

                    Element dnsServersSequenceElement = XmlUtility.getElementByTagNameNS(dnsElement,
                            "http://schemas.microsoft.com/windowsazure", "DnsServers");
                    if (dnsServersSequenceElement != null) {
                        for (int i33 = 0; i33 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(dnsServersSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "DnsServer")
                                .size(); i33 = i33 + 1) {
                            org.w3c.dom.Element dnsServersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(dnsServersSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "DnsServer")
                                    .get(i33));
                            DnsServer dnsServerInstance = new DnsServer();
                            dnsInstance.getDnsServers().add(dnsServerInstance);

                            Element nameElement12 = XmlUtility.getElementByTagNameNS(dnsServersElement,
                                    "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement12 != null) {
                                String nameInstance12;
                                nameInstance12 = nameElement12.getTextContent();
                                dnsServerInstance.setName(nameInstance12);
                            }

                            Element addressElement3 = XmlUtility.getElementByTagNameNS(dnsServersElement,
                                    "http://schemas.microsoft.com/windowsazure", "Address");
                            if (addressElement3 != null) {
                                InetAddress addressInstance3;
                                addressInstance3 = InetAddress.getByName(addressElement3.getTextContent());
                                dnsServerInstance.setAddress(addressInstance3);
                            }
                        }
                    }
                }

                Element persistentVMDowntimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "PersistentVMDowntime");
                if (persistentVMDowntimeElement != null) {
                    PersistentVMDowntime persistentVMDowntimeInstance = new PersistentVMDowntime();
                    result.setPersistentVMDowntime(persistentVMDowntimeInstance);

                    Element startTimeElement = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "StartTime");
                    if (startTimeElement != null) {
                        Calendar startTimeInstance;
                        startTimeInstance = DatatypeConverter.parseDateTime(startTimeElement.getTextContent());
                        persistentVMDowntimeInstance.setStartTime(startTimeInstance);
                    }

                    Element endTimeElement = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "EndTime");
                    if (endTimeElement != null) {
                        Calendar endTimeInstance;
                        endTimeInstance = DatatypeConverter.parseDateTime(endTimeElement.getTextContent());
                        persistentVMDowntimeInstance.setEndTime(endTimeInstance);
                    }

                    Element statusElement6 = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "Status");
                    if (statusElement6 != null) {
                        String statusInstance6;
                        statusInstance6 = statusElement6.getTextContent();
                        persistentVMDowntimeInstance.setStatus(statusInstance6);
                    }
                }

                Element virtualIPsSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "VirtualIPs");
                if (virtualIPsSequenceElement != null) {
                    for (int i34 = 0; i34 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(virtualIPsSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "VirtualIP")
                            .size(); i34 = i34 + 1) {
                        org.w3c.dom.Element virtualIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(virtualIPsSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "VirtualIP")
                                .get(i34));
                        VirtualIPAddress virtualIPInstance = new VirtualIPAddress();
                        result.getVirtualIPAddresses().add(virtualIPInstance);

                        Element addressElement4 = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "Address");
                        if (addressElement4 != null) {
                            InetAddress addressInstance4;
                            addressInstance4 = InetAddress.getByName(addressElement4.getTextContent());
                            virtualIPInstance.setAddress(addressInstance4);
                        }

                        Element isDnsProgrammedElement = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "IsDnsProgrammed");
                        if (isDnsProgrammedElement != null && isDnsProgrammedElement.getTextContent() != null
                                && !isDnsProgrammedElement.getTextContent().isEmpty()) {
                            boolean isDnsProgrammedInstance;
                            isDnsProgrammedInstance = DatatypeConverter
                                    .parseBoolean(isDnsProgrammedElement.getTextContent().toLowerCase());
                            virtualIPInstance.setIsDnsProgrammed(isDnsProgrammedInstance);
                        }

                        Element nameElement13 = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement13 != null) {
                            String nameInstance13;
                            nameInstance13 = nameElement13.getTextContent();
                            virtualIPInstance.setName(nameInstance13);
                        }

                        Element reservedIPNameElement = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "ReservedIPName");
                        if (reservedIPNameElement != null) {
                            String reservedIPNameInstance;
                            reservedIPNameInstance = reservedIPNameElement.getTextContent();
                            virtualIPInstance.setReservedIPName(reservedIPNameInstance);
                        }
                    }
                }

                Element extensionConfigurationElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ExtensionConfiguration");
                if (extensionConfigurationElement != null) {
                    ExtensionConfiguration extensionConfigurationInstance = new ExtensionConfiguration();
                    result.setExtensionConfiguration(extensionConfigurationInstance);

                    Element allRolesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                            "AllRoles");
                    if (allRolesSequenceElement != null) {
                        for (int i35 = 0; i35 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(allRolesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Extension")
                                .size(); i35 = i35 + 1) {
                            org.w3c.dom.Element allRolesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(allRolesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "Extension")
                                    .get(i35));
                            ExtensionConfiguration.Extension extensionInstance = new ExtensionConfiguration.Extension();
                            extensionConfigurationInstance.getAllRoles().add(extensionInstance);

                            Element idElement = XmlUtility.getElementByTagNameNS(allRolesElement,
                                    "http://schemas.microsoft.com/windowsazure", "Id");
                            if (idElement != null) {
                                String idInstance;
                                idInstance = idElement.getTextContent();
                                extensionInstance.setId(idInstance);
                            }
                        }
                    }

                    Element namedRolesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                            "NamedRoles");
                    if (namedRolesSequenceElement != null) {
                        for (int i36 = 0; i36 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(namedRolesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Role")
                                .size(); i36 = i36 + 1) {
                            org.w3c.dom.Element namedRolesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(namedRolesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "Role")
                                    .get(i36));
                            ExtensionConfiguration.NamedRole roleInstance2 = new ExtensionConfiguration.NamedRole();
                            extensionConfigurationInstance.getNamedRoles().add(roleInstance2);

                            Element roleNameElement3 = XmlUtility.getElementByTagNameNS(namedRolesElement,
                                    "http://schemas.microsoft.com/windowsazure", "RoleName");
                            if (roleNameElement3 != null) {
                                String roleNameInstance3;
                                roleNameInstance3 = roleNameElement3.getTextContent();
                                roleInstance2.setRoleName(roleNameInstance3);
                            }

                            Element extensionsSequenceElement = XmlUtility.getElementByTagNameNS(
                                    namedRolesElement, "http://schemas.microsoft.com/windowsazure",
                                    "Extensions");
                            if (extensionsSequenceElement != null) {
                                for (int i37 = 0; i37 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(extensionsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "Extension")
                                        .size(); i37 = i37 + 1) {
                                    org.w3c.dom.Element extensionsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(extensionsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Extension")
                                            .get(i37));
                                    ExtensionConfiguration.Extension extensionInstance2 = new ExtensionConfiguration.Extension();
                                    roleInstance2.getExtensions().add(extensionInstance2);

                                    Element idElement2 = XmlUtility.getElementByTagNameNS(extensionsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Id");
                                    if (idElement2 != null) {
                                        String idInstance2;
                                        idInstance2 = idElement2.getTextContent();
                                        extensionInstance2.setId(idInstance2);
                                    }
                                }
                            }
                        }
                    }
                }

                Element reservedIPNameElement2 = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ReservedIPName");
                if (reservedIPNameElement2 != null) {
                    String reservedIPNameInstance2;
                    reservedIPNameInstance2 = reservedIPNameElement2.getTextContent();
                    result.setReservedIPName(reservedIPNameInstance2);
                }

                Element loadBalancersSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "LoadBalancers");
                if (loadBalancersSequenceElement != null) {
                    for (int i38 = 0; i38 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(loadBalancersSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "LoadBalancer")
                            .size(); i38 = i38 + 1) {
                        org.w3c.dom.Element loadBalancersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(loadBalancersSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "LoadBalancer")
                                .get(i38));
                        LoadBalancer loadBalancerInstance = new LoadBalancer();
                        result.getLoadBalancers().add(loadBalancerInstance);

                        Element nameElement14 = XmlUtility.getElementByTagNameNS(loadBalancersElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement14 != null) {
                            String nameInstance14;
                            nameInstance14 = nameElement14.getTextContent();
                            loadBalancerInstance.setName(nameInstance14);
                        }

                        Element frontendIpConfigurationElement = XmlUtility.getElementByTagNameNS(
                                loadBalancersElement, "http://schemas.microsoft.com/windowsazure",
                                "FrontendIpConfiguration");
                        if (frontendIpConfigurationElement != null) {
                            FrontendIPConfiguration frontendIpConfigurationInstance = new FrontendIPConfiguration();
                            loadBalancerInstance.setFrontendIPConfiguration(frontendIpConfigurationInstance);

                            Element typeElement2 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "Type");
                            if (typeElement2 != null) {
                                String typeInstance2;
                                typeInstance2 = typeElement2.getTextContent();
                                frontendIpConfigurationInstance.setType(typeInstance2);
                            }

                            Element subnetNameElement3 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "SubnetName");
                            if (subnetNameElement3 != null) {
                                String subnetNameInstance3;
                                subnetNameInstance3 = subnetNameElement3.getTextContent();
                                frontendIpConfigurationInstance.setSubnetName(subnetNameInstance3);
                            }

                            Element staticVirtualNetworkIPAddressElement3 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "StaticVirtualNetworkIPAddress");
                            if (staticVirtualNetworkIPAddressElement3 != null) {
                                InetAddress staticVirtualNetworkIPAddressInstance3;
                                staticVirtualNetworkIPAddressInstance3 = InetAddress
                                        .getByName(staticVirtualNetworkIPAddressElement3.getTextContent());
                                frontendIpConfigurationInstance.setStaticVirtualNetworkIPAddress(
                                        staticVirtualNetworkIPAddressInstance3);
                            }
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.HostedServiceOperationsImpl.java

/**
* The List Extension Versions operation lists the versions of an extension
* that are available to add to a cloud service. In Azure, a process can
* run as an extension of a cloud service. For example, Remote Desktop
* Access or the Azure Diagnostics Agent can run as extensions to the cloud
* service.  (see/*from w w w  .  j  a  v  a  2s .c  o m*/
* http://msdn.microsoft.com/en-us/library/windowsazure/dn495437.aspx for
* more information)
*
* @param providerNamespace Required. The provider namespace.
* @param extensionType Required. The extension type name.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The List Available Extensions operation response.
*/
@Override
public HostedServiceListAvailableExtensionsResponse listExtensionVersions(String providerNamespace,
        String extensionType)
        throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
    // Validate
    if (providerNamespace == null) {
        throw new NullPointerException("providerNamespace");
    }
    if (extensionType == null) {
        throw new NullPointerException("extensionType");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("providerNamespace", providerNamespace);
        tracingParameters.put("extensionType", extensionType);
        CloudTracing.enter(invocationId, this, "listExtensionVersionsAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/extensions/";
    url = url + URLEncoder.encode(providerNamespace, "UTF-8");
    url = url + "/";
    url = url + URLEncoder.encode(extensionType, "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        HostedServiceListAvailableExtensionsResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new HostedServiceListAvailableExtensionsResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element extensionImagesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "ExtensionImages");
            if (extensionImagesSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                        .getElementsByTagNameNS(extensionImagesSequenceElement,
                                "http://schemas.microsoft.com/windowsazure", "ExtensionImage")
                        .size(); i1 = i1 + 1) {
                    org.w3c.dom.Element extensionImagesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(extensionImagesSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "ExtensionImage")
                            .get(i1));
                    ExtensionImage extensionImageInstance = new ExtensionImage();
                    result.getExtensionImages().add(extensionImageInstance);

                    Element providerNameSpaceElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "ProviderNameSpace");
                    if (providerNameSpaceElement != null) {
                        String providerNameSpaceInstance;
                        providerNameSpaceInstance = providerNameSpaceElement.getTextContent();
                        extensionImageInstance.setProviderNameSpace(providerNameSpaceInstance);
                    }

                    Element typeElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Type");
                    if (typeElement != null) {
                        String typeInstance;
                        typeInstance = typeElement.getTextContent();
                        extensionImageInstance.setType(typeInstance);
                    }

                    Element versionElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Version");
                    if (versionElement != null) {
                        String versionInstance;
                        versionInstance = versionElement.getTextContent();
                        extensionImageInstance.setVersion(versionInstance);
                    }

                    Element labelElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Label");
                    if (labelElement != null) {
                        String labelInstance;
                        labelInstance = labelElement.getTextContent();
                        extensionImageInstance.setLabel(labelInstance);
                    }

                    Element hostingResourcesElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "HostingResources");
                    if (hostingResourcesElement != null) {
                        String hostingResourcesInstance;
                        hostingResourcesInstance = hostingResourcesElement.getTextContent();
                        extensionImageInstance.setHostingResources(hostingResourcesInstance);
                    }

                    Element mediaLinkElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "MediaLink");
                    if (mediaLinkElement != null) {
                        URI mediaLinkInstance;
                        mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
                        extensionImageInstance.setMediaLink(mediaLinkInstance);
                    }

                    Element certificateElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Certificate");
                    if (certificateElement != null) {
                        ExtensionCertificateConfiguration certificateInstance = new ExtensionCertificateConfiguration();
                        extensionImageInstance.setCertificate(certificateInstance);

                        Element storeLocationElement = XmlUtility.getElementByTagNameNS(certificateElement,
                                "http://schemas.microsoft.com/windowsazure", "StoreLocation");
                        if (storeLocationElement != null) {
                            String storeLocationInstance;
                            storeLocationInstance = storeLocationElement.getTextContent();
                            certificateInstance.setStoreLocation(storeLocationInstance);
                        }

                        Element storeNameElement = XmlUtility.getElementByTagNameNS(certificateElement,
                                "http://schemas.microsoft.com/windowsazure", "StoreName");
                        if (storeNameElement != null) {
                            String storeNameInstance;
                            storeNameInstance = storeNameElement.getTextContent();
                            certificateInstance.setStoreName(storeNameInstance);
                        }

                        Element thumbprintRequiredElement = XmlUtility.getElementByTagNameNS(certificateElement,
                                "http://schemas.microsoft.com/windowsazure", "ThumbprintRequired");
                        if (thumbprintRequiredElement != null
                                && thumbprintRequiredElement.getTextContent() != null
                                && !thumbprintRequiredElement.getTextContent().isEmpty()) {
                            boolean thumbprintRequiredInstance;
                            thumbprintRequiredInstance = DatatypeConverter
                                    .parseBoolean(thumbprintRequiredElement.getTextContent().toLowerCase());
                            certificateInstance.setThumbprintRequired(thumbprintRequiredInstance);
                        }

                        Element thumbprintAlgorithmElement = XmlUtility.getElementByTagNameNS(
                                certificateElement, "http://schemas.microsoft.com/windowsazure",
                                "ThumbprintAlgorithm");
                        if (thumbprintAlgorithmElement != null) {
                            String thumbprintAlgorithmInstance;
                            thumbprintAlgorithmInstance = thumbprintAlgorithmElement.getTextContent();
                            certificateInstance.setThumbprintAlgorithm(thumbprintAlgorithmInstance);
                        }
                    }

                    Element endpointsElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Endpoints");
                    if (endpointsElement != null) {
                        ExtensionEndpointConfiguration endpointsInstance = new ExtensionEndpointConfiguration();
                        extensionImageInstance.setExtensionEndpoints(endpointsInstance);

                        Element inputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                endpointsElement, "http://schemas.microsoft.com/windowsazure",
                                "InputEndpoints");
                        if (inputEndpointsSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InputEndpoint")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InputEndpoint")
                                        .get(i2));
                                ExtensionEndpointConfiguration.InputEndpoint inputEndpointInstance = new ExtensionEndpointConfiguration.InputEndpoint();
                                endpointsInstance.getInputEndpoints().add(inputEndpointInstance);

                                Element nameElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement != null) {
                                    String nameInstance;
                                    nameInstance = nameElement.getTextContent();
                                    inputEndpointInstance.setName(nameInstance);
                                }

                                Element protocolElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement != null) {
                                    String protocolInstance;
                                    protocolInstance = protocolElement.getTextContent();
                                    inputEndpointInstance.setProtocol(protocolInstance);
                                }

                                Element portElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Port");
                                if (portElement != null) {
                                    int portInstance;
                                    portInstance = DatatypeConverter.parseInt(portElement.getTextContent());
                                    inputEndpointInstance.setPort(portInstance);
                                }

                                Element localPortElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LocalPort");
                                if (localPortElement != null) {
                                    String localPortInstance;
                                    localPortInstance = localPortElement.getTextContent();
                                    inputEndpointInstance.setLocalPort(localPortInstance);
                                }
                            }
                        }

                        Element internalEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                endpointsElement, "http://schemas.microsoft.com/windowsazure",
                                "InternalEndpoints");
                        if (internalEndpointsSequenceElement != null) {
                            for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(internalEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InternalEndpoint")
                                    .size(); i3 = i3 + 1) {
                                org.w3c.dom.Element internalEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(internalEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InternalEndpoint")
                                        .get(i3));
                                ExtensionEndpointConfiguration.InternalEndpoint internalEndpointInstance = new ExtensionEndpointConfiguration.InternalEndpoint();
                                endpointsInstance.getInternalEndpoints().add(internalEndpointInstance);

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(
                                        internalEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    internalEndpointInstance.setName(nameInstance2);
                                }

                                Element protocolElement2 = XmlUtility.getElementByTagNameNS(
                                        internalEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement2 != null) {
                                    String protocolInstance2;
                                    protocolInstance2 = protocolElement2.getTextContent();
                                    internalEndpointInstance.setProtocol(protocolInstance2);
                                }

                                Element portElement2 = XmlUtility.getElementByTagNameNS(
                                        internalEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Port");
                                if (portElement2 != null) {
                                    int portInstance2;
                                    portInstance2 = DatatypeConverter.parseInt(portElement2.getTextContent());
                                    internalEndpointInstance.setPort(portInstance2);
                                }
                            }
                        }

                        Element instanceInputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                endpointsElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceInputEndpoints");
                        if (instanceInputEndpointsSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(instanceInputEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "InstanceInputEndpoint")
                                    .size(); i4 = i4 + 1) {
                                org.w3c.dom.Element instanceInputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(instanceInputEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "InstanceInputEndpoint")
                                        .get(i4));
                                ExtensionEndpointConfiguration.InstanceInputEndpoint instanceInputEndpointInstance = new ExtensionEndpointConfiguration.InstanceInputEndpoint();
                                endpointsInstance.getInstanceInputEndpoints()
                                        .add(instanceInputEndpointInstance);

                                Element nameElement3 = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement3 != null) {
                                    String nameInstance3;
                                    nameInstance3 = nameElement3.getTextContent();
                                    instanceInputEndpointInstance.setName(nameInstance3);
                                }

                                Element protocolElement3 = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Protocol");
                                if (protocolElement3 != null) {
                                    String protocolInstance3;
                                    protocolInstance3 = protocolElement3.getTextContent();
                                    instanceInputEndpointInstance.setProtocol(protocolInstance3);
                                }

                                Element localPortElement2 = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "LocalPort");
                                if (localPortElement2 != null) {
                                    String localPortInstance2;
                                    localPortInstance2 = localPortElement2.getTextContent();
                                    instanceInputEndpointInstance.setLocalPort(localPortInstance2);
                                }

                                Element fixedPortMinElement = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "FixedPortMin");
                                if (fixedPortMinElement != null) {
                                    int fixedPortMinInstance;
                                    fixedPortMinInstance = DatatypeConverter
                                            .parseInt(fixedPortMinElement.getTextContent());
                                    instanceInputEndpointInstance.setFixedPortMin(fixedPortMinInstance);
                                }

                                Element fixedPortMaxElement = XmlUtility.getElementByTagNameNS(
                                        instanceInputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "FixedPortMax");
                                if (fixedPortMaxElement != null) {
                                    int fixedPortMaxInstance;
                                    fixedPortMaxInstance = DatatypeConverter
                                            .parseInt(fixedPortMaxElement.getTextContent());
                                    instanceInputEndpointInstance.setFixedPortMax(fixedPortMaxInstance);
                                }
                            }
                        }
                    }

                    Element publicConfigurationSchemaElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "PublicConfigurationSchema");
                    if (publicConfigurationSchemaElement != null) {
                        String publicConfigurationSchemaInstance;
                        publicConfigurationSchemaInstance = publicConfigurationSchemaElement
                                .getTextContent() != null ? new String(
                                        Base64.decode(publicConfigurationSchemaElement.getTextContent()))
                                        : null;
                        extensionImageInstance.setPublicConfigurationSchema(publicConfigurationSchemaInstance);
                    }

                    Element privateConfigurationSchemaElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "PrivateConfigurationSchema");
                    if (privateConfigurationSchemaElement != null) {
                        String privateConfigurationSchemaInstance;
                        privateConfigurationSchemaInstance = privateConfigurationSchemaElement
                                .getTextContent() != null ? new String(
                                        Base64.decode(privateConfigurationSchemaElement.getTextContent()))
                                        : null;
                        extensionImageInstance
                                .setPrivateConfigurationSchema(privateConfigurationSchemaInstance);
                    }

                    Element descriptionElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Description");
                    if (descriptionElement != null) {
                        String descriptionInstance;
                        descriptionInstance = descriptionElement.getTextContent();
                        extensionImageInstance.setDescription(descriptionInstance);
                    }

                    Element publisherNameElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "PublisherName");
                    if (publisherNameElement != null) {
                        String publisherNameInstance;
                        publisherNameInstance = publisherNameElement.getTextContent();
                        extensionImageInstance.setPublisherName(publisherNameInstance);
                    }

                    Element publishedDateElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "PublishedDate");
                    if (publishedDateElement != null && publishedDateElement.getTextContent() != null
                            && !publishedDateElement.getTextContent().isEmpty()) {
                        Calendar publishedDateInstance;
                        publishedDateInstance = DatatypeConverter
                                .parseDateTime(publishedDateElement.getTextContent());
                        extensionImageInstance.setPublishedDate(publishedDateInstance);
                    }

                    Element localResourcesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "LocalResources");
                    if (localResourcesSequenceElement != null) {
                        for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(localResourcesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "LocalResource")
                                .size(); i5 = i5 + 1) {
                            org.w3c.dom.Element localResourcesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(localResourcesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "LocalResource")
                                    .get(i5));
                            ExtensionLocalResourceConfiguration localResourceInstance = new ExtensionLocalResourceConfiguration();
                            extensionImageInstance.getLocalResources().add(localResourceInstance);

                            Element nameElement4 = XmlUtility.getElementByTagNameNS(localResourcesElement,
                                    "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement4 != null) {
                                String nameInstance4;
                                nameInstance4 = nameElement4.getTextContent();
                                localResourceInstance.setName(nameInstance4);
                            }

                            Element sizeInMBElement = XmlUtility.getElementByTagNameNS(localResourcesElement,
                                    "http://schemas.microsoft.com/windowsazure", "SizeInMB");
                            if (sizeInMBElement != null && sizeInMBElement.getTextContent() != null
                                    && !sizeInMBElement.getTextContent().isEmpty()) {
                                int sizeInMBInstance;
                                sizeInMBInstance = DatatypeConverter.parseInt(sizeInMBElement.getTextContent());
                                localResourceInstance.setSizeInMB(sizeInMBInstance);
                            }
                        }
                    }

                    Element blockRoleUponFailureElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "BlockRoleUponFailure");
                    if (blockRoleUponFailureElement != null
                            && blockRoleUponFailureElement.getTextContent() != null
                            && !blockRoleUponFailureElement.getTextContent().isEmpty()) {
                        boolean blockRoleUponFailureInstance;
                        blockRoleUponFailureInstance = DatatypeConverter
                                .parseBoolean(blockRoleUponFailureElement.getTextContent().toLowerCase());
                        extensionImageInstance.setBlockRoleUponFailure(blockRoleUponFailureInstance);
                    }

                    Element isInternalExtensionElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "IsInternalExtension");
                    if (isInternalExtensionElement != null
                            && isInternalExtensionElement.getTextContent() != null
                            && !isInternalExtensionElement.getTextContent().isEmpty()) {
                        boolean isInternalExtensionInstance;
                        isInternalExtensionInstance = DatatypeConverter
                                .parseBoolean(isInternalExtensionElement.getTextContent().toLowerCase());
                        extensionImageInstance.setIsInternalExtension(isInternalExtensionInstance);
                    }

                    Element sampleConfigElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "SampleConfig");
                    if (sampleConfigElement != null) {
                        String sampleConfigInstance;
                        sampleConfigInstance = sampleConfigElement.getTextContent() != null
                                ? new String(Base64.decode(sampleConfigElement.getTextContent()))
                                : null;
                        extensionImageInstance.setSampleConfig(sampleConfigInstance);
                    }

                    Element replicationCompletedElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "ReplicationCompleted");
                    if (replicationCompletedElement != null
                            && replicationCompletedElement.getTextContent() != null
                            && !replicationCompletedElement.getTextContent().isEmpty()) {
                        boolean replicationCompletedInstance;
                        replicationCompletedInstance = DatatypeConverter
                                .parseBoolean(replicationCompletedElement.getTextContent().toLowerCase());
                        extensionImageInstance.setReplicationCompleted(replicationCompletedInstance);
                    }

                    Element eulaElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Eula");
                    if (eulaElement != null) {
                        URI eulaInstance;
                        eulaInstance = new URI(eulaElement.getTextContent());
                        extensionImageInstance.setEula(eulaInstance);
                    }

                    Element privacyUriElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "PrivacyUri");
                    if (privacyUriElement != null) {
                        URI privacyUriInstance;
                        privacyUriInstance = new URI(privacyUriElement.getTextContent());
                        extensionImageInstance.setPrivacyUri(privacyUriInstance);
                    }

                    Element homepageUriElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "HomepageUri");
                    if (homepageUriElement != null) {
                        URI homepageUriInstance;
                        homepageUriInstance = new URI(homepageUriElement.getTextContent());
                        extensionImageInstance.setHomepageUri(homepageUriInstance);
                    }

                    Element isJsonExtensionElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "IsJsonExtension");
                    if (isJsonExtensionElement != null && isJsonExtensionElement.getTextContent() != null
                            && !isJsonExtensionElement.getTextContent().isEmpty()) {
                        boolean isJsonExtensionInstance;
                        isJsonExtensionInstance = DatatypeConverter
                                .parseBoolean(isJsonExtensionElement.getTextContent().toLowerCase());
                        extensionImageInstance.setIsJsonExtension(isJsonExtensionInstance);
                    }

                    Element disallowMajorVersionUpgradeElement = XmlUtility.getElementByTagNameNS(
                            extensionImagesElement, "http://schemas.microsoft.com/windowsazure",
                            "DisallowMajorVersionUpgrade");
                    if (disallowMajorVersionUpgradeElement != null
                            && disallowMajorVersionUpgradeElement.getTextContent() != null
                            && !disallowMajorVersionUpgradeElement.getTextContent().isEmpty()) {
                        boolean disallowMajorVersionUpgradeInstance;
                        disallowMajorVersionUpgradeInstance = DatatypeConverter.parseBoolean(
                                disallowMajorVersionUpgradeElement.getTextContent().toLowerCase());
                        extensionImageInstance
                                .setDisallowMajorVersionUpgrade(disallowMajorVersionUpgradeInstance);
                    }

                    Element supportedOSElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "SupportedOS");
                    if (supportedOSElement != null) {
                        String supportedOSInstance;
                        supportedOSInstance = supportedOSElement.getTextContent();
                        extensionImageInstance.setSupportedOS(supportedOSInstance);
                    }

                    Element companyNameElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "CompanyName");
                    if (companyNameElement != null) {
                        String companyNameInstance;
                        companyNameInstance = companyNameElement.getTextContent();
                        extensionImageInstance.setCompanyName(companyNameInstance);
                    }

                    Element regionsElement = XmlUtility.getElementByTagNameNS(extensionImagesElement,
                            "http://schemas.microsoft.com/windowsazure", "Regions");
                    if (regionsElement != null) {
                        String regionsInstance;
                        regionsInstance = regionsElement.getTextContent();
                        extensionImageInstance.setRegions(regionsInstance);
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.network.GatewayOperationsImpl.java

/**
* The List Virtual network gateways operation returns a list of the virtual
* network gateways./*from w w  w . jav  a 2  s  .  c o m*/
*
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @return The response to a ListVirtualNetworkGateways request.
*/
@Override
public ListVirtualNetworkGatewaysResponse listVirtualNetworkGateways()
        throws IOException, ServiceException, ParserConfigurationException, SAXException {
    // Validate

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        CloudTracing.enter(invocationId, this, "listVirtualNetworkGatewaysAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/networking/virtualnetworkgateways";
    ArrayList<String> queryParameters = new ArrayList<String>();
    queryParameters.add("api-version=" + "2015-04-01");
    if (queryParameters.size() > 0) {
        url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
    }
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        ListVirtualNetworkGatewaysResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new ListVirtualNetworkGatewaysResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element virtualNetworkGatewaysSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "VirtualNetworkGateways");
            if (virtualNetworkGatewaysSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                        .getElementsByTagNameNS(virtualNetworkGatewaysSequenceElement,
                                "http://schemas.microsoft.com/windowsazure", "VirtualNetworkGateway")
                        .size(); i1 = i1 + 1) {
                    org.w3c.dom.Element virtualNetworkGatewaysElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(virtualNetworkGatewaysSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "VirtualNetworkGateway")
                            .get(i1));
                    ListVirtualNetworkGatewaysResponse.VirtualNetworkGateway virtualNetworkGatewayInstance = new ListVirtualNetworkGatewaysResponse.VirtualNetworkGateway();
                    result.getVirtualNetworkGateways().add(virtualNetworkGatewayInstance);

                    Element gatewayIdElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "GatewayId");
                    if (gatewayIdElement != null && gatewayIdElement.getTextContent() != null
                            && !gatewayIdElement.getTextContent().isEmpty()) {
                        String gatewayIdInstance;
                        gatewayIdInstance = gatewayIdElement.getTextContent();
                        virtualNetworkGatewayInstance.setGatewayId(gatewayIdInstance);
                    }

                    Element lastEventElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "LastEvent");
                    if (lastEventElement != null) {
                        GatewayEvent lastEventInstance = new GatewayEvent();
                        virtualNetworkGatewayInstance.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 gatewayNameElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "GatewayName");
                    if (gatewayNameElement != null) {
                        String gatewayNameInstance;
                        gatewayNameInstance = gatewayNameElement.getTextContent();
                        virtualNetworkGatewayInstance.setGatewayName(gatewayNameInstance);
                    }

                    Element gatewayTypeElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "GatewayType");
                    if (gatewayTypeElement != null) {
                        String gatewayTypeInstance;
                        gatewayTypeInstance = gatewayTypeElement.getTextContent();
                        virtualNetworkGatewayInstance.setGatewayType(gatewayTypeInstance);
                    }

                    Element gatewaySizeElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "GatewaySize");
                    if (gatewaySizeElement != null) {
                        String gatewaySizeInstance;
                        gatewaySizeInstance = gatewaySizeElement.getTextContent();
                        virtualNetworkGatewayInstance.setGatewaySKU(gatewaySizeInstance);
                    }

                    Element stateElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "State");
                    if (stateElement != null) {
                        String stateInstance;
                        stateInstance = stateElement.getTextContent();
                        virtualNetworkGatewayInstance.setState(stateInstance);
                    }

                    Element vIPAddressElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "VIPAddress");
                    if (vIPAddressElement != null) {
                        String vIPAddressInstance;
                        vIPAddressInstance = vIPAddressElement.getTextContent();
                        virtualNetworkGatewayInstance.setVipAddress(vIPAddressInstance);
                    }

                    Element locationElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "Location");
                    if (locationElement != null) {
                        String locationInstance;
                        locationInstance = locationElement.getTextContent();
                        virtualNetworkGatewayInstance.setLocation(locationInstance);
                    }

                    Element vnetIdElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "VnetId");
                    if (vnetIdElement != null) {
                        String vnetIdInstance;
                        vnetIdInstance = vnetIdElement.getTextContent();
                        virtualNetworkGatewayInstance.setVnetId(vnetIdInstance);
                    }

                    Element subnetIdElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "SubnetId");
                    if (subnetIdElement != null) {
                        String subnetIdInstance;
                        subnetIdInstance = subnetIdElement.getTextContent();
                        virtualNetworkGatewayInstance.setSubnetId(subnetIdInstance);
                    }

                    Element defaultSitesElement = XmlUtility.getElementByTagNameNS(
                            virtualNetworkGatewaysElement, "http://schemas.microsoft.com/windowsazure",
                            "DefaultSites");
                    if (defaultSitesElement != null) {
                        GatewayDefaultSite defaultSitesInstance = new GatewayDefaultSite();
                        virtualNetworkGatewayInstance.setDefaultSite(defaultSitesInstance);

                        Element stringElement = XmlUtility.getElementByTagNameNS(defaultSitesElement,
                                "http://schemas.microsoft.com/windowsazure", "string");
                        if (stringElement != null) {
                            String stringInstance;
                            stringInstance = stringElement.getTextContent();
                            defaultSitesInstance.setName(stringInstance);
                        }
                    }

                    Element enableBgpElement = XmlUtility.getElementByTagNameNS(virtualNetworkGatewaysElement,
                            "http://schemas.microsoft.com/windowsazure", "EnableBgp");
                    if (enableBgpElement != null) {
                        boolean enableBgpInstance;
                        enableBgpInstance = DatatypeConverter
                                .parseBoolean(enableBgpElement.getTextContent().toLowerCase());
                        virtualNetworkGatewayInstance.setEnableBgp(enableBgpInstance);
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.VirtualMachineOperationsImpl.java

/**
* The Get Role operation retrieves information about the specified virtual
* machine.  (see// w  w w . j a va2 s  . c o  m
* http://msdn.microsoft.com/en-us/library/windowsazure/jj157193.aspx for
* more information)
*
* @param serviceName Required. The name of your service.
* @param deploymentName Required. The name of your deployment.
* @param virtualMachineName Required. The name of the virtual machine.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The Get Virtual Machine operation response.
*/
@Override
public VirtualMachineGetResponse get(String serviceName, String deploymentName, String virtualMachineName)
        throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
    // Validate
    if (serviceName == null) {
        throw new NullPointerException("serviceName");
    }
    if (deploymentName == null) {
        throw new NullPointerException("deploymentName");
    }
    if (virtualMachineName == null) {
        throw new NullPointerException("virtualMachineName");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("serviceName", serviceName);
        tracingParameters.put("deploymentName", deploymentName);
        tracingParameters.put("virtualMachineName", virtualMachineName);
        CloudTracing.enter(invocationId, this, "getAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/hostedservices/";
    url = url + URLEncoder.encode(serviceName, "UTF-8");
    url = url + "/deployments/";
    url = url + URLEncoder.encode(deploymentName, "UTF-8");
    url = url + "/roles/";
    url = url + URLEncoder.encode(virtualMachineName, "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        VirtualMachineGetResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new VirtualMachineGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element persistentVMRoleElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "PersistentVMRole");
            if (persistentVMRoleElement != null) {
                Element roleNameElement = XmlUtility.getElementByTagNameNS(persistentVMRoleElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleName");
                if (roleNameElement != null) {
                    String roleNameInstance;
                    roleNameInstance = roleNameElement.getTextContent();
                    result.setRoleName(roleNameInstance);
                }

                Element osVersionElement = XmlUtility.getElementByTagNameNS(persistentVMRoleElement,
                        "http://schemas.microsoft.com/windowsazure", "OsVersion");
                if (osVersionElement != null) {
                    String osVersionInstance;
                    osVersionInstance = osVersionElement.getTextContent();
                    result.setOsVersion(osVersionInstance);
                }

                Element roleTypeElement = XmlUtility.getElementByTagNameNS(persistentVMRoleElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleType");
                if (roleTypeElement != null && roleTypeElement.getTextContent() != null
                        && !roleTypeElement.getTextContent().isEmpty()) {
                    VirtualMachineRoleType roleTypeInstance;
                    roleTypeInstance = VirtualMachineRoleType.valueOf(roleTypeElement.getTextContent());
                    result.setRoleType(roleTypeInstance);
                }

                Element availabilitySetNameElement = XmlUtility.getElementByTagNameNS(persistentVMRoleElement,
                        "http://schemas.microsoft.com/windowsazure", "AvailabilitySetName");
                if (availabilitySetNameElement != null) {
                    String availabilitySetNameInstance;
                    availabilitySetNameInstance = availabilitySetNameElement.getTextContent();
                    result.setAvailabilitySetName(availabilitySetNameInstance);
                }

                Element roleSizeElement = XmlUtility.getElementByTagNameNS(persistentVMRoleElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleSize");
                if (roleSizeElement != null) {
                    String roleSizeInstance;
                    roleSizeInstance = roleSizeElement.getTextContent();
                    result.setRoleSize(roleSizeInstance);
                }

                Element defaultWinRmCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                        persistentVMRoleElement, "http://schemas.microsoft.com/windowsazure",
                        "DefaultWinRmCertificateThumbprint");
                if (defaultWinRmCertificateThumbprintElement != null) {
                    String defaultWinRmCertificateThumbprintInstance;
                    defaultWinRmCertificateThumbprintInstance = defaultWinRmCertificateThumbprintElement
                            .getTextContent();
                    result.setDefaultWinRmCertificateThumbprint(defaultWinRmCertificateThumbprintInstance);
                }

                Element configurationSetsSequenceElement = XmlUtility.getElementByTagNameNS(
                        persistentVMRoleElement, "http://schemas.microsoft.com/windowsazure",
                        "ConfigurationSets");
                if (configurationSetsSequenceElement != null) {
                    for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(configurationSetsSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                            .size(); i1 = i1 + 1) {
                        org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(configurationSetsSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                .get(i1));
                        ConfigurationSet configurationSetInstance = new ConfigurationSet();
                        result.getConfigurationSets().add(configurationSetInstance);

                        Element configurationSetTypeElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "ConfigurationSetType");
                        if (configurationSetTypeElement != null) {
                            String configurationSetTypeInstance;
                            configurationSetTypeInstance = configurationSetTypeElement.getTextContent();
                            configurationSetInstance.setConfigurationSetType(configurationSetTypeInstance);
                        }

                        Element inputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "InputEndpoints");
                        if (inputEndpointsSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InputEndpoint")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InputEndpoint")
                                        .get(i2));
                                InputEndpoint inputEndpointInstance = new InputEndpoint();
                                configurationSetInstance.getInputEndpoints().add(inputEndpointInstance);

                                Element loadBalancedEndpointSetNameElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LoadBalancedEndpointSetName");
                                if (loadBalancedEndpointSetNameElement != null) {
                                    String loadBalancedEndpointSetNameInstance;
                                    loadBalancedEndpointSetNameInstance = loadBalancedEndpointSetNameElement
                                            .getTextContent();
                                    inputEndpointInstance.setLoadBalancedEndpointSetName(
                                            loadBalancedEndpointSetNameInstance);
                                }

                                Element localPortElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LocalPort");
                                if (localPortElement != null && localPortElement.getTextContent() != null
                                        && !localPortElement.getTextContent().isEmpty()) {
                                    int localPortInstance;
                                    localPortInstance = DatatypeConverter
                                            .parseInt(localPortElement.getTextContent());
                                    inputEndpointInstance.setLocalPort(localPortInstance);
                                }

                                Element nameElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement != null) {
                                    String nameInstance;
                                    nameInstance = nameElement.getTextContent();
                                    inputEndpointInstance.setName(nameInstance);
                                }

                                Element portElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Port");
                                if (portElement != null && portElement.getTextContent() != null
                                        && !portElement.getTextContent().isEmpty()) {
                                    int portInstance;
                                    portInstance = DatatypeConverter.parseInt(portElement.getTextContent());
                                    inputEndpointInstance.setPort(portInstance);
                                }

                                Element loadBalancerProbeElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LoadBalancerProbe");
                                if (loadBalancerProbeElement != null) {
                                    LoadBalancerProbe loadBalancerProbeInstance = new LoadBalancerProbe();
                                    inputEndpointInstance.setLoadBalancerProbe(loadBalancerProbeInstance);

                                    Element pathElement = XmlUtility.getElementByTagNameNS(
                                            loadBalancerProbeElement,
                                            "http://schemas.microsoft.com/windowsazure", "Path");
                                    if (pathElement != null) {
                                        String pathInstance;
                                        pathInstance = pathElement.getTextContent();
                                        loadBalancerProbeInstance.setPath(pathInstance);
                                    }

                                    Element portElement2 = XmlUtility.getElementByTagNameNS(
                                            loadBalancerProbeElement,
                                            "http://schemas.microsoft.com/windowsazure", "Port");
                                    if (portElement2 != null) {
                                        int portInstance2;
                                        portInstance2 = DatatypeConverter
                                                .parseInt(portElement2.getTextContent());
                                        loadBalancerProbeInstance.setPort(portInstance2);
                                    }

                                    Element protocolElement = XmlUtility.getElementByTagNameNS(
                                            loadBalancerProbeElement,
                                            "http://schemas.microsoft.com/windowsazure", "Protocol");
                                    if (protocolElement != null && protocolElement.getTextContent() != null
                                            && !protocolElement.getTextContent().isEmpty()) {
                                        LoadBalancerProbeTransportProtocol protocolInstance;
                                        protocolInstance = ComputeManagementClientImpl
                                                .parseLoadBalancerProbeTransportProtocol(
                                                        protocolElement.getTextContent());
                                        loadBalancerProbeInstance.setProtocol(protocolInstance);
                                    }

                                    Element intervalInSecondsElement = XmlUtility.getElementByTagNameNS(
                                            loadBalancerProbeElement,
                                            "http://schemas.microsoft.com/windowsazure", "IntervalInSeconds");
                                    if (intervalInSecondsElement != null
                                            && intervalInSecondsElement.getTextContent() != null
                                            && !intervalInSecondsElement.getTextContent().isEmpty()) {
                                        int intervalInSecondsInstance;
                                        intervalInSecondsInstance = DatatypeConverter
                                                .parseInt(intervalInSecondsElement.getTextContent());
                                        loadBalancerProbeInstance
                                                .setIntervalInSeconds(intervalInSecondsInstance);
                                    }

                                    Element timeoutInSecondsElement = XmlUtility.getElementByTagNameNS(
                                            loadBalancerProbeElement,
                                            "http://schemas.microsoft.com/windowsazure", "TimeoutInSeconds");
                                    if (timeoutInSecondsElement != null
                                            && timeoutInSecondsElement.getTextContent() != null
                                            && !timeoutInSecondsElement.getTextContent().isEmpty()) {
                                        int timeoutInSecondsInstance;
                                        timeoutInSecondsInstance = DatatypeConverter
                                                .parseInt(timeoutInSecondsElement.getTextContent());
                                        loadBalancerProbeInstance.setTimeoutInSeconds(timeoutInSecondsInstance);
                                    }
                                }

                                Element protocolElement2 = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement2 != null) {
                                    String protocolInstance2;
                                    protocolInstance2 = protocolElement2.getTextContent();
                                    inputEndpointInstance.setProtocol(protocolInstance2);
                                }

                                Element vipElement = XmlUtility.getElementByTagNameNS(inputEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Vip");
                                if (vipElement != null) {
                                    InetAddress vipInstance;
                                    vipInstance = InetAddress.getByName(vipElement.getTextContent());
                                    inputEndpointInstance.setVirtualIPAddress(vipInstance);
                                }

                                Element enableDirectServerReturnElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "EnableDirectServerReturn");
                                if (enableDirectServerReturnElement != null
                                        && enableDirectServerReturnElement.getTextContent() != null
                                        && !enableDirectServerReturnElement.getTextContent().isEmpty()) {
                                    boolean enableDirectServerReturnInstance;
                                    enableDirectServerReturnInstance = DatatypeConverter.parseBoolean(
                                            enableDirectServerReturnElement.getTextContent().toLowerCase());
                                    inputEndpointInstance
                                            .setEnableDirectServerReturn(enableDirectServerReturnInstance);
                                }

                                Element loadBalancerNameElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LoadBalancerName");
                                if (loadBalancerNameElement != null) {
                                    String loadBalancerNameInstance;
                                    loadBalancerNameInstance = loadBalancerNameElement.getTextContent();
                                    inputEndpointInstance.setLoadBalancerName(loadBalancerNameInstance);
                                }

                                Element endpointAclElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "EndpointAcl");
                                if (endpointAclElement != null) {
                                    EndpointAcl endpointAclInstance = new EndpointAcl();
                                    inputEndpointInstance.setEndpointAcl(endpointAclInstance);

                                    Element rulesSequenceElement = XmlUtility.getElementByTagNameNS(
                                            endpointAclElement, "http://schemas.microsoft.com/windowsazure",
                                            "Rules");
                                    if (rulesSequenceElement != null) {
                                        for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(rulesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Rule")
                                                .size(); i3 = i3 + 1) {
                                            org.w3c.dom.Element rulesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(rulesSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure", "Rule")
                                                    .get(i3));
                                            AccessControlListRule ruleInstance = new AccessControlListRule();
                                            endpointAclInstance.getRules().add(ruleInstance);

                                            Element orderElement = XmlUtility.getElementByTagNameNS(
                                                    rulesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "Order");
                                            if (orderElement != null && orderElement.getTextContent() != null
                                                    && !orderElement.getTextContent().isEmpty()) {
                                                int orderInstance;
                                                orderInstance = DatatypeConverter
                                                        .parseInt(orderElement.getTextContent());
                                                ruleInstance.setOrder(orderInstance);
                                            }

                                            Element actionElement = XmlUtility.getElementByTagNameNS(
                                                    rulesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "Action");
                                            if (actionElement != null) {
                                                String actionInstance;
                                                actionInstance = actionElement.getTextContent();
                                                ruleInstance.setAction(actionInstance);
                                            }

                                            Element remoteSubnetElement = XmlUtility.getElementByTagNameNS(
                                                    rulesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "RemoteSubnet");
                                            if (remoteSubnetElement != null) {
                                                String remoteSubnetInstance;
                                                remoteSubnetInstance = remoteSubnetElement.getTextContent();
                                                ruleInstance.setRemoteSubnet(remoteSubnetInstance);
                                            }

                                            Element descriptionElement = XmlUtility.getElementByTagNameNS(
                                                    rulesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "Description");
                                            if (descriptionElement != null) {
                                                String descriptionInstance;
                                                descriptionInstance = descriptionElement.getTextContent();
                                                ruleInstance.setDescription(descriptionInstance);
                                            }
                                        }
                                    }
                                }

                                Element idleTimeoutInMinutesElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement != null
                                        && idleTimeoutInMinutesElement.getTextContent() != null
                                        && !idleTimeoutInMinutesElement.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance;
                                    idleTimeoutInMinutesInstance = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement.getTextContent());
                                    inputEndpointInstance.setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance);
                                }

                                Element loadBalancerDistributionElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LoadBalancerDistribution");
                                if (loadBalancerDistributionElement != null) {
                                    String loadBalancerDistributionInstance;
                                    loadBalancerDistributionInstance = loadBalancerDistributionElement
                                            .getTextContent();
                                    inputEndpointInstance
                                            .setLoadBalancerDistribution(loadBalancerDistributionInstance);
                                }

                                Element virtualIPNameElement = XmlUtility.getElementByTagNameNS(
                                        inputEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "VirtualIPName");
                                if (virtualIPNameElement != null) {
                                    String virtualIPNameInstance;
                                    virtualIPNameInstance = virtualIPNameElement.getTextContent();
                                    inputEndpointInstance.setVirtualIPName(virtualIPNameInstance);
                                }
                            }
                        }

                        Element subnetNamesSequenceElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "SubnetNames");
                        if (subnetNamesSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(subnetNamesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "SubnetName")
                                    .size(); i4 = i4 + 1) {
                                org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "SubnetName")
                                        .get(i4));
                                configurationSetInstance.getSubnetNames()
                                        .add(subnetNamesElement.getTextContent());
                            }
                        }

                        Element staticVirtualNetworkIPAddressElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "StaticVirtualNetworkIPAddress");
                        if (staticVirtualNetworkIPAddressElement != null) {
                            String staticVirtualNetworkIPAddressInstance;
                            staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement
                                    .getTextContent();
                            configurationSetInstance
                                    .setStaticVirtualNetworkIPAddress(staticVirtualNetworkIPAddressInstance);
                        }

                        Element publicIPsSequenceElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "PublicIPs");
                        if (publicIPsSequenceElement != null) {
                            for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(publicIPsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                    .size(); i5 = i5 + 1) {
                                org.w3c.dom.Element publicIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(publicIPsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                        .get(i5));
                                ConfigurationSet.PublicIP publicIPInstance = new ConfigurationSet.PublicIP();
                                configurationSetInstance.getPublicIPs().add(publicIPInstance);

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    publicIPInstance.setName(nameInstance2);
                                }

                                Element idleTimeoutInMinutesElement2 = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement2 != null
                                        && idleTimeoutInMinutesElement2.getTextContent() != null
                                        && !idleTimeoutInMinutesElement2.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance2;
                                    idleTimeoutInMinutesInstance2 = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement2.getTextContent());
                                    publicIPInstance.setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance2);
                                }

                                Element domainNameLabelElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainNameLabel");
                                if (domainNameLabelElement != null) {
                                    String domainNameLabelInstance;
                                    domainNameLabelInstance = domainNameLabelElement.getTextContent();
                                    publicIPInstance.setDomainNameLabel(domainNameLabelInstance);
                                }
                            }
                        }

                        Element networkInterfacesSequenceElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "NetworkInterfaces");
                        if (networkInterfacesSequenceElement != null) {
                            for (int i6 = 0; i6 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                    .size(); i6 = i6 + 1) {
                                org.w3c.dom.Element networkInterfacesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                        .get(i6));
                                NetworkInterface networkInterfaceInstance = new NetworkInterface();
                                configurationSetInstance.getNetworkInterfaces().add(networkInterfaceInstance);

                                Element nameElement3 = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement3 != null) {
                                    String nameInstance3;
                                    nameInstance3 = nameElement3.getTextContent();
                                    networkInterfaceInstance.setName(nameInstance3);
                                }

                                Element iPConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPConfigurations");
                                if (iPConfigurationsSequenceElement != null) {
                                    for (int i7 = 0; i7 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IPConfiguration")
                                            .size(); i7 = i7 + 1) {
                                        org.w3c.dom.Element iPConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfiguration")
                                                .get(i7));
                                        IPConfiguration iPConfigurationInstance = new IPConfiguration();
                                        networkInterfaceInstance.getIPConfigurations()
                                                .add(iPConfigurationInstance);

                                        Element subnetNameElement = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "SubnetName");
                                        if (subnetNameElement != null) {
                                            String subnetNameInstance;
                                            subnetNameInstance = subnetNameElement.getTextContent();
                                            iPConfigurationInstance.setSubnetName(subnetNameInstance);
                                        }

                                        Element staticVirtualNetworkIPAddressElement2 = XmlUtility
                                                .getElementByTagNameNS(iPConfigurationsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "StaticVirtualNetworkIPAddress");
                                        if (staticVirtualNetworkIPAddressElement2 != null) {
                                            String staticVirtualNetworkIPAddressInstance2;
                                            staticVirtualNetworkIPAddressInstance2 = staticVirtualNetworkIPAddressElement2
                                                    .getTextContent();
                                            iPConfigurationInstance.setStaticVirtualNetworkIPAddress(
                                                    staticVirtualNetworkIPAddressInstance2);
                                        }
                                    }
                                }

                                Element networkSecurityGroupElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkSecurityGroup");
                                if (networkSecurityGroupElement != null) {
                                    String networkSecurityGroupInstance;
                                    networkSecurityGroupInstance = networkSecurityGroupElement.getTextContent();
                                    networkInterfaceInstance
                                            .setNetworkSecurityGroup(networkSecurityGroupInstance);
                                }

                                Element iPForwardingElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPForwarding");
                                if (iPForwardingElement != null) {
                                    String iPForwardingInstance;
                                    iPForwardingInstance = iPForwardingElement.getTextContent();
                                    networkInterfaceInstance.setIPForwarding(iPForwardingInstance);
                                }
                            }
                        }

                        Element networkSecurityGroupElement2 = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "NetworkSecurityGroup");
                        if (networkSecurityGroupElement2 != null) {
                            String networkSecurityGroupInstance2;
                            networkSecurityGroupInstance2 = networkSecurityGroupElement2.getTextContent();
                            configurationSetInstance.setNetworkSecurityGroup(networkSecurityGroupInstance2);
                        }

                        Element iPForwardingElement2 = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "IPForwarding");
                        if (iPForwardingElement2 != null) {
                            String iPForwardingInstance2;
                            iPForwardingInstance2 = iPForwardingElement2.getTextContent();
                            configurationSetInstance.setIPForwarding(iPForwardingInstance2);
                        }

                        Element computerNameElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "ComputerName");
                        if (computerNameElement != null) {
                            String computerNameInstance;
                            computerNameInstance = computerNameElement.getTextContent();
                            configurationSetInstance.setComputerName(computerNameInstance);
                        }

                        Element adminPasswordElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "AdminPassword");
                        if (adminPasswordElement != null) {
                            String adminPasswordInstance;
                            adminPasswordInstance = adminPasswordElement.getTextContent();
                            configurationSetInstance.setAdminPassword(adminPasswordInstance);
                        }

                        Element resetPasswordOnFirstLogonElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "ResetPasswordOnFirstLogon");
                        if (resetPasswordOnFirstLogonElement != null
                                && resetPasswordOnFirstLogonElement.getTextContent() != null
                                && !resetPasswordOnFirstLogonElement.getTextContent().isEmpty()) {
                            boolean resetPasswordOnFirstLogonInstance;
                            resetPasswordOnFirstLogonInstance = DatatypeConverter.parseBoolean(
                                    resetPasswordOnFirstLogonElement.getTextContent().toLowerCase());
                            configurationSetInstance
                                    .setResetPasswordOnFirstLogon(resetPasswordOnFirstLogonInstance);
                        }

                        Element enableAutomaticUpdatesElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "EnableAutomaticUpdates");
                        if (enableAutomaticUpdatesElement != null
                                && enableAutomaticUpdatesElement.getTextContent() != null
                                && !enableAutomaticUpdatesElement.getTextContent().isEmpty()) {
                            boolean enableAutomaticUpdatesInstance;
                            enableAutomaticUpdatesInstance = DatatypeConverter
                                    .parseBoolean(enableAutomaticUpdatesElement.getTextContent().toLowerCase());
                            configurationSetInstance.setEnableAutomaticUpdates(enableAutomaticUpdatesInstance);
                        }

                        Element timeZoneElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "TimeZone");
                        if (timeZoneElement != null) {
                            String timeZoneInstance;
                            timeZoneInstance = timeZoneElement.getTextContent();
                            configurationSetInstance.setTimeZone(timeZoneInstance);
                        }

                        Element domainJoinElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "DomainJoin");
                        if (domainJoinElement != null) {
                            DomainJoinSettings domainJoinInstance = new DomainJoinSettings();
                            configurationSetInstance.setDomainJoin(domainJoinInstance);

                            Element credentialsElement = XmlUtility.getElementByTagNameNS(domainJoinElement,
                                    "http://schemas.microsoft.com/windowsazure", "Credentials");
                            if (credentialsElement != null) {
                                DomainJoinCredentials credentialsInstance = new DomainJoinCredentials();
                                domainJoinInstance.setCredentials(credentialsInstance);

                                Element domainElement = XmlUtility.getElementByTagNameNS(credentialsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Domain");
                                if (domainElement != null) {
                                    String domainInstance;
                                    domainInstance = domainElement.getTextContent();
                                    credentialsInstance.setDomain(domainInstance);
                                }

                                Element usernameElement = XmlUtility.getElementByTagNameNS(credentialsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Username");
                                if (usernameElement != null) {
                                    String usernameInstance;
                                    usernameInstance = usernameElement.getTextContent();
                                    credentialsInstance.setUserName(usernameInstance);
                                }

                                Element passwordElement = XmlUtility.getElementByTagNameNS(credentialsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Password");
                                if (passwordElement != null) {
                                    String passwordInstance;
                                    passwordInstance = passwordElement.getTextContent();
                                    credentialsInstance.setPassword(passwordInstance);
                                }
                            }

                            Element joinDomainElement = XmlUtility.getElementByTagNameNS(domainJoinElement,
                                    "http://schemas.microsoft.com/windowsazure", "JoinDomain");
                            if (joinDomainElement != null) {
                                String joinDomainInstance;
                                joinDomainInstance = joinDomainElement.getTextContent();
                                domainJoinInstance.setDomainToJoin(joinDomainInstance);
                            }

                            Element machineObjectOUElement = XmlUtility.getElementByTagNameNS(domainJoinElement,
                                    "http://schemas.microsoft.com/windowsazure", "MachineObjectOU");
                            if (machineObjectOUElement != null) {
                                String machineObjectOUInstance;
                                machineObjectOUInstance = machineObjectOUElement.getTextContent();
                                domainJoinInstance.setLdapMachineObjectOU(machineObjectOUInstance);
                            }

                            Element provisioningElement = XmlUtility.getElementByTagNameNS(domainJoinElement,
                                    "http://schemas.microsoft.com/windowsazure", "Provisioning");
                            if (provisioningElement != null) {
                                DomainJoinProvisioning provisioningInstance = new DomainJoinProvisioning();
                                domainJoinInstance.setProvisioning(provisioningInstance);

                                Element accountDataElement = XmlUtility.getElementByTagNameNS(
                                        provisioningElement, "http://schemas.microsoft.com/windowsazure",
                                        "AccountData");
                                if (accountDataElement != null) {
                                    String accountDataInstance;
                                    accountDataInstance = accountDataElement.getTextContent();
                                    provisioningInstance.setAccountData(accountDataInstance);
                                }
                            }
                        }

                        Element storedCertificateSettingsSequenceElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "StoredCertificateSettings");
                        if (storedCertificateSettingsSequenceElement != null) {
                            for (int i8 = 0; i8 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(storedCertificateSettingsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "CertificateSetting")
                                    .size(); i8 = i8 + 1) {
                                org.w3c.dom.Element storedCertificateSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(storedCertificateSettingsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "CertificateSetting")
                                        .get(i8));
                                StoredCertificateSettings certificateSettingInstance = new StoredCertificateSettings();
                                configurationSetInstance.getStoredCertificateSettings()
                                        .add(certificateSettingInstance);

                                Element storeLocationElement = XmlUtility.getElementByTagNameNS(
                                        storedCertificateSettingsElement,
                                        "http://schemas.microsoft.com/windowsazure", "StoreLocation");
                                if (storeLocationElement != null) {
                                }

                                Element storeNameElement = XmlUtility.getElementByTagNameNS(
                                        storedCertificateSettingsElement,
                                        "http://schemas.microsoft.com/windowsazure", "StoreName");
                                if (storeNameElement != null) {
                                    String storeNameInstance;
                                    storeNameInstance = storeNameElement.getTextContent();
                                    certificateSettingInstance.setStoreName(storeNameInstance);
                                }

                                Element thumbprintElement = XmlUtility.getElementByTagNameNS(
                                        storedCertificateSettingsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Thumbprint");
                                if (thumbprintElement != null) {
                                    String thumbprintInstance;
                                    thumbprintInstance = thumbprintElement.getTextContent();
                                    certificateSettingInstance.setThumbprint(thumbprintInstance);
                                }
                            }
                        }

                        Element winRMElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "WinRM");
                        if (winRMElement != null) {
                            WindowsRemoteManagementSettings winRMInstance = new WindowsRemoteManagementSettings();
                            configurationSetInstance.setWindowsRemoteManagement(winRMInstance);

                            Element listenersSequenceElement = XmlUtility.getElementByTagNameNS(winRMElement,
                                    "http://schemas.microsoft.com/windowsazure", "Listeners");
                            if (listenersSequenceElement != null) {
                                for (int i9 = 0; i9 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(listenersSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "Listener")
                                        .size(); i9 = i9 + 1) {
                                    org.w3c.dom.Element listenersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(listenersSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Listener")
                                            .get(i9));
                                    WindowsRemoteManagementListener listenerInstance = new WindowsRemoteManagementListener();
                                    winRMInstance.getListeners().add(listenerInstance);

                                    Element protocolElement3 = XmlUtility.getElementByTagNameNS(
                                            listenersElement, "http://schemas.microsoft.com/windowsazure",
                                            "Protocol");
                                    if (protocolElement3 != null && protocolElement3.getTextContent() != null
                                            && !protocolElement3.getTextContent().isEmpty()) {
                                        VirtualMachineWindowsRemoteManagementListenerType protocolInstance3;
                                        protocolInstance3 = VirtualMachineWindowsRemoteManagementListenerType
                                                .valueOf(protocolElement3.getTextContent());
                                        listenerInstance.setListenerType(protocolInstance3);
                                    }

                                    Element certificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                            listenersElement, "http://schemas.microsoft.com/windowsazure",
                                            "CertificateThumbprint");
                                    if (certificateThumbprintElement != null) {
                                        String certificateThumbprintInstance;
                                        certificateThumbprintInstance = certificateThumbprintElement
                                                .getTextContent();
                                        listenerInstance
                                                .setCertificateThumbprint(certificateThumbprintInstance);
                                    }
                                }
                            }
                        }

                        Element adminUsernameElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "AdminUsername");
                        if (adminUsernameElement != null) {
                            String adminUsernameInstance;
                            adminUsernameInstance = adminUsernameElement.getTextContent();
                            configurationSetInstance.setAdminUserName(adminUsernameInstance);
                        }

                        Element additionalUnattendContentElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "AdditionalUnattendContent");
                        if (additionalUnattendContentElement != null) {
                            AdditionalUnattendContentSettings additionalUnattendContentInstance = new AdditionalUnattendContentSettings();
                            configurationSetInstance
                                    .setAdditionalUnattendContent(additionalUnattendContentInstance);

                            Element passesSequenceElement = XmlUtility.getElementByTagNameNS(
                                    additionalUnattendContentElement,
                                    "http://schemas.microsoft.com/windowsazure", "Passes");
                            if (passesSequenceElement != null) {
                                for (int i10 = 0; i10 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(passesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "UnattendPass")
                                        .size(); i10 = i10 + 1) {
                                    org.w3c.dom.Element passesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(passesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "UnattendPass")
                                            .get(i10));
                                    UnattendPassSettings unattendPassInstance = new UnattendPassSettings();
                                    additionalUnattendContentInstance.getUnattendPasses()
                                            .add(unattendPassInstance);

                                    Element passNameElement = XmlUtility.getElementByTagNameNS(passesElement,
                                            "http://schemas.microsoft.com/windowsazure", "PassName");
                                    if (passNameElement != null) {
                                        String passNameInstance;
                                        passNameInstance = passNameElement.getTextContent();
                                        unattendPassInstance.setPassName(passNameInstance);
                                    }

                                    Element componentsSequenceElement = XmlUtility.getElementByTagNameNS(
                                            passesElement, "http://schemas.microsoft.com/windowsazure",
                                            "Components");
                                    if (componentsSequenceElement != null) {
                                        for (int i11 = 0; i11 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(componentsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "UnattendComponent")
                                                .size(); i11 = i11 + 1) {
                                            org.w3c.dom.Element componentsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(componentsSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "UnattendComponent")
                                                    .get(i11));
                                            UnattendComponent unattendComponentInstance = new UnattendComponent();
                                            unattendPassInstance.getUnattendComponents()
                                                    .add(unattendComponentInstance);

                                            Element componentNameElement = XmlUtility.getElementByTagNameNS(
                                                    componentsElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "ComponentName");
                                            if (componentNameElement != null) {
                                                String componentNameInstance;
                                                componentNameInstance = componentNameElement.getTextContent();
                                                unattendComponentInstance
                                                        .setComponentName(componentNameInstance);
                                            }

                                            Element componentSettingsSequenceElement = XmlUtility
                                                    .getElementByTagNameNS(componentsElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "ComponentSettings");
                                            if (componentSettingsSequenceElement != null) {
                                                for (int i12 = 0; i12 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(
                                                                componentSettingsSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "ComponentSetting")
                                                        .size(); i12 = i12 + 1) {
                                                    org.w3c.dom.Element componentSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(
                                                                    componentSettingsSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentSetting")
                                                            .get(i12));
                                                    ComponentSetting componentSettingInstance = new ComponentSetting();
                                                    unattendComponentInstance.getUnattendComponentSettings()
                                                            .add(componentSettingInstance);

                                                    Element settingNameElement = XmlUtility
                                                            .getElementByTagNameNS(componentSettingsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "SettingName");
                                                    if (settingNameElement != null) {
                                                        String settingNameInstance;
                                                        settingNameInstance = settingNameElement
                                                                .getTextContent();
                                                        componentSettingInstance
                                                                .setSettingName(settingNameInstance);
                                                    }

                                                    Element contentElement = XmlUtility.getElementByTagNameNS(
                                                            componentSettingsElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Content");
                                                    if (contentElement != null) {
                                                        String contentInstance;
                                                        contentInstance = contentElement
                                                                .getTextContent() != null
                                                                        ? new String(
                                                                                Base64.decode(contentElement
                                                                                        .getTextContent()))
                                                                        : null;
                                                        componentSettingInstance.setContent(contentInstance);
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        Element hostNameElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "HostName");
                        if (hostNameElement != null) {
                            String hostNameInstance;
                            hostNameInstance = hostNameElement.getTextContent();
                            configurationSetInstance.setHostName(hostNameInstance);
                        }

                        Element userNameElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "UserName");
                        if (userNameElement != null) {
                            String userNameInstance;
                            userNameInstance = userNameElement.getTextContent();
                            configurationSetInstance.setUserName(userNameInstance);
                        }

                        Element userPasswordElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "UserPassword");
                        if (userPasswordElement != null) {
                            String userPasswordInstance;
                            userPasswordInstance = userPasswordElement.getTextContent();
                            configurationSetInstance.setUserPassword(userPasswordInstance);
                        }

                        Element disableSshPasswordAuthenticationElement = XmlUtility.getElementByTagNameNS(
                                configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                "DisableSshPasswordAuthentication");
                        if (disableSshPasswordAuthenticationElement != null
                                && disableSshPasswordAuthenticationElement.getTextContent() != null
                                && !disableSshPasswordAuthenticationElement.getTextContent().isEmpty()) {
                            boolean disableSshPasswordAuthenticationInstance;
                            disableSshPasswordAuthenticationInstance = DatatypeConverter.parseBoolean(
                                    disableSshPasswordAuthenticationElement.getTextContent().toLowerCase());
                            configurationSetInstance.setDisableSshPasswordAuthentication(
                                    disableSshPasswordAuthenticationInstance);
                        }

                        Element sSHElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "SSH");
                        if (sSHElement != null) {
                            SshSettings sSHInstance = new SshSettings();
                            configurationSetInstance.setSshSettings(sSHInstance);

                            Element publicKeysSequenceElement = XmlUtility.getElementByTagNameNS(sSHElement,
                                    "http://schemas.microsoft.com/windowsazure", "PublicKeys");
                            if (publicKeysSequenceElement != null) {
                                for (int i13 = 0; i13 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(publicKeysSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "PublicKey")
                                        .size(); i13 = i13 + 1) {
                                    org.w3c.dom.Element publicKeysElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(publicKeysSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "PublicKey")
                                            .get(i13));
                                    SshSettingPublicKey publicKeyInstance = new SshSettingPublicKey();
                                    sSHInstance.getPublicKeys().add(publicKeyInstance);

                                    Element fingerprintElement = XmlUtility.getElementByTagNameNS(
                                            publicKeysElement, "http://schemas.microsoft.com/windowsazure",
                                            "Fingerprint");
                                    if (fingerprintElement != null) {
                                        String fingerprintInstance;
                                        fingerprintInstance = fingerprintElement.getTextContent();
                                        publicKeyInstance.setFingerprint(fingerprintInstance);
                                    }

                                    Element pathElement2 = XmlUtility.getElementByTagNameNS(publicKeysElement,
                                            "http://schemas.microsoft.com/windowsazure", "Path");
                                    if (pathElement2 != null) {
                                        String pathInstance2;
                                        pathInstance2 = pathElement2.getTextContent();
                                        publicKeyInstance.setPath(pathInstance2);
                                    }
                                }
                            }

                            Element keyPairsSequenceElement = XmlUtility.getElementByTagNameNS(sSHElement,
                                    "http://schemas.microsoft.com/windowsazure", "KeyPairs");
                            if (keyPairsSequenceElement != null) {
                                for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(keyPairsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "KeyPair")
                                        .size(); i14 = i14 + 1) {
                                    org.w3c.dom.Element keyPairsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(keyPairsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "KeyPair")
                                            .get(i14));
                                    SshSettingKeyPair keyPairInstance = new SshSettingKeyPair();
                                    sSHInstance.getKeyPairs().add(keyPairInstance);

                                    Element fingerprintElement2 = XmlUtility.getElementByTagNameNS(
                                            keyPairsElement, "http://schemas.microsoft.com/windowsazure",
                                            "Fingerprint");
                                    if (fingerprintElement2 != null) {
                                        String fingerprintInstance2;
                                        fingerprintInstance2 = fingerprintElement2.getTextContent();
                                        keyPairInstance.setFingerprint(fingerprintInstance2);
                                    }

                                    Element pathElement3 = XmlUtility.getElementByTagNameNS(keyPairsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Path");
                                    if (pathElement3 != null) {
                                        String pathInstance3;
                                        pathInstance3 = pathElement3.getTextContent();
                                        keyPairInstance.setPath(pathInstance3);
                                    }
                                }
                            }
                        }

                        Element customDataElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                "http://schemas.microsoft.com/windowsazure", "CustomData");
                        if (customDataElement != null) {
                            String customDataInstance;
                            customDataInstance = customDataElement.getTextContent();
                            configurationSetInstance.setCustomData(customDataInstance);
                        }
                    }
                }

                Element dataVirtualHardDisksSequenceElement = XmlUtility.getElementByTagNameNS(
                        persistentVMRoleElement, "http://schemas.microsoft.com/windowsazure",
                        "DataVirtualHardDisks");
                if (dataVirtualHardDisksSequenceElement != null) {
                    for (int i15 = 0; i15 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "DataVirtualHardDisk")
                            .size(); i15 = i15 + 1) {
                        org.w3c.dom.Element dataVirtualHardDisksElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "DataVirtualHardDisk")
                                .get(i15));
                        DataVirtualHardDisk dataVirtualHardDiskInstance = new DataVirtualHardDisk();
                        result.getDataVirtualHardDisks().add(dataVirtualHardDiskInstance);

                        Element hostCachingElement = XmlUtility.getElementByTagNameNS(
                                dataVirtualHardDisksElement, "http://schemas.microsoft.com/windowsazure",
                                "HostCaching");
                        if (hostCachingElement != null) {
                            String hostCachingInstance;
                            hostCachingInstance = hostCachingElement.getTextContent();
                            dataVirtualHardDiskInstance.setHostCaching(hostCachingInstance);
                        }

                        Element diskLabelElement = XmlUtility.getElementByTagNameNS(dataVirtualHardDisksElement,
                                "http://schemas.microsoft.com/windowsazure", "DiskLabel");
                        if (diskLabelElement != null) {
                            String diskLabelInstance;
                            diskLabelInstance = diskLabelElement.getTextContent();
                            dataVirtualHardDiskInstance.setLabel(diskLabelInstance);
                        }

                        Element diskNameElement = XmlUtility.getElementByTagNameNS(dataVirtualHardDisksElement,
                                "http://schemas.microsoft.com/windowsazure", "DiskName");
                        if (diskNameElement != null) {
                            String diskNameInstance;
                            diskNameInstance = diskNameElement.getTextContent();
                            dataVirtualHardDiskInstance.setName(diskNameInstance);
                        }

                        Element lunElement = XmlUtility.getElementByTagNameNS(dataVirtualHardDisksElement,
                                "http://schemas.microsoft.com/windowsazure", "Lun");
                        if (lunElement != null && lunElement.getTextContent() != null
                                && !lunElement.getTextContent().isEmpty()) {
                            int lunInstance;
                            lunInstance = DatatypeConverter.parseInt(lunElement.getTextContent());
                            dataVirtualHardDiskInstance.setLogicalUnitNumber(lunInstance);
                        }

                        Element logicalDiskSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                dataVirtualHardDisksElement, "http://schemas.microsoft.com/windowsazure",
                                "LogicalDiskSizeInGB");
                        if (logicalDiskSizeInGBElement != null
                                && logicalDiskSizeInGBElement.getTextContent() != null
                                && !logicalDiskSizeInGBElement.getTextContent().isEmpty()) {
                            int logicalDiskSizeInGBInstance;
                            logicalDiskSizeInGBInstance = DatatypeConverter
                                    .parseInt(logicalDiskSizeInGBElement.getTextContent());
                            dataVirtualHardDiskInstance.setLogicalDiskSizeInGB(logicalDiskSizeInGBInstance);
                        }

                        Element mediaLinkElement = XmlUtility.getElementByTagNameNS(dataVirtualHardDisksElement,
                                "http://schemas.microsoft.com/windowsazure", "MediaLink");
                        if (mediaLinkElement != null) {
                            URI mediaLinkInstance;
                            mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
                            dataVirtualHardDiskInstance.setMediaLink(mediaLinkInstance);
                        }

                        Element sourceMediaLinkElement = XmlUtility.getElementByTagNameNS(
                                dataVirtualHardDisksElement, "http://schemas.microsoft.com/windowsazure",
                                "SourceMediaLink");
                        if (sourceMediaLinkElement != null) {
                            URI sourceMediaLinkInstance;
                            sourceMediaLinkInstance = new URI(sourceMediaLinkElement.getTextContent());
                            dataVirtualHardDiskInstance.setSourceMediaLink(sourceMediaLinkInstance);
                        }

                        Element iOTypeElement = XmlUtility.getElementByTagNameNS(dataVirtualHardDisksElement,
                                "http://schemas.microsoft.com/windowsazure", "IOType");
                        if (iOTypeElement != null) {
                            String iOTypeInstance;
                            iOTypeInstance = iOTypeElement.getTextContent();
                            dataVirtualHardDiskInstance.setIOType(iOTypeInstance);
                        }
                    }
                }

                Element oSVirtualHardDiskElement = XmlUtility.getElementByTagNameNS(persistentVMRoleElement,
                        "http://schemas.microsoft.com/windowsazure", "OSVirtualHardDisk");
                if (oSVirtualHardDiskElement != null) {
                    OSVirtualHardDisk oSVirtualHardDiskInstance = new OSVirtualHardDisk();
                    result.setOSVirtualHardDisk(oSVirtualHardDiskInstance);

                    Element hostCachingElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "HostCaching");
                    if (hostCachingElement2 != null) {
                        String hostCachingInstance2;
                        hostCachingInstance2 = hostCachingElement2.getTextContent();
                        oSVirtualHardDiskInstance.setHostCaching(hostCachingInstance2);
                    }

                    Element diskLabelElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "DiskLabel");
                    if (diskLabelElement2 != null) {
                        String diskLabelInstance2;
                        diskLabelInstance2 = diskLabelElement2.getTextContent();
                        oSVirtualHardDiskInstance.setLabel(diskLabelInstance2);
                    }

                    Element diskNameElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "DiskName");
                    if (diskNameElement2 != null) {
                        String diskNameInstance2;
                        diskNameInstance2 = diskNameElement2.getTextContent();
                        oSVirtualHardDiskInstance.setName(diskNameInstance2);
                    }

                    Element mediaLinkElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "MediaLink");
                    if (mediaLinkElement2 != null) {
                        URI mediaLinkInstance2;
                        mediaLinkInstance2 = new URI(mediaLinkElement2.getTextContent());
                        oSVirtualHardDiskInstance.setMediaLink(mediaLinkInstance2);
                    }

                    Element sourceImageNameElement = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "SourceImageName");
                    if (sourceImageNameElement != null) {
                        String sourceImageNameInstance;
                        sourceImageNameInstance = sourceImageNameElement.getTextContent();
                        oSVirtualHardDiskInstance.setSourceImageName(sourceImageNameInstance);
                    }

                    Element osElement = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "OS");
                    if (osElement != null) {
                        String osInstance;
                        osInstance = osElement.getTextContent();
                        oSVirtualHardDiskInstance.setOperatingSystem(osInstance);
                    }

                    Element remoteSourceImageLinkElement = XmlUtility.getElementByTagNameNS(
                            oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                            "RemoteSourceImageLink");
                    if (remoteSourceImageLinkElement != null) {
                        URI remoteSourceImageLinkInstance;
                        remoteSourceImageLinkInstance = new URI(remoteSourceImageLinkElement.getTextContent());
                        oSVirtualHardDiskInstance.setRemoteSourceImageLink(remoteSourceImageLinkInstance);
                    }

                    Element iOTypeElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "IOType");
                    if (iOTypeElement2 != null) {
                        String iOTypeInstance2;
                        iOTypeInstance2 = iOTypeElement2.getTextContent();
                        oSVirtualHardDiskInstance.setIOType(iOTypeInstance2);
                    }

                    Element resizedSizeInGBElement = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                            "http://schemas.microsoft.com/windowsazure", "ResizedSizeInGB");
                    if (resizedSizeInGBElement != null && resizedSizeInGBElement.getTextContent() != null
                            && !resizedSizeInGBElement.getTextContent().isEmpty()) {
                        int resizedSizeInGBInstance;
                        resizedSizeInGBInstance = DatatypeConverter
                                .parseInt(resizedSizeInGBElement.getTextContent());
                        oSVirtualHardDiskInstance.setResizedSizeInGB(resizedSizeInGBInstance);
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:com.microsoft.windowsazure.management.compute.DeploymentOperationsImpl.java

/**
* The Get Deployment By Slot operation returns configuration information,
* status, and system properties for a deployment.  (see
* http://msdn.microsoft.com/en-us/library/windowsazure/ee460804.aspx for
* more information)//  ww  w .j a  va 2  s .  c o  m
*
* @param serviceName Required. The name of the cloud service.
* @param deploymentSlot Required. The deployment slot.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return A deployment that exists in the cloud service.
*/
@Override
public DeploymentGetResponse getBySlot(String serviceName, DeploymentSlot deploymentSlot)
        throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
    // Validate
    if (serviceName == null) {
        throw new NullPointerException("serviceName");
    }
    if (deploymentSlot == null) {
        throw new NullPointerException("deploymentSlot");
    }

    // Tracing
    boolean shouldTrace = CloudTracing.getIsEnabled();
    String invocationId = null;
    if (shouldTrace) {
        invocationId = Long.toString(CloudTracing.getNextInvocationId());
        HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
        tracingParameters.put("serviceName", serviceName);
        tracingParameters.put("deploymentSlot", deploymentSlot);
        CloudTracing.enter(invocationId, this, "getBySlotAsync", tracingParameters);
    }

    // Construct URL
    String url = "";
    url = url + "/";
    if (this.getClient().getCredentials().getSubscriptionId() != null) {
        url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
    }
    url = url + "/services/hostedservices/";
    url = url + URLEncoder.encode(serviceName, "UTF-8");
    url = url + "/deploymentslots/";
    url = url + URLEncoder.encode(deploymentSlot.toString(), "UTF-8");
    String baseUrl = this.getClient().getBaseUri().toString();
    // Trim '/' character from the end of baseUrl and beginning of url.
    if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
        baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
    }
    if (url.charAt(0) == '/') {
        url = url.substring(1);
    }
    url = baseUrl + "/" + url;
    url = url.replace(" ", "%20");

    // Create HTTP transport objects
    HttpGet httpRequest = new HttpGet(url);

    // Set Headers
    httpRequest.setHeader("x-ms-version", "2015-04-01");

    // Send Request
    HttpResponse httpResponse = null;
    try {
        if (shouldTrace) {
            CloudTracing.sendRequest(invocationId, httpRequest);
        }
        httpResponse = this.getClient().getHttpClient().execute(httpRequest);
        if (shouldTrace) {
            CloudTracing.receiveResponse(invocationId, httpResponse);
        }
        int statusCode = httpResponse.getStatusLine().getStatusCode();
        if (statusCode != HttpStatus.SC_OK) {
            ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse,
                    httpResponse.getEntity());
            if (shouldTrace) {
                CloudTracing.error(invocationId, ex);
            }
            throw ex;
        }

        // Create Result
        DeploymentGetResponse result = null;
        // Deserialize Response
        if (statusCode == HttpStatus.SC_OK) {
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new DeploymentGetResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));

            Element deploymentElement = XmlUtility.getElementByTagNameNS(responseDoc,
                    "http://schemas.microsoft.com/windowsazure", "Deployment");
            if (deploymentElement != null) {
                Element nameElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Name");
                if (nameElement != null) {
                    String nameInstance;
                    nameInstance = nameElement.getTextContent();
                    result.setName(nameInstance);
                }

                Element deploymentSlotElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "DeploymentSlot");
                if (deploymentSlotElement != null && deploymentSlotElement.getTextContent() != null
                        && !deploymentSlotElement.getTextContent().isEmpty()) {
                    DeploymentSlot deploymentSlotInstance;
                    deploymentSlotInstance = DeploymentSlot.valueOf(deploymentSlotElement.getTextContent());
                    result.setDeploymentSlot(deploymentSlotInstance);
                }

                Element privateIDElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "PrivateID");
                if (privateIDElement != null) {
                    String privateIDInstance;
                    privateIDInstance = privateIDElement.getTextContent();
                    result.setPrivateId(privateIDInstance);
                }

                Element statusElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Status");
                if (statusElement != null && statusElement.getTextContent() != null
                        && !statusElement.getTextContent().isEmpty()) {
                    DeploymentStatus statusInstance;
                    statusInstance = DeploymentStatus.valueOf(statusElement.getTextContent());
                    result.setStatus(statusInstance);
                }

                Element labelElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Label");
                if (labelElement != null) {
                    String labelInstance;
                    labelInstance = labelElement.getTextContent() != null
                            ? new String(Base64.decode(labelElement.getTextContent()))
                            : null;
                    result.setLabel(labelInstance);
                }

                Element urlElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Url");
                if (urlElement != null) {
                    URI urlInstance;
                    urlInstance = new URI(urlElement.getTextContent());
                    result.setUri(urlInstance);
                }

                Element configurationElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Configuration");
                if (configurationElement != null) {
                    String configurationInstance;
                    configurationInstance = configurationElement.getTextContent() != null
                            ? new String(Base64.decode(configurationElement.getTextContent()))
                            : null;
                    result.setConfiguration(configurationInstance);
                }

                Element roleInstanceListSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleInstanceList");
                if (roleInstanceListSequenceElement != null) {
                    for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(roleInstanceListSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "RoleInstance")
                            .size(); i1 = i1 + 1) {
                        org.w3c.dom.Element roleInstanceListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(roleInstanceListSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "RoleInstance")
                                .get(i1));
                        RoleInstance roleInstanceInstance = new RoleInstance();
                        result.getRoleInstances().add(roleInstanceInstance);

                        Element roleNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleName");
                        if (roleNameElement != null) {
                            String roleNameInstance;
                            roleNameInstance = roleNameElement.getTextContent();
                            roleInstanceInstance.setRoleName(roleNameInstance);
                        }

                        Element instanceNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "InstanceName");
                        if (instanceNameElement != null) {
                            String instanceNameInstance;
                            instanceNameInstance = instanceNameElement.getTextContent();
                            roleInstanceInstance.setInstanceName(instanceNameInstance);
                        }

                        Element instanceStatusElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceStatus");
                        if (instanceStatusElement != null) {
                            String instanceStatusInstance;
                            instanceStatusInstance = instanceStatusElement.getTextContent();
                            roleInstanceInstance.setInstanceStatus(instanceStatusInstance);
                        }

                        Element instanceUpgradeDomainElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceUpgradeDomain");
                        if (instanceUpgradeDomainElement != null
                                && instanceUpgradeDomainElement.getTextContent() != null
                                && !instanceUpgradeDomainElement.getTextContent().isEmpty()) {
                            int instanceUpgradeDomainInstance;
                            instanceUpgradeDomainInstance = DatatypeConverter
                                    .parseInt(instanceUpgradeDomainElement.getTextContent());
                            roleInstanceInstance.setInstanceUpgradeDomain(instanceUpgradeDomainInstance);
                        }

                        Element instanceFaultDomainElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceFaultDomain");
                        if (instanceFaultDomainElement != null
                                && instanceFaultDomainElement.getTextContent() != null
                                && !instanceFaultDomainElement.getTextContent().isEmpty()) {
                            int instanceFaultDomainInstance;
                            instanceFaultDomainInstance = DatatypeConverter
                                    .parseInt(instanceFaultDomainElement.getTextContent());
                            roleInstanceInstance.setInstanceFaultDomain(instanceFaultDomainInstance);
                        }

                        Element instanceSizeElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "InstanceSize");
                        if (instanceSizeElement != null) {
                            String instanceSizeInstance;
                            instanceSizeInstance = instanceSizeElement.getTextContent();
                            roleInstanceInstance.setInstanceSize(instanceSizeInstance);
                        }

                        Element instanceStateDetailsElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceStateDetails");
                        if (instanceStateDetailsElement != null) {
                            String instanceStateDetailsInstance;
                            instanceStateDetailsInstance = instanceStateDetailsElement.getTextContent();
                            roleInstanceInstance.setInstanceStateDetails(instanceStateDetailsInstance);
                        }

                        Element instanceErrorCodeElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceErrorCode");
                        if (instanceErrorCodeElement != null) {
                            String instanceErrorCodeInstance;
                            instanceErrorCodeInstance = instanceErrorCodeElement.getTextContent();
                            roleInstanceInstance.setInstanceErrorCode(instanceErrorCodeInstance);
                        }

                        Element ipAddressElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "IpAddress");
                        if (ipAddressElement != null) {
                            InetAddress ipAddressInstance;
                            ipAddressInstance = InetAddress.getByName(ipAddressElement.getTextContent());
                            roleInstanceInstance.setIPAddress(ipAddressInstance);
                        }

                        Element instanceEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "InstanceEndpoints");
                        if (instanceEndpointsSequenceElement != null) {
                            for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(instanceEndpointsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "InstanceEndpoint")
                                    .size(); i2 = i2 + 1) {
                                org.w3c.dom.Element instanceEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(instanceEndpointsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "InstanceEndpoint")
                                        .get(i2));
                                InstanceEndpoint instanceEndpointInstance = new InstanceEndpoint();
                                roleInstanceInstance.getInstanceEndpoints().add(instanceEndpointInstance);

                                Element localPortElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "LocalPort");
                                if (localPortElement != null && localPortElement.getTextContent() != null
                                        && !localPortElement.getTextContent().isEmpty()) {
                                    int localPortInstance;
                                    localPortInstance = DatatypeConverter
                                            .parseInt(localPortElement.getTextContent());
                                    instanceEndpointInstance.setLocalPort(localPortInstance);
                                }

                                Element nameElement2 = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement2 != null) {
                                    String nameInstance2;
                                    nameInstance2 = nameElement2.getTextContent();
                                    instanceEndpointInstance.setName(nameInstance2);
                                }

                                Element publicPortElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "PublicPort");
                                if (publicPortElement != null) {
                                    int publicPortInstance;
                                    publicPortInstance = DatatypeConverter
                                            .parseInt(publicPortElement.getTextContent());
                                    instanceEndpointInstance.setPort(publicPortInstance);
                                }

                                Element protocolElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "Protocol");
                                if (protocolElement != null) {
                                    String protocolInstance;
                                    protocolInstance = protocolElement.getTextContent();
                                    instanceEndpointInstance.setProtocol(protocolInstance);
                                }

                                Element vipElement = XmlUtility.getElementByTagNameNS(instanceEndpointsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Vip");
                                if (vipElement != null) {
                                    InetAddress vipInstance;
                                    vipInstance = InetAddress.getByName(vipElement.getTextContent());
                                    instanceEndpointInstance.setVirtualIPAddress(vipInstance);
                                }

                                Element idleTimeoutInMinutesElement = XmlUtility.getElementByTagNameNS(
                                        instanceEndpointsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement != null
                                        && idleTimeoutInMinutesElement.getTextContent() != null
                                        && !idleTimeoutInMinutesElement.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance;
                                    idleTimeoutInMinutesInstance = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement.getTextContent());
                                    instanceEndpointInstance
                                            .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance);
                                }
                            }
                        }

                        Element guestAgentStatusElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "GuestAgentStatus");
                        if (guestAgentStatusElement != null) {
                            GuestAgentStatus guestAgentStatusInstance = new GuestAgentStatus();
                            roleInstanceInstance.setGuestAgentStatus(guestAgentStatusInstance);

                            Element protocolVersionElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "ProtocolVersion");
                            if (protocolVersionElement != null) {
                                String protocolVersionInstance;
                                protocolVersionInstance = protocolVersionElement.getTextContent();
                                guestAgentStatusInstance.setProtocolVersion(protocolVersionInstance);
                            }

                            Element timestampElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Timestamp");
                            if (timestampElement != null && timestampElement.getTextContent() != null
                                    && !timestampElement.getTextContent().isEmpty()) {
                                Calendar timestampInstance;
                                timestampInstance = DatatypeConverter
                                        .parseDateTime(timestampElement.getTextContent());
                                guestAgentStatusInstance.setTimestamp(timestampInstance);
                            }

                            Element guestAgentVersionElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "GuestAgentVersion");
                            if (guestAgentVersionElement != null) {
                                String guestAgentVersionInstance;
                                guestAgentVersionInstance = guestAgentVersionElement.getTextContent();
                                guestAgentStatusInstance.setGuestAgentVersion(guestAgentVersionInstance);
                            }

                            Element statusElement2 = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Status");
                            if (statusElement2 != null) {
                                String statusInstance2;
                                statusInstance2 = statusElement2.getTextContent();
                                guestAgentStatusInstance.setStatus(statusInstance2);
                            }

                            Element codeElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Code");
                            if (codeElement != null && codeElement.getTextContent() != null
                                    && !codeElement.getTextContent().isEmpty()) {
                                int codeInstance;
                                codeInstance = DatatypeConverter.parseInt(codeElement.getTextContent());
                                guestAgentStatusInstance.setCode(codeInstance);
                            }

                            Element messageElement = XmlUtility.getElementByTagNameNS(guestAgentStatusElement,
                                    "http://schemas.microsoft.com/windowsazure", "Message");
                            if (messageElement != null) {
                                GuestAgentMessage messageInstance = new GuestAgentMessage();
                                guestAgentStatusInstance.setMessage(messageInstance);

                                Element messageResourceIdElement = XmlUtility.getElementByTagNameNS(
                                        messageElement, "http://schemas.microsoft.com/windowsazure",
                                        "MessageResourceId");
                                if (messageResourceIdElement != null) {
                                    String messageResourceIdInstance;
                                    messageResourceIdInstance = messageResourceIdElement.getTextContent();
                                    messageInstance.setMessageResourceId(messageResourceIdInstance);
                                }

                                Element paramListSequenceElement = XmlUtility.getElementByTagNameNS(
                                        messageElement, "http://schemas.microsoft.com/windowsazure",
                                        "ParamList");
                                if (paramListSequenceElement != null) {
                                    for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(paramListSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Param")
                                            .size(); i3 = i3 + 1) {
                                        org.w3c.dom.Element paramListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(paramListSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Param")
                                                .get(i3));
                                        messageInstance.getParamList().add(paramListElement.getTextContent());
                                    }
                                }
                            }

                            Element formattedMessageElement = XmlUtility.getElementByTagNameNS(
                                    guestAgentStatusElement, "http://schemas.microsoft.com/windowsazure",
                                    "FormattedMessage");
                            if (formattedMessageElement != null) {
                                GuestAgentFormattedMessage formattedMessageInstance = new GuestAgentFormattedMessage();
                                guestAgentStatusInstance.setFormattedMessage(formattedMessageInstance);

                                Element languageElement = XmlUtility.getElementByTagNameNS(
                                        formattedMessageElement, "http://schemas.microsoft.com/windowsazure",
                                        "Language");
                                if (languageElement != null) {
                                    String languageInstance;
                                    languageInstance = languageElement.getTextContent();
                                    formattedMessageInstance.setLanguage(languageInstance);
                                }

                                Element messageElement2 = XmlUtility.getElementByTagNameNS(
                                        formattedMessageElement, "http://schemas.microsoft.com/windowsazure",
                                        "Message");
                                if (messageElement2 != null) {
                                    String messageInstance2;
                                    messageInstance2 = messageElement2.getTextContent();
                                    formattedMessageInstance.setMessage(messageInstance2);
                                }
                            }
                        }

                        Element resourceExtensionStatusListSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "ResourceExtensionStatusList");
                        if (resourceExtensionStatusListSequenceElement != null) {
                            for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(resourceExtensionStatusListSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ResourceExtensionStatus")
                                    .size(); i4 = i4 + 1) {
                                org.w3c.dom.Element resourceExtensionStatusListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(resourceExtensionStatusListSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionStatus")
                                        .get(i4));
                                ResourceExtensionStatus resourceExtensionStatusInstance = new ResourceExtensionStatus();
                                roleInstanceInstance.getResourceExtensionStatusList()
                                        .add(resourceExtensionStatusInstance);

                                Element handlerNameElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "HandlerName");
                                if (handlerNameElement != null) {
                                    String handlerNameInstance;
                                    handlerNameInstance = handlerNameElement.getTextContent();
                                    resourceExtensionStatusInstance.setHandlerName(handlerNameInstance);
                                }

                                Element versionElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Version");
                                if (versionElement != null) {
                                    String versionInstance;
                                    versionInstance = versionElement.getTextContent();
                                    resourceExtensionStatusInstance.setVersion(versionInstance);
                                }

                                Element statusElement3 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Status");
                                if (statusElement3 != null) {
                                    String statusInstance3;
                                    statusInstance3 = statusElement3.getTextContent();
                                    resourceExtensionStatusInstance.setStatus(statusInstance3);
                                }

                                Element codeElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Code");
                                if (codeElement2 != null && codeElement2.getTextContent() != null
                                        && !codeElement2.getTextContent().isEmpty()) {
                                    int codeInstance2;
                                    codeInstance2 = DatatypeConverter.parseInt(codeElement2.getTextContent());
                                    resourceExtensionStatusInstance.setCode(codeInstance2);
                                }

                                Element messageElement3 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "Message");
                                if (messageElement3 != null) {
                                    GuestAgentMessage messageInstance3 = new GuestAgentMessage();
                                    resourceExtensionStatusInstance.setMessage(messageInstance3);

                                    Element messageResourceIdElement2 = XmlUtility.getElementByTagNameNS(
                                            messageElement3, "http://schemas.microsoft.com/windowsazure",
                                            "MessageResourceId");
                                    if (messageResourceIdElement2 != null) {
                                        String messageResourceIdInstance2;
                                        messageResourceIdInstance2 = messageResourceIdElement2.getTextContent();
                                        messageInstance3.setMessageResourceId(messageResourceIdInstance2);
                                    }

                                    Element paramListSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                            messageElement3, "http://schemas.microsoft.com/windowsazure",
                                            "ParamList");
                                    if (paramListSequenceElement2 != null) {
                                        for (int i5 = 0; i5 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(paramListSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure", "Param")
                                                .size(); i5 = i5 + 1) {
                                            org.w3c.dom.Element paramListElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(paramListSequenceElement2,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Param")
                                                    .get(i5));
                                            messageInstance3.getParamList()
                                                    .add(paramListElement2.getTextContent());
                                        }
                                    }
                                }

                                Element formattedMessageElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "FormattedMessage");
                                if (formattedMessageElement2 != null) {
                                    GuestAgentFormattedMessage formattedMessageInstance2 = new GuestAgentFormattedMessage();
                                    resourceExtensionStatusInstance
                                            .setFormattedMessage(formattedMessageInstance2);

                                    Element languageElement2 = XmlUtility.getElementByTagNameNS(
                                            formattedMessageElement2,
                                            "http://schemas.microsoft.com/windowsazure", "Language");
                                    if (languageElement2 != null) {
                                        String languageInstance2;
                                        languageInstance2 = languageElement2.getTextContent();
                                        formattedMessageInstance2.setLanguage(languageInstance2);
                                    }

                                    Element messageElement4 = XmlUtility.getElementByTagNameNS(
                                            formattedMessageElement2,
                                            "http://schemas.microsoft.com/windowsazure", "Message");
                                    if (messageElement4 != null) {
                                        String messageInstance4;
                                        messageInstance4 = messageElement4.getTextContent();
                                        formattedMessageInstance2.setMessage(messageInstance4);
                                    }
                                }

                                Element extensionSettingStatusElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionStatusListElement,
                                        "http://schemas.microsoft.com/windowsazure", "ExtensionSettingStatus");
                                if (extensionSettingStatusElement != null) {
                                    ResourceExtensionConfigurationStatus extensionSettingStatusInstance = new ResourceExtensionConfigurationStatus();
                                    resourceExtensionStatusInstance
                                            .setExtensionSettingStatus(extensionSettingStatusInstance);

                                    Element timestampElement2 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Timestamp");
                                    if (timestampElement2 != null && timestampElement2.getTextContent() != null
                                            && !timestampElement2.getTextContent().isEmpty()) {
                                        Calendar timestampInstance2;
                                        timestampInstance2 = DatatypeConverter
                                                .parseDateTime(timestampElement2.getTextContent());
                                        extensionSettingStatusInstance.setTimestamp(timestampInstance2);
                                    }

                                    Element configurationAppliedTimeElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ConfigurationAppliedTime");
                                    if (configurationAppliedTimeElement != null
                                            && configurationAppliedTimeElement.getTextContent() != null
                                            && !configurationAppliedTimeElement.getTextContent().isEmpty()) {
                                        Calendar configurationAppliedTimeInstance;
                                        configurationAppliedTimeInstance = DatatypeConverter.parseDateTime(
                                                configurationAppliedTimeElement.getTextContent());
                                        extensionSettingStatusInstance
                                                .setConfigurationAppliedTime(configurationAppliedTimeInstance);
                                    }

                                    Element nameElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement3 != null) {
                                        String nameInstance3;
                                        nameInstance3 = nameElement3.getTextContent();
                                        extensionSettingStatusInstance.setName(nameInstance3);
                                    }

                                    Element operationElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Operation");
                                    if (operationElement != null) {
                                        String operationInstance;
                                        operationInstance = operationElement.getTextContent();
                                        extensionSettingStatusInstance.setOperation(operationInstance);
                                    }

                                    Element statusElement4 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Status");
                                    if (statusElement4 != null) {
                                        String statusInstance4;
                                        statusInstance4 = statusElement4.getTextContent();
                                        extensionSettingStatusInstance.setStatus(statusInstance4);
                                    }

                                    Element codeElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Code");
                                    if (codeElement3 != null && codeElement3.getTextContent() != null
                                            && !codeElement3.getTextContent().isEmpty()) {
                                        int codeInstance3;
                                        codeInstance3 = DatatypeConverter
                                                .parseInt(codeElement3.getTextContent());
                                        extensionSettingStatusInstance.setCode(codeInstance3);
                                    }

                                    Element messageElement5 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "Message");
                                    if (messageElement5 != null) {
                                        GuestAgentMessage messageInstance5 = new GuestAgentMessage();
                                        extensionSettingStatusInstance.setMessage(messageInstance5);

                                        Element messageResourceIdElement3 = XmlUtility.getElementByTagNameNS(
                                                messageElement5, "http://schemas.microsoft.com/windowsazure",
                                                "MessageResourceId");
                                        if (messageResourceIdElement3 != null) {
                                            String messageResourceIdInstance3;
                                            messageResourceIdInstance3 = messageResourceIdElement3
                                                    .getTextContent();
                                            messageInstance5.setMessageResourceId(messageResourceIdInstance3);
                                        }

                                        Element paramListSequenceElement3 = XmlUtility.getElementByTagNameNS(
                                                messageElement5, "http://schemas.microsoft.com/windowsazure",
                                                "ParamList");
                                        if (paramListSequenceElement3 != null) {
                                            for (int i6 = 0; i6 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(paramListSequenceElement3,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Param")
                                                    .size(); i6 = i6 + 1) {
                                                org.w3c.dom.Element paramListElement3 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(paramListSequenceElement3,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "Param")
                                                        .get(i6));
                                                messageInstance5.getParamList()
                                                        .add(paramListElement3.getTextContent());
                                            }
                                        }
                                    }

                                    Element formattedMessageElement3 = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "FormattedMessage");
                                    if (formattedMessageElement3 != null) {
                                        GuestAgentFormattedMessage formattedMessageInstance3 = new GuestAgentFormattedMessage();
                                        extensionSettingStatusInstance
                                                .setFormattedMessage(formattedMessageInstance3);

                                        Element languageElement3 = XmlUtility.getElementByTagNameNS(
                                                formattedMessageElement3,
                                                "http://schemas.microsoft.com/windowsazure", "Language");
                                        if (languageElement3 != null) {
                                            String languageInstance3;
                                            languageInstance3 = languageElement3.getTextContent();
                                            formattedMessageInstance3.setLanguage(languageInstance3);
                                        }

                                        Element messageElement6 = XmlUtility.getElementByTagNameNS(
                                                formattedMessageElement3,
                                                "http://schemas.microsoft.com/windowsazure", "Message");
                                        if (messageElement6 != null) {
                                            String messageInstance6;
                                            messageInstance6 = messageElement6.getTextContent();
                                            formattedMessageInstance3.setMessage(messageInstance6);
                                        }
                                    }

                                    Element subStatusListSequenceElement = XmlUtility.getElementByTagNameNS(
                                            extensionSettingStatusElement,
                                            "http://schemas.microsoft.com/windowsazure", "SubStatusList");
                                    if (subStatusListSequenceElement != null) {
                                        for (int i7 = 0; i7 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(subStatusListSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubStatus")
                                                .size(); i7 = i7 + 1) {
                                            org.w3c.dom.Element subStatusListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(subStatusListSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "SubStatus")
                                                    .get(i7));
                                            ResourceExtensionSubStatus subStatusInstance = new ResourceExtensionSubStatus();
                                            extensionSettingStatusInstance.getSubStatusList()
                                                    .add(subStatusInstance);

                                            Element nameElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Name");
                                            if (nameElement4 != null) {
                                                String nameInstance4;
                                                nameInstance4 = nameElement4.getTextContent();
                                                subStatusInstance.setName(nameInstance4);
                                            }

                                            Element statusElement5 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Status");
                                            if (statusElement5 != null) {
                                                String statusInstance5;
                                                statusInstance5 = statusElement5.getTextContent();
                                                subStatusInstance.setStatus(statusInstance5);
                                            }

                                            Element codeElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Code");
                                            if (codeElement4 != null && codeElement4.getTextContent() != null
                                                    && !codeElement4.getTextContent().isEmpty()) {
                                                int codeInstance4;
                                                codeInstance4 = DatatypeConverter
                                                        .parseInt(codeElement4.getTextContent());
                                                subStatusInstance.setCode(codeInstance4);
                                            }

                                            Element messageElement7 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Message");
                                            if (messageElement7 != null) {
                                                GuestAgentMessage messageInstance7 = new GuestAgentMessage();
                                                subStatusInstance.setMessage(messageInstance7);

                                                Element messageResourceIdElement4 = XmlUtility
                                                        .getElementByTagNameNS(messageElement7,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "MessageResourceId");
                                                if (messageResourceIdElement4 != null) {
                                                    String messageResourceIdInstance4;
                                                    messageResourceIdInstance4 = messageResourceIdElement4
                                                            .getTextContent();
                                                    messageInstance7
                                                            .setMessageResourceId(messageResourceIdInstance4);
                                                }

                                                Element paramListSequenceElement4 = XmlUtility
                                                        .getElementByTagNameNS(messageElement7,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "ParamList");
                                                if (paramListSequenceElement4 != null) {
                                                    for (int i8 = 0; i8 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(paramListSequenceElement4,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Param")
                                                            .size(); i8 = i8 + 1) {
                                                        org.w3c.dom.Element paramListElement4 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                                .getElementsByTagNameNS(
                                                                        paramListSequenceElement4,
                                                                        "http://schemas.microsoft.com/windowsazure",
                                                                        "Param")
                                                                .get(i8));
                                                        messageInstance7.getParamList()
                                                                .add(paramListElement4.getTextContent());
                                                    }
                                                }
                                            }

                                            Element formattedMessageElement4 = XmlUtility.getElementByTagNameNS(
                                                    subStatusListElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "FormattedMessage");
                                            if (formattedMessageElement4 != null) {
                                                GuestAgentFormattedMessage formattedMessageInstance4 = new GuestAgentFormattedMessage();
                                                subStatusInstance
                                                        .setFormattedMessage(formattedMessageInstance4);

                                                Element languageElement4 = XmlUtility.getElementByTagNameNS(
                                                        formattedMessageElement4,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "Language");
                                                if (languageElement4 != null) {
                                                    String languageInstance4;
                                                    languageInstance4 = languageElement4.getTextContent();
                                                    formattedMessageInstance4.setLanguage(languageInstance4);
                                                }

                                                Element messageElement8 = XmlUtility.getElementByTagNameNS(
                                                        formattedMessageElement4,
                                                        "http://schemas.microsoft.com/windowsazure", "Message");
                                                if (messageElement8 != null) {
                                                    String messageInstance8;
                                                    messageInstance8 = messageElement8.getTextContent();
                                                    formattedMessageInstance4.setMessage(messageInstance8);
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }

                        Element powerStateElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "PowerState");
                        if (powerStateElement != null && powerStateElement.getTextContent() != null
                                && !powerStateElement.getTextContent().isEmpty()) {
                            RoleInstancePowerState powerStateInstance;
                            powerStateInstance = RoleInstancePowerState
                                    .valueOf(powerStateElement.getTextContent());
                            roleInstanceInstance.setPowerState(powerStateInstance);
                        }

                        Element hostNameElement = XmlUtility.getElementByTagNameNS(roleInstanceListElement,
                                "http://schemas.microsoft.com/windowsazure", "HostName");
                        if (hostNameElement != null) {
                            String hostNameInstance;
                            hostNameInstance = hostNameElement.getTextContent();
                            roleInstanceInstance.setHostName(hostNameInstance);
                        }

                        Element remoteAccessCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "RemoteAccessCertificateThumbprint");
                        if (remoteAccessCertificateThumbprintElement != null) {
                            String remoteAccessCertificateThumbprintInstance;
                            remoteAccessCertificateThumbprintInstance = remoteAccessCertificateThumbprintElement
                                    .getTextContent();
                            roleInstanceInstance.setRemoteAccessCertificateThumbprint(
                                    remoteAccessCertificateThumbprintInstance);
                        }

                        Element publicIPsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "PublicIPs");
                        if (publicIPsSequenceElement != null) {
                            for (int i9 = 0; i9 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(publicIPsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                    .size(); i9 = i9 + 1) {
                                org.w3c.dom.Element publicIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(publicIPsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                        .get(i9));
                                RoleInstance.PublicIP publicIPInstance = new RoleInstance.PublicIP();
                                roleInstanceInstance.getPublicIPs().add(publicIPInstance);

                                Element nameElement5 = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement5 != null) {
                                    String nameInstance5;
                                    nameInstance5 = nameElement5.getTextContent();
                                    publicIPInstance.setName(nameInstance5);
                                }

                                Element addressElement = XmlUtility.getElementByTagNameNS(publicIPsElement,
                                        "http://schemas.microsoft.com/windowsazure", "Address");
                                if (addressElement != null) {
                                    InetAddress addressInstance;
                                    addressInstance = InetAddress.getByName(addressElement.getTextContent());
                                    publicIPInstance.setAddress(addressInstance);
                                }

                                Element idleTimeoutInMinutesElement2 = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IdleTimeoutInMinutes");
                                if (idleTimeoutInMinutesElement2 != null
                                        && idleTimeoutInMinutesElement2.getTextContent() != null
                                        && !idleTimeoutInMinutesElement2.getTextContent().isEmpty()) {
                                    int idleTimeoutInMinutesInstance2;
                                    idleTimeoutInMinutesInstance2 = DatatypeConverter
                                            .parseInt(idleTimeoutInMinutesElement2.getTextContent());
                                    publicIPInstance.setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance2);
                                }

                                Element domainNameLabelElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainNameLabel");
                                if (domainNameLabelElement != null) {
                                    String domainNameLabelInstance;
                                    domainNameLabelInstance = domainNameLabelElement.getTextContent();
                                    publicIPInstance.setDomainNameLabel(domainNameLabelInstance);
                                }

                                Element fqdnsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        publicIPsElement, "http://schemas.microsoft.com/windowsazure", "Fqdns");
                                if (fqdnsSequenceElement != null) {
                                    for (int i10 = 0; i10 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(fqdnsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fqdn")
                                            .size(); i10 = i10 + 1) {
                                        org.w3c.dom.Element fqdnsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(fqdnsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Fqdn")
                                                .get(i10));
                                        publicIPInstance.getFqdns().add(fqdnsElement.getTextContent());
                                    }
                                }
                            }
                        }

                        Element networkInterfacesSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleInstanceListElement, "http://schemas.microsoft.com/windowsazure",
                                "NetworkInterfaces");
                        if (networkInterfacesSequenceElement != null) {
                            for (int i11 = 0; i11 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                    .size(); i11 = i11 + 1) {
                                org.w3c.dom.Element networkInterfacesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(networkInterfacesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "NetworkInterface")
                                        .get(i11));
                                NetworkInterfaceInstance networkInterfaceInstance = new NetworkInterfaceInstance();
                                roleInstanceInstance.getNetworkInterfaces().add(networkInterfaceInstance);

                                Element nameElement6 = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "Name");
                                if (nameElement6 != null) {
                                    String nameInstance6;
                                    nameInstance6 = nameElement6.getTextContent();
                                    networkInterfaceInstance.setName(nameInstance6);
                                }

                                Element macAddressElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "MacAddress");
                                if (macAddressElement != null) {
                                    String macAddressInstance;
                                    macAddressInstance = macAddressElement.getTextContent();
                                    networkInterfaceInstance.setMacAddress(macAddressInstance);
                                }

                                Element iPConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        networkInterfacesElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPConfigurations");
                                if (iPConfigurationsSequenceElement != null) {
                                    for (int i12 = 0; i12 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IPConfiguration")
                                            .size(); i12 = i12 + 1) {
                                        org.w3c.dom.Element iPConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(iPConfigurationsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfiguration")
                                                .get(i12));
                                        IPConfigurationInstance iPConfigurationInstance = new IPConfigurationInstance();
                                        networkInterfaceInstance.getIPConfigurations()
                                                .add(iPConfigurationInstance);

                                        Element subnetNameElement = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "SubnetName");
                                        if (subnetNameElement != null) {
                                            String subnetNameInstance;
                                            subnetNameInstance = subnetNameElement.getTextContent();
                                            iPConfigurationInstance.setSubnetName(subnetNameInstance);
                                        }

                                        Element addressElement2 = XmlUtility.getElementByTagNameNS(
                                                iPConfigurationsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Address");
                                        if (addressElement2 != null) {
                                            String addressInstance2;
                                            addressInstance2 = addressElement2.getTextContent();
                                            iPConfigurationInstance.setAddress(addressInstance2);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                Element upgradeStatusElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "UpgradeStatus");
                if (upgradeStatusElement != null) {
                    UpgradeStatus upgradeStatusInstance = new UpgradeStatus();
                    result.setUpgradeStatus(upgradeStatusInstance);

                    Element upgradeTypeElement = XmlUtility.getElementByTagNameNS(upgradeStatusElement,
                            "http://schemas.microsoft.com/windowsazure", "UpgradeType");
                    if (upgradeTypeElement != null && upgradeTypeElement.getTextContent() != null
                            && !upgradeTypeElement.getTextContent().isEmpty()) {
                        DeploymentUpgradeType upgradeTypeInstance;
                        upgradeTypeInstance = DeploymentUpgradeType
                                .valueOf(upgradeTypeElement.getTextContent());
                        upgradeStatusInstance.setUpgradeType(upgradeTypeInstance);
                    }

                    Element currentUpgradeDomainStateElement = XmlUtility.getElementByTagNameNS(
                            upgradeStatusElement, "http://schemas.microsoft.com/windowsazure",
                            "CurrentUpgradeDomainState");
                    if (currentUpgradeDomainStateElement != null
                            && currentUpgradeDomainStateElement.getTextContent() != null
                            && !currentUpgradeDomainStateElement.getTextContent().isEmpty()) {
                        UpgradeDomainState currentUpgradeDomainStateInstance;
                        currentUpgradeDomainStateInstance = UpgradeDomainState
                                .valueOf(currentUpgradeDomainStateElement.getTextContent());
                        upgradeStatusInstance.setCurrentUpgradeDomainState(currentUpgradeDomainStateInstance);
                    }

                    Element currentUpgradeDomainElement = XmlUtility.getElementByTagNameNS(upgradeStatusElement,
                            "http://schemas.microsoft.com/windowsazure", "CurrentUpgradeDomain");
                    if (currentUpgradeDomainElement != null) {
                        int currentUpgradeDomainInstance;
                        currentUpgradeDomainInstance = DatatypeConverter
                                .parseInt(currentUpgradeDomainElement.getTextContent());
                        upgradeStatusInstance.setCurrentUpgradeDomain(currentUpgradeDomainInstance);
                    }
                }

                Element upgradeDomainCountElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "UpgradeDomainCount");
                if (upgradeDomainCountElement != null) {
                    int upgradeDomainCountInstance;
                    upgradeDomainCountInstance = DatatypeConverter
                            .parseInt(upgradeDomainCountElement.getTextContent());
                    result.setUpgradeDomainCount(upgradeDomainCountInstance);
                }

                Element roleListSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RoleList");
                if (roleListSequenceElement != null) {
                    for (int i13 = 0; i13 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(roleListSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "Role")
                            .size(); i13 = i13 + 1) {
                        org.w3c.dom.Element roleListElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(roleListSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Role")
                                .get(i13));
                        Role roleInstance = new Role();
                        result.getRoles().add(roleInstance);

                        Element roleNameElement2 = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleName");
                        if (roleNameElement2 != null) {
                            String roleNameInstance2;
                            roleNameInstance2 = roleNameElement2.getTextContent();
                            roleInstance.setRoleName(roleNameInstance2);
                        }

                        Element osVersionElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "OsVersion");
                        if (osVersionElement != null) {
                            String osVersionInstance;
                            osVersionInstance = osVersionElement.getTextContent();
                            roleInstance.setOSVersion(osVersionInstance);
                        }

                        Element roleTypeElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleType");
                        if (roleTypeElement != null) {
                            String roleTypeInstance;
                            roleTypeInstance = roleTypeElement.getTextContent();
                            roleInstance.setRoleType(roleTypeInstance);
                        }

                        Element configurationSetsSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "ConfigurationSets");
                        if (configurationSetsSequenceElement != null) {
                            for (int i14 = 0; i14 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(configurationSetsSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                    .size(); i14 = i14 + 1) {
                                org.w3c.dom.Element configurationSetsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(configurationSetsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "ConfigurationSet")
                                        .get(i14));
                                ConfigurationSet configurationSetInstance = new ConfigurationSet();
                                roleInstance.getConfigurationSets().add(configurationSetInstance);

                                Element configurationSetTypeElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ConfigurationSetType");
                                if (configurationSetTypeElement != null) {
                                    String configurationSetTypeInstance;
                                    configurationSetTypeInstance = configurationSetTypeElement.getTextContent();
                                    configurationSetInstance
                                            .setConfigurationSetType(configurationSetTypeInstance);
                                }

                                Element inputEndpointsSequenceElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "InputEndpoints");
                                if (inputEndpointsSequenceElement != null) {
                                    for (int i15 = 0; i15 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "InputEndpoint")
                                            .size(); i15 = i15 + 1) {
                                        org.w3c.dom.Element inputEndpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(inputEndpointsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "InputEndpoint")
                                                .get(i15));
                                        InputEndpoint inputEndpointInstance = new InputEndpoint();
                                        configurationSetInstance.getInputEndpoints().add(inputEndpointInstance);

                                        Element loadBalancedEndpointSetNameElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "LoadBalancedEndpointSetName");
                                        if (loadBalancedEndpointSetNameElement != null) {
                                            String loadBalancedEndpointSetNameInstance;
                                            loadBalancedEndpointSetNameInstance = loadBalancedEndpointSetNameElement
                                                    .getTextContent();
                                            inputEndpointInstance.setLoadBalancedEndpointSetName(
                                                    loadBalancedEndpointSetNameInstance);
                                        }

                                        Element localPortElement2 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "LocalPort");
                                        if (localPortElement2 != null
                                                && localPortElement2.getTextContent() != null
                                                && !localPortElement2.getTextContent().isEmpty()) {
                                            int localPortInstance2;
                                            localPortInstance2 = DatatypeConverter
                                                    .parseInt(localPortElement2.getTextContent());
                                            inputEndpointInstance.setLocalPort(localPortInstance2);
                                        }

                                        Element nameElement7 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Name");
                                        if (nameElement7 != null) {
                                            String nameInstance7;
                                            nameInstance7 = nameElement7.getTextContent();
                                            inputEndpointInstance.setName(nameInstance7);
                                        }

                                        Element portElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Port");
                                        if (portElement != null && portElement.getTextContent() != null
                                                && !portElement.getTextContent().isEmpty()) {
                                            int portInstance;
                                            portInstance = DatatypeConverter
                                                    .parseInt(portElement.getTextContent());
                                            inputEndpointInstance.setPort(portInstance);
                                        }

                                        Element loadBalancerProbeElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "LoadBalancerProbe");
                                        if (loadBalancerProbeElement != null) {
                                            LoadBalancerProbe loadBalancerProbeInstance = new LoadBalancerProbe();
                                            inputEndpointInstance
                                                    .setLoadBalancerProbe(loadBalancerProbeInstance);

                                            Element pathElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement != null) {
                                                String pathInstance;
                                                pathInstance = pathElement.getTextContent();
                                                loadBalancerProbeInstance.setPath(pathInstance);
                                            }

                                            Element portElement2 = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Port");
                                            if (portElement2 != null) {
                                                int portInstance2;
                                                portInstance2 = DatatypeConverter
                                                        .parseInt(portElement2.getTextContent());
                                                loadBalancerProbeInstance.setPort(portInstance2);
                                            }

                                            Element protocolElement2 = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Protocol");
                                            if (protocolElement2 != null
                                                    && protocolElement2.getTextContent() != null
                                                    && !protocolElement2.getTextContent().isEmpty()) {
                                                LoadBalancerProbeTransportProtocol protocolInstance2;
                                                protocolInstance2 = com.microsoft.windowsazure.management.compute.ComputeManagementClientImpl
                                                        .parseLoadBalancerProbeTransportProtocol(
                                                                protocolElement2.getTextContent());
                                                loadBalancerProbeInstance.setProtocol(protocolInstance2);
                                            }

                                            Element intervalInSecondsElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "IntervalInSeconds");
                                            if (intervalInSecondsElement != null
                                                    && intervalInSecondsElement.getTextContent() != null
                                                    && !intervalInSecondsElement.getTextContent().isEmpty()) {
                                                int intervalInSecondsInstance;
                                                intervalInSecondsInstance = DatatypeConverter
                                                        .parseInt(intervalInSecondsElement.getTextContent());
                                                loadBalancerProbeInstance
                                                        .setIntervalInSeconds(intervalInSecondsInstance);
                                            }

                                            Element timeoutInSecondsElement = XmlUtility.getElementByTagNameNS(
                                                    loadBalancerProbeElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "TimeoutInSeconds");
                                            if (timeoutInSecondsElement != null
                                                    && timeoutInSecondsElement.getTextContent() != null
                                                    && !timeoutInSecondsElement.getTextContent().isEmpty()) {
                                                int timeoutInSecondsInstance;
                                                timeoutInSecondsInstance = DatatypeConverter
                                                        .parseInt(timeoutInSecondsElement.getTextContent());
                                                loadBalancerProbeInstance
                                                        .setTimeoutInSeconds(timeoutInSecondsInstance);
                                            }
                                        }

                                        Element protocolElement3 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Protocol");
                                        if (protocolElement3 != null) {
                                            String protocolInstance3;
                                            protocolInstance3 = protocolElement3.getTextContent();
                                            inputEndpointInstance.setProtocol(protocolInstance3);
                                        }

                                        Element vipElement2 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Vip");
                                        if (vipElement2 != null) {
                                            InetAddress vipInstance2;
                                            vipInstance2 = InetAddress.getByName(vipElement2.getTextContent());
                                            inputEndpointInstance.setVirtualIPAddress(vipInstance2);
                                        }

                                        Element enableDirectServerReturnElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "EnableDirectServerReturn");
                                        if (enableDirectServerReturnElement != null
                                                && enableDirectServerReturnElement.getTextContent() != null
                                                && !enableDirectServerReturnElement.getTextContent()
                                                        .isEmpty()) {
                                            boolean enableDirectServerReturnInstance;
                                            enableDirectServerReturnInstance = DatatypeConverter
                                                    .parseBoolean(enableDirectServerReturnElement
                                                            .getTextContent().toLowerCase());
                                            inputEndpointInstance.setEnableDirectServerReturn(
                                                    enableDirectServerReturnInstance);
                                        }

                                        Element loadBalancerNameElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "LoadBalancerName");
                                        if (loadBalancerNameElement != null) {
                                            String loadBalancerNameInstance;
                                            loadBalancerNameInstance = loadBalancerNameElement.getTextContent();
                                            inputEndpointInstance.setLoadBalancerName(loadBalancerNameInstance);
                                        }

                                        Element endpointAclElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "EndpointAcl");
                                        if (endpointAclElement != null) {
                                            EndpointAcl endpointAclInstance = new EndpointAcl();
                                            inputEndpointInstance.setEndpointAcl(endpointAclInstance);

                                            Element rulesSequenceElement = XmlUtility.getElementByTagNameNS(
                                                    endpointAclElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Rules");
                                            if (rulesSequenceElement != null) {
                                                for (int i16 = 0; i16 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(rulesSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "Rule")
                                                        .size(); i16 = i16 + 1) {
                                                    org.w3c.dom.Element rulesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(rulesSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Rule")
                                                            .get(i16));
                                                    AccessControlListRule ruleInstance = new AccessControlListRule();
                                                    endpointAclInstance.getRules().add(ruleInstance);

                                                    Element orderElement = XmlUtility.getElementByTagNameNS(
                                                            rulesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Order");
                                                    if (orderElement != null
                                                            && orderElement.getTextContent() != null
                                                            && !orderElement.getTextContent().isEmpty()) {
                                                        int orderInstance;
                                                        orderInstance = DatatypeConverter
                                                                .parseInt(orderElement.getTextContent());
                                                        ruleInstance.setOrder(orderInstance);
                                                    }

                                                    Element actionElement = XmlUtility.getElementByTagNameNS(
                                                            rulesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Action");
                                                    if (actionElement != null) {
                                                        String actionInstance;
                                                        actionInstance = actionElement.getTextContent();
                                                        ruleInstance.setAction(actionInstance);
                                                    }

                                                    Element remoteSubnetElement = XmlUtility
                                                            .getElementByTagNameNS(rulesElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "RemoteSubnet");
                                                    if (remoteSubnetElement != null) {
                                                        String remoteSubnetInstance;
                                                        remoteSubnetInstance = remoteSubnetElement
                                                                .getTextContent();
                                                        ruleInstance.setRemoteSubnet(remoteSubnetInstance);
                                                    }

                                                    Element descriptionElement = XmlUtility
                                                            .getElementByTagNameNS(rulesElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "Description");
                                                    if (descriptionElement != null) {
                                                        String descriptionInstance;
                                                        descriptionInstance = descriptionElement
                                                                .getTextContent();
                                                        ruleInstance.setDescription(descriptionInstance);
                                                    }
                                                }
                                            }
                                        }

                                        Element idleTimeoutInMinutesElement3 = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "IdleTimeoutInMinutes");
                                        if (idleTimeoutInMinutesElement3 != null
                                                && idleTimeoutInMinutesElement3.getTextContent() != null
                                                && !idleTimeoutInMinutesElement3.getTextContent().isEmpty()) {
                                            int idleTimeoutInMinutesInstance3;
                                            idleTimeoutInMinutesInstance3 = DatatypeConverter
                                                    .parseInt(idleTimeoutInMinutesElement3.getTextContent());
                                            inputEndpointInstance
                                                    .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance3);
                                        }

                                        Element loadBalancerDistributionElement = XmlUtility
                                                .getElementByTagNameNS(inputEndpointsElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "LoadBalancerDistribution");
                                        if (loadBalancerDistributionElement != null) {
                                            String loadBalancerDistributionInstance;
                                            loadBalancerDistributionInstance = loadBalancerDistributionElement
                                                    .getTextContent();
                                            inputEndpointInstance.setLoadBalancerDistribution(
                                                    loadBalancerDistributionInstance);
                                        }

                                        Element virtualIPNameElement = XmlUtility.getElementByTagNameNS(
                                                inputEndpointsElement,
                                                "http://schemas.microsoft.com/windowsazure", "VirtualIPName");
                                        if (virtualIPNameElement != null) {
                                            String virtualIPNameInstance;
                                            virtualIPNameInstance = virtualIPNameElement.getTextContent();
                                            inputEndpointInstance.setVirtualIPName(virtualIPNameInstance);
                                        }
                                    }
                                }

                                Element subnetNamesSequenceElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "SubnetNames");
                                if (subnetNamesSequenceElement != null) {
                                    for (int i17 = 0; i17 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "SubnetName")
                                            .size(); i17 = i17 + 1) {
                                        org.w3c.dom.Element subnetNamesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(subnetNamesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubnetName")
                                                .get(i17));
                                        configurationSetInstance.getSubnetNames()
                                                .add(subnetNamesElement.getTextContent());
                                    }
                                }

                                Element staticVirtualNetworkIPAddressElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "StaticVirtualNetworkIPAddress");
                                if (staticVirtualNetworkIPAddressElement != null) {
                                    String staticVirtualNetworkIPAddressInstance;
                                    staticVirtualNetworkIPAddressInstance = staticVirtualNetworkIPAddressElement
                                            .getTextContent();
                                    configurationSetInstance.setStaticVirtualNetworkIPAddress(
                                            staticVirtualNetworkIPAddressInstance);
                                }

                                Element publicIPsSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "PublicIPs");
                                if (publicIPsSequenceElement2 != null) {
                                    for (int i18 = 0; i18 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(publicIPsSequenceElement2,
                                                    "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                            .size(); i18 = i18 + 1) {
                                        org.w3c.dom.Element publicIPsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(publicIPsSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure", "PublicIP")
                                                .get(i18));
                                        ConfigurationSet.PublicIP publicIPInstance2 = new ConfigurationSet.PublicIP();
                                        configurationSetInstance.getPublicIPs().add(publicIPInstance2);

                                        Element nameElement8 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "Name");
                                        if (nameElement8 != null) {
                                            String nameInstance8;
                                            nameInstance8 = nameElement8.getTextContent();
                                            publicIPInstance2.setName(nameInstance8);
                                        }

                                        Element idleTimeoutInMinutesElement4 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "IdleTimeoutInMinutes");
                                        if (idleTimeoutInMinutesElement4 != null
                                                && idleTimeoutInMinutesElement4.getTextContent() != null
                                                && !idleTimeoutInMinutesElement4.getTextContent().isEmpty()) {
                                            int idleTimeoutInMinutesInstance4;
                                            idleTimeoutInMinutesInstance4 = DatatypeConverter
                                                    .parseInt(idleTimeoutInMinutesElement4.getTextContent());
                                            publicIPInstance2
                                                    .setIdleTimeoutInMinutes(idleTimeoutInMinutesInstance4);
                                        }

                                        Element domainNameLabelElement2 = XmlUtility.getElementByTagNameNS(
                                                publicIPsElement2, "http://schemas.microsoft.com/windowsazure",
                                                "DomainNameLabel");
                                        if (domainNameLabelElement2 != null) {
                                            String domainNameLabelInstance2;
                                            domainNameLabelInstance2 = domainNameLabelElement2.getTextContent();
                                            publicIPInstance2.setDomainNameLabel(domainNameLabelInstance2);
                                        }
                                    }
                                }

                                Element networkInterfacesSequenceElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkInterfaces");
                                if (networkInterfacesSequenceElement2 != null) {
                                    for (int i19 = 0; i19 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(networkInterfacesSequenceElement2,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "NetworkInterface")
                                            .size(); i19 = i19 + 1) {
                                        org.w3c.dom.Element networkInterfacesElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(networkInterfacesSequenceElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "NetworkInterface")
                                                .get(i19));
                                        NetworkInterface networkInterfaceInstance2 = new NetworkInterface();
                                        configurationSetInstance.getNetworkInterfaces()
                                                .add(networkInterfaceInstance2);

                                        Element nameElement9 = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure", "Name");
                                        if (nameElement9 != null) {
                                            String nameInstance9;
                                            nameInstance9 = nameElement9.getTextContent();
                                            networkInterfaceInstance2.setName(nameInstance9);
                                        }

                                        Element iPConfigurationsSequenceElement2 = XmlUtility
                                                .getElementByTagNameNS(networkInterfacesElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "IPConfigurations");
                                        if (iPConfigurationsSequenceElement2 != null) {
                                            for (int i20 = 0; i20 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(iPConfigurationsSequenceElement2,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "IPConfiguration")
                                                    .size(); i20 = i20 + 1) {
                                                org.w3c.dom.Element iPConfigurationsElement2 = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(
                                                                iPConfigurationsSequenceElement2,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "IPConfiguration")
                                                        .get(i20));
                                                IPConfiguration iPConfigurationInstance2 = new IPConfiguration();
                                                networkInterfaceInstance2.getIPConfigurations()
                                                        .add(iPConfigurationInstance2);

                                                Element subnetNameElement2 = XmlUtility.getElementByTagNameNS(
                                                        iPConfigurationsElement2,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "SubnetName");
                                                if (subnetNameElement2 != null) {
                                                    String subnetNameInstance2;
                                                    subnetNameInstance2 = subnetNameElement2.getTextContent();
                                                    iPConfigurationInstance2.setSubnetName(subnetNameInstance2);
                                                }

                                                Element staticVirtualNetworkIPAddressElement2 = XmlUtility
                                                        .getElementByTagNameNS(iPConfigurationsElement2,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "StaticVirtualNetworkIPAddress");
                                                if (staticVirtualNetworkIPAddressElement2 != null) {
                                                    String staticVirtualNetworkIPAddressInstance2;
                                                    staticVirtualNetworkIPAddressInstance2 = staticVirtualNetworkIPAddressElement2
                                                            .getTextContent();
                                                    iPConfigurationInstance2.setStaticVirtualNetworkIPAddress(
                                                            staticVirtualNetworkIPAddressInstance2);
                                                }
                                            }
                                        }

                                        Element networkSecurityGroupElement = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "NetworkSecurityGroup");
                                        if (networkSecurityGroupElement != null) {
                                            String networkSecurityGroupInstance;
                                            networkSecurityGroupInstance = networkSecurityGroupElement
                                                    .getTextContent();
                                            networkInterfaceInstance2
                                                    .setNetworkSecurityGroup(networkSecurityGroupInstance);
                                        }

                                        Element iPForwardingElement = XmlUtility.getElementByTagNameNS(
                                                networkInterfacesElement2,
                                                "http://schemas.microsoft.com/windowsazure", "IPForwarding");
                                        if (iPForwardingElement != null) {
                                            String iPForwardingInstance;
                                            iPForwardingInstance = iPForwardingElement.getTextContent();
                                            networkInterfaceInstance2.setIPForwarding(iPForwardingInstance);
                                        }
                                    }
                                }

                                Element networkSecurityGroupElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "NetworkSecurityGroup");
                                if (networkSecurityGroupElement2 != null) {
                                    String networkSecurityGroupInstance2;
                                    networkSecurityGroupInstance2 = networkSecurityGroupElement2
                                            .getTextContent();
                                    configurationSetInstance
                                            .setNetworkSecurityGroup(networkSecurityGroupInstance2);
                                }

                                Element iPForwardingElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "IPForwarding");
                                if (iPForwardingElement2 != null) {
                                    String iPForwardingInstance2;
                                    iPForwardingInstance2 = iPForwardingElement2.getTextContent();
                                    configurationSetInstance.setIPForwarding(iPForwardingInstance2);
                                }

                                Element computerNameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ComputerName");
                                if (computerNameElement != null) {
                                    String computerNameInstance;
                                    computerNameInstance = computerNameElement.getTextContent();
                                    configurationSetInstance.setComputerName(computerNameInstance);
                                }

                                Element adminPasswordElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdminPassword");
                                if (adminPasswordElement != null) {
                                    String adminPasswordInstance;
                                    adminPasswordInstance = adminPasswordElement.getTextContent();
                                    configurationSetInstance.setAdminPassword(adminPasswordInstance);
                                }

                                Element resetPasswordOnFirstLogonElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "ResetPasswordOnFirstLogon");
                                if (resetPasswordOnFirstLogonElement != null
                                        && resetPasswordOnFirstLogonElement.getTextContent() != null
                                        && !resetPasswordOnFirstLogonElement.getTextContent().isEmpty()) {
                                    boolean resetPasswordOnFirstLogonInstance;
                                    resetPasswordOnFirstLogonInstance = DatatypeConverter.parseBoolean(
                                            resetPasswordOnFirstLogonElement.getTextContent().toLowerCase());
                                    configurationSetInstance
                                            .setResetPasswordOnFirstLogon(resetPasswordOnFirstLogonInstance);
                                }

                                Element enableAutomaticUpdatesElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "EnableAutomaticUpdates");
                                if (enableAutomaticUpdatesElement != null
                                        && enableAutomaticUpdatesElement.getTextContent() != null
                                        && !enableAutomaticUpdatesElement.getTextContent().isEmpty()) {
                                    boolean enableAutomaticUpdatesInstance;
                                    enableAutomaticUpdatesInstance = DatatypeConverter.parseBoolean(
                                            enableAutomaticUpdatesElement.getTextContent().toLowerCase());
                                    configurationSetInstance
                                            .setEnableAutomaticUpdates(enableAutomaticUpdatesInstance);
                                }

                                Element timeZoneElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "TimeZone");
                                if (timeZoneElement != null) {
                                    String timeZoneInstance;
                                    timeZoneInstance = timeZoneElement.getTextContent();
                                    configurationSetInstance.setTimeZone(timeZoneInstance);
                                }

                                Element domainJoinElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "DomainJoin");
                                if (domainJoinElement != null) {
                                    DomainJoinSettings domainJoinInstance = new DomainJoinSettings();
                                    configurationSetInstance.setDomainJoin(domainJoinInstance);

                                    Element credentialsElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "Credentials");
                                    if (credentialsElement != null) {
                                        DomainJoinCredentials credentialsInstance = new DomainJoinCredentials();
                                        domainJoinInstance.setCredentials(credentialsInstance);

                                        Element domainElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Domain");
                                        if (domainElement != null) {
                                            String domainInstance;
                                            domainInstance = domainElement.getTextContent();
                                            credentialsInstance.setDomain(domainInstance);
                                        }

                                        Element usernameElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Username");
                                        if (usernameElement != null) {
                                            String usernameInstance;
                                            usernameInstance = usernameElement.getTextContent();
                                            credentialsInstance.setUserName(usernameInstance);
                                        }

                                        Element passwordElement = XmlUtility.getElementByTagNameNS(
                                                credentialsElement, "http://schemas.microsoft.com/windowsazure",
                                                "Password");
                                        if (passwordElement != null) {
                                            String passwordInstance;
                                            passwordInstance = passwordElement.getTextContent();
                                            credentialsInstance.setPassword(passwordInstance);
                                        }
                                    }

                                    Element joinDomainElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "JoinDomain");
                                    if (joinDomainElement != null) {
                                        String joinDomainInstance;
                                        joinDomainInstance = joinDomainElement.getTextContent();
                                        domainJoinInstance.setDomainToJoin(joinDomainInstance);
                                    }

                                    Element machineObjectOUElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "MachineObjectOU");
                                    if (machineObjectOUElement != null) {
                                        String machineObjectOUInstance;
                                        machineObjectOUInstance = machineObjectOUElement.getTextContent();
                                        domainJoinInstance.setLdapMachineObjectOU(machineObjectOUInstance);
                                    }

                                    Element provisioningElement = XmlUtility.getElementByTagNameNS(
                                            domainJoinElement, "http://schemas.microsoft.com/windowsazure",
                                            "Provisioning");
                                    if (provisioningElement != null) {
                                        DomainJoinProvisioning provisioningInstance = new DomainJoinProvisioning();
                                        domainJoinInstance.setProvisioning(provisioningInstance);

                                        Element accountDataElement = XmlUtility.getElementByTagNameNS(
                                                provisioningElement,
                                                "http://schemas.microsoft.com/windowsazure", "AccountData");
                                        if (accountDataElement != null) {
                                            String accountDataInstance;
                                            accountDataInstance = accountDataElement.getTextContent();
                                            provisioningInstance.setAccountData(accountDataInstance);
                                        }
                                    }
                                }

                                Element storedCertificateSettingsSequenceElement = XmlUtility
                                        .getElementByTagNameNS(configurationSetsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "StoredCertificateSettings");
                                if (storedCertificateSettingsSequenceElement != null) {
                                    for (int i21 = 0; i21 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(storedCertificateSettingsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "CertificateSetting")
                                            .size(); i21 = i21 + 1) {
                                        org.w3c.dom.Element storedCertificateSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(
                                                        storedCertificateSettingsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "CertificateSetting")
                                                .get(i21));
                                        StoredCertificateSettings certificateSettingInstance = new StoredCertificateSettings();
                                        configurationSetInstance.getStoredCertificateSettings()
                                                .add(certificateSettingInstance);

                                        Element storeLocationElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "StoreLocation");
                                        if (storeLocationElement != null) {
                                        }

                                        Element storeNameElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "StoreName");
                                        if (storeNameElement != null) {
                                            String storeNameInstance;
                                            storeNameInstance = storeNameElement.getTextContent();
                                            certificateSettingInstance.setStoreName(storeNameInstance);
                                        }

                                        Element thumbprintElement = XmlUtility.getElementByTagNameNS(
                                                storedCertificateSettingsElement,
                                                "http://schemas.microsoft.com/windowsazure", "Thumbprint");
                                        if (thumbprintElement != null) {
                                            String thumbprintInstance;
                                            thumbprintInstance = thumbprintElement.getTextContent();
                                            certificateSettingInstance.setThumbprint(thumbprintInstance);
                                        }
                                    }
                                }

                                Element winRMElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "WinRM");
                                if (winRMElement != null) {
                                    WindowsRemoteManagementSettings winRMInstance = new WindowsRemoteManagementSettings();
                                    configurationSetInstance.setWindowsRemoteManagement(winRMInstance);

                                    Element listenersSequenceElement = XmlUtility.getElementByTagNameNS(
                                            winRMElement, "http://schemas.microsoft.com/windowsazure",
                                            "Listeners");
                                    if (listenersSequenceElement != null) {
                                        for (int i22 = 0; i22 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(listenersSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "Listener")
                                                .size(); i22 = i22 + 1) {
                                            org.w3c.dom.Element listenersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(listenersSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Listener")
                                                    .get(i22));
                                            WindowsRemoteManagementListener listenerInstance = new WindowsRemoteManagementListener();
                                            winRMInstance.getListeners().add(listenerInstance);

                                            Element protocolElement4 = XmlUtility.getElementByTagNameNS(
                                                    listenersElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Protocol");
                                            if (protocolElement4 != null
                                                    && protocolElement4.getTextContent() != null
                                                    && !protocolElement4.getTextContent().isEmpty()) {
                                                VirtualMachineWindowsRemoteManagementListenerType protocolInstance4;
                                                protocolInstance4 = VirtualMachineWindowsRemoteManagementListenerType
                                                        .valueOf(protocolElement4.getTextContent());
                                                listenerInstance.setListenerType(protocolInstance4);
                                            }

                                            Element certificateThumbprintElement = XmlUtility
                                                    .getElementByTagNameNS(listenersElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "CertificateThumbprint");
                                            if (certificateThumbprintElement != null) {
                                                String certificateThumbprintInstance;
                                                certificateThumbprintInstance = certificateThumbprintElement
                                                        .getTextContent();
                                                listenerInstance.setCertificateThumbprint(
                                                        certificateThumbprintInstance);
                                            }
                                        }
                                    }
                                }

                                Element adminUsernameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdminUsername");
                                if (adminUsernameElement != null) {
                                    String adminUsernameInstance;
                                    adminUsernameInstance = adminUsernameElement.getTextContent();
                                    configurationSetInstance.setAdminUserName(adminUsernameInstance);
                                }

                                Element additionalUnattendContentElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "AdditionalUnattendContent");
                                if (additionalUnattendContentElement != null) {
                                    AdditionalUnattendContentSettings additionalUnattendContentInstance = new AdditionalUnattendContentSettings();
                                    configurationSetInstance
                                            .setAdditionalUnattendContent(additionalUnattendContentInstance);

                                    Element passesSequenceElement = XmlUtility.getElementByTagNameNS(
                                            additionalUnattendContentElement,
                                            "http://schemas.microsoft.com/windowsazure", "Passes");
                                    if (passesSequenceElement != null) {
                                        for (int i23 = 0; i23 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(passesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "UnattendPass")
                                                .size(); i23 = i23 + 1) {
                                            org.w3c.dom.Element passesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(passesSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "UnattendPass")
                                                    .get(i23));
                                            UnattendPassSettings unattendPassInstance = new UnattendPassSettings();
                                            additionalUnattendContentInstance.getUnattendPasses()
                                                    .add(unattendPassInstance);

                                            Element passNameElement = XmlUtility.getElementByTagNameNS(
                                                    passesElement, "http://schemas.microsoft.com/windowsazure",
                                                    "PassName");
                                            if (passNameElement != null) {
                                                String passNameInstance;
                                                passNameInstance = passNameElement.getTextContent();
                                                unattendPassInstance.setPassName(passNameInstance);
                                            }

                                            Element componentsSequenceElement = XmlUtility
                                                    .getElementByTagNameNS(passesElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "Components");
                                            if (componentsSequenceElement != null) {
                                                for (int i24 = 0; i24 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                        .getElementsByTagNameNS(componentsSequenceElement,
                                                                "http://schemas.microsoft.com/windowsazure",
                                                                "UnattendComponent")
                                                        .size(); i24 = i24 + 1) {
                                                    org.w3c.dom.Element componentsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                            .getElementsByTagNameNS(componentsSequenceElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "UnattendComponent")
                                                            .get(i24));
                                                    UnattendComponent unattendComponentInstance = new UnattendComponent();
                                                    unattendPassInstance.getUnattendComponents()
                                                            .add(unattendComponentInstance);

                                                    Element componentNameElement = XmlUtility
                                                            .getElementByTagNameNS(componentsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentName");
                                                    if (componentNameElement != null) {
                                                        String componentNameInstance;
                                                        componentNameInstance = componentNameElement
                                                                .getTextContent();
                                                        unattendComponentInstance
                                                                .setComponentName(componentNameInstance);
                                                    }

                                                    Element componentSettingsSequenceElement = XmlUtility
                                                            .getElementByTagNameNS(componentsElement,
                                                                    "http://schemas.microsoft.com/windowsazure",
                                                                    "ComponentSettings");
                                                    if (componentSettingsSequenceElement != null) {
                                                        for (int i25 = 0; i25 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                                .getElementsByTagNameNS(
                                                                        componentSettingsSequenceElement,
                                                                        "http://schemas.microsoft.com/windowsazure",
                                                                        "ComponentSetting")
                                                                .size(); i25 = i25 + 1) {
                                                            org.w3c.dom.Element componentSettingsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                                    .getElementsByTagNameNS(
                                                                            componentSettingsSequenceElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "ComponentSetting")
                                                                    .get(i25));
                                                            ComponentSetting componentSettingInstance = new ComponentSetting();
                                                            unattendComponentInstance
                                                                    .getUnattendComponentSettings()
                                                                    .add(componentSettingInstance);

                                                            Element settingNameElement = XmlUtility
                                                                    .getElementByTagNameNS(
                                                                            componentSettingsElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "SettingName");
                                                            if (settingNameElement != null) {
                                                                String settingNameInstance;
                                                                settingNameInstance = settingNameElement
                                                                        .getTextContent();
                                                                componentSettingInstance
                                                                        .setSettingName(settingNameInstance);
                                                            }

                                                            Element contentElement = XmlUtility
                                                                    .getElementByTagNameNS(
                                                                            componentSettingsElement,
                                                                            "http://schemas.microsoft.com/windowsazure",
                                                                            "Content");
                                                            if (contentElement != null) {
                                                                String contentInstance;
                                                                contentInstance = contentElement
                                                                        .getTextContent() != null ? new String(
                                                                                Base64.decode(contentElement
                                                                                        .getTextContent()))
                                                                                : null;
                                                                componentSettingInstance
                                                                        .setContent(contentInstance);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }

                                Element hostNameElement2 = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "HostName");
                                if (hostNameElement2 != null) {
                                    String hostNameInstance2;
                                    hostNameInstance2 = hostNameElement2.getTextContent();
                                    configurationSetInstance.setHostName(hostNameInstance2);
                                }

                                Element userNameElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "UserName");
                                if (userNameElement != null) {
                                    String userNameInstance;
                                    userNameInstance = userNameElement.getTextContent();
                                    configurationSetInstance.setUserName(userNameInstance);
                                }

                                Element userPasswordElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "UserPassword");
                                if (userPasswordElement != null) {
                                    String userPasswordInstance;
                                    userPasswordInstance = userPasswordElement.getTextContent();
                                    configurationSetInstance.setUserPassword(userPasswordInstance);
                                }

                                Element disableSshPasswordAuthenticationElement = XmlUtility
                                        .getElementByTagNameNS(configurationSetsElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DisableSshPasswordAuthentication");
                                if (disableSshPasswordAuthenticationElement != null
                                        && disableSshPasswordAuthenticationElement.getTextContent() != null
                                        && !disableSshPasswordAuthenticationElement.getTextContent()
                                                .isEmpty()) {
                                    boolean disableSshPasswordAuthenticationInstance;
                                    disableSshPasswordAuthenticationInstance = DatatypeConverter
                                            .parseBoolean(disableSshPasswordAuthenticationElement
                                                    .getTextContent().toLowerCase());
                                    configurationSetInstance.setDisableSshPasswordAuthentication(
                                            disableSshPasswordAuthenticationInstance);
                                }

                                Element sSHElement = XmlUtility.getElementByTagNameNS(configurationSetsElement,
                                        "http://schemas.microsoft.com/windowsazure", "SSH");
                                if (sSHElement != null) {
                                    SshSettings sSHInstance = new SshSettings();
                                    configurationSetInstance.setSshSettings(sSHInstance);

                                    Element publicKeysSequenceElement = XmlUtility.getElementByTagNameNS(
                                            sSHElement, "http://schemas.microsoft.com/windowsazure",
                                            "PublicKeys");
                                    if (publicKeysSequenceElement != null) {
                                        for (int i26 = 0; i26 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(publicKeysSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "PublicKey")
                                                .size(); i26 = i26 + 1) {
                                            org.w3c.dom.Element publicKeysElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(publicKeysSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "PublicKey")
                                                    .get(i26));
                                            SshSettingPublicKey publicKeyInstance = new SshSettingPublicKey();
                                            sSHInstance.getPublicKeys().add(publicKeyInstance);

                                            Element fingerprintElement = XmlUtility.getElementByTagNameNS(
                                                    publicKeysElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fingerprint");
                                            if (fingerprintElement != null) {
                                                String fingerprintInstance;
                                                fingerprintInstance = fingerprintElement.getTextContent();
                                                publicKeyInstance.setFingerprint(fingerprintInstance);
                                            }

                                            Element pathElement2 = XmlUtility.getElementByTagNameNS(
                                                    publicKeysElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement2 != null) {
                                                String pathInstance2;
                                                pathInstance2 = pathElement2.getTextContent();
                                                publicKeyInstance.setPath(pathInstance2);
                                            }
                                        }
                                    }

                                    Element keyPairsSequenceElement = XmlUtility.getElementByTagNameNS(
                                            sSHElement, "http://schemas.microsoft.com/windowsazure",
                                            "KeyPairs");
                                    if (keyPairsSequenceElement != null) {
                                        for (int i27 = 0; i27 < com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(keyPairsSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure", "KeyPair")
                                                .size(); i27 = i27 + 1) {
                                            org.w3c.dom.Element keyPairsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                    .getElementsByTagNameNS(keyPairsSequenceElement,
                                                            "http://schemas.microsoft.com/windowsazure",
                                                            "KeyPair")
                                                    .get(i27));
                                            SshSettingKeyPair keyPairInstance = new SshSettingKeyPair();
                                            sSHInstance.getKeyPairs().add(keyPairInstance);

                                            Element fingerprintElement2 = XmlUtility.getElementByTagNameNS(
                                                    keyPairsElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Fingerprint");
                                            if (fingerprintElement2 != null) {
                                                String fingerprintInstance2;
                                                fingerprintInstance2 = fingerprintElement2.getTextContent();
                                                keyPairInstance.setFingerprint(fingerprintInstance2);
                                            }

                                            Element pathElement3 = XmlUtility.getElementByTagNameNS(
                                                    keyPairsElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Path");
                                            if (pathElement3 != null) {
                                                String pathInstance3;
                                                pathInstance3 = pathElement3.getTextContent();
                                                keyPairInstance.setPath(pathInstance3);
                                            }
                                        }
                                    }
                                }

                                Element customDataElement = XmlUtility.getElementByTagNameNS(
                                        configurationSetsElement, "http://schemas.microsoft.com/windowsazure",
                                        "CustomData");
                                if (customDataElement != null) {
                                    String customDataInstance;
                                    customDataInstance = customDataElement.getTextContent();
                                    configurationSetInstance.setCustomData(customDataInstance);
                                }
                            }
                        }

                        Element resourceExtensionReferencesSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "ResourceExtensionReferences");
                        if (resourceExtensionReferencesSequenceElement != null) {
                            for (int i28 = 0; i28 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(resourceExtensionReferencesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure",
                                            "ResourceExtensionReference")
                                    .size(); i28 = i28 + 1) {
                                org.w3c.dom.Element resourceExtensionReferencesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(resourceExtensionReferencesSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionReference")
                                        .get(i28));
                                ResourceExtensionReference resourceExtensionReferenceInstance = new ResourceExtensionReference();
                                roleInstance.getResourceExtensionReferences()
                                        .add(resourceExtensionReferenceInstance);

                                Element referenceNameElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "ReferenceName");
                                if (referenceNameElement != null) {
                                    String referenceNameInstance;
                                    referenceNameInstance = referenceNameElement.getTextContent();
                                    resourceExtensionReferenceInstance.setReferenceName(referenceNameInstance);
                                }

                                Element publisherElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Publisher");
                                if (publisherElement != null) {
                                    String publisherInstance;
                                    publisherInstance = publisherElement.getTextContent();
                                    resourceExtensionReferenceInstance.setPublisher(publisherInstance);
                                }

                                Element nameElement10 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name");
                                if (nameElement10 != null) {
                                    String nameInstance10;
                                    nameInstance10 = nameElement10.getTextContent();
                                    resourceExtensionReferenceInstance.setName(nameInstance10);
                                }

                                Element versionElement2 = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Version");
                                if (versionElement2 != null) {
                                    String versionInstance2;
                                    versionInstance2 = versionElement2.getTextContent();
                                    resourceExtensionReferenceInstance.setVersion(versionInstance2);
                                }

                                Element resourceExtensionParameterValuesSequenceElement = XmlUtility
                                        .getElementByTagNameNS(resourceExtensionReferencesElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "ResourceExtensionParameterValues");
                                if (resourceExtensionParameterValuesSequenceElement != null) {
                                    for (int i29 = 0; i29 < com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(
                                                    resourceExtensionParameterValuesSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "ResourceExtensionParameterValue")
                                            .size(); i29 = i29 + 1) {
                                        org.w3c.dom.Element resourceExtensionParameterValuesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                                .getElementsByTagNameNS(
                                                        resourceExtensionParameterValuesSequenceElement,
                                                        "http://schemas.microsoft.com/windowsazure",
                                                        "ResourceExtensionParameterValue")
                                                .get(i29));
                                        ResourceExtensionParameterValue resourceExtensionParameterValueInstance = new ResourceExtensionParameterValue();
                                        resourceExtensionReferenceInstance.getResourceExtensionParameterValues()
                                                .add(resourceExtensionParameterValueInstance);

                                        Element keyElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Key");
                                        if (keyElement != null) {
                                            String keyInstance;
                                            keyInstance = keyElement.getTextContent();
                                            resourceExtensionParameterValueInstance.setKey(keyInstance);
                                        }

                                        Element valueElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Value");
                                        if (valueElement != null) {
                                            String valueInstance;
                                            valueInstance = valueElement.getTextContent() != null
                                                    ? new String(Base64.decode(valueElement.getTextContent()))
                                                    : null;
                                            resourceExtensionParameterValueInstance.setValue(valueInstance);
                                        }

                                        Element typeElement = XmlUtility.getElementByTagNameNS(
                                                resourceExtensionParameterValuesElement,
                                                "http://schemas.microsoft.com/windowsazure", "Type");
                                        if (typeElement != null) {
                                            String typeInstance;
                                            typeInstance = typeElement.getTextContent();
                                            resourceExtensionParameterValueInstance.setType(typeInstance);
                                        }
                                    }
                                }

                                Element stateElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "State");
                                if (stateElement != null) {
                                    String stateInstance;
                                    stateInstance = stateElement.getTextContent();
                                    resourceExtensionReferenceInstance.setState(stateInstance);
                                }

                                Element forceUpdateElement = XmlUtility.getElementByTagNameNS(
                                        resourceExtensionReferencesElement,
                                        "http://schemas.microsoft.com/windowsazure", "ForceUpdate");
                                if (forceUpdateElement != null && forceUpdateElement.getTextContent() != null
                                        && !forceUpdateElement.getTextContent().isEmpty()) {
                                    boolean forceUpdateInstance;
                                    forceUpdateInstance = DatatypeConverter
                                            .parseBoolean(forceUpdateElement.getTextContent().toLowerCase());
                                    resourceExtensionReferenceInstance.setForceUpdate(forceUpdateInstance);
                                }
                            }
                        }

                        Element vMImageNameElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "VMImageName");
                        if (vMImageNameElement != null) {
                            String vMImageNameInstance;
                            vMImageNameInstance = vMImageNameElement.getTextContent();
                            roleInstance.setVMImageName(vMImageNameInstance);
                        }

                        Element mediaLocationElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "MediaLocation");
                        if (mediaLocationElement != null) {
                            URI mediaLocationInstance;
                            mediaLocationInstance = new URI(mediaLocationElement.getTextContent());
                            roleInstance.setMediaLocation(mediaLocationInstance);
                        }

                        Element availabilitySetNameElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "AvailabilitySetName");
                        if (availabilitySetNameElement != null) {
                            String availabilitySetNameInstance;
                            availabilitySetNameInstance = availabilitySetNameElement.getTextContent();
                            roleInstance.setAvailabilitySetName(availabilitySetNameInstance);
                        }

                        Element dataVirtualHardDisksSequenceElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "DataVirtualHardDisks");
                        if (dataVirtualHardDisksSequenceElement != null) {
                            for (int i30 = 0; i30 < com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "DataVirtualHardDisk")
                                    .size(); i30 = i30 + 1) {
                                org.w3c.dom.Element dataVirtualHardDisksElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(dataVirtualHardDisksSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DataVirtualHardDisk")
                                        .get(i30));
                                DataVirtualHardDisk dataVirtualHardDiskInstance = new DataVirtualHardDisk();
                                roleInstance.getDataVirtualHardDisks().add(dataVirtualHardDiskInstance);

                                Element hostCachingElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "HostCaching");
                                if (hostCachingElement != null) {
                                    String hostCachingInstance;
                                    hostCachingInstance = hostCachingElement.getTextContent();
                                    dataVirtualHardDiskInstance.setHostCaching(hostCachingInstance);
                                }

                                Element diskLabelElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "DiskLabel");
                                if (diskLabelElement != null) {
                                    String diskLabelInstance;
                                    diskLabelInstance = diskLabelElement.getTextContent();
                                    dataVirtualHardDiskInstance.setLabel(diskLabelInstance);
                                }

                                Element diskNameElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "DiskName");
                                if (diskNameElement != null) {
                                    String diskNameInstance;
                                    diskNameInstance = diskNameElement.getTextContent();
                                    dataVirtualHardDiskInstance.setName(diskNameInstance);
                                }

                                Element lunElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "Lun");
                                if (lunElement != null && lunElement.getTextContent() != null
                                        && !lunElement.getTextContent().isEmpty()) {
                                    int lunInstance;
                                    lunInstance = DatatypeConverter.parseInt(lunElement.getTextContent());
                                    dataVirtualHardDiskInstance.setLogicalUnitNumber(lunInstance);
                                }

                                Element logicalDiskSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "LogicalDiskSizeInGB");
                                if (logicalDiskSizeInGBElement != null
                                        && logicalDiskSizeInGBElement.getTextContent() != null
                                        && !logicalDiskSizeInGBElement.getTextContent().isEmpty()) {
                                    int logicalDiskSizeInGBInstance;
                                    logicalDiskSizeInGBInstance = DatatypeConverter
                                            .parseInt(logicalDiskSizeInGBElement.getTextContent());
                                    dataVirtualHardDiskInstance
                                            .setLogicalDiskSizeInGB(logicalDiskSizeInGBInstance);
                                }

                                Element mediaLinkElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "MediaLink");
                                if (mediaLinkElement != null) {
                                    URI mediaLinkInstance;
                                    mediaLinkInstance = new URI(mediaLinkElement.getTextContent());
                                    dataVirtualHardDiskInstance.setMediaLink(mediaLinkInstance);
                                }

                                Element sourceMediaLinkElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "SourceMediaLink");
                                if (sourceMediaLinkElement != null) {
                                    URI sourceMediaLinkInstance;
                                    sourceMediaLinkInstance = new URI(sourceMediaLinkElement.getTextContent());
                                    dataVirtualHardDiskInstance.setSourceMediaLink(sourceMediaLinkInstance);
                                }

                                Element iOTypeElement = XmlUtility.getElementByTagNameNS(
                                        dataVirtualHardDisksElement,
                                        "http://schemas.microsoft.com/windowsazure", "IOType");
                                if (iOTypeElement != null) {
                                    String iOTypeInstance;
                                    iOTypeInstance = iOTypeElement.getTextContent();
                                    dataVirtualHardDiskInstance.setIOType(iOTypeInstance);
                                }
                            }
                        }

                        Element labelElement2 = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "Label");
                        if (labelElement2 != null) {
                            String labelInstance2;
                            labelInstance2 = labelElement2.getTextContent();
                            roleInstance.setLabel(labelInstance2);
                        }

                        Element oSVirtualHardDiskElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "OSVirtualHardDisk");
                        if (oSVirtualHardDiskElement != null) {
                            OSVirtualHardDisk oSVirtualHardDiskInstance = new OSVirtualHardDisk();
                            roleInstance.setOSVirtualHardDisk(oSVirtualHardDiskInstance);

                            Element hostCachingElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "HostCaching");
                            if (hostCachingElement2 != null) {
                                String hostCachingInstance2;
                                hostCachingInstance2 = hostCachingElement2.getTextContent();
                                oSVirtualHardDiskInstance.setHostCaching(hostCachingInstance2);
                            }

                            Element diskLabelElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "DiskLabel");
                            if (diskLabelElement2 != null) {
                                String diskLabelInstance2;
                                diskLabelInstance2 = diskLabelElement2.getTextContent();
                                oSVirtualHardDiskInstance.setLabel(diskLabelInstance2);
                            }

                            Element diskNameElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "DiskName");
                            if (diskNameElement2 != null) {
                                String diskNameInstance2;
                                diskNameInstance2 = diskNameElement2.getTextContent();
                                oSVirtualHardDiskInstance.setName(diskNameInstance2);
                            }

                            Element mediaLinkElement2 = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "MediaLink");
                            if (mediaLinkElement2 != null) {
                                URI mediaLinkInstance2;
                                mediaLinkInstance2 = new URI(mediaLinkElement2.getTextContent());
                                oSVirtualHardDiskInstance.setMediaLink(mediaLinkInstance2);
                            }

                            Element sourceImageNameElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "SourceImageName");
                            if (sourceImageNameElement != null) {
                                String sourceImageNameInstance;
                                sourceImageNameInstance = sourceImageNameElement.getTextContent();
                                oSVirtualHardDiskInstance.setSourceImageName(sourceImageNameInstance);
                            }

                            Element osElement = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                                    "http://schemas.microsoft.com/windowsazure", "OS");
                            if (osElement != null) {
                                String osInstance;
                                osInstance = osElement.getTextContent();
                                oSVirtualHardDiskInstance.setOperatingSystem(osInstance);
                            }

                            Element remoteSourceImageLinkElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "RemoteSourceImageLink");
                            if (remoteSourceImageLinkElement != null) {
                                URI remoteSourceImageLinkInstance;
                                remoteSourceImageLinkInstance = new URI(
                                        remoteSourceImageLinkElement.getTextContent());
                                oSVirtualHardDiskInstance
                                        .setRemoteSourceImageLink(remoteSourceImageLinkInstance);
                            }

                            Element iOTypeElement2 = XmlUtility.getElementByTagNameNS(oSVirtualHardDiskElement,
                                    "http://schemas.microsoft.com/windowsazure", "IOType");
                            if (iOTypeElement2 != null) {
                                String iOTypeInstance2;
                                iOTypeInstance2 = iOTypeElement2.getTextContent();
                                oSVirtualHardDiskInstance.setIOType(iOTypeInstance2);
                            }

                            Element resizedSizeInGBElement = XmlUtility.getElementByTagNameNS(
                                    oSVirtualHardDiskElement, "http://schemas.microsoft.com/windowsazure",
                                    "ResizedSizeInGB");
                            if (resizedSizeInGBElement != null
                                    && resizedSizeInGBElement.getTextContent() != null
                                    && !resizedSizeInGBElement.getTextContent().isEmpty()) {
                                int resizedSizeInGBInstance;
                                resizedSizeInGBInstance = DatatypeConverter
                                        .parseInt(resizedSizeInGBElement.getTextContent());
                                oSVirtualHardDiskInstance.setResizedSizeInGB(resizedSizeInGBInstance);
                            }
                        }

                        Element roleSizeElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "RoleSize");
                        if (roleSizeElement != null) {
                            String roleSizeInstance;
                            roleSizeInstance = roleSizeElement.getTextContent();
                            roleInstance.setRoleSize(roleSizeInstance);
                        }

                        Element defaultWinRmCertificateThumbprintElement = XmlUtility.getElementByTagNameNS(
                                roleListElement, "http://schemas.microsoft.com/windowsazure",
                                "DefaultWinRmCertificateThumbprint");
                        if (defaultWinRmCertificateThumbprintElement != null) {
                            String defaultWinRmCertificateThumbprintInstance;
                            defaultWinRmCertificateThumbprintInstance = defaultWinRmCertificateThumbprintElement
                                    .getTextContent();
                            roleInstance.setDefaultWinRmCertificateThumbprint(
                                    defaultWinRmCertificateThumbprintInstance);
                        }

                        Element provisionGuestAgentElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "ProvisionGuestAgent");
                        if (provisionGuestAgentElement != null
                                && provisionGuestAgentElement.getTextContent() != null
                                && !provisionGuestAgentElement.getTextContent().isEmpty()) {
                            boolean provisionGuestAgentInstance;
                            provisionGuestAgentInstance = DatatypeConverter
                                    .parseBoolean(provisionGuestAgentElement.getTextContent().toLowerCase());
                            roleInstance.setProvisionGuestAgent(provisionGuestAgentInstance);
                        }

                        Element vMImageInputElement = XmlUtility.getElementByTagNameNS(roleListElement,
                                "http://schemas.microsoft.com/windowsazure", "VMImageInput");
                        if (vMImageInputElement != null) {
                            VMImageInput vMImageInputInstance = new VMImageInput();
                            roleInstance.setVMImageInput(vMImageInputInstance);

                            Element oSDiskConfigurationElement = XmlUtility.getElementByTagNameNS(
                                    vMImageInputElement, "http://schemas.microsoft.com/windowsazure",
                                    "OSDiskConfiguration");
                            if (oSDiskConfigurationElement != null) {
                                OSDiskConfiguration oSDiskConfigurationInstance = new OSDiskConfiguration();
                                vMImageInputInstance.setOSDiskConfiguration(oSDiskConfigurationInstance);

                                Element resizedSizeInGBElement2 = XmlUtility.getElementByTagNameNS(
                                        oSDiskConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                        "ResizedSizeInGB");
                                if (resizedSizeInGBElement2 != null
                                        && resizedSizeInGBElement2.getTextContent() != null
                                        && !resizedSizeInGBElement2.getTextContent().isEmpty()) {
                                    int resizedSizeInGBInstance2;
                                    resizedSizeInGBInstance2 = DatatypeConverter
                                            .parseInt(resizedSizeInGBElement2.getTextContent());
                                    oSDiskConfigurationInstance.setResizedSizeInGB(resizedSizeInGBInstance2);
                                }
                            }

                            Element dataDiskConfigurationsSequenceElement = XmlUtility.getElementByTagNameNS(
                                    vMImageInputElement, "http://schemas.microsoft.com/windowsazure",
                                    "DataDiskConfigurations");
                            if (dataDiskConfigurationsSequenceElement != null) {
                                for (int i31 = 0; i31 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(dataDiskConfigurationsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure",
                                                "DataDiskConfiguration")
                                        .size(); i31 = i31 + 1) {
                                    org.w3c.dom.Element dataDiskConfigurationsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(dataDiskConfigurationsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure",
                                                    "DataDiskConfiguration")
                                            .get(i31));
                                    DataDiskConfiguration dataDiskConfigurationInstance = new DataDiskConfiguration();
                                    vMImageInputInstance.getDataDiskConfigurations()
                                            .add(dataDiskConfigurationInstance);

                                    Element nameElement11 = XmlUtility.getElementByTagNameNS(
                                            dataDiskConfigurationsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement11 != null) {
                                        String nameInstance11;
                                        nameInstance11 = nameElement11.getTextContent();
                                        dataDiskConfigurationInstance.setDiskName(nameInstance11);
                                    }

                                    Element resizedSizeInGBElement3 = XmlUtility.getElementByTagNameNS(
                                            dataDiskConfigurationsElement,
                                            "http://schemas.microsoft.com/windowsazure", "ResizedSizeInGB");
                                    if (resizedSizeInGBElement3 != null
                                            && resizedSizeInGBElement3.getTextContent() != null
                                            && !resizedSizeInGBElement3.getTextContent().isEmpty()) {
                                        int resizedSizeInGBInstance3;
                                        resizedSizeInGBInstance3 = DatatypeConverter
                                                .parseInt(resizedSizeInGBElement3.getTextContent());
                                        dataDiskConfigurationInstance
                                                .setResizedSizeInGB(resizedSizeInGBInstance3);
                                    }
                                }
                            }
                        }
                    }
                }

                Element sdkVersionElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "SdkVersion");
                if (sdkVersionElement != null) {
                    String sdkVersionInstance;
                    sdkVersionInstance = sdkVersionElement.getTextContent();
                    result.setSdkVersion(sdkVersionInstance);
                }

                Element lockedElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Locked");
                if (lockedElement != null && lockedElement.getTextContent() != null
                        && !lockedElement.getTextContent().isEmpty()) {
                    boolean lockedInstance;
                    lockedInstance = DatatypeConverter
                            .parseBoolean(lockedElement.getTextContent().toLowerCase());
                    result.setLocked(lockedInstance);
                }

                Element rollbackAllowedElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "RollbackAllowed");
                if (rollbackAllowedElement != null && rollbackAllowedElement.getTextContent() != null
                        && !rollbackAllowedElement.getTextContent().isEmpty()) {
                    boolean rollbackAllowedInstance;
                    rollbackAllowedInstance = DatatypeConverter
                            .parseBoolean(rollbackAllowedElement.getTextContent().toLowerCase());
                    result.setRollbackAllowed(rollbackAllowedInstance);
                }

                Element virtualNetworkNameElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "VirtualNetworkName");
                if (virtualNetworkNameElement != null) {
                    String virtualNetworkNameInstance;
                    virtualNetworkNameInstance = virtualNetworkNameElement.getTextContent();
                    result.setVirtualNetworkName(virtualNetworkNameInstance);
                }

                Element createdTimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "CreatedTime");
                if (createdTimeElement != null) {
                    Calendar createdTimeInstance;
                    createdTimeInstance = DatatypeConverter.parseDateTime(createdTimeElement.getTextContent());
                    result.setCreatedTime(createdTimeInstance);
                }

                Element lastModifiedTimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "LastModifiedTime");
                if (lastModifiedTimeElement != null) {
                    Calendar lastModifiedTimeInstance;
                    lastModifiedTimeInstance = DatatypeConverter
                            .parseDateTime(lastModifiedTimeElement.getTextContent());
                    result.setLastModifiedTime(lastModifiedTimeInstance);
                }

                Element extendedPropertiesSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ExtendedProperties");
                if (extendedPropertiesSequenceElement != null) {
                    for (int i32 = 0; i32 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(extendedPropertiesSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "ExtendedProperty")
                            .size(); i32 = i32 + 1) {
                        org.w3c.dom.Element extendedPropertiesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(extendedPropertiesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "ExtendedProperty")
                                .get(i32));
                        String extendedPropertiesKey = XmlUtility
                                .getElementByTagNameNS(extendedPropertiesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Name")
                                .getTextContent();
                        String extendedPropertiesValue = XmlUtility
                                .getElementByTagNameNS(extendedPropertiesElement,
                                        "http://schemas.microsoft.com/windowsazure", "Value")
                                .getTextContent();
                        result.getExtendedProperties().put(extendedPropertiesKey, extendedPropertiesValue);
                    }
                }

                Element dnsElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "Dns");
                if (dnsElement != null) {
                    DnsSettings dnsInstance = new DnsSettings();
                    result.setDnsSettings(dnsInstance);

                    Element dnsServersSequenceElement = XmlUtility.getElementByTagNameNS(dnsElement,
                            "http://schemas.microsoft.com/windowsazure", "DnsServers");
                    if (dnsServersSequenceElement != null) {
                        for (int i33 = 0; i33 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(dnsServersSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "DnsServer")
                                .size(); i33 = i33 + 1) {
                            org.w3c.dom.Element dnsServersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(dnsServersSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "DnsServer")
                                    .get(i33));
                            DnsServer dnsServerInstance = new DnsServer();
                            dnsInstance.getDnsServers().add(dnsServerInstance);

                            Element nameElement12 = XmlUtility.getElementByTagNameNS(dnsServersElement,
                                    "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement12 != null) {
                                String nameInstance12;
                                nameInstance12 = nameElement12.getTextContent();
                                dnsServerInstance.setName(nameInstance12);
                            }

                            Element addressElement3 = XmlUtility.getElementByTagNameNS(dnsServersElement,
                                    "http://schemas.microsoft.com/windowsazure", "Address");
                            if (addressElement3 != null) {
                                InetAddress addressInstance3;
                                addressInstance3 = InetAddress.getByName(addressElement3.getTextContent());
                                dnsServerInstance.setAddress(addressInstance3);
                            }
                        }
                    }
                }

                Element persistentVMDowntimeElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "PersistentVMDowntime");
                if (persistentVMDowntimeElement != null) {
                    PersistentVMDowntime persistentVMDowntimeInstance = new PersistentVMDowntime();
                    result.setPersistentVMDowntime(persistentVMDowntimeInstance);

                    Element startTimeElement = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "StartTime");
                    if (startTimeElement != null) {
                        Calendar startTimeInstance;
                        startTimeInstance = DatatypeConverter.parseDateTime(startTimeElement.getTextContent());
                        persistentVMDowntimeInstance.setStartTime(startTimeInstance);
                    }

                    Element endTimeElement = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "EndTime");
                    if (endTimeElement != null) {
                        Calendar endTimeInstance;
                        endTimeInstance = DatatypeConverter.parseDateTime(endTimeElement.getTextContent());
                        persistentVMDowntimeInstance.setEndTime(endTimeInstance);
                    }

                    Element statusElement6 = XmlUtility.getElementByTagNameNS(persistentVMDowntimeElement,
                            "http://schemas.microsoft.com/windowsazure", "Status");
                    if (statusElement6 != null) {
                        String statusInstance6;
                        statusInstance6 = statusElement6.getTextContent();
                        persistentVMDowntimeInstance.setStatus(statusInstance6);
                    }
                }

                Element virtualIPsSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "VirtualIPs");
                if (virtualIPsSequenceElement != null) {
                    for (int i34 = 0; i34 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(virtualIPsSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "VirtualIP")
                            .size(); i34 = i34 + 1) {
                        org.w3c.dom.Element virtualIPsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(virtualIPsSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "VirtualIP")
                                .get(i34));
                        VirtualIPAddress virtualIPInstance = new VirtualIPAddress();
                        result.getVirtualIPAddresses().add(virtualIPInstance);

                        Element addressElement4 = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "Address");
                        if (addressElement4 != null) {
                            InetAddress addressInstance4;
                            addressInstance4 = InetAddress.getByName(addressElement4.getTextContent());
                            virtualIPInstance.setAddress(addressInstance4);
                        }

                        Element isDnsProgrammedElement = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "IsDnsProgrammed");
                        if (isDnsProgrammedElement != null && isDnsProgrammedElement.getTextContent() != null
                                && !isDnsProgrammedElement.getTextContent().isEmpty()) {
                            boolean isDnsProgrammedInstance;
                            isDnsProgrammedInstance = DatatypeConverter
                                    .parseBoolean(isDnsProgrammedElement.getTextContent().toLowerCase());
                            virtualIPInstance.setIsDnsProgrammed(isDnsProgrammedInstance);
                        }

                        Element nameElement13 = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement13 != null) {
                            String nameInstance13;
                            nameInstance13 = nameElement13.getTextContent();
                            virtualIPInstance.setName(nameInstance13);
                        }

                        Element reservedIPNameElement = XmlUtility.getElementByTagNameNS(virtualIPsElement,
                                "http://schemas.microsoft.com/windowsazure", "ReservedIPName");
                        if (reservedIPNameElement != null) {
                            String reservedIPNameInstance;
                            reservedIPNameInstance = reservedIPNameElement.getTextContent();
                            virtualIPInstance.setReservedIPName(reservedIPNameInstance);
                        }
                    }
                }

                Element extensionConfigurationElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ExtensionConfiguration");
                if (extensionConfigurationElement != null) {
                    ExtensionConfiguration extensionConfigurationInstance = new ExtensionConfiguration();
                    result.setExtensionConfiguration(extensionConfigurationInstance);

                    Element allRolesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                            "AllRoles");
                    if (allRolesSequenceElement != null) {
                        for (int i35 = 0; i35 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(allRolesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Extension")
                                .size(); i35 = i35 + 1) {
                            org.w3c.dom.Element allRolesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(allRolesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "Extension")
                                    .get(i35));
                            ExtensionConfiguration.Extension extensionInstance = new ExtensionConfiguration.Extension();
                            extensionConfigurationInstance.getAllRoles().add(extensionInstance);

                            Element idElement = XmlUtility.getElementByTagNameNS(allRolesElement,
                                    "http://schemas.microsoft.com/windowsazure", "Id");
                            if (idElement != null) {
                                String idInstance;
                                idInstance = idElement.getTextContent();
                                extensionInstance.setId(idInstance);
                            }
                        }
                    }

                    Element namedRolesSequenceElement = XmlUtility.getElementByTagNameNS(
                            extensionConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                            "NamedRoles");
                    if (namedRolesSequenceElement != null) {
                        for (int i36 = 0; i36 < com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(namedRolesSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "Role")
                                .size(); i36 = i36 + 1) {
                            org.w3c.dom.Element namedRolesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                    .getElementsByTagNameNS(namedRolesSequenceElement,
                                            "http://schemas.microsoft.com/windowsazure", "Role")
                                    .get(i36));
                            ExtensionConfiguration.NamedRole roleInstance2 = new ExtensionConfiguration.NamedRole();
                            extensionConfigurationInstance.getNamedRoles().add(roleInstance2);

                            Element roleNameElement3 = XmlUtility.getElementByTagNameNS(namedRolesElement,
                                    "http://schemas.microsoft.com/windowsazure", "RoleName");
                            if (roleNameElement3 != null) {
                                String roleNameInstance3;
                                roleNameInstance3 = roleNameElement3.getTextContent();
                                roleInstance2.setRoleName(roleNameInstance3);
                            }

                            Element extensionsSequenceElement = XmlUtility.getElementByTagNameNS(
                                    namedRolesElement, "http://schemas.microsoft.com/windowsazure",
                                    "Extensions");
                            if (extensionsSequenceElement != null) {
                                for (int i37 = 0; i37 < com.microsoft.windowsazure.core.utils.XmlUtility
                                        .getElementsByTagNameNS(extensionsSequenceElement,
                                                "http://schemas.microsoft.com/windowsazure", "Extension")
                                        .size(); i37 = i37 + 1) {
                                    org.w3c.dom.Element extensionsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                            .getElementsByTagNameNS(extensionsSequenceElement,
                                                    "http://schemas.microsoft.com/windowsazure", "Extension")
                                            .get(i37));
                                    ExtensionConfiguration.Extension extensionInstance2 = new ExtensionConfiguration.Extension();
                                    roleInstance2.getExtensions().add(extensionInstance2);

                                    Element idElement2 = XmlUtility.getElementByTagNameNS(extensionsElement,
                                            "http://schemas.microsoft.com/windowsazure", "Id");
                                    if (idElement2 != null) {
                                        String idInstance2;
                                        idInstance2 = idElement2.getTextContent();
                                        extensionInstance2.setId(idInstance2);
                                    }
                                }
                            }
                        }
                    }
                }

                Element reservedIPNameElement2 = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "ReservedIPName");
                if (reservedIPNameElement2 != null) {
                    String reservedIPNameInstance2;
                    reservedIPNameInstance2 = reservedIPNameElement2.getTextContent();
                    result.setReservedIPName(reservedIPNameInstance2);
                }

                Element loadBalancersSequenceElement = XmlUtility.getElementByTagNameNS(deploymentElement,
                        "http://schemas.microsoft.com/windowsazure", "LoadBalancers");
                if (loadBalancersSequenceElement != null) {
                    for (int i38 = 0; i38 < com.microsoft.windowsazure.core.utils.XmlUtility
                            .getElementsByTagNameNS(loadBalancersSequenceElement,
                                    "http://schemas.microsoft.com/windowsazure", "LoadBalancer")
                            .size(); i38 = i38 + 1) {
                        org.w3c.dom.Element loadBalancersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility
                                .getElementsByTagNameNS(loadBalancersSequenceElement,
                                        "http://schemas.microsoft.com/windowsazure", "LoadBalancer")
                                .get(i38));
                        LoadBalancer loadBalancerInstance = new LoadBalancer();
                        result.getLoadBalancers().add(loadBalancerInstance);

                        Element nameElement14 = XmlUtility.getElementByTagNameNS(loadBalancersElement,
                                "http://schemas.microsoft.com/windowsazure", "Name");
                        if (nameElement14 != null) {
                            String nameInstance14;
                            nameInstance14 = nameElement14.getTextContent();
                            loadBalancerInstance.setName(nameInstance14);
                        }

                        Element frontendIpConfigurationElement = XmlUtility.getElementByTagNameNS(
                                loadBalancersElement, "http://schemas.microsoft.com/windowsazure",
                                "FrontendIpConfiguration");
                        if (frontendIpConfigurationElement != null) {
                            FrontendIPConfiguration frontendIpConfigurationInstance = new FrontendIPConfiguration();
                            loadBalancerInstance.setFrontendIPConfiguration(frontendIpConfigurationInstance);

                            Element typeElement2 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "Type");
                            if (typeElement2 != null) {
                                String typeInstance2;
                                typeInstance2 = typeElement2.getTextContent();
                                frontendIpConfigurationInstance.setType(typeInstance2);
                            }

                            Element subnetNameElement3 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "SubnetName");
                            if (subnetNameElement3 != null) {
                                String subnetNameInstance3;
                                subnetNameInstance3 = subnetNameElement3.getTextContent();
                                frontendIpConfigurationInstance.setSubnetName(subnetNameInstance3);
                            }

                            Element staticVirtualNetworkIPAddressElement3 = XmlUtility.getElementByTagNameNS(
                                    frontendIpConfigurationElement, "http://schemas.microsoft.com/windowsazure",
                                    "StaticVirtualNetworkIPAddress");
                            if (staticVirtualNetworkIPAddressElement3 != null) {
                                InetAddress staticVirtualNetworkIPAddressInstance3;
                                staticVirtualNetworkIPAddressInstance3 = InetAddress
                                        .getByName(staticVirtualNetworkIPAddressElement3.getTextContent());
                                frontendIpConfigurationInstance.setStaticVirtualNetworkIPAddress(
                                        staticVirtualNetworkIPAddressInstance3);
                            }
                        }
                    }
                }
            }

        }
        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);
        }
        return result;
    } finally {
        if (httpResponse != null && httpResponse.getEntity() != null) {
            httpResponse.getEntity().getContent().close();
        }
    }
}

From source file:org.kalypso.service.wps.client.WPSRequest.java

/**
 * Collects the process output.<br>
 * <br>/*w w w  .  j  a  va  2  s .  co m*/
 * <ol>
 * <li>All files (ComplexValueReference) will be collected with their id.</li>
 * <li>All literals (LiteralValueType) will be collected with their id.</li>
 * <li>All bounding boxes (BoundingBoxType) will be collected with their id.</li>
 * <li>All complex datas (ComplexDataType) will be collected with their id.</li>
 * </ol>
 * 
 * @param processOutputs
 *          The process outputs contains the info of the results, which are to be collected.
 */
private void collectOutput(final ExecuteResponseType.ProcessOutputs processOutputs) {
    // TODO: maybe check, if all desired outputs have been created??

    /* Collect all data for the client. */
    final List<IOValueType> ioValues = processOutputs.getOutput();
    for (final IOValueType ioValue : ioValues) {
        /* Complex value reference. */
        final ComplexValueReference complexValueReference = ioValue.getComplexValueReference();
        if (complexValueReference != null) {
            m_references.put(ioValue.getIdentifier().getValue(), complexValueReference);
            continue;
        }

        /* Literal value type. */
        final LiteralValueType literalValue = ioValue.getLiteralValue();
        if (literalValue != null) {
            final String value = literalValue.getValue();
            final String dataType = literalValue.getDataType();

            Object result = null;
            if ("string".equals(dataType)) //$NON-NLS-1$
            {
                result = DatatypeConverter.parseString(value);
            } else if ("int".equals(dataType)) //$NON-NLS-1$
            {
                result = DatatypeConverter.parseInt(value);
            } else if ("double".equals(dataType)) //$NON-NLS-1$
            {
                result = DatatypeConverter.parseDouble(value);
            } else if ("boolean".equals(dataType)) //$NON-NLS-1$
            {
                result = DatatypeConverter.parseBoolean(value);
            }

            if (result != null) {
                if (m_literals == null) {
                    m_literals = new LinkedHashMap<>();
                }

                m_literals.put(ioValue.getIdentifier().getValue(), result);
            }

            continue;
        }

        /* Bounding box type. */
        final BoundingBoxType boundingBox = ioValue.getBoundingBoxValue();
        if (boundingBox != null) {
            if (m_boundingBoxes == null)
                m_boundingBoxes = new LinkedHashMap<>();

            m_boundingBoxes.put(ioValue.getIdentifier().getValue(), boundingBox);

            continue;
        }

        /* Complex value type. */
        final ComplexValueType complexValue = ioValue.getComplexValue();
        if (complexValue != null) {
            if (m_complexValues == null)
                m_complexValues = new LinkedHashMap<>();

            m_complexValues.put(ioValue.getIdentifier().getValue(), complexValue);

            continue;
        }
    }
}