1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.compute.domain;
20
21 import org.jclouds.compute.config.CustomizationResponse;
22
23
24
25
26 public class ExecResponse implements CustomizationResponse {
27
28 private final String error;
29 private final String output;
30 private final int exitCode;
31
32 public ExecResponse(String output, String error, int exitCode) {
33 this.output = output;
34 this.error = error;
35 this.exitCode = exitCode;
36 }
37
38 public String getError() {
39 return error;
40 }
41
42 public String getOutput() {
43 return output;
44 }
45
46 @Override
47 public String toString() {
48 return "[output=" + output + ", error=" + error + ", exitCode=" + exitCode + "]";
49 }
50
51 @Override
52 public int hashCode() {
53 final int prime = 31;
54 int result = 1;
55 result = prime * result + ((error == null) ? 0 : error.hashCode());
56 result = prime * result + exitCode;
57 result = prime * result + ((output == null) ? 0 : output.hashCode());
58 return result;
59 }
60
61 @Override
62 public boolean equals(Object obj) {
63 if (this == obj)
64 return true;
65 if (obj == null)
66 return false;
67 if (getClass() != obj.getClass())
68 return false;
69 ExecResponse other = (ExecResponse) obj;
70 if (error == null) {
71 if (other.error != null)
72 return false;
73 } else if (!error.equals(other.error))
74 return false;
75 if (exitCode != other.exitCode)
76 return false;
77 if (output == null) {
78 if (other.output != null)
79 return false;
80 } else if (!output.equals(other.output))
81 return false;
82 return true;
83 }
84
85 public int getExitCode() {
86 return exitCode;
87 }
88
89 }