EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.azureblob.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [BlobPropertiesImpl.java]

nameclass, %method, %block, %line, %
BlobPropertiesImpl.java100% (1/1)21%  (3/14)51%  (108/211)57%  (22.9/40)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BlobPropertiesImpl100% (1/1)21%  (3/14)51%  (108/211)57%  (22.9/40)
compareTo (BlobProperties): int 0%   (0/1)0%   (0/11)0%   (0/1)
getContainer (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getContentMetadata (): ContentMetadata 0%   (0/1)0%   (0/3)0%   (0/1)
getETag (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getLastModified (): Date 0%   (0/1)0%   (0/3)0%   (0/1)
getLeaseStatus (): LeaseStatus 0%   (0/1)0%   (0/3)0%   (0/1)
getMetadata (): Map 0%   (0/1)0%   (0/3)0%   (0/1)
getName (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getType (): BlobType 0%   (0/1)0%   (0/3)0%   (0/1)
getUrl (): URI 0%   (0/1)0%   (0/3)0%   (0/1)
toString (): String 0%   (0/1)0%   (0/50)0%   (0/1)
equals (Object): boolean 100% (1/1)65%  (24/37)54%  (7/13)
hashCode (): int 100% (1/1)89%  (17/19)97%  (3.9/4)
BlobPropertiesImpl (BlobType, String, String, URI, Date, String, long, String... 100% (1/1)100% (67/67)100% (12/12)

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.azureblob.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.io.Serializable;
24import java.net.URI;
25import java.util.Date;
26import java.util.Map;
27 
28import org.jclouds.javax.annotation.Nullable;
29 
30import org.jclouds.azureblob.domain.BlobProperties;
31import org.jclouds.azureblob.domain.BlobType;
32import org.jclouds.azureblob.domain.LeaseStatus;
33import org.jclouds.io.ContentMetadata;
34import org.jclouds.io.payloads.BaseImmutableContentMetadata;
35 
36import com.google.common.collect.Maps;
37 
38/**
39 * Allows you to manipulate metadata.
40 * 
41 * @author Adrian Cole
42 */
43public class BlobPropertiesImpl implements Serializable, BlobProperties {
44 
45   /** The serialVersionUID */
46   private static final long serialVersionUID = -4648755473986695062L;
47   private final BlobType type;
48   private final String name;
49   private final String container;
50   private final URI url;
51   private final Date lastModified;
52   private final String eTag;
53   private final Map<String, String> metadata = Maps.newLinkedHashMap();
54   private final LeaseStatus leaseStatus;
55   private final BaseImmutableContentMetadata contentMetadata;
56 
57   public BlobPropertiesImpl(BlobType type, String name, String container, URI url, Date lastModified, String eTag,
58            long size, String contentType, @Nullable byte[] contentMD5, @Nullable String contentMetadata,
59            @Nullable String contentLanguage, LeaseStatus leaseStatus, Map<String, String> metadata) {
60      this.type = checkNotNull(type, "type");
61      this.leaseStatus = checkNotNull(leaseStatus, "leaseStatus");
62      this.name = checkNotNull(name, "name");
63      this.container = checkNotNull(container, "container");
64      this.url = checkNotNull(url, "url");
65      this.lastModified = checkNotNull(lastModified, "lastModified");
66      this.eTag = checkNotNull(eTag, "eTag");
67      this.contentMetadata = new BaseImmutableContentMetadata(contentType, size, contentMD5, null, contentLanguage,
68               contentMetadata);
69      this.metadata.putAll(checkNotNull(metadata, "metadata"));
70   }
71 
72   /**
73    *{@inheritDoc}
74    */
75   @Override
76   public BlobType getType() {
77      return type;
78   }
79 
80   /**
81    *{@inheritDoc}
82    */
83   @Override
84   public String getName() {
85      return name;
86   }
87 
88   /**
89    *{@inheritDoc}
90    */
91   @Override
92   public String getContainer() {
93      return container;
94   }
95 
96   /**
97    *{@inheritDoc}
98    */
99   @Override
100   public Date getLastModified() {
101      return lastModified;
102   }
103 
104   /**
105    *{@inheritDoc}
106    */
107   @Override
108   public String getETag() {
109      return eTag;
110   }
111 
112   /**
113    *{@inheritDoc}
114    */
115   @Override
116   public int compareTo(BlobProperties o) {
117      return (this == o) ? 0 : getName().compareTo(o.getName());
118   }
119 
120   /**
121    *{@inheritDoc}
122    */
123   @Override
124   public Map<String, String> getMetadata() {
125      return metadata;
126   }
127 
128   /**
129    *{@inheritDoc}
130    */
131   @Override
132   public URI getUrl() {
133      return url;
134   }
135 
136   /**
137    *{@inheritDoc}
138    */
139   @Override
140   public LeaseStatus getLeaseStatus() {
141      return leaseStatus;
142   }
143 
144   /**
145    *{@inheritDoc}
146    */
147   @Override
148   public ContentMetadata getContentMetadata() {
149      return contentMetadata;
150   }
151 
152   @Override
153   public int hashCode() {
154      final int prime = 31;
155      int result = 1;
156      result = prime * result + ((url == null) ? 0 : url.hashCode());
157      return result;
158   }
159 
160   @Override
161   public boolean equals(Object obj) {
162      if (this == obj)
163         return true;
164      if (obj == null)
165         return false;
166      if (getClass() != obj.getClass())
167         return false;
168      BlobPropertiesImpl other = (BlobPropertiesImpl) obj;
169      if (url == null) {
170         if (other.url != null)
171            return false;
172      } else if (!url.equals(other.url))
173         return false;
174      return true;
175   }
176 
177   @Override
178   public String toString() {
179      return String
180               .format(
181                        "[name=%s, container=%s, url=%s, contentMetadata=%s, eTag=%s, lastModified=%s, leaseStatus=%s, metadata=%s, type=%s]",
182                        name, container, url, contentMetadata, eTag, lastModified, leaseStatus, metadata, type);
183   }
184}

[all classes][org.jclouds.azureblob.domain.internal]
EMMA 2.0.5312 (C) Vladimir Roubtsov