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 */
19 package org.jclouds.http;
20
21 /**
22 * Command whose endpoint is an http service.
23 *
24 * @author Adrian Cole
25 */
26 public interface HttpCommand {
27
28 /**
29 * increments the current number of redirect attempts for this command.
30 *
31 * @see #getRedirectCount
32 */
33 int incrementRedirectCount();
34
35 /**
36 * This displays the current number of redirect attempts for this command.
37 *
38 * @see org.jclouds.Constants.PROPERTY_MAX_REDIRECTS
39 */
40 int getRedirectCount();
41
42 /**
43 * Commands need to be replayed, if redirected or on a retryable error. Typically, this implies
44 * the payload carried is not a streaming type.
45 */
46 boolean isReplayable();
47
48 /**
49 * increment the current failure count.
50 *
51 * @see #getFailureCount
52 */
53 int incrementFailureCount();
54
55 /**
56 * This displays the current number of error retries for this command.
57 *
58 * @see org.jclouds.Constants.PROPERTY_MAX_RETRIES
59 */
60 int getFailureCount();
61
62 /**
63 * The request associated with this command.
64 */
65 HttpRequest getCurrentRequest();
66
67 /**
68 * The request associated with this command.
69 */
70 void setCurrentRequest(HttpRequest request);
71
72 /**
73 * Used to prevent a command from being re-executed, or having its response parsed.
74 */
75 void setException(Exception exception);
76
77 /**
78 * @see #setException
79 */
80 Exception getException();
81
82 }