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

COVERAGE SUMMARY FOR SOURCE FILE [ListDirectoryResponseHandler.java]

nameclass, %method, %block, %line, %
ListDirectoryResponseHandler.java100% (1/1)100% (4/4)95%  (83/87)94%  (17/18)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ListDirectoryResponseHandler100% (1/1)100% (4/4)95%  (83/87)94%  (17/18)
endElement (String, String, String): void 100% (1/1)94%  (61/65)92%  (11/12)
ListDirectoryResponseHandler (): void 100% (1/1)100% (11/11)100% (3/3)
characters (char [], int, int): void 100% (1/1)100% (8/8)100% (2/2)
getResult (): Set 100% (1/1)100% (3/3)100% (1/1)

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.atmos.xml;
20 
21import java.util.Set;
22 
23import org.jclouds.atmos.domain.DirectoryEntry;
24import org.jclouds.atmos.domain.FileType;
25import org.jclouds.http.functions.ParseSax;
26 
27import com.google.common.collect.Sets;
28 
29/**
30 * Parses an object list
31 * <p/>
32 * 
33 * @see <a href="https://community.emc.com/community/labs/atmos_online" />
34 * @author Adrian Cole
35 */
36public class ListDirectoryResponseHandler extends ParseSax.HandlerWithResult<Set<DirectoryEntry>> {
37 
38   private Set<DirectoryEntry> entries = Sets.newLinkedHashSet();
39   private String currentObjectId;
40   private FileType currentType;
41   private String currentName;
42 
43   private StringBuilder currentText = new StringBuilder();
44 
45   public Set<DirectoryEntry> getResult() {
46      return entries;
47   }
48 
49   public void endElement(String uri, String name, String qName) {
50      if (qName.equals("ObjectID")) {
51         currentObjectId = currentText.toString().trim();
52      } else if (qName.equals("FileType")) {
53         currentType = FileType.fromValue(currentText.toString().trim());
54      } else if (qName.equals("Filename")) {
55         currentName = currentText.toString().trim();
56         if (currentName.equals(""))
57            currentName = null;
58      } else if (qName.equals("DirectoryEntry")) {
59         entries.add(new DirectoryEntry(currentObjectId, currentType, currentName));
60      }
61      currentText = new StringBuilder();
62   }
63 
64   public void characters(char ch[], int start, int length) {
65      currentText.append(ch, start, length);
66   }
67}

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