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

COVERAGE SUMMARY FOR SOURCE FILE [MutableBlobPropertiesImpl.java]

nameclass, %method, %block, %line, %
MutableBlobPropertiesImpl.java100% (1/1)70%  (16/23)48%  (115/240)41%  (24.8/60)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MutableBlobPropertiesImpl100% (1/1)70%  (16/23)48%  (115/240)41%  (24.8/60)
MutableBlobPropertiesImpl (BlobProperties): void 0%   (0/1)0%   (0/47)0%   (0/13)
compareTo (BlobProperties): int 0%   (0/1)0%   (0/11)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/37)0%   (0/13)
getLeaseStatus (): LeaseStatus 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/19)0%   (0/4)
setContainer (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setType (BlobType): void 0%   (0/1)0%   (0/4)0%   (0/2)
MutableBlobPropertiesImpl (): void 100% (1/1)100% (17/17)100% (6/6)
getContainer (): String 100% (1/1)100% (3/3)100% (1/1)
getContentMetadata (): MutableContentMetadata 100% (1/1)100% (3/3)100% (1/1)
getETag (): String 100% (1/1)100% (3/3)100% (1/1)
getLastModified (): Date 100% (1/1)100% (3/3)100% (1/1)
getMetadata (): Map 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getType (): BlobType 100% (1/1)100% (3/3)100% (1/1)
getUrl (): URI 100% (1/1)100% (3/3)100% (1/1)
setContentMetadata (MutableContentMetadata): void 100% (1/1)100% (4/4)100% (2/2)
setETag (String): void 100% (1/1)100% (4/4)100% (2/2)
setLastModified (Date): void 100% (1/1)100% (4/4)100% (2/2)
setMetadata (Map): void 100% (1/1)100% (4/4)100% (2/2)
setName (String): void 100% (1/1)100% (4/4)100% (2/2)
setUrl (URI): void 100% (1/1)100% (4/4)100% (2/2)
toString (): String 100% (1/1)100% (50/50)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.azureblob.domain.internal;
20 
21import java.io.Serializable;
22import java.net.URI;
23import java.util.Date;
24import java.util.Map;
25 
26import org.jclouds.azureblob.domain.BlobProperties;
27import org.jclouds.azureblob.domain.BlobType;
28import org.jclouds.azureblob.domain.LeaseStatus;
29import org.jclouds.azureblob.domain.MutableBlobProperties;
30import org.jclouds.http.HttpUtils;
31import org.jclouds.io.MutableContentMetadata;
32import org.jclouds.io.payloads.BaseMutableContentMetadata;
33 
34import com.google.common.collect.Maps;
35 
36/**
37 * Allows you to manipulate metadata.
38 * 
39 * @author Adrian Cole
40 */
41public class MutableBlobPropertiesImpl implements Serializable, MutableBlobProperties {
42 
43   /** The serialVersionUID */
44   private static final long serialVersionUID = -4648755473986695062L;
45 
46   private BlobType type = BlobType.BLOCK_BLOB;
47   private LeaseStatus leaseStatus = LeaseStatus.UNLOCKED;
48 
49   private String name;
50   private String container;
51   private URI url;
52   private Date lastModified;
53   private String eTag;
54   private MutableContentMetadata contentMetadata;
55   private Map<String, String> metadata = Maps.newHashMap();
56 
57   public MutableBlobPropertiesImpl() {
58      super();
59      this.contentMetadata = new BaseMutableContentMetadata();
60   }
61 
62   public MutableBlobPropertiesImpl(BlobProperties from) {
63      this.contentMetadata = new BaseMutableContentMetadata();
64      this.name = from.getName();
65      this.container = from.getContainer();
66      this.url = from.getUrl();
67      this.lastModified = from.getLastModified();
68      this.eTag = from.getETag();
69      this.metadata.putAll(from.getMetadata());
70      HttpUtils.copy(from.getContentMetadata(), this.contentMetadata);
71   }
72 
73   /**
74    *{@inheritDoc}
75    */
76   @Override
77   public BlobType getType() {
78      return type;
79   }
80 
81   /**
82    *{@inheritDoc}
83    */
84   public void setType(BlobType type) {
85      this.type = type;
86   }
87 
88   /**
89    *{@inheritDoc}
90    */
91   public String getName() {
92      return name;
93   }
94 
95   /**
96    *{@inheritDoc}
97    */
98   public Date getLastModified() {
99      return lastModified;
100   }
101 
102   /**
103    *{@inheritDoc}
104    */
105   public String getETag() {
106      return eTag;
107   }
108 
109   /**
110    *{@inheritDoc}
111    */
112   public int compareTo(BlobProperties o) {
113      return (this == o) ? 0 : getName().compareTo(o.getName());
114   }
115 
116   /**
117    *{@inheritDoc}
118    */
119   public Map<String, String> getMetadata() {
120      return metadata;
121   }
122 
123   /**
124    *{@inheritDoc}
125    */
126   @Override
127   public LeaseStatus getLeaseStatus() {
128      return leaseStatus;
129   }
130 
131   /**
132    *{@inheritDoc}
133    */
134   public void setETag(String eTag) {
135      this.eTag = eTag;
136   }
137 
138   /**
139    *{@inheritDoc}
140    */
141   public void setName(String name) {
142      this.name = name;
143   }
144 
145   /**
146    *{@inheritDoc}
147    */
148   public void setLastModified(Date lastModified) {
149      this.lastModified = lastModified;
150   }
151 
152   /**
153    *{@inheritDoc}
154    */
155   public void setMetadata(Map<String, String> metadata) {
156      this.metadata = metadata;
157   }
158 
159   public void setUrl(URI url) {
160      this.url = url;
161   }
162 
163   public URI getUrl() {
164      return url;
165   }
166 
167   @Override
168   public int hashCode() {
169      final int prime = 31;
170      int result = 1;
171      result = prime * result + ((url == null) ? 0 : url.hashCode());
172      return result;
173   }
174 
175   @Override
176   public boolean equals(Object obj) {
177      if (this == obj)
178         return true;
179      if (obj == null)
180         return false;
181      if (getClass() != obj.getClass())
182         return false;
183      MutableBlobPropertiesImpl other = (MutableBlobPropertiesImpl) obj;
184      if (url == null) {
185         if (other.url != null)
186            return false;
187      } else if (!url.equals(other.url))
188         return false;
189      return true;
190   }
191 
192   @Override
193   public String toString() {
194      return String
195               .format(
196                        "[name=%s, container=%s, url=%s, contentMetadata=%s, eTag=%s, lastModified=%s, leaseStatus=%s, metadata=%s, type=%s]",
197                        name, container, url, contentMetadata, eTag, lastModified, leaseStatus, metadata, type);
198   }
199 
200   /**
201    * {@inheritDoc}
202    */
203   @Override
204   public MutableContentMetadata getContentMetadata() {
205      return contentMetadata;
206   }
207 
208   /**
209    * {@inheritDoc}
210    */
211   @Override
212   public void setContentMetadata(MutableContentMetadata contentMetadata) {
213      this.contentMetadata = contentMetadata;
214   }
215 
216   /**
217    *{@inheritDoc}
218    */
219   @Override
220   public String getContainer() {
221      return container;
222   }
223 
224   /**
225    *{@inheritDoc}
226    */
227   @Override
228   public void setContainer(String container) {
229      this.container = container;
230   }
231 
232}

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