EMMA Coverage Report (generated Mon Oct 17 05:41:20 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 * 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.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