001: /*
002: * Portions Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025: package com.sun.xml.internal.ws.client;
026:
027: import com.sun.xml.internal.ws.pept.Delegate;
028: import com.sun.xml.internal.ws.pept.ept.MessageInfo;
029: import com.sun.xml.internal.ws.binding.BindingImpl;
030: import com.sun.xml.internal.ws.spi.runtime.ClientTransportFactory;
031: import com.sun.xml.internal.ws.transport.http.client.HttpClientTransportFactory;
032:
033: import javax.xml.ws.Binding;
034: import javax.xml.ws.BindingProvider;
035:
036: import java.util.Map;
037:
038: /**
039: * @author WS Development Team
040: */
041: public class EndpointIFBase implements
042: com.sun.xml.internal.ws.pept.presentation.Stub,
043: com.sun.xml.internal.ws.spi.runtime.StubBase, BindingProvider,
044: InternalBindingProvider {
045:
046: protected Map<String, Object> _requestContext;
047: protected Map<String, Object> _responseContext;
048:
049: protected String _bindingId = null;
050: protected Delegate _delegate = null;
051: protected BindingImpl binding;
052:
053: private ClientTransportFactory _transportFactory;
054:
055: void setResponseContext(ResponseContext context) {
056: _responseContext = context;
057: }
058:
059: public void _setDelegate(Delegate delegate) {
060: _delegate = delegate;
061: }
062:
063: public Delegate _getDelegate() {
064: return _delegate;
065: }
066:
067: public ClientTransportFactory _getTransportFactory() {
068: _transportFactory = (com.sun.xml.internal.ws.spi.runtime.ClientTransportFactory) getRequestContext()
069: .get(BindingProviderProperties.CLIENT_TRANSPORT_FACTORY);
070:
071: if (_transportFactory == null) {
072: _transportFactory = new HttpClientTransportFactory();
073: }
074: return _transportFactory;
075: }
076:
077: public void _setTransportFactory(ClientTransportFactory f) {
078: getRequestContext().put(
079: BindingProviderProperties.CLIENT_TRANSPORT_FACTORY, f);
080: _transportFactory = f;
081: }
082:
083: //toDo: have to update generator on PeptStub to getContext
084: public void updateResponseContext(MessageInfo messageInfo) {
085: ResponseContext responseContext = (ResponseContext) messageInfo
086: .getMetaData(BindingProviderProperties.JAXWS_RESPONSE_CONTEXT_PROPERTY);
087: if (responseContext != null) { // null in async case
088: setResponseContext(responseContext);
089: }
090: }
091:
092: /**
093: * Get the JAXWSContext that is used in processing request messages.
094: * <p/>
095: * Modifications to the request context do not affect asynchronous
096: * operations that have already been started.
097: *
098: * @return The JAXWSContext that is used in processing request messages.
099: */
100: public Map<String, Object> getRequestContext() {
101: if (_requestContext == null)
102: _requestContext = new RequestContext(this );
103:
104: return _requestContext;
105: }
106:
107: /**
108: * Get the JAXWSContext that resulted from processing a response message.
109: * <p/>
110: * The returned context is for the most recently completed synchronous
111: * operation. Subsequent synchronous operation invocations overwrite the
112: * response context. Asynchronous operations return their response context
113: * via the Response interface.
114: *
115: * @return The JAXWSContext that is used in processing request messages.
116: */
117: public Map<String, Object> getResponseContext() {
118: if (_responseContext == null)
119: _responseContext = new ResponseContext(this );
120: return _responseContext;
121: }
122:
123: public Binding getBinding() {
124: return binding;
125: }
126:
127: public void _setBinding(BindingImpl binding) {
128: this .binding = binding;
129: }
130:
131: /**
132: * returns binding id from BindingImpl
133: *
134: * @return the String representing the BindingID
135: */
136: public String _getBindingId() {
137: return _bindingId;
138: }
139:
140: }
|