EMMA Coverage Report (generated Wed Aug 10 12:30:04 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 *
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.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