ohair@286: /* alanb@368: * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. ohair@286: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ohair@286: * ohair@286: * This code is free software; you can redistribute it and/or modify it ohair@286: * under the terms of the GNU General Public License version 2 only, as ohair@286: * published by the Free Software Foundation. Oracle designates this ohair@286: * particular file as subject to the "Classpath" exception as provided ohair@286: * by Oracle in the LICENSE file that accompanied this code. ohair@286: * ohair@286: * This code is distributed in the hope that it will be useful, but WITHOUT ohair@286: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ohair@286: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ohair@286: * version 2 for more details (a copy is included in the LICENSE file that ohair@286: * accompanied this code). ohair@286: * ohair@286: * You should have received a copy of the GNU General Public License version ohair@286: * 2 along with this work; if not, write to the Free Software Foundation, ohair@286: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ohair@286: * ohair@286: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ohair@286: * or visit www.oracle.com if you need additional information or have any ohair@286: * questions. ohair@286: */ ohair@286: ohair@286: package com.sun.xml.internal.ws.handler; ohair@286: ohair@286: import com.sun.xml.internal.ws.api.message.Message; ohair@286: import com.sun.xml.internal.ws.api.message.Packet; ohair@286: import java.util.Collection; ohair@286: import java.util.Map; ohair@286: import java.util.Set; ohair@286: import javax.xml.ws.handler.MessageContext; ohair@286: ohair@286: /** ohair@286: * The class represents a MessageContext(Properties) and also allows the Message to be modified. ohair@286: * This is extended by SOAPMessageContextImpl and LogicalMessageContextImpl. ohair@286: * ohair@286: * @author WS Development Team ohair@286: */ ohair@286: public abstract class MessageUpdatableContext implements MessageContext { ohair@286: final Packet packet; ohair@286: private MessageContextImpl ctxt; ohair@286: /** Creates a new instance of MessageUpdatableContext */ ohair@286: public MessageUpdatableContext(Packet packet) { ohair@286: ctxt = new MessageContextImpl(packet); ohair@286: this.packet = packet; ohair@286: } ohair@286: ohair@286: /** ohair@286: * Updates Message in the packet with user modifications ohair@286: */ ohair@286: abstract void updateMessage(); ohair@286: ohair@286: /** ohair@286: * Updates Message in the packet with user modifications ohair@286: * returns the new packet's message ohair@286: */ ohair@286: Message getPacketMessage(){ ohair@286: updateMessage(); ohair@286: return packet.getMessage(); ohair@286: } ohair@286: ohair@286: /** ohair@286: * Sets Message in the packet ohair@286: * Any user modifications done on previous Message are lost. ohair@286: */ ohair@286: abstract void setPacketMessage(Message newMessage); ohair@286: ohair@286: /** ohair@286: * Updates the complete packet with user modfications to the message and ohair@286: * properties cahnges in MessageContext ohair@286: */ ohair@286: public final void updatePacket() { ohair@286: updateMessage(); ohair@286: } ohair@286: ohair@286: MessageContextImpl getMessageContext() { ohair@286: return ctxt; ohair@286: } ohair@286: ohair@286: public void setScope(String name, Scope scope) { ohair@286: ctxt.setScope(name, scope); ohair@286: } ohair@286: ohair@286: public Scope getScope(String name) { ohair@286: return ctxt.getScope(name); ohair@286: } ohair@286: ohair@286: /* java.util.Map methods below here */ ohair@286: ohair@286: public void clear() { ohair@286: ctxt.clear(); ohair@286: } ohair@286: ohair@286: public boolean containsKey(Object obj) { ohair@286: return ctxt.containsKey(obj); ohair@286: } ohair@286: ohair@286: public boolean containsValue(Object obj) { ohair@286: return ctxt.containsValue(obj); ohair@286: } ohair@286: ohair@286: public Set> entrySet() { ohair@286: return ctxt.entrySet(); ohair@286: } ohair@286: ohair@286: public Object get(Object obj) { ohair@286: return ctxt.get(obj); ohair@286: } ohair@286: ohair@286: public boolean isEmpty() { ohair@286: return ctxt.isEmpty(); ohair@286: } ohair@286: ohair@286: public Set keySet() { ohair@286: return ctxt.keySet(); ohair@286: } ohair@286: ohair@286: public Object put(String str, Object obj) { ohair@286: return ctxt.put(str, obj); ohair@286: } ohair@286: ohair@286: public void putAll(Map map) { ohair@286: ctxt.putAll(map); ohair@286: } ohair@286: ohair@286: public Object remove(Object obj) { ohair@286: return ctxt.remove(obj); ohair@286: } ohair@286: ohair@286: public int size() { ohair@286: return ctxt.size(); ohair@286: } ohair@286: ohair@286: public Collection values() { ohair@286: return ctxt.values(); ohair@286: } ohair@286: ohair@286: }