Subversion Repositories XServices

Rev

Rev 73 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 brianR 1
/*
2
 *   Copyright 2010 Brian Rosenberger (Brutex Network)
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
15
 */
16
 
17
package net.brutex.xservices.types;
18
 
12 brianR 19
import java.util.List;
6 brianR 20
import javax.xml.bind.annotation.XmlElement;
21
import javax.xml.bind.annotation.XmlType;
82 brianR 22
 
23
import net.brutex.xservices.types.ant.AntProperty;
10 brianR 24
import net.brutex.xservices.util.BrutexNamespaces;
6 brianR 25
 
26
/**
27
 *
28
 * @author Brian Rosenberger, bru@brutex.de
29
 */
10 brianR 30
@XmlType(namespace=BrutexNamespaces.WS_XSERVICES, name="ReturnCodeType")
6 brianR 31
public class ReturnCode {
32
 
10 brianR 33
    /**
34
     * Numeric return code.
35
     *
36
     * The numeric return code of the last operation on the underlying operation
37
     * systen (OS). In general the return code indicates the failure or success
38
     * of a command. Which value indicates success is dependent on the OS, most
39
     * linux based systems use "0" for success.
40
     */
41
    @XmlElement(required=true, nillable=false)
42
    public int returnCode=0;
6 brianR 43
 
10 brianR 44
    /**
45
     * Standard Out as provided by the OS.
46
     *
47
     * The stdOut given by the last operation (if any).
48
     */
49
    @XmlElement(name="stdOut", nillable=false)
50
    public String stdOut="";
6 brianR 51
 
10 brianR 52
    /**
53
     * The Standard Error as provided by the OS.
54
     *
55
     * The stdErr given by the last operation (if any). The presents of any
56
     * value here ususally indicates that a failure has occured.
57
     */
58
    @XmlElement(name="stdErr", nillable=false)
59
    public String stdErr="";
60
 
12 brianR 61
 
62
    @XmlElement(name="propertyList", nillable=true)
63
    public List<AntProperty> property = null;
64
 
10 brianR 65
    /**
66
     * Create a new ReturnCode default constructor.
67
     */
6 brianR 68
    public ReturnCode() {
69
    }
70
 
10 brianR 71
    /**
72
     * Create a new ReturnCode.
73
     *
74
     * @param returnCode    return code integer value
75
     * @param stdOut        standard out string
76
     * @param stdErr        standard error string
77
     */
12 brianR 78
    public ReturnCode(int returnCode, String stdOut, String stdErr, List<AntProperty> props) {
6 brianR 79
        this.returnCode = returnCode;
80
        this.stdOut = stdOut;
81
        this.stdErr = stdErr;
12 brianR 82
        this.property = props;
6 brianR 83
    }
54 brianR 84
 
73 brianR 85
    /**
86
     * @param key
87
     * @return
88
     */
54 brianR 89
    public String getProperty(String key) {
90
    	for(AntProperty prop : this.property) {
73 brianR 91
    		if(key.equals(prop.name)) return prop.value;
54 brianR 92
    	}
93
    	return null;
94
    }
70 brianR 95
 
73 brianR 96
    /**
97
     * @return
98
     */
70 brianR 99
    public String getStdOut() { return this.stdOut; }
6 brianR 100
}