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

COVERAGE SUMMARY FOR SOURCE FILE [TasksListHandler.java]

nameclass, %method, %block, %line, %
TasksListHandler.java100% (1/1)25%  (1/4)18%  (9/50)33%  (4/12)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TasksListHandler100% (1/1)25%  (1/4)18%  (9/50)33%  (4/12)
endElement (String, String, String): void 0%   (0/1)0%   (0/18)0%   (0/4)
getResult (): Set 0%   (0/1)0%   (0/15)0%   (0/2)
startElement (String, String, String, Attributes): void 0%   (0/1)0%   (0/8)0%   (0/2)
TasksListHandler (TaskHandler): void 100% (1/1)100% (9/9)100% (4/4)

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.savvis.vpdc.xml;
20 
21import static org.jclouds.util.SaxUtils.equalsOrSuffix;
22 
23import java.util.Set;
24 
25import javax.inject.Inject;
26 
27import org.jclouds.http.functions.ParseSax;
28import org.jclouds.savvis.vpdc.domain.Task;
29import org.xml.sax.Attributes;
30import org.xml.sax.SAXException;
31 
32import com.google.common.collect.ImmutableSet;
33import com.google.common.collect.ImmutableSet.Builder;
34 
35/**
36 * @author Adrian Cole
37 */
38public class TasksListHandler extends ParseSax.HandlerWithResult<Set<Task>> {
39 
40   private Builder<Task> tasks = ImmutableSet.<Task> builder();
41   private final TaskHandler taskHandler;
42 
43   @Inject
44   public TasksListHandler(TaskHandler taskHandler) {
45      this.taskHandler = taskHandler;
46   }
47 
48   public Set<Task> getResult() {
49      try {
50         return tasks.build();
51      } finally {
52         tasks = ImmutableSet.<Task> builder();
53      }
54   }
55 
56   @Override
57   public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
58      taskHandler.startElement(uri, localName, qName, attrs);
59   }
60 
61   @Override
62   public void endElement(String uri, String localName, String qName) throws SAXException {
63      taskHandler.endElement(uri, localName, qName);
64      if (equalsOrSuffix(qName, "Task")) {
65         this.tasks.add(taskHandler.getResult());
66      }
67   }
68 
69}

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