gdbtrace: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.control.ui / src / org / eclipse / linuxtools / internal / lttng2 / control / ui / views / remote / CommandResult.java
1 /**********************************************************************
2 * Copyright (c) 2012, 2013 Ericsson
3 *
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.linuxtools.internal.lttng2.control.ui.views.remote;
13
14 import java.util.Arrays;
15
16 /**
17 * <p>
18 * Class containing command result of remote command execution.
19 * </p>
20 *
21 * @author Bernd Hufmann
22 */
23 public class CommandResult implements ICommandResult {
24
25 // ------------------------------------------------------------------------
26 // Attributes
27 // ------------------------------------------------------------------------
28 /**
29 * The result of the command. 0 if successful else > 0
30 */
31 private int fResult;
32
33 /**
34 * The output as String array.
35 */
36 private String[] fOutput = new String[0];
37 private String[] fErrorOutput = new String[0];
38
39 // ------------------------------------------------------------------------
40 // Constructor
41 // ------------------------------------------------------------------------
42
43 /**
44 * Constructor
45 *
46 * @param result
47 * The result of the command
48 * @param output
49 * The output, as an array of strings
50 * @param errorOutput
51 * THe error output as an array of strings
52 */
53 public CommandResult(int result, String[] output, String[] errorOutput) {
54 fResult = result;
55 if (output != null) {
56 fOutput = Arrays.copyOf(output, output.length);
57 }
58 if (errorOutput != null) {
59 fErrorOutput = Arrays.copyOf(errorOutput, errorOutput.length);
60 }
61 }
62
63 // ------------------------------------------------------------------------
64 // Accessors
65 // ------------------------------------------------------------------------
66
67 @Override
68 public int getResult() {
69 return fResult;
70 }
71
72 @Override
73 public void setResult(int result) {
74 fResult = result;
75 }
76
77 @Override
78 public String[] getOutput() {
79 return Arrays.copyOf(fOutput, fOutput.length);
80 }
81
82 @Override
83 public void setOutput(String[] output) {
84 fOutput = new String[0];
85 if (output != null) {
86 fOutput = Arrays.copyOf(output, output.length);
87 }
88 }
89
90 @Override
91 public String[] getErrorOutput() {
92 return Arrays.copyOf(fErrorOutput, fErrorOutput.length);
93 }
94
95 @Override
96 public void setErrorOutput(String[] output) {
97 fErrorOutput = new String[0];
98 if (output != null) {
99 fErrorOutput = Arrays.copyOf(output, output.length);
100 }
101 }
102 }
This page took 0.035287 seconds and 5 git commands to generate.