Subversion Repositories XServices

Rev

Rev 46 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 46 Rev 65
1
/*
1
/*
2
 *   Copyright 2010 Brian Rosenberger (Brutex Network)
2
 *   Copyright 2010 Brian Rosenberger (Brutex Network)
3
 *
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with 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
6
 *   You may obtain a copy of the License at
7
 *
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
14
 *   limitations under the License.
15
 */
15
 */
16
 
16
 
17
package net.brutex.xservices.ws;
17
package net.brutex.xservices.ws;
18
 
18
 
19
import java.util.GregorianCalendar;
19
import java.util.GregorianCalendar;
20
import javax.xml.bind.annotation.XmlElement;
20
import javax.xml.bind.annotation.XmlElement;
-
 
21
import javax.xml.bind.annotation.XmlRootElement;
-
 
22
import javax.xml.bind.annotation.XmlType;
21
import javax.xml.datatype.DatatypeConfigurationException;
23
import javax.xml.datatype.DatatypeConfigurationException;
22
import javax.xml.datatype.DatatypeFactory;
24
import javax.xml.datatype.DatatypeFactory;
23
import javax.xml.datatype.XMLGregorianCalendar;
25
import javax.xml.datatype.XMLGregorianCalendar;
-
 
26
import javax.xml.ws.WebFault;
-
 
27
 
-
 
28
import net.brutex.xservices.util.BrutexNamespaces;
24
 
29
 
25
/**
30
/**
26
 *
31
 *
27
 * @author Brian Rosenberger, bru@brutex.de
32
 * @author Brian Rosenberger, bru@brutex.de
28
 */
33
 */
-
 
34
@WebFault(targetNamespace=BrutexNamespaces.WS_XSERVICES)
29
public class XServicesFault extends Exception {
35
public class XServicesFault extends Exception {
30
 
36
 
31
    /**
37
    /**
32
	 * 
38
	 * 
33
	 */
39
	 */
34
	private static final long serialVersionUID = -6779279189376374820L;
40
	private static final long serialVersionUID = -6779279189376374820L;
35
 
41
 
36
	public XServicesFault(String message, Exception e) {
42
	public XServicesFault(String message, Exception e) {
37
        this(message, e.getCause());
43
        this(message, e.getCause());
38
    }
44
    }
39
 
45
 
40
    public XServicesFault(String string) {
46
    public XServicesFault(String string) {
41
        this(string, new Exception(string).getCause());
47
        this(string, new Exception(string).getCause());
42
    }
48
    }
43
 
49
 
44
    public XServicesFault(Exception e) {
50
    public XServicesFault(Exception e) {
45
        this(e.getMessage(), e.getCause());
51
        this(e.getMessage(), e.getCause());
46
    }
52
    }
47
 
53
 
48
    public XServicesFault(String message, Throwable cause) {
54
    public XServicesFault(String message, Throwable cause) {
49
        super(message, cause);
55
        super(message, cause);
50
        this.faultstring=message;
56
        this.faultstring=message;
51
 
57
 
52
       
58
       
53
        try {
59
        try {
54
            timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
60
            timestamp = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
55
        } catch (DatatypeConfigurationException ex) {
61
        } catch (DatatypeConfigurationException ex) {
56
            System.err.println(ex.getMessage());
62
            System.err.println(ex.getMessage());
57
        }
63
        }
58
 
64
 
59
 
65
 
60
    }
66
    }
-
 
67
    /**
-
 
68
     * The error message.
-
 
69
     */
61
    @XmlElement(name="faultstring")
70
    @XmlElement(name="faultstring", namespace=BrutexNamespaces.WS_XSERVICES)
62
    public String faultstring = "";
71
    public String faultstring = "";
-
 
72
 
-
 
73
    /**
-
 
74
     * Username under which the web service has been executed.
63
 
75
     */
64
    @XmlElement(name="username")
76
    @XmlElement(name="username", namespace=BrutexNamespaces.WS_XSERVICES)
-
 
77
    public String username = System.getProperty("user.name");
-
 
78
 
-
 
79
    /**
65
    public String username = System.getProperty("user.name");
80
     * Home directory of the user profile running the web service.
66
 
81
     */
-
 
82
    @XmlElement(name="homedir", namespace=BrutexNamespaces.WS_XSERVICES)
-
 
83
    public String homedir = System.getProperty("user.home");
-
 
84
 
-
 
85
    
67
    @XmlElement(name="homedir")
86
    /**
68
    public String homedir = System.getProperty("user.home");
87
     * Timestamp when the fault was thrown.
-
 
88
     */
-
 
89
    @XmlElement(name="timstamp", namespace=BrutexNamespaces.WS_XSERVICES)
-
 
90
    public XMLGregorianCalendar timestamp = null;
-
 
91
    
-
 
92
    /**
-
 
93
     * Java runtime version.
69
 
94
     */
70
    @XmlElement(name="timstamp")
95
    @XmlElement(name="jvmversion")
71
    public XMLGregorianCalendar timestamp = null;
96
    public String jvmruntime = System.getProperty("java.version");
72
}
97
}