Sat, 07 Nov 2020 10:30:02 +0800
Added tag mips-jdk8u275-b01 for changeset fdbe50121f48
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 */
26 package com.sun.xml.internal.ws.handler;
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;
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 }
50 /**
51 * Updates Message in the packet with user modifications
52 */
53 abstract void updateMessage();
55 /**
56 * Updates Message in the packet with user modifications
57 * returns the new packet's message
58 */
59 Message getPacketMessage(){
60 updateMessage();
61 return packet.getMessage();
62 }
64 /**
65 * Sets Message in the packet
66 * Any user modifications done on previous Message are lost.
67 */
68 abstract void setPacketMessage(Message newMessage);
70 /**
71 * Updates the complete packet with user modfications to the message and
72 * properties cahnges in MessageContext
73 */
74 public final void updatePacket() {
75 updateMessage();
76 }
78 MessageContextImpl getMessageContext() {
79 return ctxt;
80 }
82 public void setScope(String name, Scope scope) {
83 ctxt.setScope(name, scope);
84 }
86 public Scope getScope(String name) {
87 return ctxt.getScope(name);
88 }
90 /* java.util.Map methods below here */
92 public void clear() {
93 ctxt.clear();
94 }
96 public boolean containsKey(Object obj) {
97 return ctxt.containsKey(obj);
98 }
100 public boolean containsValue(Object obj) {
101 return ctxt.containsValue(obj);
102 }
104 public Set<Entry<String, Object>> entrySet() {
105 return ctxt.entrySet();
106 }
108 public Object get(Object obj) {
109 return ctxt.get(obj);
110 }
112 public boolean isEmpty() {
113 return ctxt.isEmpty();
114 }
116 public Set<String> keySet() {
117 return ctxt.keySet();
118 }
120 public Object put(String str, Object obj) {
121 return ctxt.put(str, obj);
122 }
124 public void putAll(Map<? extends String, ? extends Object> map) {
125 ctxt.putAll(map);
126 }
128 public Object remove(Object obj) {
129 return ctxt.remove(obj);
130 }
132 public int size() {
133 return ctxt.size();
134 }
136 public Collection<Object> values() {
137 return ctxt.values();
138 }
140 }