EMMA Coverage Report (generated Wed Jun 22 19:47:49 EDT 2011)
[all classes][org.jclouds.vcloud.terremark.xml]

COVERAGE SUMMARY FOR SOURCE FILE [TerremarkVDCHandler.java]

nameclass, %method, %block, %line, %
TerremarkVDCHandler.java100% (1/1)100% (3/3)100% (101/101)100% (16/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TerremarkVDCHandler100% (1/1)100% (3/3)100% (101/101)100% (16/16)
TerremarkVDCHandler (TaskHandler): void 100% (1/1)100% (4/4)100% (2/2)
getResult (): TerremarkVDC 100% (1/1)100% (47/47)100% (2/2)
startElement (String, String, String, Attributes): void 100% (1/1)100% (50/50)100% (12/12)

1/**
2 *
3 * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4 *
5 * ====================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 * ====================================================================
18 */
19package org.jclouds.vcloud.terremark.xml;
20 
21import static org.jclouds.util.SaxUtils.cleanseAttributes;
22 
23import java.util.Map;
24 
25import javax.inject.Inject;
26 
27import org.jclouds.vcloud.VCloudExpressMediaType;
28import org.jclouds.vcloud.domain.ReferenceType;
29import org.jclouds.vcloud.domain.VDC;
30import org.jclouds.vcloud.terremark.domain.TerremarkVDC;
31import org.jclouds.vcloud.terremark.domain.internal.TerremarkVDCImpl;
32import org.jclouds.vcloud.util.Utils;
33import org.jclouds.vcloud.xml.TaskHandler;
34import org.jclouds.vcloud.xml.VDCHandler;
35import org.xml.sax.Attributes;
36import org.xml.sax.SAXException;
37 
38/**
39 * @author Adrian Cole
40 */
41public class TerremarkVDCHandler extends VDCHandler {
42 
43   @Inject
44   public TerremarkVDCHandler(TaskHandler taskHandler) {
45      super(taskHandler);
46   }
47 
48   private ReferenceType catalog;
49   private ReferenceType publicIps;
50   private ReferenceType internetServices;
51 
52   public TerremarkVDC getResult() {
53      VDC vDC = super.getResult();
54      return new TerremarkVDCImpl(vDC.getName(), vDC.getType(), vDC.getHref(), status, org, description, tasks,
55               allocationModel, storageCapacity, cpuCapacity, memoryCapacity, resourceEntities, availableNetworks,
56               nicQuota, networkQuota, vmQuota, isEnabled, catalog, publicIps, internetServices);
57   }
58 
59   @Override
60   public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
61      Map<String, String> attributes = cleanseAttributes(attrs);
62      super.startElement(uri, localName, qName, attrs);
63      if (qName.equals("Link")) {
64         String name = attributes.get("name");
65         if (name.equals("Internet Services")) {
66            internetServices = Utils.newReferenceType(attributes);
67         } else if (name.equals("Public IPs")) {
68            publicIps = Utils.newReferenceType(attributes);
69         } else {
70            String type = attributes.get("type");
71            if (type.equals(VCloudExpressMediaType.CATALOG_XML)) {
72               catalog = Utils.newReferenceType(attributes);
73            }
74         }
75      }
76   }
77 
78}

[all classes][org.jclouds.vcloud.terremark.xml]
EMMA 2.0.5312 (C) Vladimir Roubtsov