Subversion Repositories XServices

Rev

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