EMMA Coverage Report (generated Fri Aug 26 14:14:05 EDT 2011)
[all classes][org.jclouds.vcloud.xml.ovf]

COVERAGE SUMMARY FOR SOURCE FILE [VCloudNetworkSectionHandler.java]

nameclass, %method, %block, %line, %
VCloudNetworkSectionHandler.java100% (1/1)100% (5/5)100% (58/58)100% (14/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class VCloudNetworkSectionHandler100% (1/1)100% (5/5)100% (58/58)100% (14/14)
VCloudNetworkSectionHandler (NetworkSectionHandler): 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 (): VCloudNetworkSection 100% (1/1)100% (19/19)100% (2/2)
startElement (String, String, String, Attributes): void 100% (1/1)100% (19/19)100% (5/5)

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.xml.ovf;
20 
21import java.util.Map;
22 
23import javax.inject.Inject;
24 
25import org.jclouds.http.functions.ParseSax;
26import org.jclouds.ovf.NetworkSection;
27import org.jclouds.ovf.xml.NetworkSectionHandler;
28import org.jclouds.util.SaxUtils;
29import org.jclouds.vcloud.domain.ReferenceType;
30import org.jclouds.vcloud.domain.ovf.VCloudNetworkSection;
31import org.jclouds.vcloud.util.Utils;
32import org.xml.sax.Attributes;
33 
34/**
35 * @author Adrian Cole
36 */
37public class VCloudNetworkSectionHandler extends ParseSax.HandlerWithResult<VCloudNetworkSection> {
38   private final NetworkSectionHandler networkSectionHandler;
39 
40   @Inject
41   VCloudNetworkSectionHandler(NetworkSectionHandler networkSectionHandler) {
42      this.networkSectionHandler = networkSectionHandler;
43   }
44 
45   private ReferenceType net;
46 
47   public VCloudNetworkSection getResult() {
48      NetworkSection system = networkSectionHandler.getResult();
49      return new VCloudNetworkSection(net.getType(), net.getHref(), system.getInfo(), system.getNetworks());
50   }
51 
52   public void startElement(String uri, String localName, String qName, Attributes attrs) {
53      Map<String, String> attributes = SaxUtils.cleanseAttributes(attrs);
54      if (qName.endsWith("NetworkSection")) {
55         this.net = Utils.newReferenceType(attributes);
56      }
57      networkSectionHandler.startElement(uri, localName, qName, attrs);
58   }
59 
60   @Override
61   public void endElement(String uri, String localName, String qName) {
62      networkSectionHandler.endElement(uri, localName, qName);
63   }
64 
65   public void characters(char ch[], int start, int length) {
66      networkSectionHandler.characters(ch, start, length);
67   }
68 
69}

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