Examples of CloudServiceListResponse


Examples of com.microsoft.windowsazure.management.scheduler.models.CloudServiceListResponse

                }
                throw ex;
            }
           
            // Create Result
            CloudServiceListResponse result = null;
            // Deserialize Response
            InputStream responseContent = httpResponse.getEntity().getContent();
            result = new CloudServiceListResponse();
            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
            documentBuilderFactory.setNamespaceAware(true);
            DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
            Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
           
            Element cloudServicesSequenceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "CloudServices");
            if (cloudServicesSequenceElement != null) {
                for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(cloudServicesSequenceElement, "http://schemas.microsoft.com/windowsazure", "CloudService").size(); i1 = i1 + 1) {
                    org.w3c.dom.Element cloudServicesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(cloudServicesSequenceElement, "http://schemas.microsoft.com/windowsazure", "CloudService").get(i1));
                    CloudServiceListResponse.CloudService cloudServiceInstance = new CloudServiceListResponse.CloudService();
                    result.getCloudServices().add(cloudServiceInstance);
                   
                    Element nameElement = XmlUtility.getElementByTagNameNS(cloudServicesElement, "http://schemas.microsoft.com/windowsazure", "Name");
                    if (nameElement != null) {
                        String nameInstance;
                        nameInstance = nameElement.getTextContent();
                        cloudServiceInstance.setName(nameInstance);
                    }
                   
                    Element labelElement = XmlUtility.getElementByTagNameNS(cloudServicesElement, "http://schemas.microsoft.com/windowsazure", "Label");
                    if (labelElement != null) {
                        String labelInstance;
                        labelInstance = labelElement.getTextContent();
                        cloudServiceInstance.setLabel(labelInstance);
                    }
                   
                    Element descriptionElement = XmlUtility.getElementByTagNameNS(cloudServicesElement, "http://schemas.microsoft.com/windowsazure", "Description");
                    if (descriptionElement != null) {
                        String descriptionInstance;
                        descriptionInstance = descriptionElement.getTextContent();
                        cloudServiceInstance.setDescription(descriptionInstance);
                    }
                   
                    Element geoRegionElement = XmlUtility.getElementByTagNameNS(cloudServicesElement, "http://schemas.microsoft.com/windowsazure", "GeoRegion");
                    if (geoRegionElement != null) {
                        String geoRegionInstance;
                        geoRegionInstance = geoRegionElement.getTextContent();
                        cloudServiceInstance.setGeoRegion(geoRegionInstance);
                    }
                   
                    Element resourcesSequenceElement = XmlUtility.getElementByTagNameNS(cloudServicesElement, "http://schemas.microsoft.com/windowsazure", "Resources");
                    if (resourcesSequenceElement != null) {
                        for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(resourcesSequenceElement, "http://schemas.microsoft.com/windowsazure", "Resource").size(); i2 = i2 + 1) {
                            org.w3c.dom.Element resourcesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(resourcesSequenceElement, "http://schemas.microsoft.com/windowsazure", "Resource").get(i2));
                            CloudServiceListResponse.CloudService.AddOnResource resourceInstance = new CloudServiceListResponse.CloudService.AddOnResource();
                            cloudServiceInstance.getResources().add(resourceInstance);
                           
                            Element resourceProviderNamespaceElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "ResourceProviderNamespace");
                            if (resourceProviderNamespaceElement != null) {
                                String resourceProviderNamespaceInstance;
                                resourceProviderNamespaceInstance = resourceProviderNamespaceElement.getTextContent();
                                resourceInstance.setNamespace(resourceProviderNamespaceInstance);
                            }
                           
                            Element typeElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Type");
                            if (typeElement != null) {
                                String typeInstance;
                                typeInstance = typeElement.getTextContent();
                                resourceInstance.setType(typeInstance);
                            }
                           
                            Element nameElement2 = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Name");
                            if (nameElement2 != null) {
                                String nameInstance2;
                                nameInstance2 = nameElement2.getTextContent();
                                resourceInstance.setName(nameInstance2);
                            }
                           
                            Element planElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "Plan");
                            if (planElement != null) {
                                String planInstance;
                                planInstance = planElement.getTextContent();
                                resourceInstance.setPlan(planInstance);
                            }
                           
                            Element schemaVersionElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "SchemaVersion");
                            if (schemaVersionElement != null) {
                                String schemaVersionInstance;
                                schemaVersionInstance = schemaVersionElement.getTextContent();
                                resourceInstance.setSchemaVersion(schemaVersionInstance);
                            }
                           
                            Element eTagElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "ETag");
                            if (eTagElement != null) {
                                String eTagInstance;
                                eTagInstance = eTagElement.getTextContent();
                                resourceInstance.setETag(eTagInstance);
                            }
                           
                            Element stateElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "State");
                            if (stateElement != null) {
                                String stateInstance;
                                stateInstance = stateElement.getTextContent();
                                resourceInstance.setState(stateInstance);
                            }
                           
                            Element usageMetersSequenceElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "UsageMeters");
                            if (usageMetersSequenceElement != null) {
                                for (int i3 = 0; i3 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(usageMetersSequenceElement, "http://schemas.microsoft.com/windowsazure", "UsageMeter").size(); i3 = i3 + 1) {
                                    org.w3c.dom.Element usageMetersElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(usageMetersSequenceElement, "http://schemas.microsoft.com/windowsazure", "UsageMeter").get(i3));
                                    CloudServiceListResponse.CloudService.AddOnResource.UsageLimit usageMeterInstance = new CloudServiceListResponse.CloudService.AddOnResource.UsageLimit();
                                    resourceInstance.getUsageLimits().add(usageMeterInstance);
                                   
                                    Element nameElement3 = XmlUtility.getElementByTagNameNS(usageMetersElement, "http://schemas.microsoft.com/windowsazure", "Name");
                                    if (nameElement3 != null) {
                                        String nameInstance3;
                                        nameInstance3 = nameElement3.getTextContent();
                                        usageMeterInstance.setName(nameInstance3);
                                    }
                                   
                                    Element unitElement = XmlUtility.getElementByTagNameNS(usageMetersElement, "http://schemas.microsoft.com/windowsazure", "Unit");
                                    if (unitElement != null) {
                                        String unitInstance;
                                        unitInstance = unitElement.getTextContent();
                                        usageMeterInstance.setUnit(unitInstance);
                                    }
                                   
                                    Element includedElement = XmlUtility.getElementByTagNameNS(usageMetersElement, "http://schemas.microsoft.com/windowsazure", "Included");
                                    if (includedElement != null) {
                                        String includedInstance;
                                        includedInstance = includedElement.getTextContent();
                                        usageMeterInstance.setAmountIncluded(includedInstance);
                                    }
                                   
                                    Element usedElement = XmlUtility.getElementByTagNameNS(usageMetersElement, "http://schemas.microsoft.com/windowsazure", "Used");
                                    if (usedElement != null) {
                                        String usedInstance;
                                        usedInstance = usedElement.getTextContent();
                                        usageMeterInstance.setAmountUsed(usedInstance);
                                    }
                                }
                            }
                           
                            Element outputItemsSequenceElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "OutputItems");
                            if (outputItemsSequenceElement != null) {
                                for (int i4 = 0; i4 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(outputItemsSequenceElement, "http://schemas.microsoft.com/windowsazure", "OutputItem").size(); i4 = i4 + 1) {
                                    org.w3c.dom.Element outputItemsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(outputItemsSequenceElement, "http://schemas.microsoft.com/windowsazure", "OutputItem").get(i4));
                                    String outputItemsKey = XmlUtility.getElementByTagNameNS(outputItemsElement, "http://schemas.microsoft.com/windowsazure", "Key").getTextContent();
                                    String outputItemsValue = XmlUtility.getElementByTagNameNS(outputItemsElement, "http://schemas.microsoft.com/windowsazure", "Value").getTextContent();
                                    resourceInstance.getOutputItems().put(outputItemsKey, outputItemsValue);
                                }
                            }
                           
                            Element operationStatusElement = XmlUtility.getElementByTagNameNS(resourcesElement, "http://schemas.microsoft.com/windowsazure", "OperationStatus");
                            if (operationStatusElement != null) {
                                CloudServiceListResponse.CloudService.AddOnResource.OperationStatus operationStatusInstance = new CloudServiceListResponse.CloudService.AddOnResource.OperationStatus();
                                resourceInstance.setStatus(operationStatusInstance);
                               
                                Element typeElement2 = XmlUtility.getElementByTagNameNS(operationStatusElement, "http://schemas.microsoft.com/windowsazure", "Type");
                                if (typeElement2 != null) {
                                    String typeInstance2;
                                    typeInstance2 = typeElement2.getTextContent();
                                    operationStatusInstance.setType(typeInstance2);
                                }
                               
                                Element resultElement = XmlUtility.getElementByTagNameNS(operationStatusElement, "http://schemas.microsoft.com/windowsazure", "Result");
                                if (resultElement != null) {
                                    String resultInstance;
                                    resultInstance = resultElement.getTextContent();
                                    operationStatusInstance.setResult(resultInstance);
                                }
                            }
                        }
                    }
                }
            }
           
            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);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.