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

COVERAGE SUMMARY FOR SOURCE FILE [RateLimit.java]

nameclass, %method, %block, %line, %
RateLimit.java0%   (0/1)0%   (0/12)0%   (0/273)0%   (0/60)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RateLimit0%   (0/1)0%   (0/12)0%   (0/273)0%   (0/60)
RateLimit (): void 0%   (0/1)0%   (0/3)0%   (0/2)
RateLimit (String, String, int, long, RateLimitUnit, int, String): void 0%   (0/1)0%   (0/24)0%   (0/9)
equals (Object): boolean 0%   (0/1)0%   (0/98)0%   (0/31)
getRegex (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getRemaining (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getResetTime (): long 0%   (0/1)0%   (0/3)0%   (0/1)
getUnit (): RateLimitUnit 0%   (0/1)0%   (0/3)0%   (0/1)
getUri (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getValue (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getVerb (): String 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/85)0%   (0/10)
toString (): String 0%   (0/1)0%   (0/42)0%   (0/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.cloudservers.domain;
20 
21/**
22 * 
23 * RateLimit.
24 * <p/>
25 * we specify rate limits in terms of both a human readable wild-card URI and a machine processable
26 * regular expression. The regular expression boundary matcher '^' takes affect after the root URI
27 * path. For example, the regular expression ^/servers would match the bolded portion of the
28 * following URI: https://servers.api.rackspacecloud.com/v1.0/3542812 /servers .
29 * <p/>
30 * Rate limits are applied in order relative to the verb, going from least to most specific. For
31 * example, although the threshold for POST to /servers is 25 per day, one cannot POST to /servers
32 * more than 10 times within a single minute because the rate limits for any POST is 10/min. In the
33 * event you exceed the thresholds established for your identity, a 413 Rate Control HTTP response
34 * will be returned with a Reply-After header to notify the client when theyagain.
35 * 
36 * @author Adrian Cole
37 */
38public class RateLimit {
39 
40   @Override
41   public int hashCode() {
42      final int prime = 31;
43      int result = 1;
44      result = prime * result + ((regex == null) ? 0 : regex.hashCode());
45      result = prime * result + remaining;
46      result = prime * result + (int) (resetTime ^ (resetTime >>> 32));
47      result = prime * result + ((unit == null) ? 0 : unit.hashCode());
48      result = prime * result + ((uri == null) ? 0 : uri.hashCode());
49      result = prime * result + value;
50      result = prime * result + ((verb == null) ? 0 : verb.hashCode());
51      return result;
52   }
53 
54   @Override
55   public boolean equals(Object obj) {
56      if (this == obj)
57         return true;
58      if (obj == null)
59         return false;
60      if (getClass() != obj.getClass())
61         return false;
62      RateLimit other = (RateLimit) obj;
63      if (regex == null) {
64         if (other.regex != null)
65            return false;
66      } else if (!regex.equals(other.regex))
67         return false;
68      if (remaining != other.remaining)
69         return false;
70      if (resetTime != other.resetTime)
71         return false;
72      if (unit != other.unit)
73         return false;
74      if (uri == null) {
75         if (other.uri != null)
76            return false;
77      } else if (!uri.equals(other.uri))
78         return false;
79      if (value != other.value)
80         return false;
81      if (verb == null) {
82         if (other.verb != null)
83            return false;
84      } else if (!verb.equals(other.verb))
85         return false;
86      return true;
87   }
88 
89   private String uri;
90   private String regex;
91   private int remaining;
92   private long resetTime;
93   private RateLimitUnit unit;
94   private int value;
95   private String verb;
96 
97   // for deserializer
98   public RateLimit() {
99 
100   }
101 
102   public RateLimit(String uri, String regex, int remaining, long resetTime, RateLimitUnit unit, int value, String verb) {
103      this.uri = uri;
104      this.regex = regex;
105      this.remaining = remaining;
106      this.resetTime = resetTime;
107      this.unit = unit;
108      this.value = value;
109      this.verb = verb;
110   }
111 
112   public String getUri() {
113      return uri;
114   }
115 
116   public String getRegex() {
117      return regex;
118   }
119 
120   public int getRemaining() {
121      return remaining;
122   }
123 
124   public long getResetTime() {
125      return resetTime;
126   }
127 
128   public RateLimitUnit getUnit() {
129      return unit;
130   }
131 
132   public int getValue() {
133      return value;
134   }
135 
136   public String getVerb() {
137      return verb;
138   }
139 
140   @Override
141   public String toString() {
142      return "[uri=" + uri + ", regex=" + regex + ", remaining=" + remaining + ", resetTime=" + resetTime + ", unit="
143            + unit + ", value=" + value + ", verb=" + verb + "]";
144   }
145 
146}

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