001/*
002 * This library is part of OpenCms -
003 * the Open Source Content Management System
004 *
005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com)
006 *
007 * This library is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * This library is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015 * Lesser General Public License for more details.
016 *
017 * For further information about Alkacon Software, please see the
018 * company website: http://www.alkacon.com
019 *
020 * For further information about OpenCms, please see the
021 * project website: http://www.opencms.org
022 *
023 * You should have received a copy of the GNU Lesser General Public
024 * License along with this library; if not, write to the Free Software
025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
026 */
027
028package org.opencms.rmi;
029
030import java.io.Serializable;
031
032/**
033 * An object containing the output of a remote shell command and also the updated values for some of the
034 * internal state fields of the client application.<p>
035 */
036public class CmsShellCommandResult implements Serializable {
037
038    /** Serial version id. */
039    private static final long serialVersionUID = 8485596393085683802L;
040
041    /** The command output. */
042    private String m_output;
043
044    /** The error code. */
045    private int m_errorCode;
046
047    /** The prompt. */
048    private String m_prompt;
049
050    /** The echo mode. */
051    private boolean m_echo;
052
053    /** True if exit was called. */
054    private boolean m_exitCalled;
055
056    /** True if an error occurred during command execution. */
057    private boolean m_hasError;
058
059    /**
060     * Gets the error code.<p>
061     *
062     * @return the error code
063     */
064    public int getErrorCode() {
065
066        return m_errorCode;
067    }
068
069    /**
070     * Gets the command output.<p>
071     *
072     * @return the command output
073     */
074    public String getOutput() {
075
076        return m_output;
077    }
078
079    /**
080     * Gets the prompt.<p>
081     *
082     * @return the prompt
083     */
084    public String getPrompt() {
085
086        return m_prompt;
087    }
088
089    /**
090     * Returns the echo mode.<p>
091     *
092     * @return the echo mode
093     */
094    public boolean hasEcho() {
095
096        return m_echo;
097    }
098
099    /**
100     * Returns true if an error has occurred.<p>
101     *
102     * @return true if an error has occurred
103     */
104    public boolean hasError() {
105
106        return m_hasError;
107    }
108
109    /**
110     * Returns true if exit was called.<p>
111     *
112     * @return true if exit was called
113     */
114    public boolean isExitCalled() {
115
116        return m_exitCalled;
117    }
118
119    /**
120     * Sets the echo mode.<p>
121     *
122     * @param echo the echo mode
123     */
124    public void setEcho(boolean echo) {
125
126        m_echo = echo;
127    }
128
129    /**
130     * Sets the error code.<p>
131     *
132     * @param errorCode the error code
133     */
134    public void setErrorCode(int errorCode) {
135
136        m_errorCode = errorCode;
137    }
138
139    /**
140     * Sets the 'exitCalled' flag.<p>
141     *
142     * @param exitCalled the new value
143     */
144    public void setExitCalled(boolean exitCalled) {
145
146        m_exitCalled = exitCalled;
147    }
148
149    /**
150     * Sets the error mode.<p>
151     *
152     * @param hasError the error mode
153     */
154    public void setHasError(boolean hasError) {
155
156        m_hasError = hasError;
157    }
158
159    /**
160     * Sets the command output.<p>
161     *
162     * @param outputString the command output
163     */
164    public void setOutput(String outputString) {
165
166        m_output = outputString;
167    }
168
169    /**
170     * Sets the prompt.<p>
171     *
172     * @param prompt the prompt
173     */
174    public void setPrompt(String prompt) {
175
176        m_prompt = prompt;
177    }
178
179}