|
1 /* |
|
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. Oracle designates this |
|
8 * particular file as subject to the "Classpath" exception as provided |
|
9 * by Oracle in the LICENSE file that accompanied this code. |
|
10 * |
|
11 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 * version 2 for more details (a copy is included in the LICENSE file that |
|
15 * accompanied this code). |
|
16 * |
|
17 * You should have received a copy of the GNU General Public License version |
|
18 * 2 along with this work; if not, write to the Free Software Foundation, |
|
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 * |
|
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
22 * or visit www.oracle.com if you need additional information or have any |
|
23 * questions. |
|
24 */ |
|
25 |
|
26 package com.sun.xml.internal.ws.api.pipe; |
|
27 |
|
28 import javax.xml.ws.Dispatch; |
|
29 |
|
30 import com.sun.xml.internal.ws.api.message.Message; |
|
31 import com.sun.xml.internal.ws.api.message.Packet; |
|
32 import com.oracle.webservices.internal.api.message.BasePropertySet; |
|
33 import com.oracle.webservices.internal.api.message.PropertySet; |
|
34 |
|
35 /** |
|
36 * When using {@link Dispatch}<{@link Packet}> and the invocation completes with a Throwable, it is |
|
37 * useful to be able to inspect the Packet in addition to the Throwable as the Packet contains |
|
38 * meta-data about the request and/or response. However, the default behavior is that the caller |
|
39 * only receives the Throwable. |
|
40 * |
|
41 * This {@link PropertySet} is part of the implementation that allows a completing Fiber to return |
|
42 * the Throwable to the caller as part of the Packet. |
|
43 * |
|
44 */ |
|
45 public class ThrowableContainerPropertySet extends BasePropertySet { |
|
46 |
|
47 public ThrowableContainerPropertySet(final Throwable throwable) { |
|
48 this.throwable = throwable; |
|
49 } |
|
50 |
|
51 //////////////////////////////////////////////////// |
|
52 // |
|
53 // The original throwable |
|
54 // |
|
55 public static final String FIBER_COMPLETION_THROWABLE = "com.sun.xml.internal.ws.api.pipe.fiber-completion-throwable"; |
|
56 private Throwable throwable; |
|
57 @Property(FIBER_COMPLETION_THROWABLE) |
|
58 public Throwable getThrowable() { |
|
59 return throwable; |
|
60 } |
|
61 public void setThrowable(final Throwable throwable) { |
|
62 this.throwable = throwable; |
|
63 } |
|
64 |
|
65 //////////////////////////////////////////////////// |
|
66 // |
|
67 // The FAULT message created in WsaServerTube or WSEndpointImpl |
|
68 // |
|
69 public static final String FAULT_MESSAGE = "com.sun.xml.internal.ws.api.pipe.fiber-completion-fault-message"; |
|
70 private Message faultMessage; |
|
71 @Property(FAULT_MESSAGE) |
|
72 public Message getFaultMessage() { |
|
73 return faultMessage; |
|
74 } |
|
75 public void setFaultMessage(final Message faultMessage) { |
|
76 this.faultMessage = faultMessage; |
|
77 } |
|
78 |
|
79 //////////////////////////////////////////////////// |
|
80 // |
|
81 // The response Packet seen in WsaServerTube.processException or WSEndpointImpl |
|
82 // |
|
83 public static final String RESPONSE_PACKET = "com.sun.xml.internal.ws.api.pipe.fiber-completion-response-packet"; |
|
84 private Packet responsePacket; |
|
85 @Property(RESPONSE_PACKET) |
|
86 public Packet getResponsePacket() { |
|
87 return responsePacket; |
|
88 } |
|
89 public void setResponsePacket(final Packet responsePacket) { |
|
90 this.responsePacket = responsePacket; |
|
91 } |
|
92 |
|
93 //////////////////////////////////////////////////// |
|
94 // |
|
95 // If the fault representation of the exception has already been created |
|
96 // |
|
97 public static final String IS_FAULT_CREATED = "com.sun.xml.internal.ws.api.pipe.fiber-completion-is-fault-created"; |
|
98 private boolean isFaultCreated = false; |
|
99 @Property(IS_FAULT_CREATED) |
|
100 public boolean isFaultCreated() { |
|
101 return isFaultCreated; |
|
102 } |
|
103 public void setFaultCreated(final boolean isFaultCreated) { |
|
104 this.isFaultCreated = isFaultCreated; |
|
105 } |
|
106 |
|
107 // |
|
108 // boilerplate |
|
109 // |
|
110 |
|
111 @Override |
|
112 protected PropertyMap getPropertyMap() { |
|
113 return model; |
|
114 } |
|
115 |
|
116 private static final PropertyMap model; |
|
117 static { |
|
118 model = parse(ThrowableContainerPropertySet.class); |
|
119 } |
|
120 } |