Subversion Repositories XServices

Rev

Details | 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.ws;
18
 
19
import java.util.GregorianCalendar;
20
import javax.xml.bind.annotation.XmlElement;
65 brianR 21
import javax.xml.bind.annotation.XmlRootElement;
22
import javax.xml.bind.annotation.XmlType;
6 brianR 23
import javax.xml.datatype.DatatypeConfigurationException;
24
import javax.xml.datatype.DatatypeFactory;
25
import javax.xml.datatype.XMLGregorianCalendar;
65 brianR 26
import javax.xml.ws.WebFault;
6 brianR 27
 
65 brianR 28
import net.brutex.xservices.util.BrutexNamespaces;
29
 
6 brianR 30
/**
31
 *
32
 * @author Brian Rosenberger, bru@brutex.de
33
 */
65 brianR 34
@WebFault(targetNamespace=BrutexNamespaces.WS_XSERVICES)
6 brianR 35
public class XServicesFault extends Exception {
36
 
46 brianR 37
    /**
38
	 *
39
	 */
40
	private static final long serialVersionUID = -6779279189376374820L;
41
 
42
	public XServicesFault(String message, Exception e) {
6 brianR 43
        this(message, e.getCause());
44
    }
45
 
46
    public XServicesFault(String string) {
47
        this(string, new Exception(string).getCause());
48
    }
49
 
50
    public XServicesFault(Exception e) {
51
        this(e.getMessage(), e.getCause());
52
    }
53
 
54
    public XServicesFault(String message, Throwable cause) {
55
        super(message, cause);
56
        this.faultstring=message;
57
 
58
 
59
        try {
60
            timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
61
        } catch (DatatypeConfigurationException ex) {
62
            System.err.println(ex.getMessage());
63
        }
64
 
65
 
66
    }
65 brianR 67
    /**
68
     * The error message.
69
     */
70
    @XmlElement(name="faultstring", namespace=BrutexNamespaces.WS_XSERVICES)
6 brianR 71
    public String faultstring = "";
72
 
65 brianR 73
    /**
74
     * Username under which the web service has been executed.
75
     */
76
    @XmlElement(name="username", namespace=BrutexNamespaces.WS_XSERVICES)
6 brianR 77
    public String username = System.getProperty("user.name");
78
 
65 brianR 79
    /**
80
     * Home directory of the user profile running the web service.
81
     */
82
    @XmlElement(name="homedir", namespace=BrutexNamespaces.WS_XSERVICES)
6 brianR 83
    public String homedir = System.getProperty("user.home");
84
 
65 brianR 85
 
86
    /**
87
     * Timestamp when the fault was thrown.
88
     */
89
    @XmlElement(name="timstamp", namespace=BrutexNamespaces.WS_XSERVICES)
6 brianR 90
    public XMLGregorianCalendar timestamp = null;
65 brianR 91
 
92
    /**
93
     * Java runtime version.
94
     */
95
    @XmlElement(name="jvmversion")
96
    public String jvmruntime = System.getProperty("java.version");
6 brianR 97
}