src/share/jaxws_classes/com/sun/xml/internal/ws/handler/MessageUpdatableContext.java

changeset 286
f50545b5e2f1
child 368
0989ad8c0860
equal deleted inserted replaced
284:88b85470e72c 286:f50545b5e2f1
1 /*
2 * Copyright (c) 1997, 2010, 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.handler;
27
28 import com.sun.xml.internal.ws.api.message.Message;
29 import com.sun.xml.internal.ws.api.message.Packet;
30 import java.util.Collection;
31 import java.util.Map;
32 import java.util.Set;
33 import javax.xml.ws.handler.MessageContext;
34
35 /**
36 * The class represents a MessageContext(Properties) and also allows the Message to be modified.
37 * This is extended by SOAPMessageContextImpl and LogicalMessageContextImpl.
38 *
39 * @author WS Development Team
40 */
41 public abstract class MessageUpdatableContext implements MessageContext {
42 final Packet packet;
43 private MessageContextImpl ctxt;
44 /** Creates a new instance of MessageUpdatableContext */
45 public MessageUpdatableContext(Packet packet) {
46 ctxt = new MessageContextImpl(packet);
47 this.packet = packet;
48 }
49
50 /**
51 * Fill a {@link Packet} with values of this {@link MessageContext}.
52 */
53 private void fill(Packet packet) {
54 ctxt.fill(packet);
55 }
56 /**
57 * Updates Message in the packet with user modifications
58 */
59 abstract void updateMessage();
60
61 /**
62 * Updates Message in the packet with user modifications
63 * returns the new packet's message
64 */
65 Message getPacketMessage(){
66 updateMessage();
67 return packet.getMessage();
68 }
69
70 /**
71 * Sets Message in the packet
72 * Any user modifications done on previous Message are lost.
73 */
74 abstract void setPacketMessage(Message newMessage);
75
76 /**
77 * Updates the complete packet with user modfications to the message and
78 * properties cahnges in MessageContext
79 */
80 public final void updatePacket() {
81 updateMessage();
82 fill(packet);
83 }
84
85 MessageContextImpl getMessageContext() {
86 return ctxt;
87 }
88
89 public void setScope(String name, Scope scope) {
90 ctxt.setScope(name, scope);
91 }
92
93 public Scope getScope(String name) {
94 return ctxt.getScope(name);
95 }
96
97 /* java.util.Map methods below here */
98
99 public void clear() {
100 ctxt.clear();
101 }
102
103 public boolean containsKey(Object obj) {
104 return ctxt.containsKey(obj);
105 }
106
107 public boolean containsValue(Object obj) {
108 return ctxt.containsValue(obj);
109 }
110
111 public Set<Entry<String, Object>> entrySet() {
112 return ctxt.entrySet();
113 }
114
115 public Object get(Object obj) {
116 return ctxt.get(obj);
117 }
118
119 public boolean isEmpty() {
120 return ctxt.isEmpty();
121 }
122
123 public Set<String> keySet() {
124 return ctxt.keySet();
125 }
126
127 public Object put(String str, Object obj) {
128 return ctxt.put(str, obj);
129 }
130
131 public void putAll(Map<? extends String, ? extends Object> map) {
132 ctxt.putAll(map);
133 }
134
135 public Object remove(Object obj) {
136 return ctxt.remove(obj);
137 }
138
139 public int size() {
140 return ctxt.size();
141 }
142
143 public Collection<Object> values() {
144 return ctxt.values();
145 }
146
147 }

mercurial