EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.vcloud.xml]

COVERAGE SUMMARY FOR SOURCE FILE [VCloudVirtualHardwareHandler.java]

nameclass, %method, %block, %line, %
VCloudVirtualHardwareHandler.java100% (1/1)100% (5/5)100% (62/62)100% (14/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VCloudVirtualHardwareHandler100% (1/1)100% (5/5)100% (62/62)100% (14/14)
VCloudVirtualHardwareHandler (VirtualHardwareSectionHandler): void 100% (1/1)100% (6/6)100% (3/3)
characters (char [], int, int): void 100% (1/1)100% (7/7)100% (2/2)
endElement (String, String, String): void 100% (1/1)100% (7/7)100% (2/2)
getResult (): VCloudVirtualHardwareSection 100% (1/1)100% (23/23)100% (2/2)
startElement (String, String, String, Attributes): void 100% (1/1)100% (19/19)100% (5/5)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  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,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.vcloud.xml;
20 
21import static org.jclouds.vcloud.util.Utils.newReferenceType;
22 
23import java.util.Map;
24 
25import javax.inject.Inject;
26 
27import org.jclouds.http.functions.ParseSax;
28import org.jclouds.ovf.VirtualHardwareSection;
29import org.jclouds.ovf.xml.VirtualHardwareSectionHandler;
30import org.jclouds.util.SaxUtils;
31import org.jclouds.vcloud.domain.ReferenceType;
32import org.jclouds.vcloud.domain.ovf.VCloudVirtualHardwareSection;
33import org.xml.sax.Attributes;
34 
35/**
36 * @author Adrian Cole
37 */
38public class VCloudVirtualHardwareHandler extends ParseSax.HandlerWithResult<VCloudVirtualHardwareSection> {
39 
40   private final VirtualHardwareSectionHandler hardwareHandler;
41 
42   private ReferenceType hardware;
43 
44   @Inject
45   public VCloudVirtualHardwareHandler(VirtualHardwareSectionHandler hardwareHandler) {
46      this.hardwareHandler = hardwareHandler;
47   }
48 
49   public VCloudVirtualHardwareSection getResult() {
50      VirtualHardwareSection hardware = hardwareHandler.getResult();
51      return new VCloudVirtualHardwareSection(this.hardware.getType(), this.hardware.getHref(), hardware.getInfo(), hardware
52                        .getTransports(), hardware.getSystem(), hardware.getItems());
53   }
54 
55   public void startElement(String uri, String localName, String qName, Attributes attrs) {
56      Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
57      if (qName.endsWith("VirtualHardwareSection")) {
58         hardware = newReferenceType(attributes);
59      }
60      hardwareHandler.startElement(uri, localName, qName, attrs);
61   }
62 
63   @Override
64   public void endElement(String uri, String localName, String qName) {
65      hardwareHandler.endElement(uri, localName, qName);
66 
67   }
68 
69   @Override
70   public void characters(char ch[], int start, int length) {
71      hardwareHandler.characters(ch, start, length);
72   }
73 
74}

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