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;
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
 
46 brianR 31
    /**
32
	 *
33
	 */
34
	private static final long serialVersionUID = -6779279189376374820L;
35
 
36
	public XServicesFault(String message, Exception e) {
6 brianR 37
        this(message, e.getCause());
38
    }
39
 
40
    public XServicesFault(String string) {
41
        this(string, new Exception(string).getCause());
42
    }
43
 
44
    public XServicesFault(Exception e) {
45
        this(e.getMessage(), e.getCause());
46
    }
47
 
48
    public XServicesFault(String message, Throwable cause) {
49
        super(message, cause);
50
        this.faultstring=message;
51
 
52
 
53
        try {
54
            timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
55
        } catch (DatatypeConfigurationException ex) {
56
            System.err.println(ex.getMessage());
57
        }
58
 
59
 
60
    }
61
    @XmlElement(name="faultstring")
62
    public String faultstring = "";
63
 
64
    @XmlElement(name="username")
65
    public String username = System.getProperty("user.name");
66
 
67
    @XmlElement(name="homedir")
68
    public String homedir = System.getProperty("user.home");
69
 
70
    @XmlElement(name="timstamp")
71
    public XMLGregorianCalendar timestamp = null;
72
}