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

COVERAGE SUMMARY FOR SOURCE FILE [BucketMetadata.java]

nameclass, %method, %block, %line, %
BucketMetadata.java100% (1/1)71%  (5/7)42%  (49/117)40%  (12.8/32)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BucketMetadata100% (1/1)71%  (5/7)42%  (49/117)40%  (12.8/32)
compareTo (BucketMetadata): int 0%   (0/1)0%   (0/11)0%   (0/1)
equals (Object): boolean 0%   (0/1)0%   (0/53)0%   (0/18)
hashCode (): int 100% (1/1)88%  (28/32)96%  (4.8/5)
BucketMetadata (String, Date, CanonicalUser): void 100% (1/1)100% (12/12)100% (5/5)
getCreationDate (): Date 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getOwner (): CanonicalUser 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.s3.domain;
20 
21import java.util.Date;
22 
23/**
24 * System metadata of the S3Bucket
25 * 
26 * @author Adrian Cole
27 */
28public class BucketMetadata implements Comparable<BucketMetadata> {
29   /** The serialVersionUID */
30   private static final long serialVersionUID = -6965068835316857535L;
31   private final Date creationDate;
32   private final CanonicalUser owner;
33   private final String name;
34 
35   public BucketMetadata(String name, Date creationDate, CanonicalUser owner) {
36      this.name = name;
37      this.creationDate = creationDate;
38      this.owner = owner;
39   }
40 
41   /**
42    * Every bucket and object in Amazon S3 has an owner, the user that created the bucket or object.
43    * The owner of a bucket or object cannot be changed. However, if the object is overwritten by
44    * another user (deleted and rewritten), the new object will have a new owner.
45    */
46   public CanonicalUser getOwner() {
47      return owner;
48   }
49 
50   public Date getCreationDate() {
51      return creationDate;
52   }
53 
54   /**
55    * To comply with Amazon S3 requirements, bucket names must:
56    * <p/>
57    * Contain lowercase letters, numbers, periods (.), underscores (_), and dashes (-)
58    * <p/>
59    * Start with a number or letter
60    * <p/>
61    * Be between 3 and 255 characters long
62    * <p/>
63    * Not be in an IP address style (e.g., "192.168.5.4")
64    */
65   public String getName() {
66      return name;
67   }
68 
69   public int compareTo(BucketMetadata o) {
70      return (this == o) ? 0 : getName().compareTo(o.getName());
71   }
72 
73   @Override
74   public int hashCode() {
75      final int prime = 31;
76      int result = 1;
77      result = prime * result + ((name == null) ? 0 : name.hashCode());
78      result = prime * result + ((owner == null) ? 0 : owner.hashCode());
79      return result;
80   }
81 
82   @Override
83   public boolean equals(Object obj) {
84      if (this == obj)
85         return true;
86      if (obj == null)
87         return false;
88      if (getClass() != obj.getClass())
89         return false;
90      BucketMetadata other = (BucketMetadata) obj;
91      if (name == null) {
92         if (other.name != null)
93            return false;
94      } else if (!name.equals(other.name))
95         return false;
96      if (owner == null) {
97         if (other.owner != null)
98            return false;
99      } else if (!owner.equals(other.owner))
100         return false;
101      return true;
102   }
103}

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