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;
21
import javax.xml.datatype.DatatypeConfigurationException;
22
import javax.xml.datatype.DatatypeFactory;
23
import javax.xml.datatype.XMLGregorianCalendar;
24
 
25
/**
26
 *
27
 * @author Brian Rosenberger, bru@brutex.de
28
 */
29
public class XServicesFault extends Exception {
30
 
31
    public XServicesFault(String message, Exception e) {
32
        this(message, e.getCause());
33
    }
34
 
35
    public XServicesFault(String string) {
36
        this(string, new Exception(string).getCause());
37
    }
38
 
39
    public XServicesFault(Exception e) {
40
        this(e.getMessage(), e.getCause());
41
    }
42
 
43
    public XServicesFault(String message, Throwable cause) {
44
        super(message, cause);
45
        this.faultstring=message;
46
 
47
 
48
        try {
49
            timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
50
        } catch (DatatypeConfigurationException ex) {
51
            System.err.println(ex.getMessage());
52
        }
53
 
54
 
55
    }
56
    @XmlElement(name="faultstring")
57
    public String faultstring = "";
58
 
59
    @XmlElement(name="username")
60
    public String username = System.getProperty("user.name");
61
 
62
    @XmlElement(name="homedir")
63
    public String homedir = System.getProperty("user.home");
64
 
65
    @XmlElement(name="timstamp")
66
    public XMLGregorianCalendar timestamp = null;
67
}