1 /**
2 This file is part of GoldenGate Project (named also GoldenGate or GG).
3
4 Copyright 2009, Frederic Bregier, and individual contributors by the @author
5 tags. See the COPYRIGHT.txt in the distribution for a full listing of
6 individual contributors.
7
8 All GoldenGate Project is free software: you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as published
10 by the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 GoldenGate is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with GoldenGate . If not, see <http://www.gnu.org/licenses/>.
20 */
21 package goldengate.commandexec.utils;
22
23 /**
24 * Message Result for an Execution
25 *
26 * @author Frederic Bregier
27 *
28 */
29 public class LocalExecResult {
30 public int status;
31 public boolean isSuccess;
32 public Exception exception;
33 public String result;
34 /**
35 * @param status
36 * @param exception
37 * @param result
38 */
39 public LocalExecResult(boolean isSuccess, int status, Exception exception, String result) {
40 this.isSuccess = isSuccess;
41 this.status = status;
42 this.exception = exception;
43 this.result = result;
44 }
45
46 /**
47 * Constructor from a pre-existing LocalExecResult
48 * @param localExecResult
49 */
50 public LocalExecResult(LocalExecResult localExecResult) {
51 this.isSuccess = localExecResult.isSuccess;
52 this.status = localExecResult.status;
53 this.exception = localExecResult.exception;
54 this.result = localExecResult.result;
55 }
56 /**
57 * Set the values from a LocalExecResult (pointer copy)
58 * @param localExecResult
59 */
60 public void set(LocalExecResult localExecResult) {
61 this.isSuccess = localExecResult.isSuccess;
62 this.status = localExecResult.status;
63 this.exception = localExecResult.exception;
64 this.result = localExecResult.result;
65 }
66
67 /* (non-Javadoc)
68 * @see java.lang.Object#toString()
69 */
70 @Override
71 public String toString() {
72 return "Status: "+status+" Output: "+result+(exception != null ? "\nError: "+exception.getMessage():"");
73 }
74
75 }