tmf: Bug 460842: Introduce tmf remote plug-ins and feature
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.remote.core / src / org / eclipse / tracecompass / tmf / remote / core / shell / CommandResult.java
CommitLineData
eb1bab5b 1/**********************************************************************
ec619615 2 * Copyright (c) 2012, 2015 Ericsson
cfdb727a 3 *
eb1bab5b
BH
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
cfdb727a
AM
8 *
9 * Contributors:
eb1bab5b
BH
10 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
ec619615 12package org.eclipse.tracecompass.tmf.remote.core.shell;
eb1bab5b
BH
13
14import java.util.Arrays;
15
16/**
eb1bab5b
BH
17 * <p>
18 * Class containing command result of remote command execution.
19 * </p>
cfdb727a 20 *
dbd4432d 21 * @author Bernd Hufmann
eb1bab5b
BH
22 */
23public class CommandResult implements ICommandResult {
cfdb727a 24
eb1bab5b
BH
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];
6418ef54 37 private String[] fErrorOutput = new String[0];
eb1bab5b
BH
38
39 // ------------------------------------------------------------------------
40 // Constructor
41 // ------------------------------------------------------------------------
cfdb727a
AM
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
6418ef54
JRJ
50 * @param errorOutput
51 * THe error output as an array of strings
cfdb727a 52 */
6418ef54 53 public CommandResult(int result, String[] output, String[] errorOutput) {
eb1bab5b
BH
54 fResult = result;
55 if (output != null) {
56 fOutput = Arrays.copyOf(output, output.length);
57 }
6418ef54
JRJ
58 if (errorOutput != null) {
59 fErrorOutput = Arrays.copyOf(errorOutput, errorOutput.length);
60 }
eb1bab5b
BH
61 }
62
63 // ------------------------------------------------------------------------
cfdb727a 64 // Accessors
eb1bab5b 65 // ------------------------------------------------------------------------
11252342 66
eb1bab5b
BH
67 @Override
68 public int getResult() {
69 return fResult;
70 }
71
eb1bab5b
BH
72 @Override
73 public String[] getOutput() {
74 return Arrays.copyOf(fOutput, fOutput.length);
75 }
76
6418ef54
JRJ
77 @Override
78 public String[] getErrorOutput() {
79 return Arrays.copyOf(fErrorOutput, fErrorOutput.length);
80 }
eb1bab5b 81}
This page took 0.064236 seconds and 5 git commands to generate.